diff options
Diffstat (limited to 'tests')
2508 files changed, 24937 insertions, 11454 deletions
diff --git a/tests/assembly/asm/aarch64-modifiers.rs b/tests/assembly/asm/aarch64-modifiers.rs index a3956d21a06..58f7c114d3a 100644 --- a/tests/assembly/asm/aarch64-modifiers.rs +++ b/tests/assembly/asm/aarch64-modifiers.rs @@ -1,6 +1,6 @@ //@ add-core-stubs //@ assembly-output: emit-asm -//@ compile-flags: -O -C panic=abort +//@ compile-flags: -Copt-level=3 -C panic=abort //@ compile-flags: --target aarch64-unknown-linux-gnu //@ compile-flags: -Zmerge-functions=disabled //@ needs-llvm-components: aarch64 @@ -15,7 +15,7 @@ use minicore::*; macro_rules! check { ($func:ident $reg:ident $code:literal) => { - // -O and extern "C" guarantee that the selected register is always r0/s0/d0/q0 + // -Copt-level=3 and extern "C" guarantee that the selected register is always r0/s0/d0/q0 #[no_mangle] pub unsafe extern "C" fn $func() -> i32 { let y; diff --git a/tests/assembly/asm/aarch64-outline-atomics.rs b/tests/assembly/asm/aarch64-outline-atomics.rs index 46586f0f31c..5990fb84942 100644 --- a/tests/assembly/asm/aarch64-outline-atomics.rs +++ b/tests/assembly/asm/aarch64-outline-atomics.rs @@ -1,5 +1,5 @@ //@ assembly-output: emit-asm -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ compile-flags: --target aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 //@ only-aarch64 diff --git a/tests/assembly/asm/aarch64-types.rs b/tests/assembly/asm/aarch64-types.rs index 439385b14b0..8e4e0850325 100644 --- a/tests/assembly/asm/aarch64-types.rs +++ b/tests/assembly/asm/aarch64-types.rs @@ -11,8 +11,6 @@ #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -// FIXME(f16_f128): Only needed for FIXME in check! and check_reg! -#![feature(auto_traits, lang_items)] extern crate minicore; use minicore::*; @@ -63,12 +61,6 @@ impl Copy for f16x8 {} impl Copy for f32x4 {} impl Copy for f64x2 {} -// FIXME(f16_f128): Only needed for FIXME in check! and check_reg! -#[lang = "freeze"] -unsafe auto trait Freeze {} -#[lang = "unpin"] -auto trait Unpin {} - extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/assembly/asm/arm-modifiers.rs b/tests/assembly/asm/arm-modifiers.rs index 562b6bed74c..32a36840492 100644 --- a/tests/assembly/asm/arm-modifiers.rs +++ b/tests/assembly/asm/arm-modifiers.rs @@ -1,6 +1,6 @@ //@ add-core-stubs //@ assembly-output: emit-asm -//@ compile-flags: -O -C panic=abort +//@ compile-flags: -Copt-level=3 -C panic=abort //@ compile-flags: --target armv7-unknown-linux-gnueabihf //@ compile-flags: -C target-feature=+neon //@ compile-flags: -Zmerge-functions=disabled @@ -21,7 +21,7 @@ impl Copy for f32x4 {} macro_rules! check { ($func:ident $modifier:literal $reg:ident $ty:ident $mov:literal) => { - // -O and extern "C" guarantee that the selected register is always r0/s0/d0/q0 + // -Copt-level=3 and extern "C" guarantee that the selected register is always r0/s0/d0/q0 #[no_mangle] pub unsafe extern "C" fn $func() -> $ty { let y; diff --git a/tests/assembly/asm/x86-modifiers.rs b/tests/assembly/asm/x86-modifiers.rs index 53e4b92f84a..5f68e5c7317 100644 --- a/tests/assembly/asm/x86-modifiers.rs +++ b/tests/assembly/asm/x86-modifiers.rs @@ -1,7 +1,7 @@ //@ add-core-stubs //@ revisions: x86_64 i686 //@ assembly-output: emit-asm -//@ compile-flags: -O -C panic=abort +//@ compile-flags: -Copt-level=3 -C panic=abort //@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu //@[x86_64] needs-llvm-components: x86 //@[i686] compile-flags: --target i686-unknown-linux-gnu @@ -20,7 +20,7 @@ use minicore::*; macro_rules! check { ($func:ident $modifier:literal $reg:ident $mov:literal) => { - // -O and extern "C" guarantee that the selected register is always ax/xmm0 + // -Copt-level=3 and extern "C" guarantee that the selected register is always ax/xmm0 #[no_mangle] pub unsafe extern "C" fn $func() -> i32 { let y; diff --git a/tests/assembly/auxiliary/dwarf-mixed-versions-lto-aux.rs b/tests/assembly/auxiliary/dwarf-mixed-versions-lto-aux.rs new file mode 100644 index 00000000000..faff6e7e2d0 --- /dev/null +++ b/tests/assembly/auxiliary/dwarf-mixed-versions-lto-aux.rs @@ -0,0 +1,5 @@ +//@ compile-flags: -g --crate-type=rlib -Zdwarf-version=4 + +pub fn check_is_even(number: &u64) -> bool { + number % 2 == 0 +} diff --git a/tests/assembly/closure-inherit-target-feature.rs b/tests/assembly/closure-inherit-target-feature.rs index 4692653d91f..069204bbd34 100644 --- a/tests/assembly/closure-inherit-target-feature.rs +++ b/tests/assembly/closure-inherit-target-feature.rs @@ -4,13 +4,13 @@ // make sure the feature is not enabled at compile-time //@ compile-flags: -C opt-level=3 -C target-feature=-sse4.1 -C llvm-args=-x86-asm-syntax=intel -#![feature(target_feature_11)] #![crate_type = "rlib"] use std::arch::x86_64::{__m128, _mm_blend_ps}; +// Use an explicit return pointer to prevent tail call optimization. #[no_mangle] -pub unsafe fn sse41_blend_nofeature(x: __m128, y: __m128) -> __m128 { +pub unsafe fn sse41_blend_nofeature(x: __m128, y: __m128, ret: *mut __m128) { let f = { // check that _mm_blend_ps is not being inlined into the closure // CHECK-LABEL: {{sse41_blend_nofeature.*closure.*:}} @@ -19,9 +19,9 @@ pub unsafe fn sse41_blend_nofeature(x: __m128, y: __m128) -> __m128 { // CHECK-NOT: blendps // CHECK: ret #[inline(never)] - |x, y| _mm_blend_ps(x, y, 0b0101) + |x, y, ret: *mut __m128| unsafe { *ret = _mm_blend_ps(x, y, 0b0101) } }; - f(x, y) + f(x, y, ret); } #[no_mangle] diff --git a/tests/assembly/dwarf-mixed-versions-lto.rs b/tests/assembly/dwarf-mixed-versions-lto.rs new file mode 100644 index 00000000000..5b8e5ff4f4a --- /dev/null +++ b/tests/assembly/dwarf-mixed-versions-lto.rs @@ -0,0 +1,19 @@ +// This test ensures that if LTO occurs between crates with different DWARF versions, we +// will choose the highest DWARF version for the final binary. This matches Clang's behavior. + +//@ only-linux +//@ aux-build:dwarf-mixed-versions-lto-aux.rs +//@ compile-flags: -C lto -g -Zdwarf-version=5 +//@ assembly-output: emit-asm +//@ no-prefer-dynamic + +extern crate dwarf_mixed_versions_lto_aux; + +fn main() { + dwarf_mixed_versions_lto_aux::check_is_even(&0); +} + +// CHECK: .section .debug_info +// CHECK-NOT: {{\.(short|hword)}} 2 +// CHECK-NOT: {{\.(short|hword)}} 4 +// CHECK: {{\.(short|hword)}} 5 diff --git a/tests/assembly/libs/issue-115339-zip-arrays.rs b/tests/assembly/libs/issue-115339-zip-arrays.rs index 956459b2c77..098382502e8 100644 --- a/tests/assembly/libs/issue-115339-zip-arrays.rs +++ b/tests/assembly/libs/issue-115339-zip-arrays.rs @@ -1,6 +1,6 @@ //@ assembly-output: emit-asm // # zen3 previously exhibited odd vectorization -//@ compile-flags: --crate-type=lib -Ctarget-cpu=znver3 -O +//@ compile-flags: --crate-type=lib -Ctarget-cpu=znver3 -Copt-level=3 //@ only-x86_64 //@ ignore-sgx diff --git a/tests/assembly/manual-eq-efficient.rs b/tests/assembly/manual-eq-efficient.rs index 817ce94f476..8dafed354be 100644 --- a/tests/assembly/manual-eq-efficient.rs +++ b/tests/assembly/manual-eq-efficient.rs @@ -1,6 +1,6 @@ // Regression test for #106269 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel +//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel //@ only-x86_64 //@ ignore-sgx diff --git a/tests/assembly/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs b/tests/assembly/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs index fb3a325a41f..b3bfc66a5a5 100644 --- a/tests/assembly/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs +++ b/tests/assembly/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs @@ -242,22 +242,6 @@ pub unsafe extern "ptx-kernel" fn f_float_array_arg(_a: [f32; 5]) {} //pub unsafe extern "ptx-kernel" fn f_u128_array_arg(_a: [u128; 5]) {} // CHECK: .visible .entry f_u32_slice_arg( -// CHECK: .param .u64 f_u32_slice_arg_param_0 -// CHECK: .param .u64 f_u32_slice_arg_param_1 +// CHECK: .param .align 8 .b8 f_u32_slice_arg_param_0[16] #[no_mangle] pub unsafe extern "ptx-kernel" fn f_u32_slice_arg(_a: &[u32]) {} - -// CHECK: .visible .entry f_tuple_u8_u8_arg( -// CHECK: .param .align 1 .b8 f_tuple_u8_u8_arg_param_0[2] -#[no_mangle] -pub unsafe extern "ptx-kernel" fn f_tuple_u8_u8_arg(_a: (u8, u8)) {} - -// CHECK: .visible .entry f_tuple_u32_u32_arg( -// CHECK: .param .align 4 .b8 f_tuple_u32_u32_arg_param_0[8] -#[no_mangle] -pub unsafe extern "ptx-kernel" fn f_tuple_u32_u32_arg(_a: (u32, u32)) {} - -// CHECK: .visible .entry f_tuple_u8_u8_u32_arg( -// CHECK: .param .align 4 .b8 f_tuple_u8_u8_u32_arg_param_0[8] -#[no_mangle] -pub unsafe extern "ptx-kernel" fn f_tuple_u8_u8_u32_arg(_a: (u8, u8, u32)) {} diff --git a/tests/assembly/panic-no-unwind-no-uwtable.rs b/tests/assembly/panic-no-unwind-no-uwtable.rs index 24626280155..b51b173e961 100644 --- a/tests/assembly/panic-no-unwind-no-uwtable.rs +++ b/tests/assembly/panic-no-unwind-no-uwtable.rs @@ -1,6 +1,6 @@ //@ assembly-output: emit-asm //@ only-x86_64-unknown-linux-gnu -//@ compile-flags: -C panic=unwind -C force-unwind-tables=n -O +//@ compile-flags: -C panic=unwind -C force-unwind-tables=n -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/assembly/powerpc64-struct-abi.rs b/tests/assembly/powerpc64-struct-abi.rs index db08a514819..0332eb94d8a 100644 --- a/tests/assembly/powerpc64-struct-abi.rs +++ b/tests/assembly/powerpc64-struct-abi.rs @@ -1,6 +1,6 @@ //@ revisions: elfv1-be elfv2-be elfv2-le aix //@ assembly-output: emit-asm -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@[elfv1-be] compile-flags: --target powerpc64-unknown-linux-gnu //@[elfv1-be] needs-llvm-components: powerpc //@[elfv2-be] compile-flags: --target powerpc64-unknown-linux-musl diff --git a/tests/assembly/s390x-backchain-toggle.rs b/tests/assembly/s390x-backchain-toggle.rs index 8b6d0cf2123..7ef0292d911 100644 --- a/tests/assembly/s390x-backchain-toggle.rs +++ b/tests/assembly/s390x-backchain-toggle.rs @@ -1,6 +1,6 @@ //@ revisions: enable-backchain disable-backchain //@ assembly-output: emit-asm -//@ compile-flags: -O --crate-type=lib --target=s390x-unknown-linux-gnu +//@ compile-flags: -Copt-level=3 --crate-type=lib --target=s390x-unknown-linux-gnu //@ needs-llvm-components: systemz //@[enable-backchain] compile-flags: -Ctarget-feature=+backchain //@[disable-backchain] compile-flags: -Ctarget-feature=-backchain diff --git a/tests/assembly/s390x-vector-abi.rs b/tests/assembly/s390x-vector-abi.rs index c1935582561..7d86559c002 100644 --- a/tests/assembly/s390x-vector-abi.rs +++ b/tests/assembly/s390x-vector-abi.rs @@ -1,7 +1,7 @@ //@ revisions: z10 z10_vector z13 z13_no_vector // ignore-tidy-linelength //@ assembly-output: emit-asm -//@ compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled //@[z10] compile-flags: --target s390x-unknown-linux-gnu --cfg no_vector //@[z10] needs-llvm-components: systemz //@[z10_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-feature=+vector diff --git a/tests/assembly/simd-bitmask.rs b/tests/assembly/simd-bitmask.rs index 9a355cc162f..4a829c4dd98 100644 --- a/tests/assembly/simd-bitmask.rs +++ b/tests/assembly/simd-bitmask.rs @@ -10,7 +10,7 @@ //@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu //@ [aarch64] needs-llvm-components: aarch64 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd-intrinsic-gather.rs b/tests/assembly/simd-intrinsic-gather.rs index 29b0df64065..3152de35f29 100644 --- a/tests/assembly/simd-intrinsic-gather.rs +++ b/tests/assembly/simd-intrinsic-gather.rs @@ -3,7 +3,7 @@ //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq //@ [x86-avx512] needs-llvm-components: x86 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd-intrinsic-mask-load.rs b/tests/assembly/simd-intrinsic-mask-load.rs index 89b35ed7734..efe3e3752fa 100644 --- a/tests/assembly/simd-intrinsic-mask-load.rs +++ b/tests/assembly/simd-intrinsic-mask-load.rs @@ -6,7 +6,7 @@ //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq //@ [x86-avx512] needs-llvm-components: x86 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd-intrinsic-mask-reduce.rs b/tests/assembly/simd-intrinsic-mask-reduce.rs index 8ac55990c73..4d4adda6c24 100644 --- a/tests/assembly/simd-intrinsic-mask-reduce.rs +++ b/tests/assembly/simd-intrinsic-mask-reduce.rs @@ -7,7 +7,7 @@ //@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu //@ [aarch64] needs-llvm-components: aarch64 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd-intrinsic-mask-store.rs b/tests/assembly/simd-intrinsic-mask-store.rs index 1686fd5dd88..f5d924f24a7 100644 --- a/tests/assembly/simd-intrinsic-mask-store.rs +++ b/tests/assembly/simd-intrinsic-mask-store.rs @@ -6,7 +6,7 @@ //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq //@ [x86-avx512] needs-llvm-components: x86 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd-intrinsic-scatter.rs b/tests/assembly/simd-intrinsic-scatter.rs index 3f4d7569c59..5f52ababd19 100644 --- a/tests/assembly/simd-intrinsic-scatter.rs +++ b/tests/assembly/simd-intrinsic-scatter.rs @@ -3,7 +3,7 @@ //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq //@ [x86-avx512] needs-llvm-components: x86 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd-intrinsic-select.rs b/tests/assembly/simd-intrinsic-select.rs index 803abf2eeb3..74784a77213 100644 --- a/tests/assembly/simd-intrinsic-select.rs +++ b/tests/assembly/simd-intrinsic-select.rs @@ -8,7 +8,7 @@ //@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu //@ [aarch64] needs-llvm-components: aarch64 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd/reduce-fadd-unordered.rs b/tests/assembly/simd/reduce-fadd-unordered.rs index ade60ba184c..e872826f6ef 100644 --- a/tests/assembly/simd/reduce-fadd-unordered.rs +++ b/tests/assembly/simd/reduce-fadd-unordered.rs @@ -1,6 +1,7 @@ //@ revisions: x86_64 aarch64 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O +//@ compile-flags: --crate-type=lib -Copt-level=3 + //@[aarch64] only-aarch64 //@[x86_64] only-x86_64 //@[x86_64] compile-flags: -Ctarget-feature=+sse3 diff --git a/tests/assembly/slice-is_ascii.rs b/tests/assembly/slice-is_ascii.rs index 3a050347d89..e53cd5160cf 100644 --- a/tests/assembly/slice-is_ascii.rs +++ b/tests/assembly/slice-is_ascii.rs @@ -2,7 +2,7 @@ //@ [WIN] only-windows //@ [LIN] only-linux //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel +//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel //@ only-x86_64 //@ ignore-sgx diff --git a/tests/assembly/small_data_threshold.rs b/tests/assembly/small_data_threshold.rs index d3ba144600e..bed515915b8 100644 --- a/tests/assembly/small_data_threshold.rs +++ b/tests/assembly/small_data_threshold.rs @@ -58,35 +58,35 @@ static mut Z: u64 = 0; // Currently, only MIPS and RISCV successfully put any objects in the small data // sections so the U/V/W/X tests are skipped on Hexagon and M68K -//@ RISCV: .section .sdata -//@ RISCV-NOT: .section -//@ RISCV: U: -//@ RISCV: .section .sbss -//@ RISCV-NOT: .section -//@ RISCV: V: -//@ RISCV: .section .sdata -//@ RISCV-NOT: .section -//@ RISCV: W: -//@ RISCV: .section .sbss -//@ RISCV-NOT: .section -//@ RISCV: X: +// RISCV: .section .sdata +// RISCV-NOT: .section +// RISCV: U: +// RISCV: .section .sbss +// RISCV-NOT: .section +// RISCV: V: +// RISCV: .section .sdata +// RISCV-NOT: .section +// RISCV: W: +// RISCV: .section .sbss +// RISCV-NOT: .section +// RISCV: X: -//@ MIPS: .section .sdata -//@ MIPS-NOT: .section -//@ MIPS: U: -//@ MIPS: .section .sbss -//@ MIPS-NOT: .section -//@ MIPS: V: -//@ MIPS: .section .sdata -//@ MIPS-NOT: .section -//@ MIPS: W: -//@ MIPS: .section .sbss -//@ MIPS-NOT: .section -//@ MIPS: X: +// MIPS: .section .sdata +// MIPS-NOT: .section +// MIPS: U: +// MIPS: .section .sbss +// MIPS-NOT: .section +// MIPS: V: +// MIPS: .section .sdata +// MIPS-NOT: .section +// MIPS: W: +// MIPS: .section .sbss +// MIPS-NOT: .section +// MIPS: X: -//@ CHECK: .section .data.Y, -//@ CHECK-NOT: .section -//@ CHECK: Y: -//@ CHECK: .section .bss.Z, -//@ CHECK-NOT: .section -//@ CHECK: Z: +// CHECK: .section .data.Y, +// CHECK-NOT: .section +// CHECK: Y: +// CHECK: .section .bss.Z, +// CHECK-NOT: .section +// CHECK: Z: diff --git a/tests/assembly/targets/targets-amdgpu.rs b/tests/assembly/targets/targets-amdgpu.rs new file mode 100644 index 00000000000..501eed2e247 --- /dev/null +++ b/tests/assembly/targets/targets-amdgpu.rs @@ -0,0 +1,21 @@ +//@ assembly-output: emit-asm +// ignore-tidy-linelength +//@ revisions: amdgcn_amd_amdhsa +//@ [amdgcn_amd_amdhsa] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 +//@ [amdgcn_amd_amdhsa] needs-llvm-components: amdgpu + +// Sanity-check that each target can produce assembly code. + +#![feature(no_core, lang_items)] +#![no_std] +#![no_core] +#![crate_type = "lib"] + +#[lang = "sized"] +trait Sized {} + +pub fn test() -> u8 { + 42 +} + +// CHECK: .version diff --git a/tests/assembly/targets/targets-elf.rs b/tests/assembly/targets/targets-elf.rs index 0ff886653a4..b5c0ee5a107 100644 --- a/tests/assembly/targets/targets-elf.rs +++ b/tests/assembly/targets/targets-elf.rs @@ -228,6 +228,9 @@ //@ revisions: i586_unknown_netbsd //@ [i586_unknown_netbsd] compile-flags: --target i586-unknown-netbsd //@ [i586_unknown_netbsd] needs-llvm-components: x86 +//@ revisions: i586_unknown_redox +//@ [i586_unknown_redox] compile-flags: --target i586-unknown-redox +//@ [i586_unknown_redox] needs-llvm-components: x86 //@ revisions: i686_linux_android //@ [i686_linux_android] compile-flags: --target i686-linux-android //@ [i686_linux_android] needs-llvm-components: x86 @@ -252,9 +255,6 @@ //@ revisions: i686_unknown_openbsd //@ [i686_unknown_openbsd] compile-flags: --target i686-unknown-openbsd //@ [i686_unknown_openbsd] needs-llvm-components: x86 -//@ revisions: i686_unknown_redox -//@ [i686_unknown_redox] compile-flags: --target i686-unknown-redox -//@ [i686_unknown_redox] needs-llvm-components: x86 //@ revisions: i686_wrs_vxworks //@ [i686_wrs_vxworks] compile-flags: --target i686-wrs-vxworks //@ [i686_wrs_vxworks] needs-llvm-components: x86 diff --git a/tests/assembly/targets/targets-pe.rs b/tests/assembly/targets/targets-pe.rs index ab74de5c8ec..1fa4dc821dd 100644 --- a/tests/assembly/targets/targets-pe.rs +++ b/tests/assembly/targets/targets-pe.rs @@ -84,6 +84,9 @@ //@ revisions: x86_64_win7_windows_msvc //@ [x86_64_win7_windows_msvc] compile-flags: --target x86_64-win7-windows-msvc //@ [x86_64_win7_windows_msvc] needs-llvm-components: x86 +//@ revisions: x86_64_pc_cygwin +//@ [x86_64_pc_cygwin] compile-flags: --target x86_64-pc-cygwin +//@ [x86_64_pc_cygwin] needs-llvm-components: x86 // Sanity-check that each target can produce assembly code. diff --git a/tests/assembly/x86-return-float.rs b/tests/assembly/x86-return-float.rs index acd1af8d38a..2c39c830684 100644 --- a/tests/assembly/x86-return-float.rs +++ b/tests/assembly/x86-return-float.rs @@ -1,19 +1,28 @@ //@ assembly-output: emit-asm -//@ only-x86 // FIXME(#114479): LLVM miscompiles loading and storing `f32` and `f64` when SSE is disabled. // There's no compiletest directive to ignore a test on i586 only, so just always explicitly enable // SSE2. // Use the same target CPU as `i686` so that LLVM orders the instructions in the same order. //@ compile-flags: -Ctarget-feature=+sse2 -Ctarget-cpu=pentium4 // Force frame pointers to make ASM more consistent between targets -//@ compile-flags: -O -C force-frame-pointers +//@ compile-flags: -C force-frame-pointers +// At opt-level=3, LLVM can merge two movss into one movsd, and we aren't testing for that. +//@ compile-flags: -Copt-level=2 //@ filecheck-flags: --implicit-check-not fld --implicit-check-not fst -//@ revisions: normal win -//@[normal] ignore-windows -//@[win] only-windows +//@ revisions: linux win +//@ add-core-stubs +//@[linux] needs-llvm-components: x86 +//@[win] needs-llvm-components: x86 +//@[linux] compile-flags: --target i686-unknown-linux-gnu +//@[win] compile-flags: --target i686-pc-windows-msvc #![crate_type = "lib"] #![feature(f16, f128)] +#![feature(no_core)] +#![no_core] + +extern crate minicore; +use minicore::*; // Tests that returning `f32` and `f64` with the "Rust" ABI on 32-bit x86 doesn't use the x87 // floating point stack, as loading and storing `f32`s and `f64`s to and from the x87 stack quietens @@ -24,19 +33,18 @@ // CHECK-LABEL: return_f32: #[no_mangle] pub fn return_f32(x: f32) -> f32 { - // CHECK: movl {{.*}}(%ebp), %eax - // CHECK-NOT: ax - // CHECK: retl + // CHECK: movss {{.*}}(%ebp), %xmm0 + // CHECK-NEXT: popl %ebp + // CHECK-NEXT: retl x } // CHECK-LABEL: return_f64: #[no_mangle] pub fn return_f64(x: f64) -> f64 { - // CHECK: movl [[#%d,OFFSET:]](%ebp), %[[PTR:.*]] - // CHECK-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL:.*]] - // CHECK-NEXT: movsd %[[VAL]], (%[[PTR]]) - // CHECK: retl + // CHECK: movsd {{.*}}(%ebp), %xmm0 + // CHECK-NEXT: popl %ebp + // CHECK-NEXT: retl x } @@ -148,7 +156,7 @@ pub unsafe fn call_f32(x: &mut f32) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f32 - // CHECK-NEXT: movl %eax, (%[[PTR]]) + // CHECK-NEXT: movss %xmm0, (%[[PTR]]) *x = get_f32(); } @@ -160,8 +168,7 @@ pub unsafe fn call_f64(x: &mut f64) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f64 - // CHECK: movsd {{.*}}(%{{ebp|esp}}), %[[VAL:.*]] - // CHECK-NEXT: movsd %[[VAL:.*]], (%[[PTR]]) + // CHECK-NEXT: movlps %xmm0, (%[[PTR]]) *x = get_f64(); } @@ -190,8 +197,8 @@ pub unsafe fn call_f64_f64(x: &mut (f64, f64)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f64_f64 - // normal: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movsd [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] + // linux: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movsd [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] // win: movsd (%esp), %[[VAL1:.*]] // win-NEXT: movsd 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]]) @@ -207,12 +214,12 @@ pub unsafe fn call_f32_f64(x: &mut (f32, f64)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f32_f64 - // normal: movss [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]] + // linux: movss [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]] // win: movss (%esp), %[[VAL1:.*]] // win-NEXT: movsd 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movss %[[VAL1]], (%[[PTR]]) - // normal-NEXT: movsd %[[VAL2]], 4(%[[PTR]]) + // linux-NEXT: movsd %[[VAL2]], 4(%[[PTR]]) // win-NEXT: movsd %[[VAL2]], 8(%[[PTR]]) *x = get_f32_f64(); } @@ -225,8 +232,8 @@ pub unsafe fn call_f64_f32(x: &mut (f64, f32)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f64_f32 - // normal: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movss [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] + // linux: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movss [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] // win: movsd (%esp), %[[VAL1:.*]] // win-NEXT: movss 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]]) @@ -257,8 +264,8 @@ pub unsafe fn call_f64_other(x: &mut (f64, usize)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f64_other - // normal: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movl [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] + // linux: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movl [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] // win: movsd (%esp), %[[VAL1:.*]] // win-NEXT: movl 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]]) @@ -289,12 +296,12 @@ pub unsafe fn call_other_f64(x: &mut (usize, f64)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_other_f64 - // normal: movl [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]] + // linux: movl [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]] // win: movl (%esp), %[[VAL1:.*]] // win-NEXT: movsd 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movl %[[VAL1]], (%[[PTR]]) - // normal-NEXT: movsd %[[VAL2]], 4(%[[PTR]]) + // linux-NEXT: movsd %[[VAL2]], 4(%[[PTR]]) // win-NEXT: movsd %[[VAL2]], 8(%[[PTR]]) *x = get_other_f64(); } @@ -306,25 +313,21 @@ pub unsafe fn call_other_f64(x: &mut (usize, f64)) { #[no_mangle] pub fn return_f16(x: f16) -> f16 { // CHECK: pushl %ebp - // CHECK: movl %esp, %ebp - // CHECK: movzwl 8(%ebp), %eax - // CHECK: popl %ebp - // CHECK: retl + // CHECK-NEXT: movl %esp, %ebp + // CHECK-NEXT: pinsrw $0, 8(%ebp), %xmm0 + // CHECK-NEXT: popl %ebp + // CHECK-NEXT: retl x } // CHECK-LABEL: return_f128: #[no_mangle] pub fn return_f128(x: f128) -> f128 { - // CHECK: movl [[#%d,OFFSET:]](%ebp), %[[PTR:.*]] - // CHECK-NEXT: movl [[#%d,OFFSET+4]](%ebp), %[[VAL1:.*]] - // CHECK-NEXT: movl [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] - // CHECK-NEXT: movl [[#%d,OFFSET+12]](%ebp), %[[VAL3:.*]] - // CHECK-NEXT: movl [[#%d,OFFSET+16]](%ebp), %[[VAL4:.*]] - // CHECK-NEXT: movl %[[VAL4:.*]] 12(%[[PTR]]) - // CHECK-NEXT: movl %[[VAL3:.*]] 8(%[[PTR]]) - // CHECK-NEXT: movl %[[VAL2:.*]] 4(%[[PTR]]) - // CHECK-NEXT: movl %[[VAL1:.*]] (%[[PTR]]) - // CHECK: retl + // CHECK: pushl %ebp + // CHECK-NEXT: movl %esp, %ebp + // linux-NEXT: movaps 8(%ebp), %xmm0 + // win-NEXT: movups 8(%ebp), %xmm0 + // CHECK-NEXT: popl %ebp + // CHECK-NEXT: retl x } diff --git a/tests/assembly/x86_64-array-pair-load-store-merge.rs b/tests/assembly/x86_64-array-pair-load-store-merge.rs index 849f34e72e5..56a1a9e8206 100644 --- a/tests/assembly/x86_64-array-pair-load-store-merge.rs +++ b/tests/assembly/x86_64-array-pair-load-store-merge.rs @@ -1,5 +1,5 @@ //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel +//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel //@ only-x86_64 //@ ignore-sgx //@ ignore-apple (manipulates rsp too) diff --git a/tests/assembly/x86_64-bigint-helpers.rs b/tests/assembly/x86_64-bigint-helpers.rs index 3ad253a2bd0..58785932bc2 100644 --- a/tests/assembly/x86_64-bigint-helpers.rs +++ b/tests/assembly/x86_64-bigint-helpers.rs @@ -1,6 +1,6 @@ //@ only-x86_64 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C target-cpu=x86-64-v4 +//@ compile-flags: --crate-type=lib -Copt-level=3 -C target-cpu=x86-64-v4 //@ compile-flags: -C llvm-args=-x86-asm-syntax=intel //@ revisions: llvm-pre-20 llvm-20 //@ [llvm-20] min-llvm-version: 20 diff --git a/tests/assembly/x86_64-floating-point-clamp.rs b/tests/assembly/x86_64-floating-point-clamp.rs index c05afadff64..6b0c29c5f21 100644 --- a/tests/assembly/x86_64-floating-point-clamp.rs +++ b/tests/assembly/x86_64-floating-point-clamp.rs @@ -3,7 +3,7 @@ //@ assembly-output: emit-asm // Set the base cpu explicitly, in case the default has been changed. -//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel -C target-cpu=x86-64 +//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel -C target-cpu=x86-64 //@ only-x86_64 //@ ignore-sgx diff --git a/tests/assembly/x86_64-function-return.rs b/tests/assembly/x86_64-function-return.rs index 7cfdf5bce0c..7fd57200a9e 100644 --- a/tests/assembly/x86_64-function-return.rs +++ b/tests/assembly/x86_64-function-return.rs @@ -3,7 +3,7 @@ //@ revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep //@ assembly-output: emit-asm -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ [keep] compile-flags: -Zfunction-return=keep //@ [thunk-extern] compile-flags: -Zfunction-return=thunk-extern //@ [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern diff --git a/tests/assembly/x86_64-no-jump-tables.rs b/tests/assembly/x86_64-no-jump-tables.rs index 9b781226232..bb10042d8f6 100644 --- a/tests/assembly/x86_64-no-jump-tables.rs +++ b/tests/assembly/x86_64-no-jump-tables.rs @@ -3,7 +3,7 @@ //@ revisions: unset set //@ assembly-output: emit-asm -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ [set] compile-flags: -Zno-jump-tables //@ only-x86_64 //@ ignore-sgx diff --git a/tests/assembly/x86_64-typed-swap.rs b/tests/assembly/x86_64-typed-swap.rs index 95e87519e6c..dfd6ee565bc 100644 --- a/tests/assembly/x86_64-typed-swap.rs +++ b/tests/assembly/x86_64-typed-swap.rs @@ -3,7 +3,7 @@ //@ [LIN] only-linux //@ only-x86_64 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O +//@ compile-flags: --crate-type=lib -Copt-level=3 use std::arch::x86_64::__m128; use std::mem::swap; @@ -12,42 +12,42 @@ use std::mem::swap; #[no_mangle] pub fn swap_i32(x: &mut i32, y: &mut i32) { // CHECK: movl (%[[ARG1:.+]]), %[[T1:.+]] - // CHECK: movl (%[[ARG2:.+]]), %[[T2:.+]] - // CHECK: movl %[[T2]], (%[[ARG1]]) - // CHECK: movl %[[T1]], (%[[ARG2]]) - // CHECK: retq + // CHECK-NEXT: movl (%[[ARG2:.+]]), %[[T2:.+]] + // CHECK-DAG: movl %[[T2]], (%[[ARG1]]) + // CHECK-DAG: movl %[[T1]], (%[[ARG2]]) + // CHECK-NEXT: retq swap(x, y) } // CHECK-LABEL: swap_pair: #[no_mangle] pub fn swap_pair(x: &mut (i32, u32), y: &mut (i32, u32)) { - // CHECK: movq (%[[ARG1]]), %[[T1:.+]] - // CHECK: movq (%[[ARG2]]), %[[T2:.+]] - // CHECK: movq %[[T2]], (%[[ARG1]]) - // CHECK: movq %[[T1]], (%[[ARG2]]) - // CHECK: retq + // CHECK: movq (%[[ARG1:r..?]]), %[[T1:.+]] + // CHECK-NEXT: movq (%[[ARG2:r..?]]), %[[T2:.+]] + // CHECK-DAG: movq %[[T2]], (%[[ARG1]]) + // CHECK-DAG: movq %[[T1]], (%[[ARG2]]) + // CHECK-NEXT: retq swap(x, y) } // CHECK-LABEL: swap_str: #[no_mangle] pub fn swap_str<'a>(x: &mut &'a str, y: &mut &'a str) { - // CHECK: movups (%[[ARG1]]), %[[T1:xmm.]] - // CHECK: movups (%[[ARG2]]), %[[T2:xmm.]] - // CHECK: movups %[[T2]], (%[[ARG1]]) - // CHECK: movups %[[T1]], (%[[ARG2]]) - // CHECK: retq + // CHECK: movups (%[[ARG1:r..?]]), %[[T1:xmm.]] + // CHECK-NEXT: movups (%[[ARG2:r..?]]), %[[T2:xmm.]] + // CHECK-DAG: movups %[[T2]], (%[[ARG1]]) + // CHECK-DAG: movups %[[T1]], (%[[ARG2]]) + // CHECK-NEXT: retq swap(x, y) } // CHECK-LABEL: swap_simd: #[no_mangle] pub fn swap_simd(x: &mut __m128, y: &mut __m128) { - // CHECK: movaps (%[[ARG1]]), %[[T1:xmm.]] - // CHECK: movaps (%[[ARG2]]), %[[T2:xmm.]] - // CHECK: movaps %[[T2]], (%[[ARG1]]) - // CHECK: movaps %[[T1]], (%[[ARG2]]) - // CHECK: retq + // CHECK: movaps (%[[ARG1:r..?]]), %[[T1:xmm.]] + // CHECK-NEXT: movaps (%[[ARG2:r..?]]), %[[T2:xmm.]] + // CHECK-DAG: movaps %[[T2]], (%[[ARG1]]) + // CHECK-DAG: movaps %[[T1]], (%[[ARG2]]) + // CHECK-NEXT: retq swap(x, y) } diff --git a/tests/assembly/x86_64-windows-float-abi.rs b/tests/assembly/x86_64-windows-float-abi.rs index 1381d492fa5..e8900be1aae 100644 --- a/tests/assembly/x86_64-windows-float-abi.rs +++ b/tests/assembly/x86_64-windows-float-abi.rs @@ -1,11 +1,17 @@ //@ assembly-output: emit-asm -//@ compile-flags: -O -//@ only-windows -//@ only-x86_64 +//@ compile-flags: -Copt-level=3 +//@ compile-flags: --target x86_64-pc-windows-msvc +//@ needs-llvm-components: x86 +//@ add-core-stubs #![feature(f16, f128)] +#![feature(no_core)] +#![no_core] #![crate_type = "lib"] +extern crate minicore; +use minicore::*; + // CHECK-LABEL: second_f16 // CHECK: movaps %xmm1, %xmm0 // CHECK-NEXT: retq diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index a68552175c3..0aa8b6b8f89 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -14,9 +14,20 @@ //! <https://github.com/rust-lang/rust/blob/c0b5cc9003f6464c11ae1c0662c6a7e06f6f5cab/compiler/rustc_codegen_cranelift/example/mini_core.rs>. // ignore-tidy-linelength -#![feature(no_core, lang_items, rustc_attrs, decl_macro, naked_functions, f16, f128)] +#![feature( + no_core, + lang_items, + auto_traits, + freeze_impls, + negative_impls, + rustc_attrs, + decl_macro, + naked_functions, + f16, + f128, + asm_experimental_arch +)] #![allow(unused, improper_ctypes_definitions, internal_features)] -#![feature(asm_experimental_arch)] #![no_std] #![no_core] @@ -39,6 +50,15 @@ impl<T: ?Sized> LegacyReceiver for &mut T {} #[lang = "copy"] pub trait Copy: Sized {} +#[lang = "bikeshed_guaranteed_no_drop"] +pub trait BikeshedGuaranteedNoDrop {} + +#[lang = "freeze"] +pub unsafe auto trait Freeze {} + +#[lang = "unpin"] +pub auto trait Unpin {} + impl_marker_trait!( Copy => [ bool, char, @@ -80,6 +100,7 @@ impl<T: Copy + ?Sized> Copy for ManuallyDrop<T> {} pub struct UnsafeCell<T: ?Sized> { value: T, } +impl<T: ?Sized> !Freeze for UnsafeCell<T> {} #[rustc_builtin_macro] pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) { diff --git a/tests/codegen/abi-repr-ext.rs b/tests/codegen/abi-repr-ext.rs index a42f7356696..b06d225ed70 100644 --- a/tests/codegen/abi-repr-ext.rs +++ b/tests/codegen/abi-repr-ext.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv diff --git a/tests/codegen/abi-win64-zst.rs b/tests/codegen/abi-win64-zst.rs index dd361898144..825a5c1b09c 100644 --- a/tests/codegen/abi-win64-zst.rs +++ b/tests/codegen/abi-win64-zst.rs @@ -1,4 +1,5 @@ //@ compile-flags: -Z merge-functions=disabled +//@ add-core-stubs //@ revisions: windows-gnu //@[windows-gnu] compile-flags: --target x86_64-pc-windows-gnu @@ -13,12 +14,12 @@ //@[linux] compile-flags: --target x86_64-unknown-linux-gnu //@[linux] needs-llvm-components: x86 -#![feature(no_core, lang_items, rustc_attrs, abi_vectorcall)] +#![feature(no_core, rustc_attrs, abi_vectorcall)] #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // Make sure the argument is always passed when explicitly requesting a Windows ABI. // Our goal here is to match clang: <https://clang.godbolt.org/z/Wr4jMWq3P>. diff --git a/tests/codegen/abi-x86-sse.rs b/tests/codegen/abi-x86-sse.rs new file mode 100644 index 00000000000..837bf6134b0 --- /dev/null +++ b/tests/codegen/abi-x86-sse.rs @@ -0,0 +1,36 @@ +//@ compile-flags: -Z merge-functions=disabled + +//@ revisions: x86-64 +//@[x86-64] compile-flags: --target x86_64-unknown-linux-gnu +//@[x86-64] needs-llvm-components: x86 + +//@ revisions: x86-32 +//@[x86-32] compile-flags: --target i686-unknown-linux-gnu +//@[x86-32] needs-llvm-components: x86 + +//@ revisions: x86-32-nosse +//@[x86-32-nosse] compile-flags: --target i586-unknown-linux-gnu +//@[x86-32-nosse] needs-llvm-components: x86 + +#![feature(no_core, lang_items, rustc_attrs, repr_simd)] +#![no_core] +#![crate_type = "lib"] + +#[lang = "sized"] +trait Sized {} + +#[lang = "copy"] +trait Copy {} + +// Ensure this type is passed without ptr indirection on targets that +// require SSE2. +#[repr(simd)] +pub struct Sse([f32; 4]); + +// x86-64: <4 x float> @sse_id(<4 x float> {{[^,]*}}) +// x86-32: <4 x float> @sse_id(<4 x float> {{[^,]*}}) +// x86-32-nosse: void @sse_id(ptr{{( [^,]*)?}} sret([16 x i8]){{( .*)?}}, ptr{{( [^,]*)?}}) +#[no_mangle] +pub fn sse_id(x: Sse) -> Sse { + x +} diff --git a/tests/codegen/addr-of-mutate.rs b/tests/codegen/addr-of-mutate.rs index f10f01274b1..14bc4b8ab28 100644 --- a/tests/codegen/addr-of-mutate.rs +++ b/tests/codegen/addr-of-mutate.rs @@ -5,7 +5,7 @@ // Test for the absence of `readonly` on the argument when it is mutated via `&raw const`. // See <https://github.com/rust-lang/rust/issues/111502>. -// CHECK: i8 @foo(ptr noalias nocapture noundef align 1 dereferenceable(128) %x) +// CHECK: i8 @foo(ptr noalias{{( nocapture)?}} noundef align 1{{( captures\(none\))?}} dereferenceable(128) %x) #[no_mangle] pub fn foo(x: [u8; 128]) -> u8 { let ptr = core::ptr::addr_of!(x).cast_mut(); @@ -15,7 +15,7 @@ pub fn foo(x: [u8; 128]) -> u8 { x[0] } -// CHECK: i1 @second(ptr noalias nocapture noundef align {{[0-9]+}} dereferenceable({{[0-9]+}}) %a_ptr_and_b) +// CHECK: i1 @second(ptr noalias{{( nocapture)?}} noundef align {{[0-9]+}}{{( captures\(none\))?}} dereferenceable({{[0-9]+}}) %a_ptr_and_b) #[no_mangle] pub unsafe fn second(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool { let b_bool_ptr = core::ptr::addr_of!(a_ptr_and_b.1.1).cast_mut(); @@ -24,7 +24,7 @@ pub unsafe fn second(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool { } // If going through a deref (and there are no other mutating accesses), then `readonly` is fine. -// CHECK: i1 @third(ptr noalias nocapture noundef readonly align {{[0-9]+}} dereferenceable({{[0-9]+}}) %a_ptr_and_b) +// CHECK: i1 @third(ptr noalias{{( nocapture)?}} noundef readonly align {{[0-9]+}}{{( captures\(none\))?}} dereferenceable({{[0-9]+}}) %a_ptr_and_b) #[no_mangle] pub unsafe fn third(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool { let b_bool_ptr = core::ptr::addr_of!((*a_ptr_and_b.0).1).cast_mut(); diff --git a/tests/codegen/align-byval-alignment-mismatch.rs b/tests/codegen/align-byval-alignment-mismatch.rs index 835cc7393e5..46cfb2972df 100644 --- a/tests/codegen/align-byval-alignment-mismatch.rs +++ b/tests/codegen/align-byval-alignment-mismatch.rs @@ -1,4 +1,5 @@ // ignore-tidy-linelength +//@ add-core-stubs //@ revisions:i686-linux x86_64-linux //@[i686-linux] compile-flags: --target i686-unknown-linux-gnu -C panic=abort @@ -16,18 +17,14 @@ // on i686-unknown-linux-gnu, since the alignment needs to be increased, and should codegen // to a direct call on x86_64-unknown-linux-gnu, where byval alignment matches Rust alignment. -#![feature(no_core, lang_items)] +#![feature(no_core)] #![crate_type = "lib"] #![no_std] #![no_core] #![allow(non_camel_case_types)] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // This type has align 1 in Rust, but as a byval argument on i686-linux, it will have align 4. #[repr(C)] diff --git a/tests/codegen/align-byval-vector.rs b/tests/codegen/align-byval-vector.rs index 60d49f93081..c33b41a7bbe 100644 --- a/tests/codegen/align-byval-vector.rs +++ b/tests/codegen/align-byval-vector.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions:x86-linux x86-darwin //@[x86-linux] compile-flags: --target i686-unknown-linux-gnu @@ -7,18 +8,14 @@ // Tests that aggregates containing vector types get their alignment increased to 16 on Darwin. -#![feature(no_core, lang_items, repr_simd, simd_ffi)] +#![feature(no_core, repr_simd, simd_ffi)] #![crate_type = "lib"] #![no_std] #![no_core] #![allow(non_camel_case_types)] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct i32x4([i32; 4]); diff --git a/tests/codegen/align-byval.rs b/tests/codegen/align-byval.rs index b057147ab13..75dabd74a79 100644 --- a/tests/codegen/align-byval.rs +++ b/tests/codegen/align-byval.rs @@ -1,4 +1,5 @@ // ignore-tidy-linelength +//@ add-core-stubs //@ revisions:m68k x86_64-linux x86_64-windows i686-linux i686-windows //@[m68k] compile-flags: --target m68k-unknown-linux-gnu @@ -16,20 +17,13 @@ // The only targets that use `byval` are m68k, x86-64, and x86. // Note also that Windows mandates a by-ref ABI here, so it does not use byval. -#![feature(no_core, lang_items)] +#![feature(no_core)] #![crate_type = "lib"] #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} -impl Copy for i64 {} +extern crate minicore; +use minicore::*; // This struct can be represented as a pair, so it exercises the OperandValue::Pair // codepath in `codegen_argument`. diff --git a/tests/codegen/align-offset.rs b/tests/codegen/align-offset.rs index aeac230f718..21062cc0a91 100644 --- a/tests/codegen/align-offset.rs +++ b/tests/codegen/align-offset.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/alloc-optimisation.rs b/tests/codegen/alloc-optimisation.rs index 6f320e68fdb..8abeecf8550 100644 --- a/tests/codegen/alloc-optimisation.rs +++ b/tests/codegen/alloc-optimisation.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #[no_mangle] diff --git a/tests/codegen/amdgpu-addrspacecast.rs b/tests/codegen/amdgpu-addrspacecast.rs new file mode 100644 index 00000000000..7fe630a7efa --- /dev/null +++ b/tests/codegen/amdgpu-addrspacecast.rs @@ -0,0 +1,18 @@ +// Check that pointers are casted to addrspace(0) before they are used + +//@ compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 +//@ needs-llvm-components: amdgpu +//@ add-core-stubs +#![feature(no_core)] +#![no_core] + +extern crate minicore; + +// CHECK-LABEL: @ref_of_local +// CHECK: [[alloca:%[0-9]]] = alloca +// CHECK: %i = addrspacecast ptr addrspace(5) [[alloca]] to ptr +#[no_mangle] +pub fn ref_of_local(f: fn(&i32)) { + let i = 0; + f(&i); +} diff --git a/tests/codegen/array-clone.rs b/tests/codegen/array-clone.rs index 2873f3cadca..35445174684 100644 --- a/tests/codegen/array-clone.rs +++ b/tests/codegen/array-clone.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/array-codegen.rs b/tests/codegen/array-codegen.rs index fc272f2556c..9b0c6e8c347 100644 --- a/tests/codegen/array-codegen.rs +++ b/tests/codegen/array-codegen.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/array-equality.rs b/tests/codegen/array-equality.rs index bc5425c7a4f..fa0475bf480 100644 --- a/tests/codegen/array-equality.rs +++ b/tests/codegen/array-equality.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled //@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/array-optimized.rs b/tests/codegen/array-optimized.rs index 42fdbd39b7e..000163d5519 100644 --- a/tests/codegen/array-optimized.rs +++ b/tests/codegen/array-optimized.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/array-repeat.rs b/tests/codegen/array-repeat.rs index b6f3b2e83d3..4c755df9390 100644 --- a/tests/codegen/array-repeat.rs +++ b/tests/codegen/array-repeat.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(array_repeat)] diff --git a/tests/codegen/asm/bpf-clobbers.rs b/tests/codegen/asm/bpf-clobbers.rs new file mode 100644 index 00000000000..1117549b1ec --- /dev/null +++ b/tests/codegen/asm/bpf-clobbers.rs @@ -0,0 +1,31 @@ +//@ add-core-stubs +//@ compile-flags: --target bpfel-unknown-none +//@ needs-llvm-components: bpf + +#![crate_type = "rlib"] +#![feature(no_core, asm_experimental_arch)] +#![no_core] + +extern crate minicore; +use minicore::*; + +// CHECK-LABEL: @flags_clobber +// CHECK: call void asm sideeffect "", ""() +#[no_mangle] +pub unsafe fn flags_clobber() { + asm!("", options(nostack, nomem)); +} + +// CHECK-LABEL: @no_clobber +// CHECK: call void asm sideeffect "", ""() +#[no_mangle] +pub unsafe fn no_clobber() { + asm!("", options(nostack, nomem, preserves_flags)); +} + +// CHECK-LABEL: @clobber_abi +// CHECK: asm sideeffect "", "={r0},={r1},={r2},={r3},={r4},={r5}"() +#[no_mangle] +pub unsafe fn clobber_abi() { + asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags)); +} diff --git a/tests/codegen/asm/csky-clobbers.rs b/tests/codegen/asm/csky-clobbers.rs new file mode 100644 index 00000000000..4986d0fe56d --- /dev/null +++ b/tests/codegen/asm/csky-clobbers.rs @@ -0,0 +1,24 @@ +//@ add-core-stubs +//@ compile-flags: --target csky-unknown-linux-gnuabiv2 +//@ needs-llvm-components: csky + +#![crate_type = "rlib"] +#![feature(no_core, asm_experimental_arch)] +#![no_core] + +extern crate minicore; +use minicore::*; + +// CHECK-LABEL: @flags_clobber +// CHECK: call void asm sideeffect "", "~{psr}"() +#[no_mangle] +pub unsafe fn flags_clobber() { + asm!("", options(nostack, nomem)); +} + +// CHECK-LABEL: @no_clobber +// CHECK: call void asm sideeffect "", ""() +#[no_mangle] +pub unsafe fn no_clobber() { + asm!("", options(nostack, nomem, preserves_flags)); +} diff --git a/tests/codegen/asm/goto.rs b/tests/codegen/asm/goto.rs index c40a43fbe1b..7a87bb7983b 100644 --- a/tests/codegen/asm/goto.rs +++ b/tests/codegen/asm/goto.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-x86_64 #![crate_type = "rlib"] diff --git a/tests/codegen/asm/may_unwind.rs b/tests/codegen/asm/may_unwind.rs index be66b3975ff..63cdec7584c 100644 --- a/tests/codegen/asm/may_unwind.rs +++ b/tests/codegen/asm/may_unwind.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-x86_64 #![crate_type = "rlib"] diff --git a/tests/codegen/asm/maybe-uninit.rs b/tests/codegen/asm/maybe-uninit.rs index 55813c35a46..d76d5cb1312 100644 --- a/tests/codegen/asm/maybe-uninit.rs +++ b/tests/codegen/asm/maybe-uninit.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-x86_64 #![crate_type = "rlib"] diff --git a/tests/codegen/asm/multiple-options.rs b/tests/codegen/asm/multiple-options.rs index 1ee295e32c9..4d87471a193 100644 --- a/tests/codegen/asm/multiple-options.rs +++ b/tests/codegen/asm/multiple-options.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-x86_64 #![crate_type = "rlib"] diff --git a/tests/codegen/asm/options.rs b/tests/codegen/asm/options.rs index 96a72c2f5ae..c087f91fd43 100644 --- a/tests/codegen/asm/options.rs +++ b/tests/codegen/asm/options.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-x86_64 #![crate_type = "rlib"] diff --git a/tests/codegen/asm/x86-clobber_abi.rs b/tests/codegen/asm/x86-clobber_abi.rs index cc563474bf8..5b34b4e8ef3 100644 --- a/tests/codegen/asm/x86-clobber_abi.rs +++ b/tests/codegen/asm/x86-clobber_abi.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-x86_64 #![crate_type = "rlib"] diff --git a/tests/codegen/asm/x86-clobbers.rs b/tests/codegen/asm/x86-clobbers.rs index 4094db74134..50163b646b2 100644 --- a/tests/codegen/asm/x86-clobbers.rs +++ b/tests/codegen/asm/x86-clobbers.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-x86_64 #![crate_type = "rlib"] diff --git a/tests/codegen/atomic-operations.rs b/tests/codegen/atomic-operations.rs index 8a70c94e480..8771b8b2419 100644 --- a/tests/codegen/atomic-operations.rs +++ b/tests/codegen/atomic-operations.rs @@ -1,5 +1,5 @@ // Code generation of atomic operations. -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] use std::sync::atomic::AtomicI32; diff --git a/tests/codegen/atomicptr.rs b/tests/codegen/atomicptr.rs index e8c5e6a6749..4819af40ca2 100644 --- a/tests/codegen/atomicptr.rs +++ b/tests/codegen/atomicptr.rs @@ -4,7 +4,7 @@ // ensures that we do not have such a round-trip for AtomicPtr::swap, because LLVM supports pointer // arguments to `atomicrmw xchg`. -//@ compile-flags: -O -Cno-prepopulate-passes +//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes #![crate_type = "lib"] #![feature(strict_provenance_atomic_ptr)] diff --git a/tests/codegen/autodiff.rs b/tests/codegen/autodiff.rs new file mode 100644 index 00000000000..abf7fcf3e4b --- /dev/null +++ b/tests/codegen/autodiff.rs @@ -0,0 +1,33 @@ +//@ compile-flags: -C opt-level=3 -Clto=fat +//@ no-prefer-dynamic +//@ needs-enzyme +#![feature(autodiff)] + +use std::autodiff::autodiff; + +#[autodiff(d_square, Reverse, Duplicated, Active)] +#[no_mangle] +fn square(x: &f64) -> f64 { + x * x +} + +// CHECK:define internal fastcc double @diffesquare(double %x.0.val, ptr nocapture align 8 %"x'" +// CHECK-NEXT:invertstart: +// CHECK-NEXT: %_0 = fmul double %x.0.val, %x.0.val +// CHECK-NEXT: %0 = fadd fast double %x.0.val, %x.0.val +// CHECK-NEXT: %1 = load double, ptr %"x'", align 8 +// CHECK-NEXT: %2 = fadd fast double %1, %0 +// CHECK-NEXT: store double %2, ptr %"x'", align 8 +// CHECK-NEXT: ret double %_0 +// CHECK-NEXT:} + +fn main() { + let x = 3.0; + let output = square(&x); + assert_eq!(9.0, output); + + let mut df_dx = 0.0; + let output_ = d_square(&x, &mut df_dx, 1.0); + assert_eq!(output, output_); + assert_eq!(6.0, df_dx); +} diff --git a/tests/codegen/avr/avr-func-addrspace.rs b/tests/codegen/avr/avr-func-addrspace.rs index 7a36490fe93..ed8acccb1ad 100644 --- a/tests/codegen/avr/avr-func-addrspace.rs +++ b/tests/codegen/avr/avr-func-addrspace.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O --target=avr-unknown-gnu-atmega328 --crate-type=rlib -C panic=abort +//@ compile-flags: -Copt-level=3 --target=avr-unknown-gnu-atmega328 --crate-type=rlib -C panic=abort //@ needs-llvm-components: avr // This test validates that function pointers can be stored in global variables diff --git a/tests/codegen/bigint-helpers.rs b/tests/codegen/bigint-helpers.rs new file mode 100644 index 00000000000..355cccb8150 --- /dev/null +++ b/tests/codegen/bigint-helpers.rs @@ -0,0 +1,13 @@ +//@ compile-flags: -C opt-level=3 + +#![crate_type = "lib"] +#![feature(bigint_helper_methods)] + +// CHECK-LABEL: @u32_carrying_add +#[no_mangle] +pub fn u32_carrying_add(a: u32, b: u32, c: bool) -> (u32, bool) { + // CHECK: @llvm.uadd.with.overflow.i32 + // CHECK: @llvm.uadd.with.overflow.i32 + // CHECK: or disjoint i1 + u32::carrying_add(a, b, c) +} diff --git a/tests/codegen/binary-heap-peek-mut-pop-no-panic.rs b/tests/codegen/binary-heap-peek-mut-pop-no-panic.rs index e3bc9a4761c..2c40327f624 100644 --- a/tests/codegen/binary-heap-peek-mut-pop-no-panic.rs +++ b/tests/codegen/binary-heap-peek-mut-pop-no-panic.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ ignore-std-debug-assertions #![crate_type = "lib"] diff --git a/tests/codegen/binary-search-index-no-bound-check.rs b/tests/codegen/binary-search-index-no-bound-check.rs index a213c015a40..d59c0beec64 100644 --- a/tests/codegen/binary-search-index-no-bound-check.rs +++ b/tests/codegen/binary-search-index-no-bound-check.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] // Make sure no bounds checks are emitted when slicing or indexing diff --git a/tests/codegen/box-uninit-bytes.rs b/tests/codegen/box-uninit-bytes.rs index 63a6c7b8415..3b83ef3e250 100644 --- a/tests/codegen/box-uninit-bytes.rs +++ b/tests/codegen/box-uninit-bytes.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] use std::mem::MaybeUninit; diff --git a/tests/codegen/call-metadata.rs b/tests/codegen/call-metadata.rs index b986b4467fa..7ad3ded2f09 100644 --- a/tests/codegen/call-metadata.rs +++ b/tests/codegen/call-metadata.rs @@ -1,7 +1,7 @@ // Checks that range metadata gets emitted on calls to functions returning a // scalar value. -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@ max-llvm-major-version: 18 #![crate_type = "lib"] diff --git a/tests/codegen/cast-optimized.rs b/tests/codegen/cast-optimized.rs index 59cf40935cd..11220c4a922 100644 --- a/tests/codegen/cast-optimized.rs +++ b/tests/codegen/cast-optimized.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled #![crate_type = "lib"] // This tests that LLVM can optimize based on the niches in the source or diff --git a/tests/codegen/cast-target-abi.rs b/tests/codegen/cast-target-abi.rs index db76aae3dd0..a0801eb9826 100644 --- a/tests/codegen/cast-target-abi.rs +++ b/tests/codegen/cast-target-abi.rs @@ -1,7 +1,7 @@ // ignore-tidy-linelength //@ revisions:aarch64 loongarch64 powerpc64 sparc64 x86_64 //@ min-llvm-version: 19 -//@ compile-flags: -O -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error +//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu //@[aarch64] needs-llvm-components: arm @@ -392,7 +392,7 @@ pub fn call_fiveu16s() { } // CHECK-LABEL: @return_fiveu16s -// CHECK-SAME: (ptr {{.+}} sret([10 x i8]) align [[RUST_ALIGN:2]] dereferenceable(10) [[RET_PTR:%.+]]) +// CHECK-SAME: (ptr {{.+}} sret([10 x i8]) align [[RUST_ALIGN:2]] {{.*}}dereferenceable(10) [[RET_PTR:%.+]]) #[no_mangle] pub fn return_fiveu16s() -> FiveU16s { // powerpc returns this struct via sret pointer, it doesn't use the cast ABI. diff --git a/tests/codegen/catch-unwind.rs b/tests/codegen/catch-unwind.rs index 48ad486fa03..d1ff55bcc28 100644 --- a/tests/codegen/catch-unwind.rs +++ b/tests/codegen/catch-unwind.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 // On x86 the closure is inlined in foo() producing something like // define i32 @foo() [...] { diff --git a/tests/codegen/char-ascii-branchless.rs b/tests/codegen/char-ascii-branchless.rs index 76d2f617ed1..f99066aa9aa 100644 --- a/tests/codegen/char-ascii-branchless.rs +++ b/tests/codegen/char-ascii-branchless.rs @@ -1,6 +1,6 @@ // Checks that these functions are branchless. // -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/checked_ilog.rs b/tests/codegen/checked_ilog.rs index d7dfc7c29e7..e340a45b6a9 100644 --- a/tests/codegen/checked_ilog.rs +++ b/tests/codegen/checked_ilog.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/checked_math.rs b/tests/codegen/checked_math.rs index c612ddccdaa..66667c69488 100644 --- a/tests/codegen/checked_math.rs +++ b/tests/codegen/checked_math.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled #![crate_type = "lib"] #![feature(unchecked_shifts)] diff --git a/tests/codegen/clone_as_copy.rs b/tests/codegen/clone_as_copy.rs index 6ba198297e2..c39f120044c 100644 --- a/tests/codegen/clone_as_copy.rs +++ b/tests/codegen/clone_as_copy.rs @@ -1,7 +1,7 @@ //@ revisions: DEBUGINFO NODEBUGINFO //@ compile-flags: -Zunsound-mir-opts // FIXME: see <https://github.com/rust-lang/rust/issues/132353> -//@ compile-flags: -O -Cno-prepopulate-passes +//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes //@ [DEBUGINFO] compile-flags: -Cdebuginfo=full // From https://github.com/rust-lang/rust/issues/128081. diff --git a/tests/codegen/common_prim_int_ptr.rs b/tests/codegen/common_prim_int_ptr.rs index aa7ebb4c911..a1d7a125f32 100644 --- a/tests/codegen/common_prim_int_ptr.rs +++ b/tests/codegen/common_prim_int_ptr.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(core_intrinsics)] @@ -40,7 +40,7 @@ pub unsafe fn extract_int(x: Result<usize, Box<()>>) -> usize { } // CHECK-LABEL: @extract_box -// CHECK-SAME: (i{{[0-9]+}} {{[^%]+}} [[DISCRIMINANT:%[0-9]+]], ptr {{[^,]+}} [[PAYLOAD:%[0-9]+]]) +// CHECK-SAME: (i{{[0-9]+}} {{[^%]+}} [[DISCRIMINANT:%[0-9]+]], ptr {{[^%]+}} [[PAYLOAD:%[0-9]+]]) #[no_mangle] pub unsafe fn extract_box(x: Result<usize, Box<i32>>) -> Box<i32> { // CHECK: ret ptr [[PAYLOAD]] diff --git a/tests/codegen/const-array.rs b/tests/codegen/const-array.rs index f2b331c315d..e257d8acc08 100644 --- a/tests/codegen/const-array.rs +++ b/tests/codegen/const-array.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/cross-crate-inlining/always-inline.rs b/tests/codegen/cross-crate-inlining/always-inline.rs index d3a35dadb67..df28b3fe197 100644 --- a/tests/codegen/cross-crate-inlining/always-inline.rs +++ b/tests/codegen/cross-crate-inlining/always-inline.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ aux-build:always.rs #![crate_type = "lib"] diff --git a/tests/codegen/cross-crate-inlining/auxiliary/always.rs b/tests/codegen/cross-crate-inlining/auxiliary/always.rs index 7f524e17d34..6ee3f81e3c8 100644 --- a/tests/codegen/cross-crate-inlining/auxiliary/always.rs +++ b/tests/codegen/cross-crate-inlining/auxiliary/always.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Zcross-crate-inline-threshold=always +//@ compile-flags: -Copt-level=3 -Zcross-crate-inline-threshold=always #![crate_type = "lib"] diff --git a/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs b/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs index 5895812b5ee..d059a3d0a73 100644 --- a/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs +++ b/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/cross-crate-inlining/auxiliary/never.rs b/tests/codegen/cross-crate-inlining/auxiliary/never.rs index 3a391608df8..55c90809ec1 100644 --- a/tests/codegen/cross-crate-inlining/auxiliary/never.rs +++ b/tests/codegen/cross-crate-inlining/auxiliary/never.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Zcross-crate-inline-threshold=never +//@ compile-flags: -Copt-level=3 -Zcross-crate-inline-threshold=never #![crate_type = "lib"] diff --git a/tests/codegen/cross-crate-inlining/leaf-inlining.rs b/tests/codegen/cross-crate-inlining/leaf-inlining.rs index b47898f750a..37132312ca9 100644 --- a/tests/codegen/cross-crate-inlining/leaf-inlining.rs +++ b/tests/codegen/cross-crate-inlining/leaf-inlining.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Zcross-crate-inline-threshold=yes +//@ compile-flags: -Copt-level=3 -Zcross-crate-inline-threshold=yes //@ aux-build:leaf.rs #![crate_type = "lib"] diff --git a/tests/codegen/cross-crate-inlining/never-inline.rs b/tests/codegen/cross-crate-inlining/never-inline.rs index eedf90ceec0..759f65d9d42 100644 --- a/tests/codegen/cross-crate-inlining/never-inline.rs +++ b/tests/codegen/cross-crate-inlining/never-inline.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ aux-build:never.rs #![crate_type = "lib"] diff --git a/tests/codegen/dealloc-no-unwind.rs b/tests/codegen/dealloc-no-unwind.rs index ead26da610e..c560d7a9932 100644 --- a/tests/codegen/dealloc-no-unwind.rs +++ b/tests/codegen/dealloc-no-unwind.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/debug-column.rs b/tests/codegen/debug-column.rs index d14a5c29142..2aa0a8a864c 100644 --- a/tests/codegen/debug-column.rs +++ b/tests/codegen/debug-column.rs @@ -1,6 +1,6 @@ // Verify that debuginfo column numbers are 1-based byte offsets. // -//@ ignore-windows +//@ ignore-msvc //@ compile-flags: -C debuginfo=2 #[rustfmt::skip] diff --git a/tests/codegen/debug-fndef-size.rs b/tests/codegen/debug-fndef-size.rs index 27bf00adf0e..8f716c34e7b 100644 --- a/tests/codegen/debug-fndef-size.rs +++ b/tests/codegen/debug-fndef-size.rs @@ -1,5 +1,7 @@ -// Verify that `i32::cmp` FnDef type is declared with size 0 and align 1 in LLVM debuginfo. -//@ compile-flags: -O -g -Cno-prepopulate-passes +// Verify that `i32::cmp` FnDef type is declared with a size of 0 and an +// alignment of 8 bits (1 byte) in LLVM debuginfo. + +//@ compile-flags: -Copt-level=3 -g -Cno-prepopulate-passes //@ ignore-msvc the types are mangled differently use std::cmp::Ordering; @@ -14,5 +16,5 @@ pub fn main() { // CHECK: %compare.dbg.spill = alloca [0 x i8], align 1 // CHECK: dbg{{.}}declare({{(metadata )?}}ptr %compare.dbg.spill, {{(metadata )?}}![[VAR:.*]], {{(metadata )?}}!DIExpression() -// CHECK: ![[TYPE:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "fn(&i32, &i32) -> core::cmp::Ordering", baseType: !{{.*}}, align: 1, dwarfAddressSpace: {{.*}}) -// CHECK: ![[VAR]] = !DILocalVariable(name: "compare", scope: !{{.*}}, file: !{{.*}}, line: {{.*}}, type: ![[TYPE]], align: 1) +// CHECK: ![[TYPE:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "fn(&i32, &i32) -> core::cmp::Ordering", baseType: !{{.*}}, align: 8, dwarfAddressSpace: {{.*}}) +// CHECK: ![[VAR]] = !DILocalVariable(name: "compare", scope: !{{.*}}, file: !{{.*}}, line: {{.*}}, type: ![[TYPE]], align: 8) diff --git a/tests/codegen/debuginfo-constant-locals.rs b/tests/codegen/debuginfo-constant-locals.rs index c8f1d964722..580c69c05a5 100644 --- a/tests/codegen/debuginfo-constant-locals.rs +++ b/tests/codegen/debuginfo-constant-locals.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -g -O +//@ compile-flags: -g -Copt-level=3 // Check that simple constant values are preserved in debuginfo across both MIR opts and LLVM opts diff --git a/tests/codegen/debuginfo-inline-callsite-location.rs b/tests/codegen/debuginfo-inline-callsite-location.rs index c31788d82db..59ade52ad32 100644 --- a/tests/codegen/debuginfo-inline-callsite-location.rs +++ b/tests/codegen/debuginfo-inline-callsite-location.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -g -O -C panic=abort +//@ compile-flags: -g -Copt-level=3 -C panic=abort // Check that each inline call site for the same function uses the same "sub-program" so that LLVM // can correctly merge the debug info if it merges the inlined code (e.g., for merging of tail diff --git a/tests/codegen/deduced-param-attrs.rs b/tests/codegen/deduced-param-attrs.rs index 5e7c571b63f..22db090d4d8 100644 --- a/tests/codegen/deduced-param-attrs.rs +++ b/tests/codegen/deduced-param-attrs.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![allow(incomplete_features)] diff --git a/tests/codegen/dont-shuffle-bswaps.rs b/tests/codegen/dont-shuffle-bswaps.rs new file mode 100644 index 00000000000..0e712bc3a4e --- /dev/null +++ b/tests/codegen/dont-shuffle-bswaps.rs @@ -0,0 +1,38 @@ +//@ revisions: OPT2 OPT3 +//@[OPT2] compile-flags: -Copt-level=2 +//@[OPT3] compile-flags: -C opt-level=3 +// some targets don't do the opt we are looking for +//@[OPT3] only-64bit +//@ min-llvm-version: 18.1.3 + +#![crate_type = "lib"] +#![no_std] + +// The code is from https://github.com/rust-lang/rust/issues/122805. +// Ensure we do not generate the shufflevector instruction +// to avoid complicating the code. +// CHECK-LABEL: define{{.*}}void @convert( +// CHECK-NOT: shufflevector +// On higher opt levels, this should just be a bswap: +// OPT3: load <8 x i16> +// OPT3-NEXT: call <8 x i16> @llvm.bswap +// OPT3-NEXT: store <8 x i16> +// OPT3-NEXT: ret void +#[no_mangle] +pub fn convert(value: [u16; 8]) -> [u8; 16] { + #[cfg(target_endian = "little")] + let bswap = u16::to_be; + #[cfg(target_endian = "big")] + let bswap = u16::to_le; + let addr16 = [ + bswap(value[0]), + bswap(value[1]), + bswap(value[2]), + bswap(value[3]), + bswap(value[4]), + bswap(value[5]), + bswap(value[6]), + bswap(value[7]), + ]; + unsafe { core::mem::transmute::<_, [u8; 16]>(addr16) } +} diff --git a/tests/codegen/drop-in-place-noalias.rs b/tests/codegen/drop-in-place-noalias.rs index 2dc769df1c9..bff2f52781f 100644 --- a/tests/codegen/drop-in-place-noalias.rs +++ b/tests/codegen/drop-in-place-noalias.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes // Tests that the compiler can apply `noalias` and other &mut attributes to `drop_in_place`. // Note that non-Unpin types should not get `noalias`, matching &mut behavior. diff --git a/tests/codegen/dst-vtable-align-nonzero.rs b/tests/codegen/dst-vtable-align-nonzero.rs index cb07e43238c..1404bd64f50 100644 --- a/tests/codegen/dst-vtable-align-nonzero.rs +++ b/tests/codegen/dst-vtable-align-nonzero.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/dst-vtable-size-range.rs b/tests/codegen/dst-vtable-size-range.rs index 69d8e68497c..670f5e8d553 100644 --- a/tests/codegen/dst-vtable-size-range.rs +++ b/tests/codegen/dst-vtable-size-range.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/emscripten-catch-unwind-js-eh.rs b/tests/codegen/emscripten-catch-unwind-js-eh.rs index b15fb40b68f..018ad5454fc 100644 --- a/tests/codegen/emscripten-catch-unwind-js-eh.rs +++ b/tests/codegen/emscripten-catch-unwind-js-eh.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O --target wasm32-unknown-emscripten +//@ compile-flags: -Copt-level=3 --target wasm32-unknown-emscripten //@ needs-llvm-components: webassembly // Emscripten has its own unique implementation of catch_unwind (in `codegen_emcc_try`), diff --git a/tests/codegen/emscripten-catch-unwind-wasm-eh.rs b/tests/codegen/emscripten-catch-unwind-wasm-eh.rs index 72395f432d5..0fc9ae96720 100644 --- a/tests/codegen/emscripten-catch-unwind-wasm-eh.rs +++ b/tests/codegen/emscripten-catch-unwind-wasm-eh.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O --target wasm32-unknown-emscripten -Z emscripten-wasm-eh +//@ compile-flags: -Copt-level=3 --target wasm32-unknown-emscripten -Z emscripten-wasm-eh //@ needs-llvm-components: webassembly // Emscripten catch_unwind using wasm exceptions diff --git a/tests/codegen/enum/enum-bounds-check-derived-idx.rs b/tests/codegen/enum/enum-bounds-check-derived-idx.rs index 15280cb2e6c..a5785f4addf 100644 --- a/tests/codegen/enum/enum-bounds-check-derived-idx.rs +++ b/tests/codegen/enum/enum-bounds-check-derived-idx.rs @@ -1,6 +1,6 @@ // This test checks an optimization that is not guaranteed to work. This test case should not block // a future LLVM update. -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/enum/enum-bounds-check-issue-13926.rs b/tests/codegen/enum/enum-bounds-check-issue-13926.rs index b60ff38ce39..6e8e5035b0d 100644 --- a/tests/codegen/enum/enum-bounds-check-issue-13926.rs +++ b/tests/codegen/enum/enum-bounds-check-issue-13926.rs @@ -1,6 +1,6 @@ // This test checks an optimization that is not guaranteed to work. This test case should not block // a future LLVM update. -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/enum/enum-bounds-check.rs b/tests/codegen/enum/enum-bounds-check.rs index c44c007ed6a..5362598ca7c 100644 --- a/tests/codegen/enum/enum-bounds-check.rs +++ b/tests/codegen/enum/enum-bounds-check.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/enum/enum-debug-niche-2.rs b/tests/codegen/enum/enum-debug-niche-2.rs index 58f43fe3ec6..80a4081f15b 100644 --- a/tests/codegen/enum/enum-debug-niche-2.rs +++ b/tests/codegen/enum/enum-debug-niche-2.rs @@ -5,8 +5,8 @@ //@ ignore-msvc // // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_variant_part,{{.*}}size: 32,{{.*}} -// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Placeholder",{{.*}}extraData: i128 4294967295{{[,)].*}} -// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i128 0{{[,)].*}} +// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Placeholder",{{.*}}extraData: i32 -1{{[,)].*}} +// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i32 0{{[,)].*}} #![feature(never_type)] #[derive(Copy, Clone)] diff --git a/tests/codegen/enum/enum-early-otherwise-branch.rs b/tests/codegen/enum/enum-early-otherwise-branch.rs index 07c8aed2624..8d39d8e9b74 100644 --- a/tests/codegen/enum/enum-early-otherwise-branch.rs +++ b/tests/codegen/enum/enum-early-otherwise-branch.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/enum/unreachable_enum_default_branch.rs b/tests/codegen/enum/unreachable_enum_default_branch.rs index 76a92496c07..55b165fc111 100644 --- a/tests/codegen/enum/unreachable_enum_default_branch.rs +++ b/tests/codegen/enum/unreachable_enum_default_branch.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/error-provide.rs b/tests/codegen/error-provide.rs index 68dd383e5cc..25a66078fd4 100644 --- a/tests/codegen/error-provide.rs +++ b/tests/codegen/error-provide.rs @@ -1,6 +1,6 @@ // Codegen test for #126242 -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(error_generic_member_access)] use std::error::Request; diff --git a/tests/codegen/external-no-mangle-statics.rs b/tests/codegen/external-no-mangle-statics.rs index a44867ff923..dc4eca8c7b4 100644 --- a/tests/codegen/external-no-mangle-statics.rs +++ b/tests/codegen/external-no-mangle-statics.rs @@ -1,6 +1,6 @@ //@ revisions: lib staticlib //@ ignore-emscripten default visibility is hidden -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ [lib] compile-flags: --crate-type lib //@ [staticlib] compile-flags: --crate-type staticlib // `#[no_mangle]`d static variables always have external linkage, i.e., no `internal` in their diff --git a/tests/codegen/f128-wasm32-callconv.rs b/tests/codegen/f128-wasm32-callconv.rs index 8b1b5e7fb01..7dccbda18f1 100644 --- a/tests/codegen/f128-wasm32-callconv.rs +++ b/tests/codegen/f128-wasm32-callconv.rs @@ -1,7 +1,7 @@ //! Verify that Rust implements the expected calling convention for `f128` //@ add-core-stubs -//@ compile-flags: -O --target wasm32-wasip1 +//@ compile-flags: -Copt-level=3 --target wasm32-wasip1 //@ needs-llvm-components: webassembly #![crate_type = "lib"] diff --git a/tests/codegen/fastcall-inreg.rs b/tests/codegen/fastcall-inreg.rs index 2459ec1539e..00b390bf1bf 100644 --- a/tests/codegen/fastcall-inreg.rs +++ b/tests/codegen/fastcall-inreg.rs @@ -2,7 +2,7 @@ // as "inreg" like the C/C++ compilers for the platforms. // x86 only. -//@ compile-flags: --target i686-unknown-linux-gnu -O -C no-prepopulate-passes +//@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3 //@ needs-llvm-components: x86 #![crate_type = "lib"] diff --git a/tests/codegen/fewer-names.rs b/tests/codegen/fewer-names.rs index a171629a076..ff7a916b619 100644 --- a/tests/codegen/fewer-names.rs +++ b/tests/codegen/fewer-names.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Coverflow-checks=no -O +//@ compile-flags: -Coverflow-checks=no -Copt-level=3 //@ revisions: YES NO //@ [YES]compile-flags: -Zfewer-names=yes //@ [NO] compile-flags: -Zfewer-names=no diff --git a/tests/codegen/float/f128.rs b/tests/codegen/float/f128.rs index 514d35433e1..d87bab1172a 100644 --- a/tests/codegen/float/f128.rs +++ b/tests/codegen/float/f128.rs @@ -1,11 +1,18 @@ // 32-bit x86 returns float types differently to avoid the x87 stack. // 32-bit systems will return 128bit values using a return area pointer. -//@ revisions: x86 bit32 bit64 -//@[x86] only-x86 +// Emscripten aligns f128 to 8 bytes, not 16. +//@ revisions: x86-sse x86-nosse bit32 bit64 emscripten +//@[x86-sse] only-x86 +//@[x86-sse] only-rustc_abi-x86-sse2 +//@[x86-nosse] only-x86 +//@[x86-nosse] ignore-rustc_abi-x86-sse2 //@[bit32] ignore-x86 +//@[bit32] ignore-emscripten //@[bit32] only-32bit //@[bit64] ignore-x86 +//@[bit64] ignore-emscripten //@[bit64] only-64bit +//@[emscripten] only-emscripten // Verify that our intrinsics generate the correct LLVM calls for f128 @@ -56,54 +63,66 @@ pub fn f128_le(a: f128, b: f128) -> bool { a <= b } -// x86-LABEL: void @f128_neg({{.*}}sret([16 x i8]) +// x86-nosse-LABEL: void @f128_neg({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @f128_neg(fp128 // bit32-LABEL: void @f128_neg({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @f128_neg( +// emscripten-LABEL: void @f128_neg({{.*}}sret([16 x i8]) #[no_mangle] pub fn f128_neg(a: f128) -> f128 { // CHECK: fneg fp128 -a } -// x86-LABEL: void @f128_add({{.*}}sret([16 x i8]) +// x86-nosse-LABEL: void @f128_add({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @f128_add(fp128 // bit32-LABEL: void @f128_add({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @f128_add( +// emscripten-LABEL: void @f128_add({{.*}}sret([16 x i8]) #[no_mangle] pub fn f128_add(a: f128, b: f128) -> f128 { // CHECK: fadd fp128 %{{.+}}, %{{.+}} a + b } -// x86-LABEL: void @f128_sub({{.*}}sret([16 x i8]) +// x86-nosse-LABEL: void @f128_sub({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @f128_sub(fp128 // bit32-LABEL: void @f128_sub({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @f128_sub( +// emscripten-LABEL: void @f128_sub({{.*}}sret([16 x i8]) #[no_mangle] pub fn f128_sub(a: f128, b: f128) -> f128 { // CHECK: fsub fp128 %{{.+}}, %{{.+}} a - b } -// x86-LABEL: void @f128_mul({{.*}}sret([16 x i8]) +// x86-nosse-LABEL: void @f128_mul({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @f128_mul(fp128 // bit32-LABEL: void @f128_mul({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @f128_mul( +// emscripten-LABEL: void @f128_mul({{.*}}sret([16 x i8]) #[no_mangle] pub fn f128_mul(a: f128, b: f128) -> f128 { // CHECK: fmul fp128 %{{.+}}, %{{.+}} a * b } -// x86-LABEL: void @f128_div({{.*}}sret([16 x i8]) +// x86-nosse-LABEL: void @f128_div({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @f128_div(fp128 // bit32-LABEL: void @f128_div({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @f128_div( +// emscripten-LABEL: void @f128_div({{.*}}sret([16 x i8]) #[no_mangle] pub fn f128_div(a: f128, b: f128) -> f128 { // CHECK: fdiv fp128 %{{.+}}, %{{.+}} a / b } -// x86-LABEL: void @f128_rem({{.*}}sret([16 x i8]) +// x86-nosse-LABEL: void @f128_rem({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @f128_rem(fp128 // bit32-LABEL: void @f128_rem({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @f128_rem( +// emscripten-LABEL: void @f128_rem({{.*}}sret([16 x i8]) #[no_mangle] pub fn f128_rem(a: f128, b: f128) -> f128 { // CHECK: frem fp128 %{{.+}}, %{{.+}} @@ -152,7 +171,8 @@ pub fn f128_rem_assign(a: &mut f128, b: f128) { /* float to float conversions */ -// x86-LABEL: i16 @f128_as_f16( +// x86-sse-LABEL: <2 x i8> @f128_as_f16( +// x86-nosse-LABEL: i16 @f128_as_f16( // bits32-LABEL: half @f128_as_f16( // bits64-LABEL: half @f128_as_f16( #[no_mangle] @@ -161,56 +181,69 @@ pub fn f128_as_f16(a: f128) -> f16 { a as f16 } -// x86-LABEL: i32 @f128_as_f32( +// x86-sse-LABEL: <4 x i8> @f128_as_f32( +// x86-nosse-LABEL: i32 @f128_as_f32( // bit32-LABEL: float @f128_as_f32( // bit64-LABEL: float @f128_as_f32( +// emscripten-LABEL: float @f128_as_f32( #[no_mangle] pub fn f128_as_f32(a: f128) -> f32 { // CHECK: fptrunc fp128 %{{.+}} to float a as f32 } -// x86-LABEL: void @f128_as_f64( +// x86-sse-LABEL: <8 x i8> @f128_as_f64( +// x86-nosse-LABEL: void @f128_as_f64({{.*}}sret([8 x i8]) // bit32-LABEL: double @f128_as_f64( // bit64-LABEL: double @f128_as_f64( +// emscripten-LABEL: double @f128_as_f64( #[no_mangle] pub fn f128_as_f64(a: f128) -> f64 { // CHECK: fptrunc fp128 %{{.+}} to double a as f64 } -// x86-LABEL: void @f128_as_self({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @f128_as_self( +// x86-nosse-LABEL: void @f128_as_self({{.*}}sret([16 x i8]) // bit32-LABEL: void @f128_as_self({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @f128_as_self( +// emscripten-LABEL: void @f128_as_self({{.*}}sret([16 x i8]) #[no_mangle] pub fn f128_as_self(a: f128) -> f128 { // x86: store fp128 %a, ptr %_0, align 16 // bit32: store fp128 %a, ptr %_0, align 16 // bit64: ret fp128 %{{.+}} + // emscripten: store fp128 %a, ptr %_0, align 8 a as f128 } -// x86-LABEL: void @f16_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @f16_as_f128( +// x86-nosse-LABEL: void @f16_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @f16_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @f16_as_f128( +// emscripten-LABEL: void @f16_as_f128({{.*}}sret([16 x i8]) #[no_mangle] pub fn f16_as_f128(a: f16) -> f128 { // CHECK: fpext half %{{.+}} to fp128 a as f128 } -// x86-LABEL: void @f32_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @f32_as_f128( +// x86-nosse-LABEL: void @f32_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @f32_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @f32_as_f128( +// emscripten-LABEL: void @f32_as_f128({{.*}}sret([16 x i8]) #[no_mangle] pub fn f32_as_f128(a: f32) -> f128 { // CHECK: fpext float %{{.+}} to fp128 a as f128 } -// x86-LABEL: void @f64_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @f64_as_f128( +// x86-nosse-LABEL: void @f64_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @f64_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @f64_as_f128( +// emscripten-LABEL: void @f64_as_f128({{.*}}sret([16 x i8]) #[no_mangle] pub fn f64_as_f128(a: f64) -> f128 { // CHECK: fpext double %{{.+}} to fp128 @@ -246,9 +279,11 @@ pub fn f128_as_u64(a: f128) -> u64 { a as u64 } -// x86-LABEL: void @f128_as_u128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: void @f128_as_u128({{.*}}sret([16 x i8]) +// x86-nosse-LABEL: void @f128_as_u128({{.*}}sret([16 x i8]) // bit32-LABEL: void @f128_as_u128({{.*}}sret([16 x i8]) // bit64-LABEL: i128 @f128_as_u128( +// emscripten-LABEL: void @f128_as_u128({{.*}}sret([16 x i8]) #[no_mangle] pub fn f128_as_u128(a: f128) -> u128 { // CHECK: call i128 @llvm.fptoui.sat.i128.f128(fp128 %{{.+}}) @@ -282,9 +317,11 @@ pub fn f128_as_i64(a: f128) -> i64 { a as i64 } -// x86-LABEL: void @f128_as_i128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: void @f128_as_i128({{.*}}sret([16 x i8]) +// x86-nosse-LABEL: void @f128_as_i128({{.*}}sret([16 x i8]) // bit32-LABEL: void @f128_as_i128({{.*}}sret([16 x i8]) // bit64-LABEL: i128 @f128_as_i128( +// emscripten-LABEL: void @f128_as_i128({{.*}}sret([16 x i8]) #[no_mangle] pub fn f128_as_i128(a: f128) -> i128 { // CHECK: call i128 @llvm.fptosi.sat.i128.f128(fp128 %{{.+}}) @@ -293,90 +330,110 @@ pub fn f128_as_i128(a: f128) -> i128 { /* int to float conversions */ -// x86-LABEL: void @u8_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @u8_as_f128( +// x86-nosse-LABEL: void @u8_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @u8_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @u8_as_f128( +// emscripten-LABEL: void @u8_as_f128({{.*}}sret([16 x i8]) #[no_mangle] pub fn u8_as_f128(a: u8) -> f128 { // CHECK: uitofp i8 %{{.+}} to fp128 a as f128 } -// x86-LABEL: void @u16_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @u16_as_f128( +// x86-nosse-LABEL: void @u16_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @u16_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @u16_as_f128( +// emscripten-LABEL: void @u16_as_f128({{.*}}sret([16 x i8]) #[no_mangle] pub fn u16_as_f128(a: u16) -> f128 { // CHECK: uitofp i16 %{{.+}} to fp128 a as f128 } -// x86-LABEL: void @u32_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @u32_as_f128( +// x86-nosse-LABEL: void @u32_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @u32_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @u32_as_f128( +// emscripten-LABEL: void @u32_as_f128({{.*}}sret([16 x i8]) #[no_mangle] pub fn u32_as_f128(a: u32) -> f128 { // CHECK: uitofp i32 %{{.+}} to fp128 a as f128 } -// x86-LABEL: void @u64_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @u64_as_f128( +// x86-nosse-LABEL: void @u64_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @u64_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @u64_as_f128( +// emscripten-LABEL: void @u64_as_f128({{.*}}sret([16 x i8]) #[no_mangle] pub fn u64_as_f128(a: u64) -> f128 { // CHECK: uitofp i64 %{{.+}} to fp128 a as f128 } -// x86-LABEL: void @u128_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @u128_as_f128( +// x86-nosse-LABEL: void @u128_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @u128_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @u128_as_f128( +// emscripten-LABEL: void @u128_as_f128({{.*}}sret([16 x i8]) #[no_mangle] pub fn u128_as_f128(a: u128) -> f128 { // CHECK: uitofp i128 %{{.+}} to fp128 a as f128 } -// x86-LABEL: void @i8_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @i8_as_f128( +// x86-nosse-LABEL: void @i8_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @i8_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @i8_as_f128( +// emscripten-LABEL: void @i8_as_f128({{.*}}sret([16 x i8]) #[no_mangle] pub fn i8_as_f128(a: i8) -> f128 { // CHECK: sitofp i8 %{{.+}} to fp128 a as f128 } -// x86-LABEL: void @i16_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @i16_as_f128( +// x86-nosse-LABEL: void @i16_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @i16_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @i16_as_f128( +// emscripten-LABEL: void @i16_as_f128({{.*}}sret([16 x i8]) #[no_mangle] pub fn i16_as_f128(a: i16) -> f128 { // CHECK: sitofp i16 %{{.+}} to fp128 a as f128 } -// x86-LABEL: void @i32_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @i32_as_f128( +// x86-nosse-LABEL: void @i32_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @i32_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @i32_as_f128( +// emscripten-LABEL: void @i32_as_f128({{.*}}sret([16 x i8]) #[no_mangle] pub fn i32_as_f128(a: i32) -> f128 { // CHECK: sitofp i32 %{{.+}} to fp128 a as f128 } -// x86-LABEL: void @i64_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @i64_as_f128( +// x86-nosse-LABEL: void @i64_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @i64_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @i64_as_f128( +// emscripten-LABEL: void @i64_as_f128({{.*}}sret([16 x i8]) #[no_mangle] pub fn i64_as_f128(a: i64) -> f128 { // CHECK: sitofp i64 %{{.+}} to fp128 a as f128 } -// x86-LABEL: void @i128_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @i128_as_f128( +// x86-nosse-LABEL: void @i128_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @i128_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @i128_as_f128( +// emscripten-LABEL: void @i128_as_f128({{.*}}sret([16 x i8]) #[no_mangle] pub fn i128_as_f128(a: i128) -> f128 { // CHECK: sitofp i128 %{{.+}} to fp128 diff --git a/tests/codegen/float/f16.rs b/tests/codegen/float/f16.rs index 5c3a5893b9d..0c40606ad8a 100644 --- a/tests/codegen/float/f16.rs +++ b/tests/codegen/float/f16.rs @@ -1,7 +1,10 @@ // 32-bit x86 returns float types differently to avoid the x87 stack. // 32-bit systems will return 128bit values using a return area pointer. -//@ revisions: x86 bit32 bit64 -//@[x86] only-x86 +//@ revisions: x86-sse x86-nosse bit32 bit64 +//@[x86-sse] only-x86 +//@[x86-sse] only-rustc_abi-x86-sse2 +//@[x86-nosse] only-x86 +//@[x86-nosse] ignore-rustc_abi-x86-sse2 //@[bit32] ignore-x86 //@[bit32] only-32bit //@[bit64] ignore-x86 @@ -59,8 +62,10 @@ pub fn f16_le(a: f16, b: f16) -> bool { } // This is where we check the argument and return ABI for f16. -// other-LABEL: half @f16_neg(half -// x86-LABEL: i16 @f16_neg(half +// bit32-LABEL: half @f16_neg(half +// bit64-LABEL: half @f16_neg(half +// x86-sse-LABEL: <2 x i8> @f16_neg(half +// x86-nosse-LABEL: i16 @f16_neg(half #[no_mangle] pub fn f16_neg(a: f16) -> f16 { // CHECK: fneg half %{{.+}} @@ -144,17 +149,23 @@ pub fn f16_rem_assign(a: &mut f16, b: f16) { /* float to float conversions */ -// other-LABEL: half @f16_as_self( -// x86-LABEL: i16 @f16_as_self( +// bit32-LABEL: half @f16_as_self( +// bit64-LABEL: half @f16_as_self( +// x86-sse-LABEL: <2 x i8> @f16_as_self( +// x86-nosse-LABEL: i16 @f16_as_self( #[no_mangle] pub fn f16_as_self(a: f16) -> f16 { - // other-CHECK: ret half %{{.+}} - // x86-CHECK: bitcast half - // x86-CHECK: ret i16 + // bit32-CHECK: ret half %{{.+}} + // bit64-CHECK: ret half %{{.+}} + // x86-sse-CHECK: bitcast half + // x86-nosse-CHECK: bitcast half + // x86-sse-CHECK: ret i16 + // x86-nosse-CHECK: ret i16 a as f16 } -// x86-LABEL: i32 @f16_as_f32( +// x86-sse-LABEL: <4 x i8> @f16_as_f32( +// x86-nosse-LABEL: i32 @f16_as_f32( // bit32-LABEL: float @f16_as_f32( // bit64-LABEL: float @f16_as_f32( #[no_mangle] @@ -163,7 +174,8 @@ pub fn f16_as_f32(a: f16) -> f32 { a as f32 } -// x86-LABEL: void @f16_as_f64( +// x86-sse-LABEL: <8 x i8> @f16_as_f64( +// x86-nosse-LABEL: void @f16_as_f64({{.*}}sret([8 x i8]) // bit32-LABEL: double @f16_as_f64( // bit64-LABEL: double @f16_as_f64( #[no_mangle] @@ -172,7 +184,8 @@ pub fn f16_as_f64(a: f16) -> f64 { a as f64 } -// x86-LABEL: void @f16_as_f128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: <16 x i8> @f16_as_f128( +// x86-nosse-LABEL: void @f16_as_f128({{.*}}sret([16 x i8]) // bit32-LABEL: void @f16_as_f128({{.*}}sret([16 x i8]) // bit64-LABEL: fp128 @f16_as_f128( #[no_mangle] @@ -231,7 +244,8 @@ pub fn f16_as_u64(a: f16) -> u64 { a as u64 } -// x86-LABEL: void @f16_as_u128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: void @f16_as_u128({{.*}}sret([16 x i8]) +// x86-nosse-LABEL: void @f16_as_u128({{.*}}sret([16 x i8]) // bit32-LABEL: void @f16_as_u128({{.*}}sret([16 x i8]) // bit64-LABEL: i128 @f16_as_u128( #[no_mangle] @@ -267,7 +281,8 @@ pub fn f16_as_i64(a: f16) -> i64 { a as i64 } -// x86-LABEL: void @f16_as_i128({{.*}}sret([16 x i8]) +// x86-sse-LABEL: void @f16_as_i128({{.*}}sret([16 x i8]) +// x86-nosse-LABEL: void @f16_as_i128({{.*}}sret([16 x i8]) // bit32-LABEL: void @f16_as_i128({{.*}}sret([16 x i8]) // bit64-LABEL: i128 @f16_as_i128( #[no_mangle] diff --git a/tests/codegen/force-no-unwind-tables.rs b/tests/codegen/force-no-unwind-tables.rs index e823bedac0f..1de5e0858e0 100644 --- a/tests/codegen/force-no-unwind-tables.rs +++ b/tests/codegen/force-no-unwind-tables.rs @@ -1,5 +1,5 @@ //@ compile-flags: -C no-prepopulate-passes -C panic=abort -C force-unwind-tables=n -//@ ignore-windows +//@ ignore-windows: unwind tables are required for panics on Windows #![crate_type = "lib"] diff --git a/tests/codegen/function-arguments.rs b/tests/codegen/function-arguments.rs index 503799d3ed2..f0708a7a109 100644 --- a/tests/codegen/function-arguments.rs +++ b/tests/codegen/function-arguments.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes #![crate_type = "lib"] #![feature(rustc_attrs)] #![feature(dyn_star)] @@ -135,7 +135,7 @@ pub fn mutable_notunpin_borrow(_: &mut NotUnpin) {} #[no_mangle] pub fn notunpin_borrow(_: &NotUnpin) {} -// CHECK: @indirect_struct(ptr noalias nocapture noundef readonly align 4 dereferenceable(32) %_1) +// CHECK: @indirect_struct(ptr noalias{{( nocapture)?}} noundef readonly align 4{{( captures\(none\))?}} dereferenceable(32) %_1) #[no_mangle] pub fn indirect_struct(_: S) {} @@ -198,7 +198,7 @@ pub fn notunpin_box(x: Box<NotUnpin>) -> Box<NotUnpin> { x } -// CHECK: @struct_return(ptr{{( dead_on_unwind)?}} noalias nocapture noundef{{( writable)?}} sret([32 x i8]) align 4 dereferenceable(32){{( %_0)?}}) +// CHECK: @struct_return(ptr{{( dead_on_unwind)?}} noalias{{( nocapture)?}} noundef{{( writable)?}} sret([32 x i8]) align 4{{( captures\(none\))?}} dereferenceable(32){{( %_0)?}}) #[no_mangle] pub fn struct_return() -> S { S { _field: [0, 0, 0, 0, 0, 0, 0, 0] } diff --git a/tests/codegen/hint/cold_path.rs b/tests/codegen/hint/cold_path.rs index dac72073f85..149abe474f6 100644 --- a/tests/codegen/hint/cold_path.rs +++ b/tests/codegen/hint/cold_path.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(cold_path)] diff --git a/tests/codegen/hint/likely.rs b/tests/codegen/hint/likely.rs index 2f589cc99d2..75f9e7aae36 100644 --- a/tests/codegen/hint/likely.rs +++ b/tests/codegen/hint/likely.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(likely_unlikely)] diff --git a/tests/codegen/hint/unlikely.rs b/tests/codegen/hint/unlikely.rs index 328533f3081..248b1e2537e 100644 --- a/tests/codegen/hint/unlikely.rs +++ b/tests/codegen/hint/unlikely.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(likely_unlikely)] diff --git a/tests/codegen/i128-wasm32-callconv.rs b/tests/codegen/i128-wasm32-callconv.rs index c6d25fbe8be..9d73d270ef3 100644 --- a/tests/codegen/i128-wasm32-callconv.rs +++ b/tests/codegen/i128-wasm32-callconv.rs @@ -1,7 +1,7 @@ //! Verify that Rust implements the expected calling convention for `i128`/`u128`. //@ add-core-stubs -//@ compile-flags: -O --target wasm32-wasip1 +//@ compile-flags: -Copt-level=3 --target wasm32-wasip1 //@ needs-llvm-components: webassembly #![crate_type = "lib"] diff --git a/tests/codegen/i128-x86-align.rs b/tests/codegen/i128-x86-align.rs index 6b1da445c40..75802b0c505 100644 --- a/tests/codegen/i128-x86-align.rs +++ b/tests/codegen/i128-x86-align.rs @@ -1,5 +1,5 @@ //@ only-x86_64 -//@ compile-flags: -O -C no-prepopulate-passes --crate-type=lib +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --crate-type=lib // On LLVM 17 and earlier LLVM's own data layout specifies that i128 has 8 byte alignment, // while rustc wants it to have 16 byte alignment. This test checks that we handle this @@ -19,8 +19,10 @@ pub struct ScalarPair { #[no_mangle] pub fn load(x: &ScalarPair) -> ScalarPair { // CHECK-LABEL: @load( - // CHECK-SAME: sret([32 x i8]) align 16 dereferenceable(32) %_0, - // CHECK-SAME: align 16 dereferenceable(32) %x + // CHECK-SAME: sret([32 x i8]) align 16 + // CHECK-SAME: dereferenceable(32) %_0, + // CHECK-SAME: align 16 + // CHECK-SAME: dereferenceable(32) %x // CHECK: [[A:%.*]] = load i32, ptr %x, align 16 // CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr %x, i64 16 // CHECK-NEXT: [[B:%.*]] = load i128, ptr [[GEP]], align 16 @@ -34,7 +36,8 @@ pub fn load(x: &ScalarPair) -> ScalarPair { #[no_mangle] pub fn store(x: &mut ScalarPair) { // CHECK-LABEL: @store( - // CHECK-SAME: align 16 dereferenceable(32) %x + // CHECK-SAME: align 16 + // CHECK-SAME: dereferenceable(32) %x // CHECK: store i32 1, ptr %x, align 16 // CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr %x, i64 16 // CHECK-NEXT: store i128 2, ptr [[GEP]], align 16 @@ -55,8 +58,10 @@ pub fn alloca() { #[no_mangle] pub fn load_volatile(x: &ScalarPair) -> ScalarPair { // CHECK-LABEL: @load_volatile( - // CHECK-SAME: sret([32 x i8]) align 16 dereferenceable(32) %_0, - // CHECK-SAME: align 16 dereferenceable(32) %x + // CHECK-SAME: sret([32 x i8]) align 16 + // CHECK-SAME: dereferenceable(32) %_0, + // CHECK-SAME: align 16 + // CHECK-SAME: dereferenceable(32) %x // CHECK: [[LOAD:%.*]] = load volatile %ScalarPair, ptr %x, align 16 // CHECK-NEXT: store %ScalarPair [[LOAD]], ptr %_0, align 16 // CHECK-NEXT: ret void @@ -66,7 +71,8 @@ pub fn load_volatile(x: &ScalarPair) -> ScalarPair { #[no_mangle] pub fn transmute(x: ScalarPair) -> (std::mem::MaybeUninit<i128>, i128) { // CHECK-LABEL: @transmute( - // CHECK-SAME: sret([32 x i8]) align 16 dereferenceable(32) %_0, + // CHECK-SAME: sret([32 x i8]) align 16 + // CHECK-SAME: dereferenceable(32) %_0, // CHECK-SAME: i32 noundef %x.0, i128 noundef %x.1 // CHECK: store i32 %x.0, ptr %_0, align 16 // CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr %_0, i64 16 @@ -86,7 +92,8 @@ pub struct Struct { #[no_mangle] pub fn store_struct(x: &mut Struct) { // CHECK-LABEL: @store_struct( - // CHECK-SAME: align 16 dereferenceable(32) %x + // CHECK-SAME: align 16 + // CHECK-SAME: dereferenceable(32) %x // CHECK: [[TMP:%.*]] = alloca [32 x i8], align 16 // CHECK: store i32 1, ptr [[TMP]], align 16 // CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds i8, ptr [[TMP]], i64 4 diff --git a/tests/codegen/integer-overflow.rs b/tests/codegen/integer-overflow.rs index a6407476fc2..80362247a86 100644 --- a/tests/codegen/integer-overflow.rs +++ b/tests/codegen/integer-overflow.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C overflow-checks=on +//@ compile-flags: -Copt-level=3 -C overflow-checks=on #![crate_type = "lib"] diff --git a/tests/codegen/intrinsics/aggregate-thin-pointer.rs b/tests/codegen/intrinsics/aggregate-thin-pointer.rs index aa3bf7e8b14..bd590ce9180 100644 --- a/tests/codegen/intrinsics/aggregate-thin-pointer.rs +++ b/tests/codegen/intrinsics/aggregate-thin-pointer.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes -Z mir-enable-passes=-InstSimplify +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Z mir-enable-passes=-InstSimplify //@ only-64bit (so I don't need to worry about usize) #![crate_type = "lib"] diff --git a/tests/codegen/intrinsics/cold_path.rs b/tests/codegen/intrinsics/cold_path.rs index 24ee84e07bf..fd75324b671 100644 --- a/tests/codegen/intrinsics/cold_path.rs +++ b/tests/codegen/intrinsics/cold_path.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/intrinsics/cold_path2.rs b/tests/codegen/intrinsics/cold_path2.rs new file mode 100644 index 00000000000..1e7e0478f4f --- /dev/null +++ b/tests/codegen/intrinsics/cold_path2.rs @@ -0,0 +1,36 @@ +//@ compile-flags: -O +#![crate_type = "lib"] +#![feature(core_intrinsics)] + +use std::intrinsics::cold_path; + +#[inline(never)] +#[no_mangle] +pub fn path_a() { + println!("path a"); +} + +#[inline(never)] +#[no_mangle] +pub fn path_b() { + println!("path b"); +} + +#[no_mangle] +pub fn test(x: Option<bool>) { + if let Some(_) = x { + path_a(); + } else { + cold_path(); + path_b(); + } + + // CHECK-LABEL: @test( + // CHECK: br i1 %1, label %bb2, label %bb1, !prof ![[NUM:[0-9]+]] + // CHECK: bb1: + // CHECK: path_a + // CHECK: bb2: + // CHECK: path_b +} + +// CHECK: ![[NUM]] = !{!"branch_weights", {{(!"expected", )?}}i32 1, i32 2000} diff --git a/tests/codegen/intrinsics/cold_path3.rs b/tests/codegen/intrinsics/cold_path3.rs new file mode 100644 index 00000000000..bf3347de665 --- /dev/null +++ b/tests/codegen/intrinsics/cold_path3.rs @@ -0,0 +1,87 @@ +//@ compile-flags: -O +#![crate_type = "lib"] +#![feature(core_intrinsics)] + +use std::intrinsics::cold_path; + +#[inline(never)] +#[no_mangle] +pub fn path_a() { + println!("path a"); +} + +#[inline(never)] +#[no_mangle] +pub fn path_b() { + println!("path b"); +} + +#[inline(never)] +#[no_mangle] +pub fn path_c() { + println!("path c"); +} + +#[inline(never)] +#[no_mangle] +pub fn path_d() { + println!("path d"); +} + +#[no_mangle] +pub fn test(x: Option<u32>) { + match x { + Some(0) => path_a(), + Some(1) => { + cold_path(); + path_b() + } + Some(2) => path_c(), + Some(3) => { + cold_path(); + path_d() + } + _ => path_a(), + } + + // CHECK-LABEL: @test( + // CHECK: switch i32 %1, label %bb1 [ + // CHECK: i32 0, label %bb6 + // CHECK: i32 1, label %bb5 + // CHECK: i32 2, label %bb4 + // CHECK: i32 3, label %bb3 + // CHECK: ], !prof ![[NUM1:[0-9]+]] +} + +#[no_mangle] +pub fn test2(x: Option<u32>) { + match x { + Some(10) => path_a(), + Some(11) => { + cold_path(); + path_b() + } + Some(12) => { + unsafe { core::intrinsics::unreachable() }; + path_c() + } + Some(13) => { + cold_path(); + path_d() + } + _ => { + cold_path(); + path_a() + } + } + + // CHECK-LABEL: @test2( + // CHECK: switch i32 %1, label %bb1 [ + // CHECK: i32 10, label %bb5 + // CHECK: i32 11, label %bb4 + // CHECK: i32 13, label %bb3 + // CHECK: ], !prof ![[NUM2:[0-9]+]] +} + +// CHECK: ![[NUM1]] = !{!"branch_weights", i32 2000, i32 2000, i32 1, i32 2000, i32 1} +// CHECK: ![[NUM2]] = !{!"branch_weights", i32 1, i32 2000, i32 1, i32 1} diff --git a/tests/codegen/intrinsics/compare_bytes.rs b/tests/codegen/intrinsics/compare_bytes.rs index cd592918fb0..3ab0e4e97e0 100644 --- a/tests/codegen/intrinsics/compare_bytes.rs +++ b/tests/codegen/intrinsics/compare_bytes.rs @@ -1,5 +1,5 @@ //@ revisions: INT32 INT16 -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ [INT32] ignore-16bit //@ [INT16] only-16bit diff --git a/tests/codegen/intrinsics/disjoint_bitor.rs b/tests/codegen/intrinsics/disjoint_bitor.rs new file mode 100644 index 00000000000..fc45439ee0b --- /dev/null +++ b/tests/codegen/intrinsics/disjoint_bitor.rs @@ -0,0 +1,30 @@ +//@ compile-flags: -C no-prepopulate-passes -Z mir-opt-level=0 + +#![crate_type = "lib"] +#![feature(core_intrinsics)] + +use std::intrinsics::disjoint_bitor; + +// CHECK-LABEL: @disjoint_bitor_signed +#[no_mangle] +pub unsafe fn disjoint_bitor_signed(x: i32, y: i32) -> i32 { + // CHECK: or disjoint i32 %x, %y + disjoint_bitor(x, y) +} + +// CHECK-LABEL: @disjoint_bitor_unsigned +#[no_mangle] +pub unsafe fn disjoint_bitor_unsigned(x: u64, y: u64) -> u64 { + // CHECK: or disjoint i64 %x, %y + disjoint_bitor(x, y) +} + +// CHECK-LABEL: @disjoint_bitor_literal +#[no_mangle] +pub unsafe fn disjoint_bitor_literal() -> u8 { + // This is a separate check because even without any passes, + // LLVM will fold so it's not an instruction, which can assert in LLVM. + + // CHECK: store i8 3 + disjoint_bitor(1, 2) +} diff --git a/tests/codegen/intrinsics/likely.rs b/tests/codegen/intrinsics/likely.rs index e318390db20..c5e3c466f45 100644 --- a/tests/codegen/intrinsics/likely.rs +++ b/tests/codegen/intrinsics/likely.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/intrinsics/likely_assert.rs b/tests/codegen/intrinsics/likely_assert.rs index 0ddbd6206ae..87ffb4ee3fb 100644 --- a/tests/codegen/intrinsics/likely_assert.rs +++ b/tests/codegen/intrinsics/likely_assert.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #[no_mangle] diff --git a/tests/codegen/intrinsics/nontemporal.rs b/tests/codegen/intrinsics/nontemporal.rs index ff2d6296066..af8892d30e7 100644 --- a/tests/codegen/intrinsics/nontemporal.rs +++ b/tests/codegen/intrinsics/nontemporal.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@revisions: with_nontemporal without_nontemporal //@[with_nontemporal] compile-flags: --target aarch64-unknown-linux-gnu //@[with_nontemporal] needs-llvm-components: aarch64 diff --git a/tests/codegen/intrinsics/offset.rs b/tests/codegen/intrinsics/offset.rs index d4791cd30b0..d76d3e705ab 100644 --- a/tests/codegen/intrinsics/offset.rs +++ b/tests/codegen/intrinsics/offset.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/intrinsics/ptr_metadata.rs b/tests/codegen/intrinsics/ptr_metadata.rs index f4bf5a1f5f1..87a32fa3d24 100644 --- a/tests/codegen/intrinsics/ptr_metadata.rs +++ b/tests/codegen/intrinsics/ptr_metadata.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes -Z inline-mir +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Z inline-mir //@ only-64bit (so I don't need to worry about usize) #![crate_type = "lib"] diff --git a/tests/codegen/intrinsics/select_unpredictable.rs b/tests/codegen/intrinsics/select_unpredictable.rs index ea6127a48bf..68a02c8342d 100644 --- a/tests/codegen/intrinsics/select_unpredictable.rs +++ b/tests/codegen/intrinsics/select_unpredictable.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Zmerge-functions=disabled +//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled #![feature(core_intrinsics)] #![feature(select_unpredictable)] diff --git a/tests/codegen/intrinsics/transmute-niched.rs b/tests/codegen/intrinsics/transmute-niched.rs index 88119ccb8b2..5ded0e192fa 100644 --- a/tests/codegen/intrinsics/transmute-niched.rs +++ b/tests/codegen/intrinsics/transmute-niched.rs @@ -6,6 +6,7 @@ use std::mem::transmute; use std::num::NonZero; +use std::ptr::NonNull; #[repr(u8)] pub enum SmallEnum { @@ -192,3 +193,31 @@ pub unsafe fn check_bool_to_ordering(x: bool) -> std::cmp::Ordering { transmute(x) } + +// CHECK-LABEL: @check_nonnull_to_ptr( +#[no_mangle] +pub unsafe fn check_nonnull_to_ptr(x: NonNull<u8>) -> *const u8 { + // CHECK-NOT: icmp + // CHECK-NOT: assume + // OPT: %0 = icmp ne ptr %x, null + // OPT: call void @llvm.assume(i1 %0) + // CHECK-NOT: icmp + // CHECK-NOT: assume + // CHECK: ret ptr %x + + transmute(x) +} + +// CHECK-LABEL: @check_ptr_to_nonnull( +#[no_mangle] +pub unsafe fn check_ptr_to_nonnull(x: *const u8) -> NonNull<u8> { + // CHECK-NOT: icmp + // CHECK-NOT: assume + // OPT: %0 = icmp ne ptr %x, null + // OPT: call void @llvm.assume(i1 %0) + // CHECK-NOT: icmp + // CHECK-NOT: assume + // CHECK: ret ptr %x + + transmute(x) +} diff --git a/tests/codegen/intrinsics/transmute-x64.rs b/tests/codegen/intrinsics/transmute-x64.rs index ea1c6b0e7e8..be45e4db90f 100644 --- a/tests/codegen/intrinsics/transmute-x64.rs +++ b/tests/codegen/intrinsics/transmute-x64.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@ only-x86_64 (it's using arch-specific types) #![crate_type = "lib"] @@ -6,15 +6,6 @@ use std::arch::x86_64::{__m128, __m128i, __m256i}; use std::mem::transmute; -// CHECK-LABEL: @check_sse_float_to_int( -#[no_mangle] -pub unsafe fn check_sse_float_to_int(x: __m128) -> __m128i { - // CHECK-NOT: alloca - // CHECK: %0 = load <4 x float>, ptr %x, align 16 - // CHECK: store <4 x float> %0, ptr %_0, align 16 - transmute(x) -} - // CHECK-LABEL: @check_sse_pair_to_avx( #[no_mangle] pub unsafe fn check_sse_pair_to_avx(x: (__m128i, __m128i)) -> __m256i { diff --git a/tests/codegen/intrinsics/transmute.rs b/tests/codegen/intrinsics/transmute.rs index 8c8e975d327..5b40a6a12c0 100644 --- a/tests/codegen/intrinsics/transmute.rs +++ b/tests/codegen/intrinsics/transmute.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@ only-64bit (so I don't need to worry about usize) #![crate_type = "lib"] @@ -370,9 +370,11 @@ pub unsafe fn check_issue_110005(x: (usize, bool)) -> Option<Box<[u8]>> { #[no_mangle] pub unsafe fn check_pair_to_dst_ref<'a>(x: (usize, usize)) -> &'a [u8] { // CHECK: %_0.0 = getelementptr i8, ptr null, i64 %x.0 - // CHECK: %0 = insertvalue { ptr, i64 } poison, ptr %_0.0, 0 - // CHECK: %1 = insertvalue { ptr, i64 } %0, i64 %x.1, 1 - // CHECK: ret { ptr, i64 } %1 + // CHECK: %0 = icmp ne ptr %_0.0, null + // CHECK: call void @llvm.assume(i1 %0) + // CHECK: %1 = insertvalue { ptr, i64 } poison, ptr %_0.0, 0 + // CHECK: %2 = insertvalue { ptr, i64 } %1, i64 %x.1, 1 + // CHECK: ret { ptr, i64 } %2 transmute(x) } diff --git a/tests/codegen/intrinsics/unlikely.rs b/tests/codegen/intrinsics/unlikely.rs index 2d776031a52..90ebf070d27 100644 --- a/tests/codegen/intrinsics/unlikely.rs +++ b/tests/codegen/intrinsics/unlikely.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/is_val_statically_known.rs b/tests/codegen/is_val_statically_known.rs index fe432d3bcc4..8119d3a3bf6 100644 --- a/tests/codegen/is_val_statically_known.rs +++ b/tests/codegen/is_val_statically_known.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --crate-type=lib -Zmerge-functions=disabled -O +//@ compile-flags: --crate-type=lib -Zmerge-functions=disabled -Copt-level=3 #![feature(core_intrinsics)] #![feature(f16, f128)] diff --git a/tests/codegen/issues/issue-101048.rs b/tests/codegen/issues/issue-101048.rs index fa6dc550f30..cfe65e758fd 100644 --- a/tests/codegen/issues/issue-101048.rs +++ b/tests/codegen/issues/issue-101048.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-101082.rs b/tests/codegen/issues/issue-101082.rs index 4be1b6cb168..048b69d207b 100644 --- a/tests/codegen/issues/issue-101082.rs +++ b/tests/codegen/issues/issue-101082.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ revisions: host x86-64-v3 // This particular CPU regressed in #131563 diff --git a/tests/codegen/issues/issue-101814.rs b/tests/codegen/issues/issue-101814.rs index e3843e9edb0..668ec8476e8 100644 --- a/tests/codegen/issues/issue-101814.rs +++ b/tests/codegen/issues/issue-101814.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-103132.rs b/tests/codegen/issues/issue-103132.rs index 8c1a17c8b78..623cab92806 100644 --- a/tests/codegen/issues/issue-103132.rs +++ b/tests/codegen/issues/issue-103132.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C overflow-checks +//@ compile-flags: -Copt-level=3 -C overflow-checks #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs b/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs index 122f02fbbc5..3ada5412e83 100644 --- a/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs +++ b/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C debug-assertions=yes +//@ compile-flags: -Copt-level=3 -C debug-assertions=yes #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-103327.rs b/tests/codegen/issues/issue-103327.rs index f8cf273e4a6..4de3cfd12a0 100644 --- a/tests/codegen/issues/issue-103327.rs +++ b/tests/codegen/issues/issue-103327.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-103840.rs b/tests/codegen/issues/issue-103840.rs index 14f157771e0..c6c5098bdd0 100644 --- a/tests/codegen/issues/issue-103840.rs +++ b/tests/codegen/issues/issue-103840.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] pub fn foo(t: &mut Vec<usize>) { diff --git a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs index db9eeda19a6..848aa910b58 100644 --- a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs +++ b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --crate-type=lib -O -Cdebuginfo=2 -Cno-prepopulate-passes -Zmir-enable-passes=-ScalarReplacementOfAggregates +//@ compile-flags: --crate-type=lib -Copt-level=3 -Cdebuginfo=2 -Cno-prepopulate-passes -Zmir-enable-passes=-ScalarReplacementOfAggregates // MIR SROA will decompose the closure #![feature(stmt_expr_attributes)] diff --git a/tests/codegen/issues/issue-106369.rs b/tests/codegen/issues/issue-106369.rs index fd375e4e605..3583d20c9fa 100644 --- a/tests/codegen/issues/issue-106369.rs +++ b/tests/codegen/issues/issue-106369.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-107681-unwrap_unchecked.rs b/tests/codegen/issues/issue-107681-unwrap_unchecked.rs index 7d9679d2322..fd7296de4c8 100644 --- a/tests/codegen/issues/issue-107681-unwrap_unchecked.rs +++ b/tests/codegen/issues/issue-107681-unwrap_unchecked.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ min-llvm-version: 19 // Test for #107681. diff --git a/tests/codegen/issues/issue-108395-branchy-bool-match.rs b/tests/codegen/issues/issue-108395-branchy-bool-match.rs index 24f5c0f6635..96387e791b0 100644 --- a/tests/codegen/issues/issue-108395-branchy-bool-match.rs +++ b/tests/codegen/issues/issue-108395-branchy-bool-match.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Zmerge-functions=disabled +//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled //! Test for <https://github.com/rust-lang/rust/issues/108395>. Check that //! matching on two bools with wildcards does not produce branches. #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-109328-split_first.rs b/tests/codegen/issues/issue-109328-split_first.rs index 7f7957593d2..26235edfc19 100644 --- a/tests/codegen/issues/issue-109328-split_first.rs +++ b/tests/codegen/issues/issue-109328-split_first.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-110797-enum-jump-same.rs b/tests/codegen/issues/issue-110797-enum-jump-same.rs index f114e0e260e..b5f7c08795b 100644 --- a/tests/codegen/issues/issue-110797-enum-jump-same.rs +++ b/tests/codegen/issues/issue-110797-enum-jump-same.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-111603.rs b/tests/codegen/issues/issue-111603.rs index 41bfb493ff5..2ba5a3f876a 100644 --- a/tests/codegen/issues/issue-111603.rs +++ b/tests/codegen/issues/issue-111603.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(get_mut_unchecked, new_uninit)] diff --git a/tests/codegen/issues/issue-112509-slice-get-andthen-get.rs b/tests/codegen/issues/issue-112509-slice-get-andthen-get.rs index aee2edd8dfa..3909b203d08 100644 --- a/tests/codegen/issues/issue-112509-slice-get-andthen-get.rs +++ b/tests/codegen/issues/issue-112509-slice-get-andthen-get.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] // CHECK-LABEL: @write_u8_variant_a diff --git a/tests/codegen/issues/issue-114312.rs b/tests/codegen/issues/issue-114312.rs index be5b999afd0..e9418249089 100644 --- a/tests/codegen/issues/issue-114312.rs +++ b/tests/codegen/issues/issue-114312.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-x86_64-unknown-linux-gnu // We want to check that this function does not mis-optimize to loop jumping. diff --git a/tests/codegen/issues/issue-115385-llvm-jump-threading.rs b/tests/codegen/issues/issue-115385-llvm-jump-threading.rs index 55aa69a7de0..8cabd94f202 100644 --- a/tests/codegen/issues/issue-115385-llvm-jump-threading.rs +++ b/tests/codegen/issues/issue-115385-llvm-jump-threading.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Ccodegen-units=1 +//@ compile-flags: -Copt-level=3 -Ccodegen-units=1 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-116878.rs b/tests/codegen/issues/issue-116878.rs index a09fac42c01..daf46c8bb55 100644 --- a/tests/codegen/issues/issue-116878.rs +++ b/tests/codegen/issues/issue-116878.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] /// Make sure no bounds checks are emitted after a `get_unchecked`. diff --git a/tests/codegen/issues/issue-118306.rs b/tests/codegen/issues/issue-118306.rs index 0778ab3fde9..f9f3e0c0529 100644 --- a/tests/codegen/issues/issue-118306.rs +++ b/tests/codegen/issues/issue-118306.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ min-llvm-version: 19 //@ only-x86_64 diff --git a/tests/codegen/issues/issue-118392.rs b/tests/codegen/issues/issue-118392.rs index ce2332b4c3c..07de8d9b237 100644 --- a/tests/codegen/issues/issue-118392.rs +++ b/tests/codegen/issues/issue-118392.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] // CHECK-LABEL: @div2 diff --git a/tests/codegen/issues/issue-119422.rs b/tests/codegen/issues/issue-119422.rs index 682430a79f4..e1a082c377f 100644 --- a/tests/codegen/issues/issue-119422.rs +++ b/tests/codegen/issues/issue-119422.rs @@ -1,7 +1,7 @@ //! This test checks that compiler don't generate useless compares to zeros //! for `NonZero` integer types. //! -//@ compile-flags: -O --edition=2021 -Zmerge-functions=disabled +//@ compile-flags: -Copt-level=3 --edition=2021 -Zmerge-functions=disabled //@ only-64bit (because the LLVM type of i64 for usize shows up) #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-121719-common-field-offset.rs b/tests/codegen/issues/issue-121719-common-field-offset.rs index 11a8aa8dcd1..9f5f44e0375 100644 --- a/tests/codegen/issues/issue-121719-common-field-offset.rs +++ b/tests/codegen/issues/issue-121719-common-field-offset.rs @@ -1,7 +1,7 @@ //! This test checks that match branches which all access a field //! at the same offset are merged together. //! -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #[repr(C)] diff --git a/tests/codegen/issues/issue-122600-ptr-discriminant-update.rs b/tests/codegen/issues/issue-122600-ptr-discriminant-update.rs index 4b520a62069..fdb8f06df80 100644 --- a/tests/codegen/issues/issue-122600-ptr-discriminant-update.rs +++ b/tests/codegen/issues/issue-122600-ptr-discriminant-update.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ min-llvm-version: 19 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-122805.rs b/tests/codegen/issues/issue-122805.rs deleted file mode 100644 index 16dae801ee4..00000000000 --- a/tests/codegen/issues/issue-122805.rs +++ /dev/null @@ -1,58 +0,0 @@ -//@ revisions: OPT2 OPT3WINX64 OPT3LINX64 -//@ [OPT2] compile-flags: -O -//@ [OPT3LINX64] compile-flags: -C opt-level=3 -//@ [OPT3WINX64] compile-flags: -C opt-level=3 -//@ [OPT3LINX64] only-linux -//@ [OPT3WINX64] only-windows -//@ [OPT3LINX64] only-x86_64 -//@ [OPT3WINX64] only-x86_64 -//@ min-llvm-version: 18.1.3 - -#![crate_type = "lib"] -#![no_std] - -// The code is from https://github.com/rust-lang/rust/issues/122805. -// Ensure we do not generate the shufflevector instruction -// to avoid complicating the code. -// CHECK-LABEL: define{{.*}}void @convert( -// CHECK-NOT: shufflevector -// OPT2: store i16 -// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 2 -// OPT2-NEXT: store i16 -// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 4 -// OPT2-NEXT: store i16 -// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 6 -// OPT2-NEXT: store i16 -// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 8 -// OPT2-NEXT: store i16 -// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 10 -// OPT2-NEXT: store i16 -// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 12 -// OPT2-NEXT: store i16 -// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 14 -// OPT2-NEXT: store i16 -// OPT3LINX64: load <8 x i16> -// OPT3LINX64-NEXT: call <8 x i16> @llvm.bswap -// OPT3LINX64-NEXT: store <8 x i16> -// OPT3WINX64: load <8 x i16> -// OPT3WINX64-NEXT: call <8 x i16> @llvm.bswap -// OPT3WINX64-NEXT: store <8 x i16> -// CHECK-NEXT: ret void -#[no_mangle] -pub fn convert(value: [u16; 8]) -> [u8; 16] { - #[cfg(target_endian = "little")] - let bswap = u16::to_be; - #[cfg(target_endian = "big")] - let bswap = u16::to_le; - let addr16 = [ - bswap(value[0]), - bswap(value[1]), - bswap(value[2]), - bswap(value[3]), - bswap(value[4]), - bswap(value[5]), - bswap(value[6]), - bswap(value[7]), - ]; - unsafe { core::mem::transmute::<_, [u8; 16]>(addr16) } -} diff --git a/tests/codegen/issues/issue-13018.rs b/tests/codegen/issues/issue-13018.rs index a29452436d2..8040018b931 100644 --- a/tests/codegen/issues/issue-13018.rs +++ b/tests/codegen/issues/issue-13018.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 // A drop([...].clone()) sequence on an Rc should be a no-op // In particular, no call to __rust_dealloc should be emitted diff --git a/tests/codegen/issues/issue-136329-optnone-noinline.rs b/tests/codegen/issues/issue-136329-optnone-noinline.rs new file mode 100644 index 00000000000..57c9e47a499 --- /dev/null +++ b/tests/codegen/issues/issue-136329-optnone-noinline.rs @@ -0,0 +1,21 @@ +//! Ensure that `#[optimize(none)]` functions are never inlined + +//@ compile-flags: -Copt-level=3 + +#![feature(optimize_attribute)] + +#[optimize(none)] +pub fn foo() { + let _x = 123; +} + +// CHECK-LABEL: define{{.*}}void @bar +// CHECK: start: +// CHECK: {{.*}}call {{.*}}void +// CHECK: ret void +#[no_mangle] +pub fn bar() { + foo(); +} + +fn main() {} diff --git a/tests/codegen/issues/issue-27130.rs b/tests/codegen/issues/issue-27130.rs index 9c22b41e97f..594e02af097 100644 --- a/tests/codegen/issues/issue-27130.rs +++ b/tests/codegen/issues/issue-27130.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-32031.rs b/tests/codegen/issues/issue-32031.rs index 4d6895166f1..559e8d947fb 100644 --- a/tests/codegen/issues/issue-32031.rs +++ b/tests/codegen/issues/issue-32031.rs @@ -1,7 +1,7 @@ //@ compile-flags: -C no-prepopulate-passes -Copt-level=0 // 32-bit x86 returns `f32` and `f64` differently to avoid the x87 stack. //@ revisions: x86 other -//@[x86] only-x86 +//@[x86] only-rustc_abi-x86-sse2 //@[other] ignore-x86 #![crate_type = "lib"] @@ -10,7 +10,7 @@ pub struct F32(f32); // other: define{{.*}}float @add_newtype_f32(float %a, float %b) -// x86: define{{.*}}i32 @add_newtype_f32(float %a, float %b) +// x86: define{{.*}}<4 x i8> @add_newtype_f32(float %a, float %b) #[inline(never)] #[no_mangle] pub fn add_newtype_f32(a: F32, b: F32) -> F32 { @@ -21,7 +21,7 @@ pub fn add_newtype_f32(a: F32, b: F32) -> F32 { pub struct F64(f64); // other: define{{.*}}double @add_newtype_f64(double %a, double %b) -// x86: define{{.*}}void @add_newtype_f64(ptr{{.*}}sret([8 x i8]){{.*}}%_0, double %a, double %b) +// x86: define{{.*}}<8 x i8> @add_newtype_f64(double %a, double %b) #[inline(never)] #[no_mangle] pub fn add_newtype_f64(a: F64, b: F64) -> F64 { diff --git a/tests/codegen/issues/issue-34634.rs b/tests/codegen/issues/issue-34634.rs index a11f248e740..d32fa97ec38 100644 --- a/tests/codegen/issues/issue-34634.rs +++ b/tests/codegen/issues/issue-34634.rs @@ -3,7 +3,7 @@ // switch case (the second check present until rustc 1.12). // This test also verifies that a single panic call is generated (for the division by zero case). -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] // CHECK-LABEL: @f diff --git a/tests/codegen/issues/issue-34947-pow-i32.rs b/tests/codegen/issues/issue-34947-pow-i32.rs index c9141c0e925..b4750cd35bc 100644 --- a/tests/codegen/issues/issue-34947-pow-i32.rs +++ b/tests/codegen/issues/issue-34947-pow-i32.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-36010-some-box-is_some.rs b/tests/codegen/issues/issue-36010-some-box-is_some.rs index 44c01096f15..c9a8262162d 100644 --- a/tests/codegen/issues/issue-36010-some-box-is_some.rs +++ b/tests/codegen/issues/issue-36010-some-box-is_some.rs @@ -1,6 +1,6 @@ #![crate_type = "lib"] -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 use std::mem; diff --git a/tests/codegen/issues/issue-37945.rs b/tests/codegen/issues/issue-37945.rs index 01d1c694ec7..23d0eab8ae4 100644 --- a/tests/codegen/issues/issue-37945.rs +++ b/tests/codegen/issues/issue-37945.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Zmerge-functions=disabled +//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled //@ ignore-32bit LLVM has a bug with them // Check that LLVM understands that `Iter` pointer is not null. Issue #37945. diff --git a/tests/codegen/issues/issue-45222.rs b/tests/codegen/issues/issue-45222.rs index d2c1ba421c4..0201363c41a 100644 --- a/tests/codegen/issues/issue-45222.rs +++ b/tests/codegen/issues/issue-45222.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-45466.rs b/tests/codegen/issues/issue-45466.rs index 8a324fa555b..164a27ef5d4 100644 --- a/tests/codegen/issues/issue-45466.rs +++ b/tests/codegen/issues/issue-45466.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "rlib"] diff --git a/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs b/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs index ea9288564e9..a48bb2a1ccf 100644 --- a/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs +++ b/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs @@ -1,7 +1,7 @@ // This test case checks that slice::{r}position functions do not // prevent optimizing away bounds checks -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "rlib"] diff --git a/tests/codegen/issues/issue-59352.rs b/tests/codegen/issues/issue-59352.rs index 7bedc3ffc4a..cb4383d4a30 100644 --- a/tests/codegen/issues/issue-59352.rs +++ b/tests/codegen/issues/issue-59352.rs @@ -6,7 +6,7 @@ // test case should be removed as it will become redundant. // mir-opt-level=3 enables inlining and enables LLVM to optimize away the unreachable panic call. -//@ compile-flags: -O -Z mir-opt-level=3 +//@ compile-flags: -Copt-level=3 -Z mir-opt-level=3 #![crate_type = "rlib"] diff --git a/tests/codegen/issues/issue-68667-unwrap-combinators.rs b/tests/codegen/issues/issue-68667-unwrap-combinators.rs index 21a5a5bf4ee..7f4a32109fe 100644 --- a/tests/codegen/issues/issue-68667-unwrap-combinators.rs +++ b/tests/codegen/issues/issue-68667-unwrap-combinators.rs @@ -1,6 +1,6 @@ #![crate_type = "lib"] -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 // MIR inlining now optimizes this code. diff --git a/tests/codegen/issues/issue-69101-bounds-check.rs b/tests/codegen/issues/issue-69101-bounds-check.rs index c014a1c1b1d..953b79aa263 100644 --- a/tests/codegen/issues/issue-69101-bounds-check.rs +++ b/tests/codegen/issues/issue-69101-bounds-check.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] // Make sure no bounds checks are emitted in the loop when upfront slicing diff --git a/tests/codegen/issues/issue-73031.rs b/tests/codegen/issues/issue-73031.rs index db9c6d6db23..80dea9b5bc2 100644 --- a/tests/codegen/issues/issue-73031.rs +++ b/tests/codegen/issues/issue-73031.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] // Test that LLVM can eliminate the unreachable `All::None` branch. diff --git a/tests/codegen/issues/issue-73258.rs b/tests/codegen/issues/issue-73258.rs index e5c622b5656..936a7554496 100644 --- a/tests/codegen/issues/issue-73258.rs +++ b/tests/codegen/issues/issue-73258.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs index 9b3b1318ced..1e2c25babe0 100644 --- a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs +++ b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] // Make sure no bounds checks are emitted when slicing or indexing diff --git a/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs b/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs index c3eb1a5968a..e9dd0d1bf23 100644 --- a/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs +++ b/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs @@ -1,7 +1,7 @@ // This test checks that bounds checks are elided when // index is part of a (x | y) < C style condition -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-74938-array-split-at.rs b/tests/codegen/issues/issue-74938-array-split-at.rs index 2675e404ced..9d3e23d642b 100644 --- a/tests/codegen/issues/issue-74938-array-split-at.rs +++ b/tests/codegen/issues/issue-74938-array-split-at.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-75525-bounds-checks.rs b/tests/codegen/issues/issue-75525-bounds-checks.rs index fbc10ce3d84..5dfbd350010 100644 --- a/tests/codegen/issues/issue-75525-bounds-checks.rs +++ b/tests/codegen/issues/issue-75525-bounds-checks.rs @@ -1,6 +1,6 @@ // Regression test for #75525, verifies that no bounds checks are generated. -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-75546.rs b/tests/codegen/issues/issue-75546.rs index 1132c8ab509..1e1e6543a88 100644 --- a/tests/codegen/issues/issue-75546.rs +++ b/tests/codegen/issues/issue-75546.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] // Test that LLVM can eliminate the impossible `i == 0` check. diff --git a/tests/codegen/issues/issue-75659.rs b/tests/codegen/issues/issue-75659.rs index 1860b73f2a9..0960bfdb6b0 100644 --- a/tests/codegen/issues/issue-75659.rs +++ b/tests/codegen/issues/issue-75659.rs @@ -1,7 +1,7 @@ // This test checks that the call to memchr/slice_contains is optimized away // when searching in small slices. -//@ compile-flags: -O -Zinline-mir=false +//@ compile-flags: -Copt-level=3 -Zinline-mir=false //@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-75978.rs b/tests/codegen/issues/issue-75978.rs index ed953fae767..f4b0bc36329 100644 --- a/tests/codegen/issues/issue-75978.rs +++ b/tests/codegen/issues/issue-75978.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-77812.rs b/tests/codegen/issues/issue-77812.rs index bf84ac21b16..09e2376c30d 100644 --- a/tests/codegen/issues/issue-77812.rs +++ b/tests/codegen/issues/issue-77812.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] // Test that LLVM can eliminate the unreachable `Variant::Zero` branch. diff --git a/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs b/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs index 49301be776f..4023412f23c 100644 --- a/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs +++ b/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C lto=thin -C prefer-dynamic=no +//@ compile-flags: -Copt-level=3 -C lto=thin -C prefer-dynamic=no //@ only-windows //@ aux-build:static_dllimport_aux.rs diff --git a/tests/codegen/issues/issue-84268.rs b/tests/codegen/issues/issue-84268.rs index 5e852133ed3..8a8ea9d1ccf 100644 --- a/tests/codegen/issues/issue-84268.rs +++ b/tests/codegen/issues/issue-84268.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O --crate-type=rlib +//@ compile-flags: -Copt-level=3 --crate-type=rlib #![feature(intrinsics, repr_simd)] extern "rust-intrinsic" { diff --git a/tests/codegen/issues/issue-85872-multiple-reverse.rs b/tests/codegen/issues/issue-85872-multiple-reverse.rs index fb5ff8309e5..6f566ddee6b 100644 --- a/tests/codegen/issues/issue-85872-multiple-reverse.rs +++ b/tests/codegen/issues/issue-85872-multiple-reverse.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs b/tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs index a8fab61b13e..345c09738b6 100644 --- a/tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs +++ b/tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //! Test for https://github.com/rust-lang/rust/issues/86109 //! Check LLVM can eliminate the impossible division by zero check by //! ensuring there is no call (to panic) instruction. diff --git a/tests/codegen/issues/issue-93036-assert-index.rs b/tests/codegen/issues/issue-93036-assert-index.rs index 7a2ea087266..46f45c2f06e 100644 --- a/tests/codegen/issues/issue-93036-assert-index.rs +++ b/tests/codegen/issues/issue-93036-assert-index.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-96274.rs b/tests/codegen/issues/issue-96274.rs index ffefd5f43f8..2425ec53e4e 100644 --- a/tests/codegen/issues/issue-96274.rs +++ b/tests/codegen/issues/issue-96274.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-96497-slice-size-nowrap.rs b/tests/codegen/issues/issue-96497-slice-size-nowrap.rs index f922462cc27..7b3a20a295e 100644 --- a/tests/codegen/issues/issue-96497-slice-size-nowrap.rs +++ b/tests/codegen/issues/issue-96497-slice-size-nowrap.rs @@ -2,7 +2,7 @@ // The possibility of wrapping results in an additional branch when dropping boxed slices // in some situations, see https://github.com/rust-lang/rust/issues/96497#issuecomment-1112865218 -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] @@ -11,7 +11,7 @@ pub fn simple_size_of_nowrap(x: &[u32]) -> usize { // Make sure the shift used to compute the size has a nowrap flag. - // CHECK: [[A:%.*]] = shl nsw {{.*}}, 2 + // CHECK: [[A:%.*]] = shl nuw nsw {{.*}}, 2 // CHECK-NEXT: ret {{.*}} [[A]] core::mem::size_of_val(x) } @@ -26,3 +26,13 @@ pub fn drop_write(mut x: Box<[u32]>) { // CHECK-NOT: store i32 42 x[1] = 42; } + +// CHECK-LABEL: @slice_size_plus_2 +#[no_mangle] +pub fn slice_size_plus_2(x: &[u16]) -> usize { + // Before #136575 this didn't get the `nuw` in the add. + + // CHECK: [[BYTES:%.+]] = shl nuw nsw {{i16|i32|i64}} %x.1, 1 + // CHECK: = add nuw {{i16|i32|i64}} [[BYTES]], 2 + core::mem::size_of_val(x) + 2 +} diff --git a/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs b/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs index 28324bfa90e..aecb81caf22 100644 --- a/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs +++ b/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs @@ -1,6 +1,6 @@ // This test checks that temporaries for indirectly-passed arguments get lifetime markers. -//@ compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0 +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Zmir-opt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs b/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs index 40827e32a01..76adcf9fd45 100644 --- a/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs +++ b/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/issues/issue-99960.rs b/tests/codegen/issues/issue-99960.rs index 9029121d35f..571a9be967d 100644 --- a/tests/codegen/issues/issue-99960.rs +++ b/tests/codegen/issues/issue-99960.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/layout-size-checks.rs b/tests/codegen/layout-size-checks.rs index 901f8f822f3..d64a7055e0b 100644 --- a/tests/codegen/layout-size-checks.rs +++ b/tests/codegen/layout-size-checks.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/lib-optimizations/iter-sum.rs b/tests/codegen/lib-optimizations/iter-sum.rs index ea8c916bfc1..a054ffffe74 100644 --- a/tests/codegen/lib-optimizations/iter-sum.rs +++ b/tests/codegen/lib-optimizations/iter-sum.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-x86_64 (vectorization varies between architectures) #![crate_type = "lib"] diff --git a/tests/codegen/lib-optimizations/slice_rotate.rs b/tests/codegen/lib-optimizations/slice_rotate.rs index d0a7b328d18..aa4bb3b528c 100644 --- a/tests/codegen/lib-optimizations/slice_rotate.rs +++ b/tests/codegen/lib-optimizations/slice_rotate.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/lifetime_start_end.rs b/tests/codegen/lifetime_start_end.rs index 99d37c25dca..0639e7640aa 100644 --- a/tests/codegen/lifetime_start_end.rs +++ b/tests/codegen/lifetime_start_end.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0 +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Zmir-opt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/loads.rs b/tests/codegen/loads.rs index e3e2f757770..88d67642b72 100644 --- a/tests/codegen/loads.rs +++ b/tests/codegen/loads.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 -O +//@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs index cba1a980caa..b11bd657c18 100644 --- a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs +++ b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes --target loongarch64-unknown-linux-gnu +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target loongarch64-unknown-linux-gnu //@ needs-llvm-components: loongarch #![feature(no_core, lang_items)] @@ -259,11 +259,11 @@ pub struct IntDoubleInt { c: i32, } -// CHECK: define void @f_int_double_int_s_arg(ptr noalias nocapture noundef align 8 dereferenceable(24) %a) +// CHECK: define void @f_int_double_int_s_arg(ptr noalias{{( nocapture)?}} noundef align 8{{( captures\(none\))?}} dereferenceable(24) %a) #[no_mangle] pub extern "C" fn f_int_double_int_s_arg(a: IntDoubleInt) {} -// CHECK: define void @f_ret_int_double_int_s(ptr{{( dead_on_unwind)?}} noalias nocapture noundef{{( writable)?}} sret([24 x i8]) align 8 dereferenceable(24) %_0) +// CHECK: define void @f_ret_int_double_int_s(ptr{{( dead_on_unwind)?}} noalias{{( nocapture)?}} noundef{{( writable)?}} sret([24 x i8]) align 8{{( captures\(none\))?}} dereferenceable(24) %_0) #[no_mangle] pub extern "C" fn f_ret_int_double_int_s() -> IntDoubleInt { IntDoubleInt { a: 1, b: 2., c: 3 } diff --git a/tests/codegen/lto-removes-invokes.rs b/tests/codegen/lto-removes-invokes.rs index 3217c239bf7..3640bd1ab86 100644 --- a/tests/codegen/lto-removes-invokes.rs +++ b/tests/codegen/lto-removes-invokes.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -C lto -C panic=abort -O +//@ compile-flags: -C lto -C panic=abort -Copt-level=3 //@ no-prefer-dynamic fn main() { diff --git a/tests/codegen/macos/i686-macosx-deployment-target.rs b/tests/codegen/macos/i686-macosx-deployment-target.rs index 389434da1f6..1f44bdfc648 100644 --- a/tests/codegen/macos/i686-macosx-deployment-target.rs +++ b/tests/codegen/macos/i686-macosx-deployment-target.rs @@ -2,7 +2,7 @@ // Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set. // See issue #60235. -//@ compile-flags: -O --target=i686-apple-darwin --crate-type=rlib +//@ compile-flags: -Copt-level=3 --target=i686-apple-darwin --crate-type=rlib //@ needs-llvm-components: x86 //@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14 #![feature(no_core, lang_items)] diff --git a/tests/codegen/macos/i686-no-macosx-deployment-target.rs b/tests/codegen/macos/i686-no-macosx-deployment-target.rs index 4c6b7656e59..a09773e0b9e 100644 --- a/tests/codegen/macos/i686-no-macosx-deployment-target.rs +++ b/tests/codegen/macos/i686-no-macosx-deployment-target.rs @@ -2,7 +2,7 @@ // Checks that we leave the target alone MACOSX_DEPLOYMENT_TARGET is unset. // See issue #60235. -//@ compile-flags: -O --target=i686-apple-darwin --crate-type=rlib +//@ compile-flags: -Copt-level=3 --target=i686-apple-darwin --crate-type=rlib //@ needs-llvm-components: x86 //@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET #![feature(no_core, lang_items)] diff --git a/tests/codegen/macos/x86_64-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-macosx-deployment-target.rs index a40deca24bb..bd8c027a9fb 100644 --- a/tests/codegen/macos/x86_64-macosx-deployment-target.rs +++ b/tests/codegen/macos/x86_64-macosx-deployment-target.rs @@ -2,7 +2,7 @@ // Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set. // See issue #60235. -//@ compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib +//@ compile-flags: -Copt-level=3 --target=x86_64-apple-darwin --crate-type=rlib //@ needs-llvm-components: x86 //@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14 #![feature(no_core, lang_items)] diff --git a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs index 26d519ef1a6..ff4a8fc46f9 100644 --- a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs +++ b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs @@ -2,7 +2,7 @@ // Checks that we leave the target alone when MACOSX_DEPLOYMENT_TARGET is unset. // See issue #60235. -//@ compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib +//@ compile-flags: -Copt-level=3 --target=x86_64-apple-darwin --crate-type=rlib //@ needs-llvm-components: x86 //@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET #![feature(no_core, lang_items)] diff --git a/tests/codegen/match-optimized.rs b/tests/codegen/match-optimized.rs index d6893be0b7b..7b409e619a8 100644 --- a/tests/codegen/match-optimized.rs +++ b/tests/codegen/match-optimized.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -C no-prepopulate-passes -O +//@ compile-flags: -Cno-prepopulate-passes -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/match-optimizes-away.rs b/tests/codegen/match-optimizes-away.rs index 82ab5718b37..8a70d993423 100644 --- a/tests/codegen/match-optimizes-away.rs +++ b/tests/codegen/match-optimizes-away.rs @@ -1,5 +1,5 @@ // -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] pub enum Three { diff --git a/tests/codegen/maybeuninit-rvo.rs b/tests/codegen/maybeuninit-rvo.rs index db2e33c34bd..097aa610f1b 100644 --- a/tests/codegen/maybeuninit-rvo.rs +++ b/tests/codegen/maybeuninit-rvo.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ needs-unwind #![feature(c_unwind)] #![crate_type = "lib"] diff --git a/tests/codegen/mem-replace-simple-type.rs b/tests/codegen/mem-replace-simple-type.rs index 41c3660dc15..9f3c6bacb71 100644 --- a/tests/codegen/mem-replace-simple-type.rs +++ b/tests/codegen/mem-replace-simple-type.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@ only-x86_64 (to not worry about usize differing) //@ ignore-std-debug-assertions // Reason: precondition checks make mem::replace not a candidate for MIR inlining diff --git a/tests/codegen/merge-functions.rs b/tests/codegen/merge-functions.rs index 8e4b65c9ee6..b9d3727ce11 100644 --- a/tests/codegen/merge-functions.rs +++ b/tests/codegen/merge-functions.rs @@ -1,6 +1,6 @@ //@ revisions: O Os //@[Os] compile-flags: -Copt-level=s -//@[O] compile-flags: -O +//@[O] compile-flags: -Copt-level=3 #![crate_type = "lib"] // CHECK: @func{{2|1}} = {{.*}}alias{{.*}}@func{{1|2}} diff --git a/tests/codegen/mir-aggregate-no-alloca.rs b/tests/codegen/mir-aggregate-no-alloca.rs index 37b024a55b3..77d367ed5da 100644 --- a/tests/codegen/mir-aggregate-no-alloca.rs +++ b/tests/codegen/mir-aggregate-no-alloca.rs @@ -2,7 +2,7 @@ //@ revisions: bit32 bit64 //@[bit32] only-32bit //@[bit64] only-64bit -//@ compile-flags: -O -C no-prepopulate-passes -Z randomize-layout=no +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Z randomize-layout=no #![crate_type = "lib"] diff --git a/tests/codegen/mir-inlined-line-numbers.rs b/tests/codegen/mir-inlined-line-numbers.rs index 57978bc7097..cfe43a6cf89 100644 --- a/tests/codegen/mir-inlined-line-numbers.rs +++ b/tests/codegen/mir-inlined-line-numbers.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -g +//@ compile-flags: -Copt-level=3 -g #![crate_type = "lib"] diff --git a/tests/codegen/move-before-nocapture-ref-arg.rs b/tests/codegen/move-before-nocapture-ref-arg.rs index c3448192ea1..2ebd645e1c3 100644 --- a/tests/codegen/move-before-nocapture-ref-arg.rs +++ b/tests/codegen/move-before-nocapture-ref-arg.rs @@ -1,6 +1,6 @@ // Verify that move before the call of the function with noalias, nocapture, readonly. // #107436 -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/move-operands.rs b/tests/codegen/move-operands.rs index 4f22921b4a3..ddad231b762 100644 --- a/tests/codegen/move-operands.rs +++ b/tests/codegen/move-operands.rs @@ -1,5 +1,5 @@ // Verify that optimized MIR only copies `a` once. -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/naked-fn/generics.rs b/tests/codegen/naked-fn/generics.rs index a33d213617a..64998df64dd 100644 --- a/tests/codegen/naked-fn/generics.rs +++ b/tests/codegen/naked-fn/generics.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/noalias-box-off.rs b/tests/codegen/noalias-box-off.rs index 1642103903a..664c7950280 100644 --- a/tests/codegen/noalias-box-off.rs +++ b/tests/codegen/noalias-box-off.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z box-noalias=no +//@ compile-flags: -Copt-level=3 -Z box-noalias=no #![crate_type = "lib"] diff --git a/tests/codegen/noalias-box.rs b/tests/codegen/noalias-box.rs index 06f94691c89..cccde775977 100644 --- a/tests/codegen/noalias-box.rs +++ b/tests/codegen/noalias-box.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/noalias-flag.rs b/tests/codegen/noalias-flag.rs index 35b94d813d5..67ba68ee6f8 100644 --- a/tests/codegen/noalias-flag.rs +++ b/tests/codegen/noalias-flag.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Zmutable-noalias=no +//@ compile-flags: -Copt-level=3 -Zmutable-noalias=no #![crate_type = "lib"] diff --git a/tests/codegen/noalias-refcell.rs b/tests/codegen/noalias-refcell.rs index 51d13967bec..b37adf92b9c 100644 --- a/tests/codegen/noalias-refcell.rs +++ b/tests/codegen/noalias-refcell.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes -Z mutable-noalias=yes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Z mutable-noalias=yes #![crate_type = "lib"] diff --git a/tests/codegen/noalias-rwlockreadguard.rs b/tests/codegen/noalias-rwlockreadguard.rs index 7b870cb28b4..c676dc32399 100644 --- a/tests/codegen/noalias-rwlockreadguard.rs +++ b/tests/codegen/noalias-rwlockreadguard.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes -Z mutable-noalias=yes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Z mutable-noalias=yes #![crate_type = "lib"] diff --git a/tests/codegen/noalias-unpin.rs b/tests/codegen/noalias-unpin.rs index 630a62020c1..30a8b399b97 100644 --- a/tests/codegen/noalias-unpin.rs +++ b/tests/codegen/noalias-unpin.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z mutable-noalias=yes +//@ compile-flags: -Copt-level=3 -Z mutable-noalias=yes #![crate_type = "lib"] diff --git a/tests/codegen/nrvo.rs b/tests/codegen/nrvo.rs index aa8bed941f5..7972186bfe5 100644 --- a/tests/codegen/nrvo.rs +++ b/tests/codegen/nrvo.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/option-as-slice.rs b/tests/codegen/option-as-slice.rs index 0edbbac1176..39b34a2035b 100644 --- a/tests/codegen/option-as-slice.rs +++ b/tests/codegen/option-as-slice.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z randomize-layout=no +//@ compile-flags: -Copt-level=3 -Z randomize-layout=no //@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/option-niche-eq.rs b/tests/codegen/option-niche-eq.rs index caef0598b4b..9c5ed9ce57a 100644 --- a/tests/codegen/option-niche-eq.rs +++ b/tests/codegen/option-niche-eq.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Zmerge-functions=disabled +//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled #![crate_type = "lib"] extern crate core; diff --git a/tests/codegen/packed.rs b/tests/codegen/packed.rs index 790d618b2ea..6f62719282e 100644 --- a/tests/codegen/packed.rs +++ b/tests/codegen/packed.rs @@ -1,5 +1,5 @@ // -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes #![crate_type = "lib"] @@ -52,7 +52,7 @@ pub struct BigPacked2 { #[no_mangle] pub fn call_pkd1(f: fn() -> Array) -> BigPacked1 { // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca [32 x i8] - // CHECK: call void %{{.*}}(ptr noalias nocapture noundef sret{{.*}} dereferenceable(32) [[ALLOCA]]) + // CHECK: call void %{{.*}}(ptr{{( captures(none))?}} noalias{{( nocapture)?}} noundef sret{{.*}} dereferenceable(32) [[ALLOCA]]) // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 1 %{{.*}}, ptr align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) // check that calls whose destination is a field of a packed struct // go through an alloca rather than calling the function with an @@ -64,7 +64,7 @@ pub fn call_pkd1(f: fn() -> Array) -> BigPacked1 { #[no_mangle] pub fn call_pkd2(f: fn() -> Array) -> BigPacked2 { // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca [32 x i8] - // CHECK: call void %{{.*}}(ptr noalias nocapture noundef sret{{.*}} dereferenceable(32) [[ALLOCA]]) + // CHECK: call void %{{.*}}(ptr{{( captures(none))?}} noalias{{( nocapture)?}} noundef sret{{.*}} dereferenceable(32) [[ALLOCA]]) // CHECK: call void @llvm.memcpy.{{.*}}(ptr align 2 %{{.*}}, ptr align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) // check that calls whose destination is a field of a packed struct // go through an alloca rather than calling the function with an diff --git a/tests/codegen/panic-abort-windows.rs b/tests/codegen/panic-abort-windows.rs index eb61e649f04..17fdd9cc726 100644 --- a/tests/codegen/panic-abort-windows.rs +++ b/tests/codegen/panic-abort-windows.rs @@ -1,7 +1,7 @@ // This test is for *-windows only. //@ only-windows -//@ compile-flags: -C no-prepopulate-passes -C panic=abort -O +//@ compile-flags: -C no-prepopulate-passes -C panic=abort -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/panic-in-drop-abort.rs b/tests/codegen/panic-in-drop-abort.rs index b150c537ad5..e89170e56ed 100644 --- a/tests/codegen/panic-in-drop-abort.rs +++ b/tests/codegen/panic-in-drop-abort.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Z panic-in-drop=abort -O +//@ compile-flags: -Z panic-in-drop=abort -Copt-level=3 //@ ignore-msvc // Ensure that unwinding code paths are eliminated from the output after diff --git a/tests/codegen/personality_lifetimes.rs b/tests/codegen/personality_lifetimes.rs index 828af05436b..cd81db63953 100644 --- a/tests/codegen/personality_lifetimes.rs +++ b/tests/codegen/personality_lifetimes.rs @@ -1,7 +1,7 @@ //@ ignore-msvc //@ needs-unwind -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/placement-new.rs b/tests/codegen/placement-new.rs index 0ec2b6a6f20..7f7f0033bec 100644 --- a/tests/codegen/placement-new.rs +++ b/tests/codegen/placement-new.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ compile-flags: -Zmerge-functions=disabled #![crate_type = "lib"] diff --git a/tests/codegen/ptr-arithmetic.rs b/tests/codegen/ptr-arithmetic.rs index 6f115d33d8d..ecb44b30f5c 100644 --- a/tests/codegen/ptr-arithmetic.rs +++ b/tests/codegen/ptr-arithmetic.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled #![crate_type = "lib"] diff --git a/tests/codegen/ptr-read-metadata.rs b/tests/codegen/ptr-read-metadata.rs index e3565c962f7..b38cfdbff88 100644 --- a/tests/codegen/ptr-read-metadata.rs +++ b/tests/codegen/ptr-read-metadata.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled #![crate_type = "lib"] diff --git a/tests/codegen/range-attribute.rs b/tests/codegen/range-attribute.rs index a44ec1026b1..e23f5e6bb74 100644 --- a/tests/codegen/range-attribute.rs +++ b/tests/codegen/range-attribute.rs @@ -5,7 +5,7 @@ //@ revisions: bit32 bit64 //@[bit32] only-32bit //@[bit64] only-64bit -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@ min-llvm-version: 19 #![crate_type = "lib"] diff --git a/tests/codegen/range_to_inclusive.rs b/tests/codegen/range_to_inclusive.rs index f3001897f88..6d939f40f55 100644 --- a/tests/codegen/range_to_inclusive.rs +++ b/tests/codegen/range_to_inclusive.rs @@ -1,6 +1,6 @@ //! Test that `RangeTo` and `RangeToInclusive` generate identical //! (and optimal) code; #63646 -//@ compile-flags: -O -Zmerge-functions=disabled +//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled #![crate_type = "lib"] #[no_mangle] diff --git a/tests/codegen/reg-struct-return.rs b/tests/codegen/reg-struct-return.rs index 73816745ea8..dfc9f8c519c 100644 --- a/tests/codegen/reg-struct-return.rs +++ b/tests/codegen/reg-struct-return.rs @@ -5,7 +5,7 @@ //@ revisions: ENABLED DISABLED //@ add-core-stubs -//@ compile-flags: --target i686-unknown-linux-gnu -O -C no-prepopulate-passes +//@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3 //@ [ENABLED] compile-flags: -Zreg-struct-return //@ needs-llvm-components: x86 diff --git a/tests/codegen/regparm-inreg.rs b/tests/codegen/regparm-inreg.rs index c8c647bcc87..82e15731128 100644 --- a/tests/codegen/regparm-inreg.rs +++ b/tests/codegen/regparm-inreg.rs @@ -2,7 +2,7 @@ // marks function arguments as "inreg" like the C/C++ compilers for the platforms. // x86 only. -//@ compile-flags: --target i686-unknown-linux-gnu -O -C no-prepopulate-passes +//@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3 //@ needs-llvm-components: x86 //@ revisions:regparm0 regparm1 regparm2 regparm3 diff --git a/tests/codegen/repeat-trusted-len.rs b/tests/codegen/repeat-trusted-len.rs index fa01f2b4969..95379535971 100644 --- a/tests/codegen/repeat-trusted-len.rs +++ b/tests/codegen/repeat-trusted-len.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 // #![crate_type = "lib"] diff --git a/tests/codegen/repr/transparent-byval-struct-ptr.rs b/tests/codegen/repr/transparent-byval-struct-ptr.rs index 92ef937d734..f9cfeb90390 100644 --- a/tests/codegen/repr/transparent-byval-struct-ptr.rs +++ b/tests/codegen/repr/transparent-byval-struct-ptr.rs @@ -1,5 +1,5 @@ //@ revisions: i686-linux i686-freebsd x64-linux x64-apple -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@[i686-linux] compile-flags: --target i686-unknown-linux-gnu //@[i686-linux] needs-llvm-components: x86 diff --git a/tests/codegen/repr/transparent-imm-array.rs b/tests/codegen/repr/transparent-imm-array.rs index 99828e4e80a..f790d093cf4 100644 --- a/tests/codegen/repr/transparent-imm-array.rs +++ b/tests/codegen/repr/transparent-imm-array.rs @@ -1,5 +1,5 @@ //@ revisions: arm-linux arm-android armv7-linux armv7-android mips thumb sparc -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@[arm-linux] compile-flags: --target arm-unknown-linux-gnueabi //@[arm-linux] needs-llvm-components: arm diff --git a/tests/codegen/repr/transparent-mips64.rs b/tests/codegen/repr/transparent-mips64.rs index 588d440b4d7..7282654b856 100644 --- a/tests/codegen/repr/transparent-mips64.rs +++ b/tests/codegen/repr/transparent-mips64.rs @@ -1,5 +1,5 @@ //@ revisions: mips64 mips64el -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@[mips64] compile-flags: --target mips64-unknown-linux-gnuabi64 //@[mips64] needs-llvm-components: mips diff --git a/tests/codegen/repr/transparent-opaque-ptr.rs b/tests/codegen/repr/transparent-opaque-ptr.rs index 29c03f0d5d9..798b7e01bba 100644 --- a/tests/codegen/repr/transparent-opaque-ptr.rs +++ b/tests/codegen/repr/transparent-opaque-ptr.rs @@ -1,5 +1,5 @@ //@ revisions: aarch64-linux aarch64-darwin wasm32-wasip1 -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@[aarch64-linux] compile-flags: --target aarch64-unknown-linux-gnu //@[aarch64-linux] needs-llvm-components: aarch64 diff --git a/tests/codegen/repr/transparent-sparc64.rs b/tests/codegen/repr/transparent-sparc64.rs index 8e4c8ce2ee9..05c090bd672 100644 --- a/tests/codegen/repr/transparent-sparc64.rs +++ b/tests/codegen/repr/transparent-sparc64.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes --target sparc64-unknown-linux-gnu +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target sparc64-unknown-linux-gnu //@ needs-llvm-components: sparc // See ./transparent.rs diff --git a/tests/codegen/repr/transparent-sysv64.rs b/tests/codegen/repr/transparent-sysv64.rs index 068414976c5..99c855db962 100644 --- a/tests/codegen/repr/transparent-sysv64.rs +++ b/tests/codegen/repr/transparent-sysv64.rs @@ -1,5 +1,5 @@ //@ revisions: linux apple win -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@[linux] compile-flags: --target x86_64-unknown-linux-gnu //@[linux] needs-llvm-components: x86 diff --git a/tests/codegen/repr/transparent.rs b/tests/codegen/repr/transparent.rs index adcd3aacd2a..e7e4c40a099 100644 --- a/tests/codegen/repr/transparent.rs +++ b/tests/codegen/repr/transparent.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@ ignore-riscv64 riscv64 has an i128 type used with test_Vector //@ ignore-s390x s390x with default march passes vector types per reference //@ ignore-loongarch64 see codegen/loongarch-abi for loongarch function call tests diff --git a/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs index 520192b5d59..46f747ad407 100644 --- a/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs +++ b/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --target riscv64gc-unknown-linux-gnu -O -C no-prepopulate-passes -C panic=abort +//@ compile-flags: --target riscv64gc-unknown-linux-gnu -Copt-level=3 -C no-prepopulate-passes -C panic=abort //@ needs-llvm-components: riscv #![crate_type = "lib"] diff --git a/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs index bcd9b0eae71..bef8fe0c044 100644 --- a/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs +++ b/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu //@ needs-llvm-components: riscv #![feature(no_core, lang_items)] @@ -263,7 +263,7 @@ pub struct IntDoubleInt { #[no_mangle] pub extern "C" fn f_int_double_int_s_arg(a: IntDoubleInt) {} -// CHECK: define void @f_ret_int_double_int_s(ptr {{.*}} sret([24 x i8]) align 8 dereferenceable(24) %_0) +// CHECK: define void @f_ret_int_double_int_s(ptr {{.*}} sret([24 x i8]) align 8 {{.*}}dereferenceable(24) %_0) #[no_mangle] pub extern "C" fn f_ret_int_double_int_s() -> IntDoubleInt { IntDoubleInt { a: 1, b: 2., c: 3 } diff --git a/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs index 27018d2e6d2..214370f424c 100644 --- a/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs +++ b/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu //@ needs-llvm-components: riscv #![feature(no_core, lang_items)] diff --git a/tests/codegen/rust-abi-arch-specific-adjustment.rs b/tests/codegen/rust-abi-arch-specific-adjustment.rs index 9da10f662b0..561f081c700 100644 --- a/tests/codegen/rust-abi-arch-specific-adjustment.rs +++ b/tests/codegen/rust-abi-arch-specific-adjustment.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes //@ revisions: riscv64 loongarch64 //@[riscv64] only-riscv64 diff --git a/tests/codegen/s390x-simd.rs b/tests/codegen/s390x-simd.rs index 23181e6a103..ac39357519e 100644 --- a/tests/codegen/s390x-simd.rs +++ b/tests/codegen/s390x-simd.rs @@ -1,7 +1,7 @@ //! test that s390x vector types are passed using `PassMode::Direct` //! see also https://github.com/rust-lang/rust/issues/135744 //@ add-core-stubs -//@ compile-flags: --target s390x-unknown-linux-gnu -O +//@ compile-flags: --target s390x-unknown-linux-gnu -Copt-level=3 //@ needs-llvm-components: systemz #![crate_type = "rlib"] diff --git a/tests/codegen/scalar-pair-bool.rs b/tests/codegen/scalar-pair-bool.rs index fce0648e450..def3b32f71a 100644 --- a/tests/codegen/scalar-pair-bool.rs +++ b/tests/codegen/scalar-pair-bool.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs index 75f989d6e12..0d21d510557 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs @@ -1,5 +1,14 @@ // //@ compile-flags: -C no-prepopulate-passes +// LLVM IR isn't very portable and the one tested here depends on the ABI +// which is different between x86 (where we use SSE registers) and others. +// `x86-64` and `x86-32-sse2` are identical, but compiletest does not support +// taking the union of multiple `only` annotations. +//@ revisions: x86-64 x86-32-sse2 other +//@[x86-64] only-x86_64 +//@[x86-32-sse2] only-rustc_abi-x86-sse2 +//@[other] ignore-rustc_abi-x86-sse2 +//@[other] ignore-x86_64 #![crate_type = "lib"] #![allow(non_camel_case_types)] @@ -38,7 +47,9 @@ pub fn build_array_s(x: [f32; 4]) -> S<4> { #[no_mangle] pub fn build_array_transmute_s(x: [f32; 4]) -> S<4> { // CHECK: %[[VAL:.+]] = load <4 x float>, ptr %x, align [[ARRAY_ALIGN]] - // CHECK: store <4 x float> %[[VAL:.+]], ptr %_0, align [[VECTOR_ALIGN]] + // x86-32: ret <4 x float> %[[VAL:.+]] + // x86-64: ret <4 x float> %[[VAL:.+]] + // other: store <4 x float> %[[VAL:.+]], ptr %_0, align [[VECTOR_ALIGN]] unsafe { std::mem::transmute(x) } } @@ -53,6 +64,8 @@ pub fn build_array_t(x: [f32; 4]) -> T { #[no_mangle] pub fn build_array_transmute_t(x: [f32; 4]) -> T { // CHECK: %[[VAL:.+]] = load <4 x float>, ptr %x, align [[ARRAY_ALIGN]] - // CHECK: store <4 x float> %[[VAL:.+]], ptr %_0, align [[VECTOR_ALIGN]] + // x86-32: ret <4 x float> %[[VAL:.+]] + // x86-64: ret <4 x float> %[[VAL:.+]] + // other: store <4 x float> %[[VAL:.+]], ptr %_0, align [[VECTOR_ALIGN]] unsafe { std::mem::transmute(x) } } diff --git a/tests/codegen/simd/packed-simd.rs b/tests/codegen/simd/packed-simd.rs index 1df09c96e6c..a27d5e3af45 100644 --- a/tests/codegen/simd/packed-simd.rs +++ b/tests/codegen/simd/packed-simd.rs @@ -1,4 +1,5 @@ //@ revisions:opt3 noopt +//@ only-x86_64 //@[opt3] compile-flags: -Copt-level=3 //@[noopt] compile-flags: -Cno-prepopulate-passes @@ -14,14 +15,14 @@ use core::{mem, ptr}; #[repr(simd, packed)] #[derive(Copy, Clone)] -pub struct Simd<T, const N: usize>([T; N]); +pub struct PackedSimd<T, const N: usize>([T; N]); #[repr(simd)] #[derive(Copy, Clone)] pub struct FullSimd<T, const N: usize>([T; N]); // non-powers-of-two have padding and need to be expanded to full vectors -fn load<T, const N: usize>(v: Simd<T, N>) -> FullSimd<T, N> { +fn load<T, const N: usize>(v: PackedSimd<T, N>) -> FullSimd<T, N> { unsafe { let mut tmp = mem::MaybeUninit::<FullSimd<T, N>>::uninit(); ptr::copy_nonoverlapping(&v as *const _, tmp.as_mut_ptr().cast(), 1); @@ -29,18 +30,16 @@ fn load<T, const N: usize>(v: Simd<T, N>) -> FullSimd<T, N> { } } -// CHECK-LABEL: square_packed_full -// CHECK-SAME: ptr{{[a-z_ ]*}} sret([[RET_TYPE:[^)]+]]) [[RET_ALIGN:align (8|16)]]{{[^%]*}} [[RET_VREG:%[_0-9]*]] -// CHECK-SAME: ptr{{[a-z_ ]*}} align 4 +// CHECK-LABEL: define <3 x float> @square_packed_full(ptr{{[a-z_ ]*}} align 4 {{[^,]*}}) #[no_mangle] -pub fn square_packed_full(x: Simd<f32, 3>) -> FullSimd<f32, 3> { - // CHECK-NEXT: start - // noopt: alloca [[RET_TYPE]], [[RET_ALIGN]] - // CHECK: load <3 x float> +pub fn square_packed_full(x: PackedSimd<f32, 3>) -> FullSimd<f32, 3> { + // The unoptimized version of this is not very interesting to check + // since `load` does not get inlined. + // opt3-NEXT: start: + // opt3-NEXT: load <3 x float> let x = load(x); - // CHECK: [[VREG:%[a-z0-9_]+]] = fmul <3 x float> - // CHECK-NEXT: store <3 x float> [[VREG]], ptr [[RET_VREG]], [[RET_ALIGN]] - // CHECK-NEXT: ret void + // opt3-NEXT: [[VREG:%[a-z0-9_]+]] = fmul <3 x float> + // opt3-NEXT: ret <3 x float> [[VREG:%[a-z0-9_]+]] unsafe { intrinsics::simd_mul(x, x) } } @@ -48,7 +47,7 @@ pub fn square_packed_full(x: Simd<f32, 3>) -> FullSimd<f32, 3> { // CHECK-SAME: ptr{{[a-z_ ]*}} sret([[RET_TYPE:[^)]+]]) [[RET_ALIGN:align 4]]{{[^%]*}} [[RET_VREG:%[_0-9]*]] // CHECK-SAME: ptr{{[a-z_ ]*}} align 4 #[no_mangle] -pub fn square_packed(x: Simd<f32, 3>) -> Simd<f32, 3> { +pub fn square_packed(x: PackedSimd<f32, 3>) -> PackedSimd<f32, 3> { // CHECK-NEXT: start // CHECK-NEXT: load <3 x float> // noopt-NEXT: load <3 x float> diff --git a/tests/codegen/simd/swap-simd-types.rs b/tests/codegen/simd/swap-simd-types.rs index cd6e84286e1..69767d0a755 100644 --- a/tests/codegen/simd/swap-simd-types.rs +++ b/tests/codegen/simd/swap-simd-types.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C target-feature=+avx +//@ compile-flags: -Copt-level=3 -C target-feature=+avx //@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/slice-as_chunks.rs b/tests/codegen/slice-as_chunks.rs index 631d18d7809..a90ee7c628e 100644 --- a/tests/codegen/slice-as_chunks.rs +++ b/tests/codegen/slice-as_chunks.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-64bit (because the LLVM type of i64 for usize shows up) #![crate_type = "lib"] diff --git a/tests/codegen/slice-indexing.rs b/tests/codegen/slice-indexing.rs index 75112bb0c24..d957ccfb5ef 100644 --- a/tests/codegen/slice-indexing.rs +++ b/tests/codegen/slice-indexing.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-64bit (because the LLVM type of i64 for usize shows up) #![crate_type = "lib"] diff --git a/tests/codegen/slice-iter-fold.rs b/tests/codegen/slice-iter-fold.rs index 1770cd4a119..55ab34661c3 100644 --- a/tests/codegen/slice-iter-fold.rs +++ b/tests/codegen/slice-iter-fold.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] // CHECK-LABEL: @slice_fold_to_last diff --git a/tests/codegen/slice-iter-len-eq-zero.rs b/tests/codegen/slice-iter-len-eq-zero.rs index b2a4b2495b6..6998d98e498 100644 --- a/tests/codegen/slice-iter-len-eq-zero.rs +++ b/tests/codegen/slice-iter-len-eq-zero.rs @@ -1,4 +1,5 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 +//@ needs-deterministic-layouts (opposite scalar pair orders breaks it) #![crate_type = "lib"] type Demo = [u8; 3]; @@ -7,7 +8,40 @@ type Demo = [u8; 3]; #[no_mangle] pub fn slice_iter_len_eq_zero(y: std::slice::Iter<'_, Demo>) -> bool { // CHECK-NOT: sub - // CHECK: %[[RET:.+]] = icmp eq ptr {{%1|%0}}, {{%1|%0}} + // CHECK: %[[RET:.+]] = icmp eq ptr {{%y.0, %y.1|%y.1, %y.0}} + // CHECK: ret i1 %[[RET]] + y.len() == 0 +} + +// CHECK-LABEL: @slice_iter_len_eq_zero_ref +#[no_mangle] +pub fn slice_iter_len_eq_zero_ref(y: &mut std::slice::Iter<'_, Demo>) -> bool { + // CHECK-NOT: sub + // CHECK: %[[A:.+]] = load ptr + // CHECK-SAME: !nonnull + // CHECK: %[[B:.+]] = load ptr + // CHECK-SAME: !nonnull + // CHECK: %[[RET:.+]] = icmp eq ptr %[[A]], %[[B]] + // CHECK: ret i1 %[[RET]] + y.len() == 0 +} + +struct MyZST; + +// CHECK-LABEL: @slice_zst_iter_len_eq_zero +#[no_mangle] +pub fn slice_zst_iter_len_eq_zero(y: std::slice::Iter<'_, MyZST>) -> bool { + // CHECK: %[[RET:.+]] = icmp eq ptr %y.1, null + // CHECK: ret i1 %[[RET]] + y.len() == 0 +} + +// CHECK-LABEL: @slice_zst_iter_len_eq_zero_ref +#[no_mangle] +pub fn slice_zst_iter_len_eq_zero_ref(y: &mut std::slice::Iter<'_, MyZST>) -> bool { + // CHECK: %[[LEN:.+]] = load ptr + // CHECK-NOT: !nonnull + // CHECK: %[[RET:.+]] = icmp eq ptr %[[LEN]], null // CHECK: ret i1 %[[RET]] y.len() == 0 } diff --git a/tests/codegen/slice-iter-nonnull.rs b/tests/codegen/slice-iter-nonnull.rs index 307020b42c0..98a1b961a64 100644 --- a/tests/codegen/slice-iter-nonnull.rs +++ b/tests/codegen/slice-iter-nonnull.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ needs-deterministic-layouts #![crate_type = "lib"] #![feature(exact_size_is_empty)] diff --git a/tests/codegen/slice-pointer-nonnull-unwrap.rs b/tests/codegen/slice-pointer-nonnull-unwrap.rs index 202edb98c73..35e4bf2c661 100644 --- a/tests/codegen/slice-pointer-nonnull-unwrap.rs +++ b/tests/codegen/slice-pointer-nonnull-unwrap.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] use std::ptr::NonNull; diff --git a/tests/codegen/slice-position-bounds-check.rs b/tests/codegen/slice-position-bounds-check.rs index f83e2f2ec44..0d1d1d869ae 100644 --- a/tests/codegen/slice-position-bounds-check.rs +++ b/tests/codegen/slice-position-bounds-check.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C panic=abort +//@ compile-flags: -Copt-level=3 -C panic=abort #![crate_type = "lib"] fn search<T: Ord + Eq>(arr: &mut [T], a: &T) -> Result<usize, ()> { diff --git a/tests/codegen/slice-ref-equality.rs b/tests/codegen/slice-ref-equality.rs index 1153d7817b2..2940378da3c 100644 --- a/tests/codegen/slice-ref-equality.rs +++ b/tests/codegen/slice-ref-equality.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Zmerge-functions=disabled +//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled #![crate_type = "lib"] use std::num::NonZero; @@ -47,7 +47,7 @@ pub fn is_zero_array(data: &[u8; 4]) -> bool { #[no_mangle] fn eq_slice_of_nested_u8(x: &[[u8; 3]], y: &[[u8; 3]]) -> bool { // CHECK: icmp eq [[USIZE]] %x.1, %y.1 - // CHECK: %[[BYTES:.+]] = mul nsw [[USIZE]] {{%x.1|%y.1}}, 3 + // CHECK: %[[BYTES:.+]] = mul nuw nsw [[USIZE]] {{%x.1|%y.1}}, 3 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y @@ -59,7 +59,7 @@ fn eq_slice_of_nested_u8(x: &[[u8; 3]], y: &[[u8; 3]]) -> bool { #[no_mangle] fn eq_slice_of_i32(x: &[i32], y: &[i32]) -> bool { // CHECK: icmp eq [[USIZE]] %x.1, %y.1 - // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] {{%x.1|%y.1}}, 2 + // CHECK: %[[BYTES:.+]] = shl nuw nsw [[USIZE]] {{%x.1|%y.1}}, 2 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y @@ -71,7 +71,7 @@ fn eq_slice_of_i32(x: &[i32], y: &[i32]) -> bool { #[no_mangle] fn eq_slice_of_nonzero(x: &[NonZero<i32>], y: &[NonZero<i32>]) -> bool { // CHECK: icmp eq [[USIZE]] %x.1, %y.1 - // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] {{%x.1|%y.1}}, 2 + // CHECK: %[[BYTES:.+]] = shl nuw nsw [[USIZE]] {{%x.1|%y.1}}, 2 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y @@ -83,7 +83,7 @@ fn eq_slice_of_nonzero(x: &[NonZero<i32>], y: &[NonZero<i32>]) -> bool { #[no_mangle] fn eq_slice_of_option_of_nonzero(x: &[Option<NonZero<i16>>], y: &[Option<NonZero<i16>>]) -> bool { // CHECK: icmp eq [[USIZE]] %x.1, %y.1 - // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] {{%x.1|%y.1}}, 1 + // CHECK: %[[BYTES:.+]] = shl nuw nsw [[USIZE]] {{%x.1|%y.1}}, 1 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y diff --git a/tests/codegen/slice-reverse.rs b/tests/codegen/slice-reverse.rs index 87cdad47962..e58d1c1d9d8 100644 --- a/tests/codegen/slice-reverse.rs +++ b/tests/codegen/slice-reverse.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-x86_64 //@ ignore-std-debug-assertions (debug assertions prevent generating shufflevector) diff --git a/tests/codegen/slice-windows-no-bounds-check.rs b/tests/codegen/slice-windows-no-bounds-check.rs index db3211c8def..87e89b14f06 100644 --- a/tests/codegen/slice-windows-no-bounds-check.rs +++ b/tests/codegen/slice-windows-no-bounds-check.rs @@ -1,6 +1,6 @@ #![crate_type = "lib"] -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 use std::slice::Windows; diff --git a/tests/codegen/slice_as_from_ptr_range.rs b/tests/codegen/slice_as_from_ptr_range.rs index 47c60461c0e..2073f05c07f 100644 --- a/tests/codegen/slice_as_from_ptr_range.rs +++ b/tests/codegen/slice_as_from_ptr_range.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-64bit (because we're using [ui]size) #![crate_type = "lib"] diff --git a/tests/codegen/some-global-nonnull.rs b/tests/codegen/some-global-nonnull.rs index 8e9308a7265..bb4d12e1c76 100644 --- a/tests/codegen/some-global-nonnull.rs +++ b/tests/codegen/some-global-nonnull.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/sparc-struct-abi.rs b/tests/codegen/sparc-struct-abi.rs index 5d978166357..0a8720c4fca 100644 --- a/tests/codegen/sparc-struct-abi.rs +++ b/tests/codegen/sparc-struct-abi.rs @@ -1,7 +1,7 @@ // Checks that we correctly codegen extern "C" functions returning structs. // See issues #52638 and #86163. -//@ compile-flags: -O --target=sparc64-unknown-linux-gnu --crate-type=rlib +//@ compile-flags: -Copt-level=3 --target=sparc64-unknown-linux-gnu --crate-type=rlib //@ needs-llvm-components: sparc #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/codegen/static-relocation-model-msvc.rs b/tests/codegen/static-relocation-model-msvc.rs index 8ed8331466c..4d30e6ec505 100644 --- a/tests/codegen/static-relocation-model-msvc.rs +++ b/tests/codegen/static-relocation-model-msvc.rs @@ -1,6 +1,6 @@ // Verify linkage of external symbols in the static relocation model on MSVC. // -//@ compile-flags: -O -C relocation-model=static +//@ compile-flags: -Copt-level=3 -C relocation-model=static //@ aux-build: extern_decl.rs //@ only-x86_64-pc-windows-msvc diff --git a/tests/codegen/step_by-overflow-checks.rs b/tests/codegen/step_by-overflow-checks.rs index 43e8514a8b7..53800e9f879 100644 --- a/tests/codegen/step_by-overflow-checks.rs +++ b/tests/codegen/step_by-overflow-checks.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/swap-large-types.rs b/tests/codegen/swap-large-types.rs index 761d48969da..49a41bb1469 100644 --- a/tests/codegen/swap-large-types.rs +++ b/tests/codegen/swap-large-types.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/swap-small-types.rs b/tests/codegen/swap-small-types.rs index 1a48c63d813..76bb853e642 100644 --- a/tests/codegen/swap-small-types.rs +++ b/tests/codegen/swap-small-types.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled //@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/target-feature-inline-closure.rs b/tests/codegen/target-feature-inline-closure.rs index d973bd93e31..73bdbc0e1a8 100644 --- a/tests/codegen/target-feature-inline-closure.rs +++ b/tests/codegen/target-feature-inline-closure.rs @@ -3,7 +3,6 @@ //@ compile-flags: -Copt-level=3 -Ctarget-cpu=x86-64 #![crate_type = "lib"] -#![feature(target_feature_11)] #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; diff --git a/tests/codegen/terminating-catchpad.rs b/tests/codegen/terminating-catchpad.rs new file mode 100644 index 00000000000..17d88796300 --- /dev/null +++ b/tests/codegen/terminating-catchpad.rs @@ -0,0 +1,37 @@ +//@ revisions: emscripten wasi seh +//@[emscripten] compile-flags: --target wasm32-unknown-emscripten -Z emscripten-wasm-eh +//@[wasi] compile-flags: --target wasm32-wasip1 -C panic=unwind +//@[seh] compile-flags: --target x86_64-pc-windows-msvc +//@[emscripten] needs-llvm-components: webassembly +//@[wasi] needs-llvm-components: webassembly +//@[seh] needs-llvm-components: x86 + +// Ensure a catch-all generates: +// - `catchpad ... [ptr null]` on Wasm (otherwise LLVM gets confused) +// - `catchpad ... [ptr null, i32 64, ptr null]` on Windows (otherwise we catch SEH exceptions) + +#![feature(no_core, lang_items, rustc_attrs)] +#![crate_type = "lib"] +#![no_std] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +unsafe extern "C-unwind" { + safe fn unwinds(); +} + +#[lang = "panic_cannot_unwind"] +fn panic_cannot_unwind() -> ! { + loop {} +} + +#[no_mangle] +#[rustc_nounwind] +pub fn doesnt_unwind() { + // emscripten: %catchpad = catchpad within %catchswitch [ptr null] + // wasi: %catchpad = catchpad within %catchswitch [ptr null] + // seh: %catchpad = catchpad within %catchswitch [ptr null, i32 64, ptr null] + unwinds(); +} diff --git a/tests/codegen/thread-local.rs b/tests/codegen/thread-local.rs index 2ee15811cc3..9ce34473b91 100644 --- a/tests/codegen/thread-local.rs +++ b/tests/codegen/thread-local.rs @@ -1,6 +1,6 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ aux-build:thread_local_aux.rs -//@ ignore-windows FIXME(#84933) +//@ ignore-windows FIXME(#134939) //@ ignore-wasm globals are used instead of thread locals //@ ignore-emscripten globals are used instead of thread locals //@ ignore-android does not use #[thread_local] diff --git a/tests/codegen/to_vec.rs b/tests/codegen/to_vec.rs index 4666f8d6f15..4f6e77188d8 100644 --- a/tests/codegen/to_vec.rs +++ b/tests/codegen/to_vec.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/trailing_zeros.rs b/tests/codegen/trailing_zeros.rs index b659e061821..0816a980992 100644 --- a/tests/codegen/trailing_zeros.rs +++ b/tests/codegen/trailing_zeros.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/transmute-optimized.rs b/tests/codegen/transmute-optimized.rs index de54eecf0c0..477fdc6de90 100644 --- a/tests/codegen/transmute-optimized.rs +++ b/tests/codegen/transmute-optimized.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled #![crate_type = "lib"] // This tests that LLVM can optimize based on the niches in the source or diff --git a/tests/codegen/try_question_mark_nop.rs b/tests/codegen/try_question_mark_nop.rs index 36a0d9066c8..751d7ca9311 100644 --- a/tests/codegen/try_question_mark_nop.rs +++ b/tests/codegen/try_question_mark_nop.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z merge-functions=disabled --edition=2021 +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled --edition=2021 //@ only-x86_64 // FIXME: Remove the `min-llvm-version`. //@ revisions: NINETEEN TWENTY diff --git a/tests/codegen/ub-checks.rs b/tests/codegen/ub-checks.rs index de48d74e652..67f5bff08d5 100644 --- a/tests/codegen/ub-checks.rs +++ b/tests/codegen/ub-checks.rs @@ -8,7 +8,7 @@ //@ revisions: DEBUG NOCHECKS //@ [DEBUG] compile-flags: //@ [NOCHECKS] compile-flags: -Zub-checks=no -//@ compile-flags: -O -Cdebug-assertions=yes +//@ compile-flags: -Copt-level=3 -Cdebug-assertions=yes #![crate_type = "lib"] diff --git a/tests/codegen/unchecked_shifts.rs b/tests/codegen/unchecked_shifts.rs index 86517c89627..b27eb73c0cc 100644 --- a/tests/codegen/unchecked_shifts.rs +++ b/tests/codegen/unchecked_shifts.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(unchecked_shifts)] diff --git a/tests/codegen/union-abi.rs b/tests/codegen/union-abi.rs index 2f14682dfa5..16022fad8af 100644 --- a/tests/codegen/union-abi.rs +++ b/tests/codegen/union-abi.rs @@ -1,9 +1,12 @@ //@ ignore-emscripten vectors passed directly -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes // 32-bit x86 returns `f32` differently to avoid the x87 stack. // 32-bit systems will return 128bit values using a return area pointer. -//@ revisions: x86 bit32 bit64 -//@[x86] only-x86 +//@ revisions: x86-sse x86-nosse bit32 bit64 +//@[x86-sse] only-x86 +//@[x86-sse] only-rustc_abi-x86-sse2 +//@[x86-nosse] only-x86 +//@[x86-nosse] ignore-rustc_abi-x86-sse2 //@[bit32] ignore-x86 //@[bit32] only-32bit //@[bit64] ignore-x86 @@ -75,7 +78,8 @@ pub union UnionF32 { a: f32, } -// x86: define {{(dso_local )?}}i32 @test_UnionF32(float %_1) +// x86-sse: define {{(dso_local )?}}<4 x i8> @test_UnionF32(float %_1) +// x86-nosse: define {{(dso_local )?}}i32 @test_UnionF32(float %_1) // bit32: define {{(dso_local )?}}float @test_UnionF32(float %_1) // bit64: define {{(dso_local )?}}float @test_UnionF32(float %_1) #[no_mangle] @@ -88,7 +92,8 @@ pub union UnionF32F32 { b: f32, } -// x86: define {{(dso_local )?}}i32 @test_UnionF32F32(float %_1) +// x86-sse: define {{(dso_local )?}}<4 x i8> @test_UnionF32F32(float %_1) +// x86-nosse: define {{(dso_local )?}}i32 @test_UnionF32F32(float %_1) // bit32: define {{(dso_local )?}}float @test_UnionF32F32(float %_1) // bit64: define {{(dso_local )?}}float @test_UnionF32F32(float %_1) #[no_mangle] @@ -110,7 +115,8 @@ pub fn test_UnionF32U32(_: UnionF32U32) -> UnionF32U32 { pub union UnionU128 { a: u128, } -// x86: define {{(dso_local )?}}void @test_UnionU128({{.*}}sret([16 x i8]){{.*}}, i128 %_1) +// x86-sse: define {{(dso_local )?}}void @test_UnionU128({{.*}}sret([16 x i8]){{.*}}, i128 %_1) +// x86-nosse: define {{(dso_local )?}}void @test_UnionU128({{.*}}sret([16 x i8]){{.*}}, i128 %_1) // bit32: define {{(dso_local )?}}void @test_UnionU128({{.*}}sret([16 x i8]){{.*}}, i128 %_1) // bit64: define {{(dso_local )?}}i128 @test_UnionU128(i128 %_1) #[no_mangle] diff --git a/tests/codegen/var-names.rs b/tests/codegen/var-names.rs index 4ea5b3b436d..40720e19761 100644 --- a/tests/codegen/var-names.rs +++ b/tests/codegen/var-names.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -C no-prepopulate-passes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/vec-as-ptr.rs b/tests/codegen/vec-as-ptr.rs index 17869c21c83..5c997802640 100644 --- a/tests/codegen/vec-as-ptr.rs +++ b/tests/codegen/vec-as-ptr.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Zmerge-functions=disabled +//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled #![crate_type = "lib"] diff --git a/tests/codegen/vec-calloc.rs b/tests/codegen/vec-calloc.rs index f88ed7ae8a5..2e2769ce130 100644 --- a/tests/codegen/vec-calloc.rs +++ b/tests/codegen/vec-calloc.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled //@ only-x86_64 #![crate_type = "lib"] diff --git a/tests/codegen/vec-in-place.rs b/tests/codegen/vec-in-place.rs index e835a7ef69b..1f6836f6dfa 100644 --- a/tests/codegen/vec-in-place.rs +++ b/tests/codegen/vec-in-place.rs @@ -1,5 +1,5 @@ //@ ignore-std-debug-assertions (FIXME: checks for call detect scoped noalias metadata) -//@ compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled #![crate_type = "lib"] // Ensure that trivial casts of vec elements are O(1) diff --git a/tests/codegen/vec-iter-collect-len.rs b/tests/codegen/vec-iter-collect-len.rs index 8c5d2f6f9a7..a88573522d4 100644 --- a/tests/codegen/vec-iter-collect-len.rs +++ b/tests/codegen/vec-iter-collect-len.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #[no_mangle] diff --git a/tests/codegen/vec-iter.rs b/tests/codegen/vec-iter.rs index 310680969c4..4ed00d2d34f 100644 --- a/tests/codegen/vec-iter.rs +++ b/tests/codegen/vec-iter.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #![feature(exact_size_is_empty)] diff --git a/tests/codegen/vec-len-invariant.rs b/tests/codegen/vec-len-invariant.rs index 780c86bab95..033181c2bfb 100644 --- a/tests/codegen/vec-len-invariant.rs +++ b/tests/codegen/vec-len-invariant.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ only-64bit // // This test confirms that we do not reload the length of a Vec after growing it in push. diff --git a/tests/codegen/vec-optimizes-away.rs b/tests/codegen/vec-optimizes-away.rs index 77a94b0b429..39d5c1614c8 100644 --- a/tests/codegen/vec-optimizes-away.rs +++ b/tests/codegen/vec-optimizes-away.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] #[no_mangle] diff --git a/tests/codegen/vec-reserve-extend.rs b/tests/codegen/vec-reserve-extend.rs index 1f00f7d2063..4d3f23ccecf 100644 --- a/tests/codegen/vec-reserve-extend.rs +++ b/tests/codegen/vec-reserve-extend.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/vec-shrink-panik.rs b/tests/codegen/vec-shrink-panik.rs index 873904c2569..23dd300d48c 100644 --- a/tests/codegen/vec-shrink-panik.rs +++ b/tests/codegen/vec-shrink-panik.rs @@ -1,6 +1,6 @@ // LLVM 17 realizes double panic is not possible and doesn't generate calls // to panic_cannot_unwind. -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ ignore-std-debug-assertions (plain old debug assertions) //@ needs-unwind #![crate_type = "lib"] diff --git a/tests/codegen/vec-with-capacity.rs b/tests/codegen/vec-with-capacity.rs index e8c5bc88bd0..777bbcc4fcb 100644 --- a/tests/codegen/vec-with-capacity.rs +++ b/tests/codegen/vec-with-capacity.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ ignore-std-debug-assertions // (with debug assertions turned on, `assert_unchecked` generates a real assertion) diff --git a/tests/codegen/vec_pop_push_noop.rs b/tests/codegen/vec_pop_push_noop.rs index 4821e840884..2635660596a 100644 --- a/tests/codegen/vec_pop_push_noop.rs +++ b/tests/codegen/vec_pop_push_noop.rs @@ -1,7 +1,7 @@ //@ revisions: llvm-pre-19 llvm-19 //@ [llvm-19] min-llvm-version: 19 //@ [llvm-pre-19] max-llvm-major-version: 18 -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/vecdeque-drain.rs b/tests/codegen/vecdeque-drain.rs index 8a34ba0674b..a5e5da65013 100644 --- a/tests/codegen/vecdeque-drain.rs +++ b/tests/codegen/vecdeque-drain.rs @@ -1,6 +1,6 @@ // Check that draining at the front or back doesn't copy memory. -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ needs-deterministic-layouts //@ ignore-std-debug-assertions (FIXME: checks for call detect scoped noalias metadata) diff --git a/tests/codegen/vecdeque-nonempty-get-no-panic.rs b/tests/codegen/vecdeque-nonempty-get-no-panic.rs index 3f802de9eee..1f886b096bb 100644 --- a/tests/codegen/vecdeque-nonempty-get-no-panic.rs +++ b/tests/codegen/vecdeque-nonempty-get-no-panic.rs @@ -1,6 +1,6 @@ // Guards against regression for optimization discussed in issue #80836 -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/vecdeque_no_panic.rs b/tests/codegen/vecdeque_no_panic.rs index da948d12254..3166842afca 100644 --- a/tests/codegen/vecdeque_no_panic.rs +++ b/tests/codegen/vecdeque_no_panic.rs @@ -1,6 +1,6 @@ // This test checks that `VecDeque::front[_mut]()` and `VecDeque::back[_mut]()` can't panic. -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ ignore-std-debug-assertions (plain old debug assertions) #![crate_type = "lib"] diff --git a/tests/codegen/vecdeque_pop_push.rs b/tests/codegen/vecdeque_pop_push.rs index 040d5a279dc..5afa1b2248b 100644 --- a/tests/codegen/vecdeque_pop_push.rs +++ b/tests/codegen/vecdeque_pop_push.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/virtual-function-elimination-32bit.rs b/tests/codegen/virtual-function-elimination-32bit.rs index 76223be1f3d..c9919cecccf 100644 --- a/tests/codegen/virtual-function-elimination-32bit.rs +++ b/tests/codegen/virtual-function-elimination-32bit.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Zvirtual-function-elimination -Clto -O -Csymbol-mangling-version=v0 +//@ compile-flags: -Zvirtual-function-elimination -Clto -Copt-level=3 -Csymbol-mangling-version=v0 //@ ignore-64bit // CHECK: @vtable.0 = {{.*}}, !type ![[TYPE0:[0-9]+]], !vcall_visibility ![[VCALL_VIS0:[0-9]+]] diff --git a/tests/codegen/virtual-function-elimination.rs b/tests/codegen/virtual-function-elimination.rs index 23d7657baa9..d2d0c4b78ab 100644 --- a/tests/codegen/virtual-function-elimination.rs +++ b/tests/codegen/virtual-function-elimination.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Zvirtual-function-elimination -Clto -O -Csymbol-mangling-version=v0 +//@ compile-flags: -Zvirtual-function-elimination -Clto -Copt-level=3 -Csymbol-mangling-version=v0 //@ ignore-32bit // CHECK: @vtable.0 = {{.*}}, !type ![[TYPE0:[0-9]+]], !vcall_visibility ![[VCALL_VIS0:[0-9]+]] diff --git a/tests/codegen/vtable-loads.rs b/tests/codegen/vtable-loads.rs index 1dd6ca51063..aa103ec6f7c 100644 --- a/tests/codegen/vtable-loads.rs +++ b/tests/codegen/vtable-loads.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/codegen/vtable-upcast.rs b/tests/codegen/vtable-upcast.rs index ae7b4bf7aee..9e13e8dd68a 100644 --- a/tests/codegen/vtable-upcast.rs +++ b/tests/codegen/vtable-upcast.rs @@ -2,7 +2,6 @@ //@ compile-flags: -C no-prepopulate-passes -Copt-level=0 #![crate_type = "lib"] -#![feature(trait_upcasting)] pub trait Base { fn base(&self); diff --git a/tests/codegen/wasm_exceptions.rs b/tests/codegen/wasm_exceptions.rs index 719499dd8ea..07b8ae6e9d7 100644 --- a/tests/codegen/wasm_exceptions.rs +++ b/tests/codegen/wasm_exceptions.rs @@ -1,5 +1,5 @@ //@ only-wasm32 -//@ compile-flags: -C panic=unwind +//@ compile-flags: -C panic=unwind -Z emscripten-wasm-eh #![crate_type = "lib"] #![feature(core_intrinsics)] diff --git a/tests/codegen/zip.rs b/tests/codegen/zip.rs index ea8caba61f3..38ecf7c15c6 100644 --- a/tests/codegen/zip.rs +++ b/tests/codegen/zip.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -C no-prepopulate-passes -O +//@ compile-flags: -Cno-prepopulate-passes -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/coverage/assert_not.cov-map b/tests/coverage/assert_not.cov-map index 397eaa17caf..526110ebbb7 100644 --- a/tests/coverage/assert_not.cov-map +++ b/tests/coverage/assert_not.cov-map @@ -1,15 +1,13 @@ Function name: assert_not::main -Raw bytes (31): 0x[01, 01, 01, 0d, 00, 05, 01, 06, 01, 01, 12, 05, 02, 05, 00, 14, 09, 01, 05, 00, 14, 0d, 01, 05, 00, 16, 02, 01, 01, 00, 02] +Raw bytes (29): 0x[01, 01, 00, 05, 01, 06, 01, 01, 12, 01, 02, 05, 00, 14, 01, 01, 05, 00, 14, 01, 01, 05, 00, 16, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 1 -- expression 0 operands: lhs = Counter(3), rhs = Zero +Number of expressions: 0 Number of file 0 mappings: 5 - Code(Counter(0)) at (prev + 6, 1) to (start + 1, 18) -- Code(Counter(1)) at (prev + 2, 5) to (start + 0, 20) -- Code(Counter(2)) at (prev + 1, 5) to (start + 0, 20) -- Code(Counter(3)) at (prev + 1, 5) to (start + 0, 22) -- Code(Expression(0, Sub)) at (prev + 1, 1) to (start + 0, 2) - = (c3 - Zero) -Highest counter ID seen: c3 +- Code(Counter(0)) at (prev + 2, 5) to (start + 0, 20) +- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 20) +- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 22) +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c0 diff --git a/tests/coverage/async2.cov-map b/tests/coverage/async2.cov-map index 7660f917b65..c2a0645ee9a 100644 --- a/tests/coverage/async2.cov-map +++ b/tests/coverage/async2.cov-map @@ -8,16 +8,16 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: async2::async_func::{closure#0} -Raw bytes (24): 0x[01, 01, 00, 04, 01, 0f, 17, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 05, 00, 06, 01, 01, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 0f, 17, 03, 09, 01, 03, 0a, 02, 06, 00, 02, 05, 00, 06, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 15, 23) to (start + 3, 9) -- Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6) +- Code(Counter(0)) at (prev + 3, 10) to (start + 2, 6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 Function name: async2::async_func_just_println Raw bytes (9): 0x[01, 01, 00, 01, 01, 17, 01, 00, 24] @@ -47,14 +47,14 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: async2::non_async_func -Raw bytes (24): 0x[01, 01, 00, 04, 01, 07, 01, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 05, 00, 06, 01, 01, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 07, 01, 03, 09, 01, 03, 0a, 02, 06, 00, 02, 05, 00, 06, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 7, 1) to (start + 3, 9) -- Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6) +- Code(Counter(0)) at (prev + 3, 10) to (start + 2, 6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 diff --git a/tests/coverage/bad_counter_ids.cov-map b/tests/coverage/bad_counter_ids.cov-map index 2b5399f33bb..baac0073fcb 100644 --- a/tests/coverage/bad_counter_ids.cov-map +++ b/tests/coverage/bad_counter_ids.cov-map @@ -9,38 +9,36 @@ Number of file 0 mappings: 2 Highest counter ID seen: c0 Function name: bad_counter_ids::eq_bad_message -Raw bytes (21): 0x[01, 01, 01, 01, 00, 03, 01, 29, 01, 02, 0f, 02, 02, 20, 00, 2b, 00, 01, 01, 00, 02] +Raw bytes (19): 0x[01, 01, 00, 03, 01, 29, 01, 02, 0f, 01, 02, 20, 00, 2b, 00, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 1 -- expression 0 operands: lhs = Counter(0), rhs = Zero +Number of expressions: 0 Number of file 0 mappings: 3 - Code(Counter(0)) at (prev + 41, 1) to (start + 2, 15) -- Code(Expression(0, Sub)) at (prev + 2, 32) to (start + 0, 43) - = (c0 - Zero) +- Code(Counter(0)) at (prev + 2, 32) to (start + 0, 43) - Code(Zero) at (prev + 1, 1) to (start + 0, 2) Highest counter ID seen: c0 Function name: bad_counter_ids::eq_good -Raw bytes (14): 0x[01, 01, 00, 02, 01, 10, 01, 02, 1f, 05, 03, 01, 00, 02] +Raw bytes (14): 0x[01, 01, 00, 02, 01, 10, 01, 02, 1f, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 2 - Code(Counter(0)) at (prev + 16, 1) to (start + 2, 31) -- Code(Counter(1)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c1 +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) +Highest counter ID seen: c0 Function name: bad_counter_ids::eq_good_message -Raw bytes (19): 0x[01, 01, 00, 03, 01, 15, 01, 02, 0f, 00, 02, 20, 00, 2b, 05, 01, 01, 00, 02] +Raw bytes (19): 0x[01, 01, 00, 03, 01, 15, 01, 02, 0f, 00, 02, 20, 00, 2b, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 3 - Code(Counter(0)) at (prev + 21, 1) to (start + 2, 15) - Code(Zero) at (prev + 2, 32) to (start + 0, 43) -- Code(Counter(1)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c1 +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) +Highest counter ID seen: c0 Function name: bad_counter_ids::ne_bad Raw bytes (14): 0x[01, 01, 00, 02, 01, 2e, 01, 02, 1f, 00, 03, 01, 00, 02] @@ -53,38 +51,34 @@ Number of file 0 mappings: 2 Highest counter ID seen: c0 Function name: bad_counter_ids::ne_bad_message -Raw bytes (19): 0x[01, 01, 00, 03, 01, 33, 01, 02, 0f, 05, 02, 20, 00, 2b, 00, 01, 01, 00, 02] +Raw bytes (19): 0x[01, 01, 00, 03, 01, 33, 01, 02, 0f, 01, 02, 20, 00, 2b, 00, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 3 - Code(Counter(0)) at (prev + 51, 1) to (start + 2, 15) -- Code(Counter(1)) at (prev + 2, 32) to (start + 0, 43) +- Code(Counter(0)) at (prev + 2, 32) to (start + 0, 43) - Code(Zero) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 Function name: bad_counter_ids::ne_good -Raw bytes (16): 0x[01, 01, 01, 01, 00, 02, 01, 1a, 01, 02, 1f, 02, 03, 01, 00, 02] +Raw bytes (14): 0x[01, 01, 00, 02, 01, 1a, 01, 02, 1f, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 1 -- expression 0 operands: lhs = Counter(0), rhs = Zero +Number of expressions: 0 Number of file 0 mappings: 2 - Code(Counter(0)) at (prev + 26, 1) to (start + 2, 31) -- Code(Expression(0, Sub)) at (prev + 3, 1) to (start + 0, 2) - = (c0 - Zero) +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) Highest counter ID seen: c0 Function name: bad_counter_ids::ne_good_message -Raw bytes (21): 0x[01, 01, 01, 01, 00, 03, 01, 1f, 01, 02, 0f, 00, 02, 20, 00, 2b, 02, 01, 01, 00, 02] +Raw bytes (19): 0x[01, 01, 00, 03, 01, 1f, 01, 02, 0f, 00, 02, 20, 00, 2b, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 1 -- expression 0 operands: lhs = Counter(0), rhs = Zero +Number of expressions: 0 Number of file 0 mappings: 3 - Code(Counter(0)) at (prev + 31, 1) to (start + 2, 15) - Code(Zero) at (prev + 2, 32) to (start + 0, 43) -- Code(Expression(0, Sub)) at (prev + 1, 1) to (start + 0, 2) - = (c0 - Zero) +- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) Highest counter ID seen: c0 diff --git a/tests/coverage/conditions.cov-map b/tests/coverage/conditions.cov-map index 549b8bb0a20..2d12f4bf774 100644 --- a/tests/coverage/conditions.cov-map +++ b/tests/coverage/conditions.cov-map @@ -1,192 +1,191 @@ Function name: conditions::main -Raw bytes (545): 0x[01, 01, 4d, 09, 0d, 01, 09, 0d, 71, 0d, 27, 71, 75, 27, 79, 71, 75, 0d, 23, 27, 79, 71, 75, 01, 03, 03, 15, 19, 65, 19, 4f, 65, 69, 4f, 6d, 65, 69, 19, 4b, 4f, 6d, 65, 69, 03, ef, 01, 15, 19, 15, 19, 1d, 25, 29, 59, 29, 7f, 59, 5d, 7f, 61, 59, 5d, 29, 7b, 7f, 61, 59, 5d, 1d, 87, 01, 25, 29, e7, 01, 1d, eb, 01, 29, ef, 01, 25, 15, 19, 31, 35, e7, 01, 1d, eb, 01, 29, ef, 01, 25, 15, 19, e7, 01, f7, 01, eb, 01, 29, ef, 01, 25, 15, 19, 1d, 31, 35, 4d, 35, df, 01, 4d, 51, df, 01, 55, 4d, 51, 35, db, 01, df, 01, 55, 4d, 51, e7, 01, f3, 01, eb, 01, 29, ef, 01, 25, 15, 19, f7, 01, 35, 1d, 31, 39, 3d, 31, 35, af, 02, 39, 31, 35, 3d, 41, 3d, a7, 02, 41, 45, a7, 02, 49, 41, 45, 3d, a3, 02, a7, 02, 49, 41, 45, af, 02, b3, 02, 31, 35, 39, 3d, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 03, 09, 00, 0a, 01, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, 06, 02, 0f, 00, 1c, 0d, 01, 0c, 00, 19, 0a, 00, 1d, 00, 2a, 0e, 00, 2e, 00, 3c, 23, 00, 3d, 02, 0a, 1e, 02, 09, 00, 0a, 0d, 01, 09, 01, 12, 2a, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 11, 01, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 02, 08, 00, 15, 15, 00, 16, 02, 06, 2e, 02, 0f, 00, 1c, 19, 01, 0c, 00, 19, 32, 00, 1d, 00, 2a, 36, 00, 2e, 00, 3c, 4b, 00, 3d, 02, 0a, 46, 02, 09, 00, 0a, 19, 01, 09, 00, 17, 52, 02, 09, 00, 0f, ef, 01, 03, 08, 00, 0c, 1d, 01, 0d, 01, 10, 21, 01, 11, 02, 0a, 00, 02, 09, 00, 0a, 1d, 02, 0c, 00, 19, 25, 00, 1a, 02, 0a, 5e, 04, 11, 00, 1e, 29, 01, 10, 00, 1d, 62, 00, 21, 00, 2e, 66, 00, 32, 00, 40, 7b, 00, 41, 02, 0e, 76, 02, 0d, 00, 0e, 29, 01, 0d, 00, 1b, 82, 01, 02, 0d, 00, 13, 00, 02, 05, 00, 06, 9e, 01, 02, 09, 01, 0c, 2d, 01, 0d, 02, 06, 00, 02, 05, 00, 06, af, 02, 02, 09, 00, 0a, 9e, 01, 00, 10, 00, 1d, 31, 00, 1e, 02, 06, ae, 01, 02, 0f, 00, 1c, 35, 01, 0c, 00, 19, c2, 01, 00, 1d, 00, 2a, c6, 01, 00, 2e, 00, 3c, db, 01, 00, 3d, 02, 0a, d6, 01, 02, 09, 00, 0a, 35, 01, 09, 00, 17, e2, 01, 02, 0d, 02, 0f, b3, 02, 05, 09, 00, 0a, af, 02, 00, 10, 00, 1d, 39, 00, 1e, 02, 06, 82, 02, 02, 0f, 00, 1c, 3d, 01, 0c, 00, 19, 8a, 02, 00, 1d, 00, 2a, 8e, 02, 00, 2e, 00, 3c, a3, 02, 00, 3d, 02, 0a, 9e, 02, 02, 09, 00, 0a, 3d, 01, 09, 00, 17, aa, 02, 02, 09, 00, 0f, 01, 02, 01, 00, 02] +Raw bytes (533): 0x[01, 01, 47, 05, 09, 01, 05, 09, 5d, 09, 27, 5d, 61, 27, 65, 5d, 61, 09, 23, 27, 65, 5d, 61, 01, 03, 03, 0d, 11, 51, 11, 4f, 51, 55, 4f, 59, 51, 55, 11, 4b, 4f, 59, 51, 55, 03, 97, 01, 0d, 11, 0d, 11, 0d, 11, 0d, 11, 0d, 11, 97, 01, 15, 0d, 11, 19, 45, 19, 8f, 01, 45, 49, 8f, 01, 4d, 45, 49, 19, 8b, 01, 8f, 01, 4d, 45, 49, 97, 01, db, 01, 0d, 11, 15, 19, 15, 19, 15, 19, 1d, 21, 15, 19, db, 01, 1d, 15, 19, 21, 39, 21, d3, 01, 39, 3d, d3, 01, 41, 39, 3d, 21, cf, 01, d3, 01, 41, 39, 3d, db, 01, 97, 02, 15, 19, 1d, 21, 25, 29, 1d, 21, 97, 02, 25, 1d, 21, 29, 2d, 29, 8f, 02, 2d, 31, 8f, 02, 35, 2d, 31, 29, 8b, 02, 8f, 02, 35, 2d, 31, 97, 02, 9b, 02, 1d, 21, 25, 29, 44, 01, 03, 01, 02, 0c, 01, 02, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 03, 09, 00, 0a, 01, 00, 10, 00, 1d, 05, 01, 09, 01, 0a, 06, 02, 0f, 00, 1c, 09, 01, 0c, 00, 19, 0a, 00, 1d, 00, 2a, 0e, 00, 2e, 00, 3c, 23, 00, 3d, 02, 0a, 1e, 02, 09, 00, 0a, 09, 01, 09, 01, 12, 2a, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 03, 01, 0d, 02, 06, 00, 02, 05, 00, 06, 03, 02, 08, 00, 15, 0d, 00, 16, 02, 06, 2e, 02, 0f, 00, 1c, 11, 01, 0c, 00, 19, 32, 00, 1d, 00, 2a, 36, 00, 2e, 00, 3c, 4b, 00, 3d, 02, 0a, 46, 02, 09, 00, 0a, 11, 01, 09, 00, 17, 52, 02, 09, 00, 0f, 97, 01, 03, 08, 00, 0c, 97, 01, 01, 0d, 01, 10, 97, 01, 01, 11, 02, 0a, 00, 02, 09, 00, 0a, 97, 01, 02, 0c, 00, 19, 15, 00, 1a, 02, 0a, 6a, 04, 11, 00, 1e, 19, 01, 10, 00, 1d, 72, 00, 21, 00, 2e, 76, 00, 32, 00, 40, 8b, 01, 00, 41, 02, 0e, 86, 01, 02, 0d, 00, 0e, 19, 01, 0d, 00, 1b, 92, 01, 02, 0d, 00, 13, 00, 02, 05, 00, 06, db, 01, 02, 09, 01, 0c, db, 01, 01, 0d, 02, 06, 00, 02, 05, 00, 06, 97, 02, 02, 09, 00, 0a, db, 01, 00, 10, 00, 1d, 1d, 00, 1e, 02, 06, ae, 01, 02, 0f, 00, 1c, 21, 01, 0c, 00, 19, b6, 01, 00, 1d, 00, 2a, ba, 01, 00, 2e, 00, 3c, cf, 01, 00, 3d, 02, 0a, ca, 01, 02, 09, 00, 0a, 21, 01, 09, 00, 17, d6, 01, 02, 0d, 02, 0f, 9b, 02, 05, 09, 00, 0a, 97, 02, 00, 10, 00, 1d, 25, 00, 1e, 02, 06, ea, 01, 02, 0f, 00, 1c, 29, 01, 0c, 00, 19, f2, 01, 00, 1d, 00, 2a, f6, 01, 00, 2e, 00, 3c, 8b, 02, 00, 3d, 02, 0a, 86, 02, 02, 09, 00, 0a, 29, 01, 09, 00, 17, 92, 02, 02, 09, 00, 0f, 01, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 77 -- expression 0 operands: lhs = Counter(2), rhs = Counter(3) -- expression 1 operands: lhs = Counter(0), rhs = Counter(2) -- expression 2 operands: lhs = Counter(3), rhs = Counter(28) -- expression 3 operands: lhs = Counter(3), rhs = Expression(9, Add) -- expression 4 operands: lhs = Counter(28), rhs = Counter(29) -- expression 5 operands: lhs = Expression(9, Add), rhs = Counter(30) -- expression 6 operands: lhs = Counter(28), rhs = Counter(29) -- expression 7 operands: lhs = Counter(3), rhs = Expression(8, Add) -- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(30) -- expression 9 operands: lhs = Counter(28), rhs = Counter(29) +Number of expressions: 71 +- expression 0 operands: lhs = Counter(1), rhs = Counter(2) +- expression 1 operands: lhs = Counter(0), rhs = Counter(1) +- expression 2 operands: lhs = Counter(2), rhs = Counter(23) +- expression 3 operands: lhs = Counter(2), rhs = Expression(9, Add) +- expression 4 operands: lhs = Counter(23), rhs = Counter(24) +- expression 5 operands: lhs = Expression(9, Add), rhs = Counter(25) +- expression 6 operands: lhs = Counter(23), rhs = Counter(24) +- expression 7 operands: lhs = Counter(2), rhs = Expression(8, Add) +- expression 8 operands: lhs = Expression(9, Add), rhs = Counter(25) +- expression 9 operands: lhs = Counter(23), rhs = Counter(24) - expression 10 operands: lhs = Counter(0), rhs = Expression(0, Add) -- expression 11 operands: lhs = Expression(0, Add), rhs = Counter(5) -- expression 12 operands: lhs = Counter(6), rhs = Counter(25) -- expression 13 operands: lhs = Counter(6), rhs = Expression(19, Add) -- expression 14 operands: lhs = Counter(25), rhs = Counter(26) -- expression 15 operands: lhs = Expression(19, Add), rhs = Counter(27) -- expression 16 operands: lhs = Counter(25), rhs = Counter(26) -- expression 17 operands: lhs = Counter(6), rhs = Expression(18, Add) -- expression 18 operands: lhs = Expression(19, Add), rhs = Counter(27) -- expression 19 operands: lhs = Counter(25), rhs = Counter(26) -- expression 20 operands: lhs = Expression(0, Add), rhs = Expression(59, Add) -- expression 21 operands: lhs = Counter(5), rhs = Counter(6) -- expression 22 operands: lhs = Counter(5), rhs = Counter(6) -- expression 23 operands: lhs = Counter(7), rhs = Counter(9) -- expression 24 operands: lhs = Counter(10), rhs = Counter(22) -- expression 25 operands: lhs = Counter(10), rhs = Expression(31, Add) -- expression 26 operands: lhs = Counter(22), rhs = Counter(23) -- expression 27 operands: lhs = Expression(31, Add), rhs = Counter(24) -- expression 28 operands: lhs = Counter(22), rhs = Counter(23) -- expression 29 operands: lhs = Counter(10), rhs = Expression(30, Add) -- expression 30 operands: lhs = Expression(31, Add), rhs = Counter(24) -- expression 31 operands: lhs = Counter(22), rhs = Counter(23) -- expression 32 operands: lhs = Counter(7), rhs = Expression(33, Add) -- expression 33 operands: lhs = Counter(9), rhs = Counter(10) -- expression 34 operands: lhs = Expression(57, Add), rhs = Counter(7) -- expression 35 operands: lhs = Expression(58, Add), rhs = Counter(10) -- expression 36 operands: lhs = Expression(59, Add), rhs = Counter(9) -- expression 37 operands: lhs = Counter(5), rhs = Counter(6) -- expression 38 operands: lhs = Counter(12), rhs = Counter(13) -- expression 39 operands: lhs = Expression(57, Add), rhs = Counter(7) -- expression 40 operands: lhs = Expression(58, Add), rhs = Counter(10) -- expression 41 operands: lhs = Expression(59, Add), rhs = Counter(9) +- expression 11 operands: lhs = Expression(0, Add), rhs = Counter(3) +- expression 12 operands: lhs = Counter(4), rhs = Counter(20) +- expression 13 operands: lhs = Counter(4), rhs = Expression(19, Add) +- expression 14 operands: lhs = Counter(20), rhs = Counter(21) +- expression 15 operands: lhs = Expression(19, Add), rhs = Counter(22) +- expression 16 operands: lhs = Counter(20), rhs = Counter(21) +- expression 17 operands: lhs = Counter(4), rhs = Expression(18, Add) +- expression 18 operands: lhs = Expression(19, Add), rhs = Counter(22) +- expression 19 operands: lhs = Counter(20), rhs = Counter(21) +- expression 20 operands: lhs = Expression(0, Add), rhs = Expression(37, Add) +- expression 21 operands: lhs = Counter(3), rhs = Counter(4) +- expression 22 operands: lhs = Counter(3), rhs = Counter(4) +- expression 23 operands: lhs = Counter(3), rhs = Counter(4) +- expression 24 operands: lhs = Counter(3), rhs = Counter(4) +- expression 25 operands: lhs = Counter(3), rhs = Counter(4) +- expression 26 operands: lhs = Expression(37, Add), rhs = Counter(5) +- expression 27 operands: lhs = Counter(3), rhs = Counter(4) +- expression 28 operands: lhs = Counter(6), rhs = Counter(17) +- expression 29 operands: lhs = Counter(6), rhs = Expression(35, Add) +- expression 30 operands: lhs = Counter(17), rhs = Counter(18) +- expression 31 operands: lhs = Expression(35, Add), rhs = Counter(19) +- expression 32 operands: lhs = Counter(17), rhs = Counter(18) +- expression 33 operands: lhs = Counter(6), rhs = Expression(34, Add) +- expression 34 operands: lhs = Expression(35, Add), rhs = Counter(19) +- expression 35 operands: lhs = Counter(17), rhs = Counter(18) +- expression 36 operands: lhs = Expression(37, Add), rhs = Expression(54, Add) +- expression 37 operands: lhs = Counter(3), rhs = Counter(4) +- expression 38 operands: lhs = Counter(5), rhs = Counter(6) +- expression 39 operands: lhs = Counter(5), rhs = Counter(6) +- expression 40 operands: lhs = Counter(5), rhs = Counter(6) +- expression 41 operands: lhs = Counter(7), rhs = Counter(8) - expression 42 operands: lhs = Counter(5), rhs = Counter(6) -- expression 43 operands: lhs = Expression(57, Add), rhs = Expression(61, Add) -- expression 44 operands: lhs = Expression(58, Add), rhs = Counter(10) -- expression 45 operands: lhs = Expression(59, Add), rhs = Counter(9) -- expression 46 operands: lhs = Counter(5), rhs = Counter(6) -- expression 47 operands: lhs = Counter(7), rhs = Counter(12) -- expression 48 operands: lhs = Counter(13), rhs = Counter(19) -- expression 49 operands: lhs = Counter(13), rhs = Expression(55, Add) -- expression 50 operands: lhs = Counter(19), rhs = Counter(20) -- expression 51 operands: lhs = Expression(55, Add), rhs = Counter(21) -- expression 52 operands: lhs = Counter(19), rhs = Counter(20) -- expression 53 operands: lhs = Counter(13), rhs = Expression(54, Add) -- expression 54 operands: lhs = Expression(55, Add), rhs = Counter(21) -- expression 55 operands: lhs = Counter(19), rhs = Counter(20) -- expression 56 operands: lhs = Expression(57, Add), rhs = Expression(60, Add) -- expression 57 operands: lhs = Expression(58, Add), rhs = Counter(10) -- expression 58 operands: lhs = Expression(59, Add), rhs = Counter(9) -- expression 59 operands: lhs = Counter(5), rhs = Counter(6) -- expression 60 operands: lhs = Expression(61, Add), rhs = Counter(13) -- expression 61 operands: lhs = Counter(7), rhs = Counter(12) -- expression 62 operands: lhs = Counter(14), rhs = Counter(15) -- expression 63 operands: lhs = Counter(12), rhs = Counter(13) -- expression 64 operands: lhs = Expression(75, Add), rhs = Counter(14) -- expression 65 operands: lhs = Counter(12), rhs = Counter(13) -- expression 66 operands: lhs = Counter(15), rhs = Counter(16) -- expression 67 operands: lhs = Counter(15), rhs = Expression(73, Add) -- expression 68 operands: lhs = Counter(16), rhs = Counter(17) -- expression 69 operands: lhs = Expression(73, Add), rhs = Counter(18) -- expression 70 operands: lhs = Counter(16), rhs = Counter(17) -- expression 71 operands: lhs = Counter(15), rhs = Expression(72, Add) -- expression 72 operands: lhs = Expression(73, Add), rhs = Counter(18) -- expression 73 operands: lhs = Counter(16), rhs = Counter(17) -- expression 74 operands: lhs = Expression(75, Add), rhs = Expression(76, Add) -- expression 75 operands: lhs = Counter(12), rhs = Counter(13) -- expression 76 operands: lhs = Counter(14), rhs = Counter(15) +- expression 43 operands: lhs = Expression(54, Add), rhs = Counter(7) +- expression 44 operands: lhs = Counter(5), rhs = Counter(6) +- expression 45 operands: lhs = Counter(8), rhs = Counter(14) +- expression 46 operands: lhs = Counter(8), rhs = Expression(52, Add) +- expression 47 operands: lhs = Counter(14), rhs = Counter(15) +- expression 48 operands: lhs = Expression(52, Add), rhs = Counter(16) +- expression 49 operands: lhs = Counter(14), rhs = Counter(15) +- expression 50 operands: lhs = Counter(8), rhs = Expression(51, Add) +- expression 51 operands: lhs = Expression(52, Add), rhs = Counter(16) +- expression 52 operands: lhs = Counter(14), rhs = Counter(15) +- expression 53 operands: lhs = Expression(54, Add), rhs = Expression(69, Add) +- expression 54 operands: lhs = Counter(5), rhs = Counter(6) +- expression 55 operands: lhs = Counter(7), rhs = Counter(8) +- expression 56 operands: lhs = Counter(9), rhs = Counter(10) +- expression 57 operands: lhs = Counter(7), rhs = Counter(8) +- expression 58 operands: lhs = Expression(69, Add), rhs = Counter(9) +- expression 59 operands: lhs = Counter(7), rhs = Counter(8) +- expression 60 operands: lhs = Counter(10), rhs = Counter(11) +- expression 61 operands: lhs = Counter(10), rhs = Expression(67, Add) +- expression 62 operands: lhs = Counter(11), rhs = Counter(12) +- expression 63 operands: lhs = Expression(67, Add), rhs = Counter(13) +- expression 64 operands: lhs = Counter(11), rhs = Counter(12) +- expression 65 operands: lhs = Counter(10), rhs = Expression(66, Add) +- expression 66 operands: lhs = Expression(67, Add), rhs = Counter(13) +- expression 67 operands: lhs = Counter(11), rhs = Counter(12) +- expression 68 operands: lhs = Expression(69, Add), rhs = Expression(70, Add) +- expression 69 operands: lhs = Counter(7), rhs = Counter(8) +- expression 70 operands: lhs = Counter(9), rhs = Counter(10) Number of file 0 mappings: 68 - Code(Counter(0)) at (prev + 3, 1) to (start + 2, 12) -- Code(Counter(1)) at (prev + 2, 13) to (start + 2, 6) +- Code(Counter(0)) at (prev + 2, 13) to (start + 2, 6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) - Code(Expression(0, Add)) at (prev + 3, 9) to (start + 0, 10) - = (c2 + c3) + = (c1 + c2) - Code(Counter(0)) at (prev + 0, 16) to (start + 0, 29) -- Code(Counter(2)) at (prev + 1, 9) to (start + 1, 10) +- Code(Counter(1)) at (prev + 1, 9) to (start + 1, 10) - Code(Expression(1, Sub)) at (prev + 2, 15) to (start + 0, 28) - = (c0 - c2) -- Code(Counter(3)) at (prev + 1, 12) to (start + 0, 25) + = (c0 - c1) +- Code(Counter(2)) at (prev + 1, 12) to (start + 0, 25) - Code(Expression(2, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (c3 - c28) + = (c2 - c23) - Code(Expression(3, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (c3 - (c28 + c29)) + = (c2 - (c23 + c24)) - Code(Expression(8, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c28 + c29) + c30) + = ((c23 + c24) + c25) - Code(Expression(7, Sub)) at (prev + 2, 9) to (start + 0, 10) - = (c3 - ((c28 + c29) + c30)) -- Code(Counter(3)) at (prev + 1, 9) to (start + 1, 18) + = (c2 - ((c23 + c24) + c25)) +- Code(Counter(2)) at (prev + 1, 9) to (start + 1, 18) - Code(Expression(10, Sub)) at (prev + 3, 9) to (start + 0, 15) - = (c0 - (c2 + c3)) + = (c0 - (c1 + c2)) - Code(Expression(0, Add)) at (prev + 3, 9) to (start + 1, 12) - = (c2 + c3) -- Code(Counter(4)) at (prev + 1, 13) to (start + 2, 6) + = (c1 + c2) +- Code(Expression(0, Add)) at (prev + 1, 13) to (start + 2, 6) + = (c1 + c2) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) - Code(Expression(0, Add)) at (prev + 2, 8) to (start + 0, 21) - = (c2 + c3) -- Code(Counter(5)) at (prev + 0, 22) to (start + 2, 6) + = (c1 + c2) +- Code(Counter(3)) at (prev + 0, 22) to (start + 2, 6) - Code(Expression(11, Sub)) at (prev + 2, 15) to (start + 0, 28) - = ((c2 + c3) - c5) -- Code(Counter(6)) at (prev + 1, 12) to (start + 0, 25) + = ((c1 + c2) - c3) +- Code(Counter(4)) at (prev + 1, 12) to (start + 0, 25) - Code(Expression(12, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (c6 - c25) + = (c4 - c20) - Code(Expression(13, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (c6 - (c25 + c26)) + = (c4 - (c20 + c21)) - Code(Expression(18, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c25 + c26) + c27) + = ((c20 + c21) + c22) - Code(Expression(17, Sub)) at (prev + 2, 9) to (start + 0, 10) - = (c6 - ((c25 + c26) + c27)) -- Code(Counter(6)) at (prev + 1, 9) to (start + 0, 23) + = (c4 - ((c20 + c21) + c22)) +- Code(Counter(4)) at (prev + 1, 9) to (start + 0, 23) - Code(Expression(20, Sub)) at (prev + 2, 9) to (start + 0, 15) - = ((c2 + c3) - (c5 + c6)) -- Code(Expression(59, Add)) at (prev + 3, 8) to (start + 0, 12) - = (c5 + c6) -- Code(Counter(7)) at (prev + 1, 13) to (start + 1, 16) -- Code(Counter(8)) at (prev + 1, 17) to (start + 2, 10) + = ((c1 + c2) - (c3 + c4)) +- Code(Expression(37, Add)) at (prev + 3, 8) to (start + 0, 12) + = (c3 + c4) +- Code(Expression(37, Add)) at (prev + 1, 13) to (start + 1, 16) + = (c3 + c4) +- Code(Expression(37, Add)) at (prev + 1, 17) to (start + 2, 10) + = (c3 + c4) - Code(Zero) at (prev + 2, 9) to (start + 0, 10) -- Code(Counter(7)) at (prev + 2, 12) to (start + 0, 25) -- Code(Counter(9)) at (prev + 0, 26) to (start + 2, 10) -- Code(Expression(23, Sub)) at (prev + 4, 17) to (start + 0, 30) - = (c7 - c9) -- Code(Counter(10)) at (prev + 1, 16) to (start + 0, 29) -- Code(Expression(24, Sub)) at (prev + 0, 33) to (start + 0, 46) - = (c10 - c22) -- Code(Expression(25, Sub)) at (prev + 0, 50) to (start + 0, 64) - = (c10 - (c22 + c23)) -- Code(Expression(30, Add)) at (prev + 0, 65) to (start + 2, 14) - = ((c22 + c23) + c24) -- Code(Expression(29, Sub)) at (prev + 2, 13) to (start + 0, 14) - = (c10 - ((c22 + c23) + c24)) -- Code(Counter(10)) at (prev + 1, 13) to (start + 0, 27) -- Code(Expression(32, Sub)) at (prev + 2, 13) to (start + 0, 19) - = (c7 - (c9 + c10)) +- Code(Expression(37, Add)) at (prev + 2, 12) to (start + 0, 25) + = (c3 + c4) +- Code(Counter(5)) at (prev + 0, 26) to (start + 2, 10) +- Code(Expression(26, Sub)) at (prev + 4, 17) to (start + 0, 30) + = ((c3 + c4) - c5) +- Code(Counter(6)) at (prev + 1, 16) to (start + 0, 29) +- Code(Expression(28, Sub)) at (prev + 0, 33) to (start + 0, 46) + = (c6 - c17) +- Code(Expression(29, Sub)) at (prev + 0, 50) to (start + 0, 64) + = (c6 - (c17 + c18)) +- Code(Expression(34, Add)) at (prev + 0, 65) to (start + 2, 14) + = ((c17 + c18) + c19) +- Code(Expression(33, Sub)) at (prev + 2, 13) to (start + 0, 14) + = (c6 - ((c17 + c18) + c19)) +- Code(Counter(6)) at (prev + 1, 13) to (start + 0, 27) +- Code(Expression(36, Sub)) at (prev + 2, 13) to (start + 0, 19) + = ((c3 + c4) - (c5 + c6)) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) -- Code(Expression(39, Sub)) at (prev + 2, 9) to (start + 1, 12) - = ((((c5 + c6) + c9) + c10) - c7) -- Code(Counter(11)) at (prev + 1, 13) to (start + 2, 6) +- Code(Expression(54, Add)) at (prev + 2, 9) to (start + 1, 12) + = (c5 + c6) +- Code(Expression(54, Add)) at (prev + 1, 13) to (start + 2, 6) + = (c5 + c6) - Code(Zero) at (prev + 2, 5) to (start + 0, 6) -- Code(Expression(75, Add)) at (prev + 2, 9) to (start + 0, 10) - = (c12 + c13) -- Code(Expression(39, Sub)) at (prev + 0, 16) to (start + 0, 29) - = ((((c5 + c6) + c9) + c10) - c7) -- Code(Counter(12)) at (prev + 0, 30) to (start + 2, 6) +- Code(Expression(69, Add)) at (prev + 2, 9) to (start + 0, 10) + = (c7 + c8) +- Code(Expression(54, Add)) at (prev + 0, 16) to (start + 0, 29) + = (c5 + c6) +- Code(Counter(7)) at (prev + 0, 30) to (start + 2, 6) - Code(Expression(43, Sub)) at (prev + 2, 15) to (start + 0, 28) - = ((((c5 + c6) + c9) + c10) - (c7 + c12)) -- Code(Counter(13)) at (prev + 1, 12) to (start + 0, 25) -- Code(Expression(48, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (c13 - c19) -- Code(Expression(49, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (c13 - (c19 + c20)) -- Code(Expression(54, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c19 + c20) + c21) -- Code(Expression(53, Sub)) at (prev + 2, 9) to (start + 0, 10) - = (c13 - ((c19 + c20) + c21)) -- Code(Counter(13)) at (prev + 1, 9) to (start + 0, 23) -- Code(Expression(56, Sub)) at (prev + 2, 13) to (start + 2, 15) - = ((((c5 + c6) + c9) + c10) - ((c7 + c12) + c13)) -- Code(Expression(76, Add)) at (prev + 5, 9) to (start + 0, 10) - = (c14 + c15) -- Code(Expression(75, Add)) at (prev + 0, 16) to (start + 0, 29) - = (c12 + c13) -- Code(Counter(14)) at (prev + 0, 30) to (start + 2, 6) -- Code(Expression(64, Sub)) at (prev + 2, 15) to (start + 0, 28) - = ((c12 + c13) - c14) -- Code(Counter(15)) at (prev + 1, 12) to (start + 0, 25) -- Code(Expression(66, Sub)) at (prev + 0, 29) to (start + 0, 42) - = (c15 - c16) -- Code(Expression(67, Sub)) at (prev + 0, 46) to (start + 0, 60) - = (c15 - (c16 + c17)) -- Code(Expression(72, Add)) at (prev + 0, 61) to (start + 2, 10) - = ((c16 + c17) + c18) -- Code(Expression(71, Sub)) at (prev + 2, 9) to (start + 0, 10) - = (c15 - ((c16 + c17) + c18)) -- Code(Counter(15)) at (prev + 1, 9) to (start + 0, 23) -- Code(Expression(74, Sub)) at (prev + 2, 9) to (start + 0, 15) - = ((c12 + c13) - (c14 + c15)) + = ((c5 + c6) - c7) +- Code(Counter(8)) at (prev + 1, 12) to (start + 0, 25) +- Code(Expression(45, Sub)) at (prev + 0, 29) to (start + 0, 42) + = (c8 - c14) +- Code(Expression(46, Sub)) at (prev + 0, 46) to (start + 0, 60) + = (c8 - (c14 + c15)) +- Code(Expression(51, Add)) at (prev + 0, 61) to (start + 2, 10) + = ((c14 + c15) + c16) +- Code(Expression(50, Sub)) at (prev + 2, 9) to (start + 0, 10) + = (c8 - ((c14 + c15) + c16)) +- Code(Counter(8)) at (prev + 1, 9) to (start + 0, 23) +- Code(Expression(53, Sub)) at (prev + 2, 13) to (start + 2, 15) + = ((c5 + c6) - (c7 + c8)) +- Code(Expression(70, Add)) at (prev + 5, 9) to (start + 0, 10) + = (c9 + c10) +- Code(Expression(69, Add)) at (prev + 0, 16) to (start + 0, 29) + = (c7 + c8) +- Code(Counter(9)) at (prev + 0, 30) to (start + 2, 6) +- Code(Expression(58, Sub)) at (prev + 2, 15) to (start + 0, 28) + = ((c7 + c8) - c9) +- Code(Counter(10)) at (prev + 1, 12) to (start + 0, 25) +- Code(Expression(60, Sub)) at (prev + 0, 29) to (start + 0, 42) + = (c10 - c11) +- Code(Expression(61, Sub)) at (prev + 0, 46) to (start + 0, 60) + = (c10 - (c11 + c12)) +- Code(Expression(66, Add)) at (prev + 0, 61) to (start + 2, 10) + = ((c11 + c12) + c13) +- Code(Expression(65, Sub)) at (prev + 2, 9) to (start + 0, 10) + = (c10 - ((c11 + c12) + c13)) +- Code(Counter(10)) at (prev + 1, 9) to (start + 0, 23) +- Code(Expression(68, Sub)) at (prev + 2, 9) to (start + 0, 15) + = ((c7 + c8) - (c9 + c10)) - Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2) -Highest counter ID seen: c15 +Highest counter ID seen: c10 diff --git a/tests/coverage/drop_trait.cov-map b/tests/coverage/drop_trait.cov-map index a97c0f8794c..16facf2eddf 100644 --- a/tests/coverage/drop_trait.cov-map +++ b/tests/coverage/drop_trait.cov-map @@ -8,14 +8,14 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: drop_trait::main -Raw bytes (24): 0x[01, 01, 00, 04, 01, 0e, 01, 05, 0c, 05, 06, 09, 01, 16, 00, 02, 06, 04, 0b, 01, 05, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 0e, 01, 05, 0c, 01, 06, 09, 01, 16, 00, 02, 06, 04, 0b, 01, 05, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 14, 1) to (start + 5, 12) -- Code(Counter(1)) at (prev + 6, 9) to (start + 1, 22) +- Code(Counter(0)) at (prev + 6, 9) to (start + 1, 22) - Code(Zero) at (prev + 2, 6) to (start + 4, 11) - Code(Counter(0)) at (prev + 5, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 diff --git a/tests/coverage/fn_sig_into_try.cov-map b/tests/coverage/fn_sig_into_try.cov-map index 374811dba9e..6d6034928c9 100644 --- a/tests/coverage/fn_sig_into_try.cov-map +++ b/tests/coverage/fn_sig_into_try.cov-map @@ -8,44 +8,38 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: fn_sig_into_try::b -Raw bytes (26): 0x[01, 01, 01, 01, 00, 04, 01, 11, 01, 03, 0f, 00, 03, 0f, 00, 10, 02, 01, 05, 00, 0c, 01, 01, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 11, 01, 03, 0f, 00, 03, 0f, 00, 10, 01, 01, 05, 00, 0c, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 1 -- expression 0 operands: lhs = Counter(0), rhs = Zero +Number of expressions: 0 Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 17, 1) to (start + 3, 15) - Code(Zero) at (prev + 3, 15) to (start + 0, 16) -- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 12) - = (c0 - Zero) +- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 12) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) Highest counter ID seen: c0 Function name: fn_sig_into_try::c -Raw bytes (26): 0x[01, 01, 01, 01, 00, 04, 01, 18, 01, 03, 17, 00, 03, 17, 00, 18, 02, 01, 05, 00, 0c, 01, 01, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 18, 01, 03, 17, 00, 03, 17, 00, 18, 01, 01, 05, 00, 0c, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 1 -- expression 0 operands: lhs = Counter(0), rhs = Zero +Number of expressions: 0 Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 24, 1) to (start + 3, 23) - Code(Zero) at (prev + 3, 23) to (start + 0, 24) -- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 12) - = (c0 - Zero) +- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 12) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) Highest counter ID seen: c0 Function name: fn_sig_into_try::d -Raw bytes (26): 0x[01, 01, 01, 01, 00, 04, 01, 1f, 01, 04, 0f, 00, 04, 0f, 00, 10, 02, 01, 05, 00, 0c, 01, 01, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 1f, 01, 04, 0f, 00, 04, 0f, 00, 10, 01, 01, 05, 00, 0c, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 1 -- expression 0 operands: lhs = Counter(0), rhs = Zero +Number of expressions: 0 Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 31, 1) to (start + 4, 15) - Code(Zero) at (prev + 4, 15) to (start + 0, 16) -- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 12) - = (c0 - Zero) +- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 12) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) Highest counter ID seen: c0 diff --git a/tests/coverage/generics.cov-map b/tests/coverage/generics.cov-map index d082bd54493..bc5661afdc1 100644 --- a/tests/coverage/generics.cov-map +++ b/tests/coverage/generics.cov-map @@ -35,14 +35,14 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: generics::main -Raw bytes (24): 0x[01, 01, 00, 04, 01, 16, 01, 08, 0c, 05, 09, 09, 01, 16, 00, 02, 06, 04, 0b, 01, 05, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 16, 01, 08, 0c, 01, 09, 09, 01, 16, 00, 02, 06, 04, 0b, 01, 05, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 22, 1) to (start + 8, 12) -- Code(Counter(1)) at (prev + 9, 9) to (start + 1, 22) +- Code(Counter(0)) at (prev + 9, 9) to (start + 1, 22) - Code(Zero) at (prev + 2, 6) to (start + 4, 11) - Code(Counter(0)) at (prev + 5, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 diff --git a/tests/coverage/inline-dead.cov-map b/tests/coverage/inline-dead.cov-map index 3e2ca2bc992..49cdc514fed 100644 --- a/tests/coverage/inline-dead.cov-map +++ b/tests/coverage/inline-dead.cov-map @@ -32,16 +32,13 @@ Number of file 0 mappings: 2 Highest counter ID seen: c0 Function name: inline_dead::main::{closure#0} -Raw bytes (23): 0x[01, 01, 02, 07, 00, 01, 00, 03, 01, 07, 17, 01, 16, 00, 01, 17, 00, 18, 02, 01, 05, 00, 06] +Raw bytes (19): 0x[01, 01, 00, 03, 01, 07, 17, 01, 16, 00, 01, 17, 00, 18, 01, 01, 05, 00, 06] Number of files: 1 - file 0 => global file 1 -Number of expressions: 2 -- expression 0 operands: lhs = Expression(1, Add), rhs = Zero -- expression 1 operands: lhs = Counter(0), rhs = Zero +Number of expressions: 0 Number of file 0 mappings: 3 - Code(Counter(0)) at (prev + 7, 23) to (start + 1, 22) - Code(Zero) at (prev + 1, 23) to (start + 0, 24) -- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 6) - = ((c0 + Zero) - Zero) +- Code(Counter(0)) at (prev + 1, 5) to (start + 0, 6) Highest counter ID seen: c0 diff --git a/tests/coverage/issue-84561.cov-map b/tests/coverage/issue-84561.cov-map index efb9d43bf5b..c8f75cddcb5 100644 --- a/tests/coverage/issue-84561.cov-map +++ b/tests/coverage/issue-84561.cov-map @@ -59,10 +59,10 @@ Number of file 0 mappings: 1 Highest counter ID seen: c0 Function name: issue_84561::test3 -Raw bytes (317): 0x[01, 01, 1c, 1d, 21, 25, 29, 21, 25, 2d, 31, 21, 17, 25, 2d, 41, 45, 49, 4d, 51, 55, 33, 51, 49, 4d, 33, 37, 49, 4d, 51, 59, 55, 59, 55, 59, 47, 5d, 55, 59, 61, 65, 71, 75, 69, 6d, 69, 6d, 69, 5f, 6d, 00, 67, 79, 71, 75, 79, 7d, 7d, 81, 01, 33, 01, 08, 01, 03, 1c, 05, 04, 09, 01, 1c, 09, 02, 05, 04, 1f, 0d, 05, 05, 00, 1f, 11, 01, 05, 00, 1f, 15, 01, 09, 01, 1c, 19, 02, 05, 00, 1f, 1d, 01, 05, 00, 0f, 02, 00, 20, 00, 30, 21, 01, 05, 03, 0f, 25, 03, 20, 00, 30, 29, 00, 33, 00, 41, 06, 00, 4b, 00, 5a, 0a, 01, 05, 00, 0f, 2d, 05, 09, 03, 10, 31, 05, 0d, 00, 1b, 0e, 02, 0d, 00, 1c, 12, 04, 09, 05, 06, 35, 06, 05, 03, 06, 39, 04, 05, 03, 06, 3d, 04, 09, 04, 06, 41, 05, 08, 00, 0f, 45, 01, 09, 03, 0a, 1a, 05, 09, 03, 0a, 33, 05, 08, 00, 0f, 51, 01, 09, 00, 13, 22, 03, 0d, 00, 1d, 26, 03, 09, 00, 13, 2e, 03, 0d, 00, 1d, 47, 03, 05, 00, 0f, 47, 01, 0c, 00, 13, 5d, 01, 0d, 00, 13, 42, 02, 0d, 00, 13, 61, 04, 05, 02, 13, 65, 03, 0d, 00, 13, 4a, 02, 0d, 00, 13, 67, 03, 05, 00, 0f, 69, 01, 0c, 00, 13, 6d, 01, 0d, 03, 0e, 71, 04, 0d, 00, 13, 56, 02, 0d, 00, 17, 56, 01, 14, 00, 1b, 00, 01, 15, 00, 1b, 5a, 02, 15, 00, 1b, 75, 04, 0d, 00, 13, 62, 03, 09, 00, 19, 79, 02, 05, 00, 0f, 6a, 03, 09, 00, 22, 7d, 02, 05, 00, 0f, 6e, 03, 09, 00, 2c, 81, 01, 02, 01, 00, 02] +Raw bytes (315): 0x[01, 01, 1b, 1d, 21, 25, 29, 21, 25, 2d, 31, 21, 17, 25, 2d, 41, 45, 49, 4d, 51, 55, 33, 51, 49, 4d, 33, 37, 49, 4d, 51, 59, 55, 59, 55, 59, 47, 5d, 55, 59, 61, 65, 71, 75, 69, 6d, 69, 6d, 69, 6d, 63, 79, 71, 75, 79, 7d, 7d, 81, 01, 33, 01, 08, 01, 03, 1c, 05, 04, 09, 01, 1c, 09, 02, 05, 04, 1f, 0d, 05, 05, 00, 1f, 11, 01, 05, 00, 1f, 15, 01, 09, 01, 1c, 19, 02, 05, 00, 1f, 1d, 01, 05, 00, 0f, 02, 00, 20, 00, 30, 21, 01, 05, 03, 0f, 25, 03, 20, 00, 30, 29, 00, 33, 00, 41, 06, 00, 4b, 00, 5a, 0a, 01, 05, 00, 0f, 2d, 05, 09, 03, 10, 31, 05, 0d, 00, 1b, 0e, 02, 0d, 00, 1c, 12, 04, 09, 05, 06, 35, 06, 05, 03, 06, 39, 04, 05, 03, 06, 3d, 04, 09, 04, 06, 41, 05, 08, 00, 0f, 45, 01, 09, 03, 0a, 1a, 05, 09, 03, 0a, 33, 05, 08, 00, 0f, 51, 01, 09, 00, 13, 22, 03, 0d, 00, 1d, 26, 03, 09, 00, 13, 2e, 03, 0d, 00, 1d, 47, 03, 05, 00, 0f, 47, 01, 0c, 00, 13, 5d, 01, 0d, 00, 13, 42, 02, 0d, 00, 13, 61, 04, 05, 02, 13, 65, 03, 0d, 00, 13, 4a, 02, 0d, 00, 13, 63, 03, 05, 00, 0f, 69, 01, 0c, 00, 13, 6d, 01, 0d, 03, 0e, 71, 04, 0d, 00, 13, 5a, 02, 0d, 00, 17, 5a, 01, 14, 00, 1b, 00, 01, 15, 00, 1b, 5a, 02, 15, 00, 1b, 75, 04, 0d, 00, 13, 5e, 03, 09, 00, 19, 79, 02, 05, 00, 0f, 66, 03, 09, 00, 22, 7d, 02, 05, 00, 0f, 6a, 03, 09, 00, 2c, 81, 01, 02, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 28 +Number of expressions: 27 - expression 0 operands: lhs = Counter(7), rhs = Counter(8) - expression 1 operands: lhs = Counter(9), rhs = Counter(10) - expression 2 operands: lhs = Counter(8), rhs = Counter(9) @@ -85,12 +85,11 @@ Number of expressions: 28 - expression 19 operands: lhs = Counter(28), rhs = Counter(29) - expression 20 operands: lhs = Counter(26), rhs = Counter(27) - expression 21 operands: lhs = Counter(26), rhs = Counter(27) -- expression 22 operands: lhs = Counter(26), rhs = Expression(23, Add) -- expression 23 operands: lhs = Counter(27), rhs = Zero -- expression 24 operands: lhs = Expression(25, Add), rhs = Counter(30) -- expression 25 operands: lhs = Counter(28), rhs = Counter(29) -- expression 26 operands: lhs = Counter(30), rhs = Counter(31) -- expression 27 operands: lhs = Counter(31), rhs = Counter(32) +- expression 22 operands: lhs = Counter(26), rhs = Counter(27) +- expression 23 operands: lhs = Expression(24, Add), rhs = Counter(30) +- expression 24 operands: lhs = Counter(28), rhs = Counter(29) +- expression 25 operands: lhs = Counter(30), rhs = Counter(31) +- expression 26 operands: lhs = Counter(31), rhs = Counter(32) Number of file 0 mappings: 51 - Code(Counter(0)) at (prev + 8, 1) to (start + 3, 28) - Code(Counter(1)) at (prev + 4, 9) to (start + 1, 28) @@ -142,26 +141,26 @@ Number of file 0 mappings: 51 - Code(Counter(25)) at (prev + 3, 13) to (start + 0, 19) - Code(Expression(18, Sub)) at (prev + 2, 13) to (start + 0, 19) = (c24 - c25) -- Code(Expression(25, Add)) at (prev + 3, 5) to (start + 0, 15) +- Code(Expression(24, Add)) at (prev + 3, 5) to (start + 0, 15) = (c28 + c29) - Code(Counter(26)) at (prev + 1, 12) to (start + 0, 19) - Code(Counter(27)) at (prev + 1, 13) to (start + 3, 14) - Code(Counter(28)) at (prev + 4, 13) to (start + 0, 19) -- Code(Expression(21, Sub)) at (prev + 2, 13) to (start + 0, 23) +- Code(Expression(22, Sub)) at (prev + 2, 13) to (start + 0, 23) = (c26 - c27) -- Code(Expression(21, Sub)) at (prev + 1, 20) to (start + 0, 27) +- Code(Expression(22, Sub)) at (prev + 1, 20) to (start + 0, 27) = (c26 - c27) - Code(Zero) at (prev + 1, 21) to (start + 0, 27) - Code(Expression(22, Sub)) at (prev + 2, 21) to (start + 0, 27) - = (c26 - (c27 + Zero)) + = (c26 - c27) - Code(Counter(29)) at (prev + 4, 13) to (start + 0, 19) -- Code(Expression(24, Sub)) at (prev + 3, 9) to (start + 0, 25) +- Code(Expression(23, Sub)) at (prev + 3, 9) to (start + 0, 25) = ((c28 + c29) - c30) - Code(Counter(30)) at (prev + 2, 5) to (start + 0, 15) -- Code(Expression(26, Sub)) at (prev + 3, 9) to (start + 0, 34) +- Code(Expression(25, Sub)) at (prev + 3, 9) to (start + 0, 34) = (c30 - c31) - Code(Counter(31)) at (prev + 2, 5) to (start + 0, 15) -- Code(Expression(27, Sub)) at (prev + 3, 9) to (start + 0, 44) +- Code(Expression(26, Sub)) at (prev + 3, 9) to (start + 0, 44) = (c31 - c32) - Code(Counter(32)) at (prev + 2, 1) to (start + 0, 2) Highest counter ID seen: c32 diff --git a/tests/coverage/loops_branches.cov-map b/tests/coverage/loops_branches.cov-map index 912141b6d5f..2cb0f948b3e 100644 --- a/tests/coverage/loops_branches.cov-map +++ b/tests/coverage/loops_branches.cov-map @@ -1,85 +1,70 @@ Function name: <loops_branches::DebugTest as core::fmt::Debug>::fmt -Raw bytes (116): 0x[01, 01, 06, 05, 00, 1d, 00, 0f, 13, 01, 19, 11, 15, 15, 19, 14, 01, 09, 05, 01, 10, 05, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 02, 01, 0d, 00, 0e, 05, 01, 0d, 00, 1e, 11, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, 19, 03, 0d, 00, 0e, 15, 00, 12, 00, 17, 19, 01, 10, 00, 14, 1d, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 06, 01, 11, 00, 12, 1d, 01, 11, 00, 22, 0a, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 16, 03, 09, 00, 0f, 01, 01, 05, 00, 06] +Raw bytes (112): 0x[01, 01, 04, 07, 0b, 01, 0d, 05, 09, 09, 0d, 14, 01, 09, 05, 01, 10, 01, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 01, 01, 0d, 00, 0e, 01, 01, 0d, 00, 1e, 05, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, 0d, 03, 0d, 00, 0e, 09, 00, 12, 00, 17, 0d, 01, 10, 00, 14, 0d, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 0d, 01, 11, 00, 12, 0d, 01, 11, 00, 22, 02, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 0e, 03, 09, 00, 0f, 01, 01, 05, 00, 06] Number of files: 1 - file 0 => global file 1 -Number of expressions: 6 -- expression 0 operands: lhs = Counter(1), rhs = Zero -- expression 1 operands: lhs = Counter(7), rhs = Zero -- expression 2 operands: lhs = Expression(3, Add), rhs = Expression(4, Add) -- expression 3 operands: lhs = Counter(0), rhs = Counter(6) -- expression 4 operands: lhs = Counter(4), rhs = Counter(5) -- expression 5 operands: lhs = Counter(5), rhs = Counter(6) +Number of expressions: 4 +- expression 0 operands: lhs = Expression(1, Add), rhs = Expression(2, Add) +- expression 1 operands: lhs = Counter(0), rhs = Counter(3) +- expression 2 operands: lhs = Counter(1), rhs = Counter(2) +- expression 3 operands: lhs = Counter(2), rhs = Counter(3) Number of file 0 mappings: 20 - Code(Counter(0)) at (prev + 9, 5) to (start + 1, 16) -- Code(Counter(1)) at (prev + 2, 16) to (start + 0, 21) +- Code(Counter(0)) at (prev + 2, 16) to (start + 0, 21) - Code(Zero) at (prev + 1, 23) to (start + 0, 27) - Code(Zero) at (prev + 0, 28) to (start + 0, 30) -- Code(Expression(0, Sub)) at (prev + 1, 13) to (start + 0, 14) - = (c1 - Zero) -- Code(Counter(1)) at (prev + 1, 13) to (start + 0, 30) -- Code(Counter(4)) at (prev + 0, 30) to (start + 0, 31) +- Code(Counter(0)) at (prev + 1, 13) to (start + 0, 14) +- Code(Counter(0)) at (prev + 1, 13) to (start + 0, 30) +- Code(Counter(1)) at (prev + 0, 30) to (start + 0, 31) - Code(Zero) at (prev + 1, 16) to (start + 1, 10) -- Code(Counter(6)) at (prev + 3, 13) to (start + 0, 14) -- Code(Counter(5)) at (prev + 0, 18) to (start + 0, 23) -- Code(Counter(6)) at (prev + 1, 16) to (start + 0, 20) -- Code(Counter(7)) at (prev + 1, 20) to (start + 0, 25) +- Code(Counter(3)) at (prev + 3, 13) to (start + 0, 14) +- Code(Counter(2)) at (prev + 0, 18) to (start + 0, 23) +- Code(Counter(3)) at (prev + 1, 16) to (start + 0, 20) +- Code(Counter(3)) at (prev + 1, 20) to (start + 0, 25) - Code(Zero) at (prev + 1, 27) to (start + 0, 31) - Code(Zero) at (prev + 0, 32) to (start + 0, 34) -- Code(Expression(1, Sub)) at (prev + 1, 17) to (start + 0, 18) - = (c7 - Zero) -- Code(Counter(7)) at (prev + 1, 17) to (start + 0, 34) -- Code(Expression(2, Sub)) at (prev + 0, 34) to (start + 0, 35) - = ((c0 + c6) - (c4 + c5)) +- Code(Counter(3)) at (prev + 1, 17) to (start + 0, 18) +- Code(Counter(3)) at (prev + 1, 17) to (start + 0, 34) +- Code(Expression(0, Sub)) at (prev + 0, 34) to (start + 0, 35) + = ((c0 + c3) - (c1 + c2)) - Code(Zero) at (prev + 1, 20) to (start + 1, 14) -- Code(Expression(5, Sub)) at (prev + 3, 9) to (start + 0, 15) - = (c5 - c6) +- Code(Expression(3, Sub)) at (prev + 3, 9) to (start + 0, 15) + = (c2 - c3) - Code(Counter(0)) at (prev + 1, 5) to (start + 0, 6) -Highest counter ID seen: c7 +Highest counter ID seen: c3 Function name: <loops_branches::DisplayTest as core::fmt::Display>::fmt -Raw bytes (122): 0x[01, 01, 09, 01, 00, 01, 00, 0d, 00, 0d, 00, 0d, 00, 1b, 1f, 01, 0d, 09, 1d, 09, 0d, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 02, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 06, 01, 0d, 00, 0e, 02, 01, 0d, 00, 1e, 1d, 00, 1e, 00, 1f, 0d, 02, 0d, 00, 0e, 09, 00, 12, 00, 17, 0d, 01, 10, 00, 15, 00, 00, 16, 01, 0e, 12, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 0e, 01, 11, 00, 12, 12, 01, 11, 00, 22, 16, 00, 22, 00, 23, 22, 03, 09, 00, 0f, 01, 01, 05, 00, 06] +Raw bytes (112): 0x[01, 01, 04, 07, 0b, 01, 09, 05, 0d, 05, 09, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 01, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 01, 01, 0d, 00, 0e, 01, 01, 0d, 00, 1e, 0d, 00, 1e, 00, 1f, 09, 02, 0d, 00, 0e, 05, 00, 12, 00, 17, 09, 01, 10, 00, 15, 00, 00, 16, 01, 0e, 09, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, 09, 01, 11, 00, 12, 09, 01, 11, 00, 22, 02, 00, 22, 00, 23, 0e, 03, 09, 00, 0f, 01, 01, 05, 00, 06] Number of files: 1 - file 0 => global file 1 -Number of expressions: 9 -- expression 0 operands: lhs = Counter(0), rhs = Zero -- expression 1 operands: lhs = Counter(0), rhs = Zero -- expression 2 operands: lhs = Counter(3), rhs = Zero -- expression 3 operands: lhs = Counter(3), rhs = Zero -- expression 4 operands: lhs = Counter(3), rhs = Zero -- expression 5 operands: lhs = Expression(6, Add), rhs = Expression(7, Add) -- expression 6 operands: lhs = Counter(0), rhs = Counter(3) -- expression 7 operands: lhs = Counter(2), rhs = Counter(7) -- expression 8 operands: lhs = Counter(2), rhs = Counter(3) +Number of expressions: 4 +- expression 0 operands: lhs = Expression(1, Add), rhs = Expression(2, Add) +- expression 1 operands: lhs = Counter(0), rhs = Counter(2) +- expression 2 operands: lhs = Counter(1), rhs = Counter(3) +- expression 3 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 20 - Code(Counter(0)) at (prev + 34, 5) to (start + 1, 17) - Code(Zero) at (prev + 1, 18) to (start + 1, 10) -- Code(Expression(0, Sub)) at (prev + 2, 16) to (start + 0, 21) - = (c0 - Zero) +- Code(Counter(0)) at (prev + 2, 16) to (start + 0, 21) - Code(Zero) at (prev + 1, 23) to (start + 0, 27) - Code(Zero) at (prev + 0, 28) to (start + 0, 30) -- Code(Expression(1, Sub)) at (prev + 1, 13) to (start + 0, 14) - = (c0 - Zero) -- Code(Expression(0, Sub)) at (prev + 1, 13) to (start + 0, 30) - = (c0 - Zero) -- Code(Counter(7)) at (prev + 0, 30) to (start + 0, 31) -- Code(Counter(3)) at (prev + 2, 13) to (start + 0, 14) -- Code(Counter(2)) at (prev + 0, 18) to (start + 0, 23) -- Code(Counter(3)) at (prev + 1, 16) to (start + 0, 21) +- Code(Counter(0)) at (prev + 1, 13) to (start + 0, 14) +- Code(Counter(0)) at (prev + 1, 13) to (start + 0, 30) +- Code(Counter(3)) at (prev + 0, 30) to (start + 0, 31) +- Code(Counter(2)) at (prev + 2, 13) to (start + 0, 14) +- Code(Counter(1)) at (prev + 0, 18) to (start + 0, 23) +- Code(Counter(2)) at (prev + 1, 16) to (start + 0, 21) - Code(Zero) at (prev + 0, 22) to (start + 1, 14) -- Code(Expression(4, Sub)) at (prev + 2, 20) to (start + 0, 25) - = (c3 - Zero) +- Code(Counter(2)) at (prev + 2, 20) to (start + 0, 25) - Code(Zero) at (prev + 1, 27) to (start + 0, 31) - Code(Zero) at (prev + 0, 32) to (start + 0, 34) -- Code(Expression(3, Sub)) at (prev + 1, 17) to (start + 0, 18) - = (c3 - Zero) -- Code(Expression(4, Sub)) at (prev + 1, 17) to (start + 0, 34) - = (c3 - Zero) -- Code(Expression(5, Sub)) at (prev + 0, 34) to (start + 0, 35) - = ((c0 + c3) - (c2 + c7)) -- Code(Expression(8, Sub)) at (prev + 3, 9) to (start + 0, 15) - = (c2 - c3) +- Code(Counter(2)) at (prev + 1, 17) to (start + 0, 18) +- Code(Counter(2)) at (prev + 1, 17) to (start + 0, 34) +- Code(Expression(0, Sub)) at (prev + 0, 34) to (start + 0, 35) + = ((c0 + c2) - (c1 + c3)) +- Code(Expression(3, Sub)) at (prev + 3, 9) to (start + 0, 15) + = (c1 - c2) - Code(Counter(0)) at (prev + 1, 5) to (start + 0, 6) -Highest counter ID seen: c7 +Highest counter ID seen: c3 Function name: loops_branches::main Raw bytes (9): 0x[01, 01, 00, 01, 01, 37, 01, 05, 02] diff --git a/tests/coverage/no_spans_if_not.cov-map b/tests/coverage/no_spans_if_not.cov-map index 9cb7e6a6cff..6c389a24317 100644 --- a/tests/coverage/no_spans_if_not.cov-map +++ b/tests/coverage/no_spans_if_not.cov-map @@ -1,13 +1,11 @@ Function name: no_spans_if_not::affected_function -Raw bytes (21): 0x[01, 01, 01, 01, 00, 03, 01, 16, 1c, 01, 12, 02, 02, 0d, 00, 0f, 00, 02, 0d, 00, 0f] +Raw bytes (19): 0x[01, 01, 00, 03, 01, 16, 1c, 01, 12, 01, 02, 0d, 00, 0f, 00, 02, 0d, 00, 0f] Number of files: 1 - file 0 => global file 1 -Number of expressions: 1 -- expression 0 operands: lhs = Counter(0), rhs = Zero +Number of expressions: 0 Number of file 0 mappings: 3 - Code(Counter(0)) at (prev + 22, 28) to (start + 1, 18) -- Code(Expression(0, Sub)) at (prev + 2, 13) to (start + 0, 15) - = (c0 - Zero) +- Code(Counter(0)) at (prev + 2, 13) to (start + 0, 15) - Code(Zero) at (prev + 2, 13) to (start + 0, 15) Highest counter ID seen: c0 diff --git a/tests/coverage/tight_inf_loop.cov-map b/tests/coverage/tight_inf_loop.cov-map index 2d2d59bf013..77a8ffb8358 100644 --- a/tests/coverage/tight_inf_loop.cov-map +++ b/tests/coverage/tight_inf_loop.cov-map @@ -1,13 +1,11 @@ Function name: tight_inf_loop::main -Raw bytes (21): 0x[01, 01, 01, 01, 00, 03, 01, 01, 01, 01, 0d, 00, 02, 09, 00, 10, 02, 01, 06, 01, 02] +Raw bytes (19): 0x[01, 01, 00, 03, 01, 01, 01, 01, 0d, 00, 02, 09, 00, 10, 01, 01, 06, 01, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 1 -- expression 0 operands: lhs = Counter(0), rhs = Zero +Number of expressions: 0 Number of file 0 mappings: 3 - Code(Counter(0)) at (prev + 1, 1) to (start + 1, 13) - Code(Zero) at (prev + 2, 9) to (start + 0, 16) -- Code(Expression(0, Sub)) at (prev + 1, 6) to (start + 1, 2) - = (c0 - Zero) +- Code(Counter(0)) at (prev + 1, 6) to (start + 1, 2) Highest counter ID seen: c0 diff --git a/tests/coverage/try_error_result.cov-map b/tests/coverage/try_error_result.cov-map index 03012f744c1..35b2c36a575 100644 --- a/tests/coverage/try_error_result.cov-map +++ b/tests/coverage/try_error_result.cov-map @@ -55,27 +55,31 @@ Number of file 0 mappings: 4 Highest counter ID seen: c1 Function name: try_error_result::test1 -Raw bytes (63): 0x[01, 01, 02, 09, 0d, 05, 09, 0b, 01, 0d, 01, 02, 17, 05, 07, 09, 00, 0e, 09, 02, 09, 04, 1a, 0d, 06, 0d, 00, 29, 11, 00, 29, 00, 2a, 00, 01, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 02, 04, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 06, 03, 05, 00, 0b, 01, 01, 01, 00, 02] +Raw bytes (67): 0x[01, 01, 04, 07, 05, 01, 09, 05, 01, 05, 09, 0b, 01, 0d, 01, 02, 17, 05, 07, 09, 00, 0e, 09, 02, 09, 04, 1a, 02, 06, 0d, 00, 29, 02, 00, 29, 00, 2a, 00, 01, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0a, 04, 0d, 00, 2a, 00, 00, 2a, 00, 2b, 0e, 03, 05, 00, 0b, 01, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 2 -- expression 0 operands: lhs = Counter(2), rhs = Counter(3) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +Number of expressions: 4 +- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(1) +- expression 1 operands: lhs = Counter(0), rhs = Counter(2) +- expression 2 operands: lhs = Counter(1), rhs = Counter(0) +- expression 3 operands: lhs = Counter(1), rhs = Counter(2) Number of file 0 mappings: 11 - Code(Counter(0)) at (prev + 13, 1) to (start + 2, 23) - Code(Counter(1)) at (prev + 7, 9) to (start + 0, 14) - Code(Counter(2)) at (prev + 2, 9) to (start + 4, 26) -- Code(Counter(3)) at (prev + 6, 13) to (start + 0, 41) -- Code(Counter(4)) at (prev + 0, 41) to (start + 0, 42) +- Code(Expression(0, Sub)) at (prev + 6, 13) to (start + 0, 41) + = ((c0 + c2) - c1) +- Code(Expression(0, Sub)) at (prev + 0, 41) to (start + 0, 42) + = ((c0 + c2) - c1) - Code(Zero) at (prev + 1, 13) to (start + 0, 42) - Code(Zero) at (prev + 0, 42) to (start + 0, 43) -- Code(Expression(0, Sub)) at (prev + 4, 13) to (start + 0, 42) - = (c2 - c3) +- Code(Expression(2, Sub)) at (prev + 4, 13) to (start + 0, 42) + = (c1 - c0) - Code(Zero) at (prev + 0, 42) to (start + 0, 43) -- Code(Expression(1, Sub)) at (prev + 3, 5) to (start + 0, 11) +- Code(Expression(3, Sub)) at (prev + 3, 5) to (start + 0, 11) = (c1 - c2) - Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2) -Highest counter ID seen: c4 +Highest counter ID seen: c2 Function name: try_error_result::test2 Raw bytes (336): 0x[01, 01, 36, 0d, 11, 0d, 3f, 11, 15, 0d, 37, 3b, 1d, 3f, 19, 11, 15, 0d, 3f, 11, 15, 0d, 3b, 3f, 19, 11, 15, 0d, 37, 3b, 1d, 3f, 19, 11, 15, 41, 53, 21, 25, 41, 21, 41, 53, 21, 25, 09, 73, 77, 2d, 0d, 29, 09, 0d, 09, 77, 0d, 29, 09, 73, 77, 2d, 0d, 29, 45, 8b, 01, 31, 35, 45, 31, 45, 8b, 01, 31, 35, 49, 9f, 01, 39, 3d, 49, 39, 49, 9f, 01, 39, 3d, 05, 09, ab, 01, 09, af, 01, 3d, b3, 01, 39, b7, 01, 35, bb, 01, 31, bf, 01, 2d, c3, 01, 29, c7, 01, 25, cb, 01, 21, cf, 01, 1d, d3, 01, 19, d7, 01, 15, 05, 11, 28, 01, 3d, 01, 03, 17, 05, 08, 09, 00, 0e, 09, 02, 09, 04, 1a, 0d, 06, 0d, 00, 2f, 11, 00, 2f, 00, 30, 02, 00, 31, 03, 35, 15, 04, 11, 00, 12, 1e, 02, 11, 04, 12, 32, 05, 11, 00, 14, 1e, 00, 17, 00, 41, 19, 00, 41, 00, 42, 26, 00, 43, 00, 5f, 1d, 00, 5f, 00, 60, 32, 01, 0d, 00, 20, 4e, 01, 11, 00, 14, 41, 00, 17, 00, 41, 21, 00, 41, 00, 42, 4a, 00, 43, 00, 60, 25, 00, 60, 00, 61, 4e, 01, 0d, 00, 20, 6e, 04, 11, 00, 14, 62, 00, 17, 00, 42, 29, 00, 42, 00, 43, 66, 00, 44, 00, 61, 2d, 00, 61, 00, 62, 6e, 01, 0d, 00, 20, 86, 01, 01, 11, 00, 14, 45, 00, 17, 01, 36, 31, 01, 36, 00, 37, 82, 01, 01, 12, 00, 2f, 35, 00, 2f, 00, 30, 86, 01, 01, 0d, 00, 20, 9a, 01, 01, 11, 00, 14, 49, 00, 17, 01, 36, 39, 02, 11, 00, 12, 96, 01, 01, 12, 00, 2f, 3d, 01, 11, 00, 12, 9a, 01, 02, 0d, 00, 20, a2, 01, 03, 05, 00, 0b, a6, 01, 01, 01, 00, 02] diff --git a/tests/coverage/while.cov-map b/tests/coverage/while.cov-map index d42aa8a7b84..5a6698128cb 100644 --- a/tests/coverage/while.cov-map +++ b/tests/coverage/while.cov-map @@ -1,12 +1,12 @@ Function name: while::main -Raw bytes (24): 0x[01, 01, 00, 04, 01, 01, 01, 01, 10, 05, 02, 0b, 00, 14, 00, 00, 15, 02, 06, 01, 03, 01, 00, 02] +Raw bytes (24): 0x[01, 01, 00, 04, 01, 01, 01, 01, 10, 01, 02, 0b, 00, 14, 00, 00, 15, 02, 06, 01, 03, 01, 00, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 1, 1) to (start + 1, 16) -- Code(Counter(1)) at (prev + 2, 11) to (start + 0, 20) +- Code(Counter(0)) at (prev + 2, 11) to (start + 0, 20) - Code(Zero) at (prev + 0, 21) to (start + 2, 6) - Code(Counter(0)) at (prev + 3, 1) to (start + 0, 2) -Highest counter ID seen: c1 +Highest counter ID seen: c0 diff --git a/tests/crashes/103899.rs b/tests/crashes/103899.rs deleted file mode 100644 index 39c2d72bd35..00000000000 --- a/tests/crashes/103899.rs +++ /dev/null @@ -1,27 +0,0 @@ -//@ known-bug: #103899 - -trait BaseWithAssoc { - type Assoc; -} - -trait WrapperWithAssoc { - type BaseAssoc: BaseWithAssoc; -} - -struct Wrapper<B> { - inner: B, -} - -struct ProjectToBase<T: BaseWithAssoc> { - data_type_h: T::Assoc, -} - -struct DoubleProject<L: WrapperWithAssoc> { - buffer: Wrapper<ProjectToBase<L::BaseAssoc>>, -} - -fn trigger<L: WrapperWithAssoc<BaseAssoc = ()>>() -> DoubleProject<L> { - loop {} -} - -fn main() {} diff --git a/tests/crashes/105299.rs b/tests/crashes/105299.rs deleted file mode 100644 index 8e3aafa47bc..00000000000 --- a/tests/crashes/105299.rs +++ /dev/null @@ -1,19 +0,0 @@ -//@ known-bug: #105299 - -pub trait Foo: Clone {} - -pub struct Bar<'a, T: Clone> { - pub cow: std::borrow::Cow<'a, [T]>, - - pub THIS_CAUSES_ICE: (), // #1 -} - -impl<T> Bar<'_, T> -where - T: Clone, - [T]: Foo, -{ - pub fn MOVES_SELF(self) {} // #2 -} - -pub fn main() {} diff --git a/tests/crashes/125810.rs b/tests/crashes/125810.rs deleted file mode 100644 index 4a152da8ddf..00000000000 --- a/tests/crashes/125810.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ known-bug: rust-lang/rust#125810 -#![feature(arbitrary_self_types, dispatch_from_dyn)] - -use std::ops::{Deref, DispatchFromDyn}; - -trait Trait<T: Deref<Target = Self> + DispatchFromDyn<T>> { - fn MONO_BUF(self: T) -> dyn Trait<T>; -} - -fn main() {} diff --git a/tests/crashes/131102.rs b/tests/crashes/131102.rs deleted file mode 100644 index 12b35f8d1b2..00000000000 --- a/tests/crashes/131102.rs +++ /dev/null @@ -1,4 +0,0 @@ -//@ known-bug: #131102 -pub struct Blorb<const N: u16>([String; N]); -pub struct Wrap(Blorb<0>); -pub const fn i(_: Wrap) {} diff --git a/tests/crashes/131886.rs b/tests/crashes/131886.rs index c31c2d6aa8b..2c692dfb777 100644 --- a/tests/crashes/131886.rs +++ b/tests/crashes/131886.rs @@ -1,6 +1,6 @@ //@ known-bug: #131886 //@ compile-flags: -Zvalidate-mir --crate-type=lib -#![feature(trait_upcasting, type_alias_impl_trait)] +#![feature(type_alias_impl_trait)] type Tait = impl Sized; diff --git a/tests/crashes/132391.rs b/tests/crashes/132391.rs deleted file mode 100644 index 6c8c2c3a878..00000000000 --- a/tests/crashes/132391.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ known-bug: #123291 - -trait MyTrait { - #[repr(align)] - fn myfun(); -} - -pub fn main() {} diff --git a/tests/crashes/132981.rs b/tests/crashes/132981.rs index 8ff4fa36fd0..916c1559240 100644 --- a/tests/crashes/132981.rs +++ b/tests/crashes/132981.rs @@ -2,6 +2,10 @@ //@compile-flags: -Clink-dead-code=true --crate-type lib //@ only-x86_64 //@ ignore-windows +// The set of targets this crashes on is really fiddly, because it is deep in our ABI logic. It +// crashes on x86_64-unknown-linux-gnu, and i686-pc-windows-msvc, but not on +// x86_64-pc-windows-msvc. If you are trying to fix this crash, don't pay too much attention to the +// directives. #![feature(rust_cold_cc)] pub extern "rust-cold" fn foo(_: [usize; 3]) {} diff --git a/tests/crashes/134336.rs b/tests/crashes/134336.rs deleted file mode 100644 index 14b88e14f04..00000000000 --- a/tests/crashes/134336.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ known-bug: #134336 -#![expect(incomplete_features)] -#![feature(explicit_tail_calls)] - -trait Tr { - fn f(); -} - -fn g<T: Tr>() { - become T::f(); -} diff --git a/tests/crashes/134355.rs b/tests/crashes/134355.rs deleted file mode 100644 index b662341e6b1..00000000000 --- a/tests/crashes/134355.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ known-bug: #134355 - -//@compile-flags: --crate-type=lib -fn digit() -> str { - return { i32::MIN }; -} diff --git a/tests/crashes/134905.rs b/tests/crashes/134905.rs deleted file mode 100644 index 9f0f0f4b3f2..00000000000 --- a/tests/crashes/134905.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ known-bug: #134905 - -trait Iterate<'a> { - type Ty: Valid; -} -impl<'a, T> Iterate<'a> for T -where - T: Check, -{ - default type Ty = (); -} - -trait Check {} -impl<'a, T> Eq for T where <T as Iterate<'a>>::Ty: Valid {} - -trait Valid {} diff --git a/tests/crashes/135124.rs b/tests/crashes/135124.rs deleted file mode 100644 index d6655cb46fa..00000000000 --- a/tests/crashes/135124.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ known-bug: #135124 -trait A { - fn y(&self) - { - fn call() -> impl Sized {} - self.fold(call()); - } - fn fold(&self, &self._) {} -} diff --git a/tests/crashes/135210.rs b/tests/crashes/135210.rs deleted file mode 100644 index acb61e21090..00000000000 --- a/tests/crashes/135210.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ known-bug: #135210 - -#![feature(const_trait_impl)] -const _: fn(&String) = |s| { - &*s as &str; -}; - -fn main() {} diff --git a/tests/crashes/135470.rs b/tests/crashes/135470.rs new file mode 100644 index 00000000000..7d357a9317f --- /dev/null +++ b/tests/crashes/135470.rs @@ -0,0 +1,40 @@ +//@ known-bug: #135470 +//@ compile-flags: --edition=2021 -Copt-level=0 + +use std::future::Future; +trait Access { + type Lister; + + fn list() -> impl Future<Output = Self::Lister> { + async { todo!() } + } +} + +trait Foo {} +impl Access for dyn Foo { + type Lister = (); +} + +fn main() { + let svc = async { + async { <dyn Foo>::list() }.await; + }; + &svc as &dyn Service; +} + +trait UnaryService { + fn call2() {} +} +trait Unimplemented {} +impl<T: Unimplemented> UnaryService for T {} +struct Wrap<T>(T); +impl<T: Send> UnaryService for Wrap<T> {} + +trait Service { + fn call(&self); +} +impl<T: Send> Service for T { + fn call(&self) { + Wrap::<T>::call2(); + } +} diff --git a/tests/crashes/135528.rs b/tests/crashes/135528.rs new file mode 100644 index 00000000000..a1418f40be6 --- /dev/null +++ b/tests/crashes/135528.rs @@ -0,0 +1,18 @@ +//@ known-bug: #135528 +//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes +#![feature(type_alias_impl_trait)] +type Tait = impl Copy; + +fn set(x: &isize) -> isize { + *x +} + +fn d(x: Tait) { + set(x); +} + +fn other_define() -> Tait { + () +} + +fn main() {} diff --git a/tests/crashes/135570.rs b/tests/crashes/135570.rs new file mode 100644 index 00000000000..a9eda97ef9d --- /dev/null +++ b/tests/crashes/135570.rs @@ -0,0 +1,12 @@ +//@ known-bug: #135570 +//@compile-flags: -Zvalidate-mir -Zmir-enable-passes=+Inline -Copt-level=0 -Zmir-enable-passes=+GVN +//@ only-x86_64 + +fn function_with_bytes<const BYTES: &'static [u8; 0xc7b889180b67b07d_bc1a3c88783d35b5_u128]>( +) -> &'static [u8] { + BYTES +} + +fn main() { + function_with_bytes::<b"aa">() == &[]; +} diff --git a/tests/crashes/135617.rs b/tests/crashes/135617.rs new file mode 100644 index 00000000000..ac524b823a0 --- /dev/null +++ b/tests/crashes/135617.rs @@ -0,0 +1,13 @@ +//@ known-bug: #135617 +trait Project { + const ASSOC: usize; +} + +fn foo() +where + for<'a> (): Project, +{ + [(); <() as Project>::ASSOC]; +} + +pub fn main() {} diff --git a/tests/crashes/135646.rs b/tests/crashes/135646.rs new file mode 100644 index 00000000000..67b0ad93db4 --- /dev/null +++ b/tests/crashes/135646.rs @@ -0,0 +1,5 @@ +//@ known-bug: #135646 +//@ compile-flags: --edition=2024 -Zpolonius=next +fn main() { + &{ [1, 2, 3][4] }; +} diff --git a/tests/crashes/135668.rs b/tests/crashes/135668.rs new file mode 100644 index 00000000000..8126a65606b --- /dev/null +++ b/tests/crashes/135668.rs @@ -0,0 +1,38 @@ +//@ known-bug: #135668 +//@ compile-flags: --edition=2021 +use std::future::Future; + +pub async fn foo() { + let _ = create_task().await; +} + +async fn create_task() -> impl Sized { + bind(documentation) +} + +async fn documentation() { + include_str!("nonexistent"); +} + +fn bind<F>(_filter: F) -> impl Sized +where + F: FilterBase, +{ + || -> <F as FilterBase>::Assoc { panic!() } +} + +trait FilterBase { + type Assoc; +} + +impl<F, R> FilterBase for F +where + F: Fn() -> R, + // Removing the below line makes it correctly error on both stable and beta + R: Future, + // Removing the below line makes it ICE on both stable and beta + R: Send, + // Removing the above two bounds makes it ICE on stable but correctly error on beta +{ + type Assoc = F; +} diff --git a/tests/crashes/135718.rs b/tests/crashes/135718.rs new file mode 100644 index 00000000000..c0e628f4c46 --- /dev/null +++ b/tests/crashes/135718.rs @@ -0,0 +1,50 @@ +//@ known-bug: #135718 + +struct Equal; + +struct Bar; + +trait TwiceNested {} +impl<M> TwiceNested for Bar where Bar: NestMakeEqual<NestEq = M> {} + +struct Sum; + +trait Not { + fn not(); +} + +impl<P> Not for Sum +where + Bar: NestMakeEqual<NestEq = P>, + Self: Problem<P>, +{ + fn not() {} +} + +trait NestMakeEqual { + type NestEq; +} + +trait MakeEqual { + type Eq; +} + +struct Foo; +impl MakeEqual for Foo { + type Eq = Equal; +} + +impl<O> NestMakeEqual for Bar +where + Foo: MakeEqual<Eq = O>, +{ + type NestEq = O; +} + +trait Problem<M> {} +impl Problem<()> for Sum where Bar: TwiceNested {} +impl Problem<Equal> for Sum where Bar: TwiceNested {} + +fn main() { + Sum::not(); +} diff --git a/tests/crashes/135720.rs b/tests/crashes/135720.rs new file mode 100644 index 00000000000..ee85bc4b66a --- /dev/null +++ b/tests/crashes/135720.rs @@ -0,0 +1,4 @@ +//@ known-bug: #135720 +#![feature(generic_const_exprs)] +type S<'l> = [i32; A]; +fn lint_me(x: S<()>) {} diff --git a/tests/crashes/135845.rs b/tests/crashes/135845.rs new file mode 100644 index 00000000000..ed038d8a1f1 --- /dev/null +++ b/tests/crashes/135845.rs @@ -0,0 +1,6 @@ +//@ known-bug: #135845 +struct S<'a, T: ?Sized>(&'a T); + +fn b<'a>() -> S<'static, _> { + S::<'a>(&0) +} diff --git a/tests/crashes/135863.rs b/tests/crashes/135863.rs new file mode 100644 index 00000000000..a0ff5988a0d --- /dev/null +++ b/tests/crashes/135863.rs @@ -0,0 +1,10 @@ +//@ known-bug: #135863 +struct A; + +impl A { + fn len(self: &&B) {} +} + +fn main() { + A.len() +} diff --git a/tests/crashes/136063.rs b/tests/crashes/136063.rs new file mode 100644 index 00000000000..078cc59dfa2 --- /dev/null +++ b/tests/crashes/136063.rs @@ -0,0 +1,6 @@ +//@ known-bug: #136063 +#![feature(generic_const_exprs)] +trait A<const B: u8 = X> {} +impl A<1> for bool {} +fn bar(arg : &dyn A<x>) { bar(true) } +pub fn main() {} diff --git a/tests/crashes/90110.rs b/tests/crashes/90110.rs deleted file mode 100644 index a27a1f42b7a..00000000000 --- a/tests/crashes/90110.rs +++ /dev/null @@ -1,57 +0,0 @@ -//@ known-bug: #90110 - -use std::fs::File; -use std::io::{BufReader, BufRead}; -use std::str::Split; -use std::path::Path; - -pub trait Parser<D> -where dyn Parser<D>: Sized -{ - fn new(split_header: Split<&str>) -> Self where Self: Sized; - fn parse_line(&self, split_line: &Split<&str>) -> D; -} - - -pub struct CsvReader<D> { - parser: Box<dyn Parser<D>>, - - reader: BufReader<File>, - buf: String, // Buffer we will read into. Avoids re-allocation on each line. - path: String, // Record this so we can return more informative error messages. - line: usize, // Same motivation for this. -} - -impl<D> CsvReader<D> -where dyn Parser<D>: Sized -{ - fn new<F>(path: &str, make_parser: F) -> CsvReader<D> - where F: Fn(Split<char>) -> dyn Parser<D> { - let file = match File::open(Path::new(path)) { - Err(err) => panic!("Couldn't read {}: {}", path, err), - Ok(file) => file, - }; - - let mut reader = BufReader::new(file); - - let mut buf = String::new(); - - let parser = Box::new(match reader.read_line(&mut buf) { - Err(err) => panic!("Failed to read the header line from {}: {}", path, err), - Ok(_) => { - let split_header = buf.split(','); - make_parser(split_header) - }, - }); - - CsvReader { - parser: parser, - reader, - buf, - path: path.to_string(), - line: 2, - } - } -} - -pub fn main() {} diff --git a/tests/incremental/feature_gate.rs b/tests/incremental/feature_gate.rs index 54c2dbb352e..332cf944b5d 100644 --- a/tests/incremental/feature_gate.rs +++ b/tests/incremental/feature_gate.rs @@ -10,4 +10,4 @@ fn main() { } extern "unadjusted" fn foo() {} -//[cfail2]~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable +//[cfail2]~^ ERROR: "unadjusted" ABI is an implementation detail and perma-unstable diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.diff b/tests/mir-opt/box_expr.main.ElaborateDrops.diff index ec40fac2894..827dc6ac7ae 100644 --- a/tests/mir-opt/box_expr.main.ElaborateDrops.diff +++ b/tests/mir-opt/box_expr.main.ElaborateDrops.diff @@ -12,6 +12,7 @@ let mut _7: std::boxed::Box<S>; + let mut _8: &mut std::boxed::Box<S>; + let mut _9: (); ++ let mut _10: *const S; scope 1 { debug x => _1; } @@ -68,7 +69,7 @@ bb8 (cleanup): { - drop(_5) -> [return: bb9, unwind terminate(cleanup)]; -+ goto -> bb11; ++ goto -> bb12; } bb9 (cleanup): { @@ -82,6 +83,11 @@ + + bb11 (cleanup): { + goto -> bb10; ++ } ++ ++ bb12 (cleanup): { ++ _10 = copy ((_5.0: std::ptr::Unique<S>).0: std::ptr::NonNull<S>) as *const S (Transmute); ++ goto -> bb11; } } diff --git a/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff b/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff new file mode 100644 index 00000000000..f090795e886 --- /dev/null +++ b/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff @@ -0,0 +1,94 @@ +- // MIR for `maybe_move` before ElaborateDrops ++ // MIR for `maybe_move` after ElaborateDrops + + fn maybe_move(_1: bool, _2: Box<String>) -> Option<String> { + debug cond => _1; + debug thing => _2; + let mut _0: std::option::Option<std::string::String>; + let mut _3: bool; + let mut _4: std::string::String; ++ let mut _5: bool; ++ let mut _6: &mut std::boxed::Box<std::string::String>; ++ let mut _7: (); ++ let mut _8: &mut std::boxed::Box<std::string::String>; ++ let mut _9: (); ++ let mut _10: *const std::string::String; + + bb0: { ++ _5 = const false; ++ _5 = const true; + StorageLive(_3); + _3 = copy _1; + switchInt(move _3) -> [0: bb3, otherwise: bb1]; + } + + bb1: { + StorageLive(_4); ++ _5 = const false; + _4 = move (*_2); + _0 = Option::<String>::Some(move _4); +- drop(_4) -> [return: bb2, unwind: bb6]; ++ goto -> bb2; + } + + bb2: { + StorageDead(_4); + goto -> bb4; + } + + bb3: { + _0 = Option::<String>::None; + goto -> bb4; + } + + bb4: { + StorageDead(_3); +- drop(_2) -> [return: bb5, unwind continue]; ++ goto -> bb14; + } + + bb5: { + return; + } + + bb6 (cleanup): { +- drop(_2) -> [return: bb7, unwind terminate(cleanup)]; ++ goto -> bb7; + } + + bb7 (cleanup): { + resume; ++ } ++ ++ bb8: { ++ goto -> bb5; ++ } ++ ++ bb9: { ++ _6 = &mut _2; ++ _7 = <Box<String> as Drop>::drop(move _6) -> [return: bb8, unwind: bb7]; ++ } ++ ++ bb10 (cleanup): { ++ _8 = &mut _2; ++ _9 = <Box<String> as Drop>::drop(move _8) -> [return: bb7, unwind terminate(cleanup)]; ++ } ++ ++ bb11: { ++ goto -> bb13; ++ } ++ ++ bb12: { ++ drop((*_10)) -> [return: bb9, unwind: bb10]; ++ } ++ ++ bb13: { ++ switchInt(copy _5) -> [0: bb9, otherwise: bb12]; ++ } ++ ++ bb14: { ++ _10 = copy ((_2.0: std::ptr::Unique<std::string::String>).0: std::ptr::NonNull<std::string::String>) as *const std::string::String (Transmute); ++ goto -> bb11; + } + } + diff --git a/tests/mir-opt/box_partial_move.rs b/tests/mir-opt/box_partial_move.rs new file mode 100644 index 00000000000..5cbd242986f --- /dev/null +++ b/tests/mir-opt/box_partial_move.rs @@ -0,0 +1,17 @@ +//@ test-mir-pass: ElaborateDrops +//@ needs-unwind + +#![feature(rustc_attrs, liballoc_internals)] + +// EMIT_MIR box_partial_move.maybe_move.ElaborateDrops.diff +fn maybe_move(cond: bool, thing: Box<String>) -> Option<String> { + // CHECK-LABEL: fn maybe_move( + // CHECK: let mut [[PTR:_[0-9]+]]: *const std::string::String; + // CHECK: [[PTR]] = copy ((_2.0: std::ptr::Unique<std::string::String>).0: std::ptr::NonNull<std::string::String>) as *const std::string::String (Transmute); + // CHECK: drop((*[[PTR]])) + if cond { Some(*thing) } else { None } +} + +fn main() { + maybe_move(false, Box::new("hello".to_string())); +} diff --git a/tests/mir-opt/building/enum_cast.droppy.built.after.mir b/tests/mir-opt/building/enum_cast.droppy.built.after.mir deleted file mode 100644 index f53c9199a49..00000000000 --- a/tests/mir-opt/building/enum_cast.droppy.built.after.mir +++ /dev/null @@ -1,71 +0,0 @@ -// MIR for `droppy` after built - -fn droppy() -> () { - let mut _0: (); - let _1: (); - let _2: Droppy; - let _4: Droppy; - let mut _5: isize; - let mut _6: u8; - let mut _7: bool; - let _8: Droppy; - scope 1 { - debug x => _2; - scope 2 { - debug y => _3; - } - scope 3 { - let _3: usize; - } - } - scope 4 { - debug z => _8; - } - - bb0: { - StorageLive(_1); - StorageLive(_2); - _2 = Droppy::C; - FakeRead(ForLet(None), _2); - StorageLive(_3); - StorageLive(_4); - _4 = move _2; - _5 = discriminant(_4); - _6 = copy _5 as u8 (IntToInt); - _7 = Le(copy _6, const 2_u8); - assume(move _7); - _3 = move _5 as usize (IntToInt); - drop(_4) -> [return: bb1, unwind: bb4]; - } - - bb1: { - StorageDead(_4); - FakeRead(ForLet(None), _3); - _1 = const (); - StorageDead(_3); - drop(_2) -> [return: bb2, unwind: bb5]; - } - - bb2: { - StorageDead(_2); - StorageDead(_1); - StorageLive(_8); - _8 = Droppy::B; - FakeRead(ForLet(None), _8); - _0 = const (); - drop(_8) -> [return: bb3, unwind: bb5]; - } - - bb3: { - StorageDead(_8); - return; - } - - bb4 (cleanup): { - drop(_2) -> [return: bb5, unwind terminate(cleanup)]; - } - - bb5 (cleanup): { - resume; - } -} diff --git a/tests/mir-opt/building/enum_cast.rs b/tests/mir-opt/building/enum_cast.rs index 7ff0cdbfe8d..4fb9a27e309 100644 --- a/tests/mir-opt/building/enum_cast.rs +++ b/tests/mir-opt/building/enum_cast.rs @@ -41,27 +41,6 @@ fn far(far: Far) -> isize { far as isize } -// EMIT_MIR enum_cast.droppy.built.after.mir -enum Droppy { - A, - B, - C, -} - -impl Drop for Droppy { - fn drop(&mut self) {} -} - -fn droppy() { - { - let x = Droppy::C; - // remove this entire test once `cenum_impl_drop_cast` becomes a hard error - #[allow(cenum_impl_drop_cast)] - let y = x as usize; - } - let z = Droppy::B; -} - #[repr(i16)] enum SignedAroundZero { A = -2, diff --git a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff index 138586300ce..e9f48a85f9c 100644 --- a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff @@ -27,18 +27,15 @@ } + coverage body span: $DIR/branch_match_arms.rs:14:11: 21:2 (#0) -+ coverage ExpressionId(0) => Expression { lhs: Counter(1), op: Add, rhs: Counter(2) }; -+ coverage ExpressionId(1) => Expression { lhs: Expression(0), op: Add, rhs: Counter(3) }; -+ coverage ExpressionId(2) => Expression { lhs: Counter(0), op: Subtract, rhs: Expression(1) }; -+ coverage Code(Counter(0)) => $DIR/branch_match_arms.rs:14:1: 15:21 (#0); -+ coverage Code(Counter(1)) => $DIR/branch_match_arms.rs:16:17: 16:33 (#0); -+ coverage Code(Counter(2)) => $DIR/branch_match_arms.rs:17:17: 17:33 (#0); -+ coverage Code(Counter(3)) => $DIR/branch_match_arms.rs:18:17: 18:33 (#0); -+ coverage Code(Expression(2)) => $DIR/branch_match_arms.rs:19:17: 19:33 (#0); -+ coverage Code(Counter(0)) => $DIR/branch_match_arms.rs:21:2: 21:2 (#0); ++ coverage Code { bcb: bcb0 } => $DIR/branch_match_arms.rs:14:1: 15:21 (#0); ++ coverage Code { bcb: bcb1 } => $DIR/branch_match_arms.rs:16:17: 16:33 (#0); ++ coverage Code { bcb: bcb3 } => $DIR/branch_match_arms.rs:17:17: 17:33 (#0); ++ coverage Code { bcb: bcb4 } => $DIR/branch_match_arms.rs:18:17: 18:33 (#0); ++ coverage Code { bcb: bcb5 } => $DIR/branch_match_arms.rs:19:17: 19:33 (#0); ++ coverage Code { bcb: bcb2 } => $DIR/branch_match_arms.rs:21:2: 21:2 (#0); + bb0: { -+ Coverage::CounterIncrement(0); ++ Coverage::VirtualCounter(bcb0); StorageLive(_1); _1 = Enum::A(const 0_u32); PlaceMention(_1); @@ -52,22 +49,22 @@ } bb2: { -+ Coverage::CounterIncrement(1); ++ Coverage::VirtualCounter(bcb1); falseEdge -> [real: bb8, imaginary: bb3]; } bb3: { -+ Coverage::CounterIncrement(2); ++ Coverage::VirtualCounter(bcb3); falseEdge -> [real: bb7, imaginary: bb4]; } bb4: { -+ Coverage::CounterIncrement(3); ++ Coverage::VirtualCounter(bcb4); falseEdge -> [real: bb6, imaginary: bb5]; } bb5: { -+ Coverage::ExpressionUsed(2); ++ Coverage::VirtualCounter(bcb5); StorageLive(_9); _9 = copy ((_1 as A).0: u32); StorageLive(_10); @@ -124,6 +121,7 @@ } bb13: { ++ Coverage::VirtualCounter(bcb2); StorageDead(_1); return; } diff --git a/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff index a91d88984a8..cbef6de917d 100644 --- a/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff @@ -5,10 +5,10 @@ let mut _0: bool; + coverage body span: $DIR/instrument_coverage.rs:29:18: 31:2 (#0) -+ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:29:1: 31:2 (#0); ++ coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:29:1: 31:2 (#0); + bb0: { -+ Coverage::CounterIncrement(0); ++ Coverage::VirtualCounter(bcb0); _0 = const true; return; } diff --git a/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff index d7ea442518e..b166d79a412 100644 --- a/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff @@ -8,20 +8,19 @@ let mut _3: !; + coverage body span: $DIR/instrument_coverage.rs:14:11: 20:2 (#0) -+ coverage ExpressionId(0) => Expression { lhs: Counter(1), op: Subtract, rhs: Counter(0) }; -+ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:14:1: 14:11 (#0); -+ coverage Code(Counter(1)) => $DIR/instrument_coverage.rs:16:12: 16:17 (#0); -+ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:17:13: 17:18 (#0); -+ coverage Code(Expression(0)) => $DIR/instrument_coverage.rs:18:10: 18:10 (#0); -+ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:20:2: 20:2 (#0); ++ coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:14:1: 14:11 (#0); ++ coverage Code { bcb: bcb1 } => $DIR/instrument_coverage.rs:16:12: 16:17 (#0); ++ coverage Code { bcb: bcb2 } => $DIR/instrument_coverage.rs:17:13: 17:18 (#0); ++ coverage Code { bcb: bcb3 } => $DIR/instrument_coverage.rs:18:10: 18:10 (#0); ++ coverage Code { bcb: bcb2 } => $DIR/instrument_coverage.rs:20:2: 20:2 (#0); + bb0: { -+ Coverage::CounterIncrement(0); ++ Coverage::VirtualCounter(bcb0); goto -> bb1; } bb1: { -+ Coverage::CounterIncrement(1); ++ Coverage::VirtualCounter(bcb1); falseUnwind -> [real: bb2, unwind: bb6]; } @@ -35,13 +34,14 @@ } bb4: { ++ Coverage::VirtualCounter(bcb2); _0 = const (); StorageDead(_2); return; } bb5: { -+ Coverage::ExpressionUsed(0); ++ Coverage::VirtualCounter(bcb3); _1 = const (); StorageDead(_2); goto -> bb1; diff --git a/tests/mir-opt/coverage/instrument_coverage.rs b/tests/mir-opt/coverage/instrument_coverage.rs index c49786f9615..48647402d0f 100644 --- a/tests/mir-opt/coverage/instrument_coverage.rs +++ b/tests/mir-opt/coverage/instrument_coverage.rs @@ -8,9 +8,9 @@ // EMIT_MIR instrument_coverage.main.InstrumentCoverage.diff // CHECK-LABEL: fn main() // CHECK: coverage body span: -// CHECK: coverage Code(Counter({{[0-9]+}})) => +// CHECK: coverage Code { bcb: bcb{{[0-9]+}} } => // CHECK: bb0: -// CHECK: Coverage::CounterIncrement +// CHECK: Coverage::VirtualCounter fn main() { loop { if bar() { @@ -22,9 +22,9 @@ fn main() { // EMIT_MIR instrument_coverage.bar.InstrumentCoverage.diff // CHECK-LABEL: fn bar() // CHECK: coverage body span: -// CHECK: coverage Code(Counter({{[0-9]+}})) => +// CHECK: coverage Code { bcb: bcb{{[0-9]+}} } => // CHECK: bb0: -// CHECK: Coverage::CounterIncrement +// CHECK: Coverage::VirtualCounter #[inline(never)] fn bar() -> bool { true diff --git a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff index 2c7ec6e85eb..855f806aae1 100644 --- a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff +++ b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff @@ -8,15 +8,14 @@ coverage branch { true: BlockMarkerId(0), false: BlockMarkerId(1) } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0) coverage body span: $DIR/instrument_coverage_cleanup.rs:13:11: 15:2 (#0) - coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Subtract, rhs: Counter(1) }; - coverage Code(Counter(0)) => $DIR/instrument_coverage_cleanup.rs:13:1: 14:36 (#0); - coverage Code(Expression(0)) => $DIR/instrument_coverage_cleanup.rs:14:37: 14:39 (#0); - coverage Code(Counter(1)) => $DIR/instrument_coverage_cleanup.rs:14:39: 14:39 (#0); - coverage Code(Counter(0)) => $DIR/instrument_coverage_cleanup.rs:15:2: 15:2 (#0); - coverage Branch { true_term: Expression(0), false_term: Counter(1) } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); + coverage Code { bcb: bcb0 } => $DIR/instrument_coverage_cleanup.rs:13:1: 14:36 (#0); + coverage Code { bcb: bcb3 } => $DIR/instrument_coverage_cleanup.rs:14:37: 14:39 (#0); + coverage Code { bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:39: 14:39 (#0); + coverage Code { bcb: bcb2 } => $DIR/instrument_coverage_cleanup.rs:15:2: 15:2 (#0); + coverage Branch { true_bcb: bcb3, false_bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); bb0: { - Coverage::CounterIncrement(0); + Coverage::VirtualCounter(bcb0); - Coverage::SpanMarker; + nop; StorageLive(_1); @@ -28,7 +27,7 @@ } bb2: { - Coverage::CounterIncrement(1); + Coverage::VirtualCounter(bcb1); - Coverage::BlockMarker(1); + nop; _0 = const (); @@ -36,7 +35,7 @@ } bb3: { - Coverage::ExpressionUsed(0); + Coverage::VirtualCounter(bcb3); - Coverage::BlockMarker(0); + nop; _0 = const (); @@ -44,6 +43,7 @@ } bb4: { + Coverage::VirtualCounter(bcb2); StorageDead(_1); return; } diff --git a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff index c08265eb0e9..df1f1e8bc50 100644 --- a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff @@ -8,15 +8,14 @@ coverage branch { true: BlockMarkerId(0), false: BlockMarkerId(1) } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0) + coverage body span: $DIR/instrument_coverage_cleanup.rs:13:11: 15:2 (#0) -+ coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Subtract, rhs: Counter(1) }; -+ coverage Code(Counter(0)) => $DIR/instrument_coverage_cleanup.rs:13:1: 14:36 (#0); -+ coverage Code(Expression(0)) => $DIR/instrument_coverage_cleanup.rs:14:37: 14:39 (#0); -+ coverage Code(Counter(1)) => $DIR/instrument_coverage_cleanup.rs:14:39: 14:39 (#0); -+ coverage Code(Counter(0)) => $DIR/instrument_coverage_cleanup.rs:15:2: 15:2 (#0); -+ coverage Branch { true_term: Expression(0), false_term: Counter(1) } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); ++ coverage Code { bcb: bcb0 } => $DIR/instrument_coverage_cleanup.rs:13:1: 14:36 (#0); ++ coverage Code { bcb: bcb3 } => $DIR/instrument_coverage_cleanup.rs:14:37: 14:39 (#0); ++ coverage Code { bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:39: 14:39 (#0); ++ coverage Code { bcb: bcb2 } => $DIR/instrument_coverage_cleanup.rs:15:2: 15:2 (#0); ++ coverage Branch { true_bcb: bcb3, false_bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); + bb0: { -+ Coverage::CounterIncrement(0); ++ Coverage::VirtualCounter(bcb0); Coverage::SpanMarker; StorageLive(_1); _1 = std::hint::black_box::<bool>(const true) -> [return: bb1, unwind: bb5]; @@ -27,20 +26,21 @@ } bb2: { -+ Coverage::CounterIncrement(1); ++ Coverage::VirtualCounter(bcb1); Coverage::BlockMarker(1); _0 = const (); goto -> bb4; } bb3: { -+ Coverage::ExpressionUsed(0); ++ Coverage::VirtualCounter(bcb3); Coverage::BlockMarker(0); _0 = const (); goto -> bb4; } bb4: { ++ Coverage::VirtualCounter(bcb2); StorageDead(_1); return; } diff --git a/tests/mir-opt/coverage/instrument_coverage_cleanup.rs b/tests/mir-opt/coverage/instrument_coverage_cleanup.rs index acc544a28af..e8af4d6174f 100644 --- a/tests/mir-opt/coverage/instrument_coverage_cleanup.rs +++ b/tests/mir-opt/coverage/instrument_coverage_cleanup.rs @@ -3,7 +3,7 @@ // but leaves the statements that were added by InstrumentCoverage. // // Removed statement kinds: BlockMarker, SpanMarker -// Retained statement kinds: CounterIncrement, ExpressionUsed +// Retained statement kinds: VirtualCounter //@ test-mir-pass: InstrumentCoverage //@ compile-flags: -Cinstrument-coverage -Zcoverage-options=branch -Zno-profiler-runtime @@ -16,6 +16,6 @@ fn main() { // CHECK-NOT: Coverage::BlockMarker // CHECK-NOT: Coverage::SpanMarker -// CHECK: Coverage::CounterIncrement +// CHECK: Coverage::VirtualCounter // CHECK-NOT: Coverage::BlockMarker // CHECK-NOT: Coverage::SpanMarker diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff index 5a830254f61..2c89670dcf7 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff @@ -26,7 +26,7 @@ } scope 11 (inlined NonZero::<usize>::get) { } - scope 12 (inlined without_provenance::<[bool; 0]>) { + scope 12 (inlined std::ptr::without_provenance::<[bool; 0]>) { scope 13 (inlined without_provenance_mut::<[bool; 0]>) { } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff index c11368a347c..8fecfe224cc 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff @@ -26,7 +26,7 @@ } scope 11 (inlined NonZero::<usize>::get) { } - scope 12 (inlined without_provenance::<[bool; 0]>) { + scope 12 (inlined std::ptr::without_provenance::<[bool; 0]>) { scope 13 (inlined without_provenance_mut::<[bool; 0]>) { } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff index 037ed02ce65..976ea252c2f 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff @@ -26,7 +26,7 @@ } scope 11 (inlined NonZero::<usize>::get) { } - scope 12 (inlined without_provenance::<[bool; 0]>) { + scope 12 (inlined std::ptr::without_provenance::<[bool; 0]>) { scope 13 (inlined without_provenance_mut::<[bool; 0]>) { } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff index 86351c78759..6c59f5e3e2e 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff @@ -26,7 +26,7 @@ } scope 11 (inlined NonZero::<usize>::get) { } - scope 12 (inlined without_provenance::<[bool; 0]>) { + scope 12 (inlined std::ptr::without_provenance::<[bool; 0]>) { scope 13 (inlined without_provenance_mut::<[bool; 0]>) { } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff index 20a3897a934..1f9cf6d6aca 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff @@ -26,7 +26,7 @@ } scope 11 (inlined NonZero::<usize>::get) { } - scope 12 (inlined without_provenance::<[bool; 0]>) { + scope 12 (inlined std::ptr::without_provenance::<[bool; 0]>) { scope 13 (inlined without_provenance_mut::<[bool; 0]>) { } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff index 2e396301fd0..a8760285fac 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff @@ -26,7 +26,7 @@ } scope 11 (inlined NonZero::<usize>::get) { } - scope 12 (inlined without_provenance::<[bool; 0]>) { + scope 12 (inlined std::ptr::without_provenance::<[bool; 0]>) { scope 13 (inlined without_provenance_mut::<[bool; 0]>) { } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff index 319691174cf..c398ae70a1a 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff @@ -26,7 +26,7 @@ } scope 11 (inlined NonZero::<usize>::get) { } - scope 12 (inlined without_provenance::<[bool; 0]>) { + scope 12 (inlined std::ptr::without_provenance::<[bool; 0]>) { scope 13 (inlined without_provenance_mut::<[bool; 0]>) { } } diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff index 5dafc89d53f..02934c02587 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff @@ -26,7 +26,7 @@ } scope 11 (inlined NonZero::<usize>::get) { } - scope 12 (inlined without_provenance::<[bool; 0]>) { + scope 12 (inlined std::ptr::without_provenance::<[bool; 0]>) { scope 13 (inlined without_provenance_mut::<[bool; 0]>) { } } diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff deleted file mode 100644 index 60742ef0e9a..00000000000 --- a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff +++ /dev/null @@ -1,100 +0,0 @@ -- // MIR for `is_line_doc_comment_2` before DeduplicateBlocks -+ // MIR for `is_line_doc_comment_2` after DeduplicateBlocks - - fn is_line_doc_comment_2(_1: &str) -> bool { - debug s => _1; - let mut _0: bool; - let mut _2: &[u8]; - let mut _3: &str; - let mut _4: usize; - let mut _5: usize; - let mut _6: bool; - let mut _7: usize; - let mut _8: usize; - let mut _9: bool; - - bb0: { - StorageLive(_2); - StorageLive(_3); - _3 = &(*_1); - _2 = core::str::<impl str>::as_bytes(move _3) -> [return: bb1, unwind unreachable]; - } - - bb1: { - StorageDead(_3); - _4 = Len((*_2)); - _5 = const 4_usize; - _6 = Ge(move _4, move _5); - switchInt(move _6) -> [0: bb2, otherwise: bb3]; - } - - bb2: { - _7 = Len((*_2)); - _8 = const 3_usize; - _9 = Ge(move _7, move _8); -- switchInt(move _9) -> [0: bb7, otherwise: bb8]; -+ switchInt(move _9) -> [0: bb11, otherwise: bb7]; - } - - bb3: { - switchInt(copy (*_2)[0 of 4]) -> [47: bb4, otherwise: bb2]; - } - - bb4: { - switchInt(copy (*_2)[1 of 4]) -> [47: bb5, otherwise: bb2]; - } - - bb5: { - switchInt(copy (*_2)[2 of 4]) -> [47: bb6, otherwise: bb2]; - } - - bb6: { -- switchInt(copy (*_2)[3 of 4]) -> [47: bb13, otherwise: bb2]; -+ switchInt(copy (*_2)[3 of 4]) -> [47: bb11, otherwise: bb2]; - } - - bb7: { -- _0 = const false; -- goto -> bb14; -+ switchInt(copy (*_2)[0 of 3]) -> [47: bb8, otherwise: bb11]; - } - - bb8: { -- switchInt(copy (*_2)[0 of 3]) -> [47: bb9, otherwise: bb7]; -+ switchInt(copy (*_2)[1 of 3]) -> [47: bb9, otherwise: bb11]; - } - - bb9: { -- switchInt(copy (*_2)[1 of 3]) -> [47: bb10, otherwise: bb7]; -+ switchInt(copy (*_2)[2 of 3]) -> [47: bb10, 33: bb10, otherwise: bb11]; - } - - bb10: { -- switchInt(copy (*_2)[2 of 3]) -> [47: bb12, 33: bb11, otherwise: bb7]; -- } -- -- bb11: { - _0 = const true; -- goto -> bb14; -+ goto -> bb12; - } - -- bb12: { -- _0 = const true; -- goto -> bb14; -- } -- -- bb13: { -+ bb11: { - _0 = const false; -- goto -> bb14; -+ goto -> bb12; - } - -- bb14: { -+ bb12: { - StorageDead(_2); - return; - } - } - diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff deleted file mode 100644 index 7337a32f525..00000000000 --- a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff +++ /dev/null @@ -1,100 +0,0 @@ -- // MIR for `is_line_doc_comment_2` before DeduplicateBlocks -+ // MIR for `is_line_doc_comment_2` after DeduplicateBlocks - - fn is_line_doc_comment_2(_1: &str) -> bool { - debug s => _1; - let mut _0: bool; - let mut _2: &[u8]; - let mut _3: &str; - let mut _4: usize; - let mut _5: usize; - let mut _6: bool; - let mut _7: usize; - let mut _8: usize; - let mut _9: bool; - - bb0: { - StorageLive(_2); - StorageLive(_3); - _3 = &(*_1); - _2 = core::str::<impl str>::as_bytes(move _3) -> [return: bb1, unwind continue]; - } - - bb1: { - StorageDead(_3); - _4 = Len((*_2)); - _5 = const 4_usize; - _6 = Ge(move _4, move _5); - switchInt(move _6) -> [0: bb2, otherwise: bb3]; - } - - bb2: { - _7 = Len((*_2)); - _8 = const 3_usize; - _9 = Ge(move _7, move _8); -- switchInt(move _9) -> [0: bb7, otherwise: bb8]; -+ switchInt(move _9) -> [0: bb11, otherwise: bb7]; - } - - bb3: { - switchInt(copy (*_2)[0 of 4]) -> [47: bb4, otherwise: bb2]; - } - - bb4: { - switchInt(copy (*_2)[1 of 4]) -> [47: bb5, otherwise: bb2]; - } - - bb5: { - switchInt(copy (*_2)[2 of 4]) -> [47: bb6, otherwise: bb2]; - } - - bb6: { -- switchInt(copy (*_2)[3 of 4]) -> [47: bb13, otherwise: bb2]; -+ switchInt(copy (*_2)[3 of 4]) -> [47: bb11, otherwise: bb2]; - } - - bb7: { -- _0 = const false; -- goto -> bb14; -+ switchInt(copy (*_2)[0 of 3]) -> [47: bb8, otherwise: bb11]; - } - - bb8: { -- switchInt(copy (*_2)[0 of 3]) -> [47: bb9, otherwise: bb7]; -+ switchInt(copy (*_2)[1 of 3]) -> [47: bb9, otherwise: bb11]; - } - - bb9: { -- switchInt(copy (*_2)[1 of 3]) -> [47: bb10, otherwise: bb7]; -+ switchInt(copy (*_2)[2 of 3]) -> [47: bb10, 33: bb10, otherwise: bb11]; - } - - bb10: { -- switchInt(copy (*_2)[2 of 3]) -> [47: bb12, 33: bb11, otherwise: bb7]; -- } -- -- bb11: { - _0 = const true; -- goto -> bb14; -+ goto -> bb12; - } - -- bb12: { -- _0 = const true; -- goto -> bb14; -- } -- -- bb13: { -+ bb11: { - _0 = const false; -- goto -> bb14; -+ goto -> bb12; - } - -- bb14: { -+ bb12: { - StorageDead(_2); - return; - } - } - diff --git a/tests/mir-opt/deduplicate_blocks.rs b/tests/mir-opt/deduplicate_blocks.rs deleted file mode 100644 index 3a164cb09a0..00000000000 --- a/tests/mir-opt/deduplicate_blocks.rs +++ /dev/null @@ -1,17 +0,0 @@ -// skip-filecheck -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY -//@ test-mir-pass: DeduplicateBlocks - -// EMIT_MIR deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff -pub const fn is_line_doc_comment_2(s: &str) -> bool { - match s.as_bytes() { - [b'/', b'/', b'/', b'/', ..] => false, - [b'/', b'/', b'/', ..] => true, - [b'/', b'/', b'!', ..] => true, - _ => false, - } -} - -fn main() { - is_line_doc_comment_2("asd"); -} diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs new file mode 100644 index 00000000000..4368933dc62 --- /dev/null +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs @@ -0,0 +1,16 @@ +// skip-filecheck +//@ compile-flags: -Zmir-enable-passes=+Inline,+GVN --crate-type lib +// EMIT_MIR_FOR_EACH_BIT_WIDTH +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY +// EMIT_MIR dont_reset_cast_kind_without_updating_operand.test.GVN.diff + +fn test() { + let vp_ctx: &Box<()> = &Box::new(()); + let slf: *const () = &raw const **vp_ctx; + let bytes = std::ptr::slice_from_raw_parts(slf, 1); + let _x = foo(bytes); +} + +fn foo(bytes: *const [()]) -> *mut () { + bytes as *mut () +} 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 new file mode 100644 index 00000000000..37dd14e6c89 --- /dev/null +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff @@ -0,0 +1,180 @@ +- // MIR for `test` before GVN ++ // MIR for `test` after GVN + + fn test() -> () { + let mut _0: (); + let _1: &std::boxed::Box<()>; + let _2: &std::boxed::Box<()>; + let _3: std::boxed::Box<()>; + let mut _6: *const (); + let mut _8: *const [()]; + let mut _9: std::boxed::Box<()>; + let mut _10: *const (); + let mut _23: usize; + scope 1 { + debug vp_ctx => _1; + let _4: *const (); + scope 2 { + debug slf => _10; + let _5: *const [()]; + scope 3 { + debug bytes => _5; + let _7: *mut (); + scope 4 { + debug _x => _7; + } + scope 18 (inlined foo) { + } + } + scope 16 (inlined slice_from_raw_parts::<()>) { + scope 17 (inlined std::ptr::from_raw_parts::<[()], ()>) { + } + } + } + } + scope 5 (inlined Box::<()>::new) { + let mut _11: usize; + let mut _12: usize; + let mut _13: *mut u8; + scope 6 (inlined alloc::alloc::exchange_malloc) { + let _14: std::alloc::Layout; + let mut _15: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>; + let mut _16: isize; + let mut _18: !; + scope 7 { + let _17: std::ptr::NonNull<[u8]>; + scope 8 { + scope 11 (inlined NonNull::<[u8]>::as_mut_ptr) { + scope 12 (inlined NonNull::<[u8]>::as_non_null_ptr) { + scope 13 (inlined NonNull::<[u8]>::cast::<u8>) { + let mut _22: *mut [u8]; + scope 14 (inlined NonNull::<[u8]>::as_ptr) { + } + } + } + scope 15 (inlined NonNull::<u8>::as_ptr) { + } + } + } + scope 10 (inlined <std::alloc::Global as Allocator>::allocate) { + } + } + scope 9 (inlined Layout::from_size_align_unchecked) { + let mut _19: bool; + let _20: (); + let mut _21: std::ptr::Alignment; + } + } + } + + bb0: { + StorageLive(_1); +- StorageLive(_2); ++ nop; + StorageLive(_3); + StorageLive(_11); + StorageLive(_12); + StorageLive(_13); +- _11 = SizeOf(()); +- _12 = AlignOf(()); ++ _11 = const 0_usize; ++ _12 = const 1_usize; + StorageLive(_14); + StorageLive(_16); + StorageLive(_17); + StorageLive(_19); + _19 = const false; +- switchInt(move _19) -> [0: bb6, otherwise: bb5]; ++ switchInt(const false) -> [0: bb6, otherwise: bb5]; + } + + bb1: { + StorageDead(_3); + StorageDead(_1); + return; + } + + bb2: { + unreachable; + } + + bb3: { +- _18 = handle_alloc_error(move _14) -> unwind unreachable; ++ _18 = handle_alloc_error(const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}) -> unwind unreachable; + } + + bb4: { + _17 = copy ((_15 as Ok).0: std::ptr::NonNull<[u8]>); + StorageLive(_22); + _22 = copy _17 as *mut [u8] (Transmute); + _13 = copy _22 as *mut u8 (PtrToPtr); + StorageDead(_22); + StorageDead(_15); + StorageDead(_17); + StorageDead(_16); + StorageDead(_14); + _3 = ShallowInitBox(move _13, ()); + StorageDead(_13); + StorageDead(_12); + StorageDead(_11); + _2 = &_3; + _1 = copy _2; +- StorageDead(_2); ++ nop; + StorageLive(_4); +- _9 = deref_copy _3; ++ _9 = copy _3; + _10 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute); + _4 = copy _10; +- StorageLive(_5); ++ nop; + StorageLive(_6); +- _6 = copy _4; ++ _6 = copy _10; + StorageLive(_23); + _23 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _23); ++ _5 = *const [()] from (copy _10, const 1_usize); + StorageDead(_23); + StorageDead(_6); + StorageLive(_7); + StorageLive(_8); + _8 = copy _5; +- _7 = copy _8 as *mut () (PtrToPtr); ++ _7 = copy _5 as *mut () (PtrToPtr); + StorageDead(_8); + StorageDead(_7); +- StorageDead(_5); ++ nop; + StorageDead(_4); + drop(_3) -> [return: bb1, unwind unreachable]; + } + + bb5: { +- _20 = Layout::from_size_align_unchecked::precondition_check(copy _11, copy _12) -> [return: bb6, unwind unreachable]; ++ _20 = Layout::from_size_align_unchecked::precondition_check(const 0_usize, const 1_usize) -> [return: bb6, unwind unreachable]; + } + + bb6: { + StorageDead(_19); + StorageLive(_21); +- _21 = copy _12 as std::ptr::Alignment (Transmute); +- _14 = Layout { size: copy _11, align: move _21 }; ++ _21 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); ++ _14 = const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}; + StorageDead(_21); + StorageLive(_15); +- _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], copy _14, const false) -> [return: bb7, unwind unreachable]; ++ _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}, const false) -> [return: bb7, unwind unreachable]; + } + + bb7: { + _16 = discriminant(_15); + switchInt(move _16) -> [0: bb4, 1: bb3, otherwise: bb2]; + } ++ } ++ ++ ALLOC0 (size: 8, align: 4) { ++ 01 00 00 00 00 00 00 00 │ ........ + } + diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff new file mode 100644 index 00000000000..6bac6805943 --- /dev/null +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff @@ -0,0 +1,88 @@ +- // MIR for `test` before GVN ++ // MIR for `test` after GVN + + fn test() -> () { + let mut _0: (); + let _1: &std::boxed::Box<()>; + let _2: &std::boxed::Box<()>; + let _3: std::boxed::Box<()>; + let mut _6: *const (); + let mut _8: *const [()]; + let mut _9: std::boxed::Box<()>; + let mut _10: *const (); + let mut _11: usize; + scope 1 { + debug vp_ctx => _1; + let _4: *const (); + scope 2 { + debug slf => _10; + let _5: *const [()]; + scope 3 { + debug bytes => _5; + let _7: *mut (); + scope 4 { + debug _x => _7; + } + scope 7 (inlined foo) { + } + } + scope 5 (inlined slice_from_raw_parts::<()>) { + scope 6 (inlined std::ptr::from_raw_parts::<[()], ()>) { + } + } + } + } + + bb0: { + StorageLive(_1); +- StorageLive(_2); ++ nop; + StorageLive(_3); + _3 = Box::<()>::new(const ()) -> [return: bb1, unwind continue]; + } + + bb1: { + _2 = &_3; + _1 = copy _2; +- StorageDead(_2); ++ nop; + StorageLive(_4); +- _9 = deref_copy _3; ++ _9 = copy _3; + _10 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute); + _4 = copy _10; +- StorageLive(_5); ++ nop; + StorageLive(_6); +- _6 = copy _4; ++ _6 = copy _10; + StorageLive(_11); + _11 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _11); ++ _5 = *const [()] from (copy _10, const 1_usize); + StorageDead(_11); + StorageDead(_6); + StorageLive(_7); + StorageLive(_8); + _8 = copy _5; +- _7 = copy _8 as *mut () (PtrToPtr); ++ _7 = copy _5 as *mut () (PtrToPtr); + StorageDead(_8); + StorageDead(_7); +- StorageDead(_5); ++ nop; + StorageDead(_4); + drop(_3) -> [return: bb2, unwind: bb3]; + } + + bb2: { + StorageDead(_3); + StorageDead(_1); + return; + } + + bb3 (cleanup): { + resume; + } + } + 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 new file mode 100644 index 00000000000..1cf0f6de011 --- /dev/null +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff @@ -0,0 +1,180 @@ +- // MIR for `test` before GVN ++ // MIR for `test` after GVN + + fn test() -> () { + let mut _0: (); + let _1: &std::boxed::Box<()>; + let _2: &std::boxed::Box<()>; + let _3: std::boxed::Box<()>; + let mut _6: *const (); + let mut _8: *const [()]; + let mut _9: std::boxed::Box<()>; + let mut _10: *const (); + let mut _23: usize; + scope 1 { + debug vp_ctx => _1; + let _4: *const (); + scope 2 { + debug slf => _10; + let _5: *const [()]; + scope 3 { + debug bytes => _5; + let _7: *mut (); + scope 4 { + debug _x => _7; + } + scope 18 (inlined foo) { + } + } + scope 16 (inlined slice_from_raw_parts::<()>) { + scope 17 (inlined std::ptr::from_raw_parts::<[()], ()>) { + } + } + } + } + scope 5 (inlined Box::<()>::new) { + let mut _11: usize; + let mut _12: usize; + let mut _13: *mut u8; + scope 6 (inlined alloc::alloc::exchange_malloc) { + let _14: std::alloc::Layout; + let mut _15: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>; + let mut _16: isize; + let mut _18: !; + scope 7 { + let _17: std::ptr::NonNull<[u8]>; + scope 8 { + scope 11 (inlined NonNull::<[u8]>::as_mut_ptr) { + scope 12 (inlined NonNull::<[u8]>::as_non_null_ptr) { + scope 13 (inlined NonNull::<[u8]>::cast::<u8>) { + let mut _22: *mut [u8]; + scope 14 (inlined NonNull::<[u8]>::as_ptr) { + } + } + } + scope 15 (inlined NonNull::<u8>::as_ptr) { + } + } + } + scope 10 (inlined <std::alloc::Global as Allocator>::allocate) { + } + } + scope 9 (inlined Layout::from_size_align_unchecked) { + let mut _19: bool; + let _20: (); + let mut _21: std::ptr::Alignment; + } + } + } + + bb0: { + StorageLive(_1); +- StorageLive(_2); ++ nop; + StorageLive(_3); + StorageLive(_11); + StorageLive(_12); + StorageLive(_13); +- _11 = SizeOf(()); +- _12 = AlignOf(()); ++ _11 = const 0_usize; ++ _12 = const 1_usize; + StorageLive(_14); + StorageLive(_16); + StorageLive(_17); + StorageLive(_19); + _19 = const false; +- switchInt(move _19) -> [0: bb6, otherwise: bb5]; ++ switchInt(const false) -> [0: bb6, otherwise: bb5]; + } + + bb1: { + StorageDead(_3); + StorageDead(_1); + return; + } + + bb2: { + unreachable; + } + + bb3: { +- _18 = handle_alloc_error(move _14) -> unwind unreachable; ++ _18 = handle_alloc_error(const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}) -> unwind unreachable; + } + + bb4: { + _17 = copy ((_15 as Ok).0: std::ptr::NonNull<[u8]>); + StorageLive(_22); + _22 = copy _17 as *mut [u8] (Transmute); + _13 = copy _22 as *mut u8 (PtrToPtr); + StorageDead(_22); + StorageDead(_15); + StorageDead(_17); + StorageDead(_16); + StorageDead(_14); + _3 = ShallowInitBox(move _13, ()); + StorageDead(_13); + StorageDead(_12); + StorageDead(_11); + _2 = &_3; + _1 = copy _2; +- StorageDead(_2); ++ nop; + StorageLive(_4); +- _9 = deref_copy _3; ++ _9 = copy _3; + _10 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute); + _4 = copy _10; +- StorageLive(_5); ++ nop; + StorageLive(_6); +- _6 = copy _4; ++ _6 = copy _10; + StorageLive(_23); + _23 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _23); ++ _5 = *const [()] from (copy _10, const 1_usize); + StorageDead(_23); + StorageDead(_6); + StorageLive(_7); + StorageLive(_8); + _8 = copy _5; +- _7 = copy _8 as *mut () (PtrToPtr); ++ _7 = copy _5 as *mut () (PtrToPtr); + StorageDead(_8); + StorageDead(_7); +- StorageDead(_5); ++ nop; + StorageDead(_4); + drop(_3) -> [return: bb1, unwind unreachable]; + } + + bb5: { +- _20 = Layout::from_size_align_unchecked::precondition_check(copy _11, copy _12) -> [return: bb6, unwind unreachable]; ++ _20 = Layout::from_size_align_unchecked::precondition_check(const 0_usize, const 1_usize) -> [return: bb6, unwind unreachable]; + } + + bb6: { + StorageDead(_19); + StorageLive(_21); +- _21 = copy _12 as std::ptr::Alignment (Transmute); +- _14 = Layout { size: copy _11, align: move _21 }; ++ _21 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); ++ _14 = const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}; + StorageDead(_21); + StorageLive(_15); +- _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], copy _14, const false) -> [return: bb7, unwind unreachable]; ++ _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}, const false) -> [return: bb7, unwind unreachable]; + } + + bb7: { + _16 = discriminant(_15); + switchInt(move _16) -> [0: bb4, 1: bb3, otherwise: bb2]; + } ++ } ++ ++ ALLOC0 (size: 16, align: 8) { ++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ + } + diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff new file mode 100644 index 00000000000..6bac6805943 --- /dev/null +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff @@ -0,0 +1,88 @@ +- // MIR for `test` before GVN ++ // MIR for `test` after GVN + + fn test() -> () { + let mut _0: (); + let _1: &std::boxed::Box<()>; + let _2: &std::boxed::Box<()>; + let _3: std::boxed::Box<()>; + let mut _6: *const (); + let mut _8: *const [()]; + let mut _9: std::boxed::Box<()>; + let mut _10: *const (); + let mut _11: usize; + scope 1 { + debug vp_ctx => _1; + let _4: *const (); + scope 2 { + debug slf => _10; + let _5: *const [()]; + scope 3 { + debug bytes => _5; + let _7: *mut (); + scope 4 { + debug _x => _7; + } + scope 7 (inlined foo) { + } + } + scope 5 (inlined slice_from_raw_parts::<()>) { + scope 6 (inlined std::ptr::from_raw_parts::<[()], ()>) { + } + } + } + } + + bb0: { + StorageLive(_1); +- StorageLive(_2); ++ nop; + StorageLive(_3); + _3 = Box::<()>::new(const ()) -> [return: bb1, unwind continue]; + } + + bb1: { + _2 = &_3; + _1 = copy _2; +- StorageDead(_2); ++ nop; + StorageLive(_4); +- _9 = deref_copy _3; ++ _9 = copy _3; + _10 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute); + _4 = copy _10; +- StorageLive(_5); ++ nop; + StorageLive(_6); +- _6 = copy _4; ++ _6 = copy _10; + StorageLive(_11); + _11 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _11); ++ _5 = *const [()] from (copy _10, const 1_usize); + StorageDead(_11); + StorageDead(_6); + StorageLive(_7); + StorageLive(_8); + _8 = copy _5; +- _7 = copy _8 as *mut () (PtrToPtr); ++ _7 = copy _5 as *mut () (PtrToPtr); + StorageDead(_8); + StorageDead(_7); +- StorageDead(_5); ++ nop; + StorageDead(_4); + drop(_3) -> [return: bb2, unwind: bb3]; + } + + bb2: { + StorageDead(_3); + StorageDead(_1); + return; + } + + bb3 (cleanup): { + resume; + } + } + diff --git a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff index 727efe4b0d9..267a4c1cf6b 100644 --- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff +++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff @@ -47,6 +47,7 @@ + Deinit(_8); + copy_nonoverlapping(dst = copy _9, src = copy _11, count = copy _7); + StorageDead(_4); ++ nop; StorageDead(_2); - _0 = move _1; + StorageLive(_12); @@ -61,6 +62,7 @@ + Deinit(_16); + copy_nonoverlapping(dst = copy _17, src = copy _19, count = copy _15); + StorageDead(_12); ++ nop; StorageDead(_1); return; } diff --git a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff index 8d0cd97f786..8e5c403cd7e 100644 --- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff +++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff @@ -47,6 +47,7 @@ + Deinit(_8); + copy_nonoverlapping(dst = copy _9, src = copy _11, count = copy _7); + StorageDead(_4); ++ nop; StorageDead(_2); - _0 = move _1; + StorageLive(_12); @@ -61,6 +62,7 @@ + Deinit(_16); + copy_nonoverlapping(dst = copy _17, src = copy _19, count = copy _15); + StorageDead(_12); ++ nop; StorageDead(_1); return; } diff --git a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff index 6d1e2a72fdb..96c5aadd85f 100644 --- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff +++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff @@ -47,6 +47,7 @@ + Deinit(_8); + copy_nonoverlapping(dst = copy _9, src = copy _11, count = copy _7); + StorageDead(_4); ++ nop; StorageDead(_2); - _0 = move _1; + StorageLive(_12); @@ -61,6 +62,7 @@ + Deinit(_16); + copy_nonoverlapping(dst = copy _17, src = copy _19, count = copy _15); + StorageDead(_12); ++ nop; StorageDead(_1); return; } diff --git a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff index 4b1406d0d62..d20e2e08eaa 100644 --- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff +++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff @@ -47,6 +47,7 @@ + Deinit(_8); + copy_nonoverlapping(dst = copy _9, src = copy _11, count = copy _7); + StorageDead(_4); ++ nop; StorageDead(_2); - _0 = move _1; + StorageLive(_12); @@ -61,6 +62,7 @@ + Deinit(_16); + copy_nonoverlapping(dst = copy _17, src = copy _19, count = copy _15); + StorageDead(_12); ++ nop; StorageDead(_1); return; } diff --git a/tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff b/tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff index 8e7964297d0..f56af33ea60 100644 --- a/tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff +++ b/tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff @@ -16,7 +16,7 @@ } scope 8 (inlined NonZero::<usize>::get) { } - scope 9 (inlined without_provenance::<u8>) { + scope 9 (inlined std::ptr::without_provenance::<u8>) { scope 10 (inlined without_provenance_mut::<u8>) { } } diff --git a/tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff b/tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff new file mode 100644 index 00000000000..2f83f54d2af --- /dev/null +++ b/tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff @@ -0,0 +1,12 @@ +- // MIR for `cursed_is_i32` before GVN ++ // MIR for `cursed_is_i32` after GVN + + fn cursed_is_i32() -> bool { + let mut _0: bool; + + bb0: { + _0 = Eq(const cursed_is_i32::<T>::{constant#0}, const cursed_is_i32::<T>::{constant#1}); + return; + } + } + diff --git a/tests/mir-opt/gvn_type_id_polymorphic.rs b/tests/mir-opt/gvn_type_id_polymorphic.rs new file mode 100644 index 00000000000..39bc5c24ecc --- /dev/null +++ b/tests/mir-opt/gvn_type_id_polymorphic.rs @@ -0,0 +1,22 @@ +//@ test-mir-pass: GVN +//@ compile-flags: -C opt-level=2 + +#![feature(core_intrinsics)] + +fn generic<T>() {} + +const fn type_id_of_val<T: 'static>(_: &T) -> u128 { + std::intrinsics::type_id::<T>() +} + +// EMIT_MIR gvn_type_id_polymorphic.cursed_is_i32.GVN.diff +fn cursed_is_i32<T: 'static>() -> bool { + // CHECK-LABEL: fn cursed_is_i32( + // CHECK: _0 = Eq(const cursed_is_i32::<T>::{constant#0}, const cursed_is_i32::<T>::{constant#1}); + // CHECK-NEXT: return; + (const { type_id_of_val(&generic::<T>) } == const { type_id_of_val(&generic::<i32>) }) +} + +fn main() { + dbg!(cursed_is_i32::<i32>()); +} diff --git a/tests/mir-opt/inline/inline_compatibility.rs b/tests/mir-opt/inline/inline_compatibility.rs index 13f28aaacd6..1bb102ccda5 100644 --- a/tests/mir-opt/inline/inline_compatibility.rs +++ b/tests/mir-opt/inline/inline_compatibility.rs @@ -4,7 +4,6 @@ #![crate_type = "lib"] #![feature(no_sanitize)] -#![feature(target_feature_11)] #![feature(c_variadic)] #[inline] diff --git a/tests/mir-opt/null_check_references.rs b/tests/mir-opt/null_check_references.rs new file mode 100644 index 00000000000..85f98865646 --- /dev/null +++ b/tests/mir-opt/null_check_references.rs @@ -0,0 +1,16 @@ +//@ compile-flags: -C debug-assertions + +struct Null { + a: u32, +} + +fn main() { + // CHECK-LABEL: fn main( + // CHECK-NOT: {{assert.*}} + let val: u32 = 42; + let val_ref: &u32 = &val; + let _access1: &u32 = &*val_ref; + + let val = Null { a: 42 }; + let _access2: &u32 = &val.a; +} diff --git a/tests/mir-opt/pattern_types.main.PreCodegen.after.mir b/tests/mir-opt/pattern_types.main.PreCodegen.after.mir index 8c99902f9b8..5ff90de9615 100644 --- a/tests/mir-opt/pattern_types.main.PreCodegen.after.mir +++ b/tests/mir-opt/pattern_types.main.PreCodegen.after.mir @@ -5,7 +5,7 @@ fn main() -> () { scope 1 { debug x => const 2_u32 is 1..=; scope 2 { - debug y => const 0_u32 is 1..=; + debug y => const {transmute(0x00000000): (u32) is 1..=}; } } diff --git a/tests/mir-opt/pattern_types.rs b/tests/mir-opt/pattern_types.rs index 217c64b90cb..0369ccf9a9d 100644 --- a/tests/mir-opt/pattern_types.rs +++ b/tests/mir-opt/pattern_types.rs @@ -7,6 +7,6 @@ use std::pat::pattern_type; fn main() { // CHECK: debug x => const 2_u32 is 1..= let x: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(2) }; - // CHECK: debug y => const 0_u32 is 1..= + // CHECK: debug y => const {transmute(0x00000000): (u32) is 1..=} let y: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) }; } diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir index 60c0b8afa53..3f000dcafb0 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir @@ -19,16 +19,16 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { scope 2 { debug x => _9; } - scope 5 (inlined iter::range::<impl Iterator for RangeInclusive<u32>>::next) { + scope 5 (inlined iter::range::<impl Iterator for std::ops::RangeInclusive<u32>>::next) { } } - scope 3 (inlined RangeInclusive::<u32>::new) { + scope 3 (inlined std::ops::RangeInclusive::<u32>::new) { } - scope 4 (inlined <RangeInclusive<u32> as IntoIterator>::into_iter) { + scope 4 (inlined <std::ops::RangeInclusive<u32> as IntoIterator>::into_iter) { } bb0: { - _4 = RangeInclusive::<u32> { start: copy _1, end: copy _2, exhausted: const false }; + _4 = std::ops::RangeInclusive::<u32> { start: copy _1, end: copy _2, exhausted: const false }; StorageLive(_5); _5 = copy _4; goto -> bb1; @@ -37,7 +37,7 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb1: { StorageLive(_7); _6 = &mut _5; - _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _6) -> [return: bb2, unwind unreachable]; + _7 = <std::ops::RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _6) -> [return: bb2, unwind unreachable]; } bb2: { diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir index 7145da58ce1..23537173627 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir @@ -19,16 +19,16 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { scope 2 { debug x => _9; } - scope 5 (inlined iter::range::<impl Iterator for RangeInclusive<u32>>::next) { + scope 5 (inlined iter::range::<impl Iterator for std::ops::RangeInclusive<u32>>::next) { } } - scope 3 (inlined RangeInclusive::<u32>::new) { + scope 3 (inlined std::ops::RangeInclusive::<u32>::new) { } - scope 4 (inlined <RangeInclusive<u32> as IntoIterator>::into_iter) { + scope 4 (inlined <std::ops::RangeInclusive<u32> as IntoIterator>::into_iter) { } bb0: { - _4 = RangeInclusive::<u32> { start: copy _1, end: copy _2, exhausted: const false }; + _4 = std::ops::RangeInclusive::<u32> { start: copy _1, end: copy _2, exhausted: const false }; StorageLive(_5); _5 = copy _4; goto -> bb1; @@ -37,7 +37,7 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb1: { StorageLive(_7); _6 = &mut _5; - _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _6) -> [return: bb2, unwind: bb8]; + _7 = <std::ops::RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _6) -> [return: bb2, unwind: bb8]; } bb2: { diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir index 8e038246fa2..13969e5d238 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-abort.mir @@ -1,13 +1,13 @@ // MIR for `range_inclusive_iter_next` after PreCodegen -fn range_inclusive_iter_next(_1: &mut RangeInclusive<u32>) -> Option<u32> { +fn range_inclusive_iter_next(_1: &mut std::ops::RangeInclusive<u32>) -> Option<u32> { debug it => _1; let mut _0: std::option::Option<u32>; - scope 1 (inlined iter::range::<impl Iterator for RangeInclusive<u32>>::next) { + scope 1 (inlined iter::range::<impl Iterator for std::ops::RangeInclusive<u32>>::next) { } bb0: { - _0 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _1) -> [return: bb1, unwind unreachable]; + _0 = <std::ops::RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _1) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir index f54d003c662..98cd58284df 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir @@ -1,13 +1,13 @@ // MIR for `range_inclusive_iter_next` after PreCodegen -fn range_inclusive_iter_next(_1: &mut RangeInclusive<u32>) -> Option<u32> { +fn range_inclusive_iter_next(_1: &mut std::ops::RangeInclusive<u32>) -> Option<u32> { debug it => _1; let mut _0: std::option::Option<u32>; - scope 1 (inlined iter::range::<impl Iterator for RangeInclusive<u32>>::next) { + scope 1 (inlined iter::range::<impl Iterator for std::ops::RangeInclusive<u32>>::next) { } bb0: { - _0 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _1) -> [return: bb1, unwind continue]; + _0 = <std::ops::RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(move _1) -> [return: bb1, unwind continue]; } bb1: { 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 496ec78fd8d..b7a9b4a1fe0 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 @@ -59,7 +59,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let _9: *const T; scope 7 { } - scope 12 (inlined without_provenance::<T>) { + scope 12 (inlined std::ptr::without_provenance::<T>) { scope 13 (inlined without_provenance_mut::<T>) { } } 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 c4547cb888f..33dbf04d028 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 @@ -34,7 +34,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let _9: *const T; scope 7 { } - scope 12 (inlined without_provenance::<T>) { + scope 12 (inlined std::ptr::without_provenance::<T>) { scope 13 (inlined without_provenance_mut::<T>) { } } 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 7d011ea3347..dc13bb23c31 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 @@ -31,7 +31,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _9: *const T; scope 7 { } - scope 12 (inlined without_provenance::<T>) { + scope 12 (inlined std::ptr::without_provenance::<T>) { scope 13 (inlined without_provenance_mut::<T>) { } } 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 75e6542a3a4..3f1e0e0f746 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 @@ -31,7 +31,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _9: *const T; scope 7 { } - scope 12 (inlined without_provenance::<T>) { + scope 12 (inlined std::ptr::without_provenance::<T>) { scope 13 (inlined without_provenance_mut::<T>) { } } 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 41bc91ab028..4b7ab4516d2 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 @@ -34,7 +34,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _9: *const T; scope 7 { } - scope 12 (inlined without_provenance::<T>) { + scope 12 (inlined std::ptr::without_provenance::<T>) { scope 13 (inlined without_provenance_mut::<T>) { } } 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 6ed8ef9715b..b2c15247cd7 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 @@ -34,7 +34,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let _9: *const T; scope 7 { } - scope 12 (inlined without_provenance::<T>) { + scope 12 (inlined std::ptr::without_provenance::<T>) { scope 13 (inlined without_provenance_mut::<T>) { } } 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 22be48c47b2..38d00cfbabd 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 @@ -4,22 +4,21 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { debug it => _1; let mut _0: bool; scope 1 (inlined <std::slice::Iter<'_, T> as ExactSizeIterator>::is_empty) { - let mut _2: *const *const T; - let mut _3: *const std::ptr::NonNull<T>; - let mut _8: *const T; + let mut _2: *const T; + let mut _7: *const T; scope 2 { - let _4: std::ptr::NonNull<T>; - let _9: usize; + let _3: std::ptr::NonNull<T>; + let _8: usize; scope 3 { } scope 4 { - scope 8 (inlined <NonNull<T> as PartialEq>::eq) { - let mut _5: std::ptr::NonNull<T>; + scope 7 (inlined <NonNull<T> as PartialEq>::eq) { + let mut _4: std::ptr::NonNull<T>; + let mut _5: *mut T; let mut _6: *mut T; - let mut _7: *mut T; - scope 9 (inlined NonNull::<T>::as_ptr) { + scope 8 (inlined NonNull::<T>::as_ptr) { } - scope 10 (inlined NonNull::<T>::as_ptr) { + scope 9 (inlined NonNull::<T>::as_ptr) { } } } @@ -27,50 +26,45 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { scope 6 (inlined std::ptr::const_ptr::<impl *const T>::cast::<()>) { } } - scope 7 (inlined std::ptr::const_ptr::<impl *const *const T>::cast::<NonNull<T>>) { - } } } bb0: { - StorageLive(_9); StorageLive(_8); - StorageLive(_4); + StorageLive(_7); + StorageLive(_3); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageLive(_3); StorageLive(_2); - _2 = &raw const ((*_1).1: *const T); - _3 = copy _2 as *const std::ptr::NonNull<T> (PtrToPtr); + _2 = copy ((*_1).1: *const T); + _3 = move _2 as std::ptr::NonNull<T> (Transmute); StorageDead(_2); - _4 = copy (*_3); - StorageDead(_3); - StorageLive(_6); StorageLive(_5); - _5 = copy ((*_1).0: std::ptr::NonNull<T>); - _6 = copy _5 as *mut T (Transmute); - StorageDead(_5); - StorageLive(_7); - _7 = copy _4 as *mut T (Transmute); - _0 = Eq(move _6, move _7); - StorageDead(_7); + StorageLive(_4); + _4 = copy ((*_1).0: std::ptr::NonNull<T>); + _5 = copy _4 as *mut T (Transmute); + StorageDead(_4); + StorageLive(_6); + _6 = copy _3 as *mut T (Transmute); + _0 = Eq(move _5, move _6); StorageDead(_6); + StorageDead(_5); goto -> bb3; } bb2: { - _8 = copy ((*_1).1: *const T); - _9 = copy _8 as usize (Transmute); - _0 = Eq(copy _9, const 0_usize); + _7 = copy ((*_1).1: *const T); + _8 = copy _7 as usize (Transmute); + _0 = Eq(copy _8, const 0_usize); goto -> bb3; } bb3: { - StorageDead(_4); + StorageDead(_3); + StorageDead(_7); StorageDead(_8); - StorageDead(_9); return; } } 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 22be48c47b2..38d00cfbabd 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 @@ -4,22 +4,21 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { debug it => _1; let mut _0: bool; scope 1 (inlined <std::slice::Iter<'_, T> as ExactSizeIterator>::is_empty) { - let mut _2: *const *const T; - let mut _3: *const std::ptr::NonNull<T>; - let mut _8: *const T; + let mut _2: *const T; + let mut _7: *const T; scope 2 { - let _4: std::ptr::NonNull<T>; - let _9: usize; + let _3: std::ptr::NonNull<T>; + let _8: usize; scope 3 { } scope 4 { - scope 8 (inlined <NonNull<T> as PartialEq>::eq) { - let mut _5: std::ptr::NonNull<T>; + scope 7 (inlined <NonNull<T> as PartialEq>::eq) { + let mut _4: std::ptr::NonNull<T>; + let mut _5: *mut T; let mut _6: *mut T; - let mut _7: *mut T; - scope 9 (inlined NonNull::<T>::as_ptr) { + scope 8 (inlined NonNull::<T>::as_ptr) { } - scope 10 (inlined NonNull::<T>::as_ptr) { + scope 9 (inlined NonNull::<T>::as_ptr) { } } } @@ -27,50 +26,45 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { scope 6 (inlined std::ptr::const_ptr::<impl *const T>::cast::<()>) { } } - scope 7 (inlined std::ptr::const_ptr::<impl *const *const T>::cast::<NonNull<T>>) { - } } } bb0: { - StorageLive(_9); StorageLive(_8); - StorageLive(_4); + StorageLive(_7); + StorageLive(_3); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageLive(_3); StorageLive(_2); - _2 = &raw const ((*_1).1: *const T); - _3 = copy _2 as *const std::ptr::NonNull<T> (PtrToPtr); + _2 = copy ((*_1).1: *const T); + _3 = move _2 as std::ptr::NonNull<T> (Transmute); StorageDead(_2); - _4 = copy (*_3); - StorageDead(_3); - StorageLive(_6); StorageLive(_5); - _5 = copy ((*_1).0: std::ptr::NonNull<T>); - _6 = copy _5 as *mut T (Transmute); - StorageDead(_5); - StorageLive(_7); - _7 = copy _4 as *mut T (Transmute); - _0 = Eq(move _6, move _7); - StorageDead(_7); + StorageLive(_4); + _4 = copy ((*_1).0: std::ptr::NonNull<T>); + _5 = copy _4 as *mut T (Transmute); + StorageDead(_4); + StorageLive(_6); + _6 = copy _3 as *mut T (Transmute); + _0 = Eq(move _5, move _6); StorageDead(_6); + StorageDead(_5); goto -> bb3; } bb2: { - _8 = copy ((*_1).1: *const T); - _9 = copy _8 as usize (Transmute); - _0 = Eq(copy _9, const 0_usize); + _7 = copy ((*_1).1: *const T); + _8 = copy _7 as usize (Transmute); + _0 = Eq(copy _8, const 0_usize); goto -> bb3; } bb3: { - StorageDead(_4); + StorageDead(_3); + StorageDead(_7); StorageDead(_8); - StorageDead(_9); return; } } diff --git a/tests/run-make/amdgpu-kd/foo.rs b/tests/run-make/amdgpu-kd/foo.rs new file mode 100644 index 00000000000..a0d803ab813 --- /dev/null +++ b/tests/run-make/amdgpu-kd/foo.rs @@ -0,0 +1,11 @@ +#![allow(internal_features)] +#![feature(no_core, lang_items, abi_gpu_kernel)] +#![no_core] +#![no_std] + +// This is needed because of #![no_core]: +#[lang = "sized"] +trait Sized {} + +#[no_mangle] +extern "gpu-kernel" fn kernel() {} diff --git a/tests/run-make/amdgpu-kd/rmake.rs b/tests/run-make/amdgpu-kd/rmake.rs new file mode 100644 index 00000000000..a787fa1da93 --- /dev/null +++ b/tests/run-make/amdgpu-kd/rmake.rs @@ -0,0 +1,20 @@ +// On the amdhsa OS, the host runtime (HIP or HSA) expects a kernel descriptor object for each +// kernel in the ELF file. The amdgpu LLVM backend generates the object. It is created as a symbol +// with the name of the kernel plus a .kd suffix. +// Check that the produced object has the .kd symbol exported. + +//@ needs-llvm-components: amdgpu +//@ needs-rust-lld + +use run_make_support::{llvm_readobj, rustc}; + +fn main() { + rustc() + .crate_name("foo") + .target("amdgcn-amd-amdhsa") + .arg("-Ctarget-cpu=gfx900") + .crate_type("cdylib") + .input("foo.rs") + .run(); + llvm_readobj().input("foo.elf").symbols().run().assert_stdout_contains("kernel.kd"); +} diff --git a/tests/run-make/apple-deployment-target/rmake.rs b/tests/run-make/apple-deployment-target/rmake.rs index 0ae95cb1f4b..839e21b7496 100644 --- a/tests/run-make/apple-deployment-target/rmake.rs +++ b/tests/run-make/apple-deployment-target/rmake.rs @@ -7,7 +7,11 @@ //@ only-apple -use run_make_support::{apple_os, cmd, run_in_tmpdir, rustc, target}; +use std::collections::HashSet; + +use run_make_support::{ + apple_os, cmd, has_extension, path, regex, run_in_tmpdir, rustc, shallow_find_files, target, +}; /// Run vtool to check the `minos` field in LC_BUILD_VERSION. /// @@ -166,4 +170,21 @@ fn main() { rustc().env_remove(env_var).run(); minos("foo.o", default_version); }); + + // Test that all binaries in rlibs produced by `rustc` have the same version. + // Regression test for https://github.com/rust-lang/rust/issues/128419. + let sysroot = rustc().print("sysroot").run().stdout_utf8(); + let target_sysroot = path(sysroot.trim()).join("lib/rustlib").join(target()).join("lib"); + let rlibs = shallow_find_files(&target_sysroot, |path| has_extension(path, "rlib")); + + let output = cmd("otool").arg("-l").args(rlibs).run().stdout_utf8(); + let re = regex::Regex::new(r"(minos|version) ([0-9.]*)").unwrap(); + let mut versions = HashSet::new(); + for (_, [_, version]) in re.captures_iter(&output).map(|c| c.extract()) { + versions.insert(version); + } + // FIXME(madsmtm): See above for aarch64-apple-watchos. + if versions.len() != 1 && target() != "aarch64-apple-watchos" { + panic!("std rlibs contained multiple different deployment target versions: {versions:?}"); + } } diff --git a/tests/run-make/libs-through-symlinks/rmake.rs b/tests/run-make/libs-through-symlinks/rmake.rs index 4bb3d05abb7..894d6246445 100644 --- a/tests/run-make/libs-through-symlinks/rmake.rs +++ b/tests/run-make/libs-through-symlinks/rmake.rs @@ -21,6 +21,7 @@ //! <https://github.com/rust-lang/rust/pull/13903>. //@ ignore-cross-compile +//@ needs-symlink use run_make_support::{bare_rustc, cwd, path, rfs, rust_lib_name}; diff --git a/tests/run-make/rustc-crates-on-stable/rmake.rs b/tests/run-make/rustc-crates-on-stable/rmake.rs index 9fbc675cc9a..cbc1f24b8c1 100644 --- a/tests/run-make/rustc-crates-on-stable/rmake.rs +++ b/tests/run-make/rustc-crates-on-stable/rmake.rs @@ -35,6 +35,8 @@ fn main() { "rustc_abi", "-p", "rustc_parse_format", + "-p", + "rustc_hashes", ]) .run(); } diff --git a/tests/run-make/rustc-help/help-v.stdout b/tests/run-make/rustc-help/help-v.stdout index 8f6fde69c29..382b1c96682 100644 --- a/tests/run-make/rustc-help/help-v.stdout +++ b/tests/run-make/rustc-help/help-v.stdout @@ -32,7 +32,7 @@ Options: --print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target] Compiler information to print on stdout -g Equivalent to -C debuginfo=2 - -O Equivalent to -C opt-level=2 + -O Equivalent to -C opt-level=3 -o FILENAME Write output to <filename> --out-dir DIR Write output to compiler-chosen filename in <dir> --explain OPT Provide a detailed explanation of an error message diff --git a/tests/run-make/rustc-help/help.stdout b/tests/run-make/rustc-help/help.stdout index 131efa93282..08bb7f85098 100644 --- a/tests/run-make/rustc-help/help.stdout +++ b/tests/run-make/rustc-help/help.stdout @@ -32,7 +32,7 @@ Options: --print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target] Compiler information to print on stdout -g Equivalent to -C debuginfo=2 - -O Equivalent to -C opt-level=2 + -O Equivalent to -C opt-level=3 -o FILENAME Write output to <filename> --out-dir DIR Write output to compiler-chosen filename in <dir> --explain OPT Provide a detailed explanation of an error message diff --git a/tests/run-make/split-debuginfo/Makefile b/tests/run-make/split-debuginfo/Makefile deleted file mode 100644 index 5f463ffe8cd..00000000000 --- a/tests/run-make/split-debuginfo/Makefile +++ /dev/null @@ -1,371 +0,0 @@ -# ignore-cross-compile -# ignore-riscv64 On this platform only `-Csplit-debuginfo=off` is supported, see #120518 - -include ../tools.mk - -all: off packed unpacked - -ifeq ($(UNAME),Darwin) -# If disabled, don't run `dsymutil`. -off: - rm -rf $(TMPDIR)/*.dSYM - $(RUSTC) foo.rs -g -C split-debuginfo=off - [ ! -d $(TMPDIR)/foo.dSYM ] - -# Packed by default, but only if debuginfo is requested -packed: - rm -rf $(TMPDIR)/*.dSYM - $(RUSTC) foo.rs - [ ! -d $(TMPDIR)/foo.dSYM ] - rm -rf $(TMPDIR)/*.dSYM - $(RUSTC) foo.rs -g - [ -d $(TMPDIR)/foo.dSYM ] - rm -rf $(TMPDIR)/*.dSYM - $(RUSTC) foo.rs -g -C split-debuginfo=packed - [ -d $(TMPDIR)/foo.dSYM ] - rm -rf $(TMPDIR)/*.dSYM - -# Object files are preserved with unpacked and `dsymutil` isn't run -unpacked: - $(RUSTC) foo.rs -g -C split-debuginfo=unpacked - ls $(TMPDIR)/*.o - [ ! -d $(TMPDIR)/foo.dSYM ] -else -ifdef IS_WINDOWS -# Windows only supports packed debuginfo - nothing to test. -off: -packed: -unpacked: -else -# Some non-Windows, non-Darwin platforms are not stable, and some are. -ifeq ($(UNAME),Linux) - UNSTABLEOPTS := -else - UNSTABLEOPTS := -Zunstable-options -endif - -# - Debuginfo in `.o` files -# - `.o` deleted -# - `.dwo` never created -# - `.dwp` never created -off: - $(RUSTC) foo.rs -g -C $(UNSTABLEOPTS) split-debuginfo=off - [ ! -f $(TMPDIR)/*.dwp ] - [ ! -f $(TMPDIR)/*.dwo ] - $(RUSTC) foo.rs -g - [ ! -f $(TMPDIR)/*.dwp ] - [ ! -f $(TMPDIR)/*.dwo ] - -packed: packed-split packed-single packed-lto packed-remapped packed-crosscrate - -# - Debuginfo in `.dwo` files -# - `.o` deleted -# - `.dwo` deleted -# - `.dwp` present -packed-split: - $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=packed -Zsplit-dwarf-kind=split - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` deleted -# - `.dwo` never created -# - `.dwp` present -packed-single: - $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=packed -Zsplit-dwarf-kind=single - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -packed-lto: packed-lto-split packed-lto-single - -# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` never created -# - `.dwo` never created -# - `.dwp` never created -packed-lto-split: - $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split \ - --crate-type=rlib -Clinker-plugin-lto - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/libbaz.rlib - -# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` never created -# - `.dwo` never created -# - `.dwp` never created -packed-lto-single: - $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=single \ - --crate-type=rlib -Clinker-plugin-lto - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/libbaz.rlib - -packed-remapped: packed-remapped-split packed-remapped-single packed-remapped-scope packed-remapped-wrong-scope - -# - Debuginfo in `.dwo` files -# - `.o` and binary refer to remapped `.dwo` paths which do not exist -# - `.o` deleted -# - `.dwo` deleted -# - `.dwp` present -packed-remapped-split: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ - -Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` and binary refer to remapped `.o` paths which do not exist -# - `.o` deleted -# - `.dwo` never created -# - `.dwp` present -packed-remapped-single: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ - -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` and binary refer to remapped `.o` paths which do not exist -# - `.o` deleted -# - `.dwo` never created -# - `.dwp` present -packed-remapped-scope: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ - -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \ - -Z remap-path-scope=debuginfo foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` and binary refer to remapped `.o` paths which do not exist -# - `.o` deleted -# - `.dwo` never created -# - `.dwp` present -packed-remapped-wrong-scope: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ - -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \ - -Z remap-path-scope=macro foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (grep $(TMPDIR)) || exit 1 - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/foo.dwp - rm $(TMPDIR)/$(call BIN,foo) - -packed-crosscrate: packed-crosscrate-split packed-crosscrate-single - -# - Debuginfo in `.dwo` files -# - (bar) `.rlib` file created, contains `.dwo` -# - (bar) `.o` deleted -# - (bar) `.dwo` deleted -# - (bar) `.dwp` never created -# - (main) `.o` deleted -# - (main) `.dwo` deleted -# - (main) `.dwp` present -packed-crosscrate-split: - $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=packed \ - -Zsplit-dwarf-kind=split -C debuginfo=2 -g bar.rs - ls $(TMPDIR)/*.rlib - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ - -C split-debuginfo=packed -Zsplit-dwarf-kind=split -C debuginfo=2 -g main.rs - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/main.dwp - rm $(TMPDIR)/$(call BIN,main) - -# - Debuginfo in `.o` files -# - (bar) `.rlib` file created, contains `.o` -# - (bar) `.o` deleted -# - (bar) `.dwo` never created -# - (bar) `.dwp` never created -# - (main) `.o` deleted -# - (main) `.dwo` never created -# - (main) `.dwp` present -packed-crosscrate-single: - $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=packed \ - -Zsplit-dwarf-kind=single -C debuginfo=2 -g bar.rs - ls $(TMPDIR)/*.rlib - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ - -C split-debuginfo=packed -Zsplit-dwarf-kind=single -C debuginfo=2 -g main.rs - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - rm $(TMPDIR)/main.dwp - rm $(TMPDIR)/$(call BIN,main) - -unpacked: unpacked-split unpacked-single unpacked-lto unpacked-remapped unpacked-crosscrate - -# - Debuginfo in `.dwo` files -# - `.o` deleted -# - `.dwo` present -# - `.dwp` never created -unpacked-split: - $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=unpacked -Zsplit-dwarf-kind=split - ls $(TMPDIR)/*.o && exit 1 || exit 0 - rm $(TMPDIR)/*.dwo - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` present -# - `.dwo` never created -# - `.dwp` never created -unpacked-single: - $(RUSTC) foo.rs -g $(UNSTABLEOPTS) -C split-debuginfo=unpacked -Zsplit-dwarf-kind=single - ls $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -unpacked-lto: unpacked-lto-split unpacked-lto-single - -# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` present (bitcode) -# - `.dwo` never created -# - `.dwp` never created -unpacked-lto-split: - $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=split \ - --crate-type=rlib -Clinker-plugin-lto - rm $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/libbaz.rlib - -# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated -# - `.o` present (bitcode) -# - `.dwo` never created -# - `.dwp` never created -unpacked-lto-single: - $(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=single \ - --crate-type=rlib -Clinker-plugin-lto - rm $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/libbaz.rlib - -unpacked-remapped: unpacked-remapped-split unpacked-remapped-single unpacked-remapped-scope unpacked-remapped-wrong-scope - -# - Debuginfo in `.dwo` files -# - `.o` and binary refer to remapped `.dwo` paths which do not exist -# - `.o` deleted -# - `.dwo` present -# - `.dwp` never created -unpacked-remapped-split: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ - -Z split-dwarf-kind=split --remap-path-prefix $(TMPDIR)=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - ls $(TMPDIR)/*.o && exit 1 || exit 0 - rm $(TMPDIR)/*.dwo - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` and binary refer to remapped `.o` paths which do not exist -# - `.o` present -# - `.dwo` never created -# - `.dwp` never created -unpacked-remapped-single: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ - -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - rm $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` and binary refer to remapped `.o` paths which do not exist -# - `.o` present -# - `.dwo` never created -# - `.dwp` never created -unpacked-remapped-scope: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ - -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \ - -Z remap-path-scope=debuginfo foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1 - rm $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -# - Debuginfo in `.o` files -# - `.o` and binary refer to remapped `.o` paths which do not exist -# - `.o` present -# - `.dwo` never created -# - `.dwp` never created -unpacked-remapped-wrong-scope: - $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ - -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \ - -Z remap-path-scope=macro foo.rs -g - objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (grep $(TMPDIR)) || exit 1 - rm $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,foo) - -unpacked-crosscrate: unpacked-crosscrate-split unpacked-crosscrate-single - -# - Debuginfo in `.dwo` files -# - (bar) `.rlib` file created, contains `.dwo` -# - (bar) `.o` deleted -# - (bar) `.dwo` present -# - (bar) `.dwp` never created -# - (main) `.o` deleted -# - (main) `.dwo` present -# - (main) `.dwp` never created -unpacked-crosscrate-split: - $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=unpacked \ - -Zsplit-dwarf-kind=split -C debuginfo=2 -g bar.rs - ls $(TMPDIR)/*.rlib - ls $(TMPDIR)/*.o && exit 1 || exit 0 - ls $(TMPDIR)/*.dwo - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ - -C split-debuginfo=unpacked -Zsplit-dwarf-kind=split -C debuginfo=2 -g main.rs - ls $(TMPDIR)/*.o && exit 1 || exit 0 - rm $(TMPDIR)/*.dwo - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,main) - -# - Debuginfo in `.o` files -# - (bar) `.rlib` file created, contains `.o` -# - (bar) `.o` present -# - (bar) `.dwo` never created -# - (bar) `.dwp` never created -# - (main) `.o` present -# - (main) `.dwo` never created -# - (main) `.dwp` never created -unpacked-crosscrate-single: - $(RUSTC) --crate-type lib $(UNSTABLEOPTS) -C split-debuginfo=unpacked \ - -Zsplit-dwarf-kind=single -C debuginfo=2 -g bar.rs - ls $(TMPDIR)/*.rlib - ls $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - $(RUSTC) --extern bar=$(TMPDIR)/libbar.rlib $(UNSTABLEOPTS) \ - -C split-debuginfo=unpacked -Zsplit-dwarf-kind=single -C debuginfo=2 -g main.rs - ls $(TMPDIR)/*.o - ls $(TMPDIR)/*.dwo && exit 1 || exit 0 - ls $(TMPDIR)/*.dwp && exit 1 || exit 0 - rm $(TMPDIR)/$(call BIN,main) -endif -endif diff --git a/tests/run-make/split-debuginfo/rmake.rs b/tests/run-make/split-debuginfo/rmake.rs new file mode 100644 index 00000000000..530a5d119f1 --- /dev/null +++ b/tests/run-make/split-debuginfo/rmake.rs @@ -0,0 +1,1618 @@ +// ignore-tidy-linelength +//! Basic smoke tests for behavior of `-C split-debuginfo` and the combined behavior when used in +//! conjunction with other flags such as: +//! +//! - `--remap-path-prefix`: see +//! <https://doc.rust-lang.org/rustc/command-line-arguments.html#--remap-path-prefix-remap-source-names-in-output>. +//! - `-Z remap-path-scope`: see +//! - <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/remap-path-scope.html> +//! - <https://github.com/rust-lang/rust/issues/111540> +//! - RFC #3127 trim-paths: <https://github.com/rust-lang/rfcs/pull/3127> +//! - `-Z split-dwarf-kind`: see <https://github.com/rust-lang/rust/pull/89819>. +//! - `-Clinker-plugin-lto`: see <https://doc.rust-lang.org/rustc/linker-plugin-lto.html>. +//! +//! # Test implementation remark +//! +//! - The pattern match on enum variants are intentional, because I find that they are very +//! revealing with respect to the kind of test coverage that we have and don't have. +//! +//! # Known limitations +//! +//! - The linux test coverage of cross-interactions between `-C split-debuginfo` and other flags are +//! significantly higher than the lack of such coverage for Windows and Darwin. +//! - windows-gnu is not tested at all, see the `FIXME(#135531)`s below. +//! - This test for the most part merely checks for existence/absence of certain artifacts, it does +//! not sanity check if the debuginfo artifacts are actually usable or contains the expected +//! amount/quality of debuginfo, especially on windows-msvc and darwin. +//! - FIXME(#111540): this test has insufficient coverage in relation to trim-paths RFC, see also +//! the comment <https://github.com/rust-lang/rust/issues/111540#issuecomment-1994010274>. The +//! basic `llvm-dwarfdump` textual output inspection here is very fragile. The original `Makefile` +//! version used `objdump` (not to be confused with `llvm-objdump`) but inspected the wrong line +//! because it was looking at `DW_AT_GNU_dwo_name` when it should've been looking at +//! `DW_AT_comp_dir`. +//! - This test does not have good coverage for what values of `-Csplit-debuginfo` are stable vs +//! non-stable for the various targets, i.e. which values *should* be gated behind +//! `-Zunstable-options` for a given target. The `Makefile` version yolo'd a `-Zunstable-options` +//! for non-windows + non-linux + non-darwin, but had a misplaced interpolation which suggested to +//! me that that conditional `-Zunstable-options` never actually materialized. +//! +//! # Additional references +//! +//! - Apple `.dSYM` debug symbol bundles: <https://lldb.llvm.org/use/symbols.html>. +//! - LLVM `dsymutil`: <https://llvm.org/docs/CommandGuide/dsymutil.html>. + +// NOTE: this is a host test +//@ ignore-cross-compile + +// NOTE: this seems to be a host test, and testing on host `riscv64-gc-unknown-linux-gnu` reveals +// that this test is failing because of [MC: "error: A dwo section may not contain relocations" when +// building with fission + RISCV64 #56642](https://github.com/llvm/llvm-project/issues/56642). This +// test is ignored for now to unblock efforts to bring riscv64 targets to be exercised in CI, cf. +// [Enable riscv64gc-gnu testing #126641](https://github.com/rust-lang/rust/pull/126641). +//@ ignore-riscv64 (https://github.com/llvm/llvm-project/issues/56642) + +// FIXME(#135531): the `Makefile` version practically didn't test `-C split-debuginfo` on Windows +// at all, and lumped windows-msvc and windows-gnu together at that. +//@ ignore-windows-gnu + +#![deny(warnings)] + +use std::collections::BTreeSet; + +use run_make_support::rustc::Rustc; +use run_make_support::{ + cwd, has_extension, is_darwin, is_msvc, is_windows, llvm_dwarfdump, run_in_tmpdir, rustc, + shallow_find_directories, shallow_find_files, uname, +}; + +/// `-C debuginfo`. See <https://doc.rust-lang.org/rustc/codegen-options/index.html#debuginfo>. +#[derive(Debug, PartialEq, Copy, Clone)] +enum DebuginfoLevel { + /// `-C debuginfo=0` or `-C debuginfo=none` aka no debuginfo at all, default. + None, + /// `-C debuginfo=2` aka full debuginfo, aliased via `-g`. + Full, + /// The cli flag is not explicitly provided; default. + Unspecified, +} + +impl DebuginfoLevel { + fn cli_value(&self) -> &'static str { + // `-Cdebuginfo=...` + match self { + DebuginfoLevel::None => "none", + DebuginfoLevel::Full => "2", + DebuginfoLevel::Unspecified => unreachable!(), + } + } +} + +/// `-C split-debuginfo`. See +/// <https://doc.rust-lang.org/rustc/codegen-options/index.html#split-debuginfo>. +/// +/// Note that all three options are supported on Linux and Apple platforms, packed is supported on +/// Windows-MSVC, and all other platforms support off. Attempting to use an unsupported option +/// requires using the nightly channel with the `-Z unstable-options` flag. +#[derive(Debug, PartialEq, Copy, Clone)] +enum SplitDebuginfo { + /// `-C split-debuginfo=off`. Default for platforms with ELF binaries and windows-gnu (not + /// Windows MSVC and not macOS). Typically DWARF debug information can be found in the final + /// artifact in sections of the executable. + /// + /// - Not supported on Windows MSVC. + /// - On macOS this options prevents the final execution of `dsymutil` to generate debuginfo. + Off, + /// `-C split-debuginfo=unpacked`. Debug information will be found in separate files for each + /// compilation unit (object file). + /// + /// - Not supported on Windows MSVC. + /// - On macOS this means the original object files will contain debug information. + /// - On other Unix platforms this means that `*.dwo` files will contain debug information. + Unpacked, + /// `-C split-debuginfo=packed`. Default for Windows MSVC and macOS. "Packed" here means that + /// all the debug information is packed into a separate file from the main executable. + /// + /// - On Windows MSVC this is a `*.pdb` file. + /// - On macOS this is a `*.dSYM` folder. + /// - On other platforms this is a `*.dwp` file. + Packed, + /// The cli flag is not explicitly provided; uses platform default. + Unspecified, +} + +impl SplitDebuginfo { + fn cli_value(&self) -> &'static str { + // `-Csplit-debuginfo=...` + match self { + SplitDebuginfo::Off => "off", + SplitDebuginfo::Unpacked => "unpacked", + SplitDebuginfo::Packed => "packed", + SplitDebuginfo::Unspecified => unreachable!(), + } + } +} + +/// `-Z split-dwarf-kind` +#[derive(Debug, PartialEq, Copy, Clone)] +enum SplitDwarfKind { + /// `-Zsplit-dwarf-kind=split` + Split, + /// `-Zsplit-dwarf-kind=single` + Single, + Unspecified, +} + +impl SplitDwarfKind { + fn cli_value(&self) -> &'static str { + // `-Zsplit-dwarf-kind=...` + match self { + SplitDwarfKind::Split => "split", + SplitDwarfKind::Single => "single", + SplitDwarfKind::Unspecified => unreachable!(), + } + } +} + +/// `-C linker-plugin-lto` +#[derive(Debug, PartialEq, Copy, Clone)] +enum LinkerPluginLto { + /// Pass `-C linker-plugin-lto`. + Yes, + /// Don't pass `-C linker-plugin-lto`. + Unspecified, +} + +/// `--remap-path-prefix` or not. +#[derive(Debug, Clone)] +enum RemapPathPrefix { + /// `--remap-path-prefix=$prefix=$remapped_prefix`. + Yes { remapped_prefix: &'static str }, + /// Don't pass `--remap-path-prefix`. + Unspecified, +} + +/// `-Zremap-path-scope`. See +/// <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/remap-path-scope.html#remap-path-scope>. +#[derive(Debug, Clone)] +enum RemapPathScope { + /// Comma-separated list of remap scopes: `macro`, `diagnostics`, `debuginfo`, `object`, `all`. + Yes(&'static str), + Unspecified, +} + +/// Whether to pass `-Zunstable-options`. +#[derive(Debug, PartialEq, Copy, Clone)] +enum UnstableOptions { + Yes, + Unspecified, +} + +#[track_caller] +fn cwd_filenames() -> BTreeSet<String> { + let files = shallow_find_files(cwd(), |path| { + // Fiilter out source files + !has_extension(path, "rs") + }); + files.iter().map(|p| p.file_name().unwrap().to_os_string().into_string().unwrap()).collect() +} + +#[track_caller] +fn cwd_dwo_filenames() -> BTreeSet<String> { + let files = shallow_find_files(cwd(), |path| has_extension(path, "dwo")); + files.iter().map(|p| p.file_name().unwrap().to_os_string().into_string().unwrap()).collect() +} + +#[track_caller] +fn cwd_object_filenames() -> BTreeSet<String> { + let files = shallow_find_files(cwd(), |path| has_extension(path, "o")); + files.iter().map(|p| p.file_name().unwrap().to_os_string().into_string().unwrap()).collect() +} + +#[must_use] +struct FileAssertions<'expected> { + expected_files: BTreeSet<&'expected str>, +} + +impl<'expected> FileAssertions<'expected> { + #[track_caller] + fn assert_on(self, found_files: &BTreeSet<String>) { + let found_files: BTreeSet<_> = found_files.iter().map(|f| f.as_str()).collect(); + assert!( + found_files.is_superset(&self.expected_files), + "expected {:?} to exist, but only found {:?}", + self.expected_files, + found_files + ); + + let unexpected_files: BTreeSet<_> = + found_files.difference(&self.expected_files).copied().collect(); + assert!(unexpected_files.is_empty(), "found unexpected files: {:?}", unexpected_files); + } +} + +/// Windows MSVC only supports packed debuginfo. +mod windows_msvc_tests { + use super::*; + + pub(crate) fn split_debuginfo(split_kind: SplitDebuginfo, level: DebuginfoLevel) { + // NOTE: `-C debuginfo` and other flags are not exercised here on Windows MSVC. + run_in_tmpdir(|| { + println!("checking: split_kind={:?} + level={:?}", split_kind, level); + match (split_kind, level) { + (SplitDebuginfo::Off, _) => { + rustc() + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .run_fail() + .assert_stderr_contains( + "error: `-Csplit-debuginfo=off` is unstable on this platform", + ); + } + (SplitDebuginfo::Unpacked, _) => { + rustc() + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .run_fail() + .assert_stderr_contains( + "error: `-Csplit-debuginfo=unpacked` is unstable on this platform", + ); + } + (SplitDebuginfo::Packed, _) => { + rustc().input("foo.rs").split_debuginfo(split_kind.cli_value()).run(); + + let found_files = cwd_filenames(); + FileAssertions { expected_files: BTreeSet::from(["foo.exe", "foo.pdb"]) } + .assert_on(&found_files); + } + (split_kind, level) => { + panic!( + "split_kind={:?} + level={:?} is not handled on Windows MSVC", + split_kind, level + ) + } + } + }); + } +} + +mod darwin_tests { + use super::*; + + pub(crate) fn split_debuginfo(split_kind: SplitDebuginfo, level: DebuginfoLevel) { + run_in_tmpdir(|| { + println!("checking: split_kind={:?} + level={:?}", split_kind, level); + + let dsym_directories = + || shallow_find_directories(cwd(), |path| has_extension(path, "dSYM")); + + match (split_kind, level) { + (_, DebuginfoLevel::Unspecified) => { + rustc().input("foo.rs").run(); + let directories = + shallow_find_directories(cwd(), |path| has_extension(path, "dSYM")); + assert!( + directories.is_empty(), + "expected no `*.dSYM` folder to be generated when `-Cdebuginfo` is not specified" + ); + } + (_, DebuginfoLevel::None) => { + rustc().input("foo.rs").debuginfo(level.cli_value()).run(); + let directories = dsym_directories(); + assert!( + directories.is_empty(), + "expected no `*.dSYM` folder to be generated when `-Cdebuginfo=none`" + ); + } + (SplitDebuginfo::Off, _) => { + rustc() + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .run(); + let directories = dsym_directories(); + assert!( + directories.is_empty(), + "expected no `*.dSYM` folder to be generated since we expect `-Csplit-debuginfo=off` to inhibit final debuginfo generation on macOS" + ); + } + (SplitDebuginfo::Unpacked, _) => { + rustc().input("foo.rs").split_debuginfo(split_kind.cli_value()).run(); + let directories = dsym_directories(); + assert!( + directories.is_empty(), + "expected no `*.dSYM` folder to be generated since we expect on macOS the object files to contain debuginfo instead" + ); + } + (SplitDebuginfo::Packed, DebuginfoLevel::Full) => { + rustc() + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .run(); + let directories = shallow_find_directories(cwd(), |path| { + path.file_name().unwrap() == "foo.dSYM" + }); + assert_eq!(directories.len(), 1, "failed to find `foo.dSYM`"); + } + (SplitDebuginfo::Unspecified, DebuginfoLevel::Full) => { + rustc().input("foo.rs").debuginfo(level.cli_value()).run(); + let directories = shallow_find_directories(cwd(), |path| { + path.file_name().unwrap() == "foo.dSYM" + }); + assert_eq!(directories.len(), 1, "failed to find `foo.dSYM`"); + } + } + }); + } +} + +mod shared_linux_other_tests { + use std::path::PathBuf; + + use super::*; + + fn rustc(unstable_options: UnstableOptions) -> Rustc { + if unstable_options == UnstableOptions::Yes { + let mut rustc = run_make_support::rustc(); + rustc.arg("-Zunstable-options"); + rustc + } else { + run_make_support::rustc() + } + } + + #[derive(PartialEq)] + pub(crate) enum CrossCrateTest { + Yes, + No, + } + + pub(crate) fn split_debuginfo( + cross_crate_test: CrossCrateTest, + unstable_options: UnstableOptions, + split_kind: SplitDebuginfo, + level: DebuginfoLevel, + split_dwarf_kind: SplitDwarfKind, + lto: LinkerPluginLto, + remap_path_prefix: RemapPathPrefix, + remap_path_scope: RemapPathScope, + ) { + run_in_tmpdir(|| { + println!( + "checking: unstable_options={:?} + split_kind={:?} + level={:?} + split_dwarf_kind={:?} + lto={:?} + remap_path_prefix={:?} + remap_path_scope={:?}", + unstable_options, + split_kind, + level, + split_dwarf_kind, + lto, + remap_path_prefix, + remap_path_scope + ); + + match cross_crate_test { + CrossCrateTest::Yes => cross_crate_split_debuginfo( + unstable_options, + split_kind, + level, + split_dwarf_kind, + lto, + remap_path_prefix, + remap_path_scope, + ), + CrossCrateTest::No => simple_split_debuginfo( + unstable_options, + split_kind, + level, + split_dwarf_kind, + lto, + remap_path_prefix, + remap_path_scope, + ), + } + }); + } + + fn cross_crate_split_debuginfo( + unstable_options: UnstableOptions, + split_kind: SplitDebuginfo, + level: DebuginfoLevel, + split_dwarf_kind: SplitDwarfKind, + lto: LinkerPluginLto, + remap_path_prefix: RemapPathPrefix, + remap_path_scope: RemapPathScope, + ) { + match (split_kind, level, split_dwarf_kind, lto, remap_path_prefix, remap_path_scope) { + // packed-crosscrate-split + // - Debuginfo in `.dwo` files + // - (bar) `.rlib` file created, contains `.dwo` + // - (bar) `.o` deleted + // - (bar) `.dwo` deleted + // - (bar) `.dwp` never created + // - (main) `.o` deleted + // - (main) `.dwo` deleted + // - (main) `.dwp` present + ( + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("bar.rs") + .crate_type("lib") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .run(); + + let found_files = cwd_filenames(); + FileAssertions { expected_files: BTreeSet::from(["libbar.rlib"]) } + .assert_on(&found_files); + + rustc(unstable_options) + .extern_("bar", "libbar.rlib") + .input("main.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .run(); + + let found_files = cwd_filenames(); + FileAssertions { + expected_files: BTreeSet::from(["libbar.rlib", "main", "main.dwp"]), + } + .assert_on(&found_files); + } + + // packed-crosscrate-single + // - Debuginfo in `.o` files + // - (bar) `.rlib` file created, contains `.o` + // - (bar) `.o` deleted + // - (bar) `.dwo` never created + // - (bar) `.dwp` never created + // - (main) `.o` deleted + // - (main) `.dwo` never created + // - (main) `.dwp` present + ( + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("bar.rs") + .crate_type("lib") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .run(); + + let found_files = cwd_filenames(); + FileAssertions { expected_files: BTreeSet::from(["libbar.rlib"]) } + .assert_on(&found_files); + + rustc(unstable_options) + .extern_("bar", "libbar.rlib") + .input("main.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .run(); + + let found_files = cwd_filenames(); + FileAssertions { + expected_files: BTreeSet::from(["libbar.rlib", "main", "main.dwp"]), + } + .assert_on(&found_files); + } + + // unpacked-crosscrate-split + // - Debuginfo in `.dwo` files + // - (bar) `.rlib` file created, contains `.dwo` + // - (bar) `.o` deleted + // - (bar) `.dwo` present + // - (bar) `.dwp` never created + // - (main) `.o` deleted + // - (main) `.dwo` present + // - (main) `.dwp` never created + ( + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("bar.rs") + .crate_type("lib") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .run(); + + let bar_found_files = cwd_filenames(); + + let bar_dwo_files = cwd_dwo_filenames(); + assert_eq!(bar_dwo_files.len(), 1); + + let mut bar_expected_files = BTreeSet::new(); + bar_expected_files.extend(bar_dwo_files); + bar_expected_files.insert("libbar.rlib".to_string()); + + FileAssertions { + expected_files: bar_expected_files.iter().map(String::as_ref).collect(), + } + .assert_on(&bar_found_files); + + rustc(unstable_options) + .extern_("bar", "libbar.rlib") + .input("main.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .run(); + + let overall_found_files = cwd_filenames(); + + let overall_dwo_files = cwd_dwo_filenames(); + assert_eq!(overall_dwo_files.len(), 2); + + let mut overall_expected_files = BTreeSet::new(); + overall_expected_files.extend(overall_dwo_files); + overall_expected_files.insert("main".to_string()); + overall_expected_files.insert("libbar.rlib".to_string()); + + FileAssertions { + expected_files: overall_expected_files.iter().map(String::as_ref).collect(), + } + .assert_on(&overall_found_files); + } + + // unpacked-crosscrate-single + // - Debuginfo in `.o` files + // - (bar) `.rlib` file created, contains `.o` + // - (bar) `.o` present + // - (bar) `.dwo` never created + // - (bar) `.dwp` never created + // - (main) `.o` present + // - (main) `.dwo` never created + // - (main) `.dwp` never created + ( + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("bar.rs") + .crate_type("lib") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .run(); + + let bar_found_files = cwd_filenames(); + + let bar_object_files = cwd_object_filenames(); + assert_eq!(bar_object_files.len(), 1); + + let mut bar_expected_files = BTreeSet::new(); + bar_expected_files.extend(bar_object_files); + bar_expected_files.insert("libbar.rlib".to_string()); + + FileAssertions { + expected_files: bar_expected_files.iter().map(String::as_ref).collect(), + } + .assert_on(&bar_found_files); + + rustc(unstable_options) + .extern_("bar", "libbar.rlib") + .input("main.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .run(); + + let overall_found_files = cwd_filenames(); + + let overall_object_files = cwd_object_filenames(); + assert_eq!(overall_object_files.len(), 2); + + let mut overall_expected_files = BTreeSet::new(); + overall_expected_files.extend(overall_object_files); + overall_expected_files.insert("main".to_string()); + overall_expected_files.insert("libbar.rlib".to_string()); + + FileAssertions { + expected_files: overall_expected_files.iter().map(String::as_ref).collect(), + } + .assert_on(&overall_found_files); + } + + _ => {} + } + } + + fn simple_split_debuginfo( + unstable_options: UnstableOptions, + split_kind: SplitDebuginfo, + level: DebuginfoLevel, + split_dwarf_kind: SplitDwarfKind, + lto: LinkerPluginLto, + remap_path_prefix: RemapPathPrefix, + remap_path_scope: RemapPathScope, + ) { + match (split_kind, level, split_dwarf_kind, lto, remap_path_prefix, remap_path_scope) { + // off (unspecified): + // - Debuginfo in `.o` files + // - `.o` deleted + // - `.dwo` never created + // - `.dwp` never created + ( + SplitDebuginfo::Unspecified, + DebuginfoLevel::Full, + SplitDwarfKind::Unspecified, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options).input("foo.rs").debuginfo(level.cli_value()).run(); + let found_files = cwd_filenames(); + FileAssertions { expected_files: BTreeSet::from(["foo"]) }.assert_on(&found_files); + } + + // off: + // - Debuginfo in `.o` files + // - `.o` deleted + // - `.dwo` never created + // - `.dwp` never created + ( + SplitDebuginfo::Off, + DebuginfoLevel::Full, + SplitDwarfKind::Unspecified, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .run(); + let found_files = cwd_filenames(); + FileAssertions { expected_files: BTreeSet::from(["foo"]) }.assert_on(&found_files); + } + + // packed-split: + // - Debuginfo in `.dwo` files + // - `.o` deleted + // - `.dwo` deleted + // - `.dwp` present + ( + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .run(); + let found_files = cwd_filenames(); + FileAssertions { expected_files: BTreeSet::from(["foo", "foo.dwp"]) } + .assert_on(&found_files); + } + + // packed-single: + // - Debuginfo in `.o` files + // - `.o` deleted + // - `.dwo` never created + // - `.dwp` present + ( + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .run(); + let found_files = cwd_filenames(); + FileAssertions { expected_files: BTreeSet::from(["foo", "foo.dwp"]) } + .assert_on(&found_files); + } + + // packed-lto-split:: + // - `rmeta` file added to `rlib`, no object files are generated and thus no + // debuginfo is generated. + // - `.o` never created + // - `.dwo` never created + // - `.dwp` never created + ( + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Yes, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("baz.rs") + .crate_type("rlib") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .arg("-Clinker-plugin-lto") + .run(); + let found_files = cwd_filenames(); + FileAssertions { expected_files: BTreeSet::from(["libbaz.rlib"]) } + .assert_on(&found_files); + } + + // packed-lto-single: + // - `rmeta` file added to `rlib`, no object files are generated and thus no + // debuginfo is generated + // - `.o` never created + // - `.dwo` never created + // - `.dwp` never created + ( + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Yes, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("baz.rs") + .crate_type("rlib") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .arg("-Clinker-plugin-lto") + .run(); + let found_files = cwd_filenames(); + FileAssertions { expected_files: BTreeSet::from(["libbaz.rlib"]) } + .assert_on(&found_files); + } + + // packed-remapped-split: + // - Debuginfo in `.dwo` files + // - `.o` and binary refer to remapped `.dwo` paths which do not exist + // - `.o` deleted + // - `.dwo` deleted + // - `.dwp` present + ( + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix }, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .remap_path_prefix(cwd(), remapped_prefix) + .run(); + let found_files = cwd_filenames(); + FileAssertions { expected_files: BTreeSet::from(["foo", "foo.dwp"]) } + .assert_on(&found_files); + + check_path_remap(cwd(), RemapExpectation::Remapped); + } + + // packed-remapped-single: + // - `.o` and binary refer to remapped `.o` paths which do not exist + // - `.o` deleted + // - `.dwo` never created + // - `.dwp` present + ( + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix }, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .remap_path_prefix(cwd(), remapped_prefix) + .run(); + let found_files = cwd_filenames(); + FileAssertions { expected_files: BTreeSet::from(["foo", "foo.dwp"]) } + .assert_on(&found_files); + + check_path_remap(cwd(), RemapExpectation::Remapped); + } + + // packed-remapped-scope: + // - Debuginfo in `.o` files + // - `.o` and binary refer to remapped `.o` paths which do not exist + // - `.o` deleted + // - `.dwo` never created + // - `.dwp` present + ( + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix }, + RemapPathScope::Yes(scope @ "debuginfo"), + ) => { + rustc(unstable_options) + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .remap_path_prefix(cwd(), remapped_prefix) + .arg(format!("-Zremap-path-scope={scope}")) + .run(); + let found_files = cwd_filenames(); + FileAssertions { expected_files: BTreeSet::from(["foo", "foo.dwp"]) } + .assert_on(&found_files); + + check_path_remap(cwd(), RemapExpectation::Remapped); + } + + // packed-remapped-wrong-scope: + // - `.o` and binary refer to un-remapped `.o` paths because remap path scope is + // macro. + // - `.o` deleted + // - `.dwo` never created + // - `.dwp` present + ( + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix }, + RemapPathScope::Yes(scope @ "macro"), + ) => { + rustc(unstable_options) + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .remap_path_prefix(cwd(), remapped_prefix) + .arg(format!("-Zremap-path-scope={scope}")) + .run(); + let found_files = cwd_filenames(); + FileAssertions { expected_files: BTreeSet::from(["foo", "foo.dwp"]) } + .assert_on(&found_files); + + check_path_remap(cwd(), RemapExpectation::NoRemap); + } + + // unpacked-split + // - Debuginfo in `.dwo` files + // - `.o` deleted + // - `.dwo` present + // - `.dwp` never created + ( + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .run(); + let found_files = cwd_filenames(); + + let dwo_files = cwd_dwo_filenames(); + assert_eq!(dwo_files.len(), 1); + + let mut expected_files = BTreeSet::new(); + expected_files.extend(dwo_files); + expected_files.insert("foo".to_string()); + + FileAssertions { + expected_files: expected_files.iter().map(String::as_str).collect(), + } + .assert_on(&found_files); + } + + // unpacked-single + // - Debuginfo in `.o` files + // - `.o` present + // - `.dwo` never created + // - `.dwp` never created + ( + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .run(); + let found_files = cwd_filenames(); + + let object_files = cwd_object_filenames(); + assert_eq!(object_files.len(), 1); + + let mut expected_files = BTreeSet::new(); + expected_files.extend(object_files); + expected_files.insert("foo".to_string()); + + FileAssertions { + expected_files: expected_files.iter().map(String::as_str).collect(), + } + .assert_on(&found_files); + } + + // unpacked-lto-split + // - `rmeta` file added to `rlib`, no object files are generated and thus no debuginfo + // is generated + // - `.o` not present + // - `.dwo` never created + // - `.dwp` never created + ( + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Yes, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("baz.rs") + .crate_type("rlib") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .arg("-Clinker-plugin-lto") + .run(); + + let found_files = cwd_filenames(); + + FileAssertions { expected_files: BTreeSet::from(["libbaz.rlib"]) } + .assert_on(&found_files); + } + + // unpacked-lto-single + // - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated + // - `.o` present (bitcode) + // - `.dwo` never created + // - `.dwp` never created + ( + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Yes, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("baz.rs") + .crate_type("rlib") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .arg("-Clinker-plugin-lto") + .run(); + + let found_files = cwd_filenames(); + + let object_files = cwd_object_filenames(); + assert_eq!(object_files.len(), 1); + + let mut expected_files = BTreeSet::new(); + expected_files.extend(object_files); + expected_files.insert("libbaz.rlib".to_string()); + + FileAssertions { + expected_files: expected_files.iter().map(String::as_ref).collect(), + } + .assert_on(&found_files); + } + + // unpacked-remapped-split + // - Debuginfo in `.dwo` files + // - `.o` and binary refer to remapped `.dwo` paths which do not exist + // - `.o` deleted + // - `.dwo` present + // - `.dwp` never created + ( + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix }, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .remap_path_prefix(cwd(), remapped_prefix) + .run(); + + let found_files = cwd_filenames(); + + let dwo_files = cwd_dwo_filenames(); + assert_eq!(dwo_files.len(), 1); + + let mut expected_files = BTreeSet::new(); + expected_files.extend(dwo_files); + expected_files.insert("foo".to_string()); + + FileAssertions { + expected_files: expected_files.iter().map(String::as_ref).collect(), + } + .assert_on(&found_files); + + check_path_remap(cwd(), RemapExpectation::Remapped); + } + + // unpacked-remapped-single + // - Debuginfo in `.o` files + // - `.o` and binary refer to remapped `.o` paths which do not exist + // - `.o` present + // - `.dwo` never created + // - `.dwp` never created + ( + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix }, + RemapPathScope::Unspecified, + ) => { + rustc(unstable_options) + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .remap_path_prefix(cwd(), remapped_prefix) + .run(); + + let found_files = cwd_filenames(); + + let object_files = cwd_object_filenames(); + assert_eq!(object_files.len(), 1); + + let mut expected_files = BTreeSet::new(); + expected_files.extend(object_files); + expected_files.insert("foo".to_string()); + + FileAssertions { + expected_files: expected_files.iter().map(String::as_ref).collect(), + } + .assert_on(&found_files); + + check_path_remap(cwd(), RemapExpectation::Remapped); + } + + // unpacked-remapped-scope + // - Debuginfo in `.o` files + // - `.o` and binary refer to remapped `.o` paths which do not exist + // - `.o` present + // - `.dwo` never created + // - `.dwp` never created + ( + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix }, + RemapPathScope::Yes(scope @ "debuginfo"), + ) => { + rustc(unstable_options) + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .remap_path_prefix(cwd(), remapped_prefix) + .arg(format!("-Zremap-path-scope={scope}")) + .run(); + + let found_files = cwd_filenames(); + + let object_files = cwd_object_filenames(); + assert_eq!(object_files.len(), 1); + + let mut expected_files = BTreeSet::new(); + expected_files.extend(object_files); + expected_files.insert("foo".to_string()); + + FileAssertions { + expected_files: expected_files.iter().map(String::as_ref).collect(), + } + .assert_on(&found_files); + + check_path_remap(cwd(), RemapExpectation::Remapped); + } + + // unpacked-remapped-wrong-scope + // - Debuginfo in `.o` files + // - `.o` and binary refer to un-remapped `.o` paths because remap path scope is macro + // - `.o` present + // - `.dwo` never created + // - `.dwp` never created + ( + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix }, + RemapPathScope::Yes(scope @ "macro"), + ) => { + rustc(unstable_options) + .input("foo.rs") + .split_debuginfo(split_kind.cli_value()) + .debuginfo(level.cli_value()) + .arg(format!("-Zsplit-dwarf-kind={}", split_dwarf_kind.cli_value())) + .remap_path_prefix(cwd(), remapped_prefix) + .arg(format!("-Zremap-path-scope={scope}")) + .run(); + + let found_files = cwd_filenames(); + + let object_files = cwd_object_filenames(); + assert_eq!(object_files.len(), 1); + + let mut expected_files = BTreeSet::new(); + expected_files.extend(object_files); + expected_files.insert("foo".to_string()); + + FileAssertions { + expected_files: expected_files.iter().map(String::as_ref).collect(), + } + .assert_on(&found_files); + + check_path_remap(cwd(), RemapExpectation::NoRemap); + } + + (split_kind, level, split_dwarf_kind, lto, remap_path_prefix, remap_path_scope) => { + panic!( + "split_kind={:?} + level={:?} + split_dwarf_kind={:?} + lto={:?} + remap_path_prefix={:?} + remap_path_scope={:?} is not handled on linux/other", + split_kind, level, split_dwarf_kind, lto, remap_path_prefix, remap_path_scope + ) + } + } + } + + #[derive(PartialEq)] + enum RemapExpectation { + Remapped, + NoRemap, + } + + #[track_caller] + fn check_path_remap(cwd_path: PathBuf, remap_expectation: RemapExpectation) { + let cwd_path = cwd_path.to_str().unwrap(); + let output = llvm_dwarfdump().input("foo").arg("--debug-info").run().stdout_utf8(); + let output_lines: Vec<_> = output.lines().collect(); + + // Look for `DW_AT_comp_dir` and `DW_AT_GNU_dwo_name` via `llvm-dwarfdump`. Note: space + // between uses tabs. + // + // ```text + // 0x0000000b: DW_TAG_compile_unit + // DW_AT_stmt_list (0x00000000) + // DW_AT_comp_dir ("/__MY_REMAPPED_PATH") # this could be e.g. /home/repos/rust/ if not remapped + // DW_AT_GNU_dwo_name ("foo.foo.fc848df41df7a00d-cgu.0.rcgu.dwo") + // ``` + // + // FIXME: this is very fragile because the output format can be load-bearing, but doing this + // via `object` + `gimli` is rather difficult. + let mut window = output_lines.windows(2); + while let Some([first_ln, second_ln]) = window.next() { + let first_ln = first_ln.trim(); + let second_ln = second_ln.trim(); + + if !second_ln.starts_with("DW_AT_GNU_dwo_name") { + continue; + } + + let Some((comp_dir_attr_name, comp_dir_attr_val)) = first_ln.split_once("\t") else { + continue; + }; + + println!("comp_dir_attr_name: `{}`", comp_dir_attr_name); + println!("cwd_path_string: `{}`", cwd_path); + + if comp_dir_attr_name != "DW_AT_comp_dir" { + continue; + } + + println!("comp_dir_attr_val: `{}`", comp_dir_attr_val); + + // Possibly `("/__MY_REMAPPED_PATH")` or `($cwd_path_string)`. + // + // FIXME: this check is insufficiently precise, it should probably also match on suffix + // (`.o` vs `.dwo` reference). But also, string matching is just very fragile. + let comp_dir_attr_val = comp_dir_attr_val.trim(); + + match remap_expectation { + RemapExpectation::Remapped => { + assert!( + !comp_dir_attr_val.contains(&cwd_path), + "unexpected non-remapped path found in `DW_AT_comp_dir`: {}", + comp_dir_attr_val + ); + } + RemapExpectation::NoRemap => { + assert!( + comp_dir_attr_val.contains(&cwd_path), + "failed to find un-remapped path in `DW_AT_comp_dir`: {}", + comp_dir_attr_val + ); + } + } + } + } +} + +fn main() { + // ENHANCEMENT: we are only checking that split-debuginfo is splitting is some way, shape or + // form, we do not sanity check the actual debuginfo artifacts on non-Linux! It may be possible + // to also sanity check the debuginfo artifacts, but I did not want to do that during the port + // to rmake.rs initially. + + // ENHANCEMENT: the Linux checks have significantly more coverage for interaction between `-C + // split-debuginfo` and other flags compared to windows-msvc or windows-gnu or darwin or some + // other non-linux targets. It would be cool if their test coverage could be improved. + + // NOTE: these combinations are not exhaustive, because while porting to rmake.rs initially I + // tried to preserve the existing test behavior closely. Notably, no attempt was made to + // exhaustively cover all cases in the 6-fold Cartesian product of `{,-Csplit=debuginfo=...}` x + // `{,-Cdebuginfo=...}` x `{,--remap-path-prefix}` x `{,-Zremap-path-scope=...}` x + // `{,-Zsplit-dwarf-kind=...}` x `{,-Clinker-plugin-lto}`. If you really want to, you can + // identify which combination isn't exercised with a 6-layers nested for loop iterating through + // each of the cli flag enum variants. + + if is_msvc() { + // FIXME: the windows-msvc test coverage is sparse at best. + + windows_msvc_tests::split_debuginfo(SplitDebuginfo::Off, DebuginfoLevel::Unspecified); + windows_msvc_tests::split_debuginfo(SplitDebuginfo::Unpacked, DebuginfoLevel::Unspecified); + windows_msvc_tests::split_debuginfo(SplitDebuginfo::Packed, DebuginfoLevel::Unspecified); + + windows_msvc_tests::split_debuginfo(SplitDebuginfo::Off, DebuginfoLevel::None); + windows_msvc_tests::split_debuginfo(SplitDebuginfo::Unpacked, DebuginfoLevel::None); + windows_msvc_tests::split_debuginfo(SplitDebuginfo::Packed, DebuginfoLevel::None); + + windows_msvc_tests::split_debuginfo(SplitDebuginfo::Off, DebuginfoLevel::Full); + windows_msvc_tests::split_debuginfo(SplitDebuginfo::Unpacked, DebuginfoLevel::Full); + windows_msvc_tests::split_debuginfo(SplitDebuginfo::Packed, DebuginfoLevel::Full); + } else if is_windows() { + // FIXME(#135531): the `Makefile` version didn't test windows at all. I don't know about the + // intended behavior on windows-gnu to expand test coverage while porting this to rmake.rs, + // but the test coverage here really should be expanded since some windows-gnu targets are + // Tier 1. + } else if is_darwin() { + // FIXME: the darwin test coverage is sparse at best. + + // Expect no `.dSYM` generation if debuginfo is not requested (special case). + darwin_tests::split_debuginfo(SplitDebuginfo::Unspecified, DebuginfoLevel::Unspecified); + + darwin_tests::split_debuginfo(SplitDebuginfo::Off, DebuginfoLevel::Unspecified); + darwin_tests::split_debuginfo(SplitDebuginfo::Unpacked, DebuginfoLevel::Unspecified); + darwin_tests::split_debuginfo(SplitDebuginfo::Packed, DebuginfoLevel::Unspecified); + + darwin_tests::split_debuginfo(SplitDebuginfo::Off, DebuginfoLevel::None); + darwin_tests::split_debuginfo(SplitDebuginfo::Unpacked, DebuginfoLevel::None); + darwin_tests::split_debuginfo(SplitDebuginfo::Packed, DebuginfoLevel::None); + + darwin_tests::split_debuginfo(SplitDebuginfo::Off, DebuginfoLevel::Full); + darwin_tests::split_debuginfo(SplitDebuginfo::Unpacked, DebuginfoLevel::Full); + darwin_tests::split_debuginfo(SplitDebuginfo::Packed, DebuginfoLevel::Full); + } else { + // Unix as well as the non-linux + non-windows + non-darwin targets. + + // FIXME: this `uname` check is very funny, it really should be refined (e.g. llvm bug + // <https://github.com/llvm/llvm-project/issues/56642> for riscv64 targets). + + // NOTE: some options are not stable on non-linux + non-windows + non-darwin targets... + let unstable_options = + if uname() == "Linux" { UnstableOptions::Unspecified } else { UnstableOptions::Yes }; + + // FIXME: we should add a test with scope `split-debuginfo,split-debuginfo-path` that greps + // the entire `.dwp` file for remapped paths (i.e. without going through objdump or + // readelf). See <https://github.com/rust-lang/rust/pull/118518#discussion_r1452180392>. + + use shared_linux_other_tests::CrossCrateTest; + + // unspecified `-Csplit-debuginfo` + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Unspecified, + DebuginfoLevel::Full, + SplitDwarfKind::Unspecified, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + + // off + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Off, + DebuginfoLevel::Full, + SplitDwarfKind::Unspecified, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + + // packed-split + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + + // packed-single + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + + // packed-lto-split + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Yes, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + + // packed-lto-single + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Yes, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + + // FIXME: the remapping tests probably need to be reworked, see + // <https://github.com/rust-lang/rust/pull/118518#discussion_r1452174338>. + + // packed-remapped-split + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix: "/__MY_REMAPPED_PATH__" }, + RemapPathScope::Unspecified, + ); + + // packed-remapped-single + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix: "/__MY_REMAPPED_PATH__" }, + RemapPathScope::Unspecified, + ); + + // packed-remapped-scope + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix: "/__MY_REMAPPED_PATH__" }, + RemapPathScope::Yes("debuginfo"), + ); + + // packed-remapped-wrong-scope + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix: "/__MY_REMAPPED_PATH__" }, + RemapPathScope::Yes("macro"), + ); + + // packed-crosscrate-split + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::Yes, + unstable_options, + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + + // packed-crosscrate-single + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::Yes, + unstable_options, + SplitDebuginfo::Packed, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + + // unpacked-split + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + + // unpacked-single + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + + // unpacked-lto-split + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Yes, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + + // unpacked-lto-single + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Yes, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + + // unpacked-remapped-split + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix: "/__MY_REMAPPED_PATH__" }, + RemapPathScope::Unspecified, + ); + + // unpacked-remapped-single + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix: "/__MY_REMAPPED_PATH__" }, + RemapPathScope::Unspecified, + ); + + // unpacked-remapped-scope + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix: "/__MY_REMAPPED_PATH__" }, + RemapPathScope::Yes("debuginfo"), + ); + + // unpacked-remapped-wrong-scope + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::No, + unstable_options, + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Yes { remapped_prefix: "/__MY_REMAPPED_PATH__" }, + RemapPathScope::Yes("macro"), + ); + + // unpacked-crosscrate-split + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::Yes, + unstable_options, + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Split, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + + // unpacked-crosscrate-single + shared_linux_other_tests::split_debuginfo( + CrossCrateTest::Yes, + unstable_options, + SplitDebuginfo::Unpacked, + DebuginfoLevel::Full, + SplitDwarfKind::Single, + LinkerPluginLto::Unspecified, + RemapPathPrefix::Unspecified, + RemapPathScope::Unspecified, + ); + } +} diff --git a/tests/run-make/symbol-mangling-hashed/Makefile b/tests/run-make/symbol-mangling-hashed/Makefile deleted file mode 100644 index c95036ead95..00000000000 --- a/tests/run-make/symbol-mangling-hashed/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -include ../tools.mk - -# ignore-cross-compile -# only-linux -# only-x86_64 - -NM=nm -D -RLIB_NAME=liba_rlib.rlib -DYLIB_NAME=liba_dylib.so -SO_NAME=libb_dylib.so -BIN_NAME=b_bin - -ifeq ($(UNAME),Darwin) -NM=nm -gU -RLIB_NAME=liba_rlib.rlib -DYLIB_NAME=liba_dylib.dylib -SO_NAME=libb_dylib.dylib -BIN_NAME=b_bin -endif - -ifdef IS_WINDOWS -NM=nm -g -RLIB_NAME=liba_rlib.dll.a -DYLIB_NAME=liba_dylib.dll -SO_NAME=libb_dylib.dll -BIN_NAME=b_bin.exe -endif - -all: - $(RUSTC) -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=hashed -C metadata=foo a_dylib.rs - $(RUSTC) -C prefer-dynamic -Z unstable-options -C symbol-mangling-version=hashed -C metadata=bar a_rlib.rs - $(RUSTC) -C prefer-dynamic -L $(TMPDIR) b_dylib.rs - $(RUSTC) -C prefer-dynamic -L $(TMPDIR) b_bin.rs - - # Check hashed symbol name - - [ "$$($(NM) $(TMPDIR)/$(DYLIB_NAME) | grep -c hello)" -eq "0" ] - [ "$$($(NM) $(TMPDIR)/$(DYLIB_NAME) | grep _RNxC7a_dylib | grep -c ' T ')" -eq "2" ] - - [ "$$($(NM) $(TMPDIR)/$(SO_NAME) | grep b_dylib | grep -c hello)" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(SO_NAME) | grep _RNxC6a_rlib | grep -c ' T ')" -eq "2" ] - [ "$$($(NM) $(TMPDIR)/$(SO_NAME) | grep _RNxC7a_dylib | grep -c ' U ')" -eq "1" ] - - [ "$$($(NM) $(TMPDIR)/$(BIN_NAME) | grep _RNxC6a_rlib | grep -c ' U ')" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(BIN_NAME) | grep _RNxC7a_dylib | grep -c ' U ')" -eq "1" ] - [ "$$($(NM) $(TMPDIR)/$(BIN_NAME) | grep b_dylib | grep hello | grep -c ' U ')" -eq "1" ] - - $(call RUN,$(BIN_NAME)) diff --git a/tests/run-make/symbol-mangling-hashed/b_bin.rs b/tests/run-make/symbol-mangling-hashed/b_bin.rs deleted file mode 100644 index 8ee7fecda62..00000000000 --- a/tests/run-make/symbol-mangling-hashed/b_bin.rs +++ /dev/null @@ -1,9 +0,0 @@ -extern crate a_dylib; -extern crate a_rlib; -extern crate b_dylib; - -fn main() { - a_rlib::hello(); - a_dylib::hello(); - b_dylib::hello(); -} diff --git a/tests/run-make/symbol-mangling-hashed/b_dylib.rs b/tests/run-make/symbol-mangling-hashed/b_dylib.rs deleted file mode 100644 index 3252c9c75c2..00000000000 --- a/tests/run-make/symbol-mangling-hashed/b_dylib.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_type = "dylib"] - -extern crate a_dylib; -extern crate a_rlib; - -pub fn hello() { - a_rlib::hello(); - a_dylib::hello(); -} diff --git a/tests/run-make/symbol-mangling-hashed/default_bin.rs b/tests/run-make/symbol-mangling-hashed/default_bin.rs new file mode 100644 index 00000000000..387596705c3 --- /dev/null +++ b/tests/run-make/symbol-mangling-hashed/default_bin.rs @@ -0,0 +1,9 @@ +extern crate default_dylib; +extern crate hashed_dylib; +extern crate hashed_rlib; + +fn main() { + hashed_rlib::hrhello(); + hashed_dylib::hdhello(); + default_dylib::ddhello(); +} diff --git a/tests/run-make/symbol-mangling-hashed/default_dylib.rs b/tests/run-make/symbol-mangling-hashed/default_dylib.rs new file mode 100644 index 00000000000..986d1c7b74d --- /dev/null +++ b/tests/run-make/symbol-mangling-hashed/default_dylib.rs @@ -0,0 +1,9 @@ +#![crate_type = "dylib"] + +extern crate hashed_dylib; +extern crate hashed_rlib; + +pub fn ddhello() { + hashed_rlib::hrhello(); + hashed_dylib::hdhello(); +} diff --git a/tests/run-make/symbol-mangling-hashed/a_dylib.rs b/tests/run-make/symbol-mangling-hashed/hashed_dylib.rs index 49d65b72cac..fbb7cba43e0 100644 --- a/tests/run-make/symbol-mangling-hashed/a_dylib.rs +++ b/tests/run-make/symbol-mangling-hashed/hashed_dylib.rs @@ -1,4 +1,4 @@ #![crate_type = "dylib"] -pub fn hello() { +pub fn hdhello() { println!("hello dylib"); } diff --git a/tests/run-make/symbol-mangling-hashed/a_rlib.rs b/tests/run-make/symbol-mangling-hashed/hashed_rlib.rs index 71e44ccc200..048e67784d2 100644 --- a/tests/run-make/symbol-mangling-hashed/a_rlib.rs +++ b/tests/run-make/symbol-mangling-hashed/hashed_rlib.rs @@ -1,5 +1,5 @@ #![crate_type = "rlib"] -pub fn hello() { +pub fn hrhello() { println!("hello rlib"); } diff --git a/tests/run-make/symbol-mangling-hashed/rmake.rs b/tests/run-make/symbol-mangling-hashed/rmake.rs new file mode 100644 index 00000000000..136e6b9fa3a --- /dev/null +++ b/tests/run-make/symbol-mangling-hashed/rmake.rs @@ -0,0 +1,108 @@ +// ignore-tidy-linelength +//! Basic smoke test for the unstable option `-C symbol_mangling_version=hashed` which aims to +//! replace full symbol mangling names based on hash digests to shorten symbol name lengths in +//! dylibs for space savings. +//! +//! # References +//! +//! - MCP #705: Provide option to shorten symbol names by replacing them with a digest: +//! <https://github.com/rust-lang/compiler-team/issues/705>. +//! - Implementation PR: <https://github.com/rust-lang/rust/pull/118636>. +//! - PE format: <https://learn.microsoft.com/en-us/windows/win32/debug/pe-format>. + +//@ ignore-cross-compile + +#![deny(warnings)] + +use run_make_support::symbols::exported_dynamic_symbol_names; +use run_make_support::{bin_name, cwd, dynamic_lib_name, is_darwin, object, rfs, run, rustc}; + +macro_rules! adjust_symbol_prefix { + ($name:literal) => { + if is_darwin() { concat!("_", $name) } else { $name } + }; +} + +fn main() { + rustc() + .input("hashed_dylib.rs") + .prefer_dynamic() + .arg("-Zunstable-options") + .symbol_mangling_version("hashed") + .metadata("foo") + .run(); + + rustc() + .input("hashed_rlib.rs") + .prefer_dynamic() + .arg("-Zunstable-options") + .symbol_mangling_version("hashed") + .metadata("bar") + .run(); + + rustc().input("default_dylib.rs").library_search_path(cwd()).prefer_dynamic().run(); + rustc().input("default_bin.rs").library_search_path(cwd()).prefer_dynamic().run(); + + { + // Check hashed symbol name + + let dylib_filename = dynamic_lib_name("hashed_dylib"); + println!("checking dylib `{dylib_filename}`"); + + let dylib_blob = rfs::read(&dylib_filename); + let dylib_file = object::File::parse(&*dylib_blob) + .unwrap_or_else(|e| panic!("failed to parse `{dylib_filename}`: {e}")); + + let dynamic_symbols = exported_dynamic_symbol_names(&dylib_file); + + if dynamic_symbols.iter().filter(|sym| sym.contains("hdhello")).count() != 0 { + eprintln!("exported dynamic symbols: {:#?}", dynamic_symbols); + panic!("expected no occurrence of `hdhello`"); + } + + let expected_prefix = adjust_symbol_prefix!("_RNxC12hashed_dylib"); + if dynamic_symbols.iter().filter(|sym| sym.starts_with(expected_prefix)).count() != 2 { + eprintln!("exported dynamic symbols: {:#?}", dynamic_symbols); + panic!("expected two dynamic symbols starting with `{expected_prefix}`"); + } + } + + { + let dylib_filename = dynamic_lib_name("default_dylib"); + println!("checking so `{dylib_filename}`"); + + let dylib_blob = rfs::read(&dylib_filename); + let dylib_file = object::File::parse(&*dylib_blob) + .unwrap_or_else(|e| panic!("failed to parse `{dylib_filename}`: {e}")); + + let dynamic_symbols = exported_dynamic_symbol_names(&dylib_file); + + if dynamic_symbols + .iter() + .filter(|sym| sym.contains("default_dylib") && sym.contains("ddhello")) + .count() + != 1 + { + eprintln!("exported dynamic symbols: {:#?}", dynamic_symbols); + panic!("expected one occurrence of mangled `ddhello`"); + } + + let expected_rlib_prefix = adjust_symbol_prefix!("_RNxC11hashed_rlib"); + if dynamic_symbols.iter().filter(|sym| sym.starts_with(expected_rlib_prefix)).count() != 2 { + eprintln!("exported dynamic symbols: {:#?}", dynamic_symbols); + panic!("expected two exported symbols starting with `{expected_rlib_prefix}`"); + } + + let expected_dylib_prefix = adjust_symbol_prefix!("_RNxC12hashed_dylib"); + if dynamic_symbols.iter().any(|sym| sym.starts_with("_RNxC12hashed_dylib")) { + eprintln!("exported dynamic symbols: {:#?}", dynamic_symbols); + panic!("did not expect any symbols starting with `{expected_dylib_prefix}`"); + } + } + + // Check that the final binary can be run. + { + let bin_filename = bin_name("default_bin"); + run(&bin_filename); + } +} diff --git a/tests/run-make/target-specs/require-explicit-cpu.json b/tests/run-make/target-specs/require-explicit-cpu.json new file mode 100644 index 00000000000..5cbb9573b3f --- /dev/null +++ b/tests/run-make/target-specs/require-explicit-cpu.json @@ -0,0 +1,11 @@ +{ + "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128", + "linker-flavor": "gcc", + "llvm-target": "i686-unknown-linux-gnu", + "target-endian": "little", + "target-pointer-width": "32", + "target-c-int-width": "32", + "arch": "x86", + "os": "linux", + "need-explicit-cpu": true +} diff --git a/tests/run-make/target-specs/rmake.rs b/tests/run-make/target-specs/rmake.rs index 79c888ab340..f36a5784c89 100644 --- a/tests/run-make/target-specs/rmake.rs +++ b/tests/run-make/target-specs/rmake.rs @@ -63,4 +63,17 @@ fn main() { .crate_type("lib") .run_fail() .assert_stderr_contains("data-layout for target"); + rustc() + .input("foo.rs") + .target("require-explicit-cpu") + .crate_type("lib") + .run_fail() + .assert_stderr_contains("target requires explicitly specifying a cpu"); + rustc() + .input("foo.rs") + .target("require-explicit-cpu") + .crate_type("lib") + .arg("-Ctarget-cpu=generic") + .run(); + rustc().target("require-explicit-cpu").arg("--print=target-cpus").run(); } diff --git a/tests/run-make/wasm-export-all-symbols/rmake.rs b/tests/run-make/wasm-export-all-symbols/rmake.rs index 0c0a785c67c..4148cc29ec2 100644 --- a/tests/run-make/wasm-export-all-symbols/rmake.rs +++ b/tests/run-make/wasm-export-all-symbols/rmake.rs @@ -20,13 +20,16 @@ fn test(args: &[&str]) { rustc().input("main.rs").target("wasm32-wasip1").args(args).run(); verify_exports(Path::new("foo.wasm"), &[("foo", Func), ("FOO", Global), ("memory", Memory)]); - verify_exports(Path::new("main.wasm"), &[ - ("foo", Func), - ("FOO", Global), - ("_start", Func), - ("__main_void", Func), - ("memory", Memory), - ]); + verify_exports( + Path::new("main.wasm"), + &[ + ("foo", Func), + ("FOO", Global), + ("_start", Func), + ("__main_void", Func), + ("memory", Memory), + ], + ); } fn verify_exports(path: &Path, exports: &[(&str, wasmparser::ExternalKind)]) { diff --git a/tests/rustdoc-gui/basic-code.goml b/tests/rustdoc-gui/basic-code.goml deleted file mode 100644 index 22ac5316184..00000000000 --- a/tests/rustdoc-gui/basic-code.goml +++ /dev/null @@ -1,6 +0,0 @@ -// Small test to ensure the "src-line-numbers" element is only present once on -// the page. -go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -click: "a.src" -wait-for: ".src-line-numbers" -assert-count: (".src-line-numbers", 1) diff --git a/tests/rustdoc-gui/docblock-code-block-line-number.goml b/tests/rustdoc-gui/docblock-code-block-line-number.goml index 3c16626336e..032746a6bdf 100644 --- a/tests/rustdoc-gui/docblock-code-block-line-number.goml +++ b/tests/rustdoc-gui/docblock-code-block-line-number.goml @@ -112,28 +112,6 @@ wait-for: "pre.example-line-numbers" go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" assert-css: ( - ".scraped-example .src-line-numbers > pre", - { - // There should not be a radius on the right of the line numbers. - "border-top-left-radius": "6px", - "border-bottom-left-radius": "6px", - "border-top-right-radius": "0px", - "border-bottom-right-radius": "0px", - }, - ALL, -) -assert-css: ( - ".scraped-example .src-line-numbers", - { - // There should not be a radius on the right of the line numbers. - "border-top-left-radius": "6px", - "border-bottom-left-radius": "6px", - "border-top-right-radius": "0px", - "border-bottom-right-radius": "0px", - }, - ALL, -) -assert-css: ( ".scraped-example .rust", { // There should not be a radius on the left of the code. @@ -149,23 +127,15 @@ define-function: ( "check-padding", [path, padding_bottom], block { - assert-css: (|path| + " .src-line-numbers", { + assert-css: (|path| + " span[data-nosnippet]", { "padding-top": "0px", "padding-bottom": "0px", - "padding-left": "0px", - "padding-right": "0px", - }, ALL) - assert-css: (|path| + " .src-line-numbers > pre", { - "padding-top": "14px", - "padding-bottom": |padding_bottom|, - "padding-left": "0px", - "padding-right": "0px", - }, ALL) - assert-css: (|path| + " .src-line-numbers > pre > span", { - "padding-top": "0px", - "padding-bottom": "0px", - "padding-left": "8px", - "padding-right": "8px", + "padding-left": "4px", + "padding-right": "4px", + "margin-right": "20px", + "margin-left": "0px", + "margin-top": "0px", + "margin-bottom": "0px", }, ALL) }, ) @@ -196,13 +166,13 @@ define-function: ("check-line-numbers-existence", [], block { wait-for-local-storage-false: {"rustdoc-line-numbers": "true" } assert-false: ".example-line-numbers" // Line numbers should still be there. - assert: ".src-line-numbers" + assert-css: ("[data-nosnippet]", { "display": "inline-block"}) // Now disabling the setting. click: "input#line-numbers" wait-for-local-storage: {"rustdoc-line-numbers": "true" } assert-false: ".example-line-numbers" // Line numbers should still be there. - assert: ".src-line-numbers" + assert-css: ("[data-nosnippet]", { "display": "inline-block"}) // Closing settings menu. click: "#settings-menu" wait-for-css: ("#settings", {"display": "none"}) @@ -214,18 +184,16 @@ call-function: ("check-line-numbers-existence", {}) // Now checking the line numbers in the source code page. click: ".src" -assert-css: (".src-line-numbers", { - "padding-top": "20px", - "padding-bottom": "20px", - "padding-left": "4px", - "padding-right": "0px", -}) -assert-css: (".src-line-numbers > a", { +assert-css: ("a[data-nosnippet]", { "padding-top": "0px", "padding-bottom": "0px", - "padding-left": "8px", - "padding-right": "8px", -}) + "padding-left": "4px", + "padding-right": "4px", + "margin-top": "0px", + "margin-bottom": "0px", + "margin-left": "0px", + "margin-right": "20px", +}, ALL) // Checking that turning off the line numbers setting won't remove line numbers. call-function: ("check-line-numbers-existence", {}) diff --git a/tests/rustdoc-gui/font-serif-change.goml b/tests/rustdoc-gui/font-serif-change.goml new file mode 100644 index 00000000000..b14d5ae96f9 --- /dev/null +++ b/tests/rustdoc-gui/font-serif-change.goml @@ -0,0 +1,31 @@ +// Ensures that the font serif change is working as expected. +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" + +// By default, it should be the serif fonts. +store-value: (serif_font, '"Source Serif 4", NanumBarunGothic, serif') +store-value: (serif_code_font, '"Source Code Pro", monospace') +assert-css: ("body", {"font-family": |serif_font|}) +assert-css: ("p code", {"font-family": |serif_code_font|}) + +// We now switch to the sans serif font +click: "#settings-menu" +wait-for: "#sans-serif-fonts" +click: "#sans-serif-fonts" + +store-value: (font, '"Fira Sans", sans-serif') +store-value: (code_font, '"Fira Mono", monospace') +assert-css: ("body", {"font-family": |font|}) +assert-css: ("p code", {"font-family": |code_font|}) + +// Reloading the page to ensure it is loaded correctly. +reload: +assert-css: ("body", {"font-family": |font|}) +assert-css: ("p code", {"font-family": |code_font|}) + +// We switch back to the serif font +click: "#settings-menu" +wait-for: "#sans-serif-fonts" +click: "#sans-serif-fonts" + +assert-css: ("body", {"font-family": |serif_font|}) +assert-css: ("p code", {"font-family": |serif_code_font|}) diff --git a/tests/rustdoc-gui/jump-to-def-background.goml b/tests/rustdoc-gui/jump-to-def-background.goml index 71320360740..de5ea6c9b0b 100644 --- a/tests/rustdoc-gui/jump-to-def-background.goml +++ b/tests/rustdoc-gui/jump-to-def-background.goml @@ -8,7 +8,7 @@ define-function: ( block { call-function: ("switch-theme", {"theme": |theme|}) assert-css: ( - "body.src .example-wrap pre.rust a", + "body.src .example-wrap pre.rust a:not([data-nosnippet])", {"background-color": |background_color|}, ALL, ) diff --git a/tests/rustdoc-gui/scrape-examples-button-focus.goml b/tests/rustdoc-gui/scrape-examples-button-focus.goml index 83ed6a219b2..12246a37661 100644 --- a/tests/rustdoc-gui/scrape-examples-button-focus.goml +++ b/tests/rustdoc-gui/scrape-examples-button-focus.goml @@ -4,52 +4,44 @@ go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html" // The next/prev buttons vertically scroll the code viewport between examples move-cursor-to: ".scraped-example-list > .scraped-example" -store-property: (".scraped-example-list > .scraped-example .src-line-numbers", { - "scrollTop": initialScrollTop, -}) +wait-for: ".scraped-example-list > .scraped-example .next" +store-value: (initialScrollTop, 250) assert-property: (".scraped-example-list > .scraped-example .rust", { "scrollTop": |initialScrollTop|, -}) +}, NEAR) focus: ".scraped-example-list > .scraped-example .next" press-key: "Enter" -assert-property-false: (".scraped-example-list > .scraped-example .src-line-numbers", { - "scrollTop": |initialScrollTop| -}, NEAR) assert-property-false: (".scraped-example-list > .scraped-example .rust", { "scrollTop": |initialScrollTop| }, NEAR) focus: ".scraped-example-list > .scraped-example .prev" press-key: "Enter" -assert-property: (".scraped-example-list > .scraped-example .src-line-numbers", { - "scrollTop": |initialScrollTop| -}, NEAR) assert-property: (".scraped-example-list > .scraped-example .rust", { "scrollTop": |initialScrollTop| }, NEAR) -// The expand button increases the scrollHeight of the minimized code viewport -store-property: (".scraped-example-list > .scraped-example pre", {"offsetHeight": smallOffsetHeight}) -assert-property: (".scraped-example-list > .scraped-example .src-line-numbers", { - "scrollHeight": |smallOffsetHeight| -}, NEAR) -assert-property: (".scraped-example-list > .scraped-example .rust", { - "scrollHeight": |smallOffsetHeight| -}, NEAR) -focus: ".scraped-example-list > .scraped-example .expand" -press-key: "Enter" -assert-property-false: (".scraped-example-list > .scraped-example .src-line-numbers", { - "offsetHeight": |smallOffsetHeight| -}, NEAR) -assert-property-false: (".scraped-example-list > .scraped-example .rust", { - "offsetHeight": |smallOffsetHeight| -}, NEAR) -store-property: (".scraped-example-list > .scraped-example .src-line-numbers", { - "offsetHeight": fullOffsetHeight, +// Make sure all the buttons are the same size +store-property: (".scraped-example-list > .scraped-example .prev", { + "offsetWidth": buttonWidth, + "offsetHeight": buttonHeight, }) -assert-property: (".scraped-example-list > .scraped-example .rust", { - "offsetHeight": |fullOffsetHeight|, - "scrollHeight": |fullOffsetHeight|, +assert-property: (".scraped-example-list > .scraped-example .prev", { + "offsetWidth": |buttonWidth|, + "offsetHeight": |buttonHeight|, + "title": "Previous usage", +}) +assert-property: (".scraped-example-list > .scraped-example .next", { + "offsetWidth": |buttonWidth|, + "offsetHeight": |buttonHeight|, + "title": "Next usage", +}) +assert-property: (".scraped-example-list > .scraped-example .expand", { + "offsetWidth": |buttonWidth|, + "offsetHeight": |buttonHeight|, + "title": "Show all", +}) +assert-property: (".scraped-example-list > .scraped-example .copy-button", { + "offsetWidth": |buttonWidth|, + "offsetHeight": |buttonHeight|, + "title": "Copy code to clipboard", }) -assert-property: (".scraped-example-list > .scraped-example .src-line-numbers", { - "scrollHeight": |fullOffsetHeight| -}, NEAR) diff --git a/tests/rustdoc-gui/scrape-examples-layout.goml b/tests/rustdoc-gui/scrape-examples-layout.goml index 5187ac486b0..85a3b2a6287 100644 --- a/tests/rustdoc-gui/scrape-examples-layout.goml +++ b/tests/rustdoc-gui/scrape-examples-layout.goml @@ -3,35 +3,38 @@ go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" set-window-size: (1000, 1000) +// We move the mouse over the scraped example for the prev button to be generated. +move-cursor-to: ".scraped-example" + // Check that it's not zero. assert-property-false: ( - ".more-scraped-examples .scraped-example .src-line-numbers", + ".more-scraped-examples .scraped-example span[data-nosnippet]", {"clientWidth": "0"} ) // Check that examples with very long lines have the same width as ones that don't. store-property: ( - ".more-scraped-examples .scraped-example:nth-child(2) .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(2) span[data-nosnippet]", {"clientWidth": clientWidth}, ) assert-property: ( - ".more-scraped-examples .scraped-example:nth-child(3) .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(3) span[data-nosnippet]", {"clientWidth": |clientWidth|} ) assert-property: ( - ".more-scraped-examples .scraped-example:nth-child(4) .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(4) span[data-nosnippet]", {"clientWidth": |clientWidth|} ) assert-property: ( - ".more-scraped-examples .scraped-example:nth-child(5) .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(5) span[data-nosnippet]", {"clientWidth": |clientWidth|} ) assert-property: ( - ".more-scraped-examples .scraped-example:nth-child(6) .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(6) span[data-nosnippet]", {"clientWidth": |clientWidth|} ) @@ -55,25 +58,6 @@ assert-size: (".more-scraped-examples .scraped-example .example-wrap", { "width": |width|, }) -// Check that the expand button works and also that line number aligns with code. -move-cursor-to: ".scraped-example .rust" -click: ".scraped-example .button-holder .expand" -wait-for: ".scraped-example.expanded" -// They should have the same y position. -compare-elements-position: ( - ".scraped-example.expanded .src-line-numbers pre span", - ".scraped-example.expanded .rust code", - ["y"], -) -// And they should have the same height. -compare-elements-size: ( - ".scraped-example.expanded .src-line-numbers", - ".scraped-example.expanded .rust", - ["height"], -) -// Collapse code again. -click: ".scraped-example .button-holder .expand" - // Check that for both mobile and desktop sizes, the buttons in scraped examples are displayed // correctly. @@ -98,7 +82,7 @@ define-function: ( [], block { // Title should be above the code. - store-position: (".scraped-example .example-wrap .src-line-numbers", {"x": x, "y": y}) + store-position: (".scraped-example .example-wrap", {"x": x, "y": y}) store-size: (".scraped-example .scraped-example-title", { "height": title_height }) assert-position: (".scraped-example .scraped-example-title", { @@ -107,10 +91,13 @@ define-function: ( }) // Line numbers should be right beside the code. - compare-elements-position: ( - ".scraped-example .example-wrap .src-line-numbers", - ".scraped-example .example-wrap .rust", - ["y"], + compare-elements-position-near: ( + ".scraped-example .example-wrap span[data-nosnippet]", + // On the first line, the code starts with `fn main` so we have a keyword. + ".scraped-example .example-wrap .rust span.kw", + // They're not exactly the same size but since they're on the same line, + // it's kinda the same. + {"y": 2}, ) } ) diff --git a/tests/rustdoc-gui/settings.goml b/tests/rustdoc-gui/settings.goml index 1d93c07f9ec..4ab5b83d7c4 100644 --- a/tests/rustdoc-gui/settings.goml +++ b/tests/rustdoc-gui/settings.goml @@ -257,15 +257,15 @@ assert-text: ("#preferred-light-theme .setting-radio-name", "Preferred light the // We now check that clicking on the toggles' text is like clicking on the checkbox. // To test it, we use the "Disable keyboard shortcuts". set-local-storage: {"rustdoc-disable-shortcuts": "false"} -click: ".setting-line:last-child .setting-check span" +click: "#disable-shortcuts" assert-local-storage: {"rustdoc-disable-shortcuts": "true"} // We now check that focusing a toggle and pressing Space is like clicking on it. assert-local-storage: {"rustdoc-disable-shortcuts": "true"} -focus: ".setting-line:last-child .setting-check input" +focus: "#disable-shortcuts" press-key: "Space" assert-local-storage: {"rustdoc-disable-shortcuts": "false"} -focus: ".setting-line:last-child .setting-check input" +focus: "#disable-shortcuts" press-key: "Space" assert-local-storage: {"rustdoc-disable-shortcuts": "true"} @@ -276,7 +276,7 @@ assert-false: "#help-button .popover" wait-for-css: ("#settings-menu .popover", {"display": "block"}) // Now turn keyboard shortcuts back on, and see if they work. -click: ".setting-line:last-child .setting-check span" +click: "#disable-shortcuts" assert-local-storage: {"rustdoc-disable-shortcuts": "false"} press-key: "Escape" press-key: "?" diff --git a/tests/rustdoc-gui/source-anchor-scroll.goml b/tests/rustdoc-gui/source-anchor-scroll.goml index 4ad65bbbd61..c005af1e7a1 100644 --- a/tests/rustdoc-gui/source-anchor-scroll.goml +++ b/tests/rustdoc-gui/source-anchor-scroll.goml @@ -8,13 +8,13 @@ set-window-size: (600, 800) assert-property: ("html", {"scrollTop": "0"}) click: '//a[text() = "barbar" and @href="#5-7"]' -assert-property: ("html", {"scrollTop": "208"}) +assert-property: ("html", {"scrollTop": "206"}) click: '//a[text() = "bar" and @href="#28-36"]' assert-property: ("html", {"scrollTop": "239"}) click: '//a[normalize-space() = "sub_fn" and @href="#2-4"]' -assert-property: ("html", {"scrollTop": "136"}) +assert-property: ("html", {"scrollTop": "134"}) // We now check that clicking on lines doesn't change the scroll // Extra information: the "sub_fn" function header is on line 1. click: '//*[@id="6"]' -assert-property: ("html", {"scrollTop": "136"}) +assert-property: ("html", {"scrollTop": "134"}) diff --git a/tests/rustdoc-gui/source-code-page-code-scroll.goml b/tests/rustdoc-gui/source-code-page-code-scroll.goml index 60012db6c8c..c15a9ae7983 100644 --- a/tests/rustdoc-gui/source-code-page-code-scroll.goml +++ b/tests/rustdoc-gui/source-code-page-code-scroll.goml @@ -2,7 +2,7 @@ go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" set-window-size: (800, 1000) // "scrollWidth" should be superior than "clientWidth". -assert-property: ("body", {"scrollWidth": 1776, "clientWidth": 800}) +assert-property: ("body", {"scrollWidth": 1780, "clientWidth": 800}) // Both properties should be equal (ie, no scroll on the code block). -assert-property: (".example-wrap .rust", {"scrollWidth": 1662, "clientWidth": 1662}) +assert-property: (".example-wrap .rust", {"scrollWidth": 1715, "clientWidth": 1715}) diff --git a/tests/rustdoc-gui/source-code-page.goml b/tests/rustdoc-gui/source-code-page.goml index afb19462521..aa5a16aac70 100644 --- a/tests/rustdoc-gui/source-code-page.goml +++ b/tests/rustdoc-gui/source-code-page.goml @@ -3,7 +3,7 @@ include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" show-text: true // Check that we can click on the line number. -click: ".src-line-numbers > a:nth-child(4)" // This is the anchor for line 4. +click: "//a[@data-nosnippet and text()='4']" // This is the anchor for line 4. // Ensure that the page URL was updated. assert-document-property: ({"URL": "lib.rs.html#4"}, ENDS_WITH) assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"}) @@ -14,11 +14,11 @@ assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"}) assert-css: ("//*[@id='4']", {"border-right-width": "0px"}) // We now check that the good anchors are highlighted go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#4-6" -assert-attribute-false: (".src-line-numbers > a:nth-child(3)", {"class": "line-highlighted"}) -assert-attribute: (".src-line-numbers > a:nth-child(4)", {"class": "line-highlighted"}) -assert-attribute: (".src-line-numbers > a:nth-child(5)", {"class": "line-highlighted"}) -assert-attribute: (".src-line-numbers > a:nth-child(6)", {"class": "line-highlighted"}) -assert-attribute-false: (".src-line-numbers > a:nth-child(7)", {"class": "line-highlighted"}) +assert-attribute-false: ("//a[@data-nosnippet and text()='3']", {"class": "line-highlighted"}) +assert-attribute: ("//a[@data-nosnippet and text()='4']", {"class": "line-highlighted"}) +assert-attribute: ("//a[@data-nosnippet and text()='5']", {"class": "line-highlighted"}) +assert-attribute: ("//a[@data-nosnippet and text()='6']", {"class": "line-highlighted"}) +assert-attribute-false: ("//a[@data-nosnippet and text()='7']", {"class": "line-highlighted"}) define-function: ( "check-colors", @@ -26,12 +26,12 @@ define-function: ( block { call-function: ("switch-theme", {"theme": |theme|}) assert-css: ( - ".src-line-numbers > a:not(.line-highlighted)", + "a[data-nosnippet]:not(.line-highlighted)", {"color": |color|, "background-color": |background_color|}, ALL, ) assert-css: ( - ".src-line-numbers > a.line-highlighted", + "a[data-nosnippet].line-highlighted", {"color": |highlight_color|, "background-color": |highlight_background_color|}, ALL, ) @@ -61,37 +61,37 @@ call-function: ("check-colors", { }) // This is to ensure that the content is correctly align with the line numbers. -compare-elements-position: ("//*[@id='1']", ".rust > code > span", ["y"]) +compare-elements-position-near: ("//*[@id='1']", ".rust > code > span", {"y": 2}) // Check the `href` property so that users can treat anchors as links. -assert-property: (".src-line-numbers > a:nth-child(1)", { +assert-property: ("//a[@data-nosnippet and text()='1']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#1" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(2)", { +assert-property: ("//a[@data-nosnippet and text()='2']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#2" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(3)", { +assert-property: ("//a[@data-nosnippet and text()='3']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#3" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(4)", { +assert-property: ("//a[@data-nosnippet and text()='4']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#4" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(5)", { +assert-property: ("//a[@data-nosnippet and text()='5']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#5" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(6)", { +assert-property: ("//a[@data-nosnippet and text()='6']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#6" }, ENDS_WITH) // Assert that the line numbers text is aligned to the right. -assert-css: (".src-line-numbers", {"text-align": "right"}) +assert-css: ("a[data-nosnippet]", {"text-align": "right"}, ALL) // Now let's check that clicking on something else than the line number doesn't // do anything (and certainly not add a `#NaN` to the URL!). go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" // We use this assert-position to know where we will click. -assert-position: ("//*[@id='1']", {"x": 88, "y": 171}) -// We click on the left of the "1" anchor but still in the "src-line-number" `<pre>`. -click: (163, 77) +assert-position: ("//*[@id='1']", {"x": 81, "y": 169}) +// We click on the left of the "1" anchor but still in the `a[data-nosnippet]`. +click: (77, 163) assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH) // Checking the source code sidebar. diff --git a/tests/rustdoc-js-std/vec-new.js b/tests/rustdoc-js-std/vec-new.js index bb122ff4398..0eae8b6c197 100644 --- a/tests/rustdoc-js-std/vec-new.js +++ b/tests/rustdoc-js-std/vec-new.js @@ -9,7 +9,7 @@ const EXPECTED = [ { 'query': 'prelude::vec', 'others': [ - { 'path': 'std::prelude::rust_2024', 'name': 'Vec' }, + { 'path': 'std::prelude::v1', 'name': 'Vec' }, ], }, { diff --git a/tests/rustdoc-json/primitives/primitive_impls.rs b/tests/rustdoc-json/primitives/primitive_impls.rs index 77d1d68f8e4..58c222ce4f0 100644 --- a/tests/rustdoc-json/primitives/primitive_impls.rs +++ b/tests/rustdoc-json/primitives/primitive_impls.rs @@ -1,4 +1,4 @@ -#![feature(no_core)] +#![feature(no_core, lang_items)] #![feature(rustc_attrs)] #![feature(rustdoc_internals)] #![no_core] @@ -6,6 +6,9 @@ //@ set impl_i32 = "$.index[*][?(@.docs=='Only core can do this')].id" +#[lang = "sized"] +trait Sized {} + /// Only core can do this impl i32 { //@ set identity = "$.index[*][?(@.docs=='Do Nothing')].id" diff --git a/tests/rustdoc-ui/coverage/html.stderr b/tests/rustdoc-ui/coverage/html.stderr index adca375d4bc..764179820c5 100644 --- a/tests/rustdoc-ui/coverage/html.stderr +++ b/tests/rustdoc-ui/coverage/html.stderr @@ -1,2 +1,2 @@ -error: html output format isn't supported for the --show-coverage option +error: `--output-format=html` is not supported for the `--show-coverage` option diff --git a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.rs b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.rs index 6b1aa455d98..18ac37280c0 100644 --- a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.rs +++ b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.rs @@ -2,9 +2,12 @@ // feature. #![deny(warnings)] -#![feature(no_core)] +#![feature(no_core, lang_items)] #![no_core] +#[lang = "sized"] +trait Sized {} + /// ```{class="} /// main; /// ``` diff --git a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr index 385b2ccacc1..cc13cc0fe53 100644 --- a/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr +++ b/tests/rustdoc-ui/custom_code_classes_in_docs-warning3.stderr @@ -1,5 +1,5 @@ error: unclosed quote string `"` - --> $DIR/custom_code_classes_in_docs-warning3.rs:8:1 + --> $DIR/custom_code_classes_in_docs-warning3.rs:11:1 | LL | / /// ```{class="} LL | | /// main; @@ -17,7 +17,7 @@ LL | #![deny(warnings)] = note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(warnings)]` error: unclosed quote string `"` - --> $DIR/custom_code_classes_in_docs-warning3.rs:8:1 + --> $DIR/custom_code_classes_in_docs-warning3.rs:11:1 | LL | / /// ```{class="} LL | | /// main; diff --git a/tests/rustdoc-ui/doctest-output.rs b/tests/rustdoc-ui/doctest-output.rs new file mode 100644 index 00000000000..720f2952980 --- /dev/null +++ b/tests/rustdoc-ui/doctest-output.rs @@ -0,0 +1 @@ +//@ compile-flags:-Z unstable-options --show-coverage --output-format=doctest diff --git a/tests/rustdoc-ui/doctest-output.stderr b/tests/rustdoc-ui/doctest-output.stderr new file mode 100644 index 00000000000..20c618dc61b --- /dev/null +++ b/tests/rustdoc-ui/doctest-output.stderr @@ -0,0 +1,2 @@ +error: `--output-format=doctest` is not supported for the `--show-coverage` option + diff --git a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout index ca6e7750264..13e142df837 100644 --- a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout +++ b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout @@ -5,7 +5,7 @@ test $DIR/relative-path-include-bytes-132203.rs - (line 18) ... FAILED failures: ---- $DIR/relative-path-include-bytes-132203.rs - (line 18) stdout ---- -error: couldn't read `$DIR/relative-dir-empty-file`: No such file or directory (os error 2) +error: couldn't read `$DIR/relative-dir-empty-file`: $FILE_NOT_FOUND_MSG (os error 2) --> $DIR/relative-path-include-bytes-132203.rs:19:9 | LL | let x = include_bytes!("relative-dir-empty-file"); diff --git a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs index 5c9e2978e48..ceacd69a5fd 100644 --- a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs +++ b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs @@ -1,4 +1,3 @@ -//@ ignore-windows //@ revisions: edition2015 edition2024 //@[edition2015]edition:2015 //@[edition2015]check-fail @@ -7,8 +6,9 @@ //@[edition2024]edition:2024 //@[edition2024]check-pass //@[edition2024]compile-flags:--test --test-args=--test-threads=1 -//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout: "tests.rustdoc-ui.doctest." -> "$$DIR/" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout: "`: .* \(os error 2\)" -> "`: $$FILE_NOT_FOUND_MSG (os error 2)" // https://github.com/rust-lang/rust/issues/132203 // This version, because it's edition2024, passes thanks to the new diff --git a/tests/rustdoc-ui/extract-doctests.rs b/tests/rustdoc-ui/extract-doctests.rs new file mode 100644 index 00000000000..06bd35969d0 --- /dev/null +++ b/tests/rustdoc-ui/extract-doctests.rs @@ -0,0 +1,15 @@ +// Test to ensure that it generates expected output for `--output-format=doctest` command-line +// flag. + +//@ compile-flags:-Z unstable-options --output-format=doctest +//@ normalize-stdout: "tests/rustdoc-ui" -> "$$DIR" +//@ check-pass + +//! ```ignore (checking attributes) +//! let x = 12; +//! let y = 14; +//! ``` +//! +//! ```edition2018,compile_fail +//! let +//! ``` diff --git a/tests/rustdoc-ui/extract-doctests.stdout b/tests/rustdoc-ui/extract-doctests.stdout new file mode 100644 index 00000000000..fa8604cae94 --- /dev/null +++ b/tests/rustdoc-ui/extract-doctests.stdout @@ -0,0 +1 @@ +{"format_version":1,"doctests":[{"file":"$DIR/extract-doctests.rs","line":8,"doctest_attributes":{"original":"ignore (checking attributes)","should_panic":false,"no_run":false,"ignore":"All","rust":true,"test_harness":false,"compile_fail":false,"standalone_crate":false,"error_codes":[],"edition":null,"added_css_classes":[],"unknown":[]},"original_code":"let x = 12;\nlet y = 14;","doctest_code":"#![allow(unused)]\nfn main() {\nlet x = 12;\nlet y = 14;\n}","name":"$DIR/extract-doctests.rs - (line 8)"},{"file":"$DIR/extract-doctests.rs","line":13,"doctest_attributes":{"original":"edition2018,compile_fail","should_panic":false,"no_run":true,"ignore":"None","rust":true,"test_harness":false,"compile_fail":true,"standalone_crate":false,"error_codes":[],"edition":"2018","added_css_classes":[],"unknown":[]},"original_code":"let","doctest_code":"#![allow(unused)]\nfn main() {\nlet\n}","name":"$DIR/extract-doctests.rs - (line 13)"}]} \ No newline at end of file diff --git a/tests/rustdoc-ui/hashtag-doctest.rs b/tests/rustdoc-ui/hashtag-doctest.rs new file mode 100644 index 00000000000..5f745611530 --- /dev/null +++ b/tests/rustdoc-ui/hashtag-doctest.rs @@ -0,0 +1,17 @@ +// This test ensures that `##` are not emitting a warning when generating +// docs with the 2024 edition (or any edition). +// Regression test for <https://github.com/rust-lang/rust/issues/136899>. + +//@ check-pass +//@revisions: edition2021 edition2024 +//@[edition2021] edition:2021 +//@[edition2024] edition:2024 + +#![deny(warnings)] + +//! Test +//! +//! ``` +//! ##[allow(dead_code)] +//! println!("hello world"); +//! ``` diff --git a/tests/rustdoc/intra-doc/auxiliary/issue-103463-aux.rs b/tests/rustdoc-ui/intra-doc/auxiliary/issue-103463-aux.rs index 2b8fdec1f12..2b8fdec1f12 100644 --- a/tests/rustdoc/intra-doc/auxiliary/issue-103463-aux.rs +++ b/tests/rustdoc-ui/intra-doc/auxiliary/issue-103463-aux.rs diff --git a/tests/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr b/tests/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr index ef7fec77b1e..3bba27e593c 100644 --- a/tests/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr +++ b/tests/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr @@ -11,8 +11,9 @@ LL | #![deny(rustdoc::broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: to link to the enum, prefix with `enum@` | -LL | /// Link to [enum@S] - | ~~~~~ +LL - /// Link to [struct@S] +LL + /// Link to [enum@S] + | error: incompatible link kind for `S` --> $DIR/disambiguator-mismatch.rs:27:14 @@ -22,8 +23,9 @@ LL | /// Link to [mod@S] | help: to link to the enum, prefix with `enum@` | -LL | /// Link to [enum@S] - | ~~~~~ +LL - /// Link to [mod@S] +LL + /// Link to [enum@S] + | error: incompatible link kind for `S` --> $DIR/disambiguator-mismatch.rs:32:14 @@ -33,8 +35,9 @@ LL | /// Link to [union@S] | help: to link to the enum, prefix with `enum@` | -LL | /// Link to [enum@S] - | ~~~~~ +LL - /// Link to [union@S] +LL + /// Link to [enum@S] + | error: incompatible link kind for `S` --> $DIR/disambiguator-mismatch.rs:37:14 @@ -44,8 +47,9 @@ LL | /// Link to [trait@S] | help: to link to the enum, prefix with `enum@` | -LL | /// Link to [enum@S] - | ~~~~~ +LL - /// Link to [trait@S] +LL + /// Link to [enum@S] + | error: incompatible link kind for `T` --> $DIR/disambiguator-mismatch.rs:42:14 @@ -55,8 +59,9 @@ LL | /// Link to [struct@T] | help: to link to the trait, prefix with `trait@` | -LL | /// Link to [trait@T] - | ~~~~~~ +LL - /// Link to [struct@T] +LL + /// Link to [trait@T] + | error: incompatible link kind for `m` --> $DIR/disambiguator-mismatch.rs:47:14 @@ -89,8 +94,9 @@ LL | /// Link to [const@s] | help: to link to the static, prefix with `static@` | -LL | /// Link to [static@s] - | ~~~~~~~ +LL - /// Link to [const@s] +LL + /// Link to [static@s] + | error: incompatible link kind for `c` --> $DIR/disambiguator-mismatch.rs:63:14 @@ -100,8 +106,9 @@ LL | /// Link to [static@c] | help: to link to the constant, prefix with `const@` | -LL | /// Link to [const@c] - | ~~~~~~ +LL - /// Link to [static@c] +LL + /// Link to [const@c] + | error: incompatible link kind for `c` --> $DIR/disambiguator-mismatch.rs:68:14 @@ -111,8 +118,9 @@ LL | /// Link to [fn@c] | help: to link to the constant, prefix with `const@` | -LL | /// Link to [const@c] - | ~~~~~~ +LL - /// Link to [fn@c] +LL + /// Link to [const@c] + | error: incompatible link kind for `c` --> $DIR/disambiguator-mismatch.rs:73:14 @@ -146,8 +154,9 @@ LL | /// Link to [fn@std] | help: to link to the crate, prefix with `mod@` | -LL | /// Link to [mod@std] - | ~~~~ +LL - /// Link to [fn@std] +LL + /// Link to [mod@std] + | error: incompatible link kind for `X::y` --> $DIR/disambiguator-mismatch.rs:88:14 @@ -157,8 +166,9 @@ LL | /// Link to [method@X::y] | help: to link to the field, prefix with `field@` | -LL | /// Link to [field@X::y] - | ~~~~~~ +LL - /// Link to [method@X::y] +LL + /// Link to [field@X::y] + | error: unresolved link to `S::A` --> $DIR/disambiguator-mismatch.rs:93:14 @@ -168,8 +178,9 @@ LL | /// Link to [field@S::A] | help: to link to the variant, prefix with `variant@` | -LL | /// Link to [variant@S::A] - | ~~~~~~~~ +LL - /// Link to [field@S::A] +LL + /// Link to [variant@S::A] + | error: aborting due to 15 previous errors diff --git a/tests/rustdoc/intra-doc/issue-104145.rs b/tests/rustdoc-ui/intra-doc/ice-extern-trait-local-impl-104145.rs index 5690803af5a..0e403b21c8a 100644 --- a/tests/rustdoc/intra-doc/issue-104145.rs +++ b/tests/rustdoc-ui/intra-doc/ice-extern-trait-local-impl-104145.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/104145 +//@ check-pass + // Doc links in `Trait`'s methods are resolved because it has a local impl. //@ aux-build:issue-103463-aux.rs diff --git a/tests/rustdoc/intra-doc/issue-103463.rs b/tests/rustdoc-ui/intra-doc/ice-priv-use-103463.rs index 9b5cb67fd32..10894282e55 100644 --- a/tests/rustdoc/intra-doc/issue-103463.rs +++ b/tests/rustdoc-ui/intra-doc/ice-priv-use-103463.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/103463 +//@ check-pass + // The `Trait` is not pulled into the crate resulting in doc links in its methods being resolved. //@ aux-build:issue-103463-aux.rs diff --git a/tests/rustdoc-ui/intra-doc/incompatible-primitive-disambiguator.stderr b/tests/rustdoc-ui/intra-doc/incompatible-primitive-disambiguator.stderr index b952517022b..2818b6b4bba 100644 --- a/tests/rustdoc-ui/intra-doc/incompatible-primitive-disambiguator.stderr +++ b/tests/rustdoc-ui/intra-doc/incompatible-primitive-disambiguator.stderr @@ -11,8 +11,9 @@ LL | #![deny(rustdoc::broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: to link to the associated constant, prefix with `const@` | -LL | //! [const@u8::MIN] - | ~~~~~~ +LL - //! [static@u8::MIN] +LL + //! [const@u8::MIN] + | error: aborting due to 1 previous error diff --git a/tests/rustdoc-ui/intra-doc/prim-conflict.stderr b/tests/rustdoc-ui/intra-doc/prim-conflict.stderr index 03ce8f15f0a..c50f6bb9b87 100644 --- a/tests/rustdoc-ui/intra-doc/prim-conflict.stderr +++ b/tests/rustdoc-ui/intra-doc/prim-conflict.stderr @@ -26,12 +26,14 @@ LL | /// [type@char] | help: to link to the module, prefix with `mod@` | -LL | /// [mod@char] - | ~~~~ +LL - /// [type@char] +LL + /// [mod@char] + | help: to link to the primitive type, prefix with `prim@` | -LL | /// [prim@char] - | ~~~~~ +LL - /// [type@char] +LL + /// [prim@char] + | error: incompatible link kind for `char` --> $DIR/prim-conflict.rs:19:6 @@ -41,8 +43,9 @@ LL | /// [struct@char] | help: to link to the module, prefix with `mod@` | -LL | /// [mod@char] - | ~~~~ +LL - /// [struct@char] +LL + /// [mod@char] + | error: incompatible link kind for `char` --> $DIR/prim-conflict.rs:26:10 @@ -52,8 +55,9 @@ LL | //! [struct@char] | help: to link to the primitive type, prefix with `prim@` | -LL | //! [prim@char] - | ~~~~~ +LL - //! [struct@char] +LL + //! [prim@char] + | error: aborting due to 4 previous errors diff --git a/tests/rustdoc-ui/intra-doc/value-ctor.stderr b/tests/rustdoc-ui/intra-doc/value-ctor.stderr index 8d2a6649f4c..cfc2bb67396 100644 --- a/tests/rustdoc-ui/intra-doc/value-ctor.stderr +++ b/tests/rustdoc-ui/intra-doc/value-ctor.stderr @@ -11,8 +11,9 @@ LL | #![deny(rustdoc::broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: to link to the variant, prefix with `variant@` | -LL | /// [variant@Foo::X] - | ~~~~~~~~ +LL - /// [value@Foo::X] +LL + /// [variant@Foo::X] + | error: unresolved link to `MyStruct` --> $DIR/value-ctor.rs:10:11 @@ -22,8 +23,9 @@ LL | /// [tst][value@MyStruct] | help: to link to the struct, prefix with `struct@` | -LL | /// [tst][struct@MyStruct] - | ~~~~~~~ +LL - /// [tst][value@MyStruct] +LL + /// [tst][struct@MyStruct] + | error: unresolved link to `Internals` --> $DIR/value-ctor.rs:20:15 @@ -33,8 +35,9 @@ LL | /// while [b][value@Internals] fails. | help: to link to the struct, prefix with `struct@` | -LL | /// while [b][struct@Internals] fails. - | ~~~~~~~ +LL - /// while [b][value@Internals] fails. +LL + /// while [b][struct@Internals] fails. + | error: incompatible link kind for `Internals` --> $DIR/value-ctor.rs:22:15 @@ -44,8 +47,9 @@ LL | /// while [d][variant@Internals] fails. | help: to link to the struct, prefix with `struct@` | -LL | /// while [d][struct@Internals] fails. - | ~~~~~~~ +LL - /// while [d][variant@Internals] fails. +LL + /// while [d][struct@Internals] fails. + | error: unresolved link to `Internals2` --> $DIR/value-ctor.rs:34:15 @@ -55,8 +59,9 @@ LL | /// while [b][value@Internals2] fails. | help: to link to the enum, prefix with `enum@` | -LL | /// while [b][enum@Internals2] fails. - | ~~~~~ +LL - /// while [b][value@Internals2] fails. +LL + /// while [b][enum@Internals2] fails. + | error: aborting due to 5 previous errors diff --git a/tests/rustdoc-ui/intra-doc/weird-syntax.rs b/tests/rustdoc-ui/intra-doc/weird-syntax.rs index ca18842fb21..d2a922b2b62 100644 --- a/tests/rustdoc-ui/intra-doc/weird-syntax.rs +++ b/tests/rustdoc-ui/intra-doc/weird-syntax.rs @@ -117,24 +117,49 @@ pub struct WLinkToCloneWithUnmatchedEscapedCloseParenAndDoubleSpace; // References -/// The [cln][] link here is going to be unresolved, because `Clone()` gets rejected //~ERROR link -/// in Markdown for not being URL-shaped enough. -/// -/// [cln]: Clone() //~ERROR link +/// The [cln][] link here is going to be unresolved, because `Clone()` gets +//~^ ERROR link +/// rejected in Markdown for not being URL-shaped enough. +/// [cln]: Clone() +//~^ ERROR link pub struct LinkToCloneWithParensInReference; -/// The [cln][] link here is going to be unresolved, because `struct@Clone` gets //~ERROR link -/// rejected in Markdown for not being URL-shaped enough. +/// The [cln][] link here is going to produce a good inline suggestion /// -/// [cln]: struct@Clone //~ERROR link +/// [cln]: struct@Clone +//~^ ERROR link pub struct LinkToCloneWithWrongPrefix; -/// The [cln][] link here will produce a plain text suggestion //~ERROR link +/// The [cln][] link here will produce a good inline suggestion /// /// [cln]: Clone\(\) +//~^ ERROR link pub struct LinkToCloneWithEscapedParensInReference; -/// The [cln][] link here will produce a plain text suggestion //~ERROR link +/// The [cln][] link here will produce a good inline suggestion /// /// [cln]: struct\@Clone +//~^ ERROR link pub struct LinkToCloneWithEscapedAtsInReference; + + +/// This link reference definition isn't used, but since it is still parsed, +/// it should still produce a warning. +/// +/// [cln]: struct\@Clone +//~^ ERROR link +pub struct UnusedLinkToCloneReferenceDefinition; + +/// <https://github.com/rust-lang/rust/issues/133150> +/// +/// - [`SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER`]: the +//~^ ERROR link +/// `(__unsafe_unretained)` NSWindow associated with the window, if you want +/// to wrap an existing window. +/// - [`SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER`]: the `(__unsafe_unretained)` +/// NSView associated with the window, defaults to `[window contentView]` +pub fn a() {} +#[allow(nonstandard_style)] +pub struct SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER; +#[allow(nonstandard_style)] +pub struct SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER; diff --git a/tests/rustdoc-ui/intra-doc/weird-syntax.stderr b/tests/rustdoc-ui/intra-doc/weird-syntax.stderr index 17bcbc783fd..ad813f0f9b6 100644 --- a/tests/rustdoc-ui/intra-doc/weird-syntax.stderr +++ b/tests/rustdoc-ui/intra-doc/weird-syntax.stderr @@ -11,8 +11,9 @@ LL | #![deny(rustdoc::broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: to link to the trait, prefix with `trait@` | -LL | /// [`trait@Clone`] - | ~~~~~~ +LL - /// [`struct@Clone`] +LL + /// [`trait@Clone`] + | error: incompatible link kind for `Clone` --> $DIR/weird-syntax.rs:21:9 @@ -22,8 +23,9 @@ LL | /// [```struct@Clone```] | help: to link to the trait, prefix with `trait@` | -LL | /// [```trait@Clone```] - | ~~~~~~ +LL - /// [```struct@Clone```] +LL + /// [```trait@Clone```] + | error: incompatible link kind for `Clone` --> $DIR/weird-syntax.rs:24:11 @@ -33,8 +35,9 @@ LL | /// [ ` struct@Clone ` ] | help: to link to the trait, prefix with `trait@` | -LL | /// [ ` trait@Clone ` ] - | ~~~~~~ +LL - /// [ ` struct@Clone ` ] +LL + /// [ ` trait@Clone ` ] + | error: unresolved link to `Clone` --> $DIR/weird-syntax.rs:27:9 @@ -104,8 +107,9 @@ LL | /// [x][ struct@Clone] | help: to link to the trait, prefix with `trait@` | -LL | /// [x][ trait@Clone] - | ~~~~~~ +LL - /// [x][ struct@Clone] +LL + /// [x][ trait@Clone] + | error: incompatible link kind for `Clone` --> $DIR/weird-syntax.rs:65:9 @@ -115,8 +119,9 @@ LL | /// [x][struct@Clone ] | help: to link to the trait, prefix with `trait@` | -LL | /// [x][trait@Clone ] - | ~~~~~~ +LL - /// [x][struct@Clone ] +LL + /// [x][trait@Clone ] + | error: unresolved link to `Clone` --> $DIR/weird-syntax.rs:74:9 @@ -158,8 +163,9 @@ LL | /// [w]( struct@Clone) | help: to link to the trait, prefix with `trait@` | -LL | /// [w]( trait@Clone) - | ~~~~~~ +LL - /// [w]( struct@Clone) +LL + /// [w]( trait@Clone) + | error: incompatible link kind for `Clone` --> $DIR/weird-syntax.rs:94:9 @@ -169,8 +175,9 @@ LL | /// [w](struct@Clone ) | help: to link to the trait, prefix with `trait@` | -LL | /// [w](trait@Clone ) - | ~~~~~~ +LL - /// [w](struct@Clone ) +LL + /// [w](trait@Clone ) + | error: unresolved link to `Clone` --> $DIR/weird-syntax.rs:97:9 @@ -223,7 +230,7 @@ LL | /// [w](Clone \)) error: unresolved link to `cln` --> $DIR/weird-syntax.rs:120:10 | -LL | /// The [cln][] link here is going to be unresolved, because `Clone()` gets rejected +LL | /// The [cln][] link here is going to be unresolved, because `Clone()` gets | ^^^ no item named `cln` in scope | = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` @@ -236,37 +243,61 @@ LL | /// [cln]: Clone() | = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` -error: unresolved link to `cln` - --> $DIR/weird-syntax.rs:126:10 +error: incompatible link kind for `Clone` + --> $DIR/weird-syntax.rs:129:12 | -LL | /// The [cln][] link here is going to be unresolved, because `struct@Clone` gets - | ^^^ no item named `cln` in scope +LL | /// [cln]: struct@Clone + | ^^^^^^^^^^^^ this link resolved to a trait, which is not a struct | - = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` - -error: unresolved link to `cln` - --> $DIR/weird-syntax.rs:129:6 +help: to link to the trait, prefix with `trait@` | -LL | /// [cln]: struct@Clone - | ^^^ no item named `cln` in scope +LL - /// [cln]: struct@Clone +LL + /// [cln]: trait@Clone | - = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` error: unresolved link to `Clone` - --> $DIR/weird-syntax.rs:132:9 + --> $DIR/weird-syntax.rs:135:12 | -LL | /// The [cln][] link here will produce a plain text suggestion - | ^^^^^ this link resolves to the trait `Clone`, which is not a function +LL | /// [cln]: Clone\(\) + | ^^^^^^^^^ this link resolves to the trait `Clone`, which is not a function + | +help: to link to the trait, prefix with `trait@` + | +LL - /// [cln]: Clone\(\) +LL + /// [cln]: trait@Clone | - = help: to link to the trait, prefix with `trait@`: trait@Clone error: incompatible link kind for `Clone` - --> $DIR/weird-syntax.rs:137:9 + --> $DIR/weird-syntax.rs:141:12 | -LL | /// The [cln][] link here will produce a plain text suggestion - | ^^^^^ this link resolved to a trait, which is not a struct +LL | /// [cln]: struct\@Clone + | ^^^^^^^^^^^^^ this link resolved to a trait, which is not a struct + | +help: to link to the trait, prefix with `trait@` + | +LL - /// [cln]: struct\@Clone +LL + /// [cln]: trait@struct + | + +error: incompatible link kind for `Clone` + --> $DIR/weird-syntax.rs:149:12 | - = help: to link to the trait, prefix with `trait@`: trait@Clone +LL | /// [cln]: struct\@Clone + | ^^^^^^^^^^^^^ this link resolved to a trait, which is not a struct + | +help: to link to the trait, prefix with `trait@` + | +LL - /// [cln]: struct\@Clone +LL + /// [cln]: trait@struct + | + +error: unresolved link to `the` + --> $DIR/weird-syntax.rs:155:56 + | +LL | /// - [`SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER`]: the + | ^^^ no item named `the` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` -error: aborting due to 26 previous errors +error: aborting due to 27 previous errors diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr index 180ba63927b..2c25589a553 100644 --- a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr +++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr @@ -99,7 +99,7 @@ LL | fn f<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} | ^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/invalid_const_in_lifetime_position.rs:2:10 | LL | trait X { diff --git a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr index 72d1a52f710..e4a84655486 100644 --- a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr +++ b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr @@ -301,7 +301,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `SVec` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/ice-generic-type-alias-105742.rs:15:17 | LL | pub trait SVec: Index< @@ -319,8 +319,9 @@ LL | | > { | |__^ ...because it uses `Self` as a type parameter help: consider using an opaque type instead | -LL | pub fn next<'a, T>(s: &'a mut impl SVec<Item = T, Output = T>) { - | ~~~~ +LL - pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { +LL + pub fn next<'a, T>(s: &'a mut impl SVec<Item = T, Output = T>) { + | error[E0107]: missing generics for associated type `SVec::Item` --> $DIR/ice-generic-type-alias-105742.rs:16:21 diff --git a/tests/rustdoc-ui/issues/ice-typeof-102986.stderr b/tests/rustdoc-ui/issues/ice-typeof-102986.stderr index 20dbb2661bc..02e257a9163 100644 --- a/tests/rustdoc-ui/issues/ice-typeof-102986.stderr +++ b/tests/rustdoc-ui/issues/ice-typeof-102986.stderr @@ -6,8 +6,9 @@ LL | y: (typeof("hey"),), | help: consider replacing `typeof(...)` with an actual type | -LL | y: (&str,), - | ~~~~ +LL - y: (typeof("hey"),), +LL + y: (&str,), + | error: aborting due to 1 previous error diff --git a/tests/rustdoc-ui/issues/issue-120444-1.stderr b/tests/rustdoc-ui/issues/issue-120444-1.stderr index 7bc56b4263f..aabdc91df2b 100644 --- a/tests/rustdoc-ui/issues/issue-120444-1.stderr +++ b/tests/rustdoc-ui/issues/issue-120444-1.stderr @@ -15,8 +15,9 @@ LL | #![deny(rustdoc::redundant_explicit_links)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove explicit link target | -LL | /// [`Vfs`] - | ~~~~~~~ +LL - /// [`Vfs`][crate::Vfs] +LL + /// [`Vfs`] + | error: aborting due to 1 previous error diff --git a/tests/rustdoc-ui/issues/issue-120444-2.stderr b/tests/rustdoc-ui/issues/issue-120444-2.stderr index 310bf08e2b5..ee160736b4d 100644 --- a/tests/rustdoc-ui/issues/issue-120444-2.stderr +++ b/tests/rustdoc-ui/issues/issue-120444-2.stderr @@ -15,8 +15,9 @@ LL | #![deny(rustdoc::redundant_explicit_links)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove explicit link target | -LL | /// [`Vfs`] - | ~~~~~~~ +LL - /// [`Vfs`][crate::Vfs] +LL + /// [`Vfs`] + | error: aborting due to 1 previous error diff --git a/tests/rustdoc-ui/lints/redundant_explicit_links.stderr b/tests/rustdoc-ui/lints/redundant_explicit_links.stderr index 34ec9be6646..f90c41af9f1 100644 --- a/tests/rustdoc-ui/lints/redundant_explicit_links.stderr +++ b/tests/rustdoc-ui/lints/redundant_explicit_links.stderr @@ -15,8 +15,9 @@ LL | #![deny(rustdoc::redundant_explicit_links)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove explicit link target | -LL | /// [dummy_target] - | ~~~~~~~~~~~~~~ +LL - /// [dummy_target](dummy_target) +LL + /// [dummy_target] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:9:22 @@ -30,8 +31,9 @@ LL | /// [`dummy_target`](dummy_target) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`dummy_target`] - | ~~~~~~~~~~~~~~~~ +LL - /// [`dummy_target`](dummy_target) +LL + /// [`dummy_target`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:12:11 @@ -45,8 +47,9 @@ LL | /// [Vec](Vec) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [Vec] - | ~~~~~ +LL - /// [Vec](Vec) +LL + /// [Vec] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:14:13 @@ -60,8 +63,9 @@ LL | /// [`Vec`](Vec) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`Vec`] - | ~~~~~~~ +LL - /// [`Vec`](Vec) +LL + /// [`Vec`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:16:11 @@ -75,8 +79,9 @@ LL | /// [Vec](std::vec::Vec) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [Vec] - | ~~~~~ +LL - /// [Vec](std::vec::Vec) +LL + /// [Vec] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:18:13 @@ -90,8 +95,9 @@ LL | /// [`Vec`](std::vec::Vec) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`Vec`] - | ~~~~~~~ +LL - /// [`Vec`](std::vec::Vec) +LL + /// [`Vec`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:20:21 @@ -105,8 +111,9 @@ LL | /// [std::vec::Vec](Vec) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [std::vec::Vec] - | ~~~~~~~~~~~~~~~ +LL - /// [std::vec::Vec](Vec) +LL + /// [std::vec::Vec] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:22:23 @@ -120,8 +127,9 @@ LL | /// [`std::vec::Vec`](Vec) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`std::vec::Vec`] - | ~~~~~~~~~~~~~~~~~ +LL - /// [`std::vec::Vec`](Vec) +LL + /// [`std::vec::Vec`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:24:21 @@ -135,8 +143,9 @@ LL | /// [std::vec::Vec](std::vec::Vec) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [std::vec::Vec] - | ~~~~~~~~~~~~~~~ +LL - /// [std::vec::Vec](std::vec::Vec) +LL + /// [std::vec::Vec] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:26:23 @@ -150,8 +159,9 @@ LL | /// [`std::vec::Vec`](std::vec::Vec) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`std::vec::Vec`] - | ~~~~~~~~~~~~~~~~~ +LL - /// [`std::vec::Vec`](std::vec::Vec) +LL + /// [`std::vec::Vec`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:29:13 @@ -165,8 +175,9 @@ LL | /// [usize](usize) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [usize] - | ~~~~~~~ +LL - /// [usize](usize) +LL + /// [usize] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:31:15 @@ -180,8 +191,9 @@ LL | /// [`usize`](usize) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`usize`] - | ~~~~~~~~~ +LL - /// [`usize`](usize) +LL + /// [`usize`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:33:13 @@ -195,8 +207,9 @@ LL | /// [usize](std::primitive::usize) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [usize] - | ~~~~~~~ +LL - /// [usize](std::primitive::usize) +LL + /// [usize] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:35:15 @@ -210,8 +223,9 @@ LL | /// [`usize`](std::primitive::usize) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`usize`] - | ~~~~~~~~~ +LL - /// [`usize`](std::primitive::usize) +LL + /// [`usize`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:37:29 @@ -225,8 +239,9 @@ LL | /// [std::primitive::usize](usize) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [std::primitive::usize] - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - /// [std::primitive::usize](usize) +LL + /// [std::primitive::usize] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:39:31 @@ -240,8 +255,9 @@ LL | /// [`std::primitive::usize`](usize) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`std::primitive::usize`] - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - /// [`std::primitive::usize`](usize) +LL + /// [`std::primitive::usize`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:41:29 @@ -255,8 +271,9 @@ LL | /// [std::primitive::usize](std::primitive::usize) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [std::primitive::usize] - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - /// [std::primitive::usize](std::primitive::usize) +LL + /// [std::primitive::usize] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:43:31 @@ -270,8 +287,9 @@ LL | /// [`std::primitive::usize`](std::primitive::usize) the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`std::primitive::usize`] - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - /// [`std::primitive::usize`](std::primitive::usize) +LL + /// [`std::primitive::usize`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:46:20 @@ -285,8 +303,9 @@ LL | /// [dummy_target](dummy_target) TEXT the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [dummy_target] TEXT - | ~~~~~~~~~~~~~~ +LL - /// [dummy_target](dummy_target) TEXT +LL + /// [dummy_target] TEXT + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:48:22 @@ -300,8 +319,9 @@ LL | /// [`dummy_target`](dummy_target) TEXT the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`dummy_target`] TEXT - | ~~~~~~~~~~~~~~~~ +LL - /// [`dummy_target`](dummy_target) TEXT +LL + /// [`dummy_target`] TEXT + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:56:20 @@ -315,8 +335,9 @@ LL | /// [dummy_target][dummy_target] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [dummy_target] - | ~~~~~~~~~~~~~~ +LL - /// [dummy_target][dummy_target] +LL + /// [dummy_target] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:58:22 @@ -330,8 +351,9 @@ LL | /// [`dummy_target`][dummy_target] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`dummy_target`] - | ~~~~~~~~~~~~~~~~ +LL - /// [`dummy_target`][dummy_target] +LL + /// [`dummy_target`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:61:11 @@ -345,8 +367,9 @@ LL | /// [Vec][Vec] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [Vec] - | ~~~~~ +LL - /// [Vec][Vec] +LL + /// [Vec] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:63:13 @@ -360,8 +383,9 @@ LL | /// [`Vec`][Vec] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`Vec`] - | ~~~~~~~ +LL - /// [`Vec`][Vec] +LL + /// [`Vec`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:65:11 @@ -375,8 +399,9 @@ LL | /// [Vec][std::vec::Vec] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [Vec] - | ~~~~~ +LL - /// [Vec][std::vec::Vec] +LL + /// [Vec] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:67:13 @@ -390,8 +415,9 @@ LL | /// [`Vec`][std::vec::Vec] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`Vec`] - | ~~~~~~~ +LL - /// [`Vec`][std::vec::Vec] +LL + /// [`Vec`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:69:21 @@ -405,8 +431,9 @@ LL | /// [std::vec::Vec][Vec] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [std::vec::Vec] - | ~~~~~~~~~~~~~~~ +LL - /// [std::vec::Vec][Vec] +LL + /// [std::vec::Vec] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:71:23 @@ -420,8 +447,9 @@ LL | /// [`std::vec::Vec`][Vec] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`std::vec::Vec`] - | ~~~~~~~~~~~~~~~~~ +LL - /// [`std::vec::Vec`][Vec] +LL + /// [`std::vec::Vec`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:73:21 @@ -435,8 +463,9 @@ LL | /// [std::vec::Vec][std::vec::Vec] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [std::vec::Vec] - | ~~~~~~~~~~~~~~~ +LL - /// [std::vec::Vec][std::vec::Vec] +LL + /// [std::vec::Vec] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:75:23 @@ -450,8 +479,9 @@ LL | /// [`std::vec::Vec`][std::vec::Vec] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`std::vec::Vec`] - | ~~~~~~~~~~~~~~~~~ +LL - /// [`std::vec::Vec`][std::vec::Vec] +LL + /// [`std::vec::Vec`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:78:13 @@ -465,8 +495,9 @@ LL | /// [usize][usize] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [usize] - | ~~~~~~~ +LL - /// [usize][usize] +LL + /// [usize] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:80:15 @@ -480,8 +511,9 @@ LL | /// [`usize`][usize] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`usize`] - | ~~~~~~~~~ +LL - /// [`usize`][usize] +LL + /// [`usize`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:82:13 @@ -495,8 +527,9 @@ LL | /// [usize][std::primitive::usize] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [usize] - | ~~~~~~~ +LL - /// [usize][std::primitive::usize] +LL + /// [usize] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:84:15 @@ -510,8 +543,9 @@ LL | /// [`usize`][std::primitive::usize] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`usize`] - | ~~~~~~~~~ +LL - /// [`usize`][std::primitive::usize] +LL + /// [`usize`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:86:29 @@ -525,8 +559,9 @@ LL | /// [std::primitive::usize][usize] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [std::primitive::usize] - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - /// [std::primitive::usize][usize] +LL + /// [std::primitive::usize] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:88:31 @@ -540,8 +575,9 @@ LL | /// [`std::primitive::usize`][usize] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`std::primitive::usize`] - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - /// [`std::primitive::usize`][usize] +LL + /// [`std::primitive::usize`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:90:29 @@ -555,8 +591,9 @@ LL | /// [std::primitive::usize][std::primitive::usize] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [std::primitive::usize] - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - /// [std::primitive::usize][std::primitive::usize] +LL + /// [std::primitive::usize] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:92:31 @@ -570,8 +607,9 @@ LL | /// [`std::primitive::usize`][std::primitive::usize] the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`std::primitive::usize`] - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - /// [`std::primitive::usize`][std::primitive::usize] +LL + /// [`std::primitive::usize`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:95:20 @@ -585,8 +623,9 @@ LL | /// [dummy_target][dummy_target] TEXT the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [dummy_target] TEXT - | ~~~~~~~~~~~~~~ +LL - /// [dummy_target][dummy_target] TEXT +LL + /// [dummy_target] TEXT + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:97:22 @@ -600,8 +639,9 @@ LL | /// [`dummy_target`][dummy_target] TEXT the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`dummy_target`] TEXT - | ~~~~~~~~~~~~~~~~ +LL - /// [`dummy_target`][dummy_target] TEXT +LL + /// [`dummy_target`] TEXT + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:105:20 @@ -620,8 +660,9 @@ LL | /// [dummy_target]: dummy_target the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [dummy_target] - | ~~~~~~~~~~~~~~ +LL - /// [dummy_target][dummy_target] +LL + /// [dummy_target] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:107:22 @@ -640,8 +681,9 @@ LL | /// [dummy_target]: dummy_target the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`dummy_target`] - | ~~~~~~~~~~~~~~~~ +LL - /// [`dummy_target`][dummy_target] +LL + /// [`dummy_target`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:110:11 @@ -660,8 +702,9 @@ LL | /// [Vec]: Vec the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [Vec] - | ~~~~~ +LL - /// [Vec][Vec] +LL + /// [Vec] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:112:13 @@ -680,8 +723,9 @@ LL | /// [Vec]: Vec the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`Vec`] - | ~~~~~~~ +LL - /// [`Vec`][Vec] +LL + /// [`Vec`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:114:11 @@ -700,8 +744,9 @@ LL | /// [std::vec::Vec]: Vec the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [Vec] - | ~~~~~ +LL - /// [Vec][std::vec::Vec] +LL + /// [Vec] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:116:13 @@ -720,8 +765,9 @@ LL | /// [std::vec::Vec]: Vec the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`Vec`] - | ~~~~~~~ +LL - /// [`Vec`][std::vec::Vec] +LL + /// [`Vec`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:118:21 @@ -740,8 +786,9 @@ LL | /// [Vec]: Vec the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [std::vec::Vec] - | ~~~~~~~~~~~~~~~ +LL - /// [std::vec::Vec][Vec] +LL + /// [std::vec::Vec] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:120:23 @@ -760,8 +807,9 @@ LL | /// [Vec]: Vec the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`std::vec::Vec`] - | ~~~~~~~~~~~~~~~~~ +LL - /// [`std::vec::Vec`][Vec] +LL + /// [`std::vec::Vec`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:122:21 @@ -780,8 +828,9 @@ LL | /// [std::vec::Vec]: Vec the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [std::vec::Vec] - | ~~~~~~~~~~~~~~~ +LL - /// [std::vec::Vec][std::vec::Vec] +LL + /// [std::vec::Vec] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:124:23 @@ -800,8 +849,9 @@ LL | /// [std::vec::Vec]: Vec the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`std::vec::Vec`] - | ~~~~~~~~~~~~~~~~~ +LL - /// [`std::vec::Vec`][std::vec::Vec] +LL + /// [`std::vec::Vec`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:127:13 @@ -820,8 +870,9 @@ LL | /// [usize]: usize the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [usize] - | ~~~~~~~ +LL - /// [usize][usize] +LL + /// [usize] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:129:15 @@ -840,8 +891,9 @@ LL | /// [usize]: usize the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`usize`] - | ~~~~~~~~~ +LL - /// [`usize`][usize] +LL + /// [`usize`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:131:13 @@ -860,8 +912,9 @@ LL | /// [std::primitive::usize]: usize the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [usize] - | ~~~~~~~ +LL - /// [usize][std::primitive::usize] +LL + /// [usize] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:133:15 @@ -880,8 +933,9 @@ LL | /// [std::primitive::usize]: usize the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`usize`] - | ~~~~~~~~~ +LL - /// [`usize`][std::primitive::usize] +LL + /// [`usize`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:135:29 @@ -900,8 +954,9 @@ LL | /// [usize]: usize the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [std::primitive::usize] - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - /// [std::primitive::usize][usize] +LL + /// [std::primitive::usize] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:137:31 @@ -920,8 +975,9 @@ LL | /// [usize]: usize the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`std::primitive::usize`] - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - /// [`std::primitive::usize`][usize] +LL + /// [`std::primitive::usize`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:139:29 @@ -940,8 +996,9 @@ LL | /// [std::primitive::usize]: usize the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [std::primitive::usize] - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - /// [std::primitive::usize][std::primitive::usize] +LL + /// [std::primitive::usize] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:141:31 @@ -960,8 +1017,9 @@ LL | /// [std::primitive::usize]: usize the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`std::primitive::usize`] - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - /// [`std::primitive::usize`][std::primitive::usize] +LL + /// [`std::primitive::usize`] + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:144:20 @@ -980,8 +1038,9 @@ LL | /// [dummy_target]: dummy_target the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [dummy_target] TEXT - | ~~~~~~~~~~~~~~ +LL - /// [dummy_target][dummy_target] TEXT +LL + /// [dummy_target] TEXT + | error: redundant explicit link target --> $DIR/redundant_explicit_links.rs:146:22 @@ -1000,8 +1059,9 @@ LL | /// [dummy_target]: dummy_target the label is used to resolve intra-doc links help: remove explicit link target | -LL | /// [`dummy_target`] TEXT - | ~~~~~~~~~~~~~~~~ +LL - /// [`dummy_target`][dummy_target] TEXT +LL + /// [`dummy_target`] TEXT + | error: aborting due to 60 previous errors diff --git a/tests/rustdoc/assoc-consts.rs b/tests/rustdoc/assoc-consts.rs index cb8e839541c..247b5b180a8 100644 --- a/tests/rustdoc/assoc-consts.rs +++ b/tests/rustdoc/assoc-consts.rs @@ -45,7 +45,7 @@ pub fn f(_: &(ToString + 'static)) {} impl Bar { //@ has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.F"]' \ - // "const F: fn(_: &(dyn ToString + 'static))" + // "const F: fn(&(dyn ToString + 'static))" pub const F: fn(_: &(ToString + 'static)) = f; } diff --git a/tests/rustdoc/cfg_doc_reexport.rs b/tests/rustdoc/cfg_doc_reexport.rs index f8101e2a958..44ec3663284 100644 --- a/tests/rustdoc/cfg_doc_reexport.rs +++ b/tests/rustdoc/cfg_doc_reexport.rs @@ -1,9 +1,12 @@ #![feature(doc_cfg)] -#![feature(no_core)] +#![feature(no_core, lang_items)] #![crate_name = "foo"] #![no_core] +#[lang = "sized"] +trait Sized {} + //@ has 'foo/index.html' //@ has - '//dt/*[@class="stab portability"]' 'foobar' //@ has - '//dt/*[@class="stab portability"]' 'bar' diff --git a/tests/rustdoc/check-source-code-urls-to-def.rs b/tests/rustdoc/check-source-code-urls-to-def.rs index 8703287abc5..d701b88bf9f 100644 --- a/tests/rustdoc/check-source-code-urls-to-def.rs +++ b/tests/rustdoc/check-source-code-urls-to-def.rs @@ -31,7 +31,8 @@ fn babar() {} //@ has - '//pre[@class="rust"]//a/@href' '/struct.String.html' //@ has - '//pre[@class="rust"]//a/@href' '/primitive.u32.html' //@ has - '//pre[@class="rust"]//a/@href' '/primitive.str.html' -//@ count - '//pre[@class="rust"]//a[@href="#23"]' 5 +// The 5 links to line 23 and the line 23 itself. +//@ count - '//pre[@class="rust"]//a[@href="#23"]' 6 //@ has - '//pre[@class="rust"]//a[@href="../../source_code/struct.SourceCode.html"]' \ // 'source_code::SourceCode' pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::SourceCode) { @@ -50,8 +51,8 @@ pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V, b: bool) {} pub trait AnotherTrait {} pub trait WhyNot {} -//@ has - '//pre[@class="rust"]//a[@href="#50"]' 'AnotherTrait' -//@ has - '//pre[@class="rust"]//a[@href="#51"]' 'WhyNot' +//@ has - '//pre[@class="rust"]//a[@href="#51"]' 'AnotherTrait' +//@ has - '//pre[@class="rust"]//a[@href="#52"]' 'WhyNot' pub fn foo3<T, V>(t: &T, v: &V) where T: AnotherTrait, @@ -60,7 +61,7 @@ where pub trait AnotherTrait2 {} -//@ has - '//pre[@class="rust"]//a[@href="#61"]' 'AnotherTrait2' +//@ has - '//pre[@class="rust"]//a[@href="#62"]' 'AnotherTrait2' pub fn foo4() { let x: Vec<&dyn AnotherTrait2> = Vec::new(); } diff --git a/tests/rustdoc/cross-crate-primitive-doc.rs b/tests/rustdoc/cross-crate-primitive-doc.rs index ca33dedcbae..0ffde5b0f2d 100644 --- a/tests/rustdoc/cross-crate-primitive-doc.rs +++ b/tests/rustdoc/cross-crate-primitive-doc.rs @@ -2,9 +2,12 @@ //@ compile-flags: --extern-html-root-url=primitive_doc=../ -Z unstable-options //@ only-linux -#![feature(no_core)] +#![feature(no_core, lang_items)] #![no_core] +#[lang = "sized"] +trait Sized {} + extern crate primitive_doc; //@ has 'cross_crate_primitive_doc/fn.foo.html' '//a[@href="../primitive_doc/primitive.usize.html"]' 'usize' diff --git a/tests/rustdoc/fn-pointer-arg-name.rs b/tests/rustdoc/fn-pointer-arg-name.rs index 3bde6e9ecfa..0ee1964511a 100644 --- a/tests/rustdoc/fn-pointer-arg-name.rs +++ b/tests/rustdoc/fn-pointer-arg-name.rs @@ -3,3 +3,11 @@ //@ has foo/fn.f.html //@ has - '//pre[@class="rust item-decl"]' 'pub fn f(callback: fn(len: usize, foo: u32))' pub fn f(callback: fn(len: usize, foo: u32)) {} + +//@ has foo/fn.g.html +//@ has - '//pre[@class="rust item-decl"]' 'pub fn g(_: fn(usize, u32))' +pub fn g(_: fn(usize, _: u32)) {} + +//@ has foo/fn.mixed.html +//@ has - '//pre[@class="rust item-decl"]' 'pub fn mixed(_: fn(_: usize, foo: u32))' +pub fn mixed(_: fn(usize, foo: u32)) {} diff --git a/tests/rustdoc/inherent-projections.rs b/tests/rustdoc/inherent-projections.rs index 4fc769f70f5..ced4db9a490 100644 --- a/tests/rustdoc/inherent-projections.rs +++ b/tests/rustdoc/inherent-projections.rs @@ -13,7 +13,7 @@ impl Owner { } // Make sure we handle bound vars correctly. -//@ has 'inherent_projections/fn.user.html' '//pre[@class="rust item-decl"]' "user(_: for<'a> fn(_: Carrier<'a>::Focus))" +//@ has 'inherent_projections/fn.user.html' '//pre[@class="rust item-decl"]' "user(_: for<'a> fn(Carrier<'a>::Focus))" pub fn user(_: for<'a> fn(Carrier<'a>::Focus)) {} pub struct Carrier<'a>(&'a ()); diff --git a/tests/rustdoc/inline_cross/issue-28480.rs b/tests/rustdoc/inline_cross/doc-hidden-broken-link-28480.rs index 004510fd922..e1ca7403c03 100644 --- a/tests/rustdoc/inline_cross/issue-28480.rs +++ b/tests/rustdoc/inline_cross/doc-hidden-broken-link-28480.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/28480 +#![crate_name="foobar"] + //@ aux-build:rustdoc-hidden-sig.rs //@ build-aux-docs //@ ignore-cross-compile @@ -7,7 +10,7 @@ //@ has - '//a' 'u8' extern crate rustdoc_hidden_sig; -//@ has issue_28480/struct.Bar.html +//@ has foobar/struct.Bar.html //@ !has - '//a/@title' 'Hidden' //@ has - '//a' 'u8' pub use rustdoc_hidden_sig::Bar; diff --git a/tests/rustdoc/inline_cross/issue-31948-1.rs b/tests/rustdoc/inline_cross/doc-reachability-impl-31948-1.rs index e59da87c29d..baab1da9547 100644 --- a/tests/rustdoc/inline_cross/issue-31948-1.rs +++ b/tests/rustdoc/inline_cross/doc-reachability-impl-31948-1.rs @@ -1,27 +1,30 @@ +// https://github.com/rust-lang/rust/issues/31948 +#![crate_name="foobar"] + //@ aux-build:rustdoc-nonreachable-impls.rs //@ build-aux-docs //@ ignore-cross-compile extern crate rustdoc_nonreachable_impls; -//@ has issue_31948_1/struct.Wobble.html +//@ has foobar/struct.Wobble.html //@ has - '//*[@class="impl"]//h3[@class="code-header"]' 'Bark for' //@ has - '//*[@class="impl"]//h3[@class="code-header"]' 'Woof for' //@ !has - '//*[@class="impl"]//h3[@class="code-header"]' 'Bar for' //@ !has - '//*[@class="impl"]//h3[@class="code-header"]' 'Qux for' pub use rustdoc_nonreachable_impls::hidden::Wobble; -//@ has issue_31948_1/trait.Bark.html +//@ has foobar/trait.Bark.html //@ has - '//h3[@class="code-header"]' 'for Foo' //@ has - '//h3[@class="code-header"]' 'for Wobble' //@ !has - '//h3[@class="code-header"]' 'for Wibble' pub use rustdoc_nonreachable_impls::Bark; -//@ has issue_31948_1/trait.Woof.html +//@ has foobar/trait.Woof.html //@ has - '//h3[@class="code-header"]' 'for Foo' //@ has - '//h3[@class="code-header"]' 'for Wobble' //@ !has - '//h3[@class="code-header"]' 'for Wibble' pub use rustdoc_nonreachable_impls::Woof; -//@ !has issue_31948_1/trait.Bar.html -//@ !has issue_31948_1/trait.Qux.html +//@ !has foobar/trait.Bar.html +//@ !has foobar/trait.Qux.html diff --git a/tests/rustdoc/inline_cross/issue-31948-2.rs b/tests/rustdoc/inline_cross/doc-reachability-impl-31948-2.rs index 34b57052883..40e9108ec62 100644 --- a/tests/rustdoc/inline_cross/issue-31948-2.rs +++ b/tests/rustdoc/inline_cross/doc-reachability-impl-31948-2.rs @@ -1,21 +1,24 @@ +// https://github.com/rust-lang/rust/issues/31948 +#![crate_name="foobar"] + //@ aux-build:rustdoc-nonreachable-impls.rs //@ build-aux-docs //@ ignore-cross-compile extern crate rustdoc_nonreachable_impls; -//@ has issue_31948_2/struct.Wobble.html +//@ has foobar/struct.Wobble.html //@ has - '//*[@class="impl"]//h3[@class="code-header"]' 'Qux for' //@ has - '//*[@class="impl"]//h3[@class="code-header"]' 'Bark for' //@ has - '//*[@class="impl"]//h3[@class="code-header"]' 'Woof for' //@ !has - '//*[@class="impl"]//h3[@class="code-header"]' 'Bar for' pub use rustdoc_nonreachable_impls::hidden::Wobble; -//@ has issue_31948_2/trait.Qux.html +//@ has foobar/trait.Qux.html //@ has - '//h3[@class="code-header"]' 'for Foo' //@ has - '//h3[@class="code-header"]' 'for Wobble' pub use rustdoc_nonreachable_impls::hidden::Qux; -//@ !has issue_31948_2/trait.Bar.html -//@ !has issue_31948_2/trait.Woof.html -//@ !has issue_31948_2/trait.Bark.html +//@ !has foobar/trait.Bar.html +//@ !has foobar/trait.Woof.html +//@ !has foobar/trait.Bark.html diff --git a/tests/rustdoc/inline_cross/issue-31948.rs b/tests/rustdoc/inline_cross/doc-reachability-impl-31948.rs index 7a43fc7b279..ab0048513c7 100644 --- a/tests/rustdoc/inline_cross/issue-31948.rs +++ b/tests/rustdoc/inline_cross/doc-reachability-impl-31948.rs @@ -1,29 +1,32 @@ +// https://github.com/rust-lang/rust/issues/31948 +#![crate_name="foobar"] + //@ aux-build:rustdoc-nonreachable-impls.rs //@ build-aux-docs //@ ignore-cross-compile extern crate rustdoc_nonreachable_impls; -//@ has issue_31948/struct.Foo.html +//@ has foobar/struct.Foo.html //@ has - '//*[@class="impl"]//h3[@class="code-header"]' 'Bark for' //@ has - '//*[@class="impl"]//h3[@class="code-header"]' 'Woof for' //@ !has - '//*[@class="impl"]//h3[@class="code-header"]' 'Bar for' //@ !has - '//*[@class="impl"]//h3[@class="code-header"]' 'Qux for' pub use rustdoc_nonreachable_impls::Foo; -//@ has issue_31948/trait.Bark.html +//@ has foobar/trait.Bark.html //@ has - '//h3[@class="code-header"]' 'for Foo' //@ !has - '//h3[@class="code-header"]' 'for Wibble' //@ !has - '//h3[@class="code-header"]' 'for Wobble' pub use rustdoc_nonreachable_impls::Bark; -//@ has issue_31948/trait.Woof.html +//@ has foobar/trait.Woof.html //@ has - '//h3[@class="code-header"]' 'for Foo' //@ !has - '//h3[@class="code-header"]' 'for Wibble' //@ !has - '//h3[@class="code-header"]' 'for Wobble' pub use rustdoc_nonreachable_impls::Woof; -//@ !has issue_31948/trait.Bar.html -//@ !has issue_31948/trait.Qux.html -//@ !has issue_31948/struct.Wibble.html -//@ !has issue_31948/struct.Wobble.html +//@ !has foobar/trait.Bar.html +//@ !has foobar/trait.Qux.html +//@ !has foobar/struct.Wibble.html +//@ !has foobar/struct.Wobble.html diff --git a/tests/rustdoc/inline_cross/issue-32881.rs b/tests/rustdoc/inline_cross/impl-dyn-trait-32881.rs index d4ebf10a1ca..f7dc7414455 100644 --- a/tests/rustdoc/inline_cross/issue-32881.rs +++ b/tests/rustdoc/inline_cross/impl-dyn-trait-32881.rs @@ -1,10 +1,13 @@ +// https://github.com/rust-lang/rust/issues/32881 +#![crate_name="foobar"] + //@ aux-build:rustdoc-trait-object-impl.rs //@ build-aux-docs //@ ignore-cross-compile extern crate rustdoc_trait_object_impl; -//@ has issue_32881/trait.Bar.html +//@ has foobar/trait.Bar.html //@ has - '//h3[@class="code-header"]' "impl<'a> dyn Bar" //@ has - '//h3[@class="code-header"]' "impl<'a> Debug for dyn Bar" diff --git a/tests/rustdoc/inline_cross/issue-33113.rs b/tests/rustdoc/inline_cross/impl-ref-33113.rs index 05e87d962cb..9ac4f02e00c 100644 --- a/tests/rustdoc/inline_cross/issue-33113.rs +++ b/tests/rustdoc/inline_cross/impl-ref-33113.rs @@ -1,10 +1,13 @@ +// https://github.com/rust-lang/rust/issues/33113 +#![crate_name="foobar"] + //@ aux-build:issue-33113.rs //@ build-aux-docs //@ ignore-cross-compile extern crate bar; -//@ has issue_33113/trait.Bar.html +//@ has foobar/trait.Bar.html //@ has - '//h3[@class="code-header"]' "for &'a char" //@ has - '//h3[@class="code-header"]' "for Foo" pub use bar::Bar; diff --git a/tests/rustdoc/inline_cross/issue-76736-1.rs b/tests/rustdoc/inline_cross/rustc-private-76736-1.rs index fe52702fd6f..3ffa5e6cc06 100644 --- a/tests/rustdoc/inline_cross/issue-76736-1.rs +++ b/tests/rustdoc/inline_cross/rustc-private-76736-1.rs @@ -1,3 +1,5 @@ +// https://github.com/rust-lang/rust/issues/76736 + //@ aux-build:issue-76736-1.rs //@ aux-build:issue-76736-2.rs diff --git a/tests/rustdoc/inline_cross/issue-76736-2.rs b/tests/rustdoc/inline_cross/rustc-private-76736-2.rs index df376ebe9a1..843b2941602 100644 --- a/tests/rustdoc/inline_cross/issue-76736-2.rs +++ b/tests/rustdoc/inline_cross/rustc-private-76736-2.rs @@ -1,3 +1,5 @@ +// https://github.com/rust-lang/rust/issues/76736 + //@ aux-build:issue-76736-1.rs //@ aux-build:issue-76736-2.rs diff --git a/tests/rustdoc/inline_cross/issue-76736-3.rs b/tests/rustdoc/inline_cross/rustc-private-76736-3.rs index 1bed4621c04..f9b46caa02f 100644 --- a/tests/rustdoc/inline_cross/issue-76736-3.rs +++ b/tests/rustdoc/inline_cross/rustc-private-76736-3.rs @@ -1,3 +1,5 @@ +// https://github.com/rust-lang/rust/issues/76736 + //@ compile-flags: -Zforce-unstable-if-unmarked //@ aux-build:issue-76736-1.rs //@ aux-build:issue-76736-2.rs diff --git a/tests/rustdoc/inline_cross/issue-76736-4.rs b/tests/rustdoc/inline_cross/rustc-private-76736-4.rs index 487e9030108..511464f2c49 100644 --- a/tests/rustdoc/inline_cross/issue-76736-4.rs +++ b/tests/rustdoc/inline_cross/rustc-private-76736-4.rs @@ -1,3 +1,5 @@ +// https://github.com/rust-lang/rust/issues/76736 + //@ aux-build:issue-76736-1.rs //@ aux-build:issue-76736-2.rs diff --git a/tests/rustdoc/inline_cross/issue-24183.method_no_where_self_sized.html b/tests/rustdoc/inline_cross/self-sized-bounds-24183.method_no_where_self_sized.html index f3c1c045202..f3c1c045202 100644 --- a/tests/rustdoc/inline_cross/issue-24183.method_no_where_self_sized.html +++ b/tests/rustdoc/inline_cross/self-sized-bounds-24183.method_no_where_self_sized.html diff --git a/tests/rustdoc/inline_cross/issue-24183.rs b/tests/rustdoc/inline_cross/self-sized-bounds-24183.rs index 8299eecc575..909005532f5 100644 --- a/tests/rustdoc/inline_cross/issue-24183.rs +++ b/tests/rustdoc/inline_cross/self-sized-bounds-24183.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/24183 #![crate_type = "lib"] #![crate_name = "usr"] diff --git a/tests/rustdoc/inline_local/issue-32343.rs b/tests/rustdoc/inline_local/doc-no-inline-32343.rs index 2ec123fdc5c..ed11614a500 100644 --- a/tests/rustdoc/inline_local/issue-32343.rs +++ b/tests/rustdoc/inline_local/doc-no-inline-32343.rs @@ -1,12 +1,15 @@ -//@ !has issue_32343/struct.Foo.html -//@ has issue_32343/index.html +// https://github.com/rust-lang/rust/issues/32343 +#![crate_name="foobar"] + +//@ !has foobar/struct.Foo.html +//@ has foobar/index.html //@ has - '//code' 'pub use foo::Foo' //@ !has - '//code/a' 'Foo' #[doc(no_inline)] pub use foo::Foo; -//@ !has issue_32343/struct.Bar.html -//@ has issue_32343/index.html +//@ !has foobar/struct.Bar.html +//@ has foobar/index.html //@ has - '//code' 'pub use foo::Bar' //@ has - '//code/a' 'Bar' #[doc(no_inline)] @@ -18,6 +21,6 @@ mod foo { } pub mod bar { - //@ has issue_32343/bar/struct.Bar.html + //@ has foobar/bar/struct.Bar.html pub use ::foo::Bar; } diff --git a/tests/rustdoc/inline_local/fully-stable-path-is-better.rs b/tests/rustdoc/inline_local/fully-stable-path-is-better.rs index 88b0b0d57b0..41bf42d2e7a 100644 --- a/tests/rustdoc/inline_local/fully-stable-path-is-better.rs +++ b/tests/rustdoc/inline_local/fully-stable-path-is-better.rs @@ -16,10 +16,10 @@ pub mod stb1 { #[unstable(feature = "uns", issue = "135003")] pub mod uns { #[stable(since = "1.0", feature = "stb1")] - #[rustc_allowed_through_unstable_modules] + #[rustc_allowed_through_unstable_modules = "use stable path instead"] pub struct Inside1; #[stable(since = "1.0", feature = "stb2")] - #[rustc_allowed_through_unstable_modules] + #[rustc_allowed_through_unstable_modules = "use stable path instead"] pub struct Inside2; } diff --git a/tests/rustdoc/inline_local/issue-28537.rs b/tests/rustdoc/inline_local/pub-re-export-28537.rs index d5ba94d2e6c..0e9836c7cee 100644 --- a/tests/rustdoc/inline_local/issue-28537.rs +++ b/tests/rustdoc/inline_local/pub-re-export-28537.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/28537 +#![crate_name="foo"] + #[doc(hidden)] pub mod foo { pub struct Foo; @@ -10,8 +13,8 @@ mod bar { } } -//@ has issue_28537/struct.Foo.html +//@ has foo/struct.Foo.html pub use foo::Foo; -//@ has issue_28537/struct.Bar.html +//@ has foo/struct.Bar.html pub use self::bar::Bar; diff --git a/tests/rustdoc/intra-doc/issue-82209.rs b/tests/rustdoc/intra-doc/enum-self-82209.rs index 46d028e535c..615115a5f8b 100644 --- a/tests/rustdoc/intra-doc/issue-82209.rs +++ b/tests/rustdoc/intra-doc/enum-self-82209.rs @@ -1,3 +1,5 @@ +// https://github.com/rust-lang/rust/issues/82209 + #![crate_name = "foo"] #![deny(rustdoc::broken_intra_doc_links)] pub enum Foo { diff --git a/tests/rustdoc/intra-doc/issue-108459.rs b/tests/rustdoc/intra-doc/link-same-name-different-disambiguator-108459.rs index 18424c069d3..0b339eaf6b2 100644 --- a/tests/rustdoc/intra-doc/issue-108459.rs +++ b/tests/rustdoc/intra-doc/link-same-name-different-disambiguator-108459.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/pull/108459 +#![crate_name="foobar"] + #![deny(rustdoc::broken_intra_doc_links)] #![allow(rustdoc::redundant_explicit_links)] @@ -13,13 +16,13 @@ pub struct MyStruct1; // the same target but different text /// See also [crate::char] and [mod@char] and [prim@char] -//@ has issue_108459/struct.MyStruct2.html '//*[@href="char/index.html"]' 'crate::char' +//@ has foobar/struct.MyStruct2.html '//*[@href="char/index.html"]' 'crate::char' //@ has - '//*[@href="char/index.html"]' 'char' //@ has - '//*[@href="{{channel}}/std/primitive.char.html"]' 'char' pub struct MyStruct2; /// See also [mod@char] and [prim@char] and [crate::char] -//@ has issue_108459/struct.MyStruct3.html '//*[@href="char/index.html"]' 'crate::char' +//@ has foobar/struct.MyStruct3.html '//*[@href="char/index.html"]' 'crate::char' //@ has - '//*[@href="char/index.html"]' 'char' //@ has - '//*[@href="{{channel}}/std/primitive.char.html"]' 'char' pub struct MyStruct3; @@ -28,11 +31,11 @@ pub struct MyStruct3; // different targets /// See also [char][mod@char] and [char][prim@char] -//@ has issue_108459/struct.MyStruct4.html '//*[@href="char/index.html"]' 'char' +//@ has foobar/struct.MyStruct4.html '//*[@href="char/index.html"]' 'char' //@ has - '//*[@href="{{channel}}/std/primitive.char.html"]' 'char' pub struct MyStruct4; /// See also [char][prim@char] and [char][crate::char] -//@ has issue_108459/struct.MyStruct5.html '//*[@href="char/index.html"]' 'char' +//@ has foobar/struct.MyStruct5.html '//*[@href="char/index.html"]' 'char' //@ has - '//*[@href="{{channel}}/std/primitive.char.html"]' 'char' pub struct MyStruct5; diff --git a/tests/rustdoc/intra-doc/no-doc-primitive.rs b/tests/rustdoc/intra-doc/no-doc-primitive.rs index 1f8622ab867..79825643b98 100644 --- a/tests/rustdoc/intra-doc/no-doc-primitive.rs +++ b/tests/rustdoc/intra-doc/no-doc-primitive.rs @@ -6,8 +6,13 @@ #![rustc_coherence_is_core] #![crate_type = "rlib"] + //@ has no_doc_primitive/index.html //! A [`char`] and its [`char::len_utf8`]. + +#[lang = "sized"] +trait Sized {} + impl char { pub fn len_utf8(self) -> usize { 42 diff --git a/tests/rustdoc/intra-doc/issue-66159.rs b/tests/rustdoc/intra-doc/same-name-different-crates-66159.rs index 5d50f63f299..7e3ace9355a 100644 --- a/tests/rustdoc/intra-doc/issue-66159.rs +++ b/tests/rustdoc/intra-doc/same-name-different-crates-66159.rs @@ -1,3 +1,6 @@ +// https://github.com/rust-lang/rust/issues/66159 +#![crate_name="foobar"] + //@ aux-crate:priv:pub_struct=pub-struct.rs //@ compile-flags:-Z unstable-options @@ -6,5 +9,5 @@ // Since we don't generate the docs for the auxiliary files, we can't actually // verify that the struct is linked correctly. -//@ has issue_66159/index.html +//@ has foobar/index.html //! [pub_struct::SomeStruct] diff --git a/tests/rustdoc/macro-higher-kinded-function.rs b/tests/rustdoc/macro-higher-kinded-function.rs index f14125d1309..738ea8fb3f1 100644 --- a/tests/rustdoc/macro-higher-kinded-function.rs +++ b/tests/rustdoc/macro-higher-kinded-function.rs @@ -11,10 +11,10 @@ macro_rules! gen { } //@ has 'foo/struct.Providers.html' -//@ has - '//*[@class="rust item-decl"]//code' "pub a: for<'tcx> fn(_: TyCtxt<'tcx>, _: u8) -> i8," -//@ has - '//*[@class="rust item-decl"]//code' "pub b: for<'tcx> fn(_: TyCtxt<'tcx>, _: u16) -> i16," -//@ has - '//*[@id="structfield.a"]/code' "a: for<'tcx> fn(_: TyCtxt<'tcx>, _: u8) -> i8" -//@ has - '//*[@id="structfield.b"]/code' "b: for<'tcx> fn(_: TyCtxt<'tcx>, _: u16) -> i16" +//@ has - '//*[@class="rust item-decl"]//code' "pub a: for<'tcx> fn(TyCtxt<'tcx>, u8) -> i8," +//@ has - '//*[@class="rust item-decl"]//code' "pub b: for<'tcx> fn(TyCtxt<'tcx>, u16) -> i16," +//@ has - '//*[@id="structfield.a"]/code' "a: for<'tcx> fn(TyCtxt<'tcx>, u8) -> i8" +//@ has - '//*[@id="structfield.b"]/code' "b: for<'tcx> fn(TyCtxt<'tcx>, u16) -> i16" gen! { (a, 'tcx, [u8], [i8]) (b, 'tcx, [u16], [i16]) diff --git a/tests/rustdoc/reexport-trait-from-hidden-111064-2.rs b/tests/rustdoc/reexport-trait-from-hidden-111064-2.rs index 2b21f9862b4..61060b3ff7c 100644 --- a/tests/rustdoc/reexport-trait-from-hidden-111064-2.rs +++ b/tests/rustdoc/reexport-trait-from-hidden-111064-2.rs @@ -1,8 +1,11 @@ // Regression test for <https://github.com/rust-lang/rust/issues/111064>. -#![feature(no_core)] +#![feature(no_core, lang_items)] #![no_core] #![crate_name = "foo"] +#[lang = "sized"] +trait Sized {} + //@ files "foo" "['sidebar-items.js', 'all.html', 'hidden', 'index.html', 'struct.Bar.html', \ // 'visible']" //@ files "foo/hidden" "['inner']" diff --git a/tests/rustdoc/safe-intrinsic.rs b/tests/rustdoc/safe-intrinsic.rs index 07af04ace60..1edc1d9f79b 100644 --- a/tests/rustdoc/safe-intrinsic.rs +++ b/tests/rustdoc/safe-intrinsic.rs @@ -1,10 +1,13 @@ #![feature(intrinsics)] -#![feature(no_core)] +#![feature(no_core, lang_items)] #![feature(rustc_attrs)] #![no_core] #![crate_name = "foo"] +#[lang = "sized"] +trait Sized {} + //@ has 'foo/fn.abort.html' //@ has - '//pre[@class="rust item-decl"]' 'pub fn abort() -> !' #[rustc_intrinsic] diff --git a/tests/rustdoc/source-line-numbers.rs b/tests/rustdoc/source-line-numbers.rs new file mode 100644 index 00000000000..0b654b1a004 --- /dev/null +++ b/tests/rustdoc/source-line-numbers.rs @@ -0,0 +1,35 @@ +// This test ensures that we have the expected number of line generated. + +#![crate_name = "foo"] + +//@ has 'src/foo/source-line-numbers.rs.html' +//@ count - '//a[@data-nosnippet]' 35 +//@ has - '//a[@id="35"]' '35' + +#[ +macro_export +] +macro_rules! bar { + ($x:ident) => {{ + $x += 2; + $x *= 2; + }} +} + +/* +multi line +comment +*/ +fn x(_: u8, _: u8) {} + +fn foo() { + let mut y = 0; + bar!(y); + println!(" + {y} + "); + x( + 1, + 2, + ); +} diff --git a/tests/rustdoc/stability.rs b/tests/rustdoc/stability.rs index b74abb0e0ba..22cd4b9cd59 100644 --- a/tests/rustdoc/stability.rs +++ b/tests/rustdoc/stability.rs @@ -85,7 +85,7 @@ pub mod stable_later { } #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_allowed_through_unstable_modules] +#[rustc_allowed_through_unstable_modules = "use stable path instead"] pub mod stable_earlier1 { //@ has stability/stable_earlier1/struct.StableInUnstable.html \ // '//div[@class="main-heading"]//span[@class="since"]' '1.0.0' diff --git a/tests/rustdoc/type-layout.rs b/tests/rustdoc/type-layout.rs index 5f34c8b99e0..6de435dbcc1 100644 --- a/tests/rustdoc/type-layout.rs +++ b/tests/rustdoc/type-layout.rs @@ -86,11 +86,11 @@ pub enum WithNiche { } //@ hasraw type_layout/enum.Uninhabited.html 'Size: ' -//@ hasraw - '0 bytes (<a href="https://doc.rust-lang.org/stable/reference/glossary.html#uninhabited">uninhabited</a>)' +//@ hasraw - '0 bytes (<a href="{{channel}}/reference/glossary.html#uninhabited">uninhabited</a>)' pub enum Uninhabited {} //@ hasraw type_layout/struct.Uninhabited2.html 'Size: ' -//@ hasraw - '8 bytes (<a href="https://doc.rust-lang.org/stable/reference/glossary.html#uninhabited">uninhabited</a>)' +//@ hasraw - '8 bytes (<a href="{{channel}}/reference/glossary.html#uninhabited">uninhabited</a>)' pub struct Uninhabited2(std::convert::Infallible, u64); pub trait Project { type Assoc; } diff --git a/tests/ui-fulldeps/missing-rustc-driver-error.stderr b/tests/ui-fulldeps/missing-rustc-driver-error.stderr index d7bf27d6349..faad6264522 100644 --- a/tests/ui-fulldeps/missing-rustc-driver-error.stderr +++ b/tests/ui-fulldeps/missing-rustc-driver-error.stderr @@ -2,5 +2,13 @@ error: crate `rustc_serialize` required to be available in rlib format, but was | = help: try adding `extern crate rustc_driver;` at the top level of this crate +error: crate `rustc_hashes` required to be available in rlib format, but was not found in this form + | + = help: try adding `extern crate rustc_driver;` at the top level of this crate + +error: crate `rustc_stable_hash` required to be available in rlib format, but was not found in this form + | + = help: try adding `extern crate rustc_driver;` at the top level of this crate + error: aborting due to NUMBER previous errors diff --git a/tests/ui-fulldeps/obtain-borrowck.rs b/tests/ui-fulldeps/obtain-borrowck.rs index f8064c245a8..84f6970c83a 100644 --- a/tests/ui-fulldeps/obtain-borrowck.rs +++ b/tests/ui-fulldeps/obtain-borrowck.rs @@ -48,7 +48,6 @@ fn main() { let mut callbacks = CompilerCalls::default(); // Call the Rust compiler with our callbacks. rustc_driver::run_compiler(&rustc_args, &mut callbacks); - Ok(()) }); std::process::exit(exit_code); } @@ -68,7 +67,6 @@ impl rustc_driver::Callbacks for CompilerCalls { fn after_analysis<'tcx>(&mut self, _compiler: &Compiler, tcx: TyCtxt<'tcx>) -> Compilation { tcx.sess.dcx().abort_if_errors(); // Collect definition ids of MIR bodies. - let hir = tcx.hir(); let mut bodies = Vec::new(); let crate_items = tcx.hir_crate_items(()); @@ -80,7 +78,7 @@ impl rustc_driver::Callbacks for CompilerCalls { for id in crate_items.trait_items() { if matches!(tcx.def_kind(id.owner_id), DefKind::AssocFn) { - let trait_item = hir.trait_item(id); + let trait_item = tcx.hir_trait_item(id); if let rustc_hir::TraitItemKind::Fn(_, trait_fn) = &trait_item.kind { if let rustc_hir::TraitFn::Provided(_) = trait_fn { bodies.push(trait_item.owner_id); diff --git a/tests/ui-fulldeps/stable-mir/check_abi.rs b/tests/ui-fulldeps/stable-mir/check_abi.rs index 8caf3032afc..ef2d5b4854b 100644 --- a/tests/ui-fulldeps/stable-mir/check_abi.rs +++ b/tests/ui-fulldeps/stable-mir/check_abi.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/check_allocation.rs b/tests/ui-fulldeps/stable-mir/check_allocation.rs index 072c8ba6a44..c102f86a228 100644 --- a/tests/ui-fulldeps/stable-mir/check_allocation.rs +++ b/tests/ui-fulldeps/stable-mir/check_allocation.rs @@ -5,7 +5,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/check_attribute.rs b/tests/ui-fulldeps/stable-mir/check_attribute.rs index 22481e275a9..11cb63f3f8a 100644 --- a/tests/ui-fulldeps/stable-mir/check_attribute.rs +++ b/tests/ui-fulldeps/stable-mir/check_attribute.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/check_binop.rs b/tests/ui-fulldeps/stable-mir/check_binop.rs index 8c44e285108..65b3ffd27ab 100644 --- a/tests/ui-fulldeps/stable-mir/check_binop.rs +++ b/tests/ui-fulldeps/stable-mir/check_binop.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/check_crate_defs.rs b/tests/ui-fulldeps/stable-mir/check_crate_defs.rs index ed093903381..71cca94c34f 100644 --- a/tests/ui-fulldeps/stable-mir/check_crate_defs.rs +++ b/tests/ui-fulldeps/stable-mir/check_crate_defs.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/check_def_ty.rs b/tests/ui-fulldeps/stable-mir/check_def_ty.rs index 482dbd22d5f..37b9a83e33e 100644 --- a/tests/ui-fulldeps/stable-mir/check_def_ty.rs +++ b/tests/ui-fulldeps/stable-mir/check_def_ty.rs @@ -5,7 +5,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/check_defs.rs b/tests/ui-fulldeps/stable-mir/check_defs.rs index bf1f1a2ceab..cd3d76d8760 100644 --- a/tests/ui-fulldeps/stable-mir/check_defs.rs +++ b/tests/ui-fulldeps/stable-mir/check_defs.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/check_foreign.rs b/tests/ui-fulldeps/stable-mir/check_foreign.rs index 4acbabbb6be..bc3956b3090 100644 --- a/tests/ui-fulldeps/stable-mir/check_foreign.rs +++ b/tests/ui-fulldeps/stable-mir/check_foreign.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/check_instance.rs b/tests/ui-fulldeps/stable-mir/check_instance.rs index 464350b1045..72a138f907e 100644 --- a/tests/ui-fulldeps/stable-mir/check_instance.rs +++ b/tests/ui-fulldeps/stable-mir/check_instance.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/check_intrinsics.rs b/tests/ui-fulldeps/stable-mir/check_intrinsics.rs index 6edebaf756c..2f772b97886 100644 --- a/tests/ui-fulldeps/stable-mir/check_intrinsics.rs +++ b/tests/ui-fulldeps/stable-mir/check_intrinsics.rs @@ -8,7 +8,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/check_item_kind.rs b/tests/ui-fulldeps/stable-mir/check_item_kind.rs index 23b54e6c60b..647ce534589 100644 --- a/tests/ui-fulldeps/stable-mir/check_item_kind.rs +++ b/tests/ui-fulldeps/stable-mir/check_item_kind.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/check_normalization.rs b/tests/ui-fulldeps/stable-mir/check_normalization.rs index 928173b154b..de14202adb9 100644 --- a/tests/ui-fulldeps/stable-mir/check_normalization.rs +++ b/tests/ui-fulldeps/stable-mir/check_normalization.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/check_trait_queries.rs b/tests/ui-fulldeps/stable-mir/check_trait_queries.rs index 304a7ce9255..23c2844d3f1 100644 --- a/tests/ui-fulldeps/stable-mir/check_trait_queries.rs +++ b/tests/ui-fulldeps/stable-mir/check_trait_queries.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/check_transform.rs b/tests/ui-fulldeps/stable-mir/check_transform.rs index bcf79c456b0..d9fc924933f 100644 --- a/tests/ui-fulldeps/stable-mir/check_transform.rs +++ b/tests/ui-fulldeps/stable-mir/check_transform.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 #![feature(rustc_private)] #![feature(assert_matches)] diff --git a/tests/ui-fulldeps/stable-mir/check_ty_fold.rs b/tests/ui-fulldeps/stable-mir/check_ty_fold.rs index e21508c9b46..9fa4929d68e 100644 --- a/tests/ui-fulldeps/stable-mir/check_ty_fold.rs +++ b/tests/ui-fulldeps/stable-mir/check_ty_fold.rs @@ -5,7 +5,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/compilation-result.rs b/tests/ui-fulldeps/stable-mir/compilation-result.rs index d921de73f43..b8a9e720e54 100644 --- a/tests/ui-fulldeps/stable-mir/compilation-result.rs +++ b/tests/ui-fulldeps/stable-mir/compilation-result.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs index 53be8eb10c1..7f0e9b50335 100644 --- a/tests/ui-fulldeps/stable-mir/crate-info.rs +++ b/tests/ui-fulldeps/stable-mir/crate-info.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/projections.rs b/tests/ui-fulldeps/stable-mir/projections.rs index fdb7eeed1b0..3cc71247e67 100644 --- a/tests/ui-fulldeps/stable-mir/projections.rs +++ b/tests/ui-fulldeps/stable-mir/projections.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/smir_internal.rs b/tests/ui-fulldeps/stable-mir/smir_internal.rs index 6f5478c08bf..453e5372de4 100644 --- a/tests/ui-fulldeps/stable-mir/smir_internal.rs +++ b/tests/ui-fulldeps/stable-mir/smir_internal.rs @@ -5,7 +5,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/smir_serde.rs b/tests/ui-fulldeps/stable-mir/smir_serde.rs index 7dbf892f9e4..2c74276d550 100644 --- a/tests/ui-fulldeps/stable-mir/smir_serde.rs +++ b/tests/ui-fulldeps/stable-mir/smir_serde.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui-fulldeps/stable-mir/smir_visitor.rs b/tests/ui-fulldeps/stable-mir/smir_visitor.rs index 666000d3b07..0a6415d490e 100644 --- a/tests/ui-fulldeps/stable-mir/smir_visitor.rs +++ b/tests/ui-fulldeps/stable-mir/smir_visitor.rs @@ -4,7 +4,6 @@ //@ ignore-stage1 //@ ignore-cross-compile //@ ignore-remote -//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 //@ edition: 2021 #![feature(rustc_private)] diff --git a/tests/ui/abi/abi-sysv64-arg-passing.rs b/tests/ui/abi/abi-sysv64-arg-passing.rs index 04942e984a8..c18752418a1 100644 --- a/tests/ui/abi/abi-sysv64-arg-passing.rs +++ b/tests/ui/abi/abi-sysv64-arg-passing.rs @@ -29,7 +29,8 @@ //@ ignore-aarch64 //@ ignore-windows -// note: windows is ignored as rust_test_helpers does not have the sysv64 abi on windows +// Windows is ignored because bootstrap doesn't yet know to compile rust_test_helpers with +// the sysv64 ABI on Windows. #[allow(dead_code)] #[allow(improper_ctypes)] diff --git a/tests/ui/abi/c-zst.aarch64-darwin.stderr b/tests/ui/abi/c-zst.aarch64-darwin.stderr index d9742612bcf..c8f7d0a517c 100644 --- a/tests/ui/abi/c-zst.aarch64-darwin.stderr +++ b/tests/ui/abi/c-zst.aarch64-darwin.stderr @@ -60,7 +60,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:63:1 + --> $DIR/c-zst.rs:64:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.powerpc-linux.stderr b/tests/ui/abi/c-zst.powerpc-linux.stderr index 0e98b5f806b..1015f7d8898 100644 --- a/tests/ui/abi/c-zst.powerpc-linux.stderr +++ b/tests/ui/abi/c-zst.powerpc-linux.stderr @@ -71,7 +71,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:63:1 + --> $DIR/c-zst.rs:64:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.rs b/tests/ui/abi/c-zst.rs index 6b299ffadb7..c1dac41f876 100644 --- a/tests/ui/abi/c-zst.rs +++ b/tests/ui/abi/c-zst.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ normalize-stderr: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN" /*! C doesn't have zero-sized types... except it does. @@ -52,12 +53,12 @@ extern "C" fn(i32, (), i32); //@[x86_64-pc-windows-gnu] needs-llvm-components: x86 -#![feature(lang_items, no_core, rustc_attrs)] +#![feature(no_core, rustc_attrs)] #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[rustc_abi(debug)] extern "C" fn pass_zst(_: ()) {} //~ ERROR: fn_abi diff --git a/tests/ui/abi/c-zst.s390x-linux.stderr b/tests/ui/abi/c-zst.s390x-linux.stderr index 0e98b5f806b..1015f7d8898 100644 --- a/tests/ui/abi/c-zst.s390x-linux.stderr +++ b/tests/ui/abi/c-zst.s390x-linux.stderr @@ -71,7 +71,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:63:1 + --> $DIR/c-zst.rs:64:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.sparc64-linux.stderr b/tests/ui/abi/c-zst.sparc64-linux.stderr index 0e98b5f806b..1015f7d8898 100644 --- a/tests/ui/abi/c-zst.sparc64-linux.stderr +++ b/tests/ui/abi/c-zst.sparc64-linux.stderr @@ -71,7 +71,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:63:1 + --> $DIR/c-zst.rs:64:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.x86_64-linux.stderr b/tests/ui/abi/c-zst.x86_64-linux.stderr index d9742612bcf..c8f7d0a517c 100644 --- a/tests/ui/abi/c-zst.x86_64-linux.stderr +++ b/tests/ui/abi/c-zst.x86_64-linux.stderr @@ -60,7 +60,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:63:1 + --> $DIR/c-zst.rs:64:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr index 0e98b5f806b..1015f7d8898 100644 --- a/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr +++ b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr @@ -71,7 +71,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:63:1 + --> $DIR/c-zst.rs:64:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/large-byval-align.rs b/tests/ui/abi/large-byval-align.rs index e39170df72b..ddd579f264e 100644 --- a/tests/ui/abi/large-byval-align.rs +++ b/tests/ui/abi/large-byval-align.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Copt-level=0 //@ only-x86_64 -//@ ignore-windows //@ min-llvm-version: 19 //@ build-pass diff --git a/tests/ui/abi/removed-wasm-abi.rs b/tests/ui/abi/removed-wasm-abi.rs deleted file mode 100644 index a45e42bfe02..00000000000 --- a/tests/ui/abi/removed-wasm-abi.rs +++ /dev/null @@ -1,4 +0,0 @@ -extern "wasm" fn test() {} -//~^ ERROR invalid ABI: found `wasm` - -fn main() {} diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr index e80411fda34..e1f43347985 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr +++ b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr @@ -8,10 +8,9 @@ LL | extern "riscv-interrupt" fn isr() {} | help: did you mean: `"riscv-interrupt-m"` | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions - = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively error[E0703]: invalid ABI: found `riscv-interrupt-u` - --> $DIR/riscv-discoverability-guidance.rs:23:8 + --> $DIR/riscv-discoverability-guidance.rs:22:8 | LL | extern "riscv-interrupt-u" fn isr_U() {} | ^^^^^^^^^^^^^^^^^^^ @@ -20,7 +19,6 @@ LL | extern "riscv-interrupt-u" fn isr_U() {} | help: did you mean: `"riscv-interrupt-m"` | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions - = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314 error: aborting due to 2 previous errors diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr index e80411fda34..e1f43347985 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr +++ b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr @@ -8,10 +8,9 @@ LL | extern "riscv-interrupt" fn isr() {} | help: did you mean: `"riscv-interrupt-m"` | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions - = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively error[E0703]: invalid ABI: found `riscv-interrupt-u` - --> $DIR/riscv-discoverability-guidance.rs:23:8 + --> $DIR/riscv-discoverability-guidance.rs:22:8 | LL | extern "riscv-interrupt-u" fn isr_U() {} | ^^^^^^^^^^^^^^^^^^^ @@ -20,7 +19,6 @@ LL | extern "riscv-interrupt-u" fn isr_U() {} | help: did you mean: `"riscv-interrupt-m"` | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions - = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314 error: aborting due to 2 previous errors diff --git a/tests/ui/abi/riscv-discoverability-guidance.rs b/tests/ui/abi/riscv-discoverability-guidance.rs index 1b189d907ba..dec5059b0a7 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.rs +++ b/tests/ui/abi/riscv-discoverability-guidance.rs @@ -18,10 +18,8 @@ extern "riscv-interrupt" fn isr() {} //~^ ERROR invalid ABI //~^^ NOTE invalid ABI //~^^^ NOTE invoke `rustc --print=calling-conventions` for a full list of supported calling conventions -//~^^^^ NOTE please use one of riscv-interrupt-m or riscv-interrupt-s extern "riscv-interrupt-u" fn isr_U() {} //~^ ERROR invalid ABI //~^^ NOTE invalid ABI //~^^^ NOTE invoke `rustc --print=calling-conventions` for a full list of supported calling conventions -//~^^^^ NOTE user-mode interrupt handlers have been removed from LLVM pending standardization diff --git a/tests/ui/abi/segfault-no-out-of-stack.rs b/tests/ui/abi/segfault-no-out-of-stack.rs index b5af13ebfb5..5e8b4e0dbf2 100644 --- a/tests/ui/abi/segfault-no-out-of-stack.rs +++ b/tests/ui/abi/segfault-no-out-of-stack.rs @@ -1,5 +1,6 @@ //@ run-pass //@ needs-subprocess +//@ compile-flags: -Zub-checks=no -Zmir-enable-passes=-CheckNull //@ ignore-fuchsia must translate zircon signal to SIGSEGV/SIGBUS, FIXME (#58590) #![feature(rustc_private)] diff --git a/tests/ui/amdgpu-require-explicit-cpu.nocpu.stderr b/tests/ui/amdgpu-require-explicit-cpu.nocpu.stderr new file mode 100644 index 00000000000..7480a8ed38f --- /dev/null +++ b/tests/ui/amdgpu-require-explicit-cpu.nocpu.stderr @@ -0,0 +1,4 @@ +error: target requires explicitly specifying a cpu with `-C target-cpu` + +error: aborting due to 1 previous error + diff --git a/tests/ui/amdgpu-require-explicit-cpu.rs b/tests/ui/amdgpu-require-explicit-cpu.rs new file mode 100644 index 00000000000..46778a1094f --- /dev/null +++ b/tests/ui/amdgpu-require-explicit-cpu.rs @@ -0,0 +1,17 @@ +//@ revisions: nocpu cpu +//@ no-prefer-dynamic +//@ compile-flags: --crate-type=cdylib --target=amdgcn-amd-amdhsa +//@ needs-llvm-components: amdgpu +//@ needs-rust-lld +//@[nocpu] error-pattern: target requires explicitly specifying a cpu +//@[nocpu] build-fail +//@[cpu] compile-flags: -Ctarget-cpu=gfx900 +//@[cpu] build-pass + +#![feature(no_core, lang_items)] +#![no_core] + +#[lang="sized"] +trait Sized {} + +pub fn foo() {} diff --git a/tests/ui/anon-params/anon-params-denied-2018.stderr b/tests/ui/anon-params/anon-params-denied-2018.stderr index 2d6356ffcb1..0c38987ca6f 100644 --- a/tests/ui/anon-params/anon-params-denied-2018.stderr +++ b/tests/ui/anon-params/anon-params-denied-2018.stderr @@ -31,8 +31,9 @@ LL | fn foo_with_ref(self: &mut i32); | +++++ help: if this is a parameter name, give it a type | -LL | fn foo_with_ref(i32: &mut TypeName); - | ~~~~~~~~~~~~~~~~~~ +LL - fn foo_with_ref(&mut i32); +LL + fn foo_with_ref(i32: &mut TypeName); + | help: if this is a type, explicitly ignore the parameter name | LL | fn foo_with_ref(_: &mut i32); diff --git a/tests/ui/argument-suggestions/basic.stderr b/tests/ui/argument-suggestions/basic.stderr index 2d52df21233..9a639d4b5e4 100644 --- a/tests/ui/argument-suggestions/basic.stderr +++ b/tests/ui/argument-suggestions/basic.stderr @@ -42,8 +42,9 @@ LL | fn missing(_i: u32) {} | ^^^^^^^ ------- help: provide the argument | -LL | missing(/* u32 */); - | ~~~~~~~~~~~ +LL - missing(); +LL + missing(/* u32 */); + | error[E0308]: arguments to this function are incorrect --> $DIR/basic.rs:23:5 @@ -57,11 +58,12 @@ note: function defined here --> $DIR/basic.rs:16:4 | LL | fn swapped(_i: u32, _s: &str) {} - | ^^^^^^^ ------- -------- + | ^^^^^^^ help: swap these arguments | -LL | swapped(1, ""); - | ~~~~~~~ +LL - swapped("", 1); +LL + swapped(1, ""); + | error[E0308]: arguments to this function are incorrect --> $DIR/basic.rs:24:5 @@ -76,11 +78,12 @@ note: function defined here --> $DIR/basic.rs:17:4 | LL | fn permuted(_x: X, _y: Y, _z: Z) {} - | ^^^^^^^^ ----- ----- ----- + | ^^^^^^^^ help: reorder these arguments | -LL | permuted(X {}, Y {}, Z {}); - | ~~~~~~~~~~~~~~~~~~ +LL - permuted(Y {}, Z {}, X {}); +LL + permuted(X {}, Y {}, Z {}); + | error[E0057]: this function takes 1 argument but 0 arguments were supplied --> $DIR/basic.rs:27:5 @@ -95,8 +98,9 @@ LL | let closure = |x| x; | ^^^ help: provide the argument | -LL | closure(/* x */); - | ~~~~~~~~~ +LL - closure(); +LL + closure(/* x */); + | error: aborting due to 6 previous errors diff --git a/tests/ui/argument-suggestions/complex.stderr b/tests/ui/argument-suggestions/complex.stderr index bb3817421df..be8838f17d7 100644 --- a/tests/ui/argument-suggestions/complex.stderr +++ b/tests/ui/argument-suggestions/complex.stderr @@ -8,11 +8,12 @@ note: function defined here --> $DIR/complex.rs:11:4 | LL | fn complex(_i: u32, _s: &str, _e: E, _f: F, _g: G, _x: X, _y: Y, _z: Z ) {} - | ^^^^^^^ ------- -------- ----- ----- ----- ----- ----- ----- + | ^^^^^^^ ------- ----- help: did you mean | -LL | complex(/* u32 */, &"", /* E */, F::X2, G{}, X {}, Y {}, Z {}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - complex(1.0, H {}, &"", G{}, F::X2, Z {}, X {}, Y {}); +LL + complex(/* u32 */, &"", /* E */, F::X2, G{}, X {}, Y {}, Z {}); + | error: aborting due to 1 previous error diff --git a/tests/ui/argument-suggestions/display-is-suggestable.stderr b/tests/ui/argument-suggestions/display-is-suggestable.stderr index eea88c3e78d..bb5df1ec234 100644 --- a/tests/ui/argument-suggestions/display-is-suggestable.stderr +++ b/tests/ui/argument-suggestions/display-is-suggestable.stderr @@ -11,8 +11,9 @@ LL | fn foo(x: &(dyn Display + Send)) {} | ^^^ ------------------------ help: provide the argument | -LL | foo(/* &dyn std::fmt::Display + Send */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - foo(); +LL + foo(/* &dyn std::fmt::Display + Send */); + | error: aborting due to 1 previous error diff --git a/tests/ui/argument-suggestions/extern-fn-arg-names.stderr b/tests/ui/argument-suggestions/extern-fn-arg-names.stderr index 47fbfc98c67..62670316cd1 100644 --- a/tests/ui/argument-suggestions/extern-fn-arg-names.stderr +++ b/tests/ui/argument-suggestions/extern-fn-arg-names.stderr @@ -14,11 +14,12 @@ note: function defined here --> $DIR/extern-fn-arg-names.rs:2:8 | LL | fn dstfn(src: i32, dst: err); - | ^^^^^ + | ^^^^^ --- help: provide the argument | -LL | dstfn(1, /* dst */); - | ~~~~~~~~~~~~~~ +LL - dstfn(1); +LL + dstfn(1, /* dst */); + | error: aborting due to 2 previous errors diff --git a/tests/ui/argument-suggestions/extra_arguments.stderr b/tests/ui/argument-suggestions/extra_arguments.stderr index 8c95cc86a27..5ed42a9ddd2 100644 --- a/tests/ui/argument-suggestions/extra_arguments.stderr +++ b/tests/ui/argument-suggestions/extra_arguments.stderr @@ -44,7 +44,7 @@ note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg<T>(_a: T) {} - | ^^^^^^^ ----- + | ^^^^^^^ help: remove the extra argument | LL - one_arg(1, 1); @@ -61,7 +61,7 @@ note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg<T>(_a: T) {} - | ^^^^^^^ ----- + | ^^^^^^^ help: remove the extra argument | LL - one_arg(1, ""); @@ -80,7 +80,7 @@ note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg<T>(_a: T) {} - | ^^^^^^^ ----- + | ^^^^^^^ help: remove the extra arguments | LL - one_arg(1, "", 1.0); @@ -97,7 +97,7 @@ note: function defined here --> $DIR/extra_arguments.rs:3:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} - | ^^^^^^^^^^^^ ------- ------- + | ^^^^^^^^^^^^ help: remove the extra argument | LL - two_arg_same(1, 1, 1); @@ -114,7 +114,7 @@ note: function defined here --> $DIR/extra_arguments.rs:3:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} - | ^^^^^^^^^^^^ ------- ------- + | ^^^^^^^^^^^^ help: remove the extra argument | LL - two_arg_same(1, 1, 1.0); @@ -131,7 +131,7 @@ note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} - | ^^^^^^^^^^^^ ------- -------- + | ^^^^^^^^^^^^ help: remove the extra argument | LL - two_arg_diff(1, 1, ""); @@ -148,7 +148,7 @@ note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} - | ^^^^^^^^^^^^ ------- -------- + | ^^^^^^^^^^^^ help: remove the extra argument | LL - two_arg_diff(1, "", ""); @@ -167,7 +167,7 @@ note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} - | ^^^^^^^^^^^^ ------- -------- + | ^^^^^^^^^^^^ help: remove the extra arguments | LL - two_arg_diff(1, 1, "", ""); @@ -186,7 +186,7 @@ note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} - | ^^^^^^^^^^^^ ------- -------- + | ^^^^^^^^^^^^ help: remove the extra arguments | LL - two_arg_diff(1, "", 1, ""); @@ -203,7 +203,7 @@ note: function defined here --> $DIR/extra_arguments.rs:3:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} - | ^^^^^^^^^^^^ ------- ------- + | ^^^^^^^^^^^^ help: remove the extra argument | LL - two_arg_same(1, 1, ""); @@ -220,7 +220,7 @@ note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} - | ^^^^^^^^^^^^ ------- -------- + | ^^^^^^^^^^^^ help: remove the extra argument | LL - two_arg_diff(1, 1, ""); @@ -240,7 +240,7 @@ note: function defined here --> $DIR/extra_arguments.rs:3:4 | LL | fn two_arg_same(_a: i32, _b: i32) {} - | ^^^^^^^^^^^^ ------- ------- + | ^^^^^^^^^^^^ help: remove the extra argument | LL - 1, @@ -261,7 +261,7 @@ note: function defined here --> $DIR/extra_arguments.rs:4:4 | LL | fn two_arg_diff(_a: i32, _b: &str) {} - | ^^^^^^^^^^^^ ------- -------- + | ^^^^^^^^^^^^ help: remove the extra argument | LL - 1, @@ -335,7 +335,7 @@ note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg<T>(_a: T) {} - | ^^^^^^^ ----- + | ^^^^^^^ help: remove the extra argument | LL - one_arg(1, panic!()); @@ -352,7 +352,7 @@ note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg<T>(_a: T) {} - | ^^^^^^^ ----- + | ^^^^^^^ help: remove the extra argument | LL - one_arg(panic!(), 1); @@ -369,7 +369,7 @@ note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg<T>(_a: T) {} - | ^^^^^^^ ----- + | ^^^^^^^ help: remove the extra argument | LL - one_arg(stringify!($e), 1); @@ -386,7 +386,7 @@ note: function defined here --> $DIR/extra_arguments.rs:2:4 | LL | fn one_arg<T>(_a: T) {} - | ^^^^^^^ ----- + | ^^^^^^^ help: remove the extra argument | LL - one_arg(for _ in 1.. {}, 1); diff --git a/tests/ui/argument-suggestions/invalid_arguments.stderr b/tests/ui/argument-suggestions/invalid_arguments.stderr index d26f33d098b..a50058149b8 100644 --- a/tests/ui/argument-suggestions/invalid_arguments.stderr +++ b/tests/ui/argument-suggestions/invalid_arguments.stderr @@ -150,7 +150,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:8:4 | LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^^^^^ ------- ------- error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:29:3 @@ -164,7 +164,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:8:4 | LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^^^^^ ------- -------- error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:30:3 @@ -178,7 +178,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:8:4 | LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^^^^^ ------- -------- error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:32:3 @@ -249,7 +249,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:9:4 | LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} - | ^^^^^^^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^^^^^^^ ------- ------- error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:39:3 @@ -263,7 +263,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:9:4 | LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} - | ^^^^^^^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^^^^^^^ ------- -------- error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:40:3 @@ -277,7 +277,7 @@ note: function defined here --> $DIR/invalid_arguments.rs:9:4 | LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} - | ^^^^^^^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^^^^^^^ ------- -------- error[E0308]: arguments to this function are incorrect --> $DIR/invalid_arguments.rs:42:3 diff --git a/tests/ui/argument-suggestions/issue-100478.stderr b/tests/ui/argument-suggestions/issue-100478.stderr index 94709f0ebc6..8889a0ab5df 100644 --- a/tests/ui/argument-suggestions/issue-100478.stderr +++ b/tests/ui/argument-suggestions/issue-100478.stderr @@ -11,11 +11,12 @@ note: function defined here --> $DIR/issue-100478.rs:30:4 | LL | fn three_diff(_a: T1, _b: T2, _c: T3) {} - | ^^^^^^^^^^ ------ ------ ------ + | ^^^^^^^^^^ ------ ------ help: provide the arguments | -LL | three_diff(/* T1 */, T2::new(0), /* T3 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - three_diff(T2::new(0)); +LL + three_diff(/* T1 */, T2::new(0), /* T3 */); + | error[E0308]: arguments to this function are incorrect --> $DIR/issue-100478.rs:35:5 @@ -31,11 +32,12 @@ note: function defined here --> $DIR/issue-100478.rs:31:4 | LL | fn four_shuffle(_a: T1, _b: T2, _c: T3, _d: T4) {} - | ^^^^^^^^^^^^ ------ ------ ------ ------ + | ^^^^^^^^^^^^ help: did you mean | -LL | four_shuffle(T1::default(), T2::default(), T3::default(), T4::default()); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - four_shuffle(T3::default(), T4::default(), T1::default(), T2::default()); +LL + four_shuffle(T1::default(), T2::default(), T3::default(), T4::default()); + | error[E0308]: arguments to this function are incorrect --> $DIR/issue-100478.rs:36:5 @@ -50,11 +52,12 @@ note: function defined here --> $DIR/issue-100478.rs:31:4 | LL | fn four_shuffle(_a: T1, _b: T2, _c: T3, _d: T4) {} - | ^^^^^^^^^^^^ ------ ------ ------ ------ + | ^^^^^^^^^^^^ ------ help: swap these arguments | -LL | four_shuffle(T1::default(), T2::default(), T3::default(), /* T4 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - four_shuffle(T3::default(), T2::default(), T1::default(), T3::default()); +LL + four_shuffle(T1::default(), T2::default(), T3::default(), /* T4 */); + | error[E0061]: this function takes 8 arguments but 7 arguments were supplied --> $DIR/issue-100478.rs:47:5 @@ -69,11 +72,16 @@ note: function defined here --> $DIR/issue-100478.rs:29:4 | LL | fn foo(p1: T1, p2: Arc<T2>, p3: T3, p4: Arc<T4>, p5: T5, p6: T6, p7: T7, p8: Arc<T8>) {} - | ^^^ ------ ----------- ------ ----------- ------ ------ ------ ----------- + | ^^^ ----------- help: provide the argument | -LL | foo(p1, /* Arc<T2> */, p3, p4, p5, p6, p7, p8); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - foo( +LL - +LL - p1, //p2, +LL - p3, p4, p5, p6, p7, p8, +LL - ); +LL + foo(p1, /* Arc<T2> */, p3, p4, p5, p6, p7, p8); + | error: aborting due to 4 previous errors diff --git a/tests/ui/argument-suggestions/issue-101097.stderr b/tests/ui/argument-suggestions/issue-101097.stderr index 6e21f19ab4f..25770e36aa3 100644 --- a/tests/ui/argument-suggestions/issue-101097.stderr +++ b/tests/ui/argument-suggestions/issue-101097.stderr @@ -13,22 +13,11 @@ note: function defined here | LL | fn f( | ^ -LL | a1: A, - | ----- -LL | a2: A, - | ----- -LL | b1: B, - | ----- -LL | b2: B, - | ----- -LL | c1: C, - | ----- -LL | c2: C, - | ----- help: did you mean | -LL | f(A, A, B, B, C, C); - | ~~~~~~~~~~~~~~~~~~ +LL - f(C, A, A, A, B, B, C); +LL + f(A, A, B, B, C, C); + | error[E0308]: arguments to this function are incorrect --> $DIR/issue-101097.rs:17:5 @@ -41,22 +30,11 @@ note: function defined here | LL | fn f( | ^ -LL | a1: A, - | ----- -LL | a2: A, - | ----- -LL | b1: B, - | ----- -LL | b2: B, - | ----- -LL | c1: C, - | ----- -LL | c2: C, - | ----- help: did you mean | -LL | f(A, A, B, B, C, C); - | ~~~~~~~~~~~~~~~~~~ +LL - f(C, C, A, A, B, B); +LL + f(A, A, B, B, C, C); + | error[E0308]: arguments to this function are incorrect --> $DIR/issue-101097.rs:18:5 @@ -72,22 +50,16 @@ note: function defined here | LL | fn f( | ^ -LL | a1: A, - | ----- -LL | a2: A, - | ----- -LL | b1: B, - | ----- -LL | b2: B, - | ----- +... LL | c1: C, | ----- LL | c2: C, | ----- help: did you mean | -LL | f(A, A, B, B, /* C */, /* C */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - f(A, A, D, D, B, B); +LL + f(A, A, B, B, /* C */, /* C */); + | error[E0308]: arguments to this function are incorrect --> $DIR/issue-101097.rs:19:5 @@ -104,22 +76,11 @@ note: function defined here | LL | fn f( | ^ -LL | a1: A, - | ----- -LL | a2: A, - | ----- -LL | b1: B, - | ----- -LL | b2: B, - | ----- -LL | c1: C, - | ----- -LL | c2: C, - | ----- help: did you mean | -LL | f(A, A, B, B, C, C); - | ~~~~~~~~~~~~~~~~~~ +LL - f(C, C, B, B, A, A); +LL + f(A, A, B, B, C, C); + | error[E0308]: arguments to this function are incorrect --> $DIR/issue-101097.rs:20:5 @@ -137,22 +98,14 @@ note: function defined here | LL | fn f( | ^ -LL | a1: A, - | ----- -LL | a2: A, - | ----- +... LL | b1: B, | ----- -LL | b2: B, - | ----- -LL | c1: C, - | ----- -LL | c2: C, - | ----- help: did you mean | -LL | f(A, A, /* B */, B, C, C); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - f(C, C, A, B, A, A); +LL + f(A, A, /* B */, B, C, C); + | error: aborting due to 5 previous errors diff --git a/tests/ui/argument-suggestions/issue-109425.stderr b/tests/ui/argument-suggestions/issue-109425.stderr index 2cd53ed528e..232dc0183c8 100644 --- a/tests/ui/argument-suggestions/issue-109425.stderr +++ b/tests/ui/argument-suggestions/issue-109425.stderr @@ -29,7 +29,7 @@ note: function defined here --> $DIR/issue-109425.rs:4:4 | LL | fn i(_: u32) {} - | ^ ------ + | ^ help: remove the extra arguments | LL - i(0, 1, 2,); // i(0,) @@ -48,7 +48,7 @@ note: function defined here --> $DIR/issue-109425.rs:4:4 | LL | fn i(_: u32) {} - | ^ ------ + | ^ help: remove the extra arguments | LL - i(0, 1, 2); // i(0) @@ -67,7 +67,7 @@ note: function defined here --> $DIR/issue-109425.rs:5:4 | LL | fn is(_: u32, _: &str) {} - | ^^ ------ ------- + | ^^ help: remove the extra arguments | LL - is(0, 1, 2, ""); // is(0, "") @@ -86,7 +86,7 @@ note: function defined here --> $DIR/issue-109425.rs:5:4 | LL | fn is(_: u32, _: &str) {} - | ^^ ------ ------- + | ^^ help: remove the extra arguments | LL - is((), 1, "", ()); @@ -105,7 +105,7 @@ note: function defined here --> $DIR/issue-109425.rs:5:4 | LL | fn is(_: u32, _: &str) {} - | ^^ ------ ------- + | ^^ help: remove the extra arguments | LL - is(1, (), "", ()); @@ -124,7 +124,7 @@ note: function defined here --> $DIR/issue-109425.rs:6:4 | LL | fn s(_: &str) {} - | ^ ------- + | ^ help: remove the extra arguments | LL - s(0, 1, ""); // s("") diff --git a/tests/ui/argument-suggestions/issue-109831.stderr b/tests/ui/argument-suggestions/issue-109831.stderr index 12be0887121..1a3a597175d 100644 --- a/tests/ui/argument-suggestions/issue-109831.stderr +++ b/tests/ui/argument-suggestions/issue-109831.stderr @@ -9,8 +9,9 @@ LL | fn f(b1: B, b2: B, a2: C) {} | help: a struct with a similar name exists | -LL | fn f(b1: B, b2: B, a2: A) {} - | ~ +LL - fn f(b1: B, b2: B, a2: C) {} +LL + fn f(b1: B, b2: B, a2: A) {} + | help: you might be missing a type parameter | LL | fn f<C>(b1: B, b2: B, a2: C) {} @@ -38,7 +39,7 @@ note: function defined here --> $DIR/issue-109831.rs:4:4 | LL | fn f(b1: B, b2: B, a2: C) {} - | ^ ----- ----- ----- + | ^ ----- ----- help: remove the extra argument | LL - f(A, A, B, C); diff --git a/tests/ui/argument-suggestions/issue-96638.stderr b/tests/ui/argument-suggestions/issue-96638.stderr index 6492acbad94..288a6853d05 100644 --- a/tests/ui/argument-suggestions/issue-96638.stderr +++ b/tests/ui/argument-suggestions/issue-96638.stderr @@ -10,11 +10,12 @@ note: function defined here --> $DIR/issue-96638.rs:1:4 | LL | fn f(_: usize, _: &usize, _: usize) {} - | ^ -------- --------- -------- + | ^ -------- -------- help: provide the argument | -LL | f(/* usize */, &x, /* usize */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - f(&x, ""); +LL + f(/* usize */, &x, /* usize */); + | error: aborting due to 1 previous error diff --git a/tests/ui/argument-suggestions/issue-97197.stderr b/tests/ui/argument-suggestions/issue-97197.stderr index 3768367a5e6..acaf4f15107 100644 --- a/tests/ui/argument-suggestions/issue-97197.stderr +++ b/tests/ui/argument-suggestions/issue-97197.stderr @@ -8,11 +8,12 @@ note: function defined here --> $DIR/issue-97197.rs:6:8 | LL | pub fn g(a1: (), a2: bool, a3: bool, a4: bool, a5: bool, a6: ()) -> () {} - | ^ ------ -------- -------- -------- -------- ------ + | ^ -------- -------- -------- -------- help: provide the arguments | -LL | g((), /* bool */, /* bool */, /* bool */, /* bool */, ()); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - g((), ()); +LL + g((), /* bool */, /* bool */, /* bool */, /* bool */, ()); + | error: aborting due to 1 previous error diff --git a/tests/ui/argument-suggestions/issue-97484.stderr b/tests/ui/argument-suggestions/issue-97484.stderr index a7708f6e0d7..e09d1928f74 100644 --- a/tests/ui/argument-suggestions/issue-97484.stderr +++ b/tests/ui/argument-suggestions/issue-97484.stderr @@ -12,7 +12,7 @@ note: function defined here --> $DIR/issue-97484.rs:9:4 | LL | fn foo(a: &A, d: D, e: &E, g: G) {} - | ^^^ ----- ---- ----- ---- + | ^^^ ----- help: consider borrowing here | LL | foo(&&A, B, C, D, &E, F, G); diff --git a/tests/ui/argument-suggestions/issue-98894.stderr b/tests/ui/argument-suggestions/issue-98894.stderr index 93e604c3101..44353cb3338 100644 --- a/tests/ui/argument-suggestions/issue-98894.stderr +++ b/tests/ui/argument-suggestions/issue-98894.stderr @@ -11,8 +11,9 @@ LL | (|_, ()| ())(if true {} else {return;}); | ^^^^^^^ help: provide the argument | -LL | (|_, ()| ())(if true {} else {return;}, ()); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - (|_, ()| ())(if true {} else {return;}); +LL + (|_, ()| ())(if true {} else {return;}, ()); + | error: aborting due to 1 previous error diff --git a/tests/ui/argument-suggestions/issue-98897.stderr b/tests/ui/argument-suggestions/issue-98897.stderr index 671e3d99d85..fd3ef467b1c 100644 --- a/tests/ui/argument-suggestions/issue-98897.stderr +++ b/tests/ui/argument-suggestions/issue-98897.stderr @@ -11,8 +11,9 @@ LL | (|_, ()| ())([return, ()]); | ^^^^^^^ help: provide the argument | -LL | (|_, ()| ())([return, ()], ()); - | ~~~~~~~~~~~~~~~~~~ +LL - (|_, ()| ())([return, ()]); +LL + (|_, ()| ())([return, ()], ()); + | error: aborting due to 1 previous error diff --git a/tests/ui/argument-suggestions/issue-99482.stderr b/tests/ui/argument-suggestions/issue-99482.stderr index be407874615..b3c39604a99 100644 --- a/tests/ui/argument-suggestions/issue-99482.stderr +++ b/tests/ui/argument-suggestions/issue-99482.stderr @@ -11,8 +11,9 @@ LL | let f = |_: (), f: fn()| f; | ^^^^^^^^^^^^^^^^ help: provide the argument | -LL | let _f = f((), main); - | ~~~~~~~~~~ +LL - let _f = f(main); +LL + let _f = f((), main); + | error: aborting due to 1 previous error diff --git a/tests/ui/argument-suggestions/missing_arguments.stderr b/tests/ui/argument-suggestions/missing_arguments.stderr index 3a27a51d032..264c485cbe1 100644 --- a/tests/ui/argument-suggestions/missing_arguments.stderr +++ b/tests/ui/argument-suggestions/missing_arguments.stderr @@ -11,8 +11,9 @@ LL | fn one_arg(_a: i32) {} | ^^^^^^^ ------- help: provide the argument | -LL | one_arg(/* i32 */); - | ~~~~~~~~~~~ +LL - one_arg(); +LL + one_arg(/* i32 */); + | error[E0061]: this function takes 2 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:14:3 @@ -27,8 +28,9 @@ LL | fn two_same(_a: i32, _b: i32) {} | ^^^^^^^^ ------- ------- help: provide the arguments | -LL | two_same(/* i32 */, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - two_same( ); +LL + two_same(/* i32 */, /* i32 */); + | error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:15:3 @@ -40,11 +42,12 @@ note: function defined here --> $DIR/missing_arguments.rs:2:4 | LL | fn two_same(_a: i32, _b: i32) {} - | ^^^^^^^^ ------- ------- + | ^^^^^^^^ ------- help: provide the argument | -LL | two_same(1, /* i32 */); - | ~~~~~~~~~~~~~~ +LL - two_same( 1 ); +LL + two_same(1, /* i32 */); + | error[E0061]: this function takes 2 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:16:3 @@ -59,8 +62,9 @@ LL | fn two_diff(_a: i32, _b: f32) {} | ^^^^^^^^ ------- ------- help: provide the arguments | -LL | two_diff(/* i32 */, /* f32 */); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - two_diff( ); +LL + two_diff(/* i32 */, /* f32 */); + | error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:17:3 @@ -72,11 +76,12 @@ note: function defined here --> $DIR/missing_arguments.rs:3:4 | LL | fn two_diff(_a: i32, _b: f32) {} - | ^^^^^^^^ ------- ------- + | ^^^^^^^^ ------- help: provide the argument | -LL | two_diff(1, /* f32 */); - | ~~~~~~~~~~~~~~ +LL - two_diff( 1 ); +LL + two_diff(1, /* f32 */); + | error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:18:3 @@ -88,11 +93,12 @@ note: function defined here --> $DIR/missing_arguments.rs:3:4 | LL | fn two_diff(_a: i32, _b: f32) {} - | ^^^^^^^^ ------- ------- + | ^^^^^^^^ ------- help: provide the argument | -LL | two_diff(/* i32 */, 1.0); - | ~~~~~~~~~~~~~~~~ +LL - two_diff( 1.0 ); +LL + two_diff(/* i32 */, 1.0); + | error[E0061]: this function takes 3 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:21:3 @@ -107,8 +113,9 @@ LL | fn three_same(_a: i32, _b: i32, _c: i32) {} | ^^^^^^^^^^ ------- ------- ------- help: provide the arguments | -LL | three_same(/* i32 */, /* i32 */, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - three_same( ); +LL + three_same(/* i32 */, /* i32 */, /* i32 */); + | error[E0061]: this function takes 3 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:22:3 @@ -120,11 +127,12 @@ note: function defined here --> $DIR/missing_arguments.rs:4:4 | LL | fn three_same(_a: i32, _b: i32, _c: i32) {} - | ^^^^^^^^^^ ------- ------- ------- + | ^^^^^^^^^^ ------- ------- help: provide the arguments | -LL | three_same(1, /* i32 */, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - three_same( 1 ); +LL + three_same(1, /* i32 */, /* i32 */); + | error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:23:3 @@ -136,11 +144,12 @@ note: function defined here --> $DIR/missing_arguments.rs:4:4 | LL | fn three_same(_a: i32, _b: i32, _c: i32) {} - | ^^^^^^^^^^ ------- ------- ------- + | ^^^^^^^^^^ ------- help: provide the argument | -LL | three_same(1, 1, /* i32 */); - | ~~~~~~~~~~~~~~~~~ +LL - three_same( 1, 1 ); +LL + three_same(1, 1, /* i32 */); + | error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:26:3 @@ -152,11 +161,12 @@ note: function defined here --> $DIR/missing_arguments.rs:5:4 | LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ ------- help: provide the argument | -LL | three_diff(/* i32 */, 1.0, ""); - | ~~~~~~~~~~~~~~~~~~~~ +LL - three_diff( 1.0, "" ); +LL + three_diff(/* i32 */, 1.0, ""); + | error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:27:3 @@ -168,11 +178,12 @@ note: function defined here --> $DIR/missing_arguments.rs:5:4 | LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ ------- help: provide the argument | -LL | three_diff(1, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~ +LL - three_diff( 1, "" ); +LL + three_diff(1, /* f32 */, ""); + | error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:28:3 @@ -184,11 +195,12 @@ note: function defined here --> $DIR/missing_arguments.rs:5:4 | LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ -------- help: provide the argument | -LL | three_diff(1, 1.0, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~ +LL - three_diff( 1, 1.0 ); +LL + three_diff(1, 1.0, /* &str */); + | error[E0061]: this function takes 3 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:29:3 @@ -200,11 +212,12 @@ note: function defined here --> $DIR/missing_arguments.rs:5:4 | LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ ------- ------- help: provide the arguments | -LL | three_diff(/* i32 */, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - three_diff( "" ); +LL + three_diff(/* i32 */, /* f32 */, ""); + | error[E0061]: this function takes 3 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:30:3 @@ -219,11 +232,12 @@ note: function defined here --> $DIR/missing_arguments.rs:5:4 | LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ ------- -------- help: provide the arguments | -LL | three_diff(/* i32 */, 1.0, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - three_diff( 1.0 ); +LL + three_diff(/* i32 */, 1.0, /* &str */); + | error[E0061]: this function takes 3 arguments but 1 argument was supplied --> $DIR/missing_arguments.rs:31:3 @@ -235,11 +249,12 @@ note: function defined here --> $DIR/missing_arguments.rs:5:4 | LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ ------- -------- help: provide the arguments | -LL | three_diff(1, /* f32 */, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - three_diff( 1 ); +LL + three_diff(1, /* f32 */, /* &str */); + | error[E0061]: this function takes 4 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:34:3 @@ -254,8 +269,9 @@ LL | fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {} | ^^^^^^^^^^^^^ ------- ------- ------- -------- help: provide the arguments | -LL | four_repeated(/* i32 */, /* f32 */, /* f32 */, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - four_repeated( ); +LL + four_repeated(/* i32 */, /* f32 */, /* f32 */, /* &str */); + | error[E0061]: this function takes 4 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:35:3 @@ -267,11 +283,12 @@ note: function defined here --> $DIR/missing_arguments.rs:6:4 | LL | fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {} - | ^^^^^^^^^^^^^ ------- ------- ------- -------- + | ^^^^^^^^^^^^^ ------- ------- help: provide the arguments | -LL | four_repeated(1, /* f32 */, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - four_repeated( 1, "" ); +LL + four_repeated(1, /* f32 */, /* f32 */, ""); + | error[E0061]: this function takes 5 arguments but 0 arguments were supplied --> $DIR/missing_arguments.rs:38:3 @@ -286,8 +303,9 @@ LL | fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {} | ^^^^^^^ ------- ------- ------- ------- -------- help: provide the arguments | -LL | complex(/* i32 */, /* f32 */, /* i32 */, /* f32 */, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - complex( ); +LL + complex(/* i32 */, /* f32 */, /* i32 */, /* f32 */, /* &str */); + | error[E0061]: this function takes 5 arguments but 2 arguments were supplied --> $DIR/missing_arguments.rs:39:3 @@ -299,11 +317,12 @@ note: function defined here --> $DIR/missing_arguments.rs:7:4 | LL | fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {} - | ^^^^^^^ ------- ------- ------- ------- -------- + | ^^^^^^^ ------- ------- ------- help: provide the arguments | -LL | complex(1, /* f32 */, /* i32 */, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - complex( 1, "" ); +LL + complex(1, /* f32 */, /* i32 */, /* f32 */, ""); + | error: aborting due to 19 previous errors diff --git a/tests/ui/argument-suggestions/mixed_cases.stderr b/tests/ui/argument-suggestions/mixed_cases.stderr index bec5d4dc16b..0dcb4337eb1 100644 --- a/tests/ui/argument-suggestions/mixed_cases.stderr +++ b/tests/ui/argument-suggestions/mixed_cases.stderr @@ -10,7 +10,7 @@ note: function defined here --> $DIR/mixed_cases.rs:5:4 | LL | fn two_args(_a: i32, _b: f32) {} - | ^^^^^^^^ ------- ------- + | ^^^^^^^^ ------- help: remove the extra argument | LL - two_args(1, "", X {}); @@ -30,11 +30,12 @@ note: function defined here --> $DIR/mixed_cases.rs:6:4 | LL | fn three_args(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ ------- help: did you mean | -LL | three_args(1, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~ +LL - three_args(1, "", X {}, ""); +LL + three_args(1, /* f32 */, ""); + | error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/mixed_cases.rs:14:3 @@ -49,11 +50,12 @@ note: function defined here --> $DIR/mixed_cases.rs:6:4 | LL | fn three_args(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ ------- -------- help: provide the argument | -LL | three_args(1, /* f32 */, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - three_args(1, X {}); +LL + three_args(1, /* f32 */, /* &str */); + | error[E0308]: arguments to this function are incorrect --> $DIR/mixed_cases.rs:17:3 @@ -67,11 +69,12 @@ note: function defined here --> $DIR/mixed_cases.rs:6:4 | LL | fn three_args(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ ------- help: did you mean | -LL | three_args(1, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~ +LL - three_args(1, "", X {}); +LL + three_args(1, /* f32 */, ""); + | error[E0308]: arguments to this function are incorrect --> $DIR/mixed_cases.rs:20:3 @@ -86,11 +89,12 @@ note: function defined here --> $DIR/mixed_cases.rs:6:4 | LL | fn three_args(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ ------- help: swap these arguments | -LL | three_args(1, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~ +LL - three_args("", X {}, 1); +LL + three_args(1, /* f32 */, ""); + | error[E0061]: this function takes 3 arguments but 2 arguments were supplied --> $DIR/mixed_cases.rs:23:3 @@ -106,11 +110,12 @@ note: function defined here --> $DIR/mixed_cases.rs:6:4 | LL | fn three_args(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ ------- help: did you mean | -LL | three_args(1, /* f32 */, ""); - | ~~~~~~~~~~~~~~~~~~ +LL - three_args("", 1); +LL + three_args(1, /* f32 */, ""); + | error: aborting due to 6 previous errors diff --git a/tests/ui/argument-suggestions/permuted_arguments.stderr b/tests/ui/argument-suggestions/permuted_arguments.stderr index 655807a7f38..9592fc2801c 100644 --- a/tests/ui/argument-suggestions/permuted_arguments.stderr +++ b/tests/ui/argument-suggestions/permuted_arguments.stderr @@ -11,11 +11,12 @@ note: function defined here --> $DIR/permuted_arguments.rs:5:4 | LL | fn three_args(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ help: reorder these arguments | -LL | three_args(1, 1.0, ""); - | ~~~~~~~~~~~~ +LL - three_args(1.0, "", 1); +LL + three_args(1, 1.0, ""); + | error[E0308]: arguments to this function are incorrect --> $DIR/permuted_arguments.rs:12:3 @@ -32,11 +33,12 @@ note: function defined here --> $DIR/permuted_arguments.rs:6:4 | LL | fn many_args(_a: i32, _b: f32, _c: &str, _d: X, _e: Y) {} - | ^^^^^^^^^ ------- ------- -------- ----- ----- + | ^^^^^^^^^ help: reorder these arguments | -LL | many_args(1, 1.0, "", X {}, Y {}); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - many_args(X {}, Y {}, 1, 1.0, ""); +LL + many_args(1, 1.0, "", X {}, Y {}); + | error: aborting due to 2 previous errors diff --git a/tests/ui/argument-suggestions/suggest-better-removing-issue-126246.stderr b/tests/ui/argument-suggestions/suggest-better-removing-issue-126246.stderr index 730f20cfb88..48c647764df 100644 --- a/tests/ui/argument-suggestions/suggest-better-removing-issue-126246.stderr +++ b/tests/ui/argument-suggestions/suggest-better-removing-issue-126246.stderr @@ -38,7 +38,7 @@ note: function defined here --> $DIR/suggest-better-removing-issue-126246.rs:1:4 | LL | fn add_one(x: i32) -> i32 { - | ^^^^^^^ ------ + | ^^^^^^^ help: remove the extra argument | LL - add_one(2, 2); @@ -55,7 +55,7 @@ note: function defined here --> $DIR/suggest-better-removing-issue-126246.rs:1:4 | LL | fn add_one(x: i32) -> i32 { - | ^^^^^^^ ------ + | ^^^^^^^ help: remove the extra argument | LL - add_one(no_such_local, 10); @@ -72,7 +72,7 @@ note: function defined here --> $DIR/suggest-better-removing-issue-126246.rs:1:4 | LL | fn add_one(x: i32) -> i32 { - | ^^^^^^^ ------ + | ^^^^^^^ help: remove the extra argument | LL - add_one(10, no_such_local); @@ -89,7 +89,7 @@ note: function defined here --> $DIR/suggest-better-removing-issue-126246.rs:5:4 | LL | fn add_two(x: i32, y: i32) -> i32 { - | ^^^^^^^ ------ ------ + | ^^^^^^^ help: remove the extra argument | LL - add_two(10, no_such_local, 10); @@ -106,7 +106,7 @@ note: function defined here --> $DIR/suggest-better-removing-issue-126246.rs:5:4 | LL | fn add_two(x: i32, y: i32) -> i32 { - | ^^^^^^^ ------ ------ + | ^^^^^^^ help: remove the extra argument | LL - add_two(no_such_local, 10, 10); @@ -123,7 +123,7 @@ note: function defined here --> $DIR/suggest-better-removing-issue-126246.rs:5:4 | LL | fn add_two(x: i32, y: i32) -> i32 { - | ^^^^^^^ ------ ------ + | ^^^^^^^ help: remove the extra argument | LL - add_two(10, 10, no_such_local); diff --git a/tests/ui/argument-suggestions/swapped_arguments.stderr b/tests/ui/argument-suggestions/swapped_arguments.stderr index dabf5e952b2..f72659363ac 100644 --- a/tests/ui/argument-suggestions/swapped_arguments.stderr +++ b/tests/ui/argument-suggestions/swapped_arguments.stderr @@ -10,11 +10,12 @@ note: function defined here --> $DIR/swapped_arguments.rs:3:4 | LL | fn two_args(_a: i32, _b: f32) {} - | ^^^^^^^^ ------- ------- + | ^^^^^^^^ help: swap these arguments | -LL | two_args(1, 1.0); - | ~~~~~~~~ +LL - two_args(1.0, 1); +LL + two_args(1, 1.0); + | error[E0308]: arguments to this function are incorrect --> $DIR/swapped_arguments.rs:9:3 @@ -28,11 +29,12 @@ note: function defined here --> $DIR/swapped_arguments.rs:4:4 | LL | fn three_args(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ help: swap these arguments | -LL | three_args(1, 1.0, ""); - | ~~~~~~~~~~~~ +LL - three_args(1.0, 1, ""); +LL + three_args(1, 1.0, ""); + | error[E0308]: arguments to this function are incorrect --> $DIR/swapped_arguments.rs:10:3 @@ -46,11 +48,12 @@ note: function defined here --> $DIR/swapped_arguments.rs:4:4 | LL | fn three_args(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ help: swap these arguments | -LL | three_args(1, 1.0, ""); - | ~~~~~~~~~~~~ +LL - three_args( 1, "", 1.0); +LL + three_args(1, 1.0, ""); + | error[E0308]: arguments to this function are incorrect --> $DIR/swapped_arguments.rs:11:3 @@ -64,11 +67,12 @@ note: function defined here --> $DIR/swapped_arguments.rs:4:4 | LL | fn three_args(_a: i32, _b: f32, _c: &str) {} - | ^^^^^^^^^^ ------- ------- -------- + | ^^^^^^^^^^ help: swap these arguments | -LL | three_args(1, 1.0, ""); - | ~~~~~~~~~~~~ +LL - three_args( "", 1.0, 1); +LL + three_args(1, 1.0, ""); + | error[E0308]: arguments to this function are incorrect --> $DIR/swapped_arguments.rs:13:3 @@ -84,11 +88,12 @@ note: function defined here --> $DIR/swapped_arguments.rs:5:4 | LL | fn four_args(_a: i32, _b: f32, _c: &str, _d: X) {} - | ^^^^^^^^^ ------- ------- -------- ----- + | ^^^^^^^^^ help: did you mean | -LL | four_args(1, 1.0, "", X {}); - | ~~~~~~~~~~~~~~~~~~ +LL - four_args(1.0, 1, X {}, ""); +LL + four_args(1, 1.0, "", X {}); + | error: aborting due to 5 previous errors diff --git a/tests/ui/array-slice-vec/driftsort-off-by-one-issue-136103.rs b/tests/ui/array-slice-vec/driftsort-off-by-one-issue-136103.rs new file mode 100644 index 00000000000..42197ff102d --- /dev/null +++ b/tests/ui/array-slice-vec/driftsort-off-by-one-issue-136103.rs @@ -0,0 +1,10 @@ +//@ run-pass +// Ensures that driftsort doesn't crash under specific slice +// length and memory size. +// Based on the example given in https://github.com/rust-lang/rust/issues/136103. +fn main() { + let n = 127; + let mut objs: Vec<_> = + (0..n).map(|i| [(i % 2) as u8; 125001]).collect(); + objs.sort(); +} diff --git a/tests/ui/array-slice-vec/suggest-array-length.stderr b/tests/ui/array-slice-vec/suggest-array-length.stderr index b71be306780..14d10832e36 100644 --- a/tests/ui/array-slice-vec/suggest-array-length.stderr +++ b/tests/ui/array-slice-vec/suggest-array-length.stderr @@ -6,8 +6,9 @@ LL | const Foo: [i32; _] = [1, 2, 3]; | help: replace this with a fully-specified type | -LL | const Foo: [i32; 3] = [1, 2, 3]; - | ~~~~~~~~ +LL - const Foo: [i32; _] = [1, 2, 3]; +LL + const Foo: [i32; 3] = [1, 2, 3]; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/suggest-array-length.rs:7:26 @@ -17,8 +18,9 @@ LL | const REF_FOO: &[u8; _] = &[1]; | help: replace this with a fully-specified type | -LL | const REF_FOO: &[u8; 1] = &[1]; - | ~~~~~~~~ +LL - const REF_FOO: &[u8; _] = &[1]; +LL + const REF_FOO: &[u8; 1] = &[1]; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/suggest-array-length.rs:9:26 @@ -28,8 +30,9 @@ LL | static Statik: [i32; _] = [1, 2, 3]; | help: replace this with a fully-specified type | -LL | static Statik: [i32; 3] = [1, 2, 3]; - | ~~~~~~~~ +LL - static Statik: [i32; _] = [1, 2, 3]; +LL + static Statik: [i32; 3] = [1, 2, 3]; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/suggest-array-length.rs:11:30 @@ -39,8 +42,9 @@ LL | static REF_STATIK: &[u8; _] = &[1]; | help: replace this with a fully-specified type | -LL | static REF_STATIK: &[u8; 1] = &[1]; - | ~~~~~~~~ +LL - static REF_STATIK: &[u8; _] = &[1]; +LL + static REF_STATIK: &[u8; 1] = &[1]; + | error[E0658]: using `_` for array lengths is unstable --> $DIR/suggest-array-length.rs:13:20 diff --git a/tests/ui/asm/aarch64/bad-reg.stderr b/tests/ui/asm/aarch64/bad-reg.stderr index 370752ad0f1..c76722f32a7 100644 --- a/tests/ui/asm/aarch64/bad-reg.stderr +++ b/tests/ui/asm/aarch64/bad-reg.stderr @@ -3,6 +3,8 @@ error: invalid register class `foo`: unknown register class | LL | asm!("{}", in(foo) foo); | ^^^^^^^^^^^ + | + = note: the following register classes are supported on this target: `reg`, `vreg`, `vreg_low16`, `preg` error: invalid register `foo`: unknown register --> $DIR/bad-reg.rs:14:18 diff --git a/tests/ui/asm/aarch64/parse-error.stderr b/tests/ui/asm/aarch64/parse-error.stderr index 7b273282ee6..b5e1169e5f6 100644 --- a/tests/ui/asm/aarch64/parse-error.stderr +++ b/tests/ui/asm/aarch64/parse-error.stderr @@ -330,8 +330,9 @@ LL | asm!("{}", options(), const foo); | help: consider using `const` instead of `let` | -LL | const foo: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut foo = 0; +LL + const foo: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:45:44 @@ -341,8 +342,9 @@ LL | asm!("{}", clobber_abi("C"), const foo); | help: consider using `const` instead of `let` | -LL | const foo: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut foo = 0; +LL + const foo: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:48:55 @@ -352,8 +354,9 @@ LL | asm!("{}", options(), clobber_abi("C"), const foo); | help: consider using `const` instead of `let` | -LL | const foo: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut foo = 0; +LL + const foo: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:50:31 @@ -363,8 +366,9 @@ LL | asm!("{a}", a = const foo, a = const bar); | help: consider using `const` instead of `let` | -LL | const foo: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut foo = 0; +LL + const foo: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:50:46 @@ -374,8 +378,9 @@ LL | asm!("{a}", a = const foo, a = const bar); | help: consider using `const` instead of `let` | -LL | const bar: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut bar = 0; +LL + const bar: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:57:45 @@ -385,8 +390,9 @@ LL | asm!("{a}", in("x0") foo, a = const bar); | help: consider using `const` instead of `let` | -LL | const bar: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut bar = 0; +LL + const bar: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:59:45 @@ -396,8 +402,9 @@ LL | asm!("{a}", in("x0") foo, a = const bar); | help: consider using `const` instead of `let` | -LL | const bar: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut bar = 0; +LL + const bar: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:61:41 @@ -407,8 +414,9 @@ LL | asm!("{1}", in("x0") foo, const bar); | help: consider using `const` instead of `let` | -LL | const bar: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut bar = 0; +LL + const bar: /* Type */ = 0; + | error: aborting due to 59 previous errors diff --git a/tests/ui/asm/invalid-const-operand.stderr b/tests/ui/asm/invalid-const-operand.stderr index bda4b0355b7..13bb10e84a5 100644 --- a/tests/ui/asm/invalid-const-operand.stderr +++ b/tests/ui/asm/invalid-const-operand.stderr @@ -6,8 +6,9 @@ LL | asm!("{}", const x); | help: consider using `const` instead of `let` | -LL | const x: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let x = 0; +LL + const x: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/invalid-const-operand.rs:43:36 @@ -17,8 +18,9 @@ LL | asm!("{}", const const_foo(x)); | help: consider using `const` instead of `let` | -LL | const x: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let x = 0; +LL + const x: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/invalid-const-operand.rs:46:36 @@ -28,8 +30,9 @@ LL | asm!("{}", const const_bar(x)); | help: consider using `const` instead of `let` | -LL | const x: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let x = 0; +LL + const x: /* Type */ = 0; + | error: invalid type for `const` operand --> $DIR/invalid-const-operand.rs:12:19 diff --git a/tests/ui/asm/parse-error.stderr b/tests/ui/asm/parse-error.stderr index 6d0e629b937..74647372a35 100644 --- a/tests/ui/asm/parse-error.stderr +++ b/tests/ui/asm/parse-error.stderr @@ -424,8 +424,9 @@ LL | asm!("{}", options(), const foo); | help: consider using `const` instead of `let` | -LL | const foo: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut foo = 0; +LL + const foo: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:69:44 @@ -435,8 +436,9 @@ LL | asm!("{}", clobber_abi("C"), const foo); | help: consider using `const` instead of `let` | -LL | const foo: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut foo = 0; +LL + const foo: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:72:55 @@ -446,8 +448,9 @@ LL | asm!("{}", options(), clobber_abi("C"), const foo); | help: consider using `const` instead of `let` | -LL | const foo: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut foo = 0; +LL + const foo: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:74:31 @@ -457,8 +460,9 @@ LL | asm!("{a}", a = const foo, a = const bar); | help: consider using `const` instead of `let` | -LL | const foo: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut foo = 0; +LL + const foo: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/parse-error.rs:74:46 @@ -468,8 +472,9 @@ LL | asm!("{a}", a = const foo, a = const bar); | help: consider using `const` instead of `let` | -LL | const bar: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut bar = 0; +LL + const bar: /* Type */ = 0; + | error: aborting due to 72 previous errors diff --git a/tests/ui/asm/x86_64/bad-reg.stderr b/tests/ui/asm/x86_64/bad-reg.stderr index 3df1f7b2208..6a02957210b 100644 --- a/tests/ui/asm/x86_64/bad-reg.stderr +++ b/tests/ui/asm/x86_64/bad-reg.stderr @@ -3,6 +3,8 @@ error: invalid register class `foo`: unknown register class | LL | asm!("{}", in(foo) foo); | ^^^^^^^^^^^ + | + = note: the following register classes are supported on this target: `reg`, `reg_abcd`, `reg_byte`, `xmm_reg`, `ymm_reg`, `zmm_reg`, `kreg`, `kreg0`, `mmx_reg`, `x87_reg`, `tmm_reg` error: invalid register `foo`: unknown register --> $DIR/bad-reg.rs:14:18 diff --git a/tests/ui/asm/x86_64/issue-82869.stderr b/tests/ui/asm/x86_64/issue-82869.stderr index 3cf9d6d1c1c..56e49099569 100644 --- a/tests/ui/asm/x86_64/issue-82869.stderr +++ b/tests/ui/asm/x86_64/issue-82869.stderr @@ -3,12 +3,16 @@ error: invalid register class `vreg`: unknown register class | LL | asm!("add {:d}, {:d}, d0", out(vreg) c, in(vreg) a, in("d0") { | ^^^^^^^^^^^ + | + = note: the following register classes are supported on this target: `reg`, `reg_abcd`, `reg_byte`, `xmm_reg`, `ymm_reg`, `zmm_reg`, `kreg`, `kreg0`, `mmx_reg`, `x87_reg`, `tmm_reg` error: invalid register class `vreg`: unknown register class --> $DIR/issue-82869.rs:11:45 | LL | asm!("add {:d}, {:d}, d0", out(vreg) c, in(vreg) a, in("d0") { | ^^^^^^^^^^ + | + = note: the following register classes are supported on this target: `reg`, `reg_abcd`, `reg_byte`, `xmm_reg`, `ymm_reg`, `zmm_reg`, `kreg`, `kreg0`, `mmx_reg`, `x87_reg`, `tmm_reg` error: invalid register `d0`: unknown register --> $DIR/issue-82869.rs:11:57 diff --git a/tests/ui/asm/x86_64/issue-89875.rs b/tests/ui/asm/x86_64/issue-89875.rs index af940f05fea..0252859cff0 100644 --- a/tests/ui/asm/x86_64/issue-89875.rs +++ b/tests/ui/asm/x86_64/issue-89875.rs @@ -2,8 +2,6 @@ //@ needs-asm-support //@ only-x86_64 -#![feature(target_feature_11)] - use std::arch::asm; #[target_feature(enable = "avx")] diff --git a/tests/ui/asm/x86_64/x86_64_parse_error.stderr b/tests/ui/asm/x86_64/x86_64_parse_error.stderr index b64f6c1127e..dfa3e1d0ef2 100644 --- a/tests/ui/asm/x86_64/x86_64_parse_error.stderr +++ b/tests/ui/asm/x86_64/x86_64_parse_error.stderr @@ -20,8 +20,9 @@ LL | asm!("{a}", in("eax") foo, a = const bar); | help: consider using `const` instead of `let` | -LL | const bar: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut bar = 0; +LL + const bar: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/x86_64_parse_error.rs:13:46 @@ -31,8 +32,9 @@ LL | asm!("{a}", in("eax") foo, a = const bar); | help: consider using `const` instead of `let` | -LL | const bar: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut bar = 0; +LL + const bar: /* Type */ = 0; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/x86_64_parse_error.rs:15:42 @@ -42,8 +44,9 @@ LL | asm!("{1}", in("eax") foo, const bar); | help: consider using `const` instead of `let` | -LL | const bar: /* Type */ = 0; - | ~~~~~ ++++++++++++ +LL - let mut bar = 0; +LL + const bar: /* Type */ = 0; + | error: aborting due to 5 previous errors diff --git a/tests/ui/associated-consts/associated-const-ambiguity-report.stderr b/tests/ui/associated-consts/associated-const-ambiguity-report.stderr index 35ee95d1215..e68ba503c50 100644 --- a/tests/ui/associated-consts/associated-const-ambiguity-report.stderr +++ b/tests/ui/associated-consts/associated-const-ambiguity-report.stderr @@ -16,10 +16,12 @@ LL | const ID: i32 = 1; | ^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | const X: i32 = <i32 as Bar>::ID; - | ~~~~~~~~~~~~~~ -LL | const X: i32 = <i32 as Foo>::ID; - | ~~~~~~~~~~~~~~ +LL - const X: i32 = <i32>::ID; +LL + const X: i32 = <i32 as Bar>::ID; + | +LL - const X: i32 = <i32>::ID; +LL + const X: i32 = <i32 as Foo>::ID; + | error: aborting due to 1 previous error diff --git a/tests/ui/associated-consts/associated-const-in-trait.rs b/tests/ui/associated-consts/associated-const-in-trait.rs index 90ad596b23e..4d88f4ff531 100644 --- a/tests/ui/associated-consts/associated-const-in-trait.rs +++ b/tests/ui/associated-consts/associated-const-in-trait.rs @@ -8,6 +8,7 @@ impl dyn Trait { //~^ ERROR the trait `Trait` is not dyn compatible [E0038] const fn n() -> usize { Self::N } //~^ ERROR the trait `Trait` is not dyn compatible [E0038] + //~| ERROR the trait `Trait` is not dyn compatible } fn main() {} diff --git a/tests/ui/associated-consts/associated-const-in-trait.stderr b/tests/ui/associated-consts/associated-const-in-trait.stderr index 107ceeaf113..fba7f53c097 100644 --- a/tests/ui/associated-consts/associated-const-in-trait.stderr +++ b/tests/ui/associated-consts/associated-const-in-trait.stderr @@ -5,7 +5,7 @@ LL | impl dyn Trait { | ^^^^^^^^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/associated-const-in-trait.rs:4:11 | LL | trait Trait { @@ -21,7 +21,7 @@ LL | const fn n() -> usize { Self::N } | ^^^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/associated-const-in-trait.rs:4:11 | LL | trait Trait { @@ -30,6 +30,22 @@ LL | const N: usize; | ^ ...because it contains this associated `const` = help: consider moving `N` to another trait -error: aborting due to 2 previous errors +error[E0038]: the trait `Trait` is not dyn compatible + --> $DIR/associated-const-in-trait.rs:9:29 + | +LL | const fn n() -> usize { Self::N } + | ^^^^^^^ `Trait` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/associated-const-in-trait.rs:4:11 + | +LL | trait Trait { + | ----- this trait is not dyn compatible... +LL | const N: usize; + | ^ ...because it contains this associated `const` + = help: consider moving `N` to another trait + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/associated-consts/issue-58022.stderr b/tests/ui/associated-consts/issue-58022.stderr index 82cbc9ed3b0..37cb162b2b2 100644 --- a/tests/ui/associated-consts/issue-58022.stderr +++ b/tests/ui/associated-consts/issue-58022.stderr @@ -1,12 +1,3 @@ -error[E0790]: cannot refer to the associated constant on trait without specifying the corresponding `impl` type - --> $DIR/issue-58022.rs:4:25 - | -LL | const SIZE: usize; - | ------------------ `Foo::SIZE` defined here -LL | -LL | fn new(slice: &[u8; Foo::SIZE]) -> Self; - | ^^^^^^^^^ cannot refer to the associated constant of trait - error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/issue-58022.rs:13:41 | @@ -21,6 +12,15 @@ LL | pub struct Bar<T: ?Sized>(T); | ^^^ = note: the return type of a function must have a statically known size +error[E0790]: cannot refer to the associated constant on trait without specifying the corresponding `impl` type + --> $DIR/issue-58022.rs:4:25 + | +LL | const SIZE: usize; + | ------------------ `Foo::SIZE` defined here +LL | +LL | fn new(slice: &[u8; Foo::SIZE]) -> Self; + | ^^^^^^^^^ cannot refer to the associated constant of trait + error[E0423]: expected function, tuple struct or tuple variant, found trait `Foo` --> $DIR/issue-58022.rs:15:9 | diff --git a/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.stderr b/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.stderr index 18d458aea80..165e89010b6 100644 --- a/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.stderr +++ b/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.stderr @@ -1,15 +1,3 @@ -error[E0599]: no associated item named `C` found for struct `Fail<i32, u32>` in the current scope - --> $DIR/wrong-projection-self-ty-invalid-bivariant-arg2.rs:15:23 - | -LL | struct Fail<T: Proj<Assoc = U>, U>(T); - | ---------------------------------- associated item `C` not found for this struct -... -LL | Fail::<i32, u32>::C - | ^ associated item not found in `Fail<i32, u32>` - | - = note: the associated item was found for - - `Fail<i32, i32>` - error[E0271]: type mismatch resolving `<i32 as Proj>::Assoc == u32` --> $DIR/wrong-projection-self-ty-invalid-bivariant-arg2.rs:15:5 | @@ -27,6 +15,18 @@ note: required by a bound in `Fail` LL | struct Fail<T: Proj<Assoc = U>, U>(T); | ^^^^^^^^^ required by this bound in `Fail` +error[E0599]: no associated item named `C` found for struct `Fail<i32, u32>` in the current scope + --> $DIR/wrong-projection-self-ty-invalid-bivariant-arg2.rs:15:23 + | +LL | struct Fail<T: Proj<Assoc = U>, U>(T); + | ---------------------------------- associated item `C` not found for this struct +... +LL | Fail::<i32, u32>::C + | ^ associated item not found in `Fail<i32, u32>` + | + = note: the associated item was found for + - `Fail<i32, i32>` + error: aborting due to 2 previous errors Some errors have detailed explanations: E0271, E0599. diff --git a/tests/ui/associated-inherent-types/bugs/wf-check-skipped.next.stderr b/tests/ui/associated-inherent-types/bugs/wf-check-skipped.next.stderr index bf53089675d..81ace4ebb6d 100644 --- a/tests/ui/associated-inherent-types/bugs/wf-check-skipped.next.stderr +++ b/tests/ui/associated-inherent-types/bugs/wf-check-skipped.next.stderr @@ -5,6 +5,8 @@ LL | fn main() -> Foo::Bar::<Vec<[u32]>> {} | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u32]` +note: required by an implicit `Sized` bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/associated-inherent-types/dont-select-if-disabled.stderr b/tests/ui/associated-inherent-types/dont-select-if-disabled.stderr index edf54894cd4..d245659c209 100644 --- a/tests/ui/associated-inherent-types/dont-select-if-disabled.stderr +++ b/tests/ui/associated-inherent-types/dont-select-if-disabled.stderr @@ -6,8 +6,9 @@ LL | struct S(S::P); | help: if there were a trait named `Example` with associated type `P` implemented for `S`, you could use the fully-qualified path | -LL | struct S(<S as Example>::P); - | ~~~~~~~~~~~~~~~~~ +LL - struct S(S::P); +LL + struct S(<S as Example>::P); + | error[E0658]: inherent associated types are unstable --> $DIR/dont-select-if-disabled.rs:15:10 diff --git a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr index 72d3f5c6d4d..d5e8fd69645 100644 --- a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr +++ b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr @@ -28,10 +28,12 @@ LL | fn T() -> Option<Self::Item> {} | help: use fully-qualified syntax | -LL | fn T() -> Option<<Windows<T> as IntoAsyncIterator>::Item> {} - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | fn T() -> Option<<Windows<T> as IntoIterator>::Item> {} - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn T() -> Option<Self::Item> {} +LL + fn T() -> Option<<Windows<T> as IntoAsyncIterator>::Item> {} + | +LL - fn T() -> Option<Self::Item> {} +LL + fn T() -> Option<<Windows<T> as IntoIterator>::Item> {} + | error[E0658]: inherent associated types are unstable --> $DIR/issue-109071.rs:8:5 diff --git a/tests/ui/associated-inherent-types/issue-109768.stderr b/tests/ui/associated-inherent-types/issue-109768.stderr index e71551f9e73..18455f4669e 100644 --- a/tests/ui/associated-inherent-types/issue-109768.stderr +++ b/tests/ui/associated-inherent-types/issue-109768.stderr @@ -43,8 +43,9 @@ LL | struct Wrapper<T>(T); | ^^^^^^^ help: provide the argument | -LL | const WRAPPED_ASSOC_3: Wrapper<Self::AssocType3> = Wrapper(/* value */); - | ~~~~~~~~~~~~~ +LL - const WRAPPED_ASSOC_3: Wrapper<Self::AssocType3> = Wrapper(); +LL + const WRAPPED_ASSOC_3: Wrapper<Self::AssocType3> = Wrapper(/* value */); + | error: aborting due to 4 previous errors diff --git a/tests/ui/associated-item/associated-item-enum.stderr b/tests/ui/associated-item/associated-item-enum.stderr index 3b00588f1d1..49f168b8544 100644 --- a/tests/ui/associated-item/associated-item-enum.stderr +++ b/tests/ui/associated-item/associated-item-enum.stderr @@ -9,8 +9,9 @@ LL | Enum::mispellable(); | help: there is an associated function `misspellable` with a similar name | -LL | Enum::misspellable(); - | ~~~~~~~~~~~~ +LL - Enum::mispellable(); +LL + Enum::misspellable(); + | error[E0599]: no variant or associated item named `mispellable_trait` found for enum `Enum` in the current scope --> $DIR/associated-item-enum.rs:18:11 @@ -23,8 +24,9 @@ LL | Enum::mispellable_trait(); | help: there is an associated function `misspellable_trait` with a similar name | -LL | Enum::misspellable_trait(); - | ~~~~~~~~~~~~~~~~~~ +LL - Enum::mispellable_trait(); +LL + Enum::misspellable_trait(); + | error[E0599]: no variant or associated item named `MISPELLABLE` found for enum `Enum` in the current scope --> $DIR/associated-item-enum.rs:19:11 @@ -37,8 +39,9 @@ LL | Enum::MISPELLABLE; | help: there is an associated constant `MISSPELLABLE` with a similar name | -LL | Enum::MISSPELLABLE; - | ~~~~~~~~~~~~ +LL - Enum::MISPELLABLE; +LL + Enum::MISSPELLABLE; + | error: aborting due to 3 previous errors diff --git a/tests/ui/associated-item/issue-48027.stderr b/tests/ui/associated-item/issue-48027.stderr index 1baaefd7720..513961e2bd0 100644 --- a/tests/ui/associated-item/issue-48027.stderr +++ b/tests/ui/associated-item/issue-48027.stderr @@ -5,7 +5,7 @@ LL | impl dyn Bar {} | ^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-48027.rs:2:11 | LL | trait Bar { diff --git a/tests/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.stderr b/tests/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.stderr index b1575abe571..d5795e7ed7d 100644 --- a/tests/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.stderr +++ b/tests/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.stderr @@ -6,8 +6,9 @@ LL | type Out = Box<dyn Bar<Assoc: Copy>>; | help: use `impl Trait` to introduce a type instead | -LL | type Out = Box<dyn Bar<Assoc = impl Copy>>; - | ~~~~~~ +LL - type Out = Box<dyn Bar<Assoc: Copy>>; +LL + type Out = Box<dyn Bar<Assoc = impl Copy>>; + | error: aborting due to 1 previous error diff --git a/tests/ui/associated-type-bounds/elision.stderr b/tests/ui/associated-type-bounds/elision.stderr index 36ca5a80024..75141080dbf 100644 --- a/tests/ui/associated-type-bounds/elision.stderr +++ b/tests/ui/associated-type-bounds/elision.stderr @@ -7,8 +7,9 @@ LL | fn f(x: &mut dyn Iterator<Item: Iterator<Item = &'_ ()>>) -> Option<&'_ ()> = help: this function's return type contains a borrowed value, but the signature does not say which one of `x`'s 2 lifetimes it is borrowed from help: consider introducing a named lifetime parameter | -LL | fn f<'a>(x: &'a mut dyn Iterator<Item: Iterator<Item = &'a ()>>) -> Option<&'a ()> { x.next() } - | ++++ ++ ~~ ~~ +LL - fn f(x: &mut dyn Iterator<Item: Iterator<Item = &'_ ()>>) -> Option<&'_ ()> { x.next() } +LL + fn f<'a>(x: &'a mut dyn Iterator<Item: Iterator<Item = &'a ()>>) -> Option<&'a ()> { x.next() } + | error: associated type bounds are not allowed in `dyn` types --> $DIR/elision.rs:4:27 @@ -18,8 +19,9 @@ LL | fn f(x: &mut dyn Iterator<Item: Iterator<Item = &'_ ()>>) -> Option<&'_ ()> | help: use `impl Trait` to introduce a type instead | -LL | fn f(x: &mut dyn Iterator<Item = impl Iterator<Item = &'_ ()>>) -> Option<&'_ ()> { x.next() } - | ~~~~~~ +LL - fn f(x: &mut dyn Iterator<Item: Iterator<Item = &'_ ()>>) -> Option<&'_ ()> { x.next() } +LL + fn f(x: &mut dyn Iterator<Item = impl Iterator<Item = &'_ ()>>) -> Option<&'_ ()> { x.next() } + | error: aborting due to 2 previous errors diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.stderr index 80705424035..12f6762cb51 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.stderr @@ -12,12 +12,14 @@ LL | T::method(..): Send, | help: use fully-qualified syntax to disambiguate | -LL | <T as B>::method(..): Send, - | ~~~~~~~~~~ +LL - T::method(..): Send, +LL + <T as B>::method(..): Send, + | help: use fully-qualified syntax to disambiguate | -LL | <T as A>::method(..): Send, - | ~~~~~~~~~~ +LL - T::method(..): Send, +LL + <T as A>::method(..): Send, + | error[E0221]: ambiguous associated function `method` in bounds of `T` --> $DIR/path-ambiguous.rs:21:5 @@ -33,12 +35,14 @@ LL | T::method(..): Send, | help: use fully-qualified syntax to disambiguate | -LL | <T as B>::method(..): Send, - | ~~~~~~~~~~ +LL - T::method(..): Send, +LL + <T as B>::method(..): Send, + | help: use fully-qualified syntax to disambiguate | -LL | <T as A>::method(..): Send, - | ~~~~~~~~~~ +LL - T::method(..): Send, +LL + <T as A>::method(..): Send, + | error: aborting due to 2 previous errors diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.stderr index 2a9a1a1e899..b3a229c58c8 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.stderr @@ -6,8 +6,9 @@ LL | T::method(..): Send, | help: use a fully qualified path with inferred lifetimes | -LL | <T as A<'_>>::method(..): Send, - | ~~~~~~~~~~~~~~ +LL - T::method(..): Send, +LL + <T as A<'_>>::method(..): Send, + | error[E0212]: cannot use the associated function of a trait with uninferred generic parameters --> $DIR/path-higher-ranked.rs:19:5 @@ -17,8 +18,9 @@ LL | T::method(..): Send, | help: use a fully qualified path with inferred lifetimes | -LL | <T as A<'_>>::method(..): Send, - | ~~~~~~~~~~~~~~ +LL - T::method(..): Send, +LL + <T as A<'_>>::method(..): Send, + | error: aborting due to 2 previous errors diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr index 6dbb5dabc0e..aad6dfc496b 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr @@ -6,8 +6,9 @@ LL | Trait::method(..): Send, | help: if there were a type named `Example` that implemented `Trait`, you could use the fully-qualified path | -LL | <Example as Trait>::method: Send, - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - Trait::method(..): Send, +LL + <Example as Trait>::method: Send, + | error: aborting due to 1 previous error diff --git a/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.stderr b/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.stderr index dbe285c5310..6eb8fabb185 100644 --- a/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.stderr +++ b/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.stderr @@ -10,8 +10,9 @@ LL | fn f(_: impl Trait<T = dyn Copy>) {} | +++ help: you might have meant to write a bound here | -LL | fn f(_: impl Trait<T: Copy>) {} - | ~ +LL - fn f(_: impl Trait<T = Copy>) {} +LL + fn f(_: impl Trait<T: Copy>) {} + | error[E0782]: expected a type, found a trait --> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:9:24 @@ -25,8 +26,9 @@ LL | fn g(_: impl Trait<T = dyn std::fmt::Debug + Eq>) {} | +++ help: you might have meant to write a bound here | -LL | fn g(_: impl Trait<T: std::fmt::Debug + Eq>) {} - | ~ +LL - fn g(_: impl Trait<T = std::fmt::Debug + Eq>) {} +LL + fn g(_: impl Trait<T: std::fmt::Debug + Eq>) {} + | error[E0782]: expected a type, found a trait --> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:14:26 @@ -40,8 +42,9 @@ LL | fn h(_: impl Trait<T<> = dyn 'static + for<'a> Fn(&'a ())>) {} | +++ help: you might have meant to write a bound here | -LL | fn h(_: impl Trait<T<>: 'static + for<'a> Fn(&'a ())>) {} - | ~ +LL - fn h(_: impl Trait<T<> = 'static + for<'a> Fn(&'a ())>) {} +LL + fn h(_: impl Trait<T<>: 'static + for<'a> Fn(&'a ())>) {} + | error[E0782]: expected a type, found a trait --> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:20:26 diff --git a/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr b/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr index df01e1e3768..b828eb86b43 100644 --- a/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr +++ b/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr @@ -12,12 +12,14 @@ LL | fn a<C:Vehicle+Box>(_: C::Color) { | help: use fully-qualified syntax to disambiguate | -LL | fn a<C:Vehicle+Box>(_: <C as Box>::Color) { - | ~~~~~~~~~~~~ +LL - fn a<C:Vehicle+Box>(_: C::Color) { +LL + fn a<C:Vehicle+Box>(_: <C as Box>::Color) { + | help: use fully-qualified syntax to disambiguate | -LL | fn a<C:Vehicle+Box>(_: <C as Vehicle>::Color) { - | ~~~~~~~~~~~~~~~~ +LL - fn a<C:Vehicle+Box>(_: C::Color) { +LL + fn a<C:Vehicle+Box>(_: <C as Vehicle>::Color) { + | error[E0221]: ambiguous associated type `Color` in bounds of `C` --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:20:12 @@ -33,12 +35,14 @@ LL | fn b<C>(_: C::Color) where C : Vehicle+Box { | help: use fully-qualified syntax to disambiguate | -LL | fn b<C>(_: <C as Box>::Color) where C : Vehicle+Box { - | ~~~~~~~~~~~~ +LL - fn b<C>(_: C::Color) where C : Vehicle+Box { +LL + fn b<C>(_: <C as Box>::Color) where C : Vehicle+Box { + | help: use fully-qualified syntax to disambiguate | -LL | fn b<C>(_: <C as Vehicle>::Color) where C : Vehicle+Box { - | ~~~~~~~~~~~~~~~~ +LL - fn b<C>(_: C::Color) where C : Vehicle+Box { +LL + fn b<C>(_: <C as Vehicle>::Color) where C : Vehicle+Box { + | error[E0221]: ambiguous associated type `Color` in bounds of `C` --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:24:12 @@ -54,12 +58,14 @@ LL | fn c<C>(_: C::Color) where C : Vehicle, C : Box { | help: use fully-qualified syntax to disambiguate | -LL | fn c<C>(_: <C as Box>::Color) where C : Vehicle, C : Box { - | ~~~~~~~~~~~~ +LL - fn c<C>(_: C::Color) where C : Vehicle, C : Box { +LL + fn c<C>(_: <C as Box>::Color) where C : Vehicle, C : Box { + | help: use fully-qualified syntax to disambiguate | -LL | fn c<C>(_: <C as Vehicle>::Color) where C : Vehicle, C : Box { - | ~~~~~~~~~~~~~~~~ +LL - fn c<C>(_: C::Color) where C : Vehicle, C : Box { +LL + fn c<C>(_: <C as Vehicle>::Color) where C : Vehicle, C : Box { + | error[E0221]: ambiguous associated type `Color` in bounds of `X` --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:35:20 @@ -75,12 +81,14 @@ LL | fn e(&self, _: X::Color) where X : Box; | help: use fully-qualified syntax to disambiguate | -LL | fn e(&self, _: <X as Box>::Color) where X : Box; - | ~~~~~~~~~~~~ +LL - fn e(&self, _: X::Color) where X : Box; +LL + fn e(&self, _: <X as Box>::Color) where X : Box; + | help: use fully-qualified syntax to disambiguate | -LL | fn e(&self, _: <X as Vehicle>::Color) where X : Box; - | ~~~~~~~~~~~~~~~~ +LL - fn e(&self, _: X::Color) where X : Box; +LL + fn e(&self, _: <X as Vehicle>::Color) where X : Box; + | error[E0221]: ambiguous associated type `Color` in bounds of `X` --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:38:20 @@ -96,12 +104,14 @@ LL | fn f(&self, _: X::Color) where X : Box { } | help: use fully-qualified syntax to disambiguate | -LL | fn f(&self, _: <X as Box>::Color) where X : Box { } - | ~~~~~~~~~~~~ +LL - fn f(&self, _: X::Color) where X : Box { } +LL + fn f(&self, _: <X as Box>::Color) where X : Box { } + | help: use fully-qualified syntax to disambiguate | -LL | fn f(&self, _: <X as Vehicle>::Color) where X : Box { } - | ~~~~~~~~~~~~~~~~ +LL - fn f(&self, _: X::Color) where X : Box { } +LL + fn f(&self, _: <X as Vehicle>::Color) where X : Box { } + | error[E0221]: ambiguous associated type `Color` in bounds of `X` --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:30:20 @@ -117,12 +127,14 @@ LL | fn d(&self, _: X::Color) where X : Box { } | help: use fully-qualified syntax to disambiguate | -LL | fn d(&self, _: <X as Box>::Color) where X : Box { } - | ~~~~~~~~~~~~ +LL - fn d(&self, _: X::Color) where X : Box { } +LL + fn d(&self, _: <X as Box>::Color) where X : Box { } + | help: use fully-qualified syntax to disambiguate | -LL | fn d(&self, _: <X as Vehicle>::Color) where X : Box { } - | ~~~~~~~~~~~~~~~~ +LL - fn d(&self, _: X::Color) where X : Box { } +LL + fn d(&self, _: <X as Vehicle>::Color) where X : Box { } + | error: aborting due to 6 previous errors diff --git a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr index a4874903285..063623ebd12 100644 --- a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr +++ b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr @@ -20,12 +20,14 @@ LL | fn dent<C:BoxCar>(c: C, color: C::Color) { | help: use fully-qualified syntax to disambiguate | -LL | fn dent<C:BoxCar>(c: C, color: <C as Vehicle>::Color) { - | ~~~~~~~~~~~~~~~~ +LL - fn dent<C:BoxCar>(c: C, color: C::Color) { +LL + fn dent<C:BoxCar>(c: C, color: <C as Vehicle>::Color) { + | help: use fully-qualified syntax to disambiguate | -LL | fn dent<C:BoxCar>(c: C, color: <C as Box>::Color) { - | ~~~~~~~~~~~~ +LL - fn dent<C:BoxCar>(c: C, color: C::Color) { +LL + fn dent<C:BoxCar>(c: C, color: <C as Box>::Color) { + | error[E0222]: ambiguous associated type `Color` in bounds of `BoxCar` --> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:38 @@ -73,12 +75,14 @@ LL | fn paint<C:BoxCar>(c: C, d: C::Color) { | help: use fully-qualified syntax to disambiguate | -LL | fn paint<C:BoxCar>(c: C, d: <C as Vehicle>::Color) { - | ~~~~~~~~~~~~~~~~ +LL - fn paint<C:BoxCar>(c: C, d: C::Color) { +LL + fn paint<C:BoxCar>(c: C, d: <C as Vehicle>::Color) { + | help: use fully-qualified syntax to disambiguate | -LL | fn paint<C:BoxCar>(c: C, d: <C as Box>::Color) { - | ~~~~~~~~~~~~ +LL - fn paint<C:BoxCar>(c: C, d: C::Color) { +LL + fn paint<C:BoxCar>(c: C, d: <C as Box>::Color) { + | error[E0191]: the value of the associated types `Color` in `Box`, `Color` in `Vehicle` must be specified --> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:33 diff --git a/tests/ui/associated-types/associated-types-eq-1.stderr b/tests/ui/associated-types/associated-types-eq-1.stderr index 14ef3687674..581ad25d88a 100644 --- a/tests/ui/associated-types/associated-types-eq-1.stderr +++ b/tests/ui/associated-types/associated-types-eq-1.stderr @@ -8,8 +8,9 @@ LL | let _: A = x.boo(); | help: a type parameter with a similar name exists | -LL | let _: I = x.boo(); - | ~ +LL - let _: A = x.boo(); +LL + let _: I = x.boo(); + | help: you might be missing a type parameter | LL | fn foo2<I: Foo, A>(x: I) { diff --git a/tests/ui/associated-types/associated-types-eq-2.stderr b/tests/ui/associated-types/associated-types-eq-2.stderr index ccd13123d70..19c34241e5f 100644 --- a/tests/ui/associated-types/associated-types-eq-2.stderr +++ b/tests/ui/associated-types/associated-types-eq-2.stderr @@ -100,8 +100,9 @@ LL | impl Tr2<i32, T2 = Qux, T3 = usize> for Bar { | help: to use `Qux` as a generic argument specify it directly | -LL | impl Tr2<i32, Qux, T3 = usize> for Bar { - | ~~~ +LL - impl Tr2<i32, T2 = Qux, T3 = usize> for Bar { +LL + impl Tr2<i32, Qux, T3 = usize> for Bar { + | error[E0107]: trait takes 3 generic arguments but 1 generic argument was supplied --> $DIR/associated-types-eq-2.rs:47:6 @@ -189,8 +190,9 @@ LL | impl Tr2<i32, Qux, T3 = GenericTerm<i32>> for Bar { | help: to use `GenericTerm<i32>` as a generic argument specify it directly | -LL | impl Tr2<i32, Qux, GenericTerm<i32>> for Bar { - | ~~~~~~~~~~~~~~~~ +LL - impl Tr2<i32, Qux, T3 = GenericTerm<i32>> for Bar { +LL + impl Tr2<i32, Qux, GenericTerm<i32>> for Bar { + | error[E0229]: associated item constraints are not allowed here --> $DIR/associated-types-eq-2.rs:76:10 @@ -203,8 +205,12 @@ LL | | = 42, T2 = Qux, T3 = usize> for Bar { | help: to use `42` as a generic argument specify it directly | -LL | impl Tr3<42, T2 = Qux, T3 = usize> for Bar { - | ~~ +LL - impl Tr3<N +LL - +LL - +LL - = 42, T2 = Qux, T3 = usize> for Bar { +LL + impl Tr3<42, T2 = Qux, T3 = usize> for Bar { + | error[E0107]: trait takes 3 generic arguments but 0 generic arguments were supplied --> $DIR/associated-types-eq-2.rs:84:6 @@ -328,8 +334,9 @@ LL | impl<'a, T> St<'a , T = Qux> { | help: to use `Qux` as a generic argument specify it directly | -LL | impl<'a, T> St<'a , Qux> { - | ~~~ +LL - impl<'a, T> St<'a , T = Qux> { +LL + impl<'a, T> St<'a , Qux> { + | error: aborting due to 25 previous errors diff --git a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr index 88db3611719..d7d2161e7ad 100644 --- a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr +++ b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr @@ -6,8 +6,9 @@ LL | fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {} | help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path | -LL | fn get<T:Get,U:Get>(x: T, y: U) -> <Example as Get>::Value {} - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn get<T:Get,U:Get>(x: T, y: U) -> Get::Value {} +LL + fn get<T:Get,U:Get>(x: T, y: U) -> <Example as Get>::Value {} + | error[E0223]: ambiguous associated type --> $DIR/associated-types-in-ambiguous-context.rs:13:23 @@ -23,8 +24,9 @@ LL | fn get(&self) -> Get::Value; | help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path | -LL | fn get(&self) -> <Example as Get>::Value; - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn get(&self) -> Get::Value; +LL + fn get(&self) -> <Example as Get>::Value; + | error[E0223]: ambiguous associated type --> $DIR/associated-types-in-ambiguous-context.rs:22:17 @@ -40,14 +42,18 @@ LL | type X = std::ops::Deref::Target; | help: use fully-qualified syntax | -LL | type X = <ByteStr as Deref>::Target; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | type X = <ByteString as Deref>::Target; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | type X = <CString as Deref>::Target; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | type X = <IoSlice<'_> as Deref>::Target; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - type X = std::ops::Deref::Target; +LL + type X = <ByteStr as Deref>::Target; + | +LL - type X = std::ops::Deref::Target; +LL + type X = <ByteString as Deref>::Target; + | +LL - type X = std::ops::Deref::Target; +LL + type X = <CString as Deref>::Target; + | +LL - type X = std::ops::Deref::Target; +LL + type X = <IoSlice<'_> as Deref>::Target; + | and N other candidates error: aborting due to 5 previous errors diff --git a/tests/ui/associated-types/associated-types-path-1.stderr b/tests/ui/associated-types/associated-types-path-1.stderr index cab9dcec0b6..aea70e085c1 100644 --- a/tests/ui/associated-types/associated-types-path-1.stderr +++ b/tests/ui/associated-types/associated-types-path-1.stderr @@ -18,12 +18,14 @@ LL | pub fn f2<T: Foo + Bar>(a: T, x: T::A) {} | help: use fully-qualified syntax to disambiguate | -LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Bar>::A) {} - | ~~~~~~~~~~~~ +LL - pub fn f2<T: Foo + Bar>(a: T, x: T::A) {} +LL + pub fn f2<T: Foo + Bar>(a: T, x: <T as Bar>::A) {} + | help: use fully-qualified syntax to disambiguate | -LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Foo>::A) {} - | ~~~~~~~~~~~~ +LL - pub fn f2<T: Foo + Bar>(a: T, x: T::A) {} +LL + pub fn f2<T: Foo + Bar>(a: T, x: <T as Foo>::A) {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/associated-types/associated-types-path-2.stderr b/tests/ui/associated-types/associated-types-path-2.stderr index 5edd5c864e1..897eb75e3e3 100644 --- a/tests/ui/associated-types/associated-types-path-2.stderr +++ b/tests/ui/associated-types/associated-types-path-2.stderr @@ -13,8 +13,9 @@ LL | pub fn f1<T: Foo>(a: T, x: T::A) {} | ^^ ------- help: change the type of the numeric literal from `i32` to `u32` | -LL | f1(2i32, 4u32); - | ~~~ +LL - f1(2i32, 4i32); +LL + f1(2i32, 4u32); + | error[E0277]: the trait bound `u32: Foo` is not satisfied --> $DIR/associated-types-path-2.rs:29:8 diff --git a/tests/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr b/tests/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr index 83bad291e56..b0c904fe62b 100644 --- a/tests/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr +++ b/tests/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr @@ -6,8 +6,9 @@ LL | x: I::A) | help: use a fully qualified path with inferred lifetimes | -LL | x: <I as Foo<&isize>>::A) - | ~~~~~~~~~~~~~~~~~~~~ +LL - x: I::A) +LL + x: <I as Foo<&isize>>::A) + | error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr b/tests/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr index 48433b15286..bd30c25c97b 100644 --- a/tests/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr +++ b/tests/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr @@ -6,8 +6,9 @@ LL | fn some_method(&self, arg: I::A); | help: use a fully qualified path with inferred lifetimes | -LL | fn some_method(&self, arg: <I as Foo<&isize>>::A); - | ~~~~~~~~~~~~~~~~~~~~ +LL - fn some_method(&self, arg: I::A); +LL + fn some_method(&self, arg: <I as Foo<&isize>>::A); + | error[E0212]: cannot use the associated type of a trait with uninferred generic parameters --> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:32:24 @@ -17,8 +18,9 @@ LL | fn mango(&self) -> X::Assoc { | help: use a fully qualified path with inferred lifetimes | -LL | fn mango(&self) -> <X as Banana<'_>>::Assoc { - | ~~~~~~~~~~~~~~~~~~~ +LL - fn mango(&self) -> X::Assoc { +LL + fn mango(&self) -> <X as Banana<'_>>::Assoc { + | error: aborting due to 2 previous errors diff --git a/tests/ui/associated-types/defaults-specialization.stderr b/tests/ui/associated-types/defaults-specialization.stderr index b4ed99f36f4..fd2a1a0c2d1 100644 --- a/tests/ui/associated-types/defaults-specialization.stderr +++ b/tests/ui/associated-types/defaults-specialization.stderr @@ -23,8 +23,9 @@ LL | fn make() -> Self::Ty { found signature `fn() -> u8` help: change the output type to match the trait | -LL | fn make() -> <A<T> as Tr>::Ty { 0 } - | ~~~~~~~~~~~~~~~~ +LL - fn make() -> u8 { 0 } +LL + fn make() -> <A<T> as Tr>::Ty { 0 } + | error[E0053]: method `make` has an incompatible type for trait --> $DIR/defaults-specialization.rs:35:18 @@ -44,8 +45,9 @@ LL | fn make() -> Self::Ty { found signature `fn() -> bool` help: change the output type to match the trait | -LL | fn make() -> <B<T> as Tr>::Ty { true } - | ~~~~~~~~~~~~~~~~ +LL - fn make() -> bool { true } +LL + fn make() -> <B<T> as Tr>::Ty { true } + | error[E0308]: mismatched types --> $DIR/defaults-specialization.rs:10:9 diff --git a/tests/ui/associated-types/defaults-suitability.current.stderr b/tests/ui/associated-types/defaults-suitability.current.stderr index 61247cee1f3..5e19674250f 100644 --- a/tests/ui/associated-types/defaults-suitability.current.stderr +++ b/tests/ui/associated-types/defaults-suitability.current.stderr @@ -135,7 +135,7 @@ LL | type Baz = T; help: consider further restricting type parameter `T` with trait `Clone` | LL | Self::Baz: Clone, T: std::clone::Clone - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error: aborting due to 8 previous errors diff --git a/tests/ui/associated-types/defaults-suitability.next.stderr b/tests/ui/associated-types/defaults-suitability.next.stderr index 61247cee1f3..5e19674250f 100644 --- a/tests/ui/associated-types/defaults-suitability.next.stderr +++ b/tests/ui/associated-types/defaults-suitability.next.stderr @@ -135,7 +135,7 @@ LL | type Baz = T; help: consider further restricting type parameter `T` with trait `Clone` | LL | Self::Baz: Clone, T: std::clone::Clone - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error: aborting due to 8 previous errors diff --git a/tests/ui/associated-types/hr-associated-type-bound-object.rs b/tests/ui/associated-types/hr-associated-type-bound-object.rs index fec253f9289..825e129dbbd 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-object.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-object.rs @@ -9,6 +9,7 @@ fn f<'a, T: X<'a> + ?Sized>(x: &<T as X<'a>>::U) { <<T as X<'_>>::U>::clone(x); //~^ ERROR the trait bound `for<'b> <T as X<'b>>::U: Clone` is not satisfied //~| ERROR the trait bound `for<'b> <T as X<'b>>::U: Clone` is not satisfied + //~| ERROR the trait bound `for<'b> <T as X<'b>>::U: Clone` is not satisfied //~| ERROR the trait bound `<T as X<'_>>::U: Clone` is not satisfied } diff --git a/tests/ui/associated-types/hr-associated-type-bound-object.stderr b/tests/ui/associated-types/hr-associated-type-bound-object.stderr index 322d6e7b947..5144cfe6d3e 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-object.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-object.stderr @@ -51,6 +51,25 @@ error[E0277]: the trait bound `for<'b> <T as X<'b>>::U: Clone` is not satisfied --> $DIR/hr-associated-type-bound-object.rs:9:5 | LL | <<T as X<'_>>::U>::clone(x); + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'b> Clone` is not implemented for `<T as X<'b>>::U` + | +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-object.rs:3:33 + | +LL | trait X<'a> + | - required by a bound in this trait +LL | where +LL | for<'b> <Self as X<'b>>::U: Clone, + | ^^^^^ required by this bound in `X` +help: consider further restricting the associated type + | +LL | fn f<'a, T: X<'a> + ?Sized>(x: &<T as X<'a>>::U) where for<'b> <T as X<'b>>::U: Clone { + | ++++++++++++++++++++++++++++++++++++ + +error[E0277]: the trait bound `for<'b> <T as X<'b>>::U: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-object.rs:9:5 + | +LL | <<T as X<'_>>::U>::clone(x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'b> Clone` is not implemented for `<T as X<'b>>::U` | note: required by a bound in `X` @@ -66,6 +85,6 @@ help: consider further restricting the associated type LL | fn f<'a, T: X<'a> + ?Sized>(x: &<T as X<'a>>::U) where for<'b> <T as X<'b>>::U: Clone { | ++++++++++++++++++++++++++++++++++++ -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-2.rs b/tests/ui/associated-types/hr-associated-type-bound-param-2.rs index b1a6fe87159..673f02c7cd0 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-2.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-param-2.rs @@ -10,6 +10,7 @@ where <T::W>::clone(x); //~^ the trait bound `str: Clone` is not satisfied //~| the trait bound `str: Clone` is not satisfied + //~| the trait bound `str: Clone` is not satisfied } } diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr index 74cc2083d26..8997832ab52 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr @@ -15,7 +15,7 @@ LL | for<'b> <T as Z<'b, u16>>::W: Clone, | ^^^^^ required by this bound in `Z` error[E0277]: the trait bound `str: Clone` is not satisfied - --> $DIR/hr-associated-type-bound-param-2.rs:17:14 + --> $DIR/hr-associated-type-bound-param-2.rs:18:14 | LL | type W = str; | ^^^ the trait `Clone` is not implemented for `str` @@ -67,6 +67,22 @@ error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-2.rs:10:9 | LL | <T::W>::clone(x); + | ^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | + = help: the trait `Clone` is implemented for `String` +note: required by a bound in `Z` + --> $DIR/hr-associated-type-bound-param-2.rs:6:35 + | +LL | trait Z<'a, T: ?Sized> + | - required by a bound in this trait +... +LL | for<'b> <T as Z<'b, u16>>::W: Clone, + | ^^^^^ required by this bound in `Z` + +error[E0277]: the trait bound `str: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-2.rs:10:9 + | +LL | <T::W>::clone(x); | ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` @@ -80,7 +96,7 @@ LL | for<'b> <T as Z<'b, u16>>::W: Clone, | ^^^^^ required by this bound in `Z` error[E0277]: the trait bound `str: Clone` is not satisfied - --> $DIR/hr-associated-type-bound-param-2.rs:22:10 + --> $DIR/hr-associated-type-bound-param-2.rs:23:10 | LL | 1u16.h("abc"); | ^ the trait `Clone` is not implemented for `str` @@ -95,6 +111,6 @@ LL | for<'b> <T as Z<'b, u16>>::W: Clone, LL | fn h(&self, x: &T::W) { | - required by a bound in this associated function -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/impl-wf-cycle-3.stderr b/tests/ui/associated-types/impl-wf-cycle-3.stderr index d3ca06f890b..b97117a9aab 100644 --- a/tests/ui/associated-types/impl-wf-cycle-3.stderr +++ b/tests/ui/associated-types/impl-wf-cycle-3.stderr @@ -19,8 +19,9 @@ LL | T: A<Self::Type>, | ------------- unsatisfied trait bound introduced here help: replace the associated type with the type specified in this `impl` | -LL | T: A<bool>, - | ~~~~ +LL - T: A<Self::Type>, +LL + T: A<bool>, + | error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/invalid-ctor.stderr b/tests/ui/associated-types/invalid-ctor.stderr index b545c95a768..0b3bf316f60 100644 --- a/tests/ui/associated-types/invalid-ctor.stderr +++ b/tests/ui/associated-types/invalid-ctor.stderr @@ -6,8 +6,9 @@ LL | Self::Out(1) | help: to construct a value of type `Constructor`, use the explicit path | -LL | Constructor(1) - | ~~~~~~~~~~~ +LL - Self::Out(1) +LL + Constructor(1) + | error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr index 58f019704e7..dc919299710 100644 --- a/tests/ui/associated-types/issue-38821.stderr +++ b/tests/ui/associated-types/issue-38821.stderr @@ -14,7 +14,7 @@ LL | impl<T: NotNull> IntoNullable for T { help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++++++++++ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:40:1 @@ -38,7 +38,7 @@ LL | impl<T: NotNull> IntoNullable for T { help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++++++++++ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:23:10 diff --git a/tests/ui/associated-types/issue-54108.current.stderr b/tests/ui/associated-types/issue-54108.current.stderr index 8850b4548e3..115a591c68f 100644 --- a/tests/ui/associated-types/issue-54108.current.stderr +++ b/tests/ui/associated-types/issue-54108.current.stderr @@ -13,7 +13,7 @@ LL | type Size: Add<Output = Self::Size>; help: consider further restricting the associated type | LL | T: SubEncoder, <T as SubEncoder>::ActualSize: Add - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/issue-54108.next.stderr b/tests/ui/associated-types/issue-54108.next.stderr index 5e2fa551afe..e6d65d8246a 100644 --- a/tests/ui/associated-types/issue-54108.next.stderr +++ b/tests/ui/associated-types/issue-54108.next.stderr @@ -13,7 +13,7 @@ LL | type Size: Add<Output = Self::Size>; help: consider further restricting the associated type | LL | T: SubEncoder, <T as SubEncoder>::ActualSize: Add - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/issue-59324.stderr b/tests/ui/associated-types/issue-59324.stderr index 2abe337b69a..dc8f9cfe895 100644 --- a/tests/ui/associated-types/issue-59324.stderr +++ b/tests/ui/associated-types/issue-59324.stderr @@ -87,8 +87,9 @@ LL | fn with_factory<H>(factory: dyn ThriftService<()>) {} = help: unsized fn params are gated as an unstable feature help: you can use `impl Trait` as the argument type | -LL | fn with_factory<H>(factory: impl ThriftService<()>) {} - | ~~~~ +LL - fn with_factory<H>(factory: dyn ThriftService<()>) {} +LL + fn with_factory<H>(factory: impl ThriftService<()>) {} + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | fn with_factory<H>(factory: &dyn ThriftService<()>) {} diff --git a/tests/ui/async-await/async-closures/arg-mismatch.stderr b/tests/ui/async-await/async-closures/arg-mismatch.stderr index 5c8e6650293..8c11fa15776 100644 --- a/tests/ui/async-await/async-closures/arg-mismatch.stderr +++ b/tests/ui/async-await/async-closures/arg-mismatch.stderr @@ -13,8 +13,9 @@ LL | let c = async |x| {}; | ^ help: change the type of the numeric literal from `usize` to `i32` | -LL | c(2i32).await; - | ~~~ +LL - c(2usize).await; +LL + c(2i32).await; + | error: aborting due to 1 previous error diff --git a/tests/ui/async-await/async-closures/fn-exception-target-features.rs b/tests/ui/async-await/async-closures/fn-exception-target-features.rs index 82fc776fd2c..66cc4139770 100644 --- a/tests/ui/async-await/async-closures/fn-exception-target-features.rs +++ b/tests/ui/async-await/async-closures/fn-exception-target-features.rs @@ -1,14 +1,13 @@ //@ edition: 2021 //@ only-x86_64 -#![feature(target_feature_11)] -// `target_feature_11` just to test safe functions w/ target features. - -use std::pin::Pin; use std::future::Future; +use std::pin::Pin; #[target_feature(enable = "sse2")] -fn target_feature() -> Pin<Box<dyn Future<Output = ()> + 'static>> { todo!() } +fn target_feature() -> Pin<Box<dyn Future<Output = ()> + 'static>> { + todo!() +} fn test(f: impl AsyncFn()) {} diff --git a/tests/ui/async-await/async-closures/fn-exception-target-features.stderr b/tests/ui/async-await/async-closures/fn-exception-target-features.stderr index 37977b45250..f0846bfdb12 100644 --- a/tests/ui/async-await/async-closures/fn-exception-target-features.stderr +++ b/tests/ui/async-await/async-closures/fn-exception-target-features.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `#[target_features] fn() -> Pin<Box<(dyn Future<Output = ()> + 'static)>> {target_feature}: AsyncFn()` is not satisfied - --> $DIR/fn-exception-target-features.rs:16:10 + --> $DIR/fn-exception-target-features.rs:15:10 | LL | test(target_feature); | ---- ^^^^^^^^^^^^^^ unsatisfied trait bound @@ -8,7 +8,7 @@ LL | test(target_feature); | = help: the trait `AsyncFn()` is not implemented for fn item `#[target_features] fn() -> Pin<Box<(dyn Future<Output = ()> + 'static)>> {target_feature}` note: required by a bound in `test` - --> $DIR/fn-exception-target-features.rs:13:17 + --> $DIR/fn-exception-target-features.rs:12:17 | LL | fn test(f: impl AsyncFn()) {} | ^^^^^^^^^ required by this bound in `test` diff --git a/tests/ui/async-await/async-closures/is-not-fn.current.stderr b/tests/ui/async-await/async-closures/is-not-fn.current.stderr index e7be1d5b10e..0fab1c15f27 100644 --- a/tests/ui/async-await/async-closures/is-not-fn.current.stderr +++ b/tests/ui/async-await/async-closures/is-not-fn.current.stderr @@ -1,4 +1,4 @@ -error[E0271]: expected `{async closure@is-not-fn.rs:8:14}` to be a closure that returns `()`, but it returns `{async closure body@$DIR/is-not-fn.rs:8:23: 8:25}` +error[E0271]: expected `{async closure@is-not-fn.rs:8:14}` to return `()`, but it returns `{async closure body@$DIR/is-not-fn.rs:8:23: 8:25}` --> $DIR/is-not-fn.rs:8:14 | LL | needs_fn(async || {}); diff --git a/tests/ui/async-await/async-closures/is-not-fn.next.stderr b/tests/ui/async-await/async-closures/is-not-fn.next.stderr index e7be1d5b10e..0fab1c15f27 100644 --- a/tests/ui/async-await/async-closures/is-not-fn.next.stderr +++ b/tests/ui/async-await/async-closures/is-not-fn.next.stderr @@ -1,4 +1,4 @@ -error[E0271]: expected `{async closure@is-not-fn.rs:8:14}` to be a closure that returns `()`, but it returns `{async closure body@$DIR/is-not-fn.rs:8:23: 8:25}` +error[E0271]: expected `{async closure@is-not-fn.rs:8:14}` to return `()`, but it returns `{async closure body@$DIR/is-not-fn.rs:8:23: 8:25}` --> $DIR/is-not-fn.rs:8:14 | LL | needs_fn(async || {}); diff --git a/tests/ui/async-await/async-closures/is-not-fn.rs b/tests/ui/async-await/async-closures/is-not-fn.rs index eacd07b7cdd..e5ab4742dab 100644 --- a/tests/ui/async-await/async-closures/is-not-fn.rs +++ b/tests/ui/async-await/async-closures/is-not-fn.rs @@ -6,5 +6,5 @@ fn main() { fn needs_fn(x: impl FnOnce()) {} needs_fn(async || {}); - //~^ ERROR expected `{async closure@is-not-fn.rs:8:14}` to be a closure that returns `()` + //~^ ERROR expected `{async closure@is-not-fn.rs:8:14}` to return `()` } diff --git a/tests/ui/async-await/async-fn/dyn-pos.stderr b/tests/ui/async-await/async-fn/dyn-pos.stderr index f9d2a669477..7d5b37bdbe7 100644 --- a/tests/ui/async-await/async-fn/dyn-pos.stderr +++ b/tests/ui/async-await/async-fn/dyn-pos.stderr @@ -5,7 +5,7 @@ LL | fn foo(x: &dyn AsyncFn()) {} | ^^^^^^^^^ `AsyncFnMut` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $SRC_DIR/core/src/ops/async_function.rs:LL:COL | = note: the trait is not dyn compatible because it contains the generic associated type `CallRefFuture` diff --git a/tests/ui/async-await/dont-ice-for-type-mismatch-in-closure-in-async.stderr b/tests/ui/async-await/dont-ice-for-type-mismatch-in-closure-in-async.stderr index b60f6a08338..ce023397db9 100644 --- a/tests/ui/async-await/dont-ice-for-type-mismatch-in-closure-in-async.stderr +++ b/tests/ui/async-await/dont-ice-for-type-mismatch-in-closure-in-async.stderr @@ -20,19 +20,15 @@ LL | true = note: expected enum `Option<()>` found type `bool` -error[E0271]: expected `{closure@dont-ice-for-type-mismatch-in-closure-in-async.rs:6:10}` to be a closure that returns `bool`, but it returns `Option<()>` - --> $DIR/dont-ice-for-type-mismatch-in-closure-in-async.rs:6:10 +error[E0271]: expected `{closure@dont-ice-for-type-mismatch-in-closure-in-async.rs:6:10}` to return `bool`, but it returns `Option<()>` + --> $DIR/dont-ice-for-type-mismatch-in-closure-in-async.rs:6:16 | -LL | call(|| -> Option<()> { - | _____----_^ - | | | - | | required by a bound introduced by this call -LL | | -LL | | if true { -LL | | false -... | -LL | | }) - | |_____^ expected `bool`, found `Option<()>` +LL | call(|| -> Option<()> { + | ---- ------^^^^^^^^^^ + | | | | + | | | expected `bool`, found `Option<()>` + | | this closure + | required by a bound introduced by this call | = note: expected type `bool` found enum `Option<()>` diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr index 36f90c7bcd5..b7f2879727f 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr +++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr @@ -17,8 +17,9 @@ LL | #[warn(refining_impl_trait)] = note: `#[warn(refining_impl_trait_reachable)]` implied by `#[warn(refining_impl_trait)]` help: replace the return type so that it matches the trait | -LL | fn foo(&self) -> impl Future<Output = i32> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn foo(&self) -> Pin<Box<dyn Future<Output = i32> + '_>> { +LL + fn foo(&self) -> impl Future<Output = i32> { + | warning: 1 warning emitted diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr index 8e39559071f..86546df88c1 100644 --- a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr +++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr @@ -17,8 +17,9 @@ LL | #[warn(refining_impl_trait)] = note: `#[warn(refining_impl_trait_reachable)]` implied by `#[warn(refining_impl_trait)]` help: replace the return type so that it matches the trait | -LL | fn foo(&self) -> impl Future<Output = i32> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn foo(&self) -> MyFuture { +LL + fn foo(&self) -> impl Future<Output = i32> { + | warning: 1 warning emitted diff --git a/tests/ui/async-await/in-trait/dyn-compatibility.stderr b/tests/ui/async-await/in-trait/dyn-compatibility.stderr index c6c406902f6..553bcbf89d5 100644 --- a/tests/ui/async-await/in-trait/dyn-compatibility.stderr +++ b/tests/ui/async-await/in-trait/dyn-compatibility.stderr @@ -5,7 +5,7 @@ LL | let x: &dyn Foo = todo!(); | ^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-compatibility.rs:5:14 | LL | trait Foo { diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs index aa8667a00ca..b25d8a34aca 100644 --- a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs +++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs @@ -1,8 +1,5 @@ //@ edition: 2021 -// Test doesn't fail until monomorphization time, unfortunately. -//@ build-fail - fn main() { let _ = async { A.first().await.second().await; diff --git a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr index 8126c6e1394..4ca6ef89819 100644 --- a/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr +++ b/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.stderr @@ -1,5 +1,5 @@ error[E0733]: recursion in an async fn requires boxing - --> $DIR/indirect-recursion-issue-112047.rs:34:5 + --> $DIR/indirect-recursion-issue-112047.rs:31:5 | LL | async fn second(self) { | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/async-await/incorrect-move-async-order-issue-79694.stderr b/tests/ui/async-await/incorrect-move-async-order-issue-79694.stderr index 782fa4295fd..2a3d46cc97f 100644 --- a/tests/ui/async-await/incorrect-move-async-order-issue-79694.stderr +++ b/tests/ui/async-await/incorrect-move-async-order-issue-79694.stderr @@ -6,8 +6,9 @@ LL | let _ = move async { }; | help: try switching the order | -LL | let _ = async move { }; - | ~~~~~~~~~~ +LL - let _ = move async { }; +LL + let _ = async move { }; + | error: aborting due to 1 previous error diff --git a/tests/ui/async-await/inference_var_self_argument.stderr b/tests/ui/async-await/inference_var_self_argument.stderr index a674fc0f3a5..1fccc32470f 100644 --- a/tests/ui/async-await/inference_var_self_argument.stderr +++ b/tests/ui/async-await/inference_var_self_argument.stderr @@ -14,7 +14,7 @@ LL | async fn foo(self: &dyn Foo) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/inference_var_self_argument.rs:5:14 | LL | trait Foo { diff --git a/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2015.stderr b/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2015.stderr index d4266814a7c..2bdc1347c81 100644 --- a/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2015.stderr +++ b/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2015.stderr @@ -16,12 +16,14 @@ LL | fn r#struct(&self) { | ^^^^^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | async::r#struct(&r#fn {}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - r#fn {}.r#struct(); +LL + async::r#struct(&r#fn {}); + | help: disambiguate the method for candidate #2 | -LL | await::r#struct(&r#fn {}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - r#fn {}.r#struct(); +LL + await::r#struct(&r#fn {}); + | error: aborting due to 1 previous error diff --git a/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2018.stderr b/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2018.stderr index fe104bfe445..ab10ab749fe 100644 --- a/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2018.stderr +++ b/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2018.stderr @@ -16,12 +16,14 @@ LL | fn r#struct(&self) { | ^^^^^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | r#async::r#struct(&r#fn {}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - r#fn {}.r#struct(); +LL + r#async::r#struct(&r#fn {}); + | help: disambiguate the method for candidate #2 | -LL | r#await::r#struct(&r#fn {}); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - r#fn {}.r#struct(); +LL + r#await::r#struct(&r#fn {}); + | error: aborting due to 1 previous error diff --git a/tests/ui/async-await/issue-98634.rs b/tests/ui/async-await/issue-98634.rs index 02e869f4325..3bfc2bf8a7c 100644 --- a/tests/ui/async-await/issue-98634.rs +++ b/tests/ui/async-await/issue-98634.rs @@ -43,8 +43,8 @@ impl Runtime { fn main() { Runtime.block_on(async { StructAsync { callback }.await; - //~^ ERROR expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` - //~| ERROR expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` - //~| ERROR expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` + //~^ ERROR expected `callback` to return `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` + //~| ERROR expected `callback` to return `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` + //~| ERROR expected `callback` to return `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` }); } diff --git a/tests/ui/async-await/issue-98634.stderr b/tests/ui/async-await/issue-98634.stderr index 574904ceafa..e0739ae3a9b 100644 --- a/tests/ui/async-await/issue-98634.stderr +++ b/tests/ui/async-await/issue-98634.stderr @@ -1,4 +1,4 @@ -error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` +error[E0271]: expected `callback` to return `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` --> $DIR/issue-98634.rs:45:23 | LL | StructAsync { callback }.await; @@ -10,7 +10,7 @@ note: required by a bound in `StructAsync` LL | pub struct StructAsync<F: Fn() -> Pin<Box<dyn Future<Output = ()>>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync` -error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` +error[E0271]: expected `callback` to return `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` --> $DIR/issue-98634.rs:45:9 | LL | StructAsync { callback }.await; @@ -22,7 +22,7 @@ note: required by a bound in `StructAsync` LL | pub struct StructAsync<F: Fn() -> Pin<Box<dyn Future<Output = ()>>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync` -error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` +error[E0271]: expected `callback` to return `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` --> $DIR/issue-98634.rs:45:34 | LL | StructAsync { callback }.await; diff --git a/tests/ui/async-await/pin-ergonomics/sugar-no-const.stderr b/tests/ui/async-await/pin-ergonomics/sugar-no-const.stderr index 822cfffcb8c..062b6d3f487 100644 --- a/tests/ui/async-await/pin-ergonomics/sugar-no-const.stderr +++ b/tests/ui/async-await/pin-ergonomics/sugar-no-const.stderr @@ -8,8 +8,9 @@ LL | let _x: &pin i32 = todo!(); | help: there is a keyword `in` with a similar name | -LL | let _x: &in i32 = todo!(); - | ~~ +LL - let _x: &pin i32 = todo!(); +LL + let _x: &in i32 = todo!(); + | error: aborting due to 1 previous error diff --git a/tests/ui/async-await/suggest-switching-edition-on-await-cargo.stderr b/tests/ui/async-await/suggest-switching-edition-on-await-cargo.stderr index c8bbb3a243c..11f5825c232 100644 --- a/tests/ui/async-await/suggest-switching-edition-on-await-cargo.stderr +++ b/tests/ui/async-await/suggest-switching-edition-on-await-cargo.stderr @@ -19,8 +19,9 @@ LL | x.await; = note: for more on editions, read https://doc.rust-lang.org/edition-guide help: a field with a similar name exists | -LL | x.awai; - | ~~~~ +LL - x.await; +LL + x.awai; + | error[E0609]: no field `await` on type `Pin<&mut dyn Future<Output = ()>>` --> $DIR/suggest-switching-edition-on-await-cargo.rs:34:7 diff --git a/tests/ui/async-await/suggest-switching-edition-on-await.stderr b/tests/ui/async-await/suggest-switching-edition-on-await.stderr index ef5a5f81269..2ede8d5b7f4 100644 --- a/tests/ui/async-await/suggest-switching-edition-on-await.stderr +++ b/tests/ui/async-await/suggest-switching-edition-on-await.stderr @@ -19,8 +19,9 @@ LL | x.await; = note: for more on editions, read https://doc.rust-lang.org/edition-guide help: a field with a similar name exists | -LL | x.awai; - | ~~~~ +LL - x.await; +LL + x.awai; + | error[E0609]: no field `await` on type `Pin<&mut dyn Future<Output = ()>>` --> $DIR/suggest-switching-edition-on-await.rs:32:7 diff --git a/tests/ui/async-await/unconstrained-lifetimes.rs b/tests/ui/async-await/unconstrained-lifetimes.rs new file mode 100644 index 00000000000..50ab7bae73d --- /dev/null +++ b/tests/ui/async-await/unconstrained-lifetimes.rs @@ -0,0 +1,9 @@ +//@ edition: 2021 + +// Make sure we don't complain about the implicit `-> impl Future` capturing an +// unconstrained anonymous lifetime. + +async fn foo(_: Missing<'_>) {} +//~^ ERROR cannot find type `Missing` in this scope + +fn main() {} diff --git a/tests/ui/async-await/unconstrained-lifetimes.stderr b/tests/ui/async-await/unconstrained-lifetimes.stderr new file mode 100644 index 00000000000..18a46a3b555 --- /dev/null +++ b/tests/ui/async-await/unconstrained-lifetimes.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `Missing` in this scope + --> $DIR/unconstrained-lifetimes.rs:6:17 + | +LL | async fn foo(_: Missing<'_>) {} + | ^^^^^^^ not found in this scope + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/attributes/crate-name-macro-call.rs b/tests/ui/attributes/crate-name-macro-call.rs new file mode 100644 index 00000000000..1aae2e506e2 --- /dev/null +++ b/tests/ui/attributes/crate-name-macro-call.rs @@ -0,0 +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 + +fn main() {} diff --git a/tests/ui/attributes/crate-name-macro-call.stderr b/tests/ui/attributes/crate-name-macro-call.stderr new file mode 100644 index 00000000000..ab562b41a31 --- /dev/null +++ b/tests/ui/attributes/crate-name-macro-call.stderr @@ -0,0 +1,8 @@ +error: malformed `crate_name` attribute input + --> $DIR/crate-name-macro-call.rs:4:1 + | +LL | #![crate_name = concat!("my", "crate")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` + +error: aborting due to 1 previous error + diff --git a/tests/ui/invalid_crate_type_syntax.rs b/tests/ui/attributes/crate-type-delimited.rs index 621587af35e..621587af35e 100644 --- a/tests/ui/invalid_crate_type_syntax.rs +++ b/tests/ui/attributes/crate-type-delimited.rs diff --git a/tests/ui/invalid_crate_type_syntax.stderr b/tests/ui/attributes/crate-type-delimited.stderr index a5563720f62..0bbbe07b198 100644 --- a/tests/ui/invalid_crate_type_syntax.stderr +++ b/tests/ui/attributes/crate-type-delimited.stderr @@ -1,5 +1,5 @@ error: malformed `crate_type` attribute input - --> $DIR/invalid_crate_type_syntax.rs:2:1 + --> $DIR/crate-type-delimited.rs:2:1 | LL | #![crate_type(lib)] | ^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_type = "bin|lib|..."]` diff --git a/tests/ui/no_crate_type.rs b/tests/ui/attributes/crate-type-empty.rs index d8e687e04a7..d8e687e04a7 100644 --- a/tests/ui/no_crate_type.rs +++ b/tests/ui/attributes/crate-type-empty.rs diff --git a/tests/ui/no_crate_type.stderr b/tests/ui/attributes/crate-type-empty.stderr index 85d8f87afa6..b9279d961ee 100644 --- a/tests/ui/no_crate_type.stderr +++ b/tests/ui/attributes/crate-type-empty.stderr @@ -1,5 +1,5 @@ error: malformed `crate_type` attribute input - --> $DIR/no_crate_type.rs:2:1 + --> $DIR/crate-type-empty.rs:2:1 | LL | #![crate_type] | ^^^^^^^^^^^^^^ help: must be of the form: `#![crate_type = "bin|lib|..."]` diff --git a/tests/ui/invalid/invalid-crate-type-macro.rs b/tests/ui/attributes/crate-type-macro-call.rs index 9ba5e79ba94..9ba5e79ba94 100644 --- a/tests/ui/invalid/invalid-crate-type-macro.rs +++ b/tests/ui/attributes/crate-type-macro-call.rs diff --git a/tests/ui/invalid/invalid-crate-type-macro.stderr b/tests/ui/attributes/crate-type-macro-call.stderr index 1cf77d4086b..6ccc3edf885 100644 --- a/tests/ui/invalid/invalid-crate-type-macro.stderr +++ b/tests/ui/attributes/crate-type-macro-call.stderr @@ -1,5 +1,5 @@ error: malformed `crate_type` attribute input - --> $DIR/invalid-crate-type-macro.rs:1:1 + --> $DIR/crate-type-macro-call.rs:1:1 | LL | #![crate_type = foo!()] | ^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_type = "bin|lib|..."]` diff --git a/tests/ui/attributes/key-value-non-ascii.stderr b/tests/ui/attributes/key-value-non-ascii.stderr index cc01bc46ebd..fa87ad5ee6d 100644 --- a/tests/ui/attributes/key-value-non-ascii.stderr +++ b/tests/ui/attributes/key-value-non-ascii.stderr @@ -6,8 +6,9 @@ LL | #[rustc_dummy = b"ffi.rs"] | help: if you meant to use the UTF-8 encoding of 'ffi', use \xHH escapes | -LL | #[rustc_dummy = b"/xEF/xAC/x83.rs"] - | ~~~~~~~~~~~~ +LL - #[rustc_dummy = b"ffi.rs"] +LL + #[rustc_dummy = b"/xEF/xAC/x83.rs"] + | error: aborting due to 1 previous error diff --git a/tests/ui/attributes/rustc_confusables.stderr b/tests/ui/attributes/rustc_confusables.stderr index 9e37d5f5083..dc71d974daf 100644 --- a/tests/ui/attributes/rustc_confusables.stderr +++ b/tests/ui/attributes/rustc_confusables.stderr @@ -36,7 +36,7 @@ LL | x.inser(); help: there is a method `insert` with a similar name | LL | x.insert(); - | ~~~~~~ + | + error[E0599]: no method named `foo` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope --> $DIR/rustc_confusables.rs:15:7 @@ -52,8 +52,9 @@ LL | x.push(); | help: you might have meant to use `insert` | -LL | x.insert(); - | ~~~~~~ +LL - x.push(); +LL + x.insert(); + | error[E0599]: no method named `test` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope --> $DIR/rustc_confusables.rs:20:7 @@ -69,8 +70,9 @@ LL | x.pulled(); | help: you might have meant to use `pull` | -LL | x.pull(); - | ~~~~ +LL - x.pulled(); +LL + x.pull(); + | error: aborting due to 9 previous errors diff --git a/tests/ui/attributes/rustc_confusables_std_cases.stderr b/tests/ui/attributes/rustc_confusables_std_cases.stderr index 7bf96241ca7..f2d9ebe2c0e 100644 --- a/tests/ui/attributes/rustc_confusables_std_cases.stderr +++ b/tests/ui/attributes/rustc_confusables_std_cases.stderr @@ -6,8 +6,9 @@ LL | x.push(1); | help: you might have meant to use `insert` | -LL | x.insert(1); - | ~~~~~~ +LL - x.push(1); +LL + x.insert(1); + | error[E0599]: no method named `push_back` found for struct `Vec<_>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:9:7 @@ -17,8 +18,9 @@ LL | x.push_back(1); | help: you might have meant to use `push` | -LL | x.push(1); - | ~~~~ +LL - x.push_back(1); +LL + x.push(1); + | error[E0599]: no method named `push` found for struct `VecDeque` in the current scope --> $DIR/rustc_confusables_std_cases.rs:12:7 @@ -37,7 +39,7 @@ LL | let mut x = VecDeque::new(); help: you might have meant to use `push_back` | LL | x.push_back(1); - | ~~~~~~~~~ + | +++++ error[E0599]: no method named `length` found for struct `Vec<{integer}>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:15:7 @@ -47,8 +49,9 @@ LL | x.length(); | help: you might have meant to use `len` | -LL | x.len(); - | ~~~ +LL - x.length(); +LL + x.len(); + | error[E0599]: no method named `size` found for struct `Vec<{integer}>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:17:7 @@ -60,8 +63,9 @@ help: there is a method `resize` with a similar name, but with different argumen --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: you might have meant to use `len` | -LL | x.len(); - | ~~~ +LL - x.size(); +LL + x.len(); + | error[E0308]: mismatched types --> $DIR/rustc_confusables_std_cases.rs:20:14 @@ -77,8 +81,9 @@ note: method defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: you might have meant to use `push` | -LL | x.push(42); - | ~~~~ +LL - x.append(42); +LL + x.push(42); + | error[E0308]: mismatched types --> $DIR/rustc_confusables_std_cases.rs:22:24 @@ -93,7 +98,7 @@ note: method defined here help: you might have meant to use `push_str` | LL | String::new().push_str(""); - | ~~~~~~~~ + | ++++ error[E0599]: no method named `append` found for struct `String` in the current scope --> $DIR/rustc_confusables_std_cases.rs:24:19 @@ -103,8 +108,9 @@ LL | String::new().append(""); | help: you might have meant to use `push_str` | -LL | String::new().push_str(""); - | ~~~~~~~~ +LL - String::new().append(""); +LL + String::new().push_str(""); + | error[E0599]: no method named `get_line` found for struct `Stdin` in the current scope --> $DIR/rustc_confusables_std_cases.rs:28:11 @@ -114,8 +120,9 @@ LL | stdin.get_line(&mut buffer).unwrap(); | help: you might have meant to use `read_line` | -LL | stdin.read_line(&mut buffer).unwrap(); - | ~~~~~~~~~ +LL - stdin.get_line(&mut buffer).unwrap(); +LL + stdin.read_line(&mut buffer).unwrap(); + | error: aborting due to 9 previous errors diff --git a/tests/ui/auto-traits/assoc-ty.next.stderr b/tests/ui/auto-traits/assoc-ty.next.stderr index b9f56d6c99c..4ce00d17475 100644 --- a/tests/ui/auto-traits/assoc-ty.next.stderr +++ b/tests/ui/auto-traits/assoc-ty.next.stderr @@ -21,20 +21,21 @@ LL | | } = help: add `#![feature(auto_traits)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0308]: mismatched types - --> $DIR/assoc-ty.rs:15:36 +error[E0271]: type mismatch resolving `<() as Trait>::Output normalizes-to _` + --> $DIR/assoc-ty.rs:15:12 | LL | let _: <() as Trait>::Output = (); - | --------------------- ^^ types differ - | | - | expected due to this + | ^^^^^^^^^^^^^^^^^^^^^ types differ + +error[E0271]: type mismatch resolving `<() as Trait>::Output normalizes-to _` + --> $DIR/assoc-ty.rs:15:12 + | +LL | let _: <() as Trait>::Output = (); + | ^^^^^^^^^^^^^^^^^^^^^ types differ | - = note: expected associated type `<() as Trait>::Output` - found unit type `()` - = help: consider constraining the associated type `<() as Trait>::Output` to `()` or calling a method that returns `<() as Trait>::Output` - = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0308, E0380, E0658. -For more information about an error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0271, E0380, E0658. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/auto-traits/assoc-ty.rs b/tests/ui/auto-traits/assoc-ty.rs index ada75147f6e..efbfead9cd0 100644 --- a/tests/ui/auto-traits/assoc-ty.rs +++ b/tests/ui/auto-traits/assoc-ty.rs @@ -13,5 +13,7 @@ auto trait Trait { fn main() { let _: <() as Trait>::Output = (); - //~^ ERROR mismatched types + //[current]~^ ERROR mismatched types + //[next]~^^ ERROR type mismatch resolving `<() as Trait>::Output normalizes-to _` + //[next]~| ERROR type mismatch resolving `<() as Trait>::Output normalizes-to _` } diff --git a/tests/ui/binding/expr-match-generic.rs b/tests/ui/binding/expr-match-generic.rs index 975eec42fd0..dcc069b9fb3 100644 --- a/tests/ui/binding/expr-match-generic.rs +++ b/tests/ui/binding/expr-match-generic.rs @@ -5,7 +5,7 @@ type compare<T> = extern "Rust" fn(T, T) -> bool; fn test_generic<T:Clone>(expected: T, eq: compare<T>) { let actual: T = match true { true => { expected.clone() }, _ => panic!("wat") }; - assert!((eq(expected, actual))); + assert!(eq(expected, actual)); } fn test_bool() { diff --git a/tests/ui/binding/expr-match.rs b/tests/ui/binding/expr-match.rs index 049beaaf51b..ce502ae1490 100644 --- a/tests/ui/binding/expr-match.rs +++ b/tests/ui/binding/expr-match.rs @@ -1,20 +1,17 @@ //@ run-pass - - - // Tests for using match as an expression fn test_basic() { let mut rs: bool = match true { true => { true } false => { false } }; - assert!((rs)); + assert!(rs); rs = match false { true => { false } false => { true } }; - assert!((rs)); + assert!(rs); } fn test_inferrence() { let rs = match true { true => { true } false => { false } }; - assert!((rs)); + assert!(rs); } fn test_alt_as_alt_head() { @@ -25,7 +22,7 @@ fn test_alt_as_alt_head() { true => { false } false => { true } }; - assert!((rs)); + assert!(rs); } fn test_alt_as_block_result() { @@ -34,7 +31,7 @@ fn test_alt_as_block_result() { true => { false } false => { match true { true => { true } false => { false } } } }; - assert!((rs)); + assert!(rs); } pub fn main() { diff --git a/tests/ui/binop/binops.rs b/tests/ui/binop/binops.rs index 0adbb49b14a..7142190a45b 100644 --- a/tests/ui/binop/binops.rs +++ b/tests/ui/binop/binops.rs @@ -5,23 +5,23 @@ fn test_nil() { assert_eq!((), ()); - assert!((!(() != ()))); - assert!((!(() < ()))); - assert!((() <= ())); - assert!((!(() > ()))); - assert!((() >= ())); + assert!(!(() != ())); + assert!(!(() < ())); + assert!(() <= ()); + assert!(!(() > ())); + assert!(() >= ()); } fn test_bool() { - assert!((!(true < false))); - assert!((!(true <= false))); - assert!((true > false)); - assert!((true >= false)); + assert!(!(true < false)); + assert!(!(true <= false)); + assert!(true > false); + assert!(true >= false); - assert!((false < true)); - assert!((false <= true)); - assert!((!(false > true))); - assert!((!(false >= true))); + assert!(false < true); + assert!(false <= true); + assert!(!(false > true)); + assert!(!(false >= true)); // Bools support bitwise binops assert_eq!(false & false, false); @@ -76,9 +76,9 @@ fn test_class() { } assert_eq!(q, r); r.y = 17; - assert!((r.y != q.y)); + assert!(r.y != q.y); assert_eq!(r.y, 17); - assert!((q != r)); + assert!(q != r); } pub fn main() { diff --git a/tests/ui/binop/placement-syntax.stderr b/tests/ui/binop/placement-syntax.stderr index b20a2ee6353..e398c0b0702 100644 --- a/tests/ui/binop/placement-syntax.stderr +++ b/tests/ui/binop/placement-syntax.stderr @@ -6,8 +6,9 @@ LL | if x<-1 { | help: if you meant to write a comparison against a negative value, add a space in between `<` and `-` | -LL | if x< -1 { - | ~~~ +LL - if x<-1 { +LL + if x< -1 { + | error: aborting due to 1 previous error diff --git a/tests/ui/binop/structured-compare.rs b/tests/ui/binop/structured-compare.rs index 164760cd7a0..7d1eff45302 100644 --- a/tests/ui/binop/structured-compare.rs +++ b/tests/ui/binop/structured-compare.rs @@ -17,14 +17,14 @@ pub fn main() { let a = (1, 2, 3); let b = (1, 2, 3); assert_eq!(a, b); - assert!((a != (1, 2, 4))); - assert!((a < (1, 2, 4))); - assert!((a <= (1, 2, 4))); - assert!(((1, 2, 4) > a)); - assert!(((1, 2, 4) >= a)); + assert!(a != (1, 2, 4)); + assert!(a < (1, 2, 4)); + assert!(a <= (1, 2, 4)); + assert!((1, 2, 4) > a); + assert!((1, 2, 4) >= a); let x = foo::large; let y = foo::small; - assert!((x != y)); + assert!(x != y); assert_eq!(x, foo::large); - assert!((x != foo::small)); + assert!(x != foo::small); } diff --git a/tests/ui/block-result/issue-3563.stderr b/tests/ui/block-result/issue-3563.stderr index 22606a52f85..e03453f3946 100644 --- a/tests/ui/block-result/issue-3563.stderr +++ b/tests/ui/block-result/issue-3563.stderr @@ -6,8 +6,9 @@ LL | || self.b() | help: there is a method `a` with a similar name | -LL | || self.a() - | ~ +LL - || self.b() +LL + || self.a() + | error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/alias-liveness/name-region.rs b/tests/ui/borrowck/alias-liveness/name-region.rs new file mode 100644 index 00000000000..9545a9eed2f --- /dev/null +++ b/tests/ui/borrowck/alias-liveness/name-region.rs @@ -0,0 +1,13 @@ +// Make sure we don't ICE when trying to name the regions that appear in the alias +// of the type test error. + +trait AnotherTrait { + type Ty2<'a>; +} + +fn test_alias<T: AnotherTrait>(_: &'static T::Ty2<'_>) { + let _: &'static T::Ty2<'_>; + //~^ ERROR the associated type `<T as AnotherTrait>::Ty2<'_>` may not live long enough +} + +fn main() {} diff --git a/tests/ui/borrowck/alias-liveness/name-region.stderr b/tests/ui/borrowck/alias-liveness/name-region.stderr new file mode 100644 index 00000000000..9a5dd711c68 --- /dev/null +++ b/tests/ui/borrowck/alias-liveness/name-region.stderr @@ -0,0 +1,14 @@ +error[E0310]: the associated type `<T as AnotherTrait>::Ty2<'_>` may not live long enough + --> $DIR/name-region.rs:9:12 + | +LL | let _: &'static T::Ty2<'_>; + | ^^^^^^^^^^^^^^^^^^^ + | | + | the associated type `<T as AnotherTrait>::Ty2<'_>` must be valid for the static lifetime... + | ...so that the type `<T as AnotherTrait>::Ty2<'_>` will meet its required lifetime bounds + | + = help: consider adding an explicit lifetime bound `<T as AnotherTrait>::Ty2<'_>: 'static`... + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0310`. diff --git a/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.rs b/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.rs new file mode 100644 index 00000000000..934aac8383d --- /dev/null +++ b/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.rs @@ -0,0 +1,46 @@ +// https://github.com/rust-lang/rust/issues/133941 +use std::marker::PhantomData; + +struct Bar<'a>(PhantomData<&'a mut i32>); + +impl<'a> Drop for Bar<'a> { + fn drop(&mut self) {} +} + +struct Foo(); + +impl Foo { + fn f(&mut self) -> Option<Bar<'_>> { + None + } + + fn g(&mut self) {} +} + +fn main() { + let mut foo = Foo(); + while let Some(_) = foo.f() { + //~^ HELP matches! + foo.g(); + //~^ ERROR [E0499] + } + if let Some(_) = foo.f() { + //~^ HELP matches! + foo.g(); + //~^ ERROR [E0499] + } + while let Some(_x) = foo.f() { + foo.g(); + //~^ ERROR [E0499] + } + if let Some(_x) = foo.f() { + foo.g(); + //~^ ERROR [E0499] + } + while let Some(_x) = {let _x = foo.f(); foo.g(); None::<()>} { + //~^ ERROR [E0499] + } + if let Some(_x) = {let _x = foo.f(); foo.g(); None::<()>} { + //~^ ERROR [E0499] + } +} diff --git a/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.stderr b/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.stderr new file mode 100644 index 00000000000..2f443797dfa --- /dev/null +++ b/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.stderr @@ -0,0 +1,91 @@ +error[E0499]: cannot borrow `foo` as mutable more than once at a time + --> $DIR/already-borrowed-as-mutable-if-let-133941.rs:24:9 + | +LL | while let Some(_) = foo.f() { + | ------- + | | + | first mutable borrow occurs here + | a temporary with access to the first borrow is created here ... +LL | +LL | foo.g(); + | ^^^ second mutable borrow occurs here +LL | +LL | } + | - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option<Bar<'_>>` + | +help: consider using the `matches!` macro + | +LL - while let Some(_) = foo.f() { +LL + while matches!(foo.f(), Some(_)) { + | + +error[E0499]: cannot borrow `foo` as mutable more than once at a time + --> $DIR/already-borrowed-as-mutable-if-let-133941.rs:29:9 + | +LL | if let Some(_) = foo.f() { + | ------- + | | + | first mutable borrow occurs here + | a temporary with access to the first borrow is created here ... +LL | +LL | foo.g(); + | ^^^ second mutable borrow occurs here +LL | +LL | } + | - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option<Bar<'_>>` + | +help: consider using the `matches!` macro + | +LL - if let Some(_) = foo.f() { +LL + if matches!(foo.f(), Some(_)) { + | + +error[E0499]: cannot borrow `foo` as mutable more than once at a time + --> $DIR/already-borrowed-as-mutable-if-let-133941.rs:33:9 + | +LL | while let Some(_x) = foo.f() { + | ------- + | | + | first mutable borrow occurs here + | a temporary with access to the first borrow is created here ... +LL | foo.g(); + | ^^^ second mutable borrow occurs here +LL | +LL | } + | - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option<Bar<'_>>` + +error[E0499]: cannot borrow `foo` as mutable more than once at a time + --> $DIR/already-borrowed-as-mutable-if-let-133941.rs:37:9 + | +LL | if let Some(_x) = foo.f() { + | ------- + | | + | first mutable borrow occurs here + | a temporary with access to the first borrow is created here ... +LL | foo.g(); + | ^^^ second mutable borrow occurs here +LL | +LL | } + | - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option<Bar<'_>>` + +error[E0499]: cannot borrow `foo` as mutable more than once at a time + --> $DIR/already-borrowed-as-mutable-if-let-133941.rs:40:45 + | +LL | while let Some(_x) = {let _x = foo.f(); foo.g(); None::<()>} { + | --- ^^^ - first borrow might be used here, when `_x` is dropped and runs the destructor for type `Option<Bar<'_>>` + | | | + | | second mutable borrow occurs here + | first mutable borrow occurs here + +error[E0499]: cannot borrow `foo` as mutable more than once at a time + --> $DIR/already-borrowed-as-mutable-if-let-133941.rs:43:42 + | +LL | if let Some(_x) = {let _x = foo.f(); foo.g(); None::<()>} { + | --- ^^^ - first borrow might be used here, when `_x` is dropped and runs the destructor for type `Option<Bar<'_>>` + | | | + | | second mutable borrow occurs here + | first mutable borrow occurs here + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/borrowck/borrowck-struct-update-with-dtor.stderr b/tests/ui/borrowck/borrowck-struct-update-with-dtor.stderr index bc11204acf2..d953ed2ad3e 100644 --- a/tests/ui/borrowck/borrowck-struct-update-with-dtor.stderr +++ b/tests/ui/borrowck/borrowck-struct-update-with-dtor.stderr @@ -33,8 +33,9 @@ LL | struct B; | ^^^^^^^^ help: if `B` implemented `Clone`, you could clone the value from the field instead of using the functional record update syntax | -LL | let _s2 = S { a: 2, b: s0.b.clone(), c: s0.c.clone() }; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _s2 = S { a: 2, ..s0 }; +LL + let _s2 = S { a: 2, b: s0.b.clone(), c: s0.c.clone() }; + | error[E0509]: cannot move out of type `S<B>`, which implements the `Drop` trait --> $DIR/borrowck-struct-update-with-dtor.rs:24:19 @@ -52,8 +53,9 @@ LL | struct B; | ^^^^^^^^ help: if `B` implemented `Clone`, you could clone the value from the field instead of using the functional record update syntax | -LL | let _s2 = S { a: 2, b: s0.b.clone(), c: s0.c.clone() }; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _s2 = S { a: 2, ..s0 }; +LL + let _s2 = S { a: 2, b: s0.b.clone(), c: s0.c.clone() }; + | error[E0509]: cannot move out of type `S<K>`, which implements the `Drop` trait --> $DIR/borrowck-struct-update-with-dtor.rs:29:19 @@ -99,8 +101,9 @@ LL | let _s2 = T { a: 2, ..s0 }; | help: clone the value from the field instead of using the functional record update syntax | -LL | let _s2 = T { a: 2, b: s0.b.clone() }; - | ~~~~~~~~~~~~~~~~~ +LL - let _s2 = T { a: 2, ..s0 }; +LL + let _s2 = T { a: 2, b: s0.b.clone() }; + | error[E0509]: cannot move out of type `T`, which implements the `Drop` trait --> $DIR/borrowck-struct-update-with-dtor.rs:42:19 @@ -113,8 +116,9 @@ LL | let _s2 = T { ..s0 }; | help: clone the value from the field instead of using the functional record update syntax | -LL | let _s2 = T { b: s0.b.clone(), ..s0 }; - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _s2 = T { ..s0 }; +LL + let _s2 = T { b: s0.b.clone(), ..s0 }; + | error[E0509]: cannot move out of type `T`, which implements the `Drop` trait --> $DIR/borrowck-struct-update-with-dtor.rs:47:32 diff --git a/tests/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.stderr b/tests/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.stderr index 11ee8f7bb91..6e0c69a4eb0 100644 --- a/tests/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.stderr +++ b/tests/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.stderr @@ -4,7 +4,7 @@ error[E0712]: thread-local variable borrowed past end of function LL | assert_static(&FOO); | ^^^^ thread-local variables cannot be borrowed beyond the end of the function LL | } - | - end of enclosing function is here + | - end of enclosing function is here error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr index e4dfa6d7fba..1e3570fc855 100644 --- a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr +++ b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr @@ -9,8 +9,9 @@ LL | let sfoo: *mut Foo = &mut SFOO; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw mut` instead to create a raw pointer | -LL | let sfoo: *mut Foo = &raw mut SFOO; - | ~~~~~~~~ +LL - let sfoo: *mut Foo = &mut SFOO; +LL + let sfoo: *mut Foo = &raw mut SFOO; + | warning: 1 warning emitted diff --git a/tests/ui/borrowck/implied-bound-from-impl-header.rs b/tests/ui/borrowck/implied-bound-from-impl-header.rs new file mode 100644 index 00000000000..326a62b22f0 --- /dev/null +++ b/tests/ui/borrowck/implied-bound-from-impl-header.rs @@ -0,0 +1,28 @@ +//@ check-pass +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +// Make sure that we can normalize `<T as Ref<'a>>::Assoc` to `&'a T` and get +// its implied bounds in impl header. + +trait Ref<'a> { + type Assoc; +} +impl<'a, T> Ref<'a> for T where T: 'a { + type Assoc = &'a T; +} + +fn outlives<'a, T: 'a>() {} + +trait Trait<'a, T> { + fn test(); +} + +impl<'a, T> Trait<'a, T> for <T as Ref<'a>>::Assoc { + fn test() { + outlives::<'a, T>(); + } +} + +fn main() {} diff --git a/tests/ui/borrowck/implied-bound-from-normalized-arg.rs b/tests/ui/borrowck/implied-bound-from-normalized-arg.rs new file mode 100644 index 00000000000..4e9a4953c6b --- /dev/null +++ b/tests/ui/borrowck/implied-bound-from-normalized-arg.rs @@ -0,0 +1,22 @@ +//@ check-pass +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +// Make sure that we can normalize `<T as Ref<'a>>::Assoc` to `&'a T` and get +// its implied bounds. + +trait Ref<'a> { + type Assoc; +} +impl<'a, T> Ref<'a> for T where T: 'a { + type Assoc = &'a T; +} + +fn outlives<'a, T: 'a>() {} + +fn test<'a, T>(_: <T as Ref<'a>>::Assoc) { + outlives::<'a, T>(); +} + +fn main() {} diff --git a/tests/ui/borrowck/index-mut-help.stderr b/tests/ui/borrowck/index-mut-help.stderr index c4c9c1c5313..6c3bd0df20b 100644 --- a/tests/ui/borrowck/index-mut-help.stderr +++ b/tests/ui/borrowck/index-mut-help.stderr @@ -7,8 +7,9 @@ LL | map["peter"].clear(); = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>` help: to modify a `HashMap<&str, String>` use `.get_mut()` | -LL | if let Some(val) = map.get_mut("peter") { val.clear(); }; - | ++++++++++++++++++ ~~~~~~~~~ ~~~~~~~ +++ +LL - map["peter"].clear(); +LL + if let Some(val) = map.get_mut("peter") { val.clear(); }; + | error[E0594]: cannot assign to data in an index of `HashMap<&str, String>` --> $DIR/index-mut-help.rs:11:5 @@ -19,12 +20,15 @@ LL | map["peter"] = "0".to_string(); = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>` help: use `.insert()` to insert a value into a `HashMap<&str, String>`, `.get_mut()` to modify it, or the entry API for more flexibility | -LL | map.insert("peter", "0".to_string()); - | ~~~~~~~~ ~ + -LL | if let Some(val) = map.get_mut("peter") { *val = "0".to_string(); }; - | ++++++++++++++++++ ~~~~~~~~~ ~~~~~~~~ +++ -LL | let val = map.entry("peter").or_insert("0".to_string()); - | +++++++++ ~~~~~~~ ~~~~~~~~~~~~ + +LL - map["peter"] = "0".to_string(); +LL + map.insert("peter", "0".to_string()); + | +LL - map["peter"] = "0".to_string(); +LL + if let Some(val) = map.get_mut("peter") { *val = "0".to_string(); }; + | +LL - map["peter"] = "0".to_string(); +LL + let val = map.entry("peter").or_insert("0".to_string()); + | error[E0596]: cannot borrow data in an index of `HashMap<&str, String>` as mutable --> $DIR/index-mut-help.rs:12:13 diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr index 40ab2e61d6a..61c01f0f024 100644 --- a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr @@ -9,7 +9,7 @@ LL | self.layers.iter().fold(0, |result, mut layer| result + layer.proce help: you may want to use `iter_mut` here | LL | self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process()) - | ~~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr index 466f19eb0ab..c6955317d87 100644 --- a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr +++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr @@ -9,7 +9,7 @@ LL | vec.iter().flat_map(|container| container.things()).cloned().co help: you may want to use `iter_mut` here | LL | vec.iter_mut().flat_map(|container| container.things()).cloned().collect::<Vec<PathBuf>>(); - | ~~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr index fd58e433020..ae4920b2a8c 100644 --- a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr @@ -9,7 +9,7 @@ LL | v.iter().for_each(|a| a.double()); help: you may want to use `iter_mut` here | LL | v.iter_mut().for_each(|a| a.double()); - | ~~~~~~~~ + | ++++ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference --> $DIR/issue-62387-suggest-iter-mut.rs:25:39 @@ -22,7 +22,7 @@ LL | v.iter().rev().rev().for_each(|a| a.double()); help: you may want to use `iter_mut` here | LL | v.iter_mut().rev().rev().for_each(|a| a.double()); - | ~~~~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/issue-85765-closure.stderr b/tests/ui/borrowck/issue-85765-closure.stderr index 936ddd67bcd..fa4e5441508 100644 --- a/tests/ui/borrowck/issue-85765-closure.stderr +++ b/tests/ui/borrowck/issue-85765-closure.stderr @@ -6,8 +6,9 @@ LL | rofl.push(Vec::new()); | help: consider changing this binding's type | -LL | let rofl: &mut Vec<Vec<i32>> = &mut test; - | ~~~~~~~~~~~~~~~~~~ +LL - let rofl: &Vec<Vec<i32>> = &mut test; +LL + let rofl: &mut Vec<Vec<i32>> = &mut test; + | error[E0594]: cannot assign to `*r`, which is behind a `&` reference --> $DIR/issue-85765-closure.rs:13:9 @@ -28,8 +29,9 @@ LL | *x = 1; | help: consider changing this binding's type | -LL | let x: &mut usize = &mut{0}; - | ~~~~~~~~~~ +LL - let x: &usize = &mut{0}; +LL + let x: &mut usize = &mut{0}; + | error[E0594]: cannot assign to `*y`, which is behind a `&` reference --> $DIR/issue-85765-closure.rs:27:9 @@ -39,8 +41,9 @@ LL | *y = 1; | help: consider changing this binding's type | -LL | let y: &mut usize = &mut(0); - | ~~~~~~~~~~ +LL - let y: &usize = &mut(0); +LL + let y: &mut usize = &mut(0); + | error: aborting due to 4 previous errors diff --git a/tests/ui/borrowck/issue-85765.stderr b/tests/ui/borrowck/issue-85765.stderr index 57900bfb612..9354294f52b 100644 --- a/tests/ui/borrowck/issue-85765.stderr +++ b/tests/ui/borrowck/issue-85765.stderr @@ -6,8 +6,9 @@ LL | rofl.push(Vec::new()); | help: consider changing this binding's type | -LL | let rofl: &mut Vec<Vec<i32>> = &mut test; - | ~~~~~~~~~~~~~~~~~~ +LL - let rofl: &Vec<Vec<i32>> = &mut test; +LL + let rofl: &mut Vec<Vec<i32>> = &mut test; + | error[E0594]: cannot assign to `*r`, which is behind a `&` reference --> $DIR/issue-85765.rs:12:5 @@ -28,8 +29,9 @@ LL | *x = 1; | help: consider changing this binding's type | -LL | let x: &mut usize = &mut{0}; - | ~~~~~~~~~~ +LL - let x: &usize = &mut{0}; +LL + let x: &mut usize = &mut{0}; + | error[E0594]: cannot assign to `*y`, which is behind a `&` reference --> $DIR/issue-85765.rs:26:5 @@ -39,8 +41,9 @@ LL | *y = 1; | help: consider changing this binding's type | -LL | let y: &mut usize = &mut(0); - | ~~~~~~~~~~ +LL - let y: &usize = &mut(0); +LL + let y: &mut usize = &mut(0); + | error: aborting due to 4 previous errors diff --git a/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr b/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr index dbe834b6b78..9bcfbd33795 100644 --- a/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr +++ b/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr @@ -6,8 +6,9 @@ LL | unsafe { *ptr = 3; } | help: consider changing this to be a mutable pointer | -LL | let ptr = &raw mut val; - | ~~~ +LL - let ptr = &raw const val; +LL + let ptr = &raw mut val; + | error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.stderr b/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.stderr index 28b4b4aa290..98fb49824ae 100644 --- a/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.stderr +++ b/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.stderr @@ -12,8 +12,9 @@ LL | | }) | help: to declare that the trait object captures data from argument `x`, you can add a lifetime parameter `'a` in the type alias | -LL | type Lazy<'a, T> = Box<dyn Fn() -> T + 'a>; - | +++ ~~ +LL - type Lazy<T> = Box<dyn Fn() -> T + 'static>; +LL + type Lazy<'a, T> = Box<dyn Fn() -> T + 'a>; + | error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function --> $DIR/suggest-lt-on-ty-alias-w-generics.rs:4:14 diff --git a/tests/ui/borrowck/unmatched-arg-and-hir-arg-issue-126385.stderr b/tests/ui/borrowck/unmatched-arg-and-hir-arg-issue-126385.stderr index 0ae301b2090..a18c4e72719 100644 --- a/tests/ui/borrowck/unmatched-arg-and-hir-arg-issue-126385.stderr +++ b/tests/ui/borrowck/unmatched-arg-and-hir-arg-issue-126385.stderr @@ -16,8 +16,9 @@ LL | impl MyStruct<'_> { | ----------------- `Self` is on type `MyStruct` in this `impl` help: the `Self` type doesn't accept type parameters, use the concrete type's name `MyStruct` instead if you want to specify its type parameters | -LL | pub fn f(field: &[u32]) -> MyStruct<u32> { - | ~~~~~~~~ +LL - pub fn f(field: &[u32]) -> Self<u32> { +LL + pub fn f(field: &[u32]) -> MyStruct<u32> { + | error: lifetime may not live long enough --> $DIR/unmatched-arg-and-hir-arg-issue-126385.rs:10:9 diff --git a/tests/ui/btreemap/btreemap-index-mut-2.stderr b/tests/ui/btreemap/btreemap-index-mut-2.stderr index c42462ee1eb..74a8aaf8aee 100644 --- a/tests/ui/btreemap/btreemap-index-mut-2.stderr +++ b/tests/ui/btreemap/btreemap-index-mut-2.stderr @@ -7,12 +7,15 @@ LL | map[&0] = 1; = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `BTreeMap<u32, u32>` help: use `.insert()` to insert a value into a `BTreeMap<u32, u32>`, `.get_mut()` to modify it, or the entry API for more flexibility | -LL | map.insert(&0, 1); - | ~~~~~~~~ ~ + -LL | if let Some(val) = map.get_mut(&0) { *val = 1; }; - | ++++++++++++++++++ ~~~~~~~~~ ~~~~~~~~ +++ -LL | let val = map.entry(&0).or_insert(1); - | +++++++++ ~~~~~~~ ~~~~~~~~~~~~ + +LL - map[&0] = 1; +LL + map.insert(&0, 1); + | +LL - map[&0] = 1; +LL + if let Some(val) = map.get_mut(&0) { *val = 1; }; + | +LL - map[&0] = 1; +LL + let val = map.entry(&0).or_insert(1); + | error: aborting due to 1 previous error diff --git a/tests/ui/btreemap/btreemap-index-mut.stderr b/tests/ui/btreemap/btreemap-index-mut.stderr index f402f503c15..e8850ed2a17 100644 --- a/tests/ui/btreemap/btreemap-index-mut.stderr +++ b/tests/ui/btreemap/btreemap-index-mut.stderr @@ -7,12 +7,15 @@ LL | map[&0] = 1; = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `BTreeMap<u32, u32>` help: use `.insert()` to insert a value into a `BTreeMap<u32, u32>`, `.get_mut()` to modify it, or the entry API for more flexibility | -LL | map.insert(&0, 1); - | ~~~~~~~~ ~ + -LL | if let Some(val) = map.get_mut(&0) { *val = 1; }; - | ++++++++++++++++++ ~~~~~~~~~ ~~~~~~~~ +++ -LL | let val = map.entry(&0).or_insert(1); - | +++++++++ ~~~~~~~ ~~~~~~~~~~~~ + +LL - map[&0] = 1; +LL + map.insert(&0, 1); + | +LL - map[&0] = 1; +LL + if let Some(val) = map.get_mut(&0) { *val = 1; }; + | +LL - map[&0] = 1; +LL + let val = map.entry(&0).or_insert(1); + | error: aborting due to 1 previous error diff --git a/tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.rs b/tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.rs new file mode 100644 index 00000000000..58370bff220 --- /dev/null +++ b/tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.rs @@ -0,0 +1,16 @@ +//@ only-x86_64 + +fn efiapi(f: extern "efiapi" fn(usize, ...)) { + //~^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable + f(22, 44); +} +fn sysv(f: extern "sysv64" fn(usize, ...)) { + //~^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable + f(22, 44); +} +fn win(f: extern "win64" fn(usize, ...)) { + //~^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable + f(22, 44); +} + +fn main() {} diff --git a/tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.stderr b/tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.stderr new file mode 100644 index 00000000000..9565575dc42 --- /dev/null +++ b/tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.stderr @@ -0,0 +1,33 @@ +error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable + --> $DIR/feature-gate-extended_varargs_abi_support.rs:3:14 + | +LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #100189 <https://github.com/rust-lang/rust/issues/100189> for more information + = help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable + --> $DIR/feature-gate-extended_varargs_abi_support.rs:7:12 + | +LL | fn sysv(f: extern "sysv64" fn(usize, ...)) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #100189 <https://github.com/rust-lang/rust/issues/100189> for more information + = help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable + --> $DIR/feature-gate-extended_varargs_abi_support.rs:11:11 + | +LL | fn win(f: extern "win64" fn(usize, ...)) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #100189 <https://github.com/rust-lang/rust/issues/100189> for more information + = help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/c-variadic/issue-86053-1.stderr b/tests/ui/c-variadic/issue-86053-1.stderr index 67a619e46d5..ce31f0d300f 100644 --- a/tests/ui/c-variadic/issue-86053-1.stderr +++ b/tests/ui/c-variadic/issue-86053-1.stderr @@ -64,7 +64,7 @@ LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize help: a trait with a similar name exists | LL | self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) { - | ~~ + | + help: you might be missing a type parameter | LL | fn ordering4 < 'a , 'b, F > ( a : , self , self , self , diff --git a/tests/ui/c-variadic/variadic-ffi-1.stderr b/tests/ui/c-variadic/variadic-ffi-1.stderr index 7a54d043356..061eae9729e 100644 --- a/tests/ui/c-variadic/variadic-ffi-1.stderr +++ b/tests/ui/c-variadic/variadic-ffi-1.stderr @@ -14,11 +14,12 @@ note: function defined here --> $DIR/variadic-ffi-1.rs:15:8 | LL | fn foo(f: isize, x: u8, ...); - | ^^^ + | ^^^ - - help: provide the arguments | -LL | foo(/* isize */, /* u8 */); - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - foo(); +LL + foo(/* isize */, /* u8 */); + | error[E0060]: this function takes at least 2 arguments but 1 argument was supplied --> $DIR/variadic-ffi-1.rs:23:9 @@ -30,11 +31,12 @@ note: function defined here --> $DIR/variadic-ffi-1.rs:15:8 | LL | fn foo(f: isize, x: u8, ...); - | ^^^ + | ^^^ - help: provide the argument | -LL | foo(1, /* u8 */); - | ~~~~~~~~~~~~~ +LL - foo(1); +LL + foo(1, /* u8 */); + | error[E0308]: mismatched types --> $DIR/variadic-ffi-1.rs:25:56 diff --git a/tests/ui/c-variadic/variadic-ffi-2-arm.rs b/tests/ui/c-variadic/variadic-ffi-2-arm.rs index 82f9df5053c..3b0a71007a0 100644 --- a/tests/ui/c-variadic/variadic-ffi-2-arm.rs +++ b/tests/ui/c-variadic/variadic-ffi-2-arm.rs @@ -1,5 +1,6 @@ //@ only-arm //@ build-pass +#![feature(extended_varargs_abi_support)] fn aapcs(f: extern "aapcs" fn(usize, ...)) { f(22, 44); diff --git a/tests/ui/c-variadic/variadic-ffi-2.rs b/tests/ui/c-variadic/variadic-ffi-2.rs index 17a1065279f..99f83f22d17 100644 --- a/tests/ui/c-variadic/variadic-ffi-2.rs +++ b/tests/ui/c-variadic/variadic-ffi-2.rs @@ -1,4 +1,5 @@ //@ ignore-arm stdcall isn't supported +#![feature(extended_varargs_abi_support)] #[allow(unsupported_fn_ptr_calling_conventions)] fn baz(f: extern "stdcall" fn(usize, ...)) { @@ -7,9 +8,6 @@ fn baz(f: extern "stdcall" fn(usize, ...)) { f(22, 44); } -fn system(f: extern "system" fn(usize, ...)) { - f(22, 44); -} #[cfg(target_arch = "x86_64")] fn sysv(f: extern "sysv64" fn(usize, ...)) { f(22, 44); diff --git a/tests/ui/c-variadic/variadic-ffi-2.stderr b/tests/ui/c-variadic/variadic-ffi-2.stderr index fbf273b1f1d..e52de93a926 100644 --- a/tests/ui/c-variadic/variadic-ffi-2.stderr +++ b/tests/ui/c-variadic/variadic-ffi-2.stderr @@ -1,5 +1,5 @@ error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi` - --> $DIR/variadic-ffi-2.rs:4:11 + --> $DIR/variadic-ffi-2.rs:5:11 | LL | fn baz(f: extern "stdcall" fn(usize, ...)) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention diff --git a/tests/ui/cast/cast-as-bool.stderr b/tests/ui/cast/cast-as-bool.stderr index 4ff56a95e49..b2c9ae5c6ad 100644 --- a/tests/ui/cast/cast-as-bool.stderr +++ b/tests/ui/cast/cast-as-bool.stderr @@ -6,8 +6,9 @@ LL | let u = 5 as bool; | help: compare with zero instead | -LL | let u = 5 != 0; - | ~~~~ +LL - let u = 5 as bool; +LL + let u = 5 != 0; + | error[E0054]: cannot cast `i32` as `bool` --> $DIR/cast-as-bool.rs:6:13 @@ -17,8 +18,9 @@ LL | let t = (1 + 2) as bool; | help: compare with zero instead | -LL | let t = (1 + 2) != 0; - | ~~~~ +LL - let t = (1 + 2) as bool; +LL + let t = (1 + 2) != 0; + | error[E0054]: cannot cast `u32` as `bool` --> $DIR/cast-as-bool.rs:10:13 @@ -28,8 +30,9 @@ LL | let _ = 5_u32 as bool; | help: compare with zero instead | -LL | let _ = 5_u32 != 0; - | ~~~~ +LL - let _ = 5_u32 as bool; +LL + let _ = 5_u32 != 0; + | error[E0054]: cannot cast `f64` as `bool` --> $DIR/cast-as-bool.rs:13:13 @@ -39,8 +42,9 @@ LL | let _ = 64.0_f64 as bool; | help: compare with zero instead | -LL | let _ = 64.0_f64 != 0; - | ~~~~ +LL - let _ = 64.0_f64 as bool; +LL + let _ = 64.0_f64 != 0; + | error[E0054]: cannot cast `IntEnum` as `bool` --> $DIR/cast-as-bool.rs:24:13 @@ -86,8 +90,9 @@ LL | let v = "hello" as bool; | help: consider using the `is_empty` method on `&'static str` to determine if it contains anything | -LL | let v = !"hello".is_empty(); - | + ~~~~~~~~~~~ +LL - let v = "hello" as bool; +LL + let v = !"hello".is_empty(); + | error: aborting due to 11 previous errors diff --git a/tests/ui/cast/cast-rfc0401-2.stderr b/tests/ui/cast/cast-rfc0401-2.stderr index b7fb420533e..f2956cdfa33 100644 --- a/tests/ui/cast/cast-rfc0401-2.stderr +++ b/tests/ui/cast/cast-rfc0401-2.stderr @@ -6,8 +6,9 @@ LL | let _ = 3 as bool; | help: compare with zero instead | -LL | let _ = 3 != 0; - | ~~~~ +LL - let _ = 3 as bool; +LL + let _ = 3 != 0; + | error: aborting due to 1 previous error diff --git a/tests/ui/cast/ice-cast-type-with-error-124848.stderr b/tests/ui/cast/ice-cast-type-with-error-124848.stderr index 1e2adcc7d9e..402ee27386d 100644 --- a/tests/ui/cast/ice-cast-type-with-error-124848.stderr +++ b/tests/ui/cast/ice-cast-type-with-error-124848.stderr @@ -48,8 +48,9 @@ LL | struct MyType<'a>(Cell<Option<&'unpinned mut MyType<'a>>>, Pin); | ^^^^^^ help: provide the argument | -LL | let mut unpinned = MyType(Cell::new(None), /* value */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let mut unpinned = MyType(Cell::new(None)); +LL + let mut unpinned = MyType(Cell::new(None), /* value */); + | error[E0606]: casting `&MyType<'_>` as `*const Cell<Option<&mut MyType<'_>>>` is invalid --> $DIR/ice-cast-type-with-error-124848.rs:14:20 diff --git a/tests/ui/cast/issue-106883-is-empty.stderr b/tests/ui/cast/issue-106883-is-empty.stderr index 7115c7704ca..5ebabc9ed83 100644 --- a/tests/ui/cast/issue-106883-is-empty.stderr +++ b/tests/ui/cast/issue-106883-is-empty.stderr @@ -6,8 +6,9 @@ LL | let _ = "foo" as bool; | help: consider using the `is_empty` method on `&'static str` to determine if it contains anything | -LL | let _ = !"foo".is_empty(); - | + ~~~~~~~~~~~ +LL - let _ = "foo" as bool; +LL + let _ = !"foo".is_empty(); + | error[E0605]: non-primitive cast: `String` as `bool` --> $DIR/issue-106883-is-empty.rs:17:13 @@ -22,8 +23,9 @@ LL | let _ = String::from("foo") as bool; | ^^^^^^^^^^^^^^^^^^^ help: consider using the `is_empty` method on `String` to determine if it contains anything | -LL | let _ = !String::from("foo").is_empty(); - | + ~~~~~~~~~~~ +LL - let _ = String::from("foo") as bool; +LL + let _ = !String::from("foo").is_empty(); + | error[E0605]: non-primitive cast: `Foo` as `bool` --> $DIR/issue-106883-is-empty.rs:20:13 @@ -38,8 +40,9 @@ LL | let _ = Foo as bool; | ^^^ help: consider using the `is_empty` method on `Foo` to determine if it contains anything | -LL | let _ = !Foo.is_empty(); - | + ~~~~~~~~~~~ +LL - let _ = Foo as bool; +LL + let _ = !Foo.is_empty(); + | error[E0606]: casting `&[i32]` as `bool` is invalid --> $DIR/issue-106883-is-empty.rs:25:5 @@ -49,8 +52,9 @@ LL | bar as bool | help: consider using the `is_empty` method on `&[i32]` to determine if it contains anything | -LL | !bar.is_empty() - | + ~~~~~~~~~~~ +LL - bar as bool +LL + !bar.is_empty() + | error: aborting due to 4 previous errors diff --git a/tests/ui/cenum_impl_drop_cast.rs b/tests/ui/cenum_impl_drop_cast.rs index 96e3d967e2c..f681434dd86 100644 --- a/tests/ui/cenum_impl_drop_cast.rs +++ b/tests/ui/cenum_impl_drop_cast.rs @@ -1,5 +1,3 @@ -#![deny(cenum_impl_drop_cast)] - enum E { A = 0, } @@ -14,5 +12,4 @@ fn main() { let e = E::A; let i = e as u32; //~^ ERROR cannot cast enum `E` into integer `u32` because it implements `Drop` - //~| WARN this was previously accepted } diff --git a/tests/ui/cenum_impl_drop_cast.stderr b/tests/ui/cenum_impl_drop_cast.stderr index 541d15d021d..35c69f4b4b7 100644 --- a/tests/ui/cenum_impl_drop_cast.stderr +++ b/tests/ui/cenum_impl_drop_cast.stderr @@ -1,31 +1,8 @@ error: cannot cast enum `E` into integer `u32` because it implements `Drop` - --> $DIR/cenum_impl_drop_cast.rs:15:13 + --> $DIR/cenum_impl_drop_cast.rs:13:13 | LL | let i = e as 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 #73333 <https://github.com/rust-lang/rust/issues/73333> -note: the lint level is defined here - --> $DIR/cenum_impl_drop_cast.rs:1:9 - | -LL | #![deny(cenum_impl_drop_cast)] - | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error -Future incompatibility report: Future breakage diagnostic: -error: cannot cast enum `E` into integer `u32` because it implements `Drop` - --> $DIR/cenum_impl_drop_cast.rs:15:13 - | -LL | let i = e as 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 #73333 <https://github.com/rust-lang/rust/issues/73333> -note: the lint level is defined here - --> $DIR/cenum_impl_drop_cast.rs:1:9 - | -LL | #![deny(cenum_impl_drop_cast)] - | ^^^^^^^^^^^^^^^^^^^^ - diff --git a/tests/ui/cfg/cfg-method-receiver.stderr b/tests/ui/cfg/cfg-method-receiver.stderr index 5767a7c1b4b..44f3d8d058e 100644 --- a/tests/ui/cfg/cfg-method-receiver.stderr +++ b/tests/ui/cfg/cfg-method-receiver.stderr @@ -17,7 +17,7 @@ LL | cbor_map! { #[cfg(test)] 4}; help: you must specify a concrete type for this numeric value, like `i32` | LL | cbor_map! { #[cfg(test)] 4_i32}; - | ~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/cfg/conditional-compile.rs b/tests/ui/cfg/conditional-compile.rs index a4f334dd696..dff280054d6 100644 --- a/tests/ui/cfg/conditional-compile.rs +++ b/tests/ui/cfg/conditional-compile.rs @@ -85,7 +85,7 @@ pub fn main() { pub fn main() { // Exercise some of the configured items in ways that wouldn't be possible // if they had the FALSE definition - assert!((b)); + assert!(b); let _x: t = true; let _y: tg = tg::bar; diff --git a/tests/ui/check-cfg/cargo-build-script.stderr b/tests/ui/check-cfg/cargo-build-script.stderr index df0bc47571c..03a7156a4d6 100644 --- a/tests/ui/check-cfg/cargo-build-script.stderr +++ b/tests/ui/check-cfg/cargo-build-script.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `has_foo` LL | #[cfg(has_foo)] | ^^^^^^^ | - = help: expected names are: `has_bar` and 30 more + = help: expected names are: `has_bar` and 31 more = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cargo-feature.none.stderr b/tests/ui/check-cfg/cargo-feature.none.stderr index 58813a1f677..b83d1794984 100644 --- a/tests/ui/check-cfg/cargo-feature.none.stderr +++ b/tests/ui/check-cfg/cargo-feature.none.stderr @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `docsrs`, `feature`, and `test` and 30 more + = help: expected names are: `docsrs`, `feature`, and `test` and 31 more = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cargo-feature.some.stderr b/tests/ui/check-cfg/cargo-feature.some.stderr index 5a12be81338..2cddcbbcd7f 100644 --- a/tests/ui/check-cfg/cargo-feature.some.stderr +++ b/tests/ui/check-cfg/cargo-feature.some.stderr @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `CONFIG_NVME`, `docsrs`, `feature`, and `test` and 30 more + = help: expected names are: `CONFIG_NVME`, `docsrs`, `feature`, and `test` and 31 more = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr index 7c276c58170..68e1259dbb8 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `value` LL | #[cfg(value)] | ^^^^^ | - = help: expected names are: `bar`, `bee`, `cow`, and `foo` and 30 more + = help: expected names are: `bar`, `bee`, `cow`, and `foo` and 31 more = help: to expect this configuration use `--check-cfg=cfg(value)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr index 9687a043e83..5279f3b0901 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr @@ -4,18 +4,20 @@ warning: unexpected `cfg` condition name: `my_value` LL | #[cfg(my_value)] | ^^^^^^^^ | - = help: expected names are: `bar` and `foo` and 30 more + = help: expected names are: `bar` and `foo` and 31 more = help: to expect this configuration use `--check-cfg=cfg(my_value)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default help: found config with similar value | -LL | #[cfg(foo = "my_value")] - | ~~~~~~~~~~~~~~~~ +LL - #[cfg(my_value)] +LL + #[cfg(foo = "my_value")] + | help: found config with similar value | -LL | #[cfg(bar = "my_value")] - | ~~~~~~~~~~~~~~~~ +LL - #[cfg(my_value)] +LL + #[cfg(bar = "my_value")] + | warning: 1 warning emitted diff --git a/tests/ui/check-cfg/diagnotics.cargo.stderr b/tests/ui/check-cfg/diagnotics.cargo.stderr index a440ccaaf58..ebfc9a935d2 100644 --- a/tests/ui/check-cfg/diagnotics.cargo.stderr +++ b/tests/ui/check-cfg/diagnotics.cargo.stderr @@ -18,7 +18,7 @@ LL | #[cfg(featur = "foo")] help: there is a config with a similar name and value | LL | #[cfg(feature = "foo")] - | ~~~~~~~ + | + warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:17:7 @@ -30,8 +30,9 @@ LL | #[cfg(featur = "fo")] = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration help: there is a config with a similar name and different values | -LL | #[cfg(feature = "foo")] - | ~~~~~~~~~~~~~~~ +LL - #[cfg(featur = "fo")] +LL + #[cfg(feature = "foo")] + | warning: unexpected `cfg` condition name: `no_value` --> $DIR/diagnotics.rs:24:7 @@ -60,8 +61,9 @@ LL | #[cfg(no_value = "foo")] = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration help: there is a config with a similar name and no value | -LL | #[cfg(no_values)] - | ~~~~~~~~~ +LL - #[cfg(no_value = "foo")] +LL + #[cfg(no_values)] + | warning: unexpected `cfg` condition value: `bar` --> $DIR/diagnotics.rs:32:7 diff --git a/tests/ui/check-cfg/diagnotics.rustc.stderr b/tests/ui/check-cfg/diagnotics.rustc.stderr index 6868be482d8..8860b3ff5da 100644 --- a/tests/ui/check-cfg/diagnotics.rustc.stderr +++ b/tests/ui/check-cfg/diagnotics.rustc.stderr @@ -20,7 +20,7 @@ LL | #[cfg(featur = "foo")] help: there is a config with a similar name and value | LL | #[cfg(feature = "foo")] - | ~~~~~~~ + | + warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:17:7 @@ -33,8 +33,9 @@ LL | #[cfg(featur = "fo")] = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration help: there is a config with a similar name and different values | -LL | #[cfg(feature = "foo")] - | ~~~~~~~~~~~~~~~ +LL - #[cfg(featur = "fo")] +LL + #[cfg(feature = "foo")] + | warning: unexpected `cfg` condition name: `no_value` --> $DIR/diagnotics.rs:24:7 @@ -55,8 +56,9 @@ LL | #[cfg(no_value = "foo")] = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration help: there is a config with a similar name and no value | -LL | #[cfg(no_values)] - | ~~~~~~~~~ +LL - #[cfg(no_value = "foo")] +LL + #[cfg(no_values)] + | warning: unexpected `cfg` condition value: `bar` --> $DIR/diagnotics.rs:32:7 diff --git a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr index 7e77ba63a12..e7b8f355057 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr @@ -14,7 +14,7 @@ warning: unexpected `cfg` condition value: `value` LL | #[cfg(target_vendor = "value")] | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_vendor` are: `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs` + = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition name: `feature` diff --git a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr index 10302f0a7e4..95af0a90929 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `feature` and 30 more + = help: expected names are: `feature` and 31 more = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default @@ -15,7 +15,7 @@ warning: unexpected `cfg` condition value: `value` LL | #[cfg(target_vendor = "value")] | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_vendor` are: `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs` + = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `unk` diff --git a/tests/ui/check-cfg/exhaustive-names-values.full.stderr b/tests/ui/check-cfg/exhaustive-names-values.full.stderr index 10302f0a7e4..95af0a90929 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.full.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.full.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `feature` and 30 more + = help: expected names are: `feature` and 31 more = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default @@ -15,7 +15,7 @@ warning: unexpected `cfg` condition value: `value` LL | #[cfg(target_vendor = "value")] | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_vendor` are: `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs` + = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `unk` diff --git a/tests/ui/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.stderr index 033aaef848f..be4d7c77276 100644 --- a/tests/ui/check-cfg/mix.stderr +++ b/tests/ui/check-cfg/mix.stderr @@ -44,7 +44,7 @@ warning: unexpected `cfg` condition name: `uu` LL | #[cfg_attr(uu, unix)] | ^^ | - = help: expected names are: `feature` and 30 more + = help: expected names are: `feature` and 31 more = help: to expect this configuration use `--check-cfg=cfg(uu)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/raw-keywords.edition2015.stderr b/tests/ui/check-cfg/raw-keywords.edition2015.stderr index f19ded9cb67..8ca33e088fc 100644 --- a/tests/ui/check-cfg/raw-keywords.edition2015.stderr +++ b/tests/ui/check-cfg/raw-keywords.edition2015.stderr @@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `r#false` LL | #[cfg(r#false)] | ^^^^^^^ | - = help: expected names are: `async`, `edition2015`, `edition2021`, and `r#true` and 30 more + = help: expected names are: `async`, `edition2015`, `edition2021`, and `r#true` and 31 more = help: to expect this configuration use `--check-cfg=cfg(r#false)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/raw-keywords.edition2021.stderr b/tests/ui/check-cfg/raw-keywords.edition2021.stderr index 6096148a259..cce55720bdd 100644 --- a/tests/ui/check-cfg/raw-keywords.edition2021.stderr +++ b/tests/ui/check-cfg/raw-keywords.edition2021.stderr @@ -14,7 +14,7 @@ warning: unexpected `cfg` condition name: `r#false` LL | #[cfg(r#false)] | ^^^^^^^ | - = help: expected names are: `r#async`, `edition2015`, `edition2021`, and `r#true` and 30 more + = help: expected names are: `r#async`, `edition2015`, `edition2021`, and `r#true` and 31 more = help: to expect this configuration use `--check-cfg=cfg(r#false)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/report-in-external-macros.cargo.stderr b/tests/ui/check-cfg/report-in-external-macros.cargo.stderr index a6584d777a3..989a01f2244 100644 --- a/tests/ui/check-cfg/report-in-external-macros.cargo.stderr +++ b/tests/ui/check-cfg/report-in-external-macros.cargo.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_lib_cfg` LL | cfg_macro::my_lib_macro!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `feature` and 30 more + = help: expected names are: `feature` and 31 more = note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate = help: try referring to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg = help: the macro `cfg_macro::my_lib_macro` may come from an old version of the `cfg_macro` crate, try updating your dependency with `cargo update -p cfg_macro` diff --git a/tests/ui/check-cfg/report-in-external-macros.rustc.stderr b/tests/ui/check-cfg/report-in-external-macros.rustc.stderr index 914b5a0efe3..95d10e014f3 100644 --- a/tests/ui/check-cfg/report-in-external-macros.rustc.stderr +++ b/tests/ui/check-cfg/report-in-external-macros.rustc.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_lib_cfg` LL | cfg_macro::my_lib_macro!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `feature` and 30 more + = help: expected names are: `feature` and 31 more = note: using a cfg inside a macro will use the cfgs from the destination crate and not the ones from the defining crate = help: try referring to `cfg_macro::my_lib_macro` crate for guidance on how handle this unexpected cfg = help: to expect this configuration use `--check-cfg=cfg(my_lib_cfg)` diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr index bf54d17f6ec..70852423bdb 100644 --- a/tests/ui/check-cfg/target_feature.stderr +++ b/tests/ui/check-cfg/target_feature.stderr @@ -127,6 +127,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `isa-68881` `isa-68882` `jsconv` +`kl` `lahfsahf` `lasx` `lbt` @@ -271,6 +272,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); `vsx` `wfxt` `wide-arithmetic` +`widekl` `x87` `xop` `xsave` diff --git a/tests/ui/check-cfg/well-known-names.stderr b/tests/ui/check-cfg/well-known-names.stderr index 4ff90261158..4edf608589d 100644 --- a/tests/ui/check-cfg/well-known-names.stderr +++ b/tests/ui/check-cfg/well-known-names.stderr @@ -5,6 +5,7 @@ LL | #[cfg(list_all_well_known_cfgs)] | ^^^^^^^^^^^^^^^^^^^^^^^^ | = help: expected names are: `clippy` +`contract_checks` `debug_assertions` `doc` `doctest` @@ -47,8 +48,9 @@ LL | #[cfg(target_oz = "linux")] = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration help: there is a config with a similar name and value | -LL | #[cfg(target_os = "linux")] - | ~~~~~~~~~ +LL - #[cfg(target_oz = "linux")] +LL + #[cfg(target_os = "linux")] + | warning: unexpected `cfg` condition name: `features` --> $DIR/well-known-names.rs:19:7 diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index ffebd7e5531..ba1900fcddb 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -138,7 +138,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_arch = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_arch` are: `aarch64`, `arm`, `arm64ec`, `avr`, `bpf`, `csky`, `hexagon`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`, and `xtensa` + = note: expected values for `target_arch` are: `aarch64`, `amdgpu`, `arm`, `arm64ec`, `avr`, `bpf`, `csky`, `hexagon`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`, and `xtensa` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` @@ -201,7 +201,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_os = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` + = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` @@ -230,7 +230,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_vendor = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_vendor` are: `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs` + = note: expected values for `target_vendor` are: `amd`, `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` @@ -274,7 +274,7 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` | | | help: there is a expected value with a similar name: `"linux"` | - = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` + = note: expected values for `target_os` are: `aix`, `amdhsa`, `android`, `cuda`, `cygwin`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: 28 warnings emitted diff --git a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr index b5ad8eb790f..ced582c9ff5 100644 --- a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr +++ b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr @@ -109,7 +109,7 @@ LL | let PAT = v1; help: introduce a variable instead | LL | let PAT_var = v1; - | ~~~~~~~ + | ++++ error: aborting due to 7 previous errors diff --git a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr index 87084e60237..bfe4afc4b58 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr @@ -9,7 +9,7 @@ LL | V(x) = func_arg; help: consider dereferencing to access the inner value using the Deref trait | LL | V(x) = &*func_arg; - | ~~~~~~~~~~ + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/closures/eager-mono-with-normalizable-upvars.rs b/tests/ui/closures/eager-mono-with-normalizable-upvars.rs new file mode 100644 index 00000000000..4d934f7a7a9 --- /dev/null +++ b/tests/ui/closures/eager-mono-with-normalizable-upvars.rs @@ -0,0 +1,19 @@ +//@ compile-flags: -Clink-dead-code -Csymbol-mangling-version=v0 +//@ build-pass + +// Ensure that when eagerly collecting `test::{closure#0}`, we don't try +// collecting an unnormalized version of the closure (specifically its +// upvars), since the closure captures the RPIT `opaque::{opaque#0}`. + +fn opaque() -> impl Sized {} + +fn test() -> impl FnOnce() { + let opaque = opaque(); + move || { + let opaque = opaque; + } +} + +fn main() { + test()(); +} diff --git a/tests/ui/closures/issue-78720.stderr b/tests/ui/closures/issue-78720.stderr index 5d65c87b0fd..90672cd83d7 100644 --- a/tests/ui/closures/issue-78720.stderr +++ b/tests/ui/closures/issue-78720.stderr @@ -16,7 +16,7 @@ LL | _func: F, help: a trait with a similar name exists | LL | _func: Fn, - | ~~ + | + help: you might be missing a type parameter | LL | struct Map2<Segment2, F> { diff --git a/tests/ui/closures/multiple-fn-bounds.stderr b/tests/ui/closures/multiple-fn-bounds.stderr index 861b39b4d07..9b824fa0eef 100644 --- a/tests/ui/closures/multiple-fn-bounds.stderr +++ b/tests/ui/closures/multiple-fn-bounds.stderr @@ -21,8 +21,9 @@ LL | fn foo<F: Fn(&char) -> bool + Fn(char) -> bool>(f: F) { | ^^^^^^^^^^^^^^^^ required by this bound in `foo` help: consider adjusting the signature so it does not borrow its argument | -LL | foo(move |char| v); - | ~~~~ +LL - foo(move |x| v); +LL + foo(move |char| v); + | error: aborting due to 1 previous error diff --git a/tests/ui/closures/return-type-doesnt-match-bound.rs b/tests/ui/closures/return-type-doesnt-match-bound.rs new file mode 100644 index 00000000000..af15385d4b0 --- /dev/null +++ b/tests/ui/closures/return-type-doesnt-match-bound.rs @@ -0,0 +1,25 @@ +use std::error::Error; +use std::process::exit; + +fn foo<F>(f: F) -> () +where + F: FnOnce() -> Result<(), Box<dyn Error>>, +{ + f().or_else(|e| -> ! { //~ ERROR to return + eprintln!("{:?}", e); + exit(1) + }); +} + +fn bar<F>(f: F) -> () +where + F: FnOnce() -> Result<(), Box<dyn Error>>, +{ + let c = |e| -> ! { //~ ERROR to return + eprintln!("{:?}", e); + exit(1) + }; + f().or_else(c); +} + +fn main() {} diff --git a/tests/ui/closures/return-type-doesnt-match-bound.stderr b/tests/ui/closures/return-type-doesnt-match-bound.stderr new file mode 100644 index 00000000000..c0bc2f6084c --- /dev/null +++ b/tests/ui/closures/return-type-doesnt-match-bound.stderr @@ -0,0 +1,37 @@ +error[E0271]: expected `{closure@return-type-doesnt-match-bound.rs:8:17}` to return `Result<(), _>`, but it returns `!` + --> $DIR/return-type-doesnt-match-bound.rs:8:24 + | +LL | f().or_else(|e| -> ! { + | ------- -------^ + | | | | + | | | expected `Result<(), _>`, found `!` + | | this closure + | required by a bound introduced by this call + | + = note: expected enum `Result<(), _>` + found type `!` +note: required by a bound in `Result::<T, E>::or_else` + --> $SRC_DIR/core/src/result.rs:LL:COL + +error[E0271]: expected `{closure@return-type-doesnt-match-bound.rs:18:13}` to return `Result<(), _>`, but it returns `!` + --> $DIR/return-type-doesnt-match-bound.rs:18:20 + | +LL | let c = |e| -> ! { + | -------^ + | | | + | | expected `Result<(), _>`, found `!` + | this closure +... +LL | f().or_else(c); + | ------- - closure used here + | | + | required by a bound introduced by this call + | + = note: expected enum `Result<(), _>` + found type `!` +note: required by a bound in `Result::<T, E>::or_else` + --> $SRC_DIR/core/src/result.rs:LL:COL + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr index 120d5cc5293..63260b5c78f 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr @@ -1,4 +1,4 @@ -error[E0658]: C-cmse-nonsecure-call ABI is experimental and subject to change +error[E0658]: the extern "C-cmse-nonsecure-call" ABI is experimental and subject to change --> $DIR/gate_test.rs:5:46 | LL | core::mem::transmute::<usize, extern "C-cmse-nonsecure-call" fn(i32, i32, i32, i32) -> i32>( diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs index da1327dace5..31782b05105 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs @@ -39,4 +39,4 @@ type WithTransparentTraitObject = //~^ ERROR return value of `"C-cmse-nonsecure-call"` function too large to pass via registers [E0798] type WithVarArgs = extern "C-cmse-nonsecure-call" fn(u32, ...); -//~^ ERROR C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi` [E0045] +//~^ ERROR C-variadic function must have a compatible calling convention, like `C` diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr index f20e67e3d94..0560f0eec1c 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr @@ -14,8 +14,9 @@ LL | f1: extern "C-cmse-nonsecure-call" fn<U: Copy>(U, u32, u32, u32) -> u64 | help: a type parameter with a similar name exists | -LL | f1: extern "C-cmse-nonsecure-call" fn<U: Copy>(T, u32, u32, u32) -> u64, - | ~ +LL - f1: extern "C-cmse-nonsecure-call" fn<U: Copy>(U, u32, u32, u32) -> u64, +LL + f1: extern "C-cmse-nonsecure-call" fn<U: Copy>(T, u32, u32, u32) -> u64, + | help: you might be missing a type parameter | LL | struct Test<T: Copy, U> { diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.rs index e6af1d60e77..b052aabb499 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.rs @@ -1,12 +1,12 @@ //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm +//@ add-core-stubs + #![feature(abi_c_cmse_nonsecure_call, no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; #[repr(C)] pub struct ReprCU64(u64); diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr index dabf16cab30..0afbbe647af 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr @@ -1,4 +1,4 @@ -error[E0658]: C-cmse-nonsecure-entry ABI is experimental and subject to change +error[E0658]: the extern "C-cmse-nonsecure-entry" ABI is experimental and subject to change --> $DIR/gate_test.rs:4:12 | LL | pub extern "C-cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 { diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs index 5746d14f9b1..23d55526e57 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs @@ -1,13 +1,12 @@ //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm +//@ add-core-stubs + #![feature(cmse_nonsecure_entry, no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for u32 {} -impl Copy for u8 {} + +extern crate minicore; +use minicore::*; #[repr(C)] pub struct ReprCU64(u64); diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr index 9c885d95318..d37d9b5e8ff 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr @@ -1,5 +1,5 @@ error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:25:48 + --> $DIR/return-via-stack.rs:24:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f1() -> ReprCU64 { | ^^^^^^^^ this type doesn't fit in the available registers @@ -8,7 +8,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f1() -> ReprCU64 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:30:48 + --> $DIR/return-via-stack.rs:29:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f2() -> ReprCBytes { | ^^^^^^^^^^ this type doesn't fit in the available registers @@ -17,7 +17,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f2() -> ReprCBytes { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:35:48 + --> $DIR/return-via-stack.rs:34:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f3() -> U64Compound { | ^^^^^^^^^^^ this type doesn't fit in the available registers @@ -26,7 +26,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f3() -> U64Compound { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:40:48 + --> $DIR/return-via-stack.rs:39:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f4() -> ReprCAlign16 { | ^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -35,7 +35,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f4() -> ReprCAlign16 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:47:48 + --> $DIR/return-via-stack.rs:46:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f5() -> [u8; 5] { | ^^^^^^^ this type doesn't fit in the available registers @@ -44,7 +44,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f5() -> [u8; 5] { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:53:50 + --> $DIR/return-via-stack.rs:52:50 | LL | pub extern "C-cmse-nonsecure-entry" fn u128() -> u128 { | ^^^^ this type doesn't fit in the available registers @@ -53,7 +53,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn u128() -> u128 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:59:50 + --> $DIR/return-via-stack.rs:58:50 | LL | pub extern "C-cmse-nonsecure-entry" fn i128() -> i128 { | ^^^^ this type doesn't fit in the available registers @@ -62,7 +62,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn i128() -> i128 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:76:56 + --> $DIR/return-via-stack.rs:75:56 | LL | pub extern "C-cmse-nonsecure-entry" fn union_rust() -> ReprRustUnionU64 { | ^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -71,7 +71,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn union_rust() -> ReprRustUnionU64 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:81:53 + --> $DIR/return-via-stack.rs:80:53 | LL | pub extern "C-cmse-nonsecure-entry" fn union_c() -> ReprCUnionU64 { | ^^^^^^^^^^^^^ this type doesn't fit in the available registers diff --git a/tests/ui/issues/issue-40883.rs b/tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs index a4646d67c68..a4646d67c68 100644 --- a/tests/ui/issues/issue-40883.rs +++ b/tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs diff --git a/tests/ui/codegen/issue-99551.rs b/tests/ui/codegen/issue-99551.rs index 9bacbaa6edc..f498718310d 100644 --- a/tests/ui/codegen/issue-99551.rs +++ b/tests/ui/codegen/issue-99551.rs @@ -1,5 +1,4 @@ //@ build-pass -#![feature(trait_upcasting)] pub trait A {} pub trait B {} diff --git a/tests/ui/codemap_tests/two_files.stderr b/tests/ui/codemap_tests/two_files.stderr index d833d4944bf..3b542fdbd33 100644 --- a/tests/ui/codemap_tests/two_files.stderr +++ b/tests/ui/codemap_tests/two_files.stderr @@ -7,7 +7,8 @@ LL | impl Bar for Baz { } help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias --> $DIR/two_files_data.rs:5:1 | -LL | trait Bar = dyn Foo; +LL - type Bar = dyn Foo; +LL + trait Bar = dyn Foo; | error: aborting due to 1 previous error diff --git a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr index 0c220a13876..b682bdac034 100644 --- a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -29,7 +29,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:14:27 | LL | let _ = type_ascribe!(Box::new( { |x| (x as u8) }), Box<dyn Fn(i32) -> _>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<{closure@coerce-expect-unsized-ascribed.rs:14:39}>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<{closure@...}>` | = note: expected struct `Box<dyn Fn(i32) -> u8>` found struct `Box<{closure@$DIR/coerce-expect-unsized-ascribed.rs:14:39: 14:42}>` @@ -85,7 +85,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:22:27 | LL | let _ = type_ascribe!(&{ |x| (x as u8) }, &dyn Fn(i32) -> _); - | ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&{closure@coerce-expect-unsized-ascribed.rs:22:30}` + | ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&{closure@...}` | = note: expected reference `&dyn Fn(i32) -> u8` found reference `&{closure@$DIR/coerce-expect-unsized-ascribed.rs:22:30: 22:33}` @@ -123,7 +123,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:27:27 | LL | let _ = type_ascribe!(Box::new(|x| (x as u8)), Box<dyn Fn(i32) -> _>); - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<{closure@coerce-expect-unsized-ascribed.rs:27:36}>` + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<{closure@...}>` | = note: expected struct `Box<dyn Fn(i32) -> u8>` found struct `Box<{closure@$DIR/coerce-expect-unsized-ascribed.rs:27:36: 27:39}>` diff --git a/tests/ui/coherence/coherence-impl-trait-for-trait-dyn-compatible.stderr b/tests/ui/coherence/coherence-impl-trait-for-trait-dyn-compatible.stderr index 20257bbaf28..033bfee226f 100644 --- a/tests/ui/coherence/coherence-impl-trait-for-trait-dyn-compatible.stderr +++ b/tests/ui/coherence/coherence-impl-trait-for-trait-dyn-compatible.stderr @@ -5,7 +5,7 @@ LL | impl DynIncompatible for dyn DynIncompatible { } | ^^^^^^^^^^^^^^^^^^^ `DynIncompatible` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/coherence-impl-trait-for-trait-dyn-compatible.rs:6:45 | LL | trait DynIncompatible { fn eq(&self, other: Self); } diff --git a/tests/ui/command/need-crate-arg-ignore-tidy$x.stderr b/tests/ui/command/need-crate-arg-ignore-tidy$x.stderr deleted file mode 100644 index 28f6d31b1ce..00000000000 --- a/tests/ui/command/need-crate-arg-ignore-tidy$x.stderr +++ /dev/null @@ -1,6 +0,0 @@ -error: invalid character `'$'` in crate name: `need_crate_arg_ignore_tidy$x` - | - = help: you can either pass `--crate-name` on the command line or add `#![crate_name="…"]` to set the crate name - -error: aborting due to 1 previous error - diff --git a/tests/ui/compare-method/bad-self-type.stderr b/tests/ui/compare-method/bad-self-type.stderr index a3a31f43447..bc1587883a3 100644 --- a/tests/ui/compare-method/bad-self-type.stderr +++ b/tests/ui/compare-method/bad-self-type.stderr @@ -9,7 +9,7 @@ LL | fn poll(self, _: &mut Context<'_>) -> Poll<()> { help: change the self-receiver type to match the trait | LL | fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> { - | ~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/bad-self-type.rs:22:18 @@ -26,8 +26,9 @@ LL | fn foo(self); found signature `fn(Box<MyFuture>)` help: change the self-receiver type to match the trait | -LL | fn foo(self) {} - | ~~~~ +LL - fn foo(self: Box<Self>) {} +LL + fn foo(self) {} + | error[E0053]: method `bar` has an incompatible type for trait --> $DIR/bad-self-type.rs:24:17 diff --git a/tests/ui/compare-method/issue-90444.stderr b/tests/ui/compare-method/issue-90444.stderr index f05c9939c00..c69d63b3e30 100644 --- a/tests/ui/compare-method/issue-90444.stderr +++ b/tests/ui/compare-method/issue-90444.stderr @@ -8,8 +8,9 @@ LL | fn from(_: fn((), (), &mut ())) -> Self { found signature `fn(for<'a> fn((), (), &'a mut ())) -> A` help: change the parameter type to match the trait | -LL | fn from(_: for<'a> fn((), (), &'a ())) -> Self { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn from(_: fn((), (), &mut ())) -> Self { +LL + fn from(_: for<'a> fn((), (), &'a ())) -> Self { + | error[E0053]: method `from` has an incompatible type for trait --> $DIR/issue-90444.rs:11:16 @@ -21,8 +22,9 @@ LL | fn from(_: fn((), (), u64)) -> Self { found signature `fn(fn((), (), u64)) -> B` help: change the parameter type to match the trait | -LL | fn from(_: fn((), (), u32)) -> Self { - | ~~~~~~~~~~~~~~~ +LL - fn from(_: fn((), (), u64)) -> Self { +LL + fn from(_: fn((), (), u32)) -> Self { + | error: aborting due to 2 previous errors diff --git a/tests/ui/compare-method/region-extra-2.stderr b/tests/ui/compare-method/region-extra-2.stderr index 3f55f673117..d19d4f28f12 100644 --- a/tests/ui/compare-method/region-extra-2.stderr +++ b/tests/ui/compare-method/region-extra-2.stderr @@ -9,8 +9,9 @@ LL | fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b { | help: copy the `where` clause predicates from the trait | -LL | fn renew<'b: 'a>(self) -> &'b mut [T] where 'b: 'a { - | ~~~~~~~~~~~~ +LL - fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b { +LL + fn renew<'b: 'a>(self) -> &'b mut [T] where 'b: 'a { + | error: aborting due to 1 previous error diff --git a/tests/ui/compare-method/reordered-type-param.stderr b/tests/ui/compare-method/reordered-type-param.stderr index 1e8266e213d..536364871a3 100644 --- a/tests/ui/compare-method/reordered-type-param.stderr +++ b/tests/ui/compare-method/reordered-type-param.stderr @@ -18,8 +18,9 @@ LL | fn b<C:Clone,D>(&self, x: C) -> C; = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters help: change the parameter type to match the trait | -LL | fn b<F:Clone,G>(&self, _x: F) -> G { panic!() } - | ~ +LL - fn b<F:Clone,G>(&self, _x: G) -> G { panic!() } +LL + fn b<F:Clone,G>(&self, _x: F) -> G { panic!() } + | error: aborting due to 1 previous error diff --git a/tests/ui/conditional-compilation/cfg-attr-parse.stderr b/tests/ui/conditional-compilation/cfg-attr-parse.stderr index 759df3c90c6..1605761e591 100644 --- a/tests/ui/conditional-compilation/cfg-attr-parse.stderr +++ b/tests/ui/conditional-compilation/cfg-attr-parse.stderr @@ -7,8 +7,9 @@ LL | #[cfg_attr()] = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> help: missing condition and attribute | -LL | #[cfg_attr(condition, attribute, other_attribute, ...)] - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - #[cfg_attr()] +LL + #[cfg_attr(condition, attribute, other_attribute, ...)] + | error: expected `,`, found end of `cfg_attr` input --> $DIR/cfg-attr-parse.rs:8:17 @@ -54,8 +55,9 @@ LL | #[cfg_attr[all(),,]] | help: the delimiters should be `(` and `)` | -LL | #[cfg_attr(all(),,)] - | ~ ~ +LL - #[cfg_attr[all(),,]] +LL + #[cfg_attr(all(),,)] + | error: expected identifier, found `,` --> $DIR/cfg-attr-parse.rs:44:18 @@ -74,8 +76,9 @@ LL | #[cfg_attr{all(),,}] | help: the delimiters should be `(` and `)` | -LL | #[cfg_attr(all(),,)] - | ~ ~ +LL - #[cfg_attr{all(),,}] +LL + #[cfg_attr(all(),,)] + | error: expected identifier, found `,` --> $DIR/cfg-attr-parse.rs:50:18 diff --git a/tests/ui/confuse-field-and-method/issue-33784.stderr b/tests/ui/confuse-field-and-method/issue-33784.stderr index 59a6f4fccd8..69f569e09a4 100644 --- a/tests/ui/confuse-field-and-method/issue-33784.stderr +++ b/tests/ui/confuse-field-and-method/issue-33784.stderr @@ -10,8 +10,9 @@ LL | (p.closure)(); | + + help: there is a method `clone` with a similar name | -LL | p.clone(); - | ~~~~~ +LL - p.closure(); +LL + p.clone(); + | error[E0599]: no method named `fn_ptr` found for reference `&&Obj<{closure@$DIR/issue-33784.rs:25:43: 25:45}>` in the current scope --> $DIR/issue-33784.rs:29:7 diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.stderr index cd7f3a3c21d..c71ec24dda3 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.stderr @@ -5,14 +5,15 @@ LL | fn foo(a: &dyn ConstParamTy_) {} | ^^^^^^^^^^^^^ `ConstParamTy_` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: the trait is not dyn compatible because it uses `Self` as a type parameter help: consider using an opaque type instead | -LL | fn foo(a: &impl ConstParamTy_) {} - | ~~~~ +LL - fn foo(a: &dyn ConstParamTy_) {} +LL + fn foo(a: &impl ConstParamTy_) {} + | error[E0038]: the trait `UnsizedConstParamTy` is not dyn compatible --> $DIR/const_param_ty_dyn_compatibility.rs:9:16 @@ -21,14 +22,15 @@ LL | fn bar(a: &dyn UnsizedConstParamTy) {} | ^^^^^^^^^^^^^^^^^^^ `UnsizedConstParamTy` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: the trait is not dyn compatible because it uses `Self` as a type parameter help: consider using an opaque type instead | -LL | fn bar(a: &impl UnsizedConstParamTy) {} - | ~~~~ +LL - fn bar(a: &dyn UnsizedConstParamTy) {} +LL + fn bar(a: &impl UnsizedConstParamTy) {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/defaults/doesnt_infer.stderr b/tests/ui/const-generics/defaults/doesnt_infer.stderr index c17f57f36bc..ef39cef70cb 100644 --- a/tests/ui/const-generics/defaults/doesnt_infer.stderr +++ b/tests/ui/const-generics/defaults/doesnt_infer.stderr @@ -2,15 +2,13 @@ error[E0284]: type annotations needed for `Foo<_>` --> $DIR/doesnt_infer.rs:13:9 | LL | let foo = Foo::foo(); - | ^^^ ---------- type must be known at this point + | ^^^ --- type must be known at this point | -note: required by a const generic parameter in `Foo::<N>::foo` - --> $DIR/doesnt_infer.rs:5:6 +note: required by a const generic parameter in `Foo` + --> $DIR/doesnt_infer.rs:3:12 | -LL | impl<const N: u32> Foo<N> { - | ^^^^^^^^^^^^ required by this const generic parameter in `Foo::<N>::foo` -LL | fn foo() -> Self { - | --- required by a bound in this associated function +LL | struct Foo<const N: u32 = 2>; + | ^^^^^^^^^^^^^^^^ required by this const generic parameter in `Foo` help: consider giving `foo` an explicit type, where the value of const parameter `N` is specified | LL | let foo: Foo<N> = Foo::foo(); @@ -20,13 +18,15 @@ error[E0284]: type annotations needed for `Foo<_>` --> $DIR/doesnt_infer.rs:13:9 | LL | let foo = Foo::foo(); - | ^^^ --- type must be known at this point + | ^^^ ---------- type must be known at this point | -note: required by a const generic parameter in `Foo` - --> $DIR/doesnt_infer.rs:3:12 +note: required by a const generic parameter in `Foo::<N>::foo` + --> $DIR/doesnt_infer.rs:5:6 | -LL | struct Foo<const N: u32 = 2>; - | ^^^^^^^^^^^^^^^^ required by this const generic parameter in `Foo` +LL | impl<const N: u32> Foo<N> { + | ^^^^^^^^^^^^ required by this const generic parameter in `Foo::<N>::foo` +LL | fn foo() -> Self { + | --- required by a bound in this associated function help: consider giving `foo` an explicit type, where the value of const parameter `N` is specified | LL | let foo: Foo<N> = Foo::foo(); diff --git a/tests/ui/const-generics/early/invalid-const-arguments.stderr b/tests/ui/const-generics/early/invalid-const-arguments.stderr index cee34e3b715..86b4d006454 100644 --- a/tests/ui/const-generics/early/invalid-const-arguments.stderr +++ b/tests/ui/const-generics/early/invalid-const-arguments.stderr @@ -9,8 +9,9 @@ LL | impl Foo for A<N> {} | help: a struct with a similar name exists | -LL | impl Foo for A<A> {} - | ~ +LL - impl Foo for A<N> {} +LL + impl Foo for A<A> {} + | help: you might be missing a type parameter | LL | impl<N> Foo for A<N> {} @@ -27,8 +28,9 @@ LL | impl<const N: u8> Foo for C<N, T> {} | help: a struct with a similar name exists | -LL | impl<const N: u8> Foo for C<N, A> {} - | ~ +LL - impl<const N: u8> Foo for C<N, T> {} +LL + impl<const N: u8> Foo for C<N, A> {} + | help: you might be missing a type parameter | LL | impl<const N: u8, T> Foo for C<N, T> {} diff --git a/tests/ui/const-generics/ensure_is_evaluatable.stderr b/tests/ui/const-generics/ensure_is_evaluatable.stderr index 62f8bc34f2e..0a03ea49de1 100644 --- a/tests/ui/const-generics/ensure_is_evaluatable.stderr +++ b/tests/ui/const-generics/ensure_is_evaluatable.stderr @@ -15,7 +15,7 @@ LL | [(); N + 1]:, help: try adding a `where` bound | LL | [(); M + 1]:, [(); N + 1]: - | ~~~~~~~~~~~~~~ + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/fn_with_two_const_inputs.stderr b/tests/ui/const-generics/fn_with_two_const_inputs.stderr index c0a913a21fd..7fb79da2d61 100644 --- a/tests/ui/const-generics/fn_with_two_const_inputs.stderr +++ b/tests/ui/const-generics/fn_with_two_const_inputs.stderr @@ -15,7 +15,7 @@ LL | [(); N + 1]:, help: try adding a `where` bound | LL | [(); both(N + 1, M + 1)]:, [(); N + 1]: - | ~~~~~~~~~~~~~~ + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/forbid-non-structural_match-types.stderr b/tests/ui/const-generics/forbid-non-structural_match-types.stderr index 94afded9469..8ef629329f1 100644 --- a/tests/ui/const-generics/forbid-non-structural_match-types.stderr +++ b/tests/ui/const-generics/forbid-non-structural_match-types.stderr @@ -6,8 +6,8 @@ LL | struct D<const X: C>; | help: add `#[derive(ConstParamTy, PartialEq, Eq)]` to the struct | +LL - struct C; LL + #[derive(ConstParamTy, PartialEq, Eq)] -LL | struct C; | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_arg_infer/in-signature.stderr b/tests/ui/const-generics/generic_arg_infer/in-signature.stderr index 5999bc18204..12d84268f95 100644 --- a/tests/ui/const-generics/generic_arg_infer/in-signature.stderr +++ b/tests/ui/const-generics/generic_arg_infer/in-signature.stderr @@ -34,8 +34,9 @@ LL | const ARR_CT: [u8; _] = [0; 3]; | help: replace this with a fully-specified type | -LL | const ARR_CT: [u8; 3] = [0; 3]; - | ~~~~~~~ +LL - const ARR_CT: [u8; _] = [0; 3]; +LL + const ARR_CT: [u8; 3] = [0; 3]; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/in-signature.rs:24:25 @@ -45,8 +46,9 @@ LL | static ARR_STATIC: [u8; _] = [0; 3]; | help: replace this with a fully-specified type | -LL | static ARR_STATIC: [u8; 3] = [0; 3]; - | ~~~~~~~ +LL - static ARR_STATIC: [u8; _] = [0; 3]; +LL + static ARR_STATIC: [u8; 3] = [0; 3]; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/in-signature.rs:26:23 @@ -56,8 +58,9 @@ LL | const TY_CT: Bar<i32, _> = Bar::<i32, 3>(0); | help: replace this with a fully-specified type | -LL | const TY_CT: Bar<i32, 3> = Bar::<i32, 3>(0); - | ~~~~~~~~~~~ +LL - const TY_CT: Bar<i32, _> = Bar::<i32, 3>(0); +LL + const TY_CT: Bar<i32, 3> = Bar::<i32, 3>(0); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/in-signature.rs:28:28 @@ -67,8 +70,9 @@ LL | static TY_STATIC: Bar<i32, _> = Bar::<i32, 3>(0); | help: replace this with a fully-specified type | -LL | static TY_STATIC: Bar<i32, 3> = Bar::<i32, 3>(0); - | ~~~~~~~~~~~ +LL - static TY_STATIC: Bar<i32, _> = Bar::<i32, 3>(0); +LL + static TY_STATIC: Bar<i32, 3> = Bar::<i32, 3>(0); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/in-signature.rs:30:24 @@ -80,8 +84,9 @@ LL | const TY_CT_MIXED: Bar<_, _> = Bar::<i32, 3>(0); | help: replace this with a fully-specified type | -LL | const TY_CT_MIXED: Bar<i32, 3> = Bar::<i32, 3>(0); - | ~~~~~~~~~~~ +LL - const TY_CT_MIXED: Bar<_, _> = Bar::<i32, 3>(0); +LL + const TY_CT_MIXED: Bar<i32, 3> = Bar::<i32, 3>(0); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/in-signature.rs:32:29 @@ -93,8 +98,9 @@ LL | static TY_STATIC_MIXED: Bar<_, _> = Bar::<i32, 3>(0); | help: replace this with a fully-specified type | -LL | static TY_STATIC_MIXED: Bar<i32, 3> = Bar::<i32, 3>(0); - | ~~~~~~~~~~~ +LL - static TY_STATIC_MIXED: Bar<_, _> = Bar::<i32, 3>(0); +LL + static TY_STATIC_MIXED: Bar<i32, 3> = Bar::<i32, 3>(0); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types --> $DIR/in-signature.rs:51:23 diff --git a/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr b/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr index b88fe966b77..b07e1f29d0d 100644 --- a/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr +++ b/tests/ui/const-generics/generic_arg_infer/issue-91614.stderr @@ -2,9 +2,9 @@ error[E0284]: type annotations needed for `Mask<_, _>` --> $DIR/issue-91614.rs:6:9 | LL | let y = Mask::<_, _>::splat(false); - | ^ -------------------------- type must be known at this point + | ^ ------------ type must be known at this point | -note: required by a const generic parameter in `Mask::<T, N>::splat` +note: required by a const generic parameter in `Mask` --> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/masks.rs:LL:COL help: consider giving `y` an explicit type, where the value of const parameter `N` is specified | @@ -15,9 +15,9 @@ error[E0284]: type annotations needed for `Mask<_, _>` --> $DIR/issue-91614.rs:6:9 | LL | let y = Mask::<_, _>::splat(false); - | ^ ------------ type must be known at this point + | ^ -------------------------- type must be known at this point | -note: required by a const generic parameter in `Mask` +note: required by a const generic parameter in `Mask::<T, N>::splat` --> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/masks.rs:LL:COL help: consider giving `y` an explicit type, where the value of const parameter `N` is specified | diff --git a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr index 3622ef16a96..8d0b2e91473 100644 --- a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr +++ b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr @@ -17,7 +17,7 @@ LL | fn assert_impl<T: Trait>() {} help: try adding a `where` bound | LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:17:5 @@ -52,7 +52,7 @@ LL | fn assert_impl<T: Trait>() {} help: try adding a `where` bound | LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:20:5 @@ -115,7 +115,7 @@ LL | fn assert_impl<T: Trait>() {} help: try adding a `where` bound | LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:35:5 @@ -150,7 +150,7 @@ LL | fn assert_impl<T: Trait>() {} help: try adding a `where` bound | LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:38:5 diff --git a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr index f3a38fcc005..6cf4e881ada 100644 --- a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr +++ b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr @@ -7,7 +7,7 @@ LL | bar::<{ T::ASSOC }>(); help: try adding a `where` bound | LL | fn foo<T: Trait, U: Trait>() where [(); U::ASSOC]:, [(); { T::ASSOC }]: { - | ~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr index 4d1fb02b59e..3c79cbeb730 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr @@ -27,7 +27,7 @@ LL | foo::<_, L>([(); L + 1 + L]); help: try adding a `where` bound | LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | ~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++ error: unconstrained generic constant --> $DIR/issue_114151.rs:17:17 diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr index 99eab935a09..af4543e7ef2 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr @@ -16,7 +16,7 @@ LL | foo::<_, L>([(); L + 1 + L]); help: try adding a `where` bound | LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | ~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/dyn-compatibility-err-ret.stderr b/tests/ui/const-generics/generic_const_exprs/dyn-compatibility-err-ret.stderr index 763bc626c9d..8bc6ef093d0 100644 --- a/tests/ui/const-generics/generic_const_exprs/dyn-compatibility-err-ret.stderr +++ b/tests/ui/const-generics/generic_const_exprs/dyn-compatibility-err-ret.stderr @@ -5,7 +5,7 @@ LL | fn use_dyn(v: &dyn Foo) { | ^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-compatibility-err-ret.rs:8:8 | LL | trait Foo { @@ -24,7 +24,7 @@ LL | v.test(); | ^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-compatibility-err-ret.rs:8:8 | LL | trait Foo { diff --git a/tests/ui/const-generics/generic_const_exprs/dyn-compatibility-err-where-bounds.stderr b/tests/ui/const-generics/generic_const_exprs/dyn-compatibility-err-where-bounds.stderr index 56678e4e9af..f5eaaa37916 100644 --- a/tests/ui/const-generics/generic_const_exprs/dyn-compatibility-err-where-bounds.stderr +++ b/tests/ui/const-generics/generic_const_exprs/dyn-compatibility-err-where-bounds.stderr @@ -5,7 +5,7 @@ LL | fn use_dyn(v: &dyn Foo) { | ^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-compatibility-err-where-bounds.rs:8:8 | LL | trait Foo { @@ -22,7 +22,7 @@ LL | v.test(); | ^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-compatibility-err-where-bounds.rs:8:8 | LL | trait Foo { diff --git a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr index 80d711ca844..b9db7461699 100644 --- a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr +++ b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr @@ -10,7 +10,7 @@ LL | let f: F = async { 1 }; help: a trait with a similar name exists | LL | let f: Fn = async { 1 }; - | ~~ + | + help: you might be missing a type parameter | LL | fn f<T, F>( @@ -28,8 +28,9 @@ LL | ) -> impl Iterator<Item = dyn SubAssign> { | +++ help: you might have meant to write a bound here | -LL | ) -> impl Iterator<Item: SubAssign> { - | ~ +LL - ) -> impl Iterator<Item = SubAssign> { +LL + ) -> impl Iterator<Item: SubAssign> { + | error[E0782]: expected a type, found a trait --> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:27 @@ -44,8 +45,9 @@ LL | ) -> impl Iterator<Item = dyn SubAssign> { | +++ help: you might have meant to write a bound here | -LL | ) -> impl Iterator<Item: SubAssign> { - | ~ +LL - ) -> impl Iterator<Item = SubAssign> { +LL + ) -> impl Iterator<Item: SubAssign> { + | error[E0277]: `()` is not an iterator --> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:6 diff --git a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr index bd1811bd2cc..57b61006631 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr @@ -99,7 +99,7 @@ LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {} | ^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-102768.rs:5:10 | LL | trait X { diff --git a/tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr b/tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr index 3739637c279..6b79b32d13e 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr @@ -22,15 +22,13 @@ error[E0284]: type annotations needed for `ArrayHolder<_>` --> $DIR/issue-62504.rs:26:9 | LL | let mut array = ArrayHolder::new(); - | ^^^^^^^^^ ------------------ type must be known at this point + | ^^^^^^^^^ ----------- type must be known at this point | -note: required by a const generic parameter in `ArrayHolder::<X>::new` - --> $DIR/issue-62504.rs:16:6 +note: required by a const generic parameter in `ArrayHolder` + --> $DIR/issue-62504.rs:14:20 | -LL | impl<const X: usize> ArrayHolder<X> { - | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder::<X>::new` -LL | pub const fn new() -> Self { - | --- required by a bound in this associated function +LL | struct ArrayHolder<const X: usize>([u32; X]); + | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder` help: consider giving `array` an explicit type, where the value of const parameter `X` is specified | LL | let mut array: ArrayHolder<X> = ArrayHolder::new(); @@ -40,13 +38,15 @@ error[E0284]: type annotations needed for `ArrayHolder<_>` --> $DIR/issue-62504.rs:26:9 | LL | let mut array = ArrayHolder::new(); - | ^^^^^^^^^ ----------- type must be known at this point + | ^^^^^^^^^ ------------------ type must be known at this point | -note: required by a const generic parameter in `ArrayHolder` - --> $DIR/issue-62504.rs:14:20 +note: required by a const generic parameter in `ArrayHolder::<X>::new` + --> $DIR/issue-62504.rs:16:6 | -LL | struct ArrayHolder<const X: usize>([u32; X]); - | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder` +LL | impl<const X: usize> ArrayHolder<X> { + | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder::<X>::new` +LL | pub const fn new() -> Self { + | --- required by a bound in this associated function help: consider giving `array` an explicit type, where the value of const parameter `X` is specified | LL | let mut array: ArrayHolder<X> = ArrayHolder::new(); diff --git a/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr b/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr index 8efd433fd1f..c53a6598d34 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-62504.min.stderr @@ -24,15 +24,13 @@ error[E0284]: type annotations needed for `ArrayHolder<_>` --> $DIR/issue-62504.rs:26:9 | LL | let mut array = ArrayHolder::new(); - | ^^^^^^^^^ ------------------ type must be known at this point + | ^^^^^^^^^ ----------- type must be known at this point | -note: required by a const generic parameter in `ArrayHolder::<X>::new` - --> $DIR/issue-62504.rs:16:6 +note: required by a const generic parameter in `ArrayHolder` + --> $DIR/issue-62504.rs:14:20 | -LL | impl<const X: usize> ArrayHolder<X> { - | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder::<X>::new` -LL | pub const fn new() -> Self { - | --- required by a bound in this associated function +LL | struct ArrayHolder<const X: usize>([u32; X]); + | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder` help: consider giving `array` an explicit type, where the value of const parameter `X` is specified | LL | let mut array: ArrayHolder<X> = ArrayHolder::new(); @@ -42,13 +40,15 @@ error[E0284]: type annotations needed for `ArrayHolder<_>` --> $DIR/issue-62504.rs:26:9 | LL | let mut array = ArrayHolder::new(); - | ^^^^^^^^^ ----------- type must be known at this point + | ^^^^^^^^^ ------------------ type must be known at this point | -note: required by a const generic parameter in `ArrayHolder` - --> $DIR/issue-62504.rs:14:20 +note: required by a const generic parameter in `ArrayHolder::<X>::new` + --> $DIR/issue-62504.rs:16:6 | -LL | struct ArrayHolder<const X: usize>([u32; X]); - | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder` +LL | impl<const X: usize> ArrayHolder<X> { + | ^^^^^^^^^^^^^^ required by this const generic parameter in `ArrayHolder::<X>::new` +LL | pub const fn new() -> Self { + | --- required by a bound in this associated function help: consider giving `array` an explicit type, where the value of const parameter `X` is specified | LL | let mut array: ArrayHolder<X> = ArrayHolder::new(); diff --git a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr index d90380396c1..07fd231cb7a 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr @@ -4,7 +4,7 @@ error: internal compiler error: compiler/rustc_const_eval/src/interpret/operator Box<dyn Any> query stack during panic: -#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at $DIR/issue-80742.rs:26:1: 28:32>::{constant#0}` +#0 [eval_to_allocation_raw] const-evaluating + checking `Inline::{constant#0}` #1 [eval_to_valtree] evaluating type-level constant ... and 2 other queries... use `env RUST_BACKTRACE=1` to see the full query stack error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr index 4004ad19032..2b4c7f4bcff 100644 --- a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr +++ b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr @@ -6,8 +6,9 @@ LL | let _: u32 = 5i32.try_into::<32>().unwrap(); | help: consider moving this generic argument to the `TryInto` trait, which takes up to 1 argument | -LL | let _: u32 = TryInto::<32>::try_into(5i32).unwrap(); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _: u32 = 5i32.try_into::<32>().unwrap(); +LL + let _: u32 = TryInto::<32>::try_into(5i32).unwrap(); + | help: remove the unnecessary generics | LL - let _: u32 = 5i32.try_into::<32>().unwrap(); diff --git a/tests/ui/const-generics/issue-80471.stderr b/tests/ui/const-generics/issue-80471.stderr index a8514c5cc07..8cf3d68e5d6 100644 --- a/tests/ui/const-generics/issue-80471.stderr +++ b/tests/ui/const-generics/issue-80471.stderr @@ -6,8 +6,8 @@ LL | fn foo<const N: Nat>() {} | help: add `#[derive(ConstParamTy)]` to the struct | +LL - enum Nat { LL + #[derive(ConstParamTy)] -LL | enum Nat { | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-87493.stderr b/tests/ui/const-generics/issues/issue-87493.stderr index 73bd6ed73e6..42d32a0ee05 100644 --- a/tests/ui/const-generics/issues/issue-87493.stderr +++ b/tests/ui/const-generics/issues/issue-87493.stderr @@ -6,8 +6,9 @@ LL | T: MyTrait<Assoc == S::Assoc>, | help: if you meant to use an associated type binding, replace `==` with `=` | -LL | T: MyTrait<Assoc = S::Assoc>, - | ~ +LL - T: MyTrait<Assoc == S::Assoc>, +LL + T: MyTrait<Assoc = S::Assoc>, + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-87493.rs:8:8 diff --git a/tests/ui/const-generics/issues/issue-88119.stderr b/tests/ui/const-generics/issues/issue-88119.stderr index f219c90849a..c497f1b6d0b 100644 --- a/tests/ui/const-generics/issues/issue-88119.stderr +++ b/tests/ui/const-generics/issues/issue-88119.stderr @@ -6,35 +6,29 @@ LL | #![feature(const_trait_impl, generic_const_exprs)] | = help: remove one of these features -error[E0284]: type annotations needed: cannot normalize `<&T as ConstName>::{constant#0}` - --> $DIR/issue-88119.rs:19:49 +error[E0284]: type annotations needed: cannot satisfy `the constant `name_len::<T>()` can be evaluated` + --> $DIR/issue-88119.rs:21:5 | -LL | impl<T: ?Sized + ConstName> const ConstName for &T - | ^^ cannot normalize `<&T as ConstName>::{constant#0}` +LL | [(); name_len::<T>()]:, + | ^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `the constant `name_len::<T>()` can be evaluated` | -note: required for `&T` to implement `~const ConstName` - --> $DIR/issue-88119.rs:19:35 +note: required by a bound in `<&T as ConstName>` + --> $DIR/issue-88119.rs:21:10 | -LL | impl<T: ?Sized + ConstName> const ConstName for &T - | ^^^^^^^^^ ^^ -LL | where LL | [(); name_len::<T>()]:, - | --------------------- unsatisfied trait bound introduced here + | ^^^^^^^^^^^^^^^ required by this bound in `<&T as ConstName>` -error[E0284]: type annotations needed: cannot normalize `<&mut T as ConstName>::{constant#0}` - --> $DIR/issue-88119.rs:26:49 +error[E0284]: type annotations needed: cannot satisfy `the constant `name_len::<T>()` can be evaluated` + --> $DIR/issue-88119.rs:28:5 | -LL | impl<T: ?Sized + ConstName> const ConstName for &mut T - | ^^^^^^ cannot normalize `<&mut T as ConstName>::{constant#0}` +LL | [(); name_len::<T>()]:, + | ^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `the constant `name_len::<T>()` can be evaluated` | -note: required for `&mut T` to implement `~const ConstName` - --> $DIR/issue-88119.rs:26:35 +note: required by a bound in `<&mut T as ConstName>` + --> $DIR/issue-88119.rs:28:10 | -LL | impl<T: ?Sized + ConstName> const ConstName for &mut T - | ^^^^^^^^^ ^^^^^^ -LL | where LL | [(); name_len::<T>()]:, - | --------------------- unsatisfied trait bound introduced here + | ^^^^^^^^^^^^^^^ required by this bound in `<&mut T as ConstName>` error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/issues/issue-97278.stderr b/tests/ui/const-generics/issues/issue-97278.stderr index 47e6bf1df4d..4894ddb7b8d 100644 --- a/tests/ui/const-generics/issues/issue-97278.stderr +++ b/tests/ui/const-generics/issues/issue-97278.stderr @@ -6,8 +6,8 @@ LL | fn test<const BAR: Bar>() {} | help: add `#[derive(ConstParamTy)]` to the struct | +LL - enum Bar { LL + #[derive(ConstParamTy)] -LL | enum Bar { | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/legacy-const-generics-bad.stderr b/tests/ui/const-generics/legacy-const-generics-bad.stderr index e9ea22e472c..3a5fa417075 100644 --- a/tests/ui/const-generics/legacy-const-generics-bad.stderr +++ b/tests/ui/const-generics/legacy-const-generics-bad.stderr @@ -6,8 +6,9 @@ LL | legacy_const_generics::foo(0, a, 2); | help: consider using `const` instead of `let` | -LL | const a: /* Type */ = 1; - | ~~~~~ ++++++++++++ +LL - let a = 1; +LL + const a: /* Type */ = 1; + | error: generic parameters may not be used in const operations --> $DIR/legacy-const-generics-bad.rs:12:35 diff --git a/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.rs b/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.rs new file mode 100644 index 00000000000..1c3274f6a37 --- /dev/null +++ b/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.rs @@ -0,0 +1,13 @@ +// Make sure we don't ICE when encountering an fn item during lowering in mGCA. + +#![feature(min_generic_const_args)] +//~^ WARN the feature `min_generic_const_args` is incomplete + +trait A<T> {} + +impl A<[usize; fn_item]> for () {} +//~^ ERROR the constant `fn_item` is not of type `usize` + +fn fn_item() {} + +fn main() {} diff --git a/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.stderr b/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.stderr new file mode 100644 index 00000000000..89fc8270e3e --- /dev/null +++ b/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.stderr @@ -0,0 +1,19 @@ +warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/unexpected-fn-item-in-array.rs:3:12 + | +LL | #![feature(min_generic_const_args)] + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information + = note: `#[warn(incomplete_features)]` on by default + +error: the constant `fn_item` is not of type `usize` + --> $DIR/unexpected-fn-item-in-array.rs:8:6 + | +LL | impl A<[usize; fn_item]> for () {} + | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found fn item + | + = note: the length of array `[usize; fn_item]` must be type `usize` + +error: aborting due to 1 previous error; 1 warning emitted + diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr index 78cddcc234c..d435af07db2 100644 --- a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr +++ b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr @@ -16,8 +16,9 @@ LL | impl Foo<N = 3> for Bar { | help: to use `3` as a generic argument specify it directly | -LL | impl Foo<3> for Bar { - | ~ +LL - impl Foo<N = 3> for Bar { +LL + impl Foo<3> for Bar { + | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr b/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr index 387eb226e70..f852c14b178 100644 --- a/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr +++ b/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr @@ -28,8 +28,9 @@ LL | impl Foo<N = const 3> for Bar { | help: to use `3` as a generic argument specify it directly | -LL | impl Foo<3> for Bar { - | ~ +LL - impl Foo<N = const 3> for Bar { +LL + impl Foo<3> for Bar { + | error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/std/const-generics-range.full.stderr b/tests/ui/const-generics/std/const-generics-range.full.stderr index 5bf48ad7385..2b5c63e6643 100644 --- a/tests/ui/const-generics/std/const-generics-range.full.stderr +++ b/tests/ui/const-generics/std/const-generics-range.full.stderr @@ -4,7 +4,7 @@ error[E0741]: `std::ops::Range<usize>` must implement `ConstParamTy` to be used LL | struct _Range<const R: std::ops::Range<usize>>; | ^^^^^^^^^^^^^^^^^^^^^^ -error[E0741]: `RangeFrom<usize>` must implement `ConstParamTy` to be used as the type of a const generic parameter +error[E0741]: `std::ops::RangeFrom<usize>` must implement `ConstParamTy` to be used as the type of a const generic parameter --> $DIR/const-generics-range.rs:13:28 | LL | struct _RangeFrom<const R: std::ops::RangeFrom<usize>>; @@ -16,7 +16,7 @@ error[E0741]: `RangeFull` must implement `ConstParamTy` to be used as the type o LL | struct _RangeFull<const R: std::ops::RangeFull>; | ^^^^^^^^^^^^^^^^^^^ -error[E0741]: `RangeInclusive<usize>` must implement `ConstParamTy` to be used as the type of a const generic parameter +error[E0741]: `std::ops::RangeInclusive<usize>` must implement `ConstParamTy` to be used as the type of a const generic parameter --> $DIR/const-generics-range.rs:24:33 | LL | struct _RangeInclusive<const R: std::ops::RangeInclusive<usize>>; diff --git a/tests/ui/const-generics/std/const-generics-range.min.stderr b/tests/ui/const-generics/std/const-generics-range.min.stderr index fd23b9b248a..04e3fe74453 100644 --- a/tests/ui/const-generics/std/const-generics-range.min.stderr +++ b/tests/ui/const-generics/std/const-generics-range.min.stderr @@ -10,7 +10,7 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more LL + #![feature(adt_const_params)] | -error: `RangeFrom<usize>` is forbidden as the type of a const generic parameter +error: `std::ops::RangeFrom<usize>` is forbidden as the type of a const generic parameter --> $DIR/const-generics-range.rs:13:28 | LL | struct _RangeFrom<const R: std::ops::RangeFrom<usize>>; @@ -34,7 +34,7 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more LL + #![feature(adt_const_params)] | -error: `RangeInclusive<usize>` is forbidden as the type of a const generic parameter +error: `std::ops::RangeInclusive<usize>` is forbidden as the type of a const generic parameter --> $DIR/const-generics-range.rs:24:33 | LL | struct _RangeInclusive<const R: std::ops::RangeInclusive<usize>>; diff --git a/tests/ui/const-generics/std/const-generics-range.rs b/tests/ui/const-generics/std/const-generics-range.rs index f959f1e2949..3a238ed177e 100644 --- a/tests/ui/const-generics/std/const-generics-range.rs +++ b/tests/ui/const-generics/std/const-generics-range.rs @@ -11,7 +11,7 @@ const RANGE : _Range<{ 0 .. 1000 }> = _Range; // `RangeFrom` should be usable within const generics: struct _RangeFrom<const R: std::ops::RangeFrom<usize>>; -//[min]~^ ERROR `RangeFrom<usize>` is forbidden +//[min]~^ ERROR `std::ops::RangeFrom<usize>` is forbidden const RANGE_FROM : _RangeFrom<{ 0 .. }> = _RangeFrom; // `RangeFull` should be usable within const generics: @@ -22,7 +22,7 @@ const RANGE_FULL : _RangeFull<{ .. }> = _RangeFull; // Regression test for #70155 // `RangeInclusive` should be usable within const generics: struct _RangeInclusive<const R: std::ops::RangeInclusive<usize>>; -//[min]~^ ERROR `RangeInclusive<usize>` is forbidden +//[min]~^ ERROR `std::ops::RangeInclusive<usize>` is forbidden const RANGE_INCLUSIVE : _RangeInclusive<{ 0 ..= 999 }> = _RangeInclusive; // `RangeTo` should be usable within const generics: diff --git a/tests/ui/const-generics/type-dependent/type-mismatch.full.stderr b/tests/ui/const-generics/type-dependent/type-mismatch.full.stderr index 4fce1aede95..95d20de1b43 100644 --- a/tests/ui/const-generics/type-dependent/type-mismatch.full.stderr +++ b/tests/ui/const-generics/type-dependent/type-mismatch.full.stderr @@ -6,8 +6,9 @@ LL | assert_eq!(R.method::<1u16>(), 1); | help: change the type of the numeric literal from `u16` to `u8` | -LL | assert_eq!(R.method::<1u8>(), 1); - | ~~ +LL - assert_eq!(R.method::<1u16>(), 1); +LL + assert_eq!(R.method::<1u8>(), 1); + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/type-dependent/type-mismatch.min.stderr b/tests/ui/const-generics/type-dependent/type-mismatch.min.stderr index 4fce1aede95..95d20de1b43 100644 --- a/tests/ui/const-generics/type-dependent/type-mismatch.min.stderr +++ b/tests/ui/const-generics/type-dependent/type-mismatch.min.stderr @@ -6,8 +6,9 @@ LL | assert_eq!(R.method::<1u16>(), 1); | help: change the type of the numeric literal from `u16` to `u8` | -LL | assert_eq!(R.method::<1u8>(), 1); - | ~~ +LL - assert_eq!(R.method::<1u16>(), 1); +LL + assert_eq!(R.method::<1u8>(), 1); + | error: aborting due to 1 previous error diff --git a/tests/ui/const-ptr/forbidden_slices.stderr b/tests/ui/const-ptr/forbidden_slices.stderr index fad078ad2b2..2e0c04dcf1e 100644 --- a/tests/ui/const-ptr/forbidden_slices.stderr +++ b/tests/ui/const-ptr/forbidden_slices.stderr @@ -190,7 +190,7 @@ LL | from_ptr_range(ptr..ptr.add(1)) error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: `ptr_offset_from_unsigned` called on pointers into different allocations + = note: `ptr_offset_from_unsigned` called on two different pointers that are not both derived from the same allocation | note: inside `std::ptr::const_ptr::<impl *const u32>::sub_ptr` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL @@ -205,7 +205,7 @@ LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).ad error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: `ptr_offset_from_unsigned` called on pointers into different allocations + = note: `ptr_offset_from_unsigned` called on two different pointers that are not both derived from the same allocation | note: inside `std::ptr::const_ptr::<impl *const u32>::sub_ptr` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL diff --git a/tests/ui/consts/assoc-const-elided-lifetime.stderr b/tests/ui/consts/assoc-const-elided-lifetime.stderr index 3e847298c35..0c3e455eb2d 100644 --- a/tests/ui/consts/assoc-const-elided-lifetime.stderr +++ b/tests/ui/consts/assoc-const-elided-lifetime.stderr @@ -18,8 +18,9 @@ LL | #![deny(elided_lifetimes_in_associated_constant)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the `'static` lifetime | -LL | const FOO: Foo<'static> = Foo { x: PhantomData::<&()> }; - | ~~~~~~~ +LL - const FOO: Foo<'_> = Foo { x: PhantomData::<&()> }; +LL + const FOO: Foo<'static> = Foo { x: PhantomData::<&()> }; + | error: `&` without an explicit lifetime name cannot be used here --> $DIR/assoc-const-elided-lifetime.rs:14:16 diff --git a/tests/ui/consts/bad-array-size-in-type-err.rs b/tests/ui/consts/bad-array-size-in-type-err.rs index cb02ad3205d..0490a9d3620 100644 --- a/tests/ui/consts/bad-array-size-in-type-err.rs +++ b/tests/ui/consts/bad-array-size-in-type-err.rs @@ -8,3 +8,14 @@ fn main() { //~^ ERROR mismatched types //~| ERROR the constant `2` is not of type `usize` } + +fn iter(val: BadArraySize::<2>) { + for _ in val.arr {} + //~^ ERROR the constant `2` is not of type `usize` + //~| ERROR `[i32; 2]` is not an iterator +} + +// issue #131102 +pub struct Blorb<const N: u16>([String; N]); //~ ERROR the constant `N` is not of type `usize` +pub struct Wrap(Blorb<0>); +pub const fn i(_: Wrap) {} //~ ERROR destructor of `Wrap` cannot be evaluated at compile-time diff --git a/tests/ui/consts/bad-array-size-in-type-err.stderr b/tests/ui/consts/bad-array-size-in-type-err.stderr index c3ff216432e..84e16f8d931 100644 --- a/tests/ui/consts/bad-array-size-in-type-err.stderr +++ b/tests/ui/consts/bad-array-size-in-type-err.stderr @@ -6,6 +6,14 @@ LL | arr: [i32; N], | = note: the length of array `[i32; N]` must be type `usize` +error: the constant `N` is not of type `usize` + --> $DIR/bad-array-size-in-type-err.rs:19:32 + | +LL | pub struct Blorb<const N: u16>([String; N]); + | ^^^^^^^^^^^ expected `usize`, found `u16` + | + = note: the length of array `[String; N]` must be type `usize` + error[E0308]: mismatched types --> $DIR/bad-array-size-in-type-err.rs:7:38 | @@ -20,6 +28,37 @@ LL | let _ = BadArraySize::<2> { arr: [0, 0, 0] }; | = note: the length of array `[i32; 2]` must be type `usize` -error: aborting due to 3 previous errors +error: the constant `2` is not of type `usize` + --> $DIR/bad-array-size-in-type-err.rs:13:14 + | +LL | for _ in val.arr {} + | ^^^^^^^ expected `usize`, found `u8` + | + = note: the length of array `[i32; 2]` must be type `usize` + +error[E0277]: `[i32; 2]` is not an iterator + --> $DIR/bad-array-size-in-type-err.rs:13:14 + | +LL | for _ in val.arr {} + | ^^^^^^^ `[i32; 2]` is not an iterator; try calling `.into_iter()` or `.iter()` + | + = help: the trait `IntoIterator` is not implemented for `[i32; 2]` + = help: the following other types implement trait `IntoIterator`: + &[T; N] + &[T] + &mut [T; N] + &mut [T] + [T; N] + +error[E0493]: destructor of `Wrap` cannot be evaluated at compile-time + --> $DIR/bad-array-size-in-type-err.rs:21:16 + | +LL | pub const fn i(_: Wrap) {} + | ^ - value is dropped here + | | + | the destructor for this type cannot be evaluated in constant functions + +error: aborting due to 7 previous errors -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0277, E0308, E0493. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr index 272c2f045e1..a3d5054ced3 100644 --- a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr +++ b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr @@ -13,8 +13,9 @@ LL | struct Bar; | help: create an inline `const` block | -LL | let _: [Option<Bar>; 2] = [const { no_copy() }; 2]; - | ~~~~~~~~~~~~~~~~~~~ +LL - let _: [Option<Bar>; 2] = [no_copy(); 2]; +LL + let _: [Option<Bar>; 2] = [const { no_copy() }; 2]; + | error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-eval/parse_ints.stderr b/tests/ui/consts/const-eval/parse_ints.stderr index ec9249ece8e..189d3c3958b 100644 --- a/tests/ui/consts/const-eval/parse_ints.stderr +++ b/tests/ui/consts/const-eval/parse_ints.stderr @@ -1,8 +1,10 @@ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/num/mod.rs:LL:COL | - = note: the evaluated program panicked at 'from_str_radix_int: must lie in the range `[2, 36]`', $SRC_DIR/core/src/num/mod.rs:LL:COL + = note: the evaluated program panicked at 'from_ascii_radix: radix must lie in the range `[2, 36]`', $SRC_DIR/core/src/num/mod.rs:LL:COL | +note: inside `core::num::<impl u64>::from_ascii_radix` + --> $SRC_DIR/core/src/num/mod.rs:LL:COL note: inside `core::num::<impl u64>::from_str_radix` --> $SRC_DIR/core/src/num/mod.rs:LL:COL note: inside `_TOO_LOW` @@ -10,13 +12,15 @@ note: inside `_TOO_LOW` | LL | const _TOO_LOW: () = { u64::from_str_radix("12345ABCD", 1); }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `from_str_radix` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `from_str_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/num/mod.rs:LL:COL | - = note: the evaluated program panicked at 'from_str_radix_int: must lie in the range `[2, 36]`', $SRC_DIR/core/src/num/mod.rs:LL:COL + = note: the evaluated program panicked at 'from_ascii_radix: radix must lie in the range `[2, 36]`', $SRC_DIR/core/src/num/mod.rs:LL:COL | +note: inside `core::num::<impl u64>::from_ascii_radix` + --> $SRC_DIR/core/src/num/mod.rs:LL:COL note: inside `core::num::<impl u64>::from_str_radix` --> $SRC_DIR/core/src/num/mod.rs:LL:COL note: inside `_TOO_HIGH` @@ -24,7 +28,7 @@ note: inside `_TOO_HIGH` | LL | const _TOO_HIGH: () = { u64::from_str_radix("12345ABCD", 37); }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `from_str_radix` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `from_str_int_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-needs_drop-monomorphic.stderr b/tests/ui/consts/const-needs_drop-monomorphic.stderr index 446d34810c5..17f197cdd5d 100644 --- a/tests/ui/consts/const-needs_drop-monomorphic.stderr +++ b/tests/ui/consts/const-needs_drop-monomorphic.stderr @@ -1,12 +1,3 @@ -error[E0599]: no function or associated item named `assert` found for struct `Bool<{ std::mem::needs_drop::<T>() }>` in the current scope - --> $DIR/const-needs_drop-monomorphic.rs:11:46 - | -LL | struct Bool<const B: bool> {} - | -------------------------- function or associated item `assert` not found for this struct -... -LL | Bool::<{ std::mem::needs_drop::<T>() }>::assert(); - | ^^^^^^ function or associated item cannot be called on `Bool<{ std::mem::needs_drop::<T>() }>` due to unsatisfied trait bounds - error: unconstrained generic constant --> $DIR/const-needs_drop-monomorphic.rs:11:5 | @@ -18,6 +9,15 @@ help: try adding a `where` bound LL | fn f<T>() where [(); { std::mem::needs_drop::<T>() } as usize]: { | +++++++++++++++++++++++++++++++++++++++++++++++++++++ +error[E0599]: no function or associated item named `assert` found for struct `Bool<{ std::mem::needs_drop::<T>() }>` in the current scope + --> $DIR/const-needs_drop-monomorphic.rs:11:46 + | +LL | struct Bool<const B: bool> {} + | -------------------------- function or associated item `assert` not found for this struct +... +LL | Bool::<{ std::mem::needs_drop::<T>() }>::assert(); + | ^^^^^^ function or associated item cannot be called on `Bool<{ std::mem::needs_drop::<T>() }>` due to unsatisfied trait bounds + error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/consts/const-pattern-irrefutable.stderr b/tests/ui/consts/const-pattern-irrefutable.stderr index 646426c9426..06bd01bff79 100644 --- a/tests/ui/consts/const-pattern-irrefutable.stderr +++ b/tests/ui/consts/const-pattern-irrefutable.stderr @@ -13,7 +13,7 @@ LL | let a = 4; help: introduce a variable instead | LL | let a_var = 4; - | ~~~~~ + | ++++ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:28:9 @@ -29,8 +29,9 @@ LL | let c = 4; = note: the matched value is of type `u8` help: introduce a variable instead | -LL | let b_var = 4; - | ~~~~~ +LL - let c = 4; +LL + let b_var = 4; + | error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:32:9 @@ -47,7 +48,7 @@ LL | let d = (4, 4); help: introduce a variable instead | LL | let d_var = (4, 4); - | ~~~~~ + | ++++ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:36:9 @@ -69,7 +70,7 @@ LL | struct S { help: introduce a variable instead | LL | let e_var = S { - | ~~~~~ + | ++++ error: aborting due to 4 previous errors diff --git a/tests/ui/consts/const-slice-array-deref.rs b/tests/ui/consts/const-slice-array-deref.rs new file mode 100644 index 00000000000..99563ac968c --- /dev/null +++ b/tests/ui/consts/const-slice-array-deref.rs @@ -0,0 +1,8 @@ +const ONE: [u16] = [1]; +//~^ ERROR the size for values of type `[u16]` cannot be known at compilation time +//~| ERROR mismatched types + +const TWO: &'static u16 = &ONE[0]; +//~^ ERROR cannot move a value of type `[u16]` + +fn main() {} diff --git a/tests/ui/consts/const-slice-array-deref.stderr b/tests/ui/consts/const-slice-array-deref.stderr new file mode 100644 index 00000000000..346685380cc --- /dev/null +++ b/tests/ui/consts/const-slice-array-deref.stderr @@ -0,0 +1,24 @@ +error[E0277]: the size for values of type `[u16]` cannot be known at compilation time + --> $DIR/const-slice-array-deref.rs:1:12 + | +LL | const ONE: [u16] = [1]; + | ^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[u16]` + +error[E0308]: mismatched types + --> $DIR/const-slice-array-deref.rs:1:20 + | +LL | const ONE: [u16] = [1]; + | ^^^ expected `[u16]`, found `[u16; 1]` + +error[E0161]: cannot move a value of type `[u16]` + --> $DIR/const-slice-array-deref.rs:5:28 + | +LL | const TWO: &'static u16 = &ONE[0]; + | ^^^ the size of `[u16]` cannot be statically determined + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0161, E0277, E0308. +For more information about an error, try `rustc --explain E0161`. diff --git a/tests/ui/consts/const-unsized.rs b/tests/ui/consts/const-unsized.rs index 18682aa6eb6..e8af3323ceb 100644 --- a/tests/ui/consts/const-unsized.rs +++ b/tests/ui/consts/const-unsized.rs @@ -2,19 +2,19 @@ use std::fmt::Debug; const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync)); //~^ ERROR the size for values of type -//~| ERROR the size for values of type +//~| ERROR cannot move out of a shared reference const CONST_FOO: str = *"foo"; //~^ ERROR the size for values of type -//~| ERROR the size for values of type +//~| ERROR cannot move out of a shared reference static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync)); //~^ ERROR the size for values of type -//~| ERROR the size for values of type +//~| ERROR cannot move out of a shared reference static STATIC_BAR: str = *"bar"; //~^ ERROR the size for values of type -//~| ERROR the size for values of type +//~| ERROR cannot move out of a shared reference fn main() { println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR); diff --git a/tests/ui/consts/const-unsized.stderr b/tests/ui/consts/const-unsized.stderr index 0b69cad9651..7931d7adafd 100644 --- a/tests/ui/consts/const-unsized.stderr +++ b/tests/ui/consts/const-unsized.stderr @@ -6,15 +6,6 @@ LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync)); | = help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)` -error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time - --> $DIR/const-unsized.rs:3:35 - | -LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)` - = note: constant expressions must have a statically known size - error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/const-unsized.rs:7:18 | @@ -23,15 +14,6 @@ LL | const CONST_FOO: str = *"foo"; | = help: the trait `Sized` is not implemented for `str` -error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/const-unsized.rs:7:24 - | -LL | const CONST_FOO: str = *"foo"; - | ^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `str` - = note: constant expressions must have a statically known size - error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time --> $DIR/const-unsized.rs:11:18 | @@ -40,15 +22,6 @@ LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync)); | = help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)` -error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time - --> $DIR/const-unsized.rs:11:37 - | -LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)` - = note: constant expressions must have a statically known size - error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/const-unsized.rs:15:20 | @@ -57,14 +30,29 @@ LL | static STATIC_BAR: str = *"bar"; | = help: the trait `Sized` is not implemented for `str` -error[E0277]: the size for values of type `str` cannot be known at compilation time +error[E0507]: cannot move out of a shared reference + --> $DIR/const-unsized.rs:3:35 + | +LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ move occurs because value has type `dyn Debug + Sync`, which does not implement the `Copy` trait + +error[E0507]: cannot move out of a shared reference + --> $DIR/const-unsized.rs:7:24 + | +LL | const CONST_FOO: str = *"foo"; + | ^^^^^^ move occurs because value has type `str`, which does not implement the `Copy` trait + +error[E0507]: cannot move out of a shared reference + --> $DIR/const-unsized.rs:11:37 + | +LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ move occurs because value has type `dyn Debug + Sync`, which does not implement the `Copy` trait + +error[E0507]: cannot move out of a shared reference --> $DIR/const-unsized.rs:15:26 | LL | static STATIC_BAR: str = *"bar"; - | ^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `str` - = note: constant expressions must have a statically known size + | ^^^^^^ move occurs because value has type `str`, which does not implement the `Copy` trait error[E0161]: cannot move a value of type `str` --> $DIR/const-unsized.rs:20:48 @@ -80,5 +68,5 @@ LL | println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATI error: aborting due to 10 previous errors -Some errors have detailed explanations: E0161, E0277. +Some errors have detailed explanations: E0161, E0277, E0507. For more information about an error, try `rustc --explain E0161`. diff --git a/tests/ui/consts/const_let_assign2.stderr b/tests/ui/consts/const_let_assign2.stderr index 9a1b84dbf09..be0ffefc80d 100644 --- a/tests/ui/consts/const_let_assign2.stderr +++ b/tests/ui/consts/const_let_assign2.stderr @@ -9,8 +9,9 @@ LL | let ptr = unsafe { &mut BB }; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw mut` instead to create a raw pointer | -LL | let ptr = unsafe { &raw mut BB }; - | ~~~~~~~~ +LL - let ptr = unsafe { &mut BB }; +LL + let ptr = unsafe { &raw mut BB }; + | warning: 1 warning emitted diff --git a/tests/ui/consts/const_refs_to_static-ice-121413.rs b/tests/ui/consts/const_refs_to_static-ice-121413.rs index 7ef67d9a984..432ae1ad5e3 100644 --- a/tests/ui/consts/const_refs_to_static-ice-121413.rs +++ b/tests/ui/consts/const_refs_to_static-ice-121413.rs @@ -9,11 +9,9 @@ const REF_INTERIOR_MUT: &usize = { //~^ ERROR failed to resolve: use of undeclared type `AtomicUsize` //~| WARN trait objects without an explicit `dyn` are deprecated //~| ERROR the size for values of type `(dyn Sync + 'static)` cannot be known at compilation time - //~| ERROR the size for values of type `(dyn Sync + 'static)` cannot be known at compilation time //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! //~| HELP if this is a dyn-compatible trait, use `dyn` //~| HELP the trait `Sized` is not implemented for `(dyn Sync + 'static)` - //~| HELP the trait `Sized` is not implemented for `(dyn Sync + 'static)` unsafe { &*(&FOO as *const _ as *const usize) } }; pub fn main() {} 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 7beb43d84fb..8665d9b6852 100644 --- a/tests/ui/consts/const_refs_to_static-ice-121413.stderr +++ b/tests/ui/consts/const_refs_to_static-ice-121413.stderr @@ -31,16 +31,7 @@ LL | static FOO: Sync = AtomicUsize::new(0); | = help: the trait `Sized` is not implemented for `(dyn Sync + 'static)` -error[E0277]: the size for values of type `(dyn Sync + 'static)` cannot be known at compilation time - --> $DIR/const_refs_to_static-ice-121413.rs:8:24 - | -LL | static FOO: Sync = AtomicUsize::new(0); - | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `(dyn Sync + 'static)` - = note: constant expressions must have a statically known size - -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 2 previous errors; 1 warning emitted Some errors have detailed explanations: E0277, E0433. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr b/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr index 115f1688520..4fc5972051c 100644 --- a/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr +++ b/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr @@ -8,8 +8,9 @@ LL | fn f() -> T {} | help: a struct with a similar name exists | -LL | fn f() -> S {} - | ~ +LL - fn f() -> T {} +LL + fn f() -> S {} + | help: you might be missing a type parameter | LL | fn f<T>() -> T {} diff --git a/tests/ui/consts/issue-104768.stderr b/tests/ui/consts/issue-104768.stderr index 41a9bab0961..bd4a54de0ae 100644 --- a/tests/ui/consts/issue-104768.stderr +++ b/tests/ui/consts/issue-104768.stderr @@ -19,8 +19,9 @@ LL | const A: &_ = 0_u32; | help: replace this with a fully-specified type | -LL | const A: u32 = 0_u32; - | ~~~ +LL - const A: &_ = 0_u32; +LL + const A: u32 = 0_u32; + | error: aborting due to 2 previous errors diff --git a/tests/ui/consts/issue-3521.stderr b/tests/ui/consts/issue-3521.stderr index c0e4cdc5a94..bddab2ebc05 100644 --- a/tests/ui/consts/issue-3521.stderr +++ b/tests/ui/consts/issue-3521.stderr @@ -6,8 +6,9 @@ LL | Bar = foo | help: consider using `const` instead of `let` | -LL | const foo: isize = 100; - | ~~~~~ +LL - let foo: isize = 100; +LL + const foo: isize = 100; + | error: aborting due to 1 previous error diff --git a/tests/ui/consts/issue-91560.stderr b/tests/ui/consts/issue-91560.stderr index 37c8f50d494..9b06f3775d9 100644 --- a/tests/ui/consts/issue-91560.stderr +++ b/tests/ui/consts/issue-91560.stderr @@ -6,8 +6,9 @@ LL | let arr = [0; length]; | help: consider using `const` instead of `let` | -LL | const length: usize = 2; - | ~~~~~ +LL - let mut length: usize = 2; +LL + const length: usize = 2; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-91560.rs:17:19 @@ -17,8 +18,9 @@ LL | let arr = [0; length]; | help: consider using `const` instead of `let` | -LL | const length: usize = 2; - | ~~~~~ +LL - let length: usize = 2; +LL + const length: usize = 2; + | error: aborting due to 2 previous errors diff --git a/tests/ui/consts/large_const_alloc.rs b/tests/ui/consts/large_const_alloc.rs index 61a22216ae5..14edc1bb696 100644 --- a/tests/ui/consts/large_const_alloc.rs +++ b/tests/ui/consts/large_const_alloc.rs @@ -1,5 +1,7 @@ //@ only-64bit // on 32bit and 16bit platforms it is plausible that the maximum allocation size will succeed +// FIXME (#135952) In some cases on AArch64 Linux the diagnostic does not trigger +//@ ignore-aarch64-unknown-linux-gnu const FOO: () = { // 128 TiB, unlikely anyone has that much RAM diff --git a/tests/ui/consts/large_const_alloc.stderr b/tests/ui/consts/large_const_alloc.stderr index 25d660f1217..fa7d5977a95 100644 --- a/tests/ui/consts/large_const_alloc.stderr +++ b/tests/ui/consts/large_const_alloc.stderr @@ -1,11 +1,11 @@ error[E0080]: evaluation of constant value failed - --> $DIR/large_const_alloc.rs:6:13 + --> $DIR/large_const_alloc.rs:8:13 | LL | let x = [0_u8; (1 << 47) - 1]; | ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler error[E0080]: could not evaluate static initializer - --> $DIR/large_const_alloc.rs:11:13 + --> $DIR/large_const_alloc.rs:13:13 | LL | let x = [0_u8; (1 << 47) - 1]; | ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler diff --git a/tests/ui/consts/non-const-value-in-const.stderr b/tests/ui/consts/non-const-value-in-const.stderr index 654b573544c..201c310843b 100644 --- a/tests/ui/consts/non-const-value-in-const.stderr +++ b/tests/ui/consts/non-const-value-in-const.stderr @@ -6,8 +6,9 @@ LL | const Y: i32 = x; | help: consider using `let` instead of `const` | -LL | let Y: i32 = x; - | ~~~ +LL - const Y: i32 = x; +LL + let Y: i32 = x; + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/non-const-value-in-const.rs:6:17 @@ -17,8 +18,9 @@ LL | let _ = [0; x]; | help: consider using `const` instead of `let` | -LL | const x: /* Type */ = 5; - | ~~~~~ ++++++++++++ +LL - let x = 5; +LL + const x: /* Type */ = 5; + | error: aborting due to 2 previous errors diff --git a/tests/ui/consts/offset_from_ub.rs b/tests/ui/consts/offset_from_ub.rs index 0232b03a813..88356900605 100644 --- a/tests/ui/consts/offset_from_ub.rs +++ b/tests/ui/consts/offset_from_ub.rs @@ -17,7 +17,7 @@ pub const DIFFERENT_ALLOC: usize = { let uninit2 = std::mem::MaybeUninit::<Struct>::uninit(); let field_ptr: *const Struct = &uninit2 as *const _ as *const Struct; let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) }; //~ERROR evaluation of constant value failed - //~| pointers into different allocations + //~| not both derived from the same allocation offset as usize }; @@ -37,7 +37,7 @@ pub const DIFFERENT_INT: isize = { // offset_from with two different integers: l let ptr1 = 8 as *const u8; let ptr2 = 16 as *const u8; unsafe { ptr_offset_from(ptr2, ptr1) } //~ERROR evaluation of constant value failed - //~| dangling pointer + //~| not both derived from the same allocation }; const OUT_OF_BOUNDS_1: isize = { @@ -46,7 +46,7 @@ const OUT_OF_BOUNDS_1: isize = { let end_ptr = (start_ptr).wrapping_add(length); // First ptr is out of bounds unsafe { ptr_offset_from(end_ptr, start_ptr) } //~ERROR evaluation of constant value failed - //~| expected a pointer to 10 bytes of memory + //~| the memory range between them is not in-bounds of an allocation }; const OUT_OF_BOUNDS_2: isize = { @@ -55,7 +55,7 @@ const OUT_OF_BOUNDS_2: isize = { let end_ptr = (start_ptr).wrapping_add(length); // Second ptr is out of bounds unsafe { ptr_offset_from(start_ptr, end_ptr) } //~ERROR evaluation of constant value failed - //~| expected a pointer to the end of 10 bytes of memory + //~| the memory range between them is not in-bounds of an allocation }; pub const DIFFERENT_ALLOC_UNSIGNED: usize = { @@ -64,7 +64,7 @@ pub const DIFFERENT_ALLOC_UNSIGNED: usize = { let uninit2 = std::mem::MaybeUninit::<Struct>::uninit(); let field_ptr: *const Struct = &uninit2 as *const _ as *const Struct; unsafe { ptr_offset_from_unsigned(field_ptr, base_ptr) } //~ERROR evaluation of constant value failed - //~| pointers into different allocations + //~| not both derived from the same allocation }; pub const TOO_FAR_APART1: isize = { diff --git a/tests/ui/consts/offset_from_ub.stderr b/tests/ui/consts/offset_from_ub.stderr index ac4597ff011..1379365cc25 100644 --- a/tests/ui/consts/offset_from_ub.stderr +++ b/tests/ui/consts/offset_from_ub.stderr @@ -2,12 +2,12 @@ error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:19:27 | LL | let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on pointers into different allocations + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers that are not both derived from the same allocation error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: `ptr_offset_from` called on pointers into different allocations + = note: `ptr_offset_from` called on two different pointers that are not both derived from the same allocation | note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL @@ -27,25 +27,25 @@ error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:39:14 | LL | unsafe { ptr_offset_from(ptr2, ptr1) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from` origin: expected a pointer to $BYTES bytes of memory, but got 0x8[noalloc] which is a dangling pointer (it has no provenance) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers that are not both derived from the same allocation error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:48:14 | LL | unsafe { ptr_offset_from(end_ptr, start_ptr) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from` origin: expected a pointer to $BYTES bytes of memory, but got ALLOC0 which is only $BYTES bytes from the end of the allocation + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers where the memory range between them is not in-bounds of an allocation error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:57:14 | LL | unsafe { ptr_offset_from(start_ptr, end_ptr) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds `offset_from` origin: expected a pointer to the end of $BYTES bytes of memory, but got ALLOC1+0xa which does not have enough space to the beginning of the allocation + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on two different pointers where the memory range between them is not in-bounds of an allocation error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:66:14 | LL | unsafe { ptr_offset_from_unsigned(field_ptr, base_ptr) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called on pointers into different allocations + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from_unsigned` called on two different pointers that are not both derived from the same allocation error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:73:14 @@ -80,7 +80,7 @@ LL | unsafe { ptr_offset_from_unsigned(ptr2, ptr1) } error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - = note: out-of-bounds `offset_from` origin: expected a pointer to $BYTES bytes of memory, but got a null pointer + = note: `ptr_offset_from` called on two different pointers that are not both derived from the same allocation | note: inside `std::ptr::const_ptr::<impl *const u8>::offset_from` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL diff --git a/tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs b/tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs index b923a768cbf..53618e2e86a 100644 --- a/tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs +++ b/tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs @@ -3,6 +3,8 @@ // Needs the max type size to be much bigger than the RAM people typically have. //@ only-64bit +// FIXME (#135952) In some cases on AArch64 Linux the diagnostic does not trigger +//@ ignore-aarch64-unknown-linux-gnu pub struct Data([u8; (1 << 47) - 1]); const _: &'static Data = &Data([0; (1 << 47) - 1]); diff --git a/tests/ui/consts/promoted_running_out_of_memory_issue-130687.stderr b/tests/ui/consts/promoted_running_out_of_memory_issue-130687.stderr index f5d767efceb..aac805dbd8c 100644 --- a/tests/ui/consts/promoted_running_out_of_memory_issue-130687.stderr +++ b/tests/ui/consts/promoted_running_out_of_memory_issue-130687.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/promoted_running_out_of_memory_issue-130687.rs:8:32 + --> $DIR/promoted_running_out_of_memory_issue-130687.rs:10:32 | LL | const _: &'static Data = &Data([0; (1 << 47) - 1]); | ^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler diff --git a/tests/ui/consts/refs_check_const_eq-issue-88384.stderr b/tests/ui/consts/refs_check_const_eq-issue-88384.stderr index 62c5c527641..65e4dc22c28 100644 --- a/tests/ui/consts/refs_check_const_eq-issue-88384.stderr +++ b/tests/ui/consts/refs_check_const_eq-issue-88384.stderr @@ -15,8 +15,8 @@ LL | struct Foo<const T: CompileTimeSettings>; | help: add `#[derive(ConstParamTy)]` to the struct | +LL - struct CompileTimeSettings { LL + #[derive(ConstParamTy)] -LL | struct CompileTimeSettings { | error[E0741]: `CompileTimeSettings` must implement `ConstParamTy` to be used as the type of a const generic parameter @@ -27,8 +27,8 @@ LL | impl<const T: CompileTimeSettings> Foo<T> { | help: add `#[derive(ConstParamTy)]` to the struct | +LL - struct CompileTimeSettings { LL + #[derive(ConstParamTy)] -LL | struct CompileTimeSettings { | error: aborting due to 2 previous errors; 1 warning emitted diff --git a/tests/ui/contracts/associated-item.rs b/tests/ui/contracts/associated-item.rs new file mode 100644 index 00000000000..4a2d05abbc5 --- /dev/null +++ b/tests/ui/contracts/associated-item.rs @@ -0,0 +1,18 @@ +// Ensure we don't ICE when lowering contracts on an associated item. + +//@ compile-flags: --crate-type=lib +//@ check-pass + +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use + +extern crate core; + +use core::contracts::requires; + +struct Foo; + +impl Foo { + #[requires(align > 0 && (align & (align - 1)) == 0)] + pub fn foo(align: i32) {} +} diff --git a/tests/ui/contracts/associated-item.stderr b/tests/ui/contracts/associated-item.stderr new file mode 100644 index 00000000000..20651026b87 --- /dev/null +++ b/tests/ui/contracts/associated-item.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/associated-item.rs:6:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-annotation-limitations.rs b/tests/ui/contracts/contract-annotation-limitations.rs new file mode 100644 index 00000000000..10b3bacab5c --- /dev/null +++ b/tests/ui/contracts/contract-annotation-limitations.rs @@ -0,0 +1,28 @@ +//! Test for some of the existing limitations and the current error messages. +//! Some of these limitations may be removed in the future. + +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] +#![allow(dead_code)] + +/// Represent a 5-star system. +struct Stars(u8); + +impl Stars { + fn is_valid(&self) -> bool { + self.0 <= 5 + } +} + +trait ParseStars { + #[core::contracts::ensures(|ret| ret.is_none_or(Stars::is_valid))] + //~^ ERROR contract annotations is only supported in functions with bodies + fn parse_string(input: String) -> Option<Stars>; + + #[core::contracts::ensures(|ret| ret.is_none_or(Stars::is_valid))] + //~^ ERROR contract annotations is only supported in functions with bodies + fn parse<T>(input: T) -> Option<Stars> where T: for<'a> Into<&'a str>; +} + +fn main() { +} diff --git a/tests/ui/contracts/contract-annotation-limitations.stderr b/tests/ui/contracts/contract-annotation-limitations.stderr new file mode 100644 index 00000000000..14338cf4b86 --- /dev/null +++ b/tests/ui/contracts/contract-annotation-limitations.stderr @@ -0,0 +1,23 @@ +error: contract annotations is only supported in functions with bodies + --> $DIR/contract-annotation-limitations.rs:18:5 + | +LL | #[core::contracts::ensures(|ret| ret.is_none_or(Stars::is_valid))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: contract annotations is only supported in functions with bodies + --> $DIR/contract-annotation-limitations.rs:22:5 + | +LL | #[core::contracts::ensures(|ret| ret.is_none_or(Stars::is_valid))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-annotation-limitations.rs:4:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +error: aborting due to 2 previous errors; 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-generics.chk_const_fail.stderr b/tests/ui/contracts/contract-attributes-generics.chk_const_fail.stderr new file mode 100644 index 00000000000..0630811d4f7 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-generics.chk_const_fail.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-generics.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-generics.chk_fail_post.stderr b/tests/ui/contracts/contract-attributes-generics.chk_fail_post.stderr new file mode 100644 index 00000000000..0630811d4f7 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-generics.chk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-generics.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-generics.chk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-generics.chk_fail_pre.stderr new file mode 100644 index 00000000000..0630811d4f7 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-generics.chk_fail_pre.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-generics.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-generics.chk_pass.stderr b/tests/ui/contracts/contract-attributes-generics.chk_pass.stderr new file mode 100644 index 00000000000..0630811d4f7 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-generics.chk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-generics.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-generics.rs b/tests/ui/contracts/contract-attributes-generics.rs new file mode 100644 index 00000000000..fd79c6abedd --- /dev/null +++ b/tests/ui/contracts/contract-attributes-generics.rs @@ -0,0 +1,71 @@ +//! Test that contracts can be applied to generic functions. + +//@ revisions: unchk_pass chk_pass chk_fail_pre chk_fail_post chk_const_fail +// +//@ [unchk_pass] run-pass +//@ [chk_pass] run-pass +// +//@ [chk_fail_pre] run-fail +//@ [chk_fail_post] run-fail +//@ [chk_const_fail] run-fail +// +//@ [unchk_pass] compile-flags: -Zcontract-checks=no +// +//@ [chk_pass] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_pre] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_post] compile-flags: -Zcontract-checks=yes +//@ [chk_const_fail] compile-flags: -Zcontract-checks=yes + +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] + +use std::ops::Sub; + +/// Dummy fn contract that precondition fails for val < 0, and post-condition fail for val == 1 +#[core::contracts::requires(val > 0u8.into())] +#[core::contracts::ensures(|ret| *ret > 0u8.into())] +fn decrement<T>(val: T) -> T +where T: PartialOrd + Sub<Output=T> + From<u8> +{ + val - 1u8.into() +} + +/// Create a structure that takes a constant parameter. +#[allow(dead_code)] +struct Capped<const MAX: usize>(usize); + +/// Now declare a function to create stars which shouldn't exceed 5 stars. +// Add redundant braces to ensure the built-in macro can handle this syntax. +#[allow(unused_braces)] +#[core::contracts::requires(num <= 5)] +unsafe fn stars_unchecked(num: usize) -> Capped<{ 5 }> { + Capped(num) +} + + +fn main() { + check_decrement(); + check_stars(); +} + +fn check_stars() { + // This should always pass. + let _ = unsafe { stars_unchecked(3) }; + + // This violates the contract. + #[cfg(any(unchk_pass, chk_const_fail))] + let _ = unsafe { stars_unchecked(10) }; +} + +fn check_decrement() { + // This should always pass + assert_eq!(decrement(10u8), 9u8); + + // This should fail requires but pass with no contract check. + #[cfg(any(unchk_pass, chk_fail_pre))] + assert_eq!(decrement(-2i128), -3i128); + + // This should fail ensures but pass with no contract check. + #[cfg(any(unchk_pass, chk_fail_post))] + assert_eq!(decrement(1i32), 0i32); +} diff --git a/tests/ui/contracts/contract-attributes-generics.unchk_pass.stderr b/tests/ui/contracts/contract-attributes-generics.unchk_pass.stderr new file mode 100644 index 00000000000..0630811d4f7 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-generics.unchk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-generics.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-nest.chk_fail_post.stderr b/tests/ui/contracts/contract-attributes-nest.chk_fail_post.stderr new file mode 100644 index 00000000000..9ca95b8bb01 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-nest.chk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-nest.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-nest.chk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-nest.chk_fail_pre.stderr new file mode 100644 index 00000000000..9ca95b8bb01 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-nest.chk_fail_pre.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-nest.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-nest.chk_pass.stderr b/tests/ui/contracts/contract-attributes-nest.chk_pass.stderr new file mode 100644 index 00000000000..9ca95b8bb01 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-nest.chk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-nest.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-nest.rs b/tests/ui/contracts/contract-attributes-nest.rs new file mode 100644 index 00000000000..e1e61b88f28 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-nest.rs @@ -0,0 +1,45 @@ +//@ revisions: unchk_pass unchk_fail_pre unchk_fail_post chk_pass chk_fail_pre chk_fail_post +// +//@ [unchk_pass] run-pass +//@ [unchk_fail_pre] run-pass +//@ [unchk_fail_post] run-pass +//@ [chk_pass] run-pass +// +//@ [chk_fail_pre] run-fail +//@ [chk_fail_post] run-fail +// +//@ [unchk_pass] compile-flags: -Zcontract-checks=no +//@ [unchk_fail_pre] compile-flags: -Zcontract-checks=no +//@ [unchk_fail_post] compile-flags: -Zcontract-checks=no +// +//@ [chk_pass] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_pre] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_post] compile-flags: -Zcontract-checks=yes + +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] + +#[core::contracts::requires(x.baz > 0)] +#[core::contracts::ensures(|ret| *ret > 100)] +fn nest(x: Baz) -> i32 +{ + loop { + return x.baz + 50; + } +} + +struct Baz { baz: i32 } + +const BAZ_PASS_PRE_POST: Baz = Baz { baz: 100 }; +#[cfg(any(unchk_fail_post, chk_fail_post))] +const BAZ_FAIL_POST: Baz = Baz { baz: 10 }; +#[cfg(any(unchk_fail_pre, chk_fail_pre))] +const BAZ_FAIL_PRE: Baz = Baz { baz: -10 }; + +fn main() { + assert_eq!(nest(BAZ_PASS_PRE_POST), 150); + #[cfg(any(unchk_fail_pre, chk_fail_pre))] + nest(BAZ_FAIL_PRE); + #[cfg(any(unchk_fail_post, chk_fail_post))] + nest(BAZ_FAIL_POST); +} diff --git a/tests/ui/contracts/contract-attributes-nest.unchk_fail_post.stderr b/tests/ui/contracts/contract-attributes-nest.unchk_fail_post.stderr new file mode 100644 index 00000000000..9ca95b8bb01 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-nest.unchk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-nest.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-nest.unchk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-nest.unchk_fail_pre.stderr new file mode 100644 index 00000000000..9ca95b8bb01 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-nest.unchk_fail_pre.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-nest.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-nest.unchk_pass.stderr b/tests/ui/contracts/contract-attributes-nest.unchk_pass.stderr new file mode 100644 index 00000000000..9ca95b8bb01 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-nest.unchk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-nest.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-tail.chk_fail_post.stderr b/tests/ui/contracts/contract-attributes-tail.chk_fail_post.stderr new file mode 100644 index 00000000000..f87e7e19fa3 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-tail.chk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-tail.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-tail.chk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-tail.chk_fail_pre.stderr new file mode 100644 index 00000000000..f87e7e19fa3 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-tail.chk_fail_pre.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-tail.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-tail.chk_pass.stderr b/tests/ui/contracts/contract-attributes-tail.chk_pass.stderr new file mode 100644 index 00000000000..f87e7e19fa3 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-tail.chk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-tail.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-tail.rs b/tests/ui/contracts/contract-attributes-tail.rs new file mode 100644 index 00000000000..ce4a6be5b82 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-tail.rs @@ -0,0 +1,43 @@ +//@ revisions: unchk_pass unchk_fail_pre unchk_fail_post chk_pass chk_fail_pre chk_fail_post +// +//@ [unchk_pass] run-pass +//@ [unchk_fail_pre] run-pass +//@ [unchk_fail_post] run-pass +//@ [chk_pass] run-pass +// +//@ [chk_fail_pre] run-fail +//@ [chk_fail_post] run-fail +// +//@ [unchk_pass] compile-flags: -Zcontract-checks=no +//@ [unchk_fail_pre] compile-flags: -Zcontract-checks=no +//@ [unchk_fail_post] compile-flags: -Zcontract-checks=no +// +//@ [chk_pass] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_pre] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_post] compile-flags: -Zcontract-checks=yes + +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] + +#[core::contracts::requires(x.baz > 0)] +#[core::contracts::ensures(|ret| *ret > 100)] +fn tail(x: Baz) -> i32 +{ + x.baz + 50 +} + +struct Baz { baz: i32 } + +const BAZ_PASS_PRE_POST: Baz = Baz { baz: 100 }; +#[cfg(any(unchk_fail_post, chk_fail_post))] +const BAZ_FAIL_POST: Baz = Baz { baz: 10 }; +#[cfg(any(unchk_fail_pre, chk_fail_pre))] +const BAZ_FAIL_PRE: Baz = Baz { baz: -10 }; + +fn main() { + assert_eq!(tail(BAZ_PASS_PRE_POST), 150); + #[cfg(any(unchk_fail_pre, chk_fail_pre))] + tail(BAZ_FAIL_PRE); + #[cfg(any(unchk_fail_post, chk_fail_post))] + tail(BAZ_FAIL_POST); +} diff --git a/tests/ui/contracts/contract-attributes-tail.unchk_fail_post.stderr b/tests/ui/contracts/contract-attributes-tail.unchk_fail_post.stderr new file mode 100644 index 00000000000..f87e7e19fa3 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-tail.unchk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-tail.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-tail.unchk_fail_pre.stderr b/tests/ui/contracts/contract-attributes-tail.unchk_fail_pre.stderr new file mode 100644 index 00000000000..f87e7e19fa3 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-tail.unchk_fail_pre.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-tail.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-attributes-tail.unchk_pass.stderr b/tests/ui/contracts/contract-attributes-tail.unchk_pass.stderr new file mode 100644 index 00000000000..f87e7e19fa3 --- /dev/null +++ b/tests/ui/contracts/contract-attributes-tail.unchk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-attributes-tail.rs:19:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-captures-via-closure-copy.rs b/tests/ui/contracts/contract-captures-via-closure-copy.rs new file mode 100644 index 00000000000..32c6d2bf4fe --- /dev/null +++ b/tests/ui/contracts/contract-captures-via-closure-copy.rs @@ -0,0 +1,26 @@ +//@ run-fail +//@ compile-flags: -Zcontract-checks=yes + +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] + +struct Baz { + baz: i32 +} + +#[track_caller] +#[core::contracts::requires(x.baz > 0)] +#[core::contracts::ensures({let old = x.baz; move |ret:&Baz| ret.baz == old*2 })] +// Relevant thing is this: ^^^^^^^^^^^^^^^ +// because we are capturing state that is Copy +fn doubler(x: Baz) -> Baz { + Baz { baz: x.baz + 10 } +} + +fn main() { + assert_eq!(doubler(Baz { baz: 10 }).baz, 20); + assert_eq!(doubler(Baz { baz: 100 }).baz, 200); + // This is a *run-fail* test because it is still exercising the + // contract machinery, specifically because this second invocation + // of `doubler` shows how the code does not meet its contract. +} diff --git a/tests/ui/contracts/contract-captures-via-closure-copy.stderr b/tests/ui/contracts/contract-captures-via-closure-copy.stderr new file mode 100644 index 00000000000..d92db601608 --- /dev/null +++ b/tests/ui/contracts/contract-captures-via-closure-copy.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-captures-via-closure-copy.rs:4:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contract-captures-via-closure-noncopy.rs b/tests/ui/contracts/contract-captures-via-closure-noncopy.rs new file mode 100644 index 00000000000..976f64c7fd9 --- /dev/null +++ b/tests/ui/contracts/contract-captures-via-closure-noncopy.rs @@ -0,0 +1,23 @@ +//@ compile-flags: -Zcontract-checks=yes + +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] + +struct Baz { + baz: i32 +} + +#[track_caller] +#[core::contracts::requires(x.baz > 0)] +#[core::contracts::ensures({let old = x; move |ret:&Baz| ret.baz == old.baz*2 })] +// Relevant thing is this: ^^^^^^^^^^^ +// because we are capturing state that is non-Copy. +//~^^^ ERROR trait bound `Baz: std::marker::Copy` is not satisfied +fn doubler(x: Baz) -> Baz { + Baz { baz: x.baz + 10 } +} + +fn main() { + assert_eq!(doubler(Baz { baz: 10 }).baz, 20); + assert_eq!(doubler(Baz { baz: 100 }).baz, 200); +} diff --git a/tests/ui/contracts/contract-captures-via-closure-noncopy.stderr b/tests/ui/contracts/contract-captures-via-closure-noncopy.stderr new file mode 100644 index 00000000000..4a47671fee1 --- /dev/null +++ b/tests/ui/contracts/contract-captures-via-closure-noncopy.stderr @@ -0,0 +1,36 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-captures-via-closure-noncopy.rs:3:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: the trait bound `Baz: std::marker::Copy` is not satisfied in `{closure@$DIR/contract-captures-via-closure-noncopy.rs:12:42: 12:57}` + --> $DIR/contract-captures-via-closure-noncopy.rs:12:1 + | +LL | #[core::contracts::ensures({let old = x; move |ret:&Baz| ret.baz == old.baz*2 })] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^^ + | | | + | | within this `{closure@$DIR/contract-captures-via-closure-noncopy.rs:12:42: 12:57}` + | | this tail expression is of type `{closure@contract-captures-via-closure-noncopy.rs:12:42}` + | unsatisfied trait bound + | + = help: within `{closure@$DIR/contract-captures-via-closure-noncopy.rs:12:42: 12:57}`, the trait `std::marker::Copy` is not implemented for `Baz` +note: required because it's used within this closure + --> $DIR/contract-captures-via-closure-noncopy.rs:12:42 + | +LL | #[core::contracts::ensures({let old = x; move |ret:&Baz| ret.baz == old.baz*2 })] + | ^^^^^^^^^^^^^^^ +note: required by a bound in `build_check_ensures` + --> $SRC_DIR/core/src/contracts.rs:LL:COL +help: consider annotating `Baz` with `#[derive(Copy)]` + | +LL + #[derive(Copy)] +LL | struct Baz { + | + +error: aborting due to 1 previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_ret.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_ret.stderr new file mode 100644 index 00000000000..d693fad446a --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_ret.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_try.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_try.stderr new file mode 100644 index 00000000000..d693fad446a --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_try.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_yeet.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_yeet.stderr new file mode 100644 index 00000000000..d693fad446a --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_fail_yeet.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_pass.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_pass.stderr new file mode 100644 index 00000000000..d693fad446a --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-early-fn-exit.chk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.rs b/tests/ui/contracts/contracts-ensures-early-fn-exit.rs new file mode 100644 index 00000000000..034cead3b4e --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-early-fn-exit.rs @@ -0,0 +1,49 @@ +//@ revisions: unchk_pass chk_pass chk_fail_try chk_fail_ret chk_fail_yeet +// +//@ [unchk_pass] run-pass +//@ [chk_pass] run-pass +//@ [chk_fail_try] run-fail +//@ [chk_fail_ret] run-fail +//@ [chk_fail_yeet] run-fail +// +//@ [unchk_pass] compile-flags: -Zcontract-checks=no +//@ [chk_pass] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_try] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_ret] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_yeet] compile-flags: -Zcontract-checks=yes +//! This test ensures that ensures clauses are checked for different return points of a function. + +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] +#![feature(yeet_expr)] + +/// This ensures will fail in different return points depending on the input. +#[core::contracts::ensures(|ret: &Option<u32>| ret.is_some())] +fn try_sum(x: u32, y: u32, z: u32) -> Option<u32> { + // Use Yeet to return early. + if x == u32::MAX && (y > 0 || z > 0) { do yeet } + + // Use `?` to early return. + let partial = x.checked_add(y)?; + + // Explicitly use `return` clause. + if u32::MAX - partial < z { + return None; + } + + Some(partial + z) +} + +fn main() { + // This should always succeed + assert_eq!(try_sum(0, 1, 2), Some(3)); + + #[cfg(any(unchk_pass, chk_fail_yeet))] + assert_eq!(try_sum(u32::MAX, 1, 1), None); + + #[cfg(any(unchk_pass, chk_fail_try))] + assert_eq!(try_sum(u32::MAX - 10, 12, 0), None); + + #[cfg(any(unchk_pass, chk_fail_ret))] + assert_eq!(try_sum(u32::MAX - 10, 2, 100), None); +} diff --git a/tests/ui/contracts/contracts-ensures-early-fn-exit.unchk_pass.stderr b/tests/ui/contracts/contracts-ensures-early-fn-exit.unchk_pass.stderr new file mode 100644 index 00000000000..d693fad446a --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-early-fn-exit.unchk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-ensures-early-fn-exit.rs:16:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs new file mode 100644 index 00000000000..f01a852fbff --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.rs @@ -0,0 +1,15 @@ +//@ run-pass +//@ compile-flags: -Zcontract-checks=yes +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] + +#[core::contracts::ensures(|ret| *ret > 0)] +fn outer() -> i32 { + let inner_closure = || -> i32 { 0 }; + inner_closure(); + 10 +} + +fn main() { + outer(); +} diff --git a/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.stderr b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.stderr new file mode 100644 index 00000000000..49a372b53c7 --- /dev/null +++ b/tests/ui/contracts/contracts-ensures-is-not-inherited-when-nesting.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-ensures-is-not-inherited-when-nesting.rs:3:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.rs b/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.rs new file mode 100644 index 00000000000..2c2a4a69785 --- /dev/null +++ b/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.rs @@ -0,0 +1,17 @@ +//@ run-pass +//@ compile-flags: -Zcontract-checks=yes +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] + +struct Outer { outer: std::cell::Cell<i32> } + +#[core::contracts::requires(x.outer.get() > 0)] +fn outer(x: Outer) { + let inner_closure = || { }; + x.outer.set(0); + inner_closure(); +} + +fn main() { + outer(Outer { outer: 1.into() }); +} diff --git a/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.stderr b/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.stderr new file mode 100644 index 00000000000..48898c4434a --- /dev/null +++ b/tests/ui/contracts/contracts-requires-is-not-inherited-when-nesting.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contracts-requires-is-not-inherited-when-nesting.rs:3:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/disallow-contract-annotation-on-non-fn.rs b/tests/ui/contracts/disallow-contract-annotation-on-non-fn.rs new file mode 100644 index 00000000000..69be906782a --- /dev/null +++ b/tests/ui/contracts/disallow-contract-annotation-on-non-fn.rs @@ -0,0 +1,53 @@ +//! Checks for compilation errors related to adding contracts to non-function items. + +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] +#![allow(dead_code)] + +#[core::contracts::requires(true)] +//~^ ERROR contract annotations can only be used on functions +struct Dummy(usize); + +#[core::contracts::ensures(|v| v == 100)] +//~^ ERROR contract annotations can only be used on functions +const MAX_VAL: usize = 100; + +// FIXME: Improve the error message here. The macro thinks this is a function. +#[core::contracts::ensures(|v| v == 100)] +//~^ ERROR contract annotations is only supported in functions with bodies +type NewDummy = fn(usize) -> Dummy; + +#[core::contracts::ensures(|v| v == 100)] +//~^ ERROR contract annotations is only supported in functions with bodies +const NEW_DUMMY_FN : fn(usize) -> Dummy = || { Dummy(0) }; + +#[core::contracts::requires(true)] +//~^ ERROR contract annotations can only be used on functions +impl Dummy { + + // This should work + #[core::contracts::ensures(|ret| ret.0 == v)] + fn new(v: usize) -> Dummy { + Dummy(v) + } +} + +#[core::contracts::ensures(|dummy| dummy.0 > 0)] +//~^ ERROR contract annotations can only be used on functions +impl From<usize> for Dummy { + // This should work. + #[core::contracts::ensures(|ret| ret.0 == v)] + fn from(value: usize) -> Self { + Dummy::new(value) + } +} + +/// You should not be able to annotate a trait either. +#[core::contracts::requires(true)] +//~^ ERROR contract annotations can only be used on functions +pub trait DummyBuilder { + fn build() -> Dummy; +} + +fn main() { +} diff --git a/tests/ui/contracts/disallow-contract-annotation-on-non-fn.stderr b/tests/ui/contracts/disallow-contract-annotation-on-non-fn.stderr new file mode 100644 index 00000000000..0a7fff8183e --- /dev/null +++ b/tests/ui/contracts/disallow-contract-annotation-on-non-fn.stderr @@ -0,0 +1,53 @@ +error: contract annotations can only be used on functions + --> $DIR/disallow-contract-annotation-on-non-fn.rs:7:1 + | +LL | #[core::contracts::requires(true)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: contract annotations can only be used on functions + --> $DIR/disallow-contract-annotation-on-non-fn.rs:11:1 + | +LL | #[core::contracts::ensures(|v| v == 100)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: contract annotations is only supported in functions with bodies + --> $DIR/disallow-contract-annotation-on-non-fn.rs:16:1 + | +LL | #[core::contracts::ensures(|v| v == 100)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: contract annotations is only supported in functions with bodies + --> $DIR/disallow-contract-annotation-on-non-fn.rs:20:1 + | +LL | #[core::contracts::ensures(|v| v == 100)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: contract annotations can only be used on functions + --> $DIR/disallow-contract-annotation-on-non-fn.rs:24:1 + | +LL | #[core::contracts::requires(true)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: contract annotations can only be used on functions + --> $DIR/disallow-contract-annotation-on-non-fn.rs:35:1 + | +LL | #[core::contracts::ensures(|dummy| dummy.0 > 0)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: contract annotations can only be used on functions + --> $DIR/disallow-contract-annotation-on-non-fn.rs:46:1 + | +LL | #[core::contracts::requires(true)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/disallow-contract-annotation-on-non-fn.rs:3:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +error: aborting due to 7 previous errors; 1 warning emitted + diff --git a/tests/ui/contracts/internal_machinery/contract-ast-extensions-nest.rs b/tests/ui/contracts/internal_machinery/contract-ast-extensions-nest.rs new file mode 100644 index 00000000000..6d8cd3949ee --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contract-ast-extensions-nest.rs @@ -0,0 +1,44 @@ +//@ revisions: unchk_pass unchk_fail_pre unchk_fail_post chk_pass chk_fail_pre chk_fail_post +// +//@ [unchk_pass] run-pass +//@ [unchk_fail_pre] run-pass +//@ [unchk_fail_post] run-pass +//@ [chk_pass] run-pass +// +//@ [chk_fail_pre] run-fail +//@ [chk_fail_post] run-fail +// +//@ [unchk_pass] compile-flags: -Zcontract-checks=no +//@ [unchk_fail_pre] compile-flags: -Zcontract-checks=no +//@ [unchk_fail_post] compile-flags: -Zcontract-checks=no +// +//@ [chk_pass] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_pre] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_post] compile-flags: -Zcontract-checks=yes + +#![feature(contracts_internals)] + +fn nest(x: Baz) -> i32 + contract_requires(|| x.baz > 0) + contract_ensures(|ret| *ret > 100) +{ + loop { + return x.baz + 50; + } +} + +struct Baz { baz: i32 } + +const BAZ_PASS_PRE_POST: Baz = Baz { baz: 100 }; +#[cfg(any(unchk_fail_post, chk_fail_post))] +const BAZ_FAIL_POST: Baz = Baz { baz: 10 }; +#[cfg(any(unchk_fail_pre, chk_fail_pre))] +const BAZ_FAIL_PRE: Baz = Baz { baz: -10 }; + +fn main() { + assert_eq!(nest(BAZ_PASS_PRE_POST), 150); + #[cfg(any(unchk_fail_pre, chk_fail_pre))] + nest(BAZ_FAIL_PRE); + #[cfg(any(unchk_fail_post, chk_fail_post))] + nest(BAZ_FAIL_POST); +} diff --git a/tests/ui/contracts/internal_machinery/contract-ast-extensions-tail.rs b/tests/ui/contracts/internal_machinery/contract-ast-extensions-tail.rs new file mode 100644 index 00000000000..07ec26f921b --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contract-ast-extensions-tail.rs @@ -0,0 +1,42 @@ +//@ revisions: unchk_pass unchk_fail_pre unchk_fail_post chk_pass chk_fail_pre chk_fail_post +// +//@ [unchk_pass] run-pass +//@ [unchk_fail_pre] run-pass +//@ [unchk_fail_post] run-pass +//@ [chk_pass] run-pass +// +//@ [chk_fail_pre] run-fail +//@ [chk_fail_post] run-fail +// +//@ [unchk_pass] compile-flags: -Zcontract-checks=no +//@ [unchk_fail_pre] compile-flags: -Zcontract-checks=no +//@ [unchk_fail_post] compile-flags: -Zcontract-checks=no +// +//@ [chk_pass] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_pre] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_post] compile-flags: -Zcontract-checks=yes + +#![feature(contracts_internals)] + +fn tail(x: Baz) -> i32 + contract_requires(|| x.baz > 0) + contract_ensures(|ret| *ret > 100) +{ + x.baz + 50 +} + +struct Baz { baz: i32 } + +const BAZ_PASS_PRE_POST: Baz = Baz { baz: 100 }; +#[cfg(any(unchk_fail_post, chk_fail_post))] +const BAZ_FAIL_POST: Baz = Baz { baz: 10 }; +#[cfg(any(unchk_fail_pre, chk_fail_pre))] +const BAZ_FAIL_PRE: Baz = Baz { baz: -10 }; + +fn main() { + assert_eq!(tail(BAZ_PASS_PRE_POST), 150); + #[cfg(any(unchk_fail_pre, chk_fail_pre))] + tail(BAZ_FAIL_PRE); + #[cfg(any(unchk_fail_post, chk_fail_post))] + tail(BAZ_FAIL_POST); +} diff --git a/tests/ui/contracts/internal_machinery/contract-intrinsics.rs b/tests/ui/contracts/internal_machinery/contract-intrinsics.rs new file mode 100644 index 00000000000..ae692afd146 --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contract-intrinsics.rs @@ -0,0 +1,36 @@ +//@ revisions: default unchk_pass chk_pass chk_fail_ensures chk_fail_requires +// +//@ [default] run-pass +//@ [unchk_pass] run-pass +//@ [chk_pass] run-pass +//@ [chk_fail_requires] run-fail +//@ [chk_fail_ensures] run-fail +// +//@ [unchk_pass] compile-flags: -Zcontract-checks=no +//@ [chk_pass] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_requires] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_ensures] compile-flags: -Zcontract-checks=yes +#![feature(cfg_contract_checks, contracts_internals, core_intrinsics)] + +fn main() { + #[cfg(any(default, unchk_pass))] // default: disabled + assert_eq!(core::intrinsics::contract_checks(), false); + + #[cfg(chk_pass)] // explicitly enabled + assert_eq!(core::intrinsics::contract_checks(), true); + + // always pass + core::intrinsics::contract_check_requires(|| true); + + // fail if enabled + #[cfg(any(default, unchk_pass, chk_fail_requires))] + core::intrinsics::contract_check_requires(|| false); + + let doubles_to_two = { let old = 2; move |ret| ret + ret == old }; + // Always pass + core::intrinsics::contract_check_ensures(&1, doubles_to_two); + + // Fail if enabled + #[cfg(any(default, unchk_pass, chk_fail_ensures))] + core::intrinsics::contract_check_ensures(&2, doubles_to_two); +} diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.chk_fail_post.stderr b/tests/ui/contracts/internal_machinery/contract-lang-items.chk_fail_post.stderr new file mode 100644 index 00000000000..a60ce160265 --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contract-lang-items.chk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-lang-items.rs:15:12 + | +LL | #![feature(contracts)] // to access core::contracts + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.chk_pass.stderr b/tests/ui/contracts/internal_machinery/contract-lang-items.chk_pass.stderr new file mode 100644 index 00000000000..a60ce160265 --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contract-lang-items.chk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-lang-items.rs:15:12 + | +LL | #![feature(contracts)] // to access core::contracts + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.rs b/tests/ui/contracts/internal_machinery/contract-lang-items.rs new file mode 100644 index 00000000000..e91bbed294d --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contract-lang-items.rs @@ -0,0 +1,39 @@ +//@ revisions: unchk_pass unchk_fail_post chk_pass chk_fail_post +// +//@ [unchk_pass] run-pass +//@ [unchk_fail_post] run-pass +//@ [chk_pass] run-pass +// +//@ [chk_fail_post] run-fail +// +//@ [unchk_pass] compile-flags: -Zcontract-checks=no +//@ [unchk_fail_post] compile-flags: -Zcontract-checks=no +// +//@ [chk_pass] compile-flags: -Zcontract-checks=yes +//@ [chk_fail_post] compile-flags: -Zcontract-checks=yes + +#![feature(contracts)] // to access core::contracts +//~^ WARN the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] +#![feature(contracts_internals)] // to access check_requires lang item + +fn foo(x: Baz) -> i32 { + let injected_checker = { + core::contracts::build_check_ensures(|ret| *ret > 100) + }; + + let ret = x.baz + 50; + injected_checker(ret) +} + +struct Baz { baz: i32 } + + +const BAZ_PASS_PRE_POST: Baz = Baz { baz: 100 }; +#[cfg(any(unchk_fail_post, chk_fail_post))] +const BAZ_FAIL_POST: Baz = Baz { baz: 10 }; + +fn main() { + assert_eq!(foo(BAZ_PASS_PRE_POST), 150); + #[cfg(any(unchk_fail_post, chk_fail_post))] + foo(BAZ_FAIL_POST); +} diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_fail_post.stderr b/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_fail_post.stderr new file mode 100644 index 00000000000..a60ce160265 --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_fail_post.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-lang-items.rs:15:12 + | +LL | #![feature(contracts)] // to access core::contracts + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_pass.stderr b/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_pass.stderr new file mode 100644 index 00000000000..a60ce160265 --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contract-lang-items.unchk_pass.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/contract-lang-items.rs:15:12 + | +LL | #![feature(contracts)] // to access core::contracts + | ^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/contracts/internal_machinery/contracts-lowering-ensures-is-not-inherited-when-nesting.rs b/tests/ui/contracts/internal_machinery/contracts-lowering-ensures-is-not-inherited-when-nesting.rs new file mode 100644 index 00000000000..960ccaed358 --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contracts-lowering-ensures-is-not-inherited-when-nesting.rs @@ -0,0 +1,15 @@ +//@ run-pass +//@ compile-flags: -Zcontract-checks=yes +#![feature(contracts_internals)] + +fn outer() -> i32 + contract_ensures(|ret| *ret > 0) +{ + let inner_closure = || -> i32 { 0 }; + inner_closure(); + 10 +} + +fn main() { + outer(); +} diff --git a/tests/ui/contracts/internal_machinery/contracts-lowering-requires-is-not-inherited-when-nesting.rs b/tests/ui/contracts/internal_machinery/contracts-lowering-requires-is-not-inherited-when-nesting.rs new file mode 100644 index 00000000000..bee703de16a --- /dev/null +++ b/tests/ui/contracts/internal_machinery/contracts-lowering-requires-is-not-inherited-when-nesting.rs @@ -0,0 +1,17 @@ +//@ run-pass +//@ compile-flags: -Zcontract-checks=yes +#![feature(contracts_internals)] + +struct Outer { outer: std::cell::Cell<i32> } + +fn outer(x: Outer) + contract_requires(|| x.outer.get() > 0) +{ + let inner_closure = || { }; + x.outer.set(0); + inner_closure(); +} + +fn main() { + outer(Outer { outer: 1.into() }); +} diff --git a/tests/ui/contracts/internal_machinery/internal-feature-gating.rs b/tests/ui/contracts/internal_machinery/internal-feature-gating.rs new file mode 100644 index 00000000000..1b76eef6780 --- /dev/null +++ b/tests/ui/contracts/internal_machinery/internal-feature-gating.rs @@ -0,0 +1,20 @@ +// gate-test-contracts_internals + +fn main() { + // intrinsics are guarded by contracts_internals feature gate. + core::intrinsics::contract_checks(); + //~^ ERROR use of unstable library feature `contracts_internals` + core::intrinsics::contract_check_requires(|| true); + //~^ ERROR use of unstable library feature `contracts_internals` + core::intrinsics::contract_check_ensures(&1, |_|true); + //~^ ERROR use of unstable library feature `contracts_internals` + + core::contracts::build_check_ensures(|_: &()| true); + //~^ ERROR use of unstable library feature `contracts_internals` + + // ast extensions are guarded by contracts_internals feature gate + fn identity_1() -> i32 contract_requires(|| true) { 10 } + //~^ ERROR contract internal machinery is for internal use only + fn identity_2() -> i32 contract_ensures(|_| true) { 10 } + //~^ ERROR contract internal machinery is for internal use only +} diff --git a/tests/ui/contracts/internal_machinery/internal-feature-gating.stderr b/tests/ui/contracts/internal_machinery/internal-feature-gating.stderr new file mode 100644 index 00000000000..7302694a787 --- /dev/null +++ b/tests/ui/contracts/internal_machinery/internal-feature-gating.stderr @@ -0,0 +1,63 @@ +error[E0658]: contract internal machinery is for internal use only + --> $DIR/internal-feature-gating.rs:16:28 + | +LL | fn identity_1() -> i32 contract_requires(|| true) { 10 } + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = help: add `#![feature(contracts_internals)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: contract internal machinery is for internal use only + --> $DIR/internal-feature-gating.rs:18:28 + | +LL | fn identity_2() -> i32 contract_ensures(|_| true) { 10 } + | ^^^^^^^^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = help: add `#![feature(contracts_internals)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: use of unstable library feature `contracts_internals` + --> $DIR/internal-feature-gating.rs:5:5 + | +LL | core::intrinsics::contract_checks(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = help: add `#![feature(contracts_internals)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: use of unstable library feature `contracts_internals` + --> $DIR/internal-feature-gating.rs:7:5 + | +LL | core::intrinsics::contract_check_requires(|| true); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = help: add `#![feature(contracts_internals)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: use of unstable library feature `contracts_internals` + --> $DIR/internal-feature-gating.rs:9:5 + | +LL | core::intrinsics::contract_check_ensures(&1, |_|true); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = help: add `#![feature(contracts_internals)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: use of unstable library feature `contracts_internals` + --> $DIR/internal-feature-gating.rs:12:5 + | +LL | core::contracts::build_check_ensures(|_: &()| true); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = help: add `#![feature(contracts_internals)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/coroutine/issue-102645.stderr b/tests/ui/coroutine/issue-102645.stderr index 1ef37d3f7d1..bec0518d8c6 100644 --- a/tests/ui/coroutine/issue-102645.stderr +++ b/tests/ui/coroutine/issue-102645.stderr @@ -8,8 +8,9 @@ note: method defined here --> $SRC_DIR/core/src/ops/coroutine.rs:LL:COL help: provide the argument | -LL | Pin::new(&mut b).resume(()); - | ~~~~ +LL - Pin::new(&mut b).resume(); +LL + Pin::new(&mut b).resume(()); + | error: aborting due to 1 previous error diff --git a/tests/ui/coroutine/resume-arg-outlives.stderr b/tests/ui/coroutine/resume-arg-outlives.stderr index 2a6337b4945..0150009c8fa 100644 --- a/tests/ui/coroutine/resume-arg-outlives.stderr +++ b/tests/ui/coroutine/resume-arg-outlives.stderr @@ -9,12 +9,14 @@ LL | generator | help: consider changing `impl Coroutine<&'not_static str> + 'static`'s explicit `'static` bound to the lifetime of argument `s` | -LL | fn demo<'not_static>(s: &'not_static str) -> Pin<Box<impl Coroutine<&'not_static str> + 'not_static>> { - | ~~~~~~~~~~~ +LL - fn demo<'not_static>(s: &'not_static str) -> Pin<Box<impl Coroutine<&'not_static str> + 'static>> { +LL + fn demo<'not_static>(s: &'not_static str) -> Pin<Box<impl Coroutine<&'not_static str> + 'not_static>> { + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn demo<'not_static>(s: &'static str) -> Pin<Box<impl Coroutine<&'not_static str> + 'static>> { - | ~~~~~~~~~~~~ +LL - fn demo<'not_static>(s: &'not_static str) -> Pin<Box<impl Coroutine<&'not_static str> + 'static>> { +LL + fn demo<'not_static>(s: &'static str) -> Pin<Box<impl Coroutine<&'not_static str> + 'static>> { + | error: aborting due to 1 previous error diff --git a/tests/ui/coverage-attr/bad-attr-ice.feat.stderr b/tests/ui/coverage-attr/bad-attr-ice.feat.stderr index 50e1c39d4f8..a8a70e363b7 100644 --- a/tests/ui/coverage-attr/bad-attr-ice.feat.stderr +++ b/tests/ui/coverage-attr/bad-attr-ice.feat.stderr @@ -6,9 +6,11 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage] +LL + #[coverage(on)] | error: aborting due to 1 previous error diff --git a/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr b/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr index e8bdd99c9b9..6443fafef3e 100644 --- a/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr +++ b/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr @@ -6,9 +6,11 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage] +LL + #[coverage(on)] | error[E0658]: the `#[coverage]` attribute is an experimental feature diff --git a/tests/ui/coverage-attr/bad-syntax.stderr b/tests/ui/coverage-attr/bad-syntax.stderr index 5592e89070d..3123066e7bf 100644 --- a/tests/ui/coverage-attr/bad-syntax.stderr +++ b/tests/ui/coverage-attr/bad-syntax.stderr @@ -6,10 +6,12 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] - | ~~~~~~~~~~~~~~~~ -LL | #[coverage(on)] - | ~~~~~~~~~~~~~~~ +LL - #[coverage] +LL + #[coverage(off)] + | +LL - #[coverage] +LL + #[coverage(on)] + | error: malformed `coverage` attribute input --> $DIR/bad-syntax.rs:20:1 @@ -19,10 +21,12 @@ LL | #[coverage = true] | help: the following are the possible correct uses | -LL | #[coverage(off)] - | ~~~~~~~~~~~~~~~~ -LL | #[coverage(on)] - | ~~~~~~~~~~~~~~~ +LL - #[coverage = true] +LL + #[coverage(off)] + | +LL - #[coverage = true] +LL + #[coverage(on)] + | error: malformed `coverage` attribute input --> $DIR/bad-syntax.rs:23:1 @@ -32,10 +36,12 @@ LL | #[coverage()] | help: the following are the possible correct uses | -LL | #[coverage(off)] - | ~~~~~~~~~~~~~~~~ -LL | #[coverage(on)] - | ~~~~~~~~~~~~~~~ +LL - #[coverage()] +LL + #[coverage(off)] + | +LL - #[coverage()] +LL + #[coverage(on)] + | error: malformed `coverage` attribute input --> $DIR/bad-syntax.rs:26:1 @@ -45,10 +51,12 @@ LL | #[coverage(off, off)] | help: the following are the possible correct uses | -LL | #[coverage(off)] - | ~~~~~~~~~~~~~~~~ -LL | #[coverage(on)] - | ~~~~~~~~~~~~~~~ +LL - #[coverage(off, off)] +LL + #[coverage(off)] + | +LL - #[coverage(off, off)] +LL + #[coverage(on)] + | error: malformed `coverage` attribute input --> $DIR/bad-syntax.rs:29:1 @@ -58,10 +66,12 @@ LL | #[coverage(off, on)] | help: the following are the possible correct uses | -LL | #[coverage(off)] - | ~~~~~~~~~~~~~~~~ -LL | #[coverage(on)] - | ~~~~~~~~~~~~~~~ +LL - #[coverage(off, on)] +LL + #[coverage(off)] + | +LL - #[coverage(off, on)] +LL + #[coverage(on)] + | error: malformed `coverage` attribute input --> $DIR/bad-syntax.rs:32:1 @@ -71,10 +81,12 @@ LL | #[coverage(bogus)] | help: the following are the possible correct uses | -LL | #[coverage(off)] - | ~~~~~~~~~~~~~~~~ -LL | #[coverage(on)] - | ~~~~~~~~~~~~~~~ +LL - #[coverage(bogus)] +LL + #[coverage(off)] + | +LL - #[coverage(bogus)] +LL + #[coverage(on)] + | error: malformed `coverage` attribute input --> $DIR/bad-syntax.rs:35:1 @@ -84,10 +96,12 @@ LL | #[coverage(bogus, off)] | help: the following are the possible correct uses | -LL | #[coverage(off)] - | ~~~~~~~~~~~~~~~~ -LL | #[coverage(on)] - | ~~~~~~~~~~~~~~~ +LL - #[coverage(bogus, off)] +LL + #[coverage(off)] + | +LL - #[coverage(bogus, off)] +LL + #[coverage(on)] + | error: malformed `coverage` attribute input --> $DIR/bad-syntax.rs:38:1 @@ -97,10 +111,12 @@ LL | #[coverage(off, bogus)] | help: the following are the possible correct uses | -LL | #[coverage(off)] - | ~~~~~~~~~~~~~~~~ -LL | #[coverage(on)] - | ~~~~~~~~~~~~~~~ +LL - #[coverage(off, bogus)] +LL + #[coverage(off)] + | +LL - #[coverage(off, bogus)] +LL + #[coverage(on)] + | error: expected identifier, found `,` --> $DIR/bad-syntax.rs:44:12 diff --git a/tests/ui/coverage-attr/name-value.stderr b/tests/ui/coverage-attr/name-value.stderr index bfd22ed5451..31a635b57e5 100644 --- a/tests/ui/coverage-attr/name-value.stderr +++ b/tests/ui/coverage-attr/name-value.stderr @@ -6,9 +6,11 @@ LL | #[coverage = "off"] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage = "off"] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage = "off"] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -19,9 +21,11 @@ LL | #![coverage = "off"] | help: the following are the possible correct uses | -LL | #![coverage(off)] +LL - #![coverage = "off"] +LL + #![coverage(off)] | -LL | #![coverage(on)] +LL - #![coverage = "off"] +LL + #![coverage(on)] | error: malformed `coverage` attribute input @@ -32,9 +36,11 @@ LL | #[coverage = "off"] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage = "off"] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage = "off"] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -45,9 +51,11 @@ LL | #[coverage = "off"] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage = "off"] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage = "off"] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -58,9 +66,11 @@ LL | #[coverage = "off"] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage = "off"] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage = "off"] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -71,9 +81,11 @@ LL | #[coverage = "off"] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage = "off"] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage = "off"] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -84,9 +96,11 @@ LL | #[coverage = "off"] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage = "off"] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage = "off"] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -97,9 +111,11 @@ LL | #[coverage = "off"] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage = "off"] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage = "off"] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -110,9 +126,11 @@ LL | #[coverage = "off"] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage = "off"] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage = "off"] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -123,9 +141,11 @@ LL | #[coverage = "off"] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage = "off"] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage = "off"] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -136,9 +156,11 @@ LL | #[coverage = "off"] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage = "off"] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage = "off"] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -149,9 +171,11 @@ LL | #[coverage = "off"] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage = "off"] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage = "off"] +LL + #[coverage(on)] | error[E0788]: coverage attribute not allowed here diff --git a/tests/ui/coverage-attr/subword.stderr b/tests/ui/coverage-attr/subword.stderr index a672ff4ac41..a5d1a492181 100644 --- a/tests/ui/coverage-attr/subword.stderr +++ b/tests/ui/coverage-attr/subword.stderr @@ -6,10 +6,12 @@ LL | #[coverage(yes(milord))] | help: the following are the possible correct uses | -LL | #[coverage(off)] - | ~~~~~~~~~~~~~~~~ -LL | #[coverage(on)] - | ~~~~~~~~~~~~~~~ +LL - #[coverage(yes(milord))] +LL + #[coverage(off)] + | +LL - #[coverage(yes(milord))] +LL + #[coverage(on)] + | error: malformed `coverage` attribute input --> $DIR/subword.rs:11:1 @@ -19,10 +21,12 @@ LL | #[coverage(no(milord))] | help: the following are the possible correct uses | -LL | #[coverage(off)] - | ~~~~~~~~~~~~~~~~ -LL | #[coverage(on)] - | ~~~~~~~~~~~~~~~ +LL - #[coverage(no(milord))] +LL + #[coverage(off)] + | +LL - #[coverage(no(milord))] +LL + #[coverage(on)] + | error: malformed `coverage` attribute input --> $DIR/subword.rs:14:1 @@ -32,10 +36,12 @@ LL | #[coverage(yes = "milord")] | help: the following are the possible correct uses | -LL | #[coverage(off)] - | ~~~~~~~~~~~~~~~~ -LL | #[coverage(on)] - | ~~~~~~~~~~~~~~~ +LL - #[coverage(yes = "milord")] +LL + #[coverage(off)] + | +LL - #[coverage(yes = "milord")] +LL + #[coverage(on)] + | error: malformed `coverage` attribute input --> $DIR/subword.rs:17:1 @@ -45,10 +51,12 @@ LL | #[coverage(no = "milord")] | help: the following are the possible correct uses | -LL | #[coverage(off)] - | ~~~~~~~~~~~~~~~~ -LL | #[coverage(on)] - | ~~~~~~~~~~~~~~~ +LL - #[coverage(no = "milord")] +LL + #[coverage(off)] + | +LL - #[coverage(no = "milord")] +LL + #[coverage(on)] + | error: aborting due to 4 previous errors diff --git a/tests/ui/coverage-attr/word-only.stderr b/tests/ui/coverage-attr/word-only.stderr index bad50b0c961..c034149d8ec 100644 --- a/tests/ui/coverage-attr/word-only.stderr +++ b/tests/ui/coverage-attr/word-only.stderr @@ -6,9 +6,11 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -19,9 +21,11 @@ LL | #![coverage] | help: the following are the possible correct uses | -LL | #![coverage(off)] +LL - #![coverage] +LL + #![coverage(off)] | -LL | #![coverage(on)] +LL - #![coverage] +LL + #![coverage(on)] | error: malformed `coverage` attribute input @@ -32,9 +36,11 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -45,9 +51,11 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -58,9 +66,11 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -71,9 +81,11 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -84,9 +96,11 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -97,9 +111,11 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -110,9 +126,11 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -123,9 +141,11 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -136,9 +156,11 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage] +LL + #[coverage(on)] | error: malformed `coverage` attribute input @@ -149,9 +171,11 @@ LL | #[coverage] | help: the following are the possible correct uses | -LL | #[coverage(off)] +LL - #[coverage] +LL + #[coverage(off)] | -LL | #[coverage(on)] +LL - #[coverage] +LL + #[coverage(on)] | error[E0788]: coverage attribute not allowed here diff --git a/tests/ui/crate-loading/crateresolve1.rs b/tests/ui/crate-loading/crateresolve1.rs index 9200b6a6231..91c34c82558 100644 --- a/tests/ui/crate-loading/crateresolve1.rs +++ b/tests/ui/crate-loading/crateresolve1.rs @@ -2,11 +2,11 @@ //@ aux-build:crateresolve1-2.rs //@ aux-build:crateresolve1-3.rs -//@ normalize-stderr: "\.nll/" -> "/" +//@ normalize-stderr: "crateresolve1\..+/auxiliary/" -> "crateresolve1/auxiliary/" //@ normalize-stderr: "\\\?\\" -> "" //@ normalize-stderr: "(lib)?crateresolve1-([123])\.[a-z]+" -> "libcrateresolve1-$2.somelib" -// NOTE: This test is duplicated at `tests/ui/error-codes/E0464.rs`. +// NOTE: This test is duplicated at `tests/ui/error-codes/E0464.rs` and `E0523.rs`. extern crate crateresolve1; //~^ ERROR multiple candidates for `rlib` dependency `crateresolve1` found diff --git a/tests/ui/crate-loading/crateresolve2.rs b/tests/ui/crate-loading/crateresolve2.rs index bec692eb8d2..6446740a321 100644 --- a/tests/ui/crate-loading/crateresolve2.rs +++ b/tests/ui/crate-loading/crateresolve2.rs @@ -4,7 +4,7 @@ //@ aux-build:crateresolve2-2.rs //@ aux-build:crateresolve2-3.rs -//@ normalize-stderr: "\.nll/" -> "/" +//@ normalize-stderr: "crateresolve2\..+/auxiliary/" -> "crateresolve2/auxiliary/" //@ normalize-stderr: "\\\?\\" -> "" extern crate crateresolve2; diff --git a/tests/ui/debuginfo/dwarf-versions.one.stderr b/tests/ui/debuginfo/dwarf-versions.one.stderr new file mode 100644 index 00000000000..bfc3a0152c6 --- /dev/null +++ b/tests/ui/debuginfo/dwarf-versions.one.stderr @@ -0,0 +1,6 @@ +error: requested DWARF version 1 is not supported + | + = help: supported DWARF versions are 2, 3, 4 and 5 + +error: aborting due to 1 previous error + diff --git a/tests/ui/debuginfo/dwarf-versions.rs b/tests/ui/debuginfo/dwarf-versions.rs new file mode 100644 index 00000000000..806ade51a99 --- /dev/null +++ b/tests/ui/debuginfo/dwarf-versions.rs @@ -0,0 +1,38 @@ +// This test verifies the expected behavior of various options passed to +// `-Zdwarf-version`: 2 - 5 (valid) with all other options being invalid. + +//@ revisions: zero one two three four five six + +//@[zero] compile-flags: -Zdwarf-version=0 +//@[zero] error-pattern: requested DWARF version 0 is not supported + +//@[one] compile-flags: -Zdwarf-version=1 +//@[one] error-pattern: requested DWARF version 1 is not supported + +//@[two] compile-flags: -Zdwarf-version=2 +//@[two] check-pass + +//@[three] compile-flags: -Zdwarf-version=3 +//@[three] check-pass + +//@[four] compile-flags: -Zdwarf-version=4 +//@[four] check-pass + +//@[five] compile-flags: -Zdwarf-version=5 +//@[five] check-pass + +//@[six] compile-flags: -Zdwarf-version=6 +//@[six] error-pattern: requested DWARF version 6 is not supported + +//@ compile-flags: -g --target x86_64-unknown-linux-gnu --crate-type cdylib +//@ needs-llvm-components: x86 + +#![feature(no_core, lang_items)] + +#![no_core] +#![no_std] + +#[lang = "sized"] +pub trait Sized {} + +pub fn foo() {} diff --git a/tests/ui/debuginfo/dwarf-versions.six.stderr b/tests/ui/debuginfo/dwarf-versions.six.stderr new file mode 100644 index 00000000000..32ab4e1471d --- /dev/null +++ b/tests/ui/debuginfo/dwarf-versions.six.stderr @@ -0,0 +1,6 @@ +error: requested DWARF version 6 is not supported + | + = help: supported DWARF versions are 2, 3, 4 and 5 + +error: aborting due to 1 previous error + diff --git a/tests/ui/debuginfo/dwarf-versions.zero.stderr b/tests/ui/debuginfo/dwarf-versions.zero.stderr new file mode 100644 index 00000000000..d58d7d3ed1c --- /dev/null +++ b/tests/ui/debuginfo/dwarf-versions.zero.stderr @@ -0,0 +1,6 @@ +error: requested DWARF version 0 is not supported + | + = help: supported DWARF versions are 2, 3, 4 and 5 + +error: aborting due to 1 previous error + diff --git a/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr index 2ce3b388073..61e2a8f64dd 100644 --- a/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr +++ b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr @@ -52,6 +52,14 @@ LL | pub struct InvariantRef<'a, T: ?Sized>(&'a T, PhantomData<&'a mut &'a T>); LL | pub const NEW: Self = InvariantRef::new(&()); | ^^^ function or associated item not found in `InvariantRef<'_, _>` +error[E0277]: the trait bound `u8: Trait` is not satisfied + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:12 + | +LL | reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } + | ^^ the trait `Trait` is not implemented for `u8` + | + = help: the trait `Trait` is implemented for `Z` + error[E0308]: mismatched types --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:53 | @@ -68,6 +76,7 @@ LL | reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW | ^^ the trait `Trait` is not implemented for `u8` | = help: the trait `Trait` is implemented for `Z` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0308]: mismatched types --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:53 @@ -98,15 +107,6 @@ LL | reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW found struct `InvariantRef<'_, ()>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0277]: the trait bound `u8: Trait` is not satisfied - --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:12 - | -LL | reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } - | ^^ the trait `Trait` is not implemented for `u8` - | - = help: the trait `Trait` is implemented for `Z` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - error: aborting due to 10 previous errors Some errors have detailed explanations: E0261, E0277, E0308, E0599. diff --git a/tests/ui/deprecation/atomic_initializers.stderr b/tests/ui/deprecation/atomic_initializers.stderr index 30fcc9de618..3a2e6613818 100644 --- a/tests/ui/deprecation/atomic_initializers.stderr +++ b/tests/ui/deprecation/atomic_initializers.stderr @@ -7,8 +7,9 @@ LL | static FOO: AtomicIsize = ATOMIC_ISIZE_INIT; = note: `#[warn(deprecated)]` on by default help: replace the use of the deprecated constant | -LL | static FOO: AtomicIsize = AtomicIsize::new(0); - | ~~~~~~~~~~~~~~~~~~~ +LL - static FOO: AtomicIsize = ATOMIC_ISIZE_INIT; +LL + static FOO: AtomicIsize = AtomicIsize::new(0); + | warning: 1 warning emitted diff --git a/tests/ui/deprecation/invalid-literal.stderr b/tests/ui/deprecation/invalid-literal.stderr index ca827beda05..cbe1fcca023 100644 --- a/tests/ui/deprecation/invalid-literal.stderr +++ b/tests/ui/deprecation/invalid-literal.stderr @@ -6,12 +6,15 @@ LL | #[deprecated = b"test"] | help: the following are the possible correct uses | -LL | #[deprecated = "reason"] - | ~~~~~~~~~~~~~~~~~~~~~~~~ -LL | #[deprecated(/*opt*/ since = "version", /*opt*/ note = "reason")] - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | #[deprecated] - | ~~~~~~~~~~~~~ +LL - #[deprecated = b"test"] +LL + #[deprecated = "reason"] + | +LL - #[deprecated = b"test"] +LL + #[deprecated(/*opt*/ since = "version", /*opt*/ note = "reason")] + | +LL - #[deprecated = b"test"] +LL + #[deprecated] + | error: aborting due to 1 previous error diff --git a/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr b/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr index d1f5ea3602a..a81143640a0 100644 --- a/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr +++ b/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr @@ -11,8 +11,9 @@ LL | #![deny(deprecated)] | ^^^^^^^^^^ help: replace the use of the deprecated method | -LL | let _foo = str::trim_start(" aoeu"); - | ~~~~~~~~~~ +LL - let _foo = str::trim_left(" aoeu"); +LL + let _foo = str::trim_start(" aoeu"); + | error: use of deprecated method `core::str::<impl str>::trim_left`: superseded by `trim_start` --> $DIR/issue-84637-deprecated-associated-function.rs:8:26 @@ -22,8 +23,9 @@ LL | let _bar = " aoeu".trim_left(); | help: replace the use of the deprecated method | -LL | let _bar = " aoeu".trim_start(); - | ~~~~~~~~~~ +LL - let _bar = " aoeu".trim_left(); +LL + let _bar = " aoeu".trim_start(); + | error: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join --> $DIR/issue-84637-deprecated-associated-function.rs:10:27 @@ -33,8 +35,9 @@ LL | let _baz = ["a", "b"].connect(" "); | help: replace the use of the deprecated method | -LL | let _baz = ["a", "b"].join(" "); - | ~~~~ +LL - let _baz = ["a", "b"].connect(" "); +LL + let _baz = ["a", "b"].join(" "); + | error: aborting due to 3 previous errors diff --git a/tests/ui/deprecation/suggestion.stderr b/tests/ui/deprecation/suggestion.stderr index 5584b6d2f8f..58e4219d37b 100644 --- a/tests/ui/deprecation/suggestion.stderr +++ b/tests/ui/deprecation/suggestion.stderr @@ -11,8 +11,9 @@ LL | #![deny(deprecated)] | ^^^^^^^^^^ help: replace the use of the deprecated function | -LL | bar::replacement(); - | ~~~~~~~~~~~ +LL - bar::deprecated(); +LL + bar::replacement(); + | error: use of deprecated method `Foo::deprecated`: replaced by `replacement` --> $DIR/suggestion.rs:40:9 @@ -22,8 +23,9 @@ LL | foo.deprecated(); | help: replace the use of the deprecated method | -LL | foo.replacement(); - | ~~~~~~~~~~~ +LL - foo.deprecated(); +LL + foo.replacement(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/deref-patterns/issue-71676-1.stderr b/tests/ui/deref-patterns/issue-71676-1.stderr index 164641ff775..348a2c12ec4 100644 --- a/tests/ui/deref-patterns/issue-71676-1.stderr +++ b/tests/ui/deref-patterns/issue-71676-1.stderr @@ -40,8 +40,9 @@ LL | let _: *const u8 = &mut a; found mutable reference `&mut Emm` help: consider dereferencing | -LL | let _: *const u8 = &***a; - | ~~~ +LL - let _: *const u8 = &mut a; +LL + let _: *const u8 = &***a; + | error[E0308]: mismatched types --> $DIR/issue-71676-1.rs:52:22 diff --git a/tests/ui/derived-errors/issue-30580.stderr b/tests/ui/derived-errors/issue-30580.stderr index 05b55591729..e8659ea931d 100644 --- a/tests/ui/derived-errors/issue-30580.stderr +++ b/tests/ui/derived-errors/issue-30580.stderr @@ -6,8 +6,9 @@ LL | b.c; | help: a field with a similar name exists | -LL | b.a; - | ~ +LL - b.c; +LL + b.a; + | error: aborting due to 1 previous error diff --git a/tests/ui/derives/rustc-decodable-issue-123156.rs b/tests/ui/derives/rustc-decodable-issue-123156.rs deleted file mode 100644 index 1983837ed8d..00000000000 --- a/tests/ui/derives/rustc-decodable-issue-123156.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ check-pass -//@ edition:2021 -//@ aux-build:rustc-serialize.rs - -#![crate_type = "lib"] -#![allow(deprecated, soft_unstable)] - -extern crate rustc_serialize; - -#[derive(RustcDecodable)] -pub enum Foo {} diff --git a/tests/ui/derives/rustc-decodable-issue-123156.stderr b/tests/ui/derives/rustc-decodable-issue-123156.stderr deleted file mode 100644 index 93a993b90d8..00000000000 --- a/tests/ui/derives/rustc-decodable-issue-123156.stderr +++ /dev/null @@ -1,10 +0,0 @@ -Future incompatibility report: Future breakage diagnostic: -warning: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code - --> $DIR/rustc-decodable-issue-123156.rs:10:10 - | -LL | #[derive(RustcDecodable)] - | ^^^^^^^^^^^^^^ - | - = 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 #64266 <https://github.com/rust-lang/rust/issues/64266> - diff --git a/tests/ui/deriving/auxiliary/malicious-macro.rs b/tests/ui/deriving/auxiliary/malicious-macro.rs new file mode 100644 index 00000000000..6665b40a14f --- /dev/null +++ b/tests/ui/deriving/auxiliary/malicious-macro.rs @@ -0,0 +1,31 @@ +#![feature(let_chains)] + +extern crate proc_macro; + +use proc_macro::{Delimiter, TokenStream, TokenTree}; + +#[proc_macro_attribute] +pub fn norepr(_: TokenStream, input: TokenStream) -> TokenStream { + let mut tokens = vec![]; + let mut tts = input.into_iter().fuse().peekable(); + loop { + let Some(token) = tts.next() else { break }; + if let TokenTree::Punct(punct) = &token + && punct.as_char() == '#' + { + if let Some(TokenTree::Group(group)) = tts.peek() + && let Delimiter::Bracket = group.delimiter() + && let Some(TokenTree::Ident(ident)) = group.stream().into_iter().next() + && ident.to_string() == "repr" + { + let _ = tts.next(); + // skip '#' and '[repr(..)] + } else { + tokens.push(token); + } + } else { + tokens.push(token); + } + } + tokens.into_iter().collect() +} diff --git a/tests/ui/deriving/built-in-proc-macro-scope.stdout b/tests/ui/deriving/built-in-proc-macro-scope.stdout index db97c7145ea..fa4e50968f4 100644 --- a/tests/ui/deriving/built-in-proc-macro-scope.stdout +++ b/tests/ui/deriving/built-in-proc-macro-scope.stdout @@ -20,6 +20,8 @@ pub struct Ptr<'a, #[pointee] T: ?Sized> { data: &'a mut T, } #[automatically_derived] +impl<'a, T: ?Sized> ::core::marker::CoercePointeeValidated for Ptr<'a, T> { } +#[automatically_derived] impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> ::core::ops::DispatchFromDyn<Ptr<'a, __S>> for Ptr<'a, T> { } diff --git a/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout b/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout index d6eaca5cba1..a774efbbe35 100644 --- a/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout +++ b/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout @@ -16,6 +16,10 @@ struct MyPointer<'a, #[pointee] T: ?Sized> { ptr: &'a T, } #[automatically_derived] +impl<'a, T: ?Sized> ::core::marker::CoercePointeeValidated for + MyPointer<'a, T> { +} +#[automatically_derived] impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> ::core::ops::DispatchFromDyn<MyPointer<'a, __S>> for MyPointer<'a, T> { } @@ -31,6 +35,11 @@ pub struct MyPointer2<'a, Y, Z: MyTrait<T>, #[pointee] T: ?Sized + MyTrait<T>, x: core::marker::PhantomData<X>, } #[automatically_derived] +impl<'a, Y, Z: MyTrait<T>, T: ?Sized + MyTrait<T>, X: MyTrait<T>> + ::core::marker::CoercePointeeValidated for MyPointer2<'a, Y, Z, T, X> + where Y: MyTrait<T> { +} +#[automatically_derived] impl<'a, Y, Z: MyTrait<T> + MyTrait<__S>, T: ?Sized + MyTrait<T> + ::core::marker::Unsize<__S>, __S: ?Sized + MyTrait<__S>, X: MyTrait<T> + MyTrait<__S>> ::core::ops::DispatchFromDyn<MyPointer2<'a, Y, Z, __S, X>> @@ -48,6 +57,10 @@ struct MyPointerWithoutPointee<'a, T: ?Sized> { ptr: &'a T, } #[automatically_derived] +impl<'a, T: ?Sized> ::core::marker::CoercePointeeValidated for + MyPointerWithoutPointee<'a, T> { +} +#[automatically_derived] impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> ::core::ops::DispatchFromDyn<MyPointerWithoutPointee<'a, __S>> for MyPointerWithoutPointee<'a, T> { diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.rs b/tests/ui/deriving/deriving-coerce-pointee-neg.rs index da25c854c54..6577500d8eb 100644 --- a/tests/ui/deriving/deriving-coerce-pointee-neg.rs +++ b/tests/ui/deriving/deriving-coerce-pointee-neg.rs @@ -1,6 +1,9 @@ +//@ proc-macro: malicious-macro.rs #![feature(derive_coerce_pointee, arbitrary_self_types)] extern crate core; +extern crate malicious_macro; + use std::marker::CoercePointee; #[derive(CoercePointee)] @@ -41,8 +44,8 @@ struct TooManyPointees<'a, #[pointee] A: ?Sized, #[pointee] B: ?Sized>((&'a A, & //~^ ERROR: only one type parameter can be marked as `#[pointee]` when deriving `CoercePointee` traits #[derive(CoercePointee)] -//~^ ERROR: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` struct NotTransparent<'a, #[pointee] T: ?Sized> { + //~^ ERROR: `derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout ptr: &'a T, } @@ -131,4 +134,12 @@ struct GlobalCoreSized<'a, #[pointee] T: ?::core::marker::Sized> { ptr: &'a T, } +#[derive(CoercePointee)] +#[malicious_macro::norepr] +#[repr(transparent)] +struct TryToWipeRepr<'a, #[pointee] T: ?Sized> { + //~^ ERROR: `derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout [E0802] + ptr: &'a T, +} + fn main() {} diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr index c1e8be49d37..999214bfa9f 100644 --- a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr +++ b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr @@ -1,89 +1,81 @@ -error: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` - --> $DIR/deriving-coerce-pointee-neg.rs:6:10 +error[E0802]: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` + --> $DIR/deriving-coerce-pointee-neg.rs:9:10 | LL | #[derive(CoercePointee)] | ^^^^^^^^^^^^^ | = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) -error: `CoercePointee` can only be derived on `struct`s with at least one field - --> $DIR/deriving-coerce-pointee-neg.rs:12:10 +error[E0802]: `CoercePointee` can only be derived on `struct`s with at least one field + --> $DIR/deriving-coerce-pointee-neg.rs:15:10 | LL | #[derive(CoercePointee)] | ^^^^^^^^^^^^^ | = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) -error: `CoercePointee` can only be derived on `struct`s with at least one field - --> $DIR/deriving-coerce-pointee-neg.rs:19:10 +error[E0802]: `CoercePointee` can only be derived on `struct`s with at least one field + --> $DIR/deriving-coerce-pointee-neg.rs:22:10 | LL | #[derive(CoercePointee)] | ^^^^^^^^^^^^^ | = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) -error: `CoercePointee` can only be derived on `struct`s that are generic over at least one type - --> $DIR/deriving-coerce-pointee-neg.rs:26:10 +error[E0802]: `CoercePointee` can only be derived on `struct`s that are generic over at least one type + --> $DIR/deriving-coerce-pointee-neg.rs:29:10 | LL | #[derive(CoercePointee)] | ^^^^^^^^^^^^^ | = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) -error: exactly one generic type parameter must be marked as `#[pointee]` to derive `CoercePointee` traits - --> $DIR/deriving-coerce-pointee-neg.rs:31:10 +error[E0802]: exactly one generic type parameter must be marked as `#[pointee]` to derive `CoercePointee` traits + --> $DIR/deriving-coerce-pointee-neg.rs:34:10 | LL | #[derive(CoercePointee)] | ^^^^^^^^^^^^^ | = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) -error: only one type parameter can be marked as `#[pointee]` when deriving `CoercePointee` traits - --> $DIR/deriving-coerce-pointee-neg.rs:40:39 +error[E0802]: only one type parameter can be marked as `#[pointee]` when deriving `CoercePointee` traits + --> $DIR/deriving-coerce-pointee-neg.rs:43:39 | LL | struct TooManyPointees<'a, #[pointee] A: ?Sized, #[pointee] B: ?Sized>((&'a A, &'a B)); | ^ - here another type parameter is marked as `#[pointee]` -error: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` - --> $DIR/deriving-coerce-pointee-neg.rs:43:10 - | -LL | #[derive(CoercePointee)] - | ^^^^^^^^^^^^^ - | - = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: `derive(CoercePointee)` requires `T` to be marked `?Sized` - --> $DIR/deriving-coerce-pointee-neg.rs:51:36 +error[E0802]: `derive(CoercePointee)` requires `T` to be marked `?Sized` + --> $DIR/deriving-coerce-pointee-neg.rs:54:36 | LL | struct NoMaybeSized<'a, #[pointee] T> { | ^ error: the `#[pointee]` attribute may only be used on generic parameters - --> $DIR/deriving-coerce-pointee-neg.rs:59:5 + --> $DIR/deriving-coerce-pointee-neg.rs:62:5 | LL | #[pointee] | ^^^^^^^^^^ error: the `#[pointee]` attribute may only be used on generic parameters - --> $DIR/deriving-coerce-pointee-neg.rs:69:33 + --> $DIR/deriving-coerce-pointee-neg.rs:72:33 | LL | struct UhOh<#[pointee] T>(T); | ^^^^^^^^^^ error: the `#[pointee]` attribute may only be used on generic parameters - --> $DIR/deriving-coerce-pointee-neg.rs:83:21 + --> $DIR/deriving-coerce-pointee-neg.rs:86:21 | LL | struct UhOh<#[pointee] T>(T); | ^^^^^^^^^^ error: the `#[pointee]` attribute may only be used on generic parameters - --> $DIR/deriving-coerce-pointee-neg.rs:98:25 + --> $DIR/deriving-coerce-pointee-neg.rs:101:25 | LL | struct UhOh<#[pointee] T>(T); | ^^^^^^^^^^ error[E0392]: lifetime parameter `'a` is never used - --> $DIR/deriving-coerce-pointee-neg.rs:15:16 + --> $DIR/deriving-coerce-pointee-neg.rs:18:16 | LL | struct NoField<'a, #[pointee] T: ?Sized> {} | ^^ unused lifetime parameter @@ -91,7 +83,7 @@ LL | struct NoField<'a, #[pointee] T: ?Sized> {} = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used - --> $DIR/deriving-coerce-pointee-neg.rs:15:31 + --> $DIR/deriving-coerce-pointee-neg.rs:18:31 | LL | struct NoField<'a, #[pointee] T: ?Sized> {} | ^ unused type parameter @@ -99,7 +91,7 @@ LL | struct NoField<'a, #[pointee] T: ?Sized> {} = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: lifetime parameter `'a` is never used - --> $DIR/deriving-coerce-pointee-neg.rs:22:20 + --> $DIR/deriving-coerce-pointee-neg.rs:25:20 | LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); | ^^ unused lifetime parameter @@ -107,13 +99,26 @@ LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used - --> $DIR/deriving-coerce-pointee-neg.rs:22:35 + --> $DIR/deriving-coerce-pointee-neg.rs:25:35 | LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); | ^ unused type parameter | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` -error: aborting due to 16 previous errors +error[E0802]: `derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout + --> $DIR/deriving-coerce-pointee-neg.rs:47:1 + | +LL | struct NotTransparent<'a, #[pointee] T: ?Sized> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0802]: `derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout + --> $DIR/deriving-coerce-pointee-neg.rs:140:1 + | +LL | struct TryToWipeRepr<'a, #[pointee] T: ?Sized> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 17 previous errors -For more information about this error, try `rustc --explain E0392`. +Some errors have detailed explanations: E0392, E0802. +For more information about an error, try `rustc --explain E0392`. diff --git a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr index 58f8e97dea0..7efc0b20e54 100644 --- a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr +++ b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr @@ -26,16 +26,19 @@ LL | Struct { a, _ } = Struct { a: 1, b: 2 }; | help: include the missing field in the pattern | -LL | Struct { a, b } = Struct { a: 1, b: 2 }; - | ~~~~~ +LL - Struct { a, _ } = Struct { a: 1, b: 2 }; +LL + Struct { a, b } = Struct { a: 1, b: 2 }; + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | Struct { a, b: _ } = Struct { a: 1, b: 2 }; - | ~~~~~~~~ +LL - Struct { a, _ } = Struct { a: 1, b: 2 }; +LL + Struct { a, b: _ } = Struct { a: 1, b: 2 }; + | help: or always ignore missing fields here | -LL | Struct { a, .. } = Struct { a: 1, b: 2 }; - | ~~~~~~ +LL - Struct { a, _ } = Struct { a: 1, b: 2 }; +LL + Struct { a, .. } = Struct { a: 1, b: 2 }; + | error[E0797]: base expression required after `..` --> $DIR/struct_destructure_fail.rs:15:19 diff --git a/tests/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr b/tests/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr index 5cc7acba3f3..515d4cc7621 100644 --- a/tests/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr +++ b/tests/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr @@ -38,8 +38,9 @@ LL | TupleStruct(_, _) = TupleStruct(1, 2); | +++ help: use `..` to ignore all fields | -LL | TupleStruct(..) = TupleStruct(1, 2); - | ~~ +LL - TupleStruct(_) = TupleStruct(1, 2); +LL + TupleStruct(..) = TupleStruct(1, 2); + | error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields --> $DIR/tuple_struct_destructure_fail.rs:32:25 @@ -65,8 +66,9 @@ LL | Enum::SingleVariant(_, _) = Enum::SingleVariant(1, 2); | +++ help: use `..` to ignore all fields | -LL | Enum::SingleVariant(..) = Enum::SingleVariant(1, 2); - | ~~ +LL - Enum::SingleVariant(_) = Enum::SingleVariant(1, 2); +LL + Enum::SingleVariant(..) = Enum::SingleVariant(1, 2); + | error[E0070]: invalid left-hand side of assignment --> $DIR/tuple_struct_destructure_fail.rs:38:12 diff --git a/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs b/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs index 40b9e6536f5..8980ef9c422 100644 --- a/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs +++ b/tests/ui/diagnostic-flags/allow-non-lint-warnings.rs @@ -1,8 +1,7 @@ // ignore-tidy-linelength //! Check that `-A warnings` cli flag applies to non-lint warnings as well. //! -//! This test tries to exercise that by checking that the "relaxing a default bound only does -//! something for `?Sized`; all other traits are not bound by default" non-lint warning (normally +//! This test tries to exercise that by checking that a non-lint warning (normally //! warn-by-default) is suppressed if the `-A warnings` cli flag is passed. //! //! Take special note that `warnings` is a special pseudo lint group in relationship to non-lint @@ -14,7 +13,7 @@ //! - Original impl PR: <https://github.com/rust-lang/rust/pull/21248>. //! - RFC 507 "Release channels": //! <https://github.com/rust-lang/rfcs/blob/c017755b9bfa0421570d92ba38082302e0f3ad4f/text/0507-release-channels.md>. -#![crate_type = "lib"] +#![feature(rustc_attrs)] //@ revisions: without_flag with_flag @@ -22,6 +21,6 @@ //@ check-pass -pub trait Trait {} -pub fn f<T: ?Trait>() {} -//[without_flag]~^ WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +#[rustc_error(warn)] +fn main() {} +//[without_flag]~^ WARN unexpected annotation used with `#[rustc_error(...)]`! diff --git a/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr b/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr index b037847c70f..3f33ccbd1c9 100644 --- a/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr +++ b/tests/ui/diagnostic-flags/allow-non-lint-warnings.without_flag.stderr @@ -1,8 +1,8 @@ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default - --> $DIR/allow-non-lint-warnings.rs:26:13 +warning: unexpected annotation used with `#[rustc_error(...)]`! + --> $DIR/allow-non-lint-warnings.rs:25:1 | -LL | pub fn f<T: ?Trait>() {} - | ^^^^^^ +LL | fn main() {} + | ^^^^^^^^^ warning: 1 warning emitted diff --git a/tests/ui/diagnostic-width/E0271.ascii.stderr b/tests/ui/diagnostic-width/E0271.ascii.stderr index 7446b1a543e..9a9c12a938f 100644 --- a/tests/ui/diagnostic-width/E0271.ascii.stderr +++ b/tests/ui/diagnostic-width/E0271.ascii.stderr @@ -1,4 +1,4 @@ -error[E0271]: type mismatch resolving `<Result<Result<(), Result<Result<(), Result<Result<(), Option<{integer}>>, ...>>, ...>>, ...> as Future>::Error == Foo` +error[E0271]: type mismatch resolving `<Result<..., ()> as Future>::Error == Foo` --> $DIR/E0271.rs:20:5 | LL | / Box::new( @@ -7,14 +7,16 @@ LL | | Err::<(), _>( LL | | Ok::<_, ()>( ... | LL | | ) - | |_____^ type mismatch resolving `<Result<Result<(), Result<Result<(), ...>, ...>>, ...> as Future>::Error == Foo` + | |_____^ type mismatch resolving `<Result<..., ()> as Future>::Error == Foo` | note: expected this to be `Foo` --> $DIR/E0271.rs:10:18 | LL | type Error = E; | ^ - = note: required for the cast from `Box<Result<Result<(), Result<Result<(), Result<Result<(), Option<{integer}>>, ()>>, ()>>, ()>>` to `Box<(dyn Future<Error = Foo> + 'static)>` + = note: required for the cast from `Box<Result<..., ()>>` to `Box<...>` + = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: consider using `--verbose` to print the full type name to the console error: aborting due to 1 previous error diff --git a/tests/ui/diagnostic-width/E0271.rs b/tests/ui/diagnostic-width/E0271.rs index 061ba45c219..06187721041 100644 --- a/tests/ui/diagnostic-width/E0271.rs +++ b/tests/ui/diagnostic-width/E0271.rs @@ -1,7 +1,7 @@ //@ revisions: ascii unicode -//@[ascii] compile-flags: --diagnostic-width=40 -//@[unicode] compile-flags: -Zunstable-options --error-format=human-unicode --diagnostic-width=40 -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" +//@[ascii] compile-flags: --diagnostic-width=40 -Zwrite-long-types-to-disk=yes +//@[unicode] compile-flags: -Zunstable-options --error-format=human-unicode --diagnostic-width=40 -Zwrite-long-types-to-disk=yes +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" trait Future { type Error; } diff --git a/tests/ui/diagnostic-width/E0271.unicode.stderr b/tests/ui/diagnostic-width/E0271.unicode.stderr index 72df2a381a4..9c3deae6660 100644 --- a/tests/ui/diagnostic-width/E0271.unicode.stderr +++ b/tests/ui/diagnostic-width/E0271.unicode.stderr @@ -1,4 +1,4 @@ -error[E0271]: type mismatch resolving `<Result<Result<(), Result<Result<(), Result<Result<(), Option<{integer}>>, ...>>, ...>>, ...> as Future>::Error == Foo` +error[E0271]: type mismatch resolving `<Result<..., ()> as Future>::Error == Foo` ╭▸ $DIR/E0271.rs:20:5 │ LL │ ┏ Box::new( @@ -7,14 +7,16 @@ LL │ ┃ Err::<(), _>( LL │ ┃ Ok::<_, ()>( ‡ ┃ LL │ ┃ ) - │ ┗━━━━━┛ type mismatch resolving `<Result<Result<(), Result<Result<(), ...>, ...>>, ...> as Future>::Error == Foo` + │ ┗━━━━━┛ type mismatch resolving `<Result<..., ()> as Future>::Error == Foo` ╰╴ note: expected this to be `Foo` ╭▸ $DIR/E0271.rs:10:18 │ LL │ type Error = E; │ ━ - ╰ note: required for the cast from `Box<Result<Result<(), Result<Result<(), Result<Result<(), Option<{integer}>>, ()>>, ()>>, ()>>` to `Box<(dyn Future<Error = Foo> + 'static)>` + ├ note: required for the cast from `Box<Result<..., ()>>` to `Box<...>` + ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + ╰ note: consider using `--verbose` to print the full type name to the console error: aborting due to 1 previous error diff --git a/tests/ui/diagnostic-width/binop.rs b/tests/ui/diagnostic-width/binop.rs new file mode 100644 index 00000000000..60ba40b8047 --- /dev/null +++ b/tests/ui/diagnostic-width/binop.rs @@ -0,0 +1,17 @@ +//@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes +// The regex below normalizes the long type file name to make it suitable for compare-modes. +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" +type A = (i32, i32, i32, i32); +type B = (A, A, A, A); +type C = (B, B, B, B); +type D = (C, C, C, C); + +fn foo(x: D) { + x + x; //~ ERROR cannot add `(... +} + +fn bar(x: D) { + !x; //~ ERROR cannot apply unary operator `!` to type `(... +} + +fn main() {} diff --git a/tests/ui/diagnostic-width/binop.stderr b/tests/ui/diagnostic-width/binop.stderr new file mode 100644 index 00000000000..fd69129c33e --- /dev/null +++ b/tests/ui/diagnostic-width/binop.stderr @@ -0,0 +1,24 @@ +error[E0369]: cannot add `(..., ..., ..., ...)` to `(..., ..., ..., ...)` + --> $DIR/binop.rs:10:7 + | +LL | x + x; + | - ^ - (..., ..., ..., ...) + | | + | (..., ..., ..., ...) + | + = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: consider using `--verbose` to print the full type name to the console + +error[E0600]: cannot apply unary operator `!` to type `(..., ..., ..., ...)` + --> $DIR/binop.rs:14:5 + | +LL | !x; + | ^^ cannot apply unary operator `!` + | + = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: consider using `--verbose` to print the full type name to the console + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0369, E0600. +For more information about an error, try `rustc --explain E0369`. diff --git a/tests/ui/diagnostic-width/long-E0308.ascii.stderr b/tests/ui/diagnostic-width/long-E0308.ascii.stderr index d45d6bf329b..83da5586188 100644 --- a/tests/ui/diagnostic-width/long-E0308.ascii.stderr +++ b/tests/ui/diagnostic-width/long-E0308.ascii.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/long-E0308.rs:46:9 + --> $DIR/long-E0308.rs:48:9 | LL | let x: Atype< | _____________- @@ -16,15 +16,15 @@ LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok... LL | | Ok("") LL | | )))))))))))))))))))))))))))))) LL | | )))))))))))))))))))))))))))))); - | |__________________________________^ expected `Atype<Btype<..., ...>, ...>`, found `Result<Result<..., ...>, ...>` + | |__________________________________^ expected `Atype<Btype<Ctype<..., i32>, i32>, i32>`, found `Result<Result<Result<..., _>, _>, _>` | - = note: expected struct `Atype<Btype<..., ...>, ...>` - found enum `Result<Result<..., ...>, ...>` - = note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.ascii/long-E0308.long-type-hash.txt' + = note: expected struct `Atype<Btype<..., i32>, i32>` + found enum `Result<Result<..., _>, _>` + = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' = note: consider using `--verbose` to print the full type name to the console error[E0308]: mismatched types - --> $DIR/long-E0308.rs:59:26 + --> $DIR/long-E0308.rs:61:26 | LL | ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O... | __________________________^ @@ -32,15 +32,15 @@ LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(... LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) LL | | )))))))))))))))))))))))))))))) LL | | )))))))))))))))))))))))); - | |____________________________^ expected `Option<Result<..., ...>>`, found `Result<Result<..., ...>, ...>` + | |____________________________^ expected `Option<Result<Option<Option<...>>, _>>`, found `Result<Result<Result<..., _>, _>, _>` | - = note: expected enum `Option<Result<..., ...>>` - found enum `Result<Result<..., ...>, ...>` - = note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.ascii/long-E0308.long-type-hash.txt' + = note: expected enum `Option<Result<Option<...>, _>>` + found enum `Result<Result<..., _>, _>` + = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' = note: consider using `--verbose` to print the full type name to the console error[E0308]: mismatched types - --> $DIR/long-E0308.rs:90:9 + --> $DIR/long-E0308.rs:92:9 | LL | let x: Atype< | ____________- @@ -50,17 +50,17 @@ LL | | Atype< ... | LL | | i32 LL | | > = (); - | | - ^^ expected `Atype<Btype<..., ...>, ...>`, found `()` + | | - ^^ expected `Atype<Btype<Ctype<..., i32>, i32>, i32>`, found `()` | |_____| | expected due to this | - = note: expected struct `Atype<Btype<..., ...>, ...>` + = note: expected struct `Atype<Btype<..., i32>, i32>` found unit type `()` - = note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.ascii/long-E0308.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' = note: consider using `--verbose` to print the full type name to the console error[E0308]: mismatched types - --> $DIR/long-E0308.rs:93:17 + --> $DIR/long-E0308.rs:95:17 | LL | let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O... | ____________--___^ @@ -70,11 +70,11 @@ LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(... LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) LL | | )))))))))))))))))))))))))))))) LL | | )))))))))))))))))))))))); - | |____________________________^ expected `()`, found `Result<Result<..., ...>, ...>` + | |____________________________^ expected `()`, found `Result<Result<Result<..., _>, _>, _>` | = note: expected unit type `()` - found enum `Result<Result<..., ...>, ...>` - = note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.ascii/long-E0308.long-type-hash.txt' + found enum `Result<Result<..., _>, _>` + = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' = note: consider using `--verbose` to print the full type name to the console error: aborting due to 4 previous errors diff --git a/tests/ui/diagnostic-width/long-E0308.rs b/tests/ui/diagnostic-width/long-E0308.rs index 93987226020..26383d9418d 100644 --- a/tests/ui/diagnostic-width/long-E0308.rs +++ b/tests/ui/diagnostic-width/long-E0308.rs @@ -1,7 +1,9 @@ //@ revisions: ascii unicode //@[ascii] compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes //@[unicode] compile-flags: -Zunstable-options --json=diagnostic-unicode --diagnostic-width=60 -Zwrite-long-types-to-disk=yes -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" + +// The regex below normalizes the long type file name to make it suitable for compare-modes. +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" mod a { // Force the "short path for unique types" machinery to trip up diff --git a/tests/ui/diagnostic-width/long-E0308.unicode.stderr b/tests/ui/diagnostic-width/long-E0308.unicode.stderr index 3e8d881d7a6..54abf576dbd 100644 --- a/tests/ui/diagnostic-width/long-E0308.unicode.stderr +++ b/tests/ui/diagnostic-width/long-E0308.unicode.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - ╭▸ $DIR/long-E0308.rs:46:9 + ╭▸ $DIR/long-E0308.rs:48:9 │ LL │ let x: Atype< │ ┌─────────────┘ @@ -16,15 +16,15 @@ LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O… LL │ ┃ Ok("") LL │ ┃ )))))))))))))))))))))))))))))) LL │ ┃ )))))))))))))))))))))))))))))); - │ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ expected `Atype<Btype<..., ...>, ...>`, found `Result<Result<..., ...>, ...>` + │ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ expected `Atype<Btype<Ctype<..., i32>, i32>, i32>`, found `Result<Result<Result<..., _>, _>, _>` │ - ├ note: expected struct `Atype<Btype<..., ...>, ...>` - │ found enum `Result<Result<..., ...>, ...>` - ├ note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.unicode/long-E0308.long-type-hash.txt' + ├ note: expected struct `Atype<Btype<..., i32>, i32>` + │ found enum `Result<Result<..., _>, _>` + ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' ╰ note: consider using `--verbose` to print the full type name to the console error[E0308]: mismatched types - ╭▸ $DIR/long-E0308.rs:59:26 + ╭▸ $DIR/long-E0308.rs:61:26 │ LL │ ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(… │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┛ @@ -32,15 +32,15 @@ LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok… LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) LL │ ┃ )))))))))))))))))))))))))))))) LL │ ┃ )))))))))))))))))))))))); - │ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ expected `Option<Result<..., ...>>`, found `Result<Result<..., ...>, ...>` + │ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ expected `Option<Result<Option<Option<...>>, _>>`, found `Result<Result<Result<..., _>, _>, _>` │ - ├ note: expected enum `Option<Result<..., ...>>` - │ found enum `Result<Result<..., ...>, ...>` - ├ note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.unicode/long-E0308.long-type-hash.txt' + ├ note: expected enum `Option<Result<Option<...>, _>>` + │ found enum `Result<Result<..., _>, _>` + ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' ╰ note: consider using `--verbose` to print the full type name to the console error[E0308]: mismatched types - ╭▸ $DIR/long-E0308.rs:90:9 + ╭▸ $DIR/long-E0308.rs:92:9 │ LL │ let x: Atype< │ ┌────────────┘ @@ -50,17 +50,17 @@ LL │ │ Atype< ‡ │ LL │ │ i32 LL │ │ > = (); - │ │ │ ━━ expected `Atype<Btype<..., ...>, ...>`, found `()` + │ │ │ ━━ expected `Atype<Btype<Ctype<..., i32>, i32>, i32>`, found `()` │ └─────┤ │ expected due to this │ - ├ note: expected struct `Atype<Btype<..., ...>, ...>` + ├ note: expected struct `Atype<Btype<..., i32>, i32>` │ found unit type `()` - ├ note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.unicode/long-E0308.long-type-hash.txt' + ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' ╰ note: consider using `--verbose` to print the full type name to the console error[E0308]: mismatched types - ╭▸ $DIR/long-E0308.rs:93:17 + ╭▸ $DIR/long-E0308.rs:95:17 │ LL │ let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(… │ ┏━━━━━━━━━━━━┬─━━━┛ @@ -70,11 +70,11 @@ LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok… LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) LL │ ┃ )))))))))))))))))))))))))))))) LL │ ┃ )))))))))))))))))))))))); - │ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ expected `()`, found `Result<Result<..., ...>, ...>` + │ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ expected `()`, found `Result<Result<Result<..., _>, _>, _>` │ ├ note: expected unit type `()` - │ found enum `Result<Result<..., ...>, ...>` - ├ note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308.unicode/long-E0308.long-type-hash.txt' + │ found enum `Result<Result<..., _>, _>` + ├ note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' ╰ note: consider using `--verbose` to print the full type name to the console error: aborting due to 4 previous errors diff --git a/tests/ui/diagnostic-width/long-e0277.rs b/tests/ui/diagnostic-width/long-e0277.rs new file mode 100644 index 00000000000..9b3bd8bb728 --- /dev/null +++ b/tests/ui/diagnostic-width/long-e0277.rs @@ -0,0 +1,15 @@ +//@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes +// The regex below normalizes the long type file name to make it suitable for compare-modes. +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" +type A = (i32, i32, i32, i32); +type B = (A, A, A, A); +type C = (B, B, B, B); +type D = (C, C, C, C); + +trait Trait {} + +fn require_trait<T: Trait>() {} + +fn main() { + require_trait::<D>(); //~ ERROR the trait bound `(... +} diff --git a/tests/ui/diagnostic-width/long-e0277.stderr b/tests/ui/diagnostic-width/long-e0277.stderr new file mode 100644 index 00000000000..a57270df7e2 --- /dev/null +++ b/tests/ui/diagnostic-width/long-e0277.stderr @@ -0,0 +1,23 @@ +error[E0277]: the trait bound `(..., ..., ..., ...): Trait` is not satisfied + --> $DIR/long-e0277.rs:14:21 + | +LL | require_trait::<D>(); + | ^ unsatisfied trait bound + | + = help: the trait `Trait` is not implemented for `(..., ..., ..., ...)` +help: this trait has no implementations, consider adding one + --> $DIR/long-e0277.rs:9:1 + | +LL | trait Trait {} + | ^^^^^^^^^^^ +note: required by a bound in `require_trait` + --> $DIR/long-e0277.rs:11:21 + | +LL | fn require_trait<T: Trait>() {} + | ^^^^^ required by this bound in `require_trait` + = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' + = note: consider using `--verbose` to print the full type name to the console + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/diagnostic-width/non-copy-type-moved.rs b/tests/ui/diagnostic-width/non-copy-type-moved.rs index a5593ad7b2a..a220c62775e 100644 --- a/tests/ui/diagnostic-width/non-copy-type-moved.rs +++ b/tests/ui/diagnostic-width/non-copy-type-moved.rs @@ -1,5 +1,7 @@ //@ compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" +// The regex below normalizes the long type file name to make it suitable for compare-modes. +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" + type A = (String, String, String, String); type B = (A, A, A, A); type C = (B, B, B, B); diff --git a/tests/ui/diagnostic-width/non-copy-type-moved.stderr b/tests/ui/diagnostic-width/non-copy-type-moved.stderr index da9385a5b4d..254542c7b39 100644 --- a/tests/ui/diagnostic-width/non-copy-type-moved.stderr +++ b/tests/ui/diagnostic-width/non-copy-type-moved.stderr @@ -1,14 +1,14 @@ error[E0382]: use of moved value: `x` - --> $DIR/non-copy-type-moved.rs:14:14 + --> $DIR/non-copy-type-moved.rs:16:14 | LL | fn foo(x: D) { - | - move occurs because `x` has type `((..., ..., ..., ...), ..., ..., ...)`, which does not implement the `Copy` trait + | - move occurs because `x` has type `(..., ..., ..., ...)`, which does not implement the `Copy` trait LL | let _a = x; | - value moved here LL | let _b = x; | ^ value used here after move | - = note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/non-copy-type-moved/non-copy-type-moved.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' = note: consider using `--verbose` to print the full type name to the console help: consider cloning the value if the performance cost is acceptable | diff --git a/tests/ui/diagnostic-width/secondary-label-with-long-type.rs b/tests/ui/diagnostic-width/secondary-label-with-long-type.rs index 6ed600c48ac..c8845af3183 100644 --- a/tests/ui/diagnostic-width/secondary-label-with-long-type.rs +++ b/tests/ui/diagnostic-width/secondary-label-with-long-type.rs @@ -1,5 +1,7 @@ //@ compile-flags: --diagnostic-width=100 -Zwrite-long-types-to-disk=yes -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" +// The regex below normalizes the long type file name to make it suitable for compare-modes. +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" + type A = (i32, i32, i32, i32); type B = (A, A, A, A); type C = (B, B, B, B); @@ -10,7 +12,7 @@ fn foo(x: D) { //~^ NOTE this expression has type `((..., //~| NOTE expected `((..., //~| NOTE expected tuple - //~| NOTE the full type name has been written to + //~| NOTE the full name for the type has been written to //~| NOTE consider using `--verbose` to print the full type name to the console } diff --git a/tests/ui/diagnostic-width/secondary-label-with-long-type.stderr b/tests/ui/diagnostic-width/secondary-label-with-long-type.stderr index 1e890455156..a95e1709148 100644 --- a/tests/ui/diagnostic-width/secondary-label-with-long-type.stderr +++ b/tests/ui/diagnostic-width/secondary-label-with-long-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/secondary-label-with-long-type.rs:9:9 + --> $DIR/secondary-label-with-long-type.rs:11:9 | LL | let () = x; | ^^ - this expression has type `((..., ..., ..., ...), ..., ..., ...)` @@ -8,7 +8,7 @@ LL | let () = x; | = note: expected tuple `((..., ..., ..., ...), ..., ..., ...)` found unit type `()` - = note: the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/secondary-label-with-long-type/secondary-label-with-long-type.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' = note: consider using `--verbose` to print the full type name to the console error: aborting due to 1 previous error diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.current.stderr index 28e7975c7a2..305fbbd275f 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.current.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `&str: AsExpression<Integer>` is not satisfied - --> $DIR/as_expression.rs:55:15 + --> $DIR/as_expression.rs:56:15 | LL | SelectInt.check("bar"); | ^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.next.stderr index 1b76669ccb0..90bb715a052 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.next.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `&str: AsExpression<<SelectInt as Expression>::SqlType>` is not satisfied - --> $DIR/as_expression.rs:55:21 + --> $DIR/as_expression.rs:56:21 | LL | SelectInt.check("bar"); | ----- ^^^^^ the trait `AsExpression<<SelectInt as Expression>::SqlType>` is not implemented for `&str` @@ -8,7 +8,7 @@ LL | SelectInt.check("bar"); | = help: the trait `AsExpression<Text>` is implemented for `&str` note: required by a bound in `Foo::check` - --> $DIR/as_expression.rs:46:12 + --> $DIR/as_expression.rs:47:12 | LL | fn check<T>(&self, _: T) -> <T as AsExpression<<Self as Expression>::SqlType>>::Expression | ----- required by a bound in this associated function @@ -16,23 +16,13 @@ LL | where LL | T: AsExpression<Self::SqlType>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::check` -error[E0277]: the trait bound `&str: AsExpression<Integer>` is not satisfied - --> $DIR/as_expression.rs:55:15 - | -LL | SelectInt.check("bar"); - | ^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str` - | - = help: the trait `AsExpression<Integer>` is not implemented for `&str` - but trait `AsExpression<Text>` is implemented for it - = help: for that trait implementation, expected `Text`, found `Integer` - error[E0271]: type mismatch resolving `<SelectInt as Expression>::SqlType == Text` - --> $DIR/as_expression.rs:55:5 + --> $DIR/as_expression.rs:56:5 | LL | SelectInt.check("bar"); | ^^^^^^^^^^^^^^^^^^^^^^ expected `Text`, found `Integer` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors Some errors have detailed explanations: E0271, E0277. For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs index 583b3c4675a..73a238ddf50 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs @@ -1,6 +1,7 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver +//@ reference: attributes.diagnostic.do_not_recommend.intro pub trait Expression { type SqlType; @@ -53,7 +54,7 @@ impl<T> Foo for T where T: Expression {} fn main() { SelectInt.check("bar"); - //~^ ERROR the trait bound `&str: AsExpression<Integer>` is not satisfied - //[next]~| the trait bound `&str: AsExpression<<SelectInt as Expression>::SqlType>` is not satisfied + //[current]~^ ERROR the trait bound `&str: AsExpression<Integer>` is not satisfied + //[next]~^^ the trait bound `&str: AsExpression<<SelectInt as Expression>::SqlType>` is not satisfied //[next]~| type mismatch } 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 47597a5d405..8a478a5c733 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 @@ -1,5 +1,5 @@ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments - --> $DIR/does_not_acccept_args.rs:10:1 + --> $DIR/does_not_acccept_args.rs:11:1 | LL | #[diagnostic::do_not_recommend(not_accepted)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,13 +7,13 @@ LL | #[diagnostic::do_not_recommend(not_accepted)] = note: `#[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:14:1 + --> $DIR/does_not_acccept_args.rs:15:1 | LL | #[diagnostic::do_not_recommend(not_accepted = "foo")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments - --> $DIR/does_not_acccept_args.rs:18:1 + --> $DIR/does_not_acccept_args.rs:19:1 | LL | #[diagnostic::do_not_recommend(not_accepted(42))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 47597a5d405..8a478a5c733 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 @@ -1,5 +1,5 @@ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments - --> $DIR/does_not_acccept_args.rs:10:1 + --> $DIR/does_not_acccept_args.rs:11:1 | LL | #[diagnostic::do_not_recommend(not_accepted)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,13 +7,13 @@ LL | #[diagnostic::do_not_recommend(not_accepted)] = note: `#[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:14:1 + --> $DIR/does_not_acccept_args.rs:15:1 | LL | #[diagnostic::do_not_recommend(not_accepted = "foo")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments - --> $DIR/does_not_acccept_args.rs:18:1 + --> $DIR/does_not_acccept_args.rs:19:1 | LL | #[diagnostic::do_not_recommend(not_accepted(42))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.rs b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.rs index eeff5e2e6e8..5c21c045e10 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.rs @@ -2,6 +2,7 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver +//@ reference: attributes.diagnostic.do_not_recommend.syntax trait Foo {} trait Bar {} 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 ee6ebabadd9..e348f0c8902 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 @@ -1,5 +1,5 @@ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:6:1 + --> $DIR/incorrect-locations.rs:7:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,49 +7,49 @@ LL | #[diagnostic::do_not_recommend] = note: `#[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:10:1 + --> $DIR/incorrect-locations.rs:11:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:14:1 + --> $DIR/incorrect-locations.rs:15:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:18:1 + --> $DIR/incorrect-locations.rs:19:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:22:1 + --> $DIR/incorrect-locations.rs:23:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:26:1 + --> $DIR/incorrect-locations.rs:27:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:30:1 + --> $DIR/incorrect-locations.rs:31:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:34:1 + --> $DIR/incorrect-locations.rs:35:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:38:1 + --> $DIR/incorrect-locations.rs:39:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 ee6ebabadd9..e348f0c8902 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 @@ -1,5 +1,5 @@ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:6:1 + --> $DIR/incorrect-locations.rs:7:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,49 +7,49 @@ LL | #[diagnostic::do_not_recommend] = note: `#[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:10:1 + --> $DIR/incorrect-locations.rs:11:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:14:1 + --> $DIR/incorrect-locations.rs:15:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:18:1 + --> $DIR/incorrect-locations.rs:19:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:22:1 + --> $DIR/incorrect-locations.rs:23:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:26:1 + --> $DIR/incorrect-locations.rs:27:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:30:1 + --> $DIR/incorrect-locations.rs:31:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:34:1 + --> $DIR/incorrect-locations.rs:35:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:38:1 + --> $DIR/incorrect-locations.rs:39:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs index 1cf436aa2af..e716457eaed 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs @@ -2,6 +2,7 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver +//@ reference: attributes.diagnostic.do_not_recommend.allowed-positions #[diagnostic::do_not_recommend] //~^WARN `#[diagnostic::do_not_recommend]` can only be placed diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr index b14c68d6897..cb1da8ff8be 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `(): Root` is not satisfied - --> $DIR/nested.rs:21:18 + --> $DIR/nested.rs:22:18 | LL | needs_root::<()>(); | ^^ the trait `Root` is not implemented for `()` | note: required by a bound in `needs_root` - --> $DIR/nested.rs:18:18 + --> $DIR/nested.rs:19:18 | LL | fn needs_root<T: Root>() {} | ^^^^ required by this bound in `needs_root` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr index b14c68d6897..cb1da8ff8be 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `(): Root` is not satisfied - --> $DIR/nested.rs:21:18 + --> $DIR/nested.rs:22:18 | LL | needs_root::<()>(); | ^^ the trait `Root` is not implemented for `()` | note: required by a bound in `needs_root` - --> $DIR/nested.rs:18:18 + --> $DIR/nested.rs:19:18 | LL | fn needs_root<T: Root>() {} | ^^^^ required by this bound in `needs_root` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/nested.rs b/tests/ui/diagnostic_namespace/do_not_recommend/nested.rs index 6534157d1fb..3c96c760dfb 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/nested.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/nested.rs @@ -1,6 +1,7 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver +//@ reference: attributes.diagnostic.do_not_recommend.intro trait Root {} trait DontRecommend {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr index 884b13c17b8..dd425f1e6ee 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `*mut (): Foo` is not satisfied - --> $DIR/simple.rs:15:17 + --> $DIR/simple.rs:16:17 | LL | needs_foo::<*mut ()>(); | ^^^^^^^ the trait `Foo` is not implemented for `*mut ()` | note: required by a bound in `needs_foo` - --> $DIR/simple.rs:10:17 + --> $DIR/simple.rs:11:17 | LL | fn needs_foo<T: Foo>() {} | ^^^ required by this bound in `needs_foo` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr index 884b13c17b8..dd425f1e6ee 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `*mut (): Foo` is not satisfied - --> $DIR/simple.rs:15:17 + --> $DIR/simple.rs:16:17 | LL | needs_foo::<*mut ()>(); | ^^^^^^^ the trait `Foo` is not implemented for `*mut ()` | note: required by a bound in `needs_foo` - --> $DIR/simple.rs:10:17 + --> $DIR/simple.rs:11:17 | LL | fn needs_foo<T: Foo>() {} | ^^^ required by this bound in `needs_foo` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs b/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs index 6bca2b724d2..a6fa7ac7949 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs @@ -1,6 +1,7 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver +//@ reference: attributes.diagnostic.do_not_recommend.intro trait Foo {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/stacked.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/stacked.current.stderr index d8605806395..d940c3fd477 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/stacked.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/stacked.current.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `(): Root` is not satisfied - --> $DIR/stacked.rs:17:18 + --> $DIR/stacked.rs:18:18 | LL | needs_root::<()>(); | ^^ the trait `Root` is not implemented for `()` | note: required by a bound in `needs_root` - --> $DIR/stacked.rs:14:18 + --> $DIR/stacked.rs:15:18 | LL | fn needs_root<T: Root>() {} | ^^^^ required by this bound in `needs_root` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/stacked.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/stacked.next.stderr index d8605806395..d940c3fd477 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/stacked.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/stacked.next.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `(): Root` is not satisfied - --> $DIR/stacked.rs:17:18 + --> $DIR/stacked.rs:18:18 | LL | needs_root::<()>(); | ^^ the trait `Root` is not implemented for `()` | note: required by a bound in `needs_root` - --> $DIR/stacked.rs:14:18 + --> $DIR/stacked.rs:15:18 | LL | fn needs_root<T: Root>() {} | ^^^^ required by this bound in `needs_root` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/stacked.rs b/tests/ui/diagnostic_namespace/do_not_recommend/stacked.rs index 842e04b9d90..fd7be35ff84 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/stacked.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/stacked.rs @@ -1,6 +1,7 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver +//@ reference: attributes.diagnostic.do_not_recommend.intro trait Root {} trait DontRecommend {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.current.stderr index 95ccbb92a89..0b07b073172 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.current.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `(): Foo` is not satisfied - --> $DIR/supress_suggestions_in_help.rs:21:11 + --> $DIR/supress_suggestions_in_help.rs:22:11 | LL | check(()); | ----- ^^ the trait `Foo` is not implemented for `()` @@ -8,7 +8,7 @@ LL | check(()); | = help: the trait `Foo` is implemented for `i32` note: required by a bound in `check` - --> $DIR/supress_suggestions_in_help.rs:18:18 + --> $DIR/supress_suggestions_in_help.rs:19:18 | LL | fn check(a: impl Foo) {} | ^^^ required by this bound in `check` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.next.stderr index 95ccbb92a89..0b07b073172 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.next.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `(): Foo` is not satisfied - --> $DIR/supress_suggestions_in_help.rs:21:11 + --> $DIR/supress_suggestions_in_help.rs:22:11 | LL | check(()); | ----- ^^ the trait `Foo` is not implemented for `()` @@ -8,7 +8,7 @@ LL | check(()); | = help: the trait `Foo` is implemented for `i32` note: required by a bound in `check` - --> $DIR/supress_suggestions_in_help.rs:18:18 + --> $DIR/supress_suggestions_in_help.rs:19:18 | LL | fn check(a: impl Foo) {} | ^^^ required by this bound in `check` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.rs b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.rs index 2c7c1516123..04cf8243a67 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.rs @@ -1,6 +1,7 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver +//@ reference: attributes.diagnostic.do_not_recommend.intro trait Foo {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.current.stderr index b53febbb71a..31a1ae991ec 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.current.stderr @@ -1,11 +1,11 @@ error[E0277]: Very important message! - --> $DIR/type_mismatch.rs:23:14 + --> $DIR/type_mismatch.rs:24:14 | LL | verify::<u8>(); | ^^ the trait `TheImportantOne` is not implemented for `u8` | note: required by a bound in `verify` - --> $DIR/type_mismatch.rs:20:14 + --> $DIR/type_mismatch.rs:21:14 | LL | fn verify<T: TheImportantOne>() {} | ^^^^^^^^^^^^^^^ required by this bound in `verify` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.next.stderr index b53febbb71a..31a1ae991ec 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.next.stderr @@ -1,11 +1,11 @@ error[E0277]: Very important message! - --> $DIR/type_mismatch.rs:23:14 + --> $DIR/type_mismatch.rs:24:14 | LL | verify::<u8>(); | ^^ the trait `TheImportantOne` is not implemented for `u8` | note: required by a bound in `verify` - --> $DIR/type_mismatch.rs:20:14 + --> $DIR/type_mismatch.rs:21:14 | LL | fn verify<T: TheImportantOne>() {} | ^^^^^^^^^^^^^^^ required by this bound in `verify` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.rs b/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.rs index 7f30fdb06c7..b5bd14745cd 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.rs @@ -1,6 +1,7 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver +//@ reference: attributes.diagnostic.do_not_recommend.intro #[diagnostic::on_unimplemented(message = "Very important message!")] trait TheImportantOne {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.current.stderr index a8429ff60f8..7e348842e19 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.current.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/with_lifetime.rs:17:5 + --> $DIR/with_lifetime.rs:18:5 | LL | fn foo<'a>(a: &'a ()) { | -- lifetime `'a` defined here diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.next.stderr index a8429ff60f8..7e348842e19 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.next.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/with_lifetime.rs:17:5 + --> $DIR/with_lifetime.rs:18:5 | LL | fn foo<'a>(a: &'a ()) { | -- lifetime `'a` defined here diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs index 6a67d83d5fe..98916ed061f 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs @@ -1,6 +1,7 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver +//@ reference: attributes.diagnostic.do_not_recommend.intro trait Root {} trait DontRecommend {} diff --git a/tests/ui/diagnostic_namespace/suggest_typos.stderr b/tests/ui/diagnostic_namespace/suggest_typos.stderr index ff4ee9717d4..f41e2f65556 100644 --- a/tests/ui/diagnostic_namespace/suggest_typos.stderr +++ b/tests/ui/diagnostic_namespace/suggest_typos.stderr @@ -11,8 +11,9 @@ LL | #![deny(unknown_or_malformed_diagnostic_attributes)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: an attribute with a similar name exists | -LL | #[diagnostic::on_unimplemented] - | ~~~~~~~~~~~~~~~~ +LL - #[diagnostic::onunimplemented] +LL + #[diagnostic::on_unimplemented] + | error: unknown diagnostic attribute --> $DIR/suggest_typos.rs:9:15 @@ -22,8 +23,9 @@ LL | #[diagnostic::un_onimplemented] | help: an attribute with a similar name exists | -LL | #[diagnostic::on_unimplemented] - | ~~~~~~~~~~~~~~~~ +LL - #[diagnostic::un_onimplemented] +LL + #[diagnostic::on_unimplemented] + | error: unknown diagnostic attribute --> $DIR/suggest_typos.rs:14:15 @@ -33,8 +35,9 @@ LL | #[diagnostic::on_implemented] | help: an attribute with a similar name exists | -LL | #[diagnostic::on_unimplemented] - | ~~~~~~~~~~~~~~~~ +LL - #[diagnostic::on_implemented] +LL + #[diagnostic::on_unimplemented] + | error: aborting due to 3 previous errors diff --git a/tests/ui/did_you_mean/bad-assoc-ty.stderr b/tests/ui/did_you_mean/bad-assoc-ty.stderr index 5fc2f7c1fe6..7e34f4d35b4 100644 --- a/tests/ui/did_you_mean/bad-assoc-ty.stderr +++ b/tests/ui/did_you_mean/bad-assoc-ty.stderr @@ -109,8 +109,9 @@ LL | type A = [u8; 4]::AssocTy; | help: if there were a trait named `Example` with associated type `AssocTy` implemented for `[u8; 4]`, you could use the fully-qualified path | -LL | type A = <[u8; 4] as Example>::AssocTy; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - type A = [u8; 4]::AssocTy; +LL + type A = <[u8; 4] as Example>::AssocTy; + | error[E0223]: ambiguous associated type --> $DIR/bad-assoc-ty.rs:5:10 @@ -120,8 +121,9 @@ LL | type B = [u8]::AssocTy; | help: if there were a trait named `Example` with associated type `AssocTy` implemented for `[u8]`, you could use the fully-qualified path | -LL | type B = <[u8] as Example>::AssocTy; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - type B = [u8]::AssocTy; +LL + type B = <[u8] as Example>::AssocTy; + | error[E0223]: ambiguous associated type --> $DIR/bad-assoc-ty.rs:9:10 @@ -131,8 +133,9 @@ LL | type C = (u8)::AssocTy; | help: if there were a trait named `Example` with associated type `AssocTy` implemented for `u8`, you could use the fully-qualified path | -LL | type C = <u8 as Example>::AssocTy; - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - type C = (u8)::AssocTy; +LL + type C = <u8 as Example>::AssocTy; + | error[E0223]: ambiguous associated type --> $DIR/bad-assoc-ty.rs:13:10 @@ -142,8 +145,9 @@ LL | type D = (u8, u8)::AssocTy; | help: if there were a trait named `Example` with associated type `AssocTy` implemented for `(u8, u8)`, you could use the fully-qualified path | -LL | type D = <(u8, u8) as Example>::AssocTy; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - type D = (u8, u8)::AssocTy; +LL + type D = <(u8, u8) as Example>::AssocTy; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases --> $DIR/bad-assoc-ty.rs:17:10 @@ -159,8 +163,9 @@ LL | type F = &'static (u8)::AssocTy; | help: if there were a trait named `Example` with associated type `AssocTy` implemented for `u8`, you could use the fully-qualified path | -LL | type F = &'static <u8 as Example>::AssocTy; - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - type F = &'static (u8)::AssocTy; +LL + type F = &'static <u8 as Example>::AssocTy; + | error[E0223]: ambiguous associated type --> $DIR/bad-assoc-ty.rs:27:10 @@ -170,8 +175,9 @@ LL | type G = dyn 'static + (Send)::AssocTy; | help: if there were a trait named `Example` with associated type `AssocTy` implemented for `(dyn Send + 'static)`, you could use the fully-qualified path | -LL | type G = <(dyn Send + 'static) as Example>::AssocTy; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - type G = dyn 'static + (Send)::AssocTy; +LL + type G = <(dyn Send + 'static) as Example>::AssocTy; + | warning: trait objects without an explicit `dyn` are deprecated --> $DIR/bad-assoc-ty.rs:33:10 @@ -195,10 +201,12 @@ LL | type H = Fn(u8) -> (u8)::Output; | help: use fully-qualified syntax | -LL | type H = <(dyn Fn(u8) -> u8 + 'static) as BitOr>::Output; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | type H = <(dyn Fn(u8) -> u8 + 'static) as IntoFuture>::Output; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - type H = Fn(u8) -> (u8)::Output; +LL + type H = <(dyn Fn(u8) -> u8 + 'static) as BitOr>::Output; + | +LL - type H = Fn(u8) -> (u8)::Output; +LL + type H = <(dyn Fn(u8) -> u8 + 'static) as IntoFuture>::Output; + | error[E0223]: ambiguous associated type --> $DIR/bad-assoc-ty.rs:39:19 @@ -212,8 +220,9 @@ LL | type J = ty!(u8); = note: this error originates in the macro `ty` (in Nightly builds, run with -Z macro-backtrace for more info) help: if there were a trait named `Example` with associated type `AssocTy` implemented for `u8`, you could use the fully-qualified path | -LL | ($ty: ty) => (<u8 as Example>::AssocTy); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - ($ty: ty) => ($ty::AssocTy); +LL + ($ty: ty) => (<u8 as Example>::AssocTy); + | error[E0223]: ambiguous associated type --> $DIR/bad-assoc-ty.rs:46:10 @@ -223,8 +232,9 @@ LL | type I = ty!()::AssocTy; | help: if there were a trait named `Example` with associated type `AssocTy` implemented for `u8`, you could use the fully-qualified path | -LL | type I = <u8 as Example>::AssocTy; - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - type I = ty!()::AssocTy; +LL + type I = <u8 as Example>::AssocTy; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/bad-assoc-ty.rs:51:13 @@ -242,8 +252,9 @@ LL | fn bar<F>(_: F) where F: Fn() -> _ {} | help: use type parameters instead | -LL | fn bar<F, T>(_: F) where F: Fn() -> T {} - | +++ ~ +LL - fn bar<F>(_: F) where F: Fn() -> _ {} +LL + fn bar<F, T>(_: F) where F: Fn() -> T {} + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/bad-assoc-ty.rs:57:19 @@ -253,8 +264,9 @@ LL | fn baz<F: Fn() -> _>(_: F) {} | help: use type parameters instead | -LL | fn baz<F: Fn() -> T, T>(_: F) {} - | ~+++ +LL - fn baz<F: Fn() -> _>(_: F) {} +LL + fn baz<F: Fn() -> T, T>(_: F) {} + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/bad-assoc-ty.rs:60:33 @@ -264,8 +276,9 @@ LL | struct L<F>(F) where F: Fn() -> _; | help: use type parameters instead | -LL | struct L<F, T>(F) where F: Fn() -> T; - | +++ ~ +LL - struct L<F>(F) where F: Fn() -> _; +LL + struct L<F, T>(F) where F: Fn() -> T; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/bad-assoc-ty.rs:82:38 @@ -275,8 +288,9 @@ LL | fn foo<F>(_: F) where F: Fn() -> _ {} | help: use type parameters instead | -LL | fn foo<F, T>(_: F) where F: Fn() -> T {} - | +++ ~ +LL - fn foo<F>(_: F) where F: Fn() -> _ {} +LL + fn foo<F, T>(_: F) where F: Fn() -> T {} + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/bad-assoc-ty.rs:62:30 @@ -286,8 +300,9 @@ LL | struct M<F> where F: Fn() -> _ { | help: use type parameters instead | -LL | struct M<F, T> where F: Fn() -> T { - | +++ ~ +LL - struct M<F> where F: Fn() -> _ { +LL + struct M<F, T> where F: Fn() -> T { + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for enums --> $DIR/bad-assoc-ty.rs:66:28 @@ -297,8 +312,9 @@ LL | enum N<F> where F: Fn() -> _ { | help: use type parameters instead | -LL | enum N<F, T> where F: Fn() -> T { - | +++ ~ +LL - enum N<F> where F: Fn() -> _ { +LL + enum N<F, T> where F: Fn() -> T { + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for unions --> $DIR/bad-assoc-ty.rs:71:29 @@ -308,8 +324,9 @@ LL | union O<F> where F: Fn() -> _ { | help: use type parameters instead | -LL | union O<F, T> where F: Fn() -> T { - | +++ ~ +LL - union O<F> where F: Fn() -> _ { +LL + union O<F, T> where F: Fn() -> T { + | error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union --> $DIR/bad-assoc-ty.rs:73:5 @@ -331,8 +348,9 @@ LL | trait P<F> where F: Fn() -> _ { | help: use type parameters instead | -LL | trait P<F, T> where F: Fn() -> T { - | +++ ~ +LL - trait P<F> where F: Fn() -> _ { +LL + trait P<F, T> where F: Fn() -> T { + | error: aborting due to 29 previous errors; 1 warning emitted diff --git a/tests/ui/did_you_mean/brackets-to-braces-single-element.stderr b/tests/ui/did_you_mean/brackets-to-braces-single-element.stderr index a7ec192592e..d4aeb1eee96 100644 --- a/tests/ui/did_you_mean/brackets-to-braces-single-element.stderr +++ b/tests/ui/did_you_mean/brackets-to-braces-single-element.stderr @@ -6,8 +6,9 @@ LL | const A: [&str; 1] = { "hello" }; | help: to create an array, use square brackets instead of curly braces | -LL | const A: [&str; 1] = [ "hello" ]; - | ~ ~ +LL - const A: [&str; 1] = { "hello" }; +LL + const A: [&str; 1] = [ "hello" ]; + | error[E0308]: mismatched types --> $DIR/brackets-to-braces-single-element.rs:4:19 @@ -19,8 +20,9 @@ LL | const B: &[u32] = &{ 1 }; found reference `&{integer}` help: to create an array, use square brackets instead of curly braces | -LL | const B: &[u32] = &[ 1 ]; - | ~ ~ +LL - const B: &[u32] = &{ 1 }; +LL + const B: &[u32] = &[ 1 ]; + | error[E0308]: mismatched types --> $DIR/brackets-to-braces-single-element.rs:7:27 @@ -30,8 +32,9 @@ LL | const C: &&[u32; 1] = &&{ 1 }; | help: to create an array, use square brackets instead of curly braces | -LL | const C: &&[u32; 1] = &&[ 1 ]; - | ~ ~ +LL - const C: &&[u32; 1] = &&{ 1 }; +LL + const C: &&[u32; 1] = &&[ 1 ]; + | error: aborting due to 3 previous errors diff --git a/tests/ui/did_you_mean/compatible-variants-in-pat.stderr b/tests/ui/did_you_mean/compatible-variants-in-pat.stderr index 5e48871bb01..09cf094e6bd 100644 --- a/tests/ui/did_you_mean/compatible-variants-in-pat.stderr +++ b/tests/ui/did_you_mean/compatible-variants-in-pat.stderr @@ -33,8 +33,9 @@ LL | Some(S) => { | +++++ + help: introduce a new binding instead | -LL | other_s => { - | ~~~~~~~ +LL - S => { +LL + other_s => { + | error[E0308]: mismatched types --> $DIR/compatible-variants-in-pat.rs:32:9 @@ -60,8 +61,9 @@ LL | Err(S) => { | ++++ + help: introduce a new binding instead | -LL | other_s => { - | ~~~~~~~ +LL - S => { +LL + other_s => { + | error: aborting due to 3 previous errors diff --git a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr index 473c9a339fc..411eec84963 100644 --- a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr +++ b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr @@ -11,7 +11,7 @@ LL | const CRATE: Crate = Crate { fiel: () }; help: a field with a similar name exists | LL | const CRATE: Crate = Crate { field: () }; - | ~~~~~ + | + error[E0609]: no field `field` on type `Compound` --> $DIR/dont-suggest-hygienic-fields.rs:24:16 diff --git a/tests/ui/did_you_mean/issue-36798.stderr b/tests/ui/did_you_mean/issue-36798.stderr index 70aa3c32bfb..233cb1e3248 100644 --- a/tests/ui/did_you_mean/issue-36798.stderr +++ b/tests/ui/did_you_mean/issue-36798.stderr @@ -6,8 +6,9 @@ LL | f.baz; | help: a field with a similar name exists | -LL | f.bar; - | ~~~ +LL - f.baz; +LL + f.bar; + | error: aborting due to 1 previous error diff --git a/tests/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr b/tests/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr index 952ac76a003..9893aad7486 100644 --- a/tests/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr +++ b/tests/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr @@ -6,8 +6,9 @@ LL | let _x = ~1; | help: use `!` to perform bitwise not | -LL | let _x = !1; - | ~ +LL - let _x = ~1; +LL + let _x = !1; + | error: unexpected `1` after identifier --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:5:18 @@ -17,8 +18,9 @@ LL | let _y = not 1; | help: use `!` to perform bitwise not | -LL | let _y = !1; - | ~ +LL - let _y = not 1; +LL + let _y = !1; + | error: unexpected keyword `false` after identifier --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:6:18 @@ -28,8 +30,9 @@ LL | let _z = not false; | help: use `!` to perform logical negation | -LL | let _z = !false; - | ~ +LL - let _z = not false; +LL + let _z = !false; + | error: unexpected keyword `true` after identifier --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:7:18 @@ -39,8 +42,9 @@ LL | let _a = not true; | help: use `!` to perform logical negation | -LL | let _a = !true; - | ~ +LL - let _a = not true; +LL + let _a = !true; + | error: unexpected `v` after identifier --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:9:18 @@ -50,8 +54,9 @@ LL | let _v = not v; | help: use `!` to perform logical negation or bitwise not | -LL | let _v = !v; - | ~ +LL - let _v = not v; +LL + let _v = !v; + | error: aborting due to 5 previous errors diff --git a/tests/ui/did_you_mean/issue-42599_available_fields_note.stderr b/tests/ui/did_you_mean/issue-42599_available_fields_note.stderr index d60db01a465..8fe46eb7ee1 100644 --- a/tests/ui/did_you_mean/issue-42599_available_fields_note.stderr +++ b/tests/ui/did_you_mean/issue-42599_available_fields_note.stderr @@ -6,8 +6,9 @@ LL | Self { secret_integer: 2, inocently_mispellable: () } | help: a field with a similar name exists | -LL | Self { secret_integer: 2, innocently_misspellable: () } - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - Self { secret_integer: 2, inocently_mispellable: () } +LL + Self { secret_integer: 2, innocently_misspellable: () } + | error[E0560]: struct `Demo` has no field named `egregiously_nonexistent_field` --> $DIR/issue-42599_available_fields_note.rs:21:39 @@ -25,8 +26,9 @@ LL | let innocent_field_misaccess = demo.inocently_mispellable; | help: a field with a similar name exists | -LL | let innocent_field_misaccess = demo.innocently_misspellable; - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - let innocent_field_misaccess = demo.inocently_mispellable; +LL + let innocent_field_misaccess = demo.innocently_misspellable; + | error[E0609]: no field `egregiously_nonexistent_field` on type `Demo` --> $DIR/issue-42599_available_fields_note.rs:35:42 diff --git a/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr b/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr index 92cbc03e0dd..633f331a13a 100644 --- a/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr +++ b/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr @@ -6,8 +6,9 @@ LL | PersonalityInventory { expressivity: exp, ... } => exp | help: to omit remaining fields, use `..` | -LL | PersonalityInventory { expressivity: exp, .. } => exp - | ~~ +LL - PersonalityInventory { expressivity: exp, ... } => exp +LL + PersonalityInventory { expressivity: exp, .. } => exp + | error: aborting due to 1 previous error diff --git a/tests/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr b/tests/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr index 6dea6a4fac8..3a25181d29c 100644 --- a/tests/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr +++ b/tests/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr @@ -6,8 +6,9 @@ LL | if not for_you { | help: use `!` to perform logical negation or bitwise not | -LL | if !for_you { - | ~ +LL - if not for_you { +LL + if !for_you { + | error: unexpected `the_worst` after identifier --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:11:15 @@ -17,8 +18,9 @@ LL | while not the_worst { | help: use `!` to perform logical negation or bitwise not | -LL | while !the_worst { - | ~ +LL - while not the_worst { +LL + while !the_worst { + | error: unexpected `println` after identifier --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:20:9 @@ -28,8 +30,9 @@ LL | println!("Then when?"); | help: use `!` to perform logical negation or bitwise not | -LL | if !// lack of braces is [sic] - | ~ +LL - if not // lack of braces is [sic] +LL + if !// lack of braces is [sic] + | error: expected `{`, found `;` --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:20:31 @@ -53,8 +56,9 @@ LL | let resource = not 2; | help: use `!` to perform bitwise not | -LL | let resource = !2; - | ~ +LL - let resource = not 2; +LL + let resource = !2; + | error: unexpected `be_smothered_out_before` after identifier --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:32:27 @@ -64,8 +68,9 @@ LL | let young_souls = not be_smothered_out_before; | help: use `!` to perform logical negation or bitwise not | -LL | let young_souls = !be_smothered_out_before; - | ~ +LL - let young_souls = not be_smothered_out_before; +LL + let young_souls = !be_smothered_out_before; + | error: aborting due to 6 previous errors diff --git a/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr b/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr index 6d92fa5e14e..d4812d4831b 100644 --- a/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr +++ b/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr @@ -34,8 +34,9 @@ LL | (Nucleotide::Adenine, Nucleotide::Cytosine, _) => true | + + help: ...or a vertical bar to match on multiple alternatives | -LL | Nucleotide::Adenine | Nucleotide::Cytosine | _ => true - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - Nucleotide::Adenine, Nucleotide::Cytosine, _ => true +LL + Nucleotide::Adenine | Nucleotide::Cytosine | _ => true + | error: unexpected `,` in pattern --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:67:10 diff --git a/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr b/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr index 4b3d429c750..664bf69b9eb 100644 --- a/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr +++ b/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr @@ -12,8 +12,9 @@ LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e−11; // m³⋅kg⁻¹ | help: Unicode character '−' (Minus Sign) looks like '-' (Minus/Hyphen), but it is not | -LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e-11; // m³⋅kg⁻¹⋅s⁻² - | ~ +LL - const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e−11; // m³⋅kg⁻¹⋅s⁻² +LL + const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e-11; // m³⋅kg⁻¹⋅s⁻² + | error: aborting due to 2 previous errors diff --git a/tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr b/tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr index c52102e2631..5dad6924dfd 100644 --- a/tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr +++ b/tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr @@ -7,8 +7,9 @@ LL | let _ = a and b; = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `&&` to perform logical conjunction | -LL | let _ = a && b; - | ~~ +LL - let _ = a and b; +LL + let _ = a && b; + | error: `and` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:9:10 @@ -19,8 +20,9 @@ LL | if a and b { = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `&&` to perform logical conjunction | -LL | if a && b { - | ~~ +LL - if a and b { +LL + if a && b { + | error: `or` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:20:15 @@ -31,8 +33,9 @@ LL | let _ = a or b; = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `||` to perform logical disjunction | -LL | let _ = a || b; - | ~~ +LL - let _ = a or b; +LL + let _ = a || b; + | error: `or` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:22:10 @@ -43,8 +46,9 @@ LL | if a or b { = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `||` to perform logical disjunction | -LL | if a || b { - | ~~ +LL - if a or b { +LL + if a || b { + | error: `and` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:30:11 @@ -55,8 +59,9 @@ LL | if (a and b) { = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `&&` to perform logical conjunction | -LL | if (a && b) { - | ~~ +LL - if (a and b) { +LL + if (a && b) { + | error: `or` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:38:11 @@ -67,8 +72,9 @@ LL | if (a or b) { = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `||` to perform logical disjunction | -LL | if (a || b) { - | ~~ +LL - if (a or b) { +LL + if (a || b) { + | error: `and` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:46:13 @@ -79,8 +85,9 @@ LL | while a and b { = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `&&` to perform logical conjunction | -LL | while a && b { - | ~~ +LL - while a and b { +LL + while a && b { + | error: `or` is not a logical operator --> $DIR/issue-54109-and_instead_of_ampersands.rs:54:13 @@ -91,8 +98,9 @@ LL | while a or b { = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `||` to perform logical disjunction | -LL | while a || b { - | ~~ +LL - while a or b { +LL + while a || b { + | error[E0308]: mismatched types --> $DIR/issue-54109-and_instead_of_ampersands.rs:13:33 diff --git a/tests/ui/did_you_mean/issue-54109-without-witness.stderr b/tests/ui/did_you_mean/issue-54109-without-witness.stderr index ee6d9901fcf..1ad88f0084c 100644 --- a/tests/ui/did_you_mean/issue-54109-without-witness.stderr +++ b/tests/ui/did_you_mean/issue-54109-without-witness.stderr @@ -7,8 +7,9 @@ LL | let _ = a and b; = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `&&` to perform logical conjunction | -LL | let _ = a && b; - | ~~ +LL - let _ = a and b; +LL + let _ = a && b; + | error: `and` is not a logical operator --> $DIR/issue-54109-without-witness.rs:15:10 @@ -19,8 +20,9 @@ LL | if a and b { = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `&&` to perform logical conjunction | -LL | if a && b { - | ~~ +LL - if a and b { +LL + if a && b { + | error: `or` is not a logical operator --> $DIR/issue-54109-without-witness.rs:24:15 @@ -31,8 +33,9 @@ LL | let _ = a or b; = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `||` to perform logical disjunction | -LL | let _ = a || b; - | ~~ +LL - let _ = a or b; +LL + let _ = a || b; + | error: `or` is not a logical operator --> $DIR/issue-54109-without-witness.rs:26:10 @@ -43,8 +46,9 @@ LL | if a or b { = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `||` to perform logical disjunction | -LL | if a || b { - | ~~ +LL - if a or b { +LL + if a || b { + | error: `and` is not a logical operator --> $DIR/issue-54109-without-witness.rs:34:11 @@ -55,8 +59,9 @@ LL | if (a and b) { = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `&&` to perform logical conjunction | -LL | if (a && b) { - | ~~ +LL - if (a and b) { +LL + if (a && b) { + | error: `or` is not a logical operator --> $DIR/issue-54109-without-witness.rs:42:11 @@ -67,8 +72,9 @@ LL | if (a or b) { = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `||` to perform logical disjunction | -LL | if (a || b) { - | ~~ +LL - if (a or b) { +LL + if (a || b) { + | error: `and` is not a logical operator --> $DIR/issue-54109-without-witness.rs:50:13 @@ -79,8 +85,9 @@ LL | while a and b { = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `&&` to perform logical conjunction | -LL | while a && b { - | ~~ +LL - while a and b { +LL + while a && b { + | error: `or` is not a logical operator --> $DIR/issue-54109-without-witness.rs:58:13 @@ -91,8 +98,9 @@ LL | while a or b { = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators help: use `||` to perform logical disjunction | -LL | while a || b { - | ~~ +LL - while a or b { +LL + while a || b { + | error: aborting due to 8 previous errors diff --git a/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr b/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr index b1a15b8594a..927f9e842e6 100644 --- a/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr +++ b/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr @@ -6,14 +6,18 @@ LL | fn setup() -> Set { Set } | help: there is an enum variant `AffixHeart::Set` and 7 others; try using the variant's enum | -LL | fn setup() -> AffixHeart { Set } - | ~~~~~~~~~~ -LL | fn setup() -> CauseToBe { Set } - | ~~~~~~~~~ -LL | fn setup() -> Determine { Set } - | ~~~~~~~~~ -LL | fn setup() -> PutDown { Set } - | ~~~~~~~ +LL - fn setup() -> Set { Set } +LL + fn setup() -> AffixHeart { Set } + | +LL - fn setup() -> Set { Set } +LL + fn setup() -> CauseToBe { Set } + | +LL - fn setup() -> Set { Set } +LL + fn setup() -> Determine { Set } + | +LL - fn setup() -> Set { Set } +LL + fn setup() -> PutDown { Set } + | and 3 other candidates error[E0425]: cannot find value `Set` in this scope diff --git a/tests/ui/did_you_mean/issue-87830-try-brackets-for-arrays.stderr b/tests/ui/did_you_mean/issue-87830-try-brackets-for-arrays.stderr index d5ad1a72b82..58232e2307d 100644 --- a/tests/ui/did_you_mean/issue-87830-try-brackets-for-arrays.stderr +++ b/tests/ui/did_you_mean/issue-87830-try-brackets-for-arrays.stderr @@ -24,8 +24,9 @@ LL | const BAR: [&str; 3] = {"one", "two", "three"}; | help: to make an array, use square brackets instead of curly braces | -LL | const BAR: [&str; 3] = ["one", "two", "three"]; - | ~ ~ +LL - const BAR: [&str; 3] = {"one", "two", "three"}; +LL + const BAR: [&str; 3] = ["one", "two", "three"]; + | error: this is a block expression, not an array --> $DIR/issue-87830-try-brackets-for-arrays.rs:12:5 @@ -35,8 +36,9 @@ LL | {1, 2, 3}; | help: to make an array, use square brackets instead of curly braces | -LL | [1, 2, 3]; - | ~ ~ +LL - {1, 2, 3}; +LL + [1, 2, 3]; + | error: expected one of `.`, `;`, `?`, `}`, or an operator, found `,` --> $DIR/issue-87830-try-brackets-for-arrays.rs:17:6 diff --git a/tests/ui/did_you_mean/pub-macro-rules.stderr b/tests/ui/did_you_mean/pub-macro-rules.stderr index fb9148748ca..a91d419d96b 100644 --- a/tests/ui/did_you_mean/pub-macro-rules.stderr +++ b/tests/ui/did_you_mean/pub-macro-rules.stderr @@ -6,8 +6,9 @@ LL | pub macro_rules! foo { | help: try exporting the macro | -LL | #[macro_export] macro_rules! foo { - | ~~~~~~~~~~~~~~~ +LL - pub macro_rules! foo { +LL + #[macro_export] macro_rules! foo { + | error: aborting due to 1 previous error diff --git a/tests/ui/did_you_mean/replace-impl-infer-ty-from-trait.stderr b/tests/ui/did_you_mean/replace-impl-infer-ty-from-trait.stderr index 96742f8bf47..6c24a5899ea 100644 --- a/tests/ui/did_you_mean/replace-impl-infer-ty-from-trait.stderr +++ b/tests/ui/did_you_mean/replace-impl-infer-ty-from-trait.stderr @@ -10,8 +10,9 @@ LL | fn bar(i: _, t: _, s: _) -> _ { | help: try replacing `_` with the types in the corresponding trait method signature | -LL | fn bar(i: i32, t: usize, s: &()) -> (usize, i32) { - | ~~~ ~~~~~ ~~~ ~~~~~~~~~~~~ +LL - fn bar(i: _, t: _, s: _) -> _ { +LL + fn bar(i: i32, t: usize, s: &()) -> (usize, i32) { + | error[E0282]: type annotations needed --> $DIR/replace-impl-infer-ty-from-trait.rs:9:15 diff --git a/tests/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr b/tests/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr index 7994ddf11c3..4fee6cc9a22 100644 --- a/tests/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr +++ b/tests/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr @@ -28,7 +28,7 @@ LL | let _: &Copy + 'static; | = note: the trait is not dyn compatible because it requires `Self: Sized` = 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> error: aborting due to 3 previous errors diff --git a/tests/ui/did_you_mean/use_instead_of_import.stderr b/tests/ui/did_you_mean/use_instead_of_import.stderr index f8d6de8a117..aadd7524ec6 100644 --- a/tests/ui/did_you_mean/use_instead_of_import.stderr +++ b/tests/ui/did_you_mean/use_instead_of_import.stderr @@ -6,8 +6,9 @@ LL | import std::{ | help: items are imported using the `use` keyword | -LL | use std::{ - | ~~~ +LL - import std::{ +LL + use std::{ + | error: expected item, found `require` --> $DIR/use_instead_of_import.rs:9:1 @@ -17,8 +18,9 @@ LL | require std::time::Duration; | help: items are imported using the `use` keyword | -LL | use std::time::Duration; - | ~~~ +LL - require std::time::Duration; +LL + use std::time::Duration; + | error: expected item, found `include` --> $DIR/use_instead_of_import.rs:12:1 @@ -28,8 +30,9 @@ LL | include std::time::Instant; | help: items are imported using the `use` keyword | -LL | use std::time::Instant; - | ~~~ +LL - include std::time::Instant; +LL + use std::time::Instant; + | error: expected item, found `using` --> $DIR/use_instead_of_import.rs:15:5 @@ -39,8 +42,9 @@ LL | pub using std::io; | help: items are imported using the `use` keyword | -LL | pub use std::io; - | ~~~ +LL - pub using std::io; +LL + pub use std::io; + | error: aborting due to 4 previous errors diff --git a/tests/ui/drop/if-let-rescope-borrowck-suggestions.stderr b/tests/ui/drop/if-let-rescope-borrowck-suggestions.stderr index 3c87e196af6..b418ff4684d 100644 --- a/tests/ui/drop/if-let-rescope-borrowck-suggestions.stderr +++ b/tests/ui/drop/if-let-rescope-borrowck-suggestions.stderr @@ -18,8 +18,9 @@ LL ~ do_something(if let Some(value) = binding.get_ref() { value } else { &0 | help: consider rewriting the `if` into `match` which preserves the extended lifetime | -LL | do_something({ match Droppy.get_ref() { Some(value) => { value } _ => { &0 }}}); - | ~~~~~~~ ++++++++++++++++ ~~~~ ++ +LL - do_something(if let Some(value) = Droppy.get_ref() { value } else { &0 }); +LL + do_something({ match Droppy.get_ref() { Some(value) => { value } _ => { &0 }}}); + | error[E0716]: temporary value dropped while borrowed --> $DIR/if-let-rescope-borrowck-suggestions.rs:23:39 diff --git a/tests/ui/drop/lint-if-let-rescope.stderr b/tests/ui/drop/lint-if-let-rescope.stderr index f6715dbae05..2b0fcb7a938 100644 --- a/tests/ui/drop/lint-if-let-rescope.stderr +++ b/tests/ui/drop/lint-if-let-rescope.stderr @@ -108,8 +108,9 @@ LL | if let Some(1) = { if let Some(_value) = Droppy.get() { Some(1) } else | ^ help: a `match` with a single arm can preserve the drop order up to Edition 2021 | -LL | if let Some(1) = { match Droppy.get() { Some(_value) => { Some(1) } _ => { None }} } { - | ~~~~~ +++++++++++++++++ ~~~~ + +LL - if let Some(1) = { if let Some(_value) = Droppy.get() { Some(1) } else { None } } { +LL + if let Some(1) = { match Droppy.get() { Some(_value) => { Some(1) } _ => { None }} } { + | error: `if let` assigns a shorter lifetime since Edition 2024 --> $DIR/lint-if-let-rescope.rs:72:12 @@ -128,8 +129,9 @@ LL | if (if let Some(_value) = droppy().get() { true } else { false }) { | ^ help: a `match` with a single arm can preserve the drop order up to Edition 2021 | -LL | if (match droppy().get() { Some(_value) => { true } _ => { false }}) { - | ~~~~~ +++++++++++++++++ ~~~~ + +LL - if (if let Some(_value) = droppy().get() { true } else { false }) { +LL + if (match droppy().get() { Some(_value) => { true } _ => { false }}) { + | error: `if let` assigns a shorter lifetime since Edition 2024 --> $DIR/lint-if-let-rescope.rs:78:21 @@ -148,8 +150,9 @@ LL | } else if (((if let Some(_value) = droppy().get() { true } else { false | ^ help: a `match` with a single arm can preserve the drop order up to Edition 2021 | -LL | } else if (((match droppy().get() { Some(_value) => { true } _ => { false }}))) { - | ~~~~~ +++++++++++++++++ ~~~~ + +LL - } else if (((if let Some(_value) = droppy().get() { true } else { false }))) { +LL + } else if (((match droppy().get() { Some(_value) => { true } _ => { false }}))) { + | error: `if let` assigns a shorter lifetime since Edition 2024 --> $DIR/lint-if-let-rescope.rs:90:15 @@ -168,8 +171,9 @@ LL | while (if let Some(_value) = droppy().get() { false } else { true }) { | ^ help: a `match` with a single arm can preserve the drop order up to Edition 2021 | -LL | while (match droppy().get() { Some(_value) => { false } _ => { true }}) { - | ~~~~~ +++++++++++++++++ ~~~~ + +LL - while (if let Some(_value) = droppy().get() { false } else { true }) { +LL + while (match droppy().get() { Some(_value) => { false } _ => { true }}) { + | error: aborting due to 7 previous errors diff --git a/tests/ui/dropck/dropck-only-error-ambiguity.rs b/tests/ui/dropck/dropck-only-error-ambiguity.rs new file mode 100644 index 00000000000..ddba2af7070 --- /dev/null +++ b/tests/ui/dropck/dropck-only-error-ambiguity.rs @@ -0,0 +1,23 @@ +// Test that we don't ICE for a typeck error that only shows up in dropck +// Version where the normalization error is an ambiguous trait implementation. +// <[T] as ToOwned>::Owned is ambiguous on whether to use T: Clone or [T]::Clone. +// Regression test for #105299 + +pub trait Foo: Clone {} + +pub struct Bar<'a, T: Clone> { + pub cow: std::borrow::Cow<'a, [T]>, + + pub THIS_CAUSES_ICE: (), +} + +impl<T> Bar<'_, T> +where + T: Clone, + [T]: Foo, +{ + pub fn MOVES_SELF(self) {} + //~^ ERROR type annotations needed +} + +pub fn main() {} diff --git a/tests/ui/dropck/dropck-only-error-ambiguity.stderr b/tests/ui/dropck/dropck-only-error-ambiguity.stderr new file mode 100644 index 00000000000..de19bd49f4e --- /dev/null +++ b/tests/ui/dropck/dropck-only-error-ambiguity.stderr @@ -0,0 +1,11 @@ +error[E0284]: type annotations needed + --> $DIR/dropck-only-error-ambiguity.rs:19:23 + | +LL | pub fn MOVES_SELF(self) {} + | ^^^^ cannot infer type + | + = note: cannot satisfy `<[T] as ToOwned>::Owned == _` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/crashes/135039.rs b/tests/ui/dropck/dropck-only-error-async.rs index c4c5336fd4f..71158e3c6ef 100644 --- a/tests/crashes/135039.rs +++ b/tests/ui/dropck/dropck-only-error-async.rs @@ -1,7 +1,6 @@ -//@ known-bug: #135039 -//@ edition:2021 - -pub type UserId<Backend> = <<Backend as AuthnBackend>::User as AuthUser>::Id; +// Test that we don't ICE for a typeck error that only shows up in dropck +// issue #135039 +//@ edition:2018 pub trait AuthUser { type Id; @@ -13,7 +12,7 @@ pub trait AuthnBackend { pub struct AuthSession<Backend: AuthnBackend> { user: Option<Backend::User>, - data: Option<UserId<Backend>>, + data: Option<<<Backend as AuthnBackend>::User as AuthUser>::Id>, } pub trait Authz: Sized { @@ -27,8 +26,12 @@ pub trait Query<User: Authz> { pub async fn run_query<User: Authz, Q: Query<User> + 'static>( auth: AuthSession<User::AuthnBackend>, + //~^ ERROR the trait bound `User: AuthUser` is not satisfied [E0277] + //~| ERROR the trait bound `User: AuthUser` is not satisfied [E0277] query: Q, ) -> Result<Q::Output, ()> { let user = auth.user; query.run().await } + +fn main() {} diff --git a/tests/ui/dropck/dropck-only-error-async.stderr b/tests/ui/dropck/dropck-only-error-async.stderr new file mode 100644 index 00000000000..4a069c8ac33 --- /dev/null +++ b/tests/ui/dropck/dropck-only-error-async.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `User: AuthUser` is not satisfied + --> $DIR/dropck-only-error-async.rs:28:5 + | +LL | auth: AuthSession<User::AuthnBackend>, + | ^^^^ the trait `AuthUser` is not implemented for `User` + +error[E0277]: the trait bound `User: AuthUser` is not satisfied + --> $DIR/dropck-only-error-async.rs:28:5 + | +LL | auth: AuthSession<User::AuthnBackend>, + | ^^^^ the trait `AuthUser` is not implemented for `User` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/crashes/91985.rs b/tests/ui/dropck/dropck-only-error-gat.rs index 338550430e1..dadcf76a43f 100644 --- a/tests/crashes/91985.rs +++ b/tests/ui/dropck/dropck-only-error-gat.rs @@ -1,6 +1,6 @@ -//@ known-bug: #91985 - -#![feature(generic_associated_types)] +// Test that we don't ICE for a typeck error that only shows up in dropck +// Version that uses a generic associated type +// Regression test for #91985 pub trait Trait1 { type Associated: Ord; @@ -22,7 +22,7 @@ impl GatTrait for GatStruct { pub struct OuterStruct<T1: Trait1, T2: Trait2> { inner: InnerStruct<T2, GatStruct>, - t1: T1, + t1: T1, } pub struct InnerStruct<T: Trait2, G: GatTrait> { @@ -35,6 +35,7 @@ where T2: Trait2<Associated = T1::Associated>, { pub fn new() -> Self { + //~^ ERROR the trait bound `<T1 as Trait1>::Associated: Clone` is not satisfied todo!() } } diff --git a/tests/ui/dropck/dropck-only-error-gat.stderr b/tests/ui/dropck/dropck-only-error-gat.stderr new file mode 100644 index 00000000000..53982c0826a --- /dev/null +++ b/tests/ui/dropck/dropck-only-error-gat.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `<T1 as Trait1>::Associated: Clone` is not satisfied + --> $DIR/dropck-only-error-gat.rs:37:21 + | +LL | pub fn new() -> Self { + | ^^^^ the trait `Clone` is not implemented for `<T1 as Trait1>::Associated` + | +note: required by a bound in `GatTrait::Gat` + --> $DIR/dropck-only-error-gat.rs:14:17 + | +LL | type Gat<T: Clone>; + | ^^^^^ required by this bound in `GatTrait::Gat` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/dropck/dropck-only-error.rs b/tests/ui/dropck/dropck-only-error.rs new file mode 100644 index 00000000000..e85eeb82e00 --- /dev/null +++ b/tests/ui/dropck/dropck-only-error.rs @@ -0,0 +1,23 @@ +// Test that we don't ICE for a typeck error that only shows up in dropck +// issue #135039 + +pub trait AuthUser { + type Id; +} + +pub trait AuthnBackend { + type User: AuthUser; +} + +pub struct AuthSession<Backend: AuthnBackend> { + data: Option<<<Backend as AuthnBackend>::User as AuthUser>::Id>, +} + +pub trait Authz: Sized { + type AuthnBackend: AuthnBackend<User = Self>; +} + +pub fn run_query<User: Authz>(auth: AuthSession<User::AuthnBackend>) {} +//~^ ERROR the trait bound `User: AuthUser` is not satisfied [E0277] + +fn main() {} diff --git a/tests/ui/dropck/dropck-only-error.stderr b/tests/ui/dropck/dropck-only-error.stderr new file mode 100644 index 00000000000..6c7cd5d296c --- /dev/null +++ b/tests/ui/dropck/dropck-only-error.stderr @@ -0,0 +1,9 @@ +error[E0277]: the trait bound `User: AuthUser` is not satisfied + --> $DIR/dropck-only-error.rs:20:31 + | +LL | pub fn run_query<User: Authz>(auth: AuthSession<User::AuthnBackend>) {} + | ^^^^ the trait `AuthUser` is not implemented for `User` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr index 2caa779ffab..12d7f5b6cd3 100644 --- a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr +++ b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr @@ -12,7 +12,7 @@ LL | struct DropMe<T: Copy>(T); help: consider further restricting type parameter `T` with trait `Copy` | LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/explicit-drop-bounds.rs:32:18 @@ -28,7 +28,7 @@ LL | struct DropMe<T: Copy>(T); help: consider further restricting type parameter `T` with trait `Copy` | LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr index 774d5ba3c89..db749436855 100644 --- a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr @@ -68,7 +68,7 @@ LL | fn wants_write(_: impl Write) {} help: consider changing this borrow's mutability | LL | wants_write(&mut [0u8][..]); - | ~~~~ + | +++ error: aborting due to 4 previous errors diff --git a/tests/ui/dyn-compatibility/almost-supertrait-associated-type.stderr b/tests/ui/dyn-compatibility/almost-supertrait-associated-type.stderr index f241333f2a7..a384697ee08 100644 --- a/tests/ui/dyn-compatibility/almost-supertrait-associated-type.stderr +++ b/tests/ui/dyn-compatibility/almost-supertrait-associated-type.stderr @@ -5,7 +5,7 @@ LL | impl<T, U> Dyn for dyn Foo<T, U> + '_ { | ^^^^^^^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/almost-supertrait-associated-type.rs:33:34 | LL | trait Foo<T, U>: Super<ActuallySuper, Assoc = T> @@ -22,7 +22,7 @@ LL | (&PhantomData::<T> as &dyn Foo<T, U>).transmute(t) | ^^^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/almost-supertrait-associated-type.rs:33:34 | LL | trait Foo<T, U>: Super<ActuallySuper, Assoc = T> @@ -39,7 +39,7 @@ LL | (&PhantomData::<T> as &dyn Foo<T, U>).transmute(t) | ^^^^^^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/almost-supertrait-associated-type.rs:33:34 | LL | trait Foo<T, U>: Super<ActuallySuper, Assoc = T> diff --git a/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.stderr b/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.stderr index b67a1244ece..7b152adea49 100644 --- a/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.stderr +++ b/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.stderr @@ -1,17 +1,3 @@ -error[E0599]: the function or associated item `default` exists for associated type `<T as Bop>::Bar`, but its trait bounds were not satisfied - --> $DIR/assoc_type_bounds_sized_used.rs:11:30 - | -LL | let _ = <T as Bop>::Bar::default(); - | ^^^^^^^ function or associated item cannot be called on `<T as Bop>::Bar` due to unsatisfied trait bounds - | - = note: the following trait bounds were not satisfied: - `T: Sized` - which is required by `<T as Bop>::Bar: Default` -help: consider restricting the type parameter to satisfy the trait bound - | -LL | fn bop<T: Bop + ?Sized>() where T: Sized { - | ++++++++++++++ - error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/assoc_type_bounds_sized_used.rs:11:14 | @@ -38,6 +24,20 @@ help: consider relaxing the implicit `Sized` restriction LL | type Bar: Default + ?Sized | ++++++++ +error[E0599]: the function or associated item `default` exists for associated type `<T as Bop>::Bar`, but its trait bounds were not satisfied + --> $DIR/assoc_type_bounds_sized_used.rs:11:30 + | +LL | let _ = <T as Bop>::Bar::default(); + | ^^^^^^^ function or associated item cannot be called on `<T as Bop>::Bar` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `T: Sized` + which is required by `<T as Bop>::Bar: Default` +help: consider restricting the type parameter to satisfy the trait bound + | +LL | fn bop<T: Bop + ?Sized>() where T: Sized { + | ++++++++++++++ + error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0599. diff --git a/tests/ui/dyn-compatibility/associated-consts.curr.stderr b/tests/ui/dyn-compatibility/associated-consts.curr.stderr index 45d4f795542..de243938123 100644 --- a/tests/ui/dyn-compatibility/associated-consts.curr.stderr +++ b/tests/ui/dyn-compatibility/associated-consts.curr.stderr @@ -5,7 +5,7 @@ LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { | ^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/associated-consts.rs:9:11 | LL | trait Bar { @@ -21,7 +21,7 @@ LL | t | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/associated-consts.rs:9:11 | LL | trait Bar { diff --git a/tests/ui/dyn-compatibility/associated-consts.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/associated-consts.dyn_compatible_for_dispatch.stderr index 4c8c82196ed..704d833f00b 100644 --- a/tests/ui/dyn-compatibility/associated-consts.dyn_compatible_for_dispatch.stderr +++ b/tests/ui/dyn-compatibility/associated-consts.dyn_compatible_for_dispatch.stderr @@ -5,7 +5,7 @@ LL | t | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/associated-consts.rs:9:11 | LL | trait Bar { diff --git a/tests/ui/dyn-compatibility/associated_type_bound_mentions_self.rs b/tests/ui/dyn-compatibility/associated_type_bound_mentions_self.rs new file mode 100644 index 00000000000..0be5fa27b4c --- /dev/null +++ b/tests/ui/dyn-compatibility/associated_type_bound_mentions_self.rs @@ -0,0 +1,14 @@ +// Ensure that we properly ignore the `B<Self>` associated type bound on `A::T` +// since that associated type requires `Self: Sized`. + +//@ check-pass + +struct X(&'static dyn A); + +trait A { + type T: B<Self> where Self: Sized; +} + +trait B<T> {} + +fn main() {} diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr index 83795f3128e..87207d607e2 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr @@ -7,8 +7,9 @@ LL | fn id<F>(f: Copy) -> usize { = note: `Copy` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `Copy` | -LL | fn id<F, T: Copy>(f: T) -> usize { - | +++++++++ ~ +LL - fn id<F>(f: Copy) -> usize { +LL + fn id<F, T: Copy>(f: T) -> usize { + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn id<F>(f: impl Copy) -> usize { 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 ff5e9fdb6b3..b811ef40c26 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 @@ -34,7 +34,7 @@ LL | fn id<F>(f: Copy) -> usize { | = note: the trait is not dyn compatible because it requires `Self: Sized` = 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> error[E0618]: expected function, found `(dyn Copy + 'static)` --> $DIR/avoid-ice-on-warning-2.rs:12:5 diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr index 813b5863738..6075e313f4e 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr @@ -7,8 +7,9 @@ LL | trait A { fn g(b: B) -> B; } = note: `B` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `B` | -LL | trait A { fn g<T: B>(b: T) -> B; } - | ++++++ ~ +LL - trait A { fn g(b: B) -> B; } +LL + trait A { fn g<T: B>(b: T) -> B; } + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | trait A { fn g(b: impl B) -> B; } @@ -34,8 +35,9 @@ LL | trait B { fn f(a: A) -> A; } = note: `A` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `A` | -LL | trait B { fn f<T: A>(a: T) -> A; } - | ++++++ ~ +LL - trait B { fn f(a: A) -> A; } +LL + trait B { fn f<T: A>(a: T) -> A; } + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | trait B { fn f(a: impl A) -> A; } 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 92a2d340115..d8935be5609 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 @@ -72,7 +72,7 @@ LL | trait B { fn f(a: A) -> A; } | ^ `A` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/avoid-ice-on-warning-3.rs:14:14 | LL | trait A { fn g(b: B) -> B; } @@ -109,7 +109,7 @@ LL | trait A { fn g(b: B) -> B; } | ^ `B` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/avoid-ice-on-warning-3.rs:4:14 | LL | trait B { fn f(a: A) -> A; } diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning.new.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning.new.stderr index e9eb1cdd0c2..3ba4aa12e6d 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning.new.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning.new.stderr @@ -6,8 +6,9 @@ LL | fn call_this<F>(f: F) : Fn(&str) + call_that {} | help: use `->` instead | -LL | fn call_this<F>(f: F) -> Fn(&str) + call_that {} - | ~~ +LL - fn call_this<F>(f: F) : Fn(&str) + call_that {} +LL + fn call_this<F>(f: F) -> Fn(&str) + call_that {} + | error[E0405]: cannot find trait `call_that` in this scope --> $DIR/avoid-ice-on-warning.rs:4:36 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 646fb57af9e..dbfe91e1811 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr @@ -6,8 +6,9 @@ LL | fn call_this<F>(f: F) : Fn(&str) + call_that {} | help: use `->` instead | -LL | fn call_this<F>(f: F) -> Fn(&str) + call_that {} - | ~~ +LL - fn call_this<F>(f: F) : Fn(&str) + call_that {} +LL + fn call_this<F>(f: F) -> Fn(&str) + call_that {} + | error[E0405]: cannot find trait `call_that` in this scope --> $DIR/avoid-ice-on-warning.rs:4:36 diff --git a/tests/ui/dyn-compatibility/bare-trait-dont-suggest-dyn.old.stderr b/tests/ui/dyn-compatibility/bare-trait-dont-suggest-dyn.old.stderr index e3ec5b9c3c8..7be6cb0d03b 100644 --- a/tests/ui/dyn-compatibility/bare-trait-dont-suggest-dyn.old.stderr +++ b/tests/ui/dyn-compatibility/bare-trait-dont-suggest-dyn.old.stderr @@ -23,7 +23,7 @@ LL | fn ord_prefer_dot(s: String) -> Ord { | ^^^ `Ord` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: the trait is not dyn compatible because it uses `Self` as a type parameter diff --git a/tests/ui/dyn-compatibility/bounds.stderr b/tests/ui/dyn-compatibility/bounds.stderr index d45e66b1d5e..5473af388c0 100644 --- a/tests/ui/dyn-compatibility/bounds.stderr +++ b/tests/ui/dyn-compatibility/bounds.stderr @@ -5,7 +5,7 @@ LL | fn f() -> Box<dyn X<U = u32>> { | ^^^^^^^^^^^^^^ `X` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/bounds.rs:4:13 | LL | trait X { diff --git a/tests/ui/dyn-compatibility/gat-incompatible-supertrait.stderr b/tests/ui/dyn-compatibility/gat-incompatible-supertrait.stderr index 04dc0b1d6f4..cfebd5d6947 100644 --- a/tests/ui/dyn-compatibility/gat-incompatible-supertrait.stderr +++ b/tests/ui/dyn-compatibility/gat-incompatible-supertrait.stderr @@ -5,7 +5,7 @@ LL | fn take_dyn(_: &dyn Child) {} | ^^^^^ `Super` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/gat-incompatible-supertrait.rs:10:10 | LL | trait Super { diff --git a/tests/ui/dyn-compatibility/generics.curr.stderr b/tests/ui/dyn-compatibility/generics.curr.stderr index 1607954ab70..d29d02b2ff3 100644 --- a/tests/ui/dyn-compatibility/generics.curr.stderr +++ b/tests/ui/dyn-compatibility/generics.curr.stderr @@ -5,7 +5,7 @@ LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { | ^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/generics.rs:10:8 | LL | trait Bar { @@ -21,7 +21,7 @@ LL | fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar { | ^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/generics.rs:10:8 | LL | trait Bar { @@ -37,7 +37,7 @@ LL | t | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/generics.rs:10:8 | LL | trait Bar { @@ -54,7 +54,7 @@ LL | t as &dyn Bar | ^^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/generics.rs:10:8 | LL | trait Bar { @@ -70,7 +70,7 @@ LL | t as &dyn Bar | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/generics.rs:10:8 | LL | trait Bar { diff --git a/tests/ui/dyn-compatibility/generics.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/generics.dyn_compatible_for_dispatch.stderr index 7f31b29b39c..b3565a766fe 100644 --- a/tests/ui/dyn-compatibility/generics.dyn_compatible_for_dispatch.stderr +++ b/tests/ui/dyn-compatibility/generics.dyn_compatible_for_dispatch.stderr @@ -5,7 +5,7 @@ LL | t | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/generics.rs:10:8 | LL | trait Bar { @@ -22,7 +22,7 @@ LL | t as &dyn Bar | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/generics.rs:10:8 | LL | trait Bar { diff --git a/tests/ui/dyn-compatibility/mention-correct-dyn-incompatible-trait.stderr b/tests/ui/dyn-compatibility/mention-correct-dyn-incompatible-trait.stderr index 1ed78e1e659..bb3f7899bf1 100644 --- a/tests/ui/dyn-compatibility/mention-correct-dyn-incompatible-trait.stderr +++ b/tests/ui/dyn-compatibility/mention-correct-dyn-incompatible-trait.stderr @@ -5,7 +5,7 @@ LL | let test: &mut dyn Bar = &mut thing; | ^^^^^^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/mention-correct-dyn-incompatible-trait.rs:4:8 | LL | fn foo<T>(&self, val: T); @@ -23,7 +23,7 @@ LL | let test: &mut dyn Bar = &mut thing; | ^^^^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/mention-correct-dyn-incompatible-trait.rs:4:8 | LL | fn foo<T>(&self, val: T); diff --git a/tests/ui/dyn-compatibility/mentions-Self-in-super-predicates.stderr b/tests/ui/dyn-compatibility/mentions-Self-in-super-predicates.stderr index eba2c15dd74..cf3a7b23084 100644 --- a/tests/ui/dyn-compatibility/mentions-Self-in-super-predicates.stderr +++ b/tests/ui/dyn-compatibility/mentions-Self-in-super-predicates.stderr @@ -5,7 +5,7 @@ LL | elements: Vec<Box<dyn Expr + 'x>>, | ^^^^ `Expr` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/mentions-Self-in-super-predicates.rs:5:21 | LL | trait Expr: Debug + PartialEq { @@ -20,7 +20,7 @@ LL | let a: Box<dyn Expr> = Box::new(SExpr::new()); | ^^^^ `Expr` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/mentions-Self-in-super-predicates.rs:5:21 | LL | trait Expr: Debug + PartialEq { @@ -35,7 +35,7 @@ LL | let b: Box<dyn Expr> = Box::new(SExpr::new()); | ^^^^ `Expr` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/mentions-Self-in-super-predicates.rs:5:21 | LL | trait Expr: Debug + PartialEq { diff --git a/tests/ui/dyn-compatibility/mentions-Self.curr.stderr b/tests/ui/dyn-compatibility/mentions-Self.curr.stderr index 90db86ffef9..2d3fe5ce636 100644 --- a/tests/ui/dyn-compatibility/mentions-Self.curr.stderr +++ b/tests/ui/dyn-compatibility/mentions-Self.curr.stderr @@ -5,7 +5,7 @@ LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { | ^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/mentions-Self.rs:11:22 | LL | trait Bar { @@ -21,7 +21,7 @@ LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz { | ^^^^^^^ `Baz` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/mentions-Self.rs:15:22 | LL | trait Baz { @@ -37,7 +37,7 @@ LL | t | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/mentions-Self.rs:11:22 | LL | trait Bar { @@ -54,7 +54,7 @@ LL | t | ^ `Baz` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/mentions-Self.rs:15:22 | LL | trait Baz { diff --git a/tests/ui/dyn-compatibility/mentions-Self.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/mentions-Self.dyn_compatible_for_dispatch.stderr index 4a50d3f07e4..91c26a86025 100644 --- a/tests/ui/dyn-compatibility/mentions-Self.dyn_compatible_for_dispatch.stderr +++ b/tests/ui/dyn-compatibility/mentions-Self.dyn_compatible_for_dispatch.stderr @@ -5,7 +5,7 @@ LL | t | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/mentions-Self.rs:11:22 | LL | trait Bar { @@ -22,7 +22,7 @@ LL | t | ^ `Baz` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/mentions-Self.rs:15:22 | LL | trait Baz { diff --git a/tests/ui/dyn-compatibility/missing-assoc-type.stderr b/tests/ui/dyn-compatibility/missing-assoc-type.stderr index 3f550494b33..5a7560682f2 100644 --- a/tests/ui/dyn-compatibility/missing-assoc-type.stderr +++ b/tests/ui/dyn-compatibility/missing-assoc-type.stderr @@ -5,7 +5,7 @@ LL | fn bar(x: &dyn Foo) {} | ^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/missing-assoc-type.rs:2:10 | LL | trait Foo { diff --git a/tests/ui/dyn-compatibility/no-static.curr.stderr b/tests/ui/dyn-compatibility/no-static.curr.stderr index 867c485053d..bf9b48e7a43 100644 --- a/tests/ui/dyn-compatibility/no-static.curr.stderr +++ b/tests/ui/dyn-compatibility/no-static.curr.stderr @@ -5,7 +5,7 @@ LL | fn diverges() -> Box<dyn Foo> { | ^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/no-static.rs:9:8 | LL | trait Foo { @@ -29,7 +29,7 @@ LL | let b: Box<dyn Foo> = Box::new(Bar); | ^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/no-static.rs:9:8 | LL | trait Foo { @@ -53,7 +53,7 @@ LL | let b: Box<dyn Foo> = Box::new(Bar); | ^^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/no-static.rs:9:8 | LL | trait Foo { diff --git a/tests/ui/dyn-compatibility/no-static.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/no-static.dyn_compatible_for_dispatch.stderr index 65608a9cca7..d5ad4510334 100644 --- a/tests/ui/dyn-compatibility/no-static.dyn_compatible_for_dispatch.stderr +++ b/tests/ui/dyn-compatibility/no-static.dyn_compatible_for_dispatch.stderr @@ -5,7 +5,7 @@ LL | let b: Box<dyn Foo> = Box::new(Bar); | ^^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/no-static.rs:9:8 | LL | trait Foo { diff --git a/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr b/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr index 4c6d84f0534..832e7ef4dc3 100644 --- a/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr +++ b/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr @@ -195,8 +195,9 @@ LL | fn foo(_: &Trait); | help: use a new generic type parameter, constrained by `Trait` | -LL | fn foo<T: Trait>(_: &T); - | ++++++++++ ~ +LL - fn foo(_: &Trait); +LL + fn foo<T: Trait>(_: &T); + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn foo(_: &impl Trait); @@ -214,8 +215,9 @@ LL | fn bar(_: &'a Trait); | help: use a new generic type parameter, constrained by `Trait` | -LL | fn bar<T: Trait>(_: &'a T); - | ++++++++++ ~ +LL - fn bar(_: &'a Trait); +LL + fn bar<T: Trait>(_: &'a T); + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bar(_: &'a impl Trait); @@ -233,8 +235,9 @@ LL | fn alice<'a>(_: &Trait); | help: use a new generic type parameter, constrained by `Trait` | -LL | fn alice<'a, T: Trait>(_: &T); - | ++++++++++ ~ +LL - fn alice<'a>(_: &Trait); +LL + fn alice<'a, T: Trait>(_: &T); + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn alice<'a>(_: &impl Trait); @@ -252,8 +255,9 @@ LL | fn bob<'a>(_: &'a Trait); | help: use a new generic type parameter, constrained by `Trait` | -LL | fn bob<'a, T: Trait>(_: &'a T); - | ++++++++++ ~ +LL - fn bob<'a>(_: &'a Trait); +LL + fn bob<'a, T: Trait>(_: &'a T); + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bob<'a>(_: &'a impl Trait); @@ -275,8 +279,9 @@ LL | fn cat() -> &impl Trait; | ++++ help: alternatively, you can return an owned trait object | -LL | fn cat() -> Box<dyn Trait>; - | ~~~~~~~~~~~~~~ +LL - fn cat() -> &Trait; +LL + fn cat() -> Box<dyn Trait>; + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:69:22 @@ -290,8 +295,9 @@ LL | fn dog<'a>() -> &impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn dog<'a>() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn dog<'a>() -> &Trait { +LL + fn dog<'a>() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:75:24 @@ -305,8 +311,9 @@ LL | fn kitten() -> &'a impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn kitten() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn kitten() -> &'a Trait { +LL + fn kitten() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:81:27 @@ -320,8 +327,9 @@ LL | fn puppy<'a>() -> &'a impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn puppy<'a>() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn puppy<'a>() -> &'a Trait { +LL + fn puppy<'a>() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:86:25 @@ -335,8 +343,9 @@ LL | fn parrot() -> &mut impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn parrot() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn parrot() -> &mut Trait { +LL + fn parrot() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:93:12 @@ -346,8 +355,9 @@ LL | fn foo(_: &Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn foo<T: Trait>(_: &T) {} - | ++++++++++ ~ +LL - fn foo(_: &Trait) {} +LL + fn foo<T: Trait>(_: &T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn foo(_: &impl Trait) {} @@ -365,8 +375,9 @@ LL | fn bar(_: &'a Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn bar<T: Trait>(_: &'a T) {} - | ++++++++++ ~ +LL - fn bar(_: &'a Trait) {} +LL + fn bar<T: Trait>(_: &'a T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bar(_: &'a impl Trait) {} @@ -384,8 +395,9 @@ LL | fn alice<'a>(_: &Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn alice<'a, T: Trait>(_: &T) {} - | ++++++++++ ~ +LL - fn alice<'a>(_: &Trait) {} +LL + fn alice<'a, T: Trait>(_: &T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn alice<'a>(_: &impl Trait) {} @@ -403,8 +415,9 @@ LL | fn bob<'a>(_: &'a Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn bob<'a, T: Trait>(_: &'a T) {} - | ++++++++++ ~ +LL - fn bob<'a>(_: &'a Trait) {} +LL + fn bob<'a, T: Trait>(_: &'a T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bob<'a>(_: &'a impl Trait) {} @@ -426,8 +439,9 @@ LL | fn cat() -> &impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn cat() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn cat() -> &Trait { +LL + fn cat() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:116:18 @@ -441,8 +455,9 @@ LL | fn dog<'a>() -> &impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn dog<'a>() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn dog<'a>() -> &Trait { +LL + fn dog<'a>() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:122:20 @@ -456,8 +471,9 @@ LL | fn kitten() -> &'a impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn kitten() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn kitten() -> &'a Trait { +LL + fn kitten() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:128:23 @@ -471,8 +487,9 @@ LL | fn puppy<'a>() -> &'a impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn puppy<'a>() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn puppy<'a>() -> &'a Trait { +LL + fn puppy<'a>() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:133:21 @@ -486,8 +503,9 @@ LL | fn parrot() -> &mut impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn parrot() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn parrot() -> &mut Trait { +LL + fn parrot() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:8:16 @@ -497,8 +515,9 @@ LL | fn foo(_: &Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn foo<T: Trait>(_: &T) {} - | ++++++++++ ~ +LL - fn foo(_: &Trait) {} +LL + fn foo<T: Trait>(_: &T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn foo(_: &impl Trait) {} @@ -516,8 +535,9 @@ LL | fn bar(self, _: &'a Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn bar<T: Trait>(self, _: &'a T) {} - | ++++++++++ ~ +LL - fn bar(self, _: &'a Trait) {} +LL + fn bar<T: Trait>(self, _: &'a T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bar(self, _: &'a impl Trait) {} @@ -535,8 +555,9 @@ LL | fn alice<'a>(&self, _: &Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn alice<'a, T: Trait>(&self, _: &T) {} - | ++++++++++ ~ +LL - fn alice<'a>(&self, _: &Trait) {} +LL + fn alice<'a, T: Trait>(&self, _: &T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn alice<'a>(&self, _: &impl Trait) {} @@ -554,8 +575,9 @@ LL | fn bob<'a>(_: &'a Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn bob<'a, T: Trait>(_: &'a T) {} - | ++++++++++ ~ +LL - fn bob<'a>(_: &'a Trait) {} +LL + fn bob<'a, T: Trait>(_: &'a T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bob<'a>(_: &'a impl Trait) {} @@ -577,8 +599,9 @@ LL | fn cat() -> &impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn cat() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn cat() -> &Trait { +LL + fn cat() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:27:22 @@ -592,8 +615,9 @@ LL | fn dog<'a>() -> &impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn dog<'a>() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn dog<'a>() -> &Trait { +LL + fn dog<'a>() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:33:24 @@ -607,8 +631,9 @@ LL | fn kitten() -> &'a impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn kitten() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn kitten() -> &'a Trait { +LL + fn kitten() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:39:27 @@ -622,8 +647,9 @@ LL | fn puppy<'a>() -> &'a impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn puppy<'a>() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn puppy<'a>() -> &'a Trait { +LL + fn puppy<'a>() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:44:25 @@ -637,8 +663,9 @@ LL | fn parrot() -> &mut impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn parrot() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn parrot() -> &mut Trait { +LL + fn parrot() -> Box<dyn Trait> { + | error: aborting due to 42 previous errors diff --git a/tests/ui/dyn-compatibility/sized-2.curr.stderr b/tests/ui/dyn-compatibility/sized-2.curr.stderr index c8fd1056237..2d262072d5d 100644 --- a/tests/ui/dyn-compatibility/sized-2.curr.stderr +++ b/tests/ui/dyn-compatibility/sized-2.curr.stderr @@ -5,7 +5,7 @@ LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { | ^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/sized-2.rs:9:18 | LL | trait Bar @@ -20,7 +20,7 @@ LL | t | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/sized-2.rs:9:18 | LL | trait Bar diff --git a/tests/ui/dyn-compatibility/sized-2.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/sized-2.dyn_compatible_for_dispatch.stderr index 477dacdf5a1..1fbc10c0c3f 100644 --- a/tests/ui/dyn-compatibility/sized-2.dyn_compatible_for_dispatch.stderr +++ b/tests/ui/dyn-compatibility/sized-2.dyn_compatible_for_dispatch.stderr @@ -5,7 +5,7 @@ LL | t | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/sized-2.rs:9:18 | LL | trait Bar diff --git a/tests/ui/dyn-compatibility/sized.curr.stderr b/tests/ui/dyn-compatibility/sized.curr.stderr index d86ea9197b9..a197d967005 100644 --- a/tests/ui/dyn-compatibility/sized.curr.stderr +++ b/tests/ui/dyn-compatibility/sized.curr.stderr @@ -5,7 +5,7 @@ LL | fn make_bar<T: Bar>(t: &T) -> &dyn Bar { | ^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/sized.rs:8:12 | LL | trait Bar: Sized { @@ -20,7 +20,7 @@ LL | t | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/sized.rs:8:12 | LL | trait Bar: Sized { diff --git a/tests/ui/dyn-compatibility/sized.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/sized.dyn_compatible_for_dispatch.stderr index b763173594b..350c8992c6f 100644 --- a/tests/ui/dyn-compatibility/sized.dyn_compatible_for_dispatch.stderr +++ b/tests/ui/dyn-compatibility/sized.dyn_compatible_for_dispatch.stderr @@ -5,7 +5,7 @@ LL | t | ^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/sized.rs:8:12 | LL | trait Bar: Sized { diff --git a/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr b/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr index f5dea256469..582cf1af054 100644 --- a/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr +++ b/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr @@ -17,8 +17,9 @@ LL | fn c(&self) -> dyn SuperTrait<T>; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn c(&self) -> Self; - | ~~~~ +LL - fn c(&self) -> dyn SuperTrait<T>; +LL + fn c(&self) -> Self; + | error[E0038]: the trait `SuperTrait` is not dyn compatible --> $DIR/supertrait-mentions-GAT.rs:10:20 @@ -27,7 +28,7 @@ LL | fn c(&self) -> dyn SuperTrait<T>; | ^^^^^^^^^^^^^^^^^ `SuperTrait` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/supertrait-mentions-GAT.rs:4:10 | LL | type Gat<'a> diff --git a/tests/ui/dyn-compatibility/supertrait-mentions-Self.stderr b/tests/ui/dyn-compatibility/supertrait-mentions-Self.stderr index f9ef0c9b2e0..2ba8e4611cb 100644 --- a/tests/ui/dyn-compatibility/supertrait-mentions-Self.stderr +++ b/tests/ui/dyn-compatibility/supertrait-mentions-Self.stderr @@ -25,7 +25,7 @@ LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz { | ^^^ `Baz` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/supertrait-mentions-Self.rs:8:13 | LL | trait Baz : Bar<Self> { @@ -34,8 +34,9 @@ LL | trait Baz : Bar<Self> { | this trait is not dyn compatible... help: consider using an opaque type instead | -LL | fn make_baz<T:Baz>(t: &T) -> &impl Baz { - | ~~~~ +LL - fn make_baz<T:Baz>(t: &T) -> &dyn Baz { +LL + fn make_baz<T:Baz>(t: &T) -> &impl Baz { + | error: aborting due to 2 previous errors diff --git a/tests/ui/dyn-compatibility/taint-const-eval.curr.stderr b/tests/ui/dyn-compatibility/taint-const-eval.curr.stderr index 8442314835e..7e80a1d2e42 100644 --- a/tests/ui/dyn-compatibility/taint-const-eval.curr.stderr +++ b/tests/ui/dyn-compatibility/taint-const-eval.curr.stderr @@ -5,7 +5,7 @@ LL | static FOO: &(dyn Qux + Sync) = "desc"; | ^^^^^^^^^^^^^^ `Qux` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/taint-const-eval.rs:8:8 | LL | trait Qux { @@ -28,7 +28,7 @@ LL | static FOO: &(dyn Qux + Sync) = "desc"; | ^^^^^^ `Qux` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/taint-const-eval.rs:8:8 | LL | trait Qux { @@ -52,7 +52,7 @@ LL | static FOO: &(dyn Qux + Sync) = "desc"; | ^^^^^^^^^^^^^^ `Qux` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/taint-const-eval.rs:8:8 | LL | trait Qux { diff --git a/tests/ui/dyn-compatibility/taint-const-eval.dyn_compatible_for_dispatch.stderr b/tests/ui/dyn-compatibility/taint-const-eval.dyn_compatible_for_dispatch.stderr index 1c51df8501f..0bc7d0b14d3 100644 --- a/tests/ui/dyn-compatibility/taint-const-eval.dyn_compatible_for_dispatch.stderr +++ b/tests/ui/dyn-compatibility/taint-const-eval.dyn_compatible_for_dispatch.stderr @@ -5,7 +5,7 @@ LL | static FOO: &(dyn Qux + Sync) = "desc"; | ^^^^^^ `Qux` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/taint-const-eval.rs:8:8 | LL | trait Qux { diff --git a/tests/ui/dyn-compatibility/undispatchable-receiver-and-wc-references-Self.stderr b/tests/ui/dyn-compatibility/undispatchable-receiver-and-wc-references-Self.stderr index 45a924008c7..1299167159e 100644 --- a/tests/ui/dyn-compatibility/undispatchable-receiver-and-wc-references-Self.stderr +++ b/tests/ui/dyn-compatibility/undispatchable-receiver-and-wc-references-Self.stderr @@ -8,7 +8,7 @@ LL | fn fetcher() -> Box<dyn Fetcher> { | ^^^^^^^^^^^ `Fetcher` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/undispatchable-receiver-and-wc-references-Self.rs:11:22 | LL | pub trait Fetcher: Send + Sync { @@ -26,7 +26,7 @@ LL | let fetcher = fetcher(); | ^^^^^^^^^ `Fetcher` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/undispatchable-receiver-and-wc-references-Self.rs:11:22 | LL | pub trait Fetcher: Send + Sync { @@ -44,7 +44,7 @@ LL | let _ = fetcher.get(); | ^^^^^^^^^^^^^ `Fetcher` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/undispatchable-receiver-and-wc-references-Self.rs:11:22 | LL | pub trait Fetcher: Send + Sync { diff --git a/tests/ui/dyn-keyword/dyn-2021-edition-error.stderr b/tests/ui/dyn-keyword/dyn-2021-edition-error.stderr index 6d1a1618ac0..8c4b809e76b 100644 --- a/tests/ui/dyn-keyword/dyn-2021-edition-error.stderr +++ b/tests/ui/dyn-keyword/dyn-2021-edition-error.stderr @@ -6,8 +6,9 @@ LL | fn function(x: &SomeTrait, y: Box<SomeTrait>) { | help: use a new generic type parameter, constrained by `SomeTrait` | -LL | fn function<T: SomeTrait>(x: &T, y: Box<SomeTrait>) { - | ++++++++++++++ ~ +LL - fn function(x: &SomeTrait, y: Box<SomeTrait>) { +LL + fn function<T: SomeTrait>(x: &T, y: Box<SomeTrait>) { + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn function(x: &impl SomeTrait, y: Box<SomeTrait>) { diff --git a/tests/ui/dyn-keyword/misspelled-associated-item.stderr b/tests/ui/dyn-keyword/misspelled-associated-item.stderr index 4211889e524..0880100dc04 100644 --- a/tests/ui/dyn-keyword/misspelled-associated-item.stderr +++ b/tests/ui/dyn-keyword/misspelled-associated-item.stderr @@ -10,8 +10,9 @@ LL | let () = <dyn Trait>::typoe(); | ++++ + help: you may have misspelled this associated item, causing `Trait` to be interpreted as a type rather than a trait | -LL | let () = Trait::typo(); - | ~~~~ +LL - let () = Trait::typoe(); +LL + let () = Trait::typo(); + | error: aborting due to 1 previous error diff --git a/tests/ui/dyn-star/no-unsize-coerce-dyn-trait.rs b/tests/ui/dyn-star/no-unsize-coerce-dyn-trait.rs index a4eb669e321..1702fc1ed49 100644 --- a/tests/ui/dyn-star/no-unsize-coerce-dyn-trait.rs +++ b/tests/ui/dyn-star/no-unsize-coerce-dyn-trait.rs @@ -1,5 +1,5 @@ -#![feature(dyn_star, trait_upcasting)] -//~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes +#![expect(incomplete_features)] +#![feature(dyn_star)] trait A: B {} trait B {} diff --git a/tests/ui/dyn-star/no-unsize-coerce-dyn-trait.stderr b/tests/ui/dyn-star/no-unsize-coerce-dyn-trait.stderr index 1f7bfb1d5bd..289d85072e6 100644 --- a/tests/ui/dyn-star/no-unsize-coerce-dyn-trait.stderr +++ b/tests/ui/dyn-star/no-unsize-coerce-dyn-trait.stderr @@ -1,12 +1,3 @@ -warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/no-unsize-coerce-dyn-trait.rs:1:12 - | -LL | #![feature(dyn_star, trait_upcasting)] - | ^^^^^^^^ - | - = note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0308]: mismatched types --> $DIR/no-unsize-coerce-dyn-trait.rs:11:26 | @@ -18,6 +9,6 @@ LL | let y: Box<dyn* B> = x; = note: expected struct `Box<dyn* B>` found struct `Box<dyn* A>` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/dyn-star/upcast.rs b/tests/ui/dyn-star/upcast.rs index e8e89fc5101..01e1b94f87e 100644 --- a/tests/ui/dyn-star/upcast.rs +++ b/tests/ui/dyn-star/upcast.rs @@ -1,6 +1,6 @@ //@ known-bug: #104800 -#![feature(dyn_star, trait_upcasting)] +#![feature(dyn_star)] trait Foo: Bar { fn hello(&self); diff --git a/tests/ui/dyn-star/upcast.stderr b/tests/ui/dyn-star/upcast.stderr index 801e1c233c1..3f244d4b6ae 100644 --- a/tests/ui/dyn-star/upcast.stderr +++ b/tests/ui/dyn-star/upcast.stderr @@ -1,7 +1,7 @@ warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/upcast.rs:3:12 | -LL | #![feature(dyn_star, trait_upcasting)] +LL | #![feature(dyn_star)] | ^^^^^^^^ | = note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information diff --git a/tests/ui/editions/auxiliary/nested_macro_rules_dep_2021.rs b/tests/ui/editions/auxiliary/nested_macro_rules_dep_2021.rs new file mode 100644 index 00000000000..36d3e712dc0 --- /dev/null +++ b/tests/ui/editions/auxiliary/nested_macro_rules_dep_2021.rs @@ -0,0 +1,23 @@ +//@ edition: 2021 + +#[macro_export] +macro_rules! make_macro_with_input { + ($i:ident) => { + macro_rules! macro_inner_input { + () => { + pub fn $i() {} + }; + } + }; +} + +#[macro_export] +macro_rules! make_macro { + () => { + macro_rules! macro_inner { + () => { + pub fn gen() {} + }; + } + }; +} diff --git a/tests/ui/editions/auxiliary/nested_macro_rules_dep_2024.rs b/tests/ui/editions/auxiliary/nested_macro_rules_dep_2024.rs new file mode 100644 index 00000000000..4012398fe66 --- /dev/null +++ b/tests/ui/editions/auxiliary/nested_macro_rules_dep_2024.rs @@ -0,0 +1,23 @@ +//@ edition: 2024 + +#[macro_export] +macro_rules! make_macro_with_input { + ($i:ident) => { + macro_rules! macro_inner_input { + () => { + pub fn $i() {} + }; + } + }; +} + +#[macro_export] +macro_rules! make_macro { + () => { + macro_rules! macro_inner { + () => { + pub fn gen() {} + }; + } + }; +} diff --git a/tests/ui/editions/nested-macro-rules-edition.e2021.stderr b/tests/ui/editions/nested-macro-rules-edition.e2021.stderr new file mode 100644 index 00000000000..eac80262364 --- /dev/null +++ b/tests/ui/editions/nested-macro-rules-edition.e2021.stderr @@ -0,0 +1,27 @@ +error: expected identifier, found reserved keyword `gen` + --> $DIR/nested-macro-rules-edition.rs:30:5 + | +LL | macro_inner_input!{} + | ^^^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword + | + = note: this error originates in the macro `macro_inner_input` (in Nightly builds, run with -Z macro-backtrace for more info) +help: escape `gen` to use it as an identifier + | +LL | nested_macro_rules_dep::make_macro_with_input!{r#gen} + | ++ + +error: expected identifier, found reserved keyword `gen` + --> $DIR/nested-macro-rules-edition.rs:35:5 + | +LL | macro_inner!{} + | ^^^^^^^^^^^^^^ expected identifier, found reserved keyword + | + = note: this error originates in the macro `macro_inner` (in Nightly builds, run with -Z macro-backtrace for more info) +help: escape `gen` to use it as an identifier + --> $DIR/auxiliary/nested_macro_rules_dep_2024.rs:19:24 + | +LL | pub fn r#gen() {} + | ++ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/editions/nested-macro-rules-edition.rs b/tests/ui/editions/nested-macro-rules-edition.rs new file mode 100644 index 00000000000..28d568f7750 --- /dev/null +++ b/tests/ui/editions/nested-macro-rules-edition.rs @@ -0,0 +1,39 @@ +// This checks the behavior of how nested macro_rules definitions are handled +// with regards to edition spans. Prior to https://github.com/rust-lang/rust/pull/133274, +// the compiler would compile the inner macro with the edition of the local crate. +// Afterwards, it uses the edition where the macro was *defined*. +// +// Unfortunately macro_rules compiler discards the edition of any *input* that +// was used to generate the macro. This is possibly not the behavior that we +// want. If we want to keep with the philosophy that code should follow the +// edition rules of the crate where it is written, then presumably we would +// want the input tokens to retain the edition of where they were written. +// +// See https://github.com/rust-lang/rust/issues/135669 for more. +// +// This has two revisions, one where local=2021 and the dep=2024. The other +// revision is vice-versa. + +//@ revisions: e2021 e2024 +//@[e2021] edition:2021 +//@[e2024] edition:2024 +//@[e2021] aux-crate: nested_macro_rules_dep=nested_macro_rules_dep_2024.rs +//@[e2024] aux-crate: nested_macro_rules_dep=nested_macro_rules_dep_2021.rs +//@[e2024] check-pass + +mod with_input { + // If we change the macro_rules input behavior, then this should pass when + // local edition is 2021 because `gen` is written in a context with 2021 + // behavior. For local edition 2024, the reverse would be true and this + // should fail. + nested_macro_rules_dep::make_macro_with_input!{gen} + macro_inner_input!{} + //[e2021]~^ ERROR found reserved keyword +} +mod no_input { + nested_macro_rules_dep::make_macro!{} + macro_inner!{} + //[e2021]~^ ERROR found reserved keyword +} + +fn main() {} diff --git a/tests/ui/empty/empty-struct-braces-expr.stderr b/tests/ui/empty/empty-struct-braces-expr.stderr index 28c701443de..8ec8ecf46bf 100644 --- a/tests/ui/empty/empty-struct-braces-expr.stderr +++ b/tests/ui/empty/empty-struct-braces-expr.stderr @@ -15,11 +15,12 @@ LL | pub struct XEmpty2; help: use struct literal syntax instead | LL | let e1 = Empty1 {}; - | ~~~~~~~~~ + | ++ help: a unit struct with a similar name exists | -LL | let e1 = XEmpty2; - | ~~~~~~~ +LL - let e1 = Empty1; +LL + let e1 = XEmpty2; + | error[E0423]: expected value, found struct `XEmpty1` --> $DIR/empty-struct-braces-expr.rs:22:15 @@ -37,11 +38,12 @@ LL | pub struct XEmpty2; help: use struct literal syntax instead | LL | let xe1 = XEmpty1 {}; - | ~~~~~~~~~~ + | ++ help: a unit struct with a similar name exists | -LL | let xe1 = XEmpty2; - | ~~~~~~~ +LL - let xe1 = XEmpty1; +LL + let xe1 = XEmpty2; + | error[E0423]: expected function, tuple struct or tuple variant, found struct `Empty1` --> $DIR/empty-struct-braces-expr.rs:16:14 @@ -59,12 +61,14 @@ LL | pub struct XEmpty2; | help: use struct literal syntax instead | -LL | let e1 = Empty1 {}; - | ~~~~~~~~~ +LL - let e1 = Empty1(); +LL + let e1 = Empty1 {}; + | help: a unit struct with a similar name exists | -LL | let e1 = XEmpty2(); - | ~~~~~~~ +LL - let e1 = Empty1(); +LL + let e1 = XEmpty2(); + | error[E0533]: expected value, found struct variant `E::Empty3` --> $DIR/empty-struct-braces-expr.rs:18:14 @@ -85,8 +89,9 @@ LL | let e3 = E::Empty3(); | help: you might have meant to create a new value of the struct | -LL | let e3 = E::Empty3 {}; - | ~~ +LL - let e3 = E::Empty3(); +LL + let e3 = E::Empty3 {}; + | error[E0423]: expected function, tuple struct or tuple variant, found struct `XEmpty1` --> $DIR/empty-struct-braces-expr.rs:23:15 @@ -103,12 +108,14 @@ LL | pub struct XEmpty2; | help: use struct literal syntax instead | -LL | let xe1 = XEmpty1 {}; - | ~~~~~~~~~~ +LL - let xe1 = XEmpty1(); +LL + let xe1 = XEmpty1 {}; + | help: a unit struct with a similar name exists | -LL | let xe1 = XEmpty2(); - | ~~~~~~~ +LL - let xe1 = XEmpty1(); +LL + let xe1 = XEmpty2(); + | error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:25:19 @@ -119,7 +126,7 @@ LL | let xe3 = XE::Empty3; help: there is a variant with a similar name | LL | let xe3 = XE::XEmpty3; - | ~~~~~~~ + | + error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:26:19 @@ -129,8 +136,9 @@ LL | let xe3 = XE::Empty3(); | help: there is a variant with a similar name | -LL | let xe3 = XE::XEmpty3 {}; - | ~~~~~~~~~~ +LL - let xe3 = XE::Empty3(); +LL + let xe3 = XE::XEmpty3 {}; + | error[E0599]: no variant named `Empty1` found for enum `empty_struct::XE` --> $DIR/empty-struct-braces-expr.rs:28:9 @@ -140,8 +148,9 @@ LL | XE::Empty1 {}; | help: there is a variant with a similar name | -LL | XE::XEmpty3 {}; - | ~~~~~~~~~~ +LL - XE::Empty1 {}; +LL + XE::XEmpty3 {}; + | error: aborting due to 9 previous errors diff --git a/tests/ui/empty/empty-struct-braces-pat-2.stderr b/tests/ui/empty/empty-struct-braces-pat-2.stderr index 7fb5cb2034a..497dc9601a7 100644 --- a/tests/ui/empty/empty-struct-braces-pat-2.stderr +++ b/tests/ui/empty/empty-struct-braces-pat-2.stderr @@ -14,12 +14,14 @@ LL | pub struct XEmpty6(); | help: use struct pattern syntax instead | -LL | Empty1 {} => () - | ~~~~~~~~~ +LL - Empty1() => () +LL + Empty1 {} => () + | help: a tuple struct with a similar name exists | -LL | XEmpty6() => () - | ~~~~~~~ +LL - Empty1() => () +LL + XEmpty6() => () + | error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1` --> $DIR/empty-struct-braces-pat-2.rs:18:9 @@ -37,12 +39,14 @@ LL | pub struct XEmpty6(); | help: use struct pattern syntax instead | -LL | XEmpty1 {} => () - | ~~~~~~~~~~ +LL - XEmpty1() => () +LL + XEmpty1 {} => () + | help: a tuple struct with a similar name exists | -LL | XEmpty6() => () - | ~~~~~~~ +LL - XEmpty1() => () +LL + XEmpty6() => () + | error[E0532]: expected tuple struct or tuple variant, found struct `Empty1` --> $DIR/empty-struct-braces-pat-2.rs:21:9 @@ -60,12 +64,14 @@ LL | pub struct XEmpty6(); | help: use struct pattern syntax instead | -LL | Empty1 {} => () - | ~~~~~~~~~ +LL - Empty1(..) => () +LL + Empty1 {} => () + | help: a tuple struct with a similar name exists | -LL | XEmpty6(..) => () - | ~~~~~~~ +LL - Empty1(..) => () +LL + XEmpty6(..) => () + | error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1` --> $DIR/empty-struct-braces-pat-2.rs:24:9 @@ -83,12 +89,14 @@ LL | pub struct XEmpty6(); | help: use struct pattern syntax instead | -LL | XEmpty1 {} => () - | ~~~~~~~~~~ +LL - XEmpty1(..) => () +LL + XEmpty1 {} => () + | help: a tuple struct with a similar name exists | -LL | XEmpty6(..) => () - | ~~~~~~~ +LL - XEmpty1(..) => () +LL + XEmpty6(..) => () + | error: aborting due to 4 previous errors diff --git a/tests/ui/empty/empty-struct-braces-pat-3.stderr b/tests/ui/empty/empty-struct-braces-pat-3.stderr index b2ab7113347..6e9618da99d 100644 --- a/tests/ui/empty/empty-struct-braces-pat-3.stderr +++ b/tests/ui/empty/empty-struct-braces-pat-3.stderr @@ -6,8 +6,9 @@ LL | E::Empty3() => () | help: use the struct variant pattern syntax | -LL | E::Empty3 {} => () - | ~~ +LL - E::Empty3() => () +LL + E::Empty3 {} => () + | error[E0164]: expected tuple struct or tuple variant, found struct variant `XE::XEmpty3` --> $DIR/empty-struct-braces-pat-3.rs:21:9 @@ -17,8 +18,9 @@ LL | XE::XEmpty3() => () | help: use the struct variant pattern syntax | -LL | XE::XEmpty3 {} => () - | ~~ +LL - XE::XEmpty3() => () +LL + XE::XEmpty3 {} => () + | error[E0164]: expected tuple struct or tuple variant, found struct variant `E::Empty3` --> $DIR/empty-struct-braces-pat-3.rs:25:9 @@ -28,8 +30,9 @@ LL | E::Empty3(..) => () | help: use the struct variant pattern syntax | -LL | E::Empty3 {} => () - | ~~ +LL - E::Empty3(..) => () +LL + E::Empty3 {} => () + | error[E0164]: expected tuple struct or tuple variant, found struct variant `XE::XEmpty3` --> $DIR/empty-struct-braces-pat-3.rs:29:9 @@ -39,8 +42,9 @@ LL | XE::XEmpty3(..) => () | help: use the struct variant pattern syntax | -LL | XE::XEmpty3 {} => () - | ~~ +LL - XE::XEmpty3(..) => () +LL + XE::XEmpty3 {} => () + | error: aborting due to 4 previous errors diff --git a/tests/ui/empty/empty-struct-tuple-pat.stderr b/tests/ui/empty/empty-struct-tuple-pat.stderr index 45001c79753..09b454653f6 100644 --- a/tests/ui/empty/empty-struct-tuple-pat.stderr +++ b/tests/ui/empty/empty-struct-tuple-pat.stderr @@ -47,11 +47,12 @@ LL | XEmpty5(), help: use the tuple variant pattern syntax instead | LL | XE::XEmpty5() => (), - | ~~~~~~~~~~~~~ + | ++ help: a unit variant with a similar name exists | -LL | XE::XEmpty4 => (), - | ~~~~~~~ +LL - XE::XEmpty5 => (), +LL + XE::XEmpty4 => (), + | error: aborting due to 4 previous errors diff --git a/tests/ui/empty/empty-struct-unit-pat.stderr b/tests/ui/empty/empty-struct-unit-pat.stderr index 5c0b4cffa94..09a476423c8 100644 --- a/tests/ui/empty/empty-struct-unit-pat.stderr +++ b/tests/ui/empty/empty-struct-unit-pat.stderr @@ -14,12 +14,14 @@ LL | pub struct XEmpty6(); | help: use this syntax instead | -LL | Empty2 => () - | ~~~~~~ +LL - Empty2() => () +LL + Empty2 => () + | help: a tuple struct with a similar name exists | -LL | XEmpty6() => () - | ~~~~~~~ +LL - Empty2() => () +LL + XEmpty6() => () + | error[E0532]: expected tuple struct or tuple variant, found unit struct `XEmpty2` --> $DIR/empty-struct-unit-pat.rs:24:9 @@ -36,12 +38,14 @@ LL | pub struct XEmpty6(); | help: use this syntax instead | -LL | XEmpty2 => () - | ~~~~~~~ +LL - XEmpty2() => () +LL + XEmpty2 => () + | help: a tuple struct with a similar name exists | -LL | XEmpty6() => () - | ~~~~~~~ +LL - XEmpty2() => () +LL + XEmpty6() => () + | error[E0532]: expected tuple struct or tuple variant, found unit struct `Empty2` --> $DIR/empty-struct-unit-pat.rs:28:9 @@ -59,12 +63,14 @@ LL | pub struct XEmpty6(); | help: use this syntax instead | -LL | Empty2 => () - | ~~~~~~ +LL - Empty2(..) => () +LL + Empty2 => () + | help: a tuple struct with a similar name exists | -LL | XEmpty6(..) => () - | ~~~~~~~ +LL - Empty2(..) => () +LL + XEmpty6(..) => () + | error[E0532]: expected tuple struct or tuple variant, found unit struct `XEmpty2` --> $DIR/empty-struct-unit-pat.rs:32:9 @@ -81,12 +87,14 @@ LL | pub struct XEmpty6(); | help: use this syntax instead | -LL | XEmpty2 => () - | ~~~~~~~ +LL - XEmpty2(..) => () +LL + XEmpty2 => () + | help: a tuple struct with a similar name exists | -LL | XEmpty6(..) => () - | ~~~~~~~ +LL - XEmpty2(..) => () +LL + XEmpty6(..) => () + | error[E0532]: expected tuple struct or tuple variant, found unit variant `E::Empty4` --> $DIR/empty-struct-unit-pat.rs:37:9 @@ -112,12 +120,14 @@ LL | XEmpty5(), | help: use this syntax instead | -LL | XE::XEmpty4 => (), - | ~~~~~~~~~~~ +LL - XE::XEmpty4() => (), +LL + XE::XEmpty4 => (), + | help: a tuple variant with a similar name exists | -LL | XE::XEmpty5() => (), - | ~~~~~~~ +LL - XE::XEmpty4() => (), +LL + XE::XEmpty5() => (), + | error[E0532]: expected tuple struct or tuple variant, found unit variant `E::Empty4` --> $DIR/empty-struct-unit-pat.rs:46:9 @@ -143,12 +153,14 @@ LL | XEmpty5(), | help: use this syntax instead | -LL | XE::XEmpty4 => (), - | ~~~~~~~~~~~ +LL - XE::XEmpty4(..) => (), +LL + XE::XEmpty4 => (), + | help: a tuple variant with a similar name exists | -LL | XE::XEmpty5(..) => (), - | ~~~~~~~ +LL - XE::XEmpty4(..) => (), +LL + XE::XEmpty5(..) => (), + | error: aborting due to 8 previous errors diff --git a/tests/ui/enum-discriminant/discriminant-ill-typed.stderr b/tests/ui/enum-discriminant/discriminant-ill-typed.stderr index 2757145285c..e9508b7fe96 100644 --- a/tests/ui/enum-discriminant/discriminant-ill-typed.stderr +++ b/tests/ui/enum-discriminant/discriminant-ill-typed.stderr @@ -6,8 +6,9 @@ LL | OhNo = 0_u8, | help: change the type of the numeric literal from `u8` to `i8` | -LL | OhNo = 0_i8, - | ~~ +LL - OhNo = 0_u8, +LL + OhNo = 0_i8, + | error[E0308]: mismatched types --> $DIR/discriminant-ill-typed.rs:28:16 @@ -17,8 +18,9 @@ LL | OhNo = 0_i8, | help: change the type of the numeric literal from `i8` to `u8` | -LL | OhNo = 0_u8, - | ~~ +LL - OhNo = 0_i8, +LL + OhNo = 0_u8, + | error[E0308]: mismatched types --> $DIR/discriminant-ill-typed.rs:41:16 @@ -28,8 +30,9 @@ LL | OhNo = 0_u16, | help: change the type of the numeric literal from `u16` to `i16` | -LL | OhNo = 0_i16, - | ~~~ +LL - OhNo = 0_u16, +LL + OhNo = 0_i16, + | error[E0308]: mismatched types --> $DIR/discriminant-ill-typed.rs:54:16 @@ -39,8 +42,9 @@ LL | OhNo = 0_i16, | help: change the type of the numeric literal from `i16` to `u16` | -LL | OhNo = 0_u16, - | ~~~ +LL - OhNo = 0_i16, +LL + OhNo = 0_u16, + | error[E0308]: mismatched types --> $DIR/discriminant-ill-typed.rs:67:16 @@ -50,8 +54,9 @@ LL | OhNo = 0_u32, | help: change the type of the numeric literal from `u32` to `i32` | -LL | OhNo = 0_i32, - | ~~~ +LL - OhNo = 0_u32, +LL + OhNo = 0_i32, + | error[E0308]: mismatched types --> $DIR/discriminant-ill-typed.rs:80:16 @@ -61,8 +66,9 @@ LL | OhNo = 0_i32, | help: change the type of the numeric literal from `i32` to `u32` | -LL | OhNo = 0_u32, - | ~~~ +LL - OhNo = 0_i32, +LL + OhNo = 0_u32, + | error[E0308]: mismatched types --> $DIR/discriminant-ill-typed.rs:93:16 @@ -72,8 +78,9 @@ LL | OhNo = 0_u64, | help: change the type of the numeric literal from `u64` to `i64` | -LL | OhNo = 0_i64, - | ~~~ +LL - OhNo = 0_u64, +LL + OhNo = 0_i64, + | error[E0308]: mismatched types --> $DIR/discriminant-ill-typed.rs:106:16 @@ -83,8 +90,9 @@ LL | OhNo = 0_i64, | help: change the type of the numeric literal from `i64` to `u64` | -LL | OhNo = 0_u64, - | ~~~ +LL - OhNo = 0_i64, +LL + OhNo = 0_u64, + | error: aborting due to 8 previous errors diff --git a/tests/ui/enum/assoc-fn-call-on-variant.stderr b/tests/ui/enum/assoc-fn-call-on-variant.stderr index 47fc630c923..5318025f554 100644 --- a/tests/ui/enum/assoc-fn-call-on-variant.stderr +++ b/tests/ui/enum/assoc-fn-call-on-variant.stderr @@ -6,8 +6,9 @@ LL | E::A::f(); | help: there is an enum variant `E::A`; try using the variant's enum | -LL | E::f(); - | ~ +LL - E::A::f(); +LL + E::f(); + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-48838.rs b/tests/ui/enum/closure-in-enum-issue-48838.rs index 057a424dfef..057a424dfef 100644 --- a/tests/ui/issues/issue-48838.rs +++ b/tests/ui/enum/closure-in-enum-issue-48838.rs diff --git a/tests/ui/issues/issue-48838.stderr b/tests/ui/enum/closure-in-enum-issue-48838.stderr index 504ea3e8010..17e6c343334 100644 --- a/tests/ui/issues/issue-48838.stderr +++ b/tests/ui/enum/closure-in-enum-issue-48838.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/issue-48838.rs:2:14 + --> $DIR/closure-in-enum-issue-48838.rs:2:14 | LL | Square = |x| x, | ^^^^^ expected `isize`, found closure | = note: expected type `isize` - found closure `{closure@$DIR/issue-48838.rs:2:14: 2:17}` + found closure `{closure@$DIR/closure-in-enum-issue-48838.rs:2:14: 2:17}` error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-40350.rs b/tests/ui/enum/enum-inside-enum-issue-40350.rs index 50d74f27b63..50d74f27b63 100644 --- a/tests/ui/issues/issue-40350.rs +++ b/tests/ui/enum/enum-inside-enum-issue-40350.rs diff --git a/tests/ui/env-macro/error-recovery-issue-55897.stderr b/tests/ui/env-macro/error-recovery-issue-55897.stderr index 5a20bf8b168..f1cacf5420e 100644 --- a/tests/ui/env-macro/error-recovery-issue-55897.stderr +++ b/tests/ui/env-macro/error-recovery-issue-55897.stderr @@ -31,7 +31,7 @@ LL | use env; help: consider importing this module instead | LL | use std::env; - | ~~~~~~~~ + | +++++ error: aborting due to 4 previous errors diff --git a/tests/ui/error-codes/E0027.stderr b/tests/ui/error-codes/E0027.stderr index 7bbafcf0a27..3a1ebf29719 100644 --- a/tests/ui/error-codes/E0027.stderr +++ b/tests/ui/error-codes/E0027.stderr @@ -7,15 +7,15 @@ LL | Dog { age: x } => {} help: include the missing field in the pattern | LL | Dog { age: x, name } => {} - | ~~~~~~~~ + | ++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Dog { age: x, name: _ } => {} - | ~~~~~~~~~~~ + | +++++++++ help: or always ignore missing fields here | LL | Dog { age: x, .. } => {} - | ~~~~~~ + | ++++ error[E0027]: pattern does not mention field `age` --> $DIR/E0027.rs:15:9 @@ -25,16 +25,19 @@ LL | Dog { name: x, } => {} | help: include the missing field in the pattern | -LL | Dog { name: x, age } => {} - | ~~~~~~~ +LL - Dog { name: x, } => {} +LL + Dog { name: x, age } => {} + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | Dog { name: x, age: _ } => {} - | ~~~~~~~~~~ +LL - Dog { name: x, } => {} +LL + Dog { name: x, age: _ } => {} + | help: or always ignore missing fields here | -LL | Dog { name: x, .. } => {} - | ~~~~~~ +LL - Dog { name: x, } => {} +LL + Dog { name: x, .. } => {} + | error[E0027]: pattern does not mention field `age` --> $DIR/E0027.rs:19:9 @@ -44,16 +47,19 @@ LL | Dog { name: x , } => {} | help: include the missing field in the pattern | -LL | Dog { name: x, age } => {} - | ~~~~~~~ +LL - Dog { name: x , } => {} +LL + Dog { name: x, age } => {} + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | Dog { name: x, age: _ } => {} - | ~~~~~~~~~~ +LL - Dog { name: x , } => {} +LL + Dog { name: x, age: _ } => {} + | help: or always ignore missing fields here | -LL | Dog { name: x, .. } => {} - | ~~~~~~ +LL - Dog { name: x , } => {} +LL + Dog { name: x, .. } => {} + | error[E0027]: pattern does not mention fields `name`, `age` --> $DIR/E0027.rs:22:9 @@ -63,16 +69,19 @@ LL | Dog {} => {} | help: include the missing fields in the pattern | -LL | Dog { name, age } => {} - | ~~~~~~~~~~~~~ +LL - Dog {} => {} +LL + Dog { name, age } => {} + | help: if you don't care about these missing fields, you can explicitly ignore them | -LL | Dog { name: _, age: _ } => {} - | ~~~~~~~~~~~~~~~~~~~ +LL - Dog {} => {} +LL + Dog { name: _, age: _ } => {} + | help: or always ignore missing fields here | -LL | Dog { .. } => {} - | ~~~~~~ +LL - Dog {} => {} +LL + Dog { .. } => {} + | error: aborting due to 4 previous errors diff --git a/tests/ui/error-codes/E0034.stderr b/tests/ui/error-codes/E0034.stderr index 48b8efcf8a2..434518741fc 100644 --- a/tests/ui/error-codes/E0034.stderr +++ b/tests/ui/error-codes/E0034.stderr @@ -16,10 +16,12 @@ LL | fn foo() {} | ^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | <Test as Trait1>::foo() - | ~~~~~~~~~~~~~~~~~~ -LL | <Test as Trait2>::foo() - | ~~~~~~~~~~~~~~~~~~ +LL - Test::foo() +LL + <Test as Trait1>::foo() + | +LL - Test::foo() +LL + <Test as Trait2>::foo() + | error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0038.stderr b/tests/ui/error-codes/E0038.stderr index 59e9f504d17..63a5249a386 100644 --- a/tests/ui/error-codes/E0038.stderr +++ b/tests/ui/error-codes/E0038.stderr @@ -5,7 +5,7 @@ LL | fn call_foo(x: Box<dyn Trait>) { | ^^^^^^^^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/E0038.rs:2:22 | LL | trait Trait { @@ -21,7 +21,7 @@ LL | let y = x.foo(); | ^^^^^^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/E0038.rs:2:22 | LL | trait Trait { diff --git a/tests/ui/error-codes/E0040.stderr b/tests/ui/error-codes/E0040.stderr index 00cccb07c0f..674c2b70b03 100644 --- a/tests/ui/error-codes/E0040.stderr +++ b/tests/ui/error-codes/E0040.stderr @@ -6,8 +6,9 @@ LL | x.drop(); | help: consider using `drop` function | -LL | drop(x); - | +++++ ~ +LL - x.drop(); +LL + drop(x); + | error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0054.stderr b/tests/ui/error-codes/E0054.stderr index be35242ad72..a2e618d9b06 100644 --- a/tests/ui/error-codes/E0054.stderr +++ b/tests/ui/error-codes/E0054.stderr @@ -6,8 +6,9 @@ LL | let x_is_nonzero = x as bool; | help: compare with zero instead | -LL | let x_is_nonzero = x != 0; - | ~~~~ +LL - let x_is_nonzero = x as bool; +LL + let x_is_nonzero = x != 0; + | error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0057.stderr b/tests/ui/error-codes/E0057.stderr index ef6e2908b93..35bd842b2cf 100644 --- a/tests/ui/error-codes/E0057.stderr +++ b/tests/ui/error-codes/E0057.stderr @@ -11,8 +11,9 @@ LL | let f = |x| x * 3; | ^^^ help: provide the argument | -LL | let a = f(/* x */); - | ~~~~~~~~~ +LL - let a = f(); +LL + let a = f(/* x */); + | error[E0057]: this function takes 1 argument but 2 arguments were supplied --> $DIR/E0057.rs:5:13 diff --git a/tests/ui/error-codes/E0060.stderr b/tests/ui/error-codes/E0060.stderr index 8387b15b970..fc52c6fc5ea 100644 --- a/tests/ui/error-codes/E0060.stderr +++ b/tests/ui/error-codes/E0060.stderr @@ -8,11 +8,12 @@ note: function defined here --> $DIR/E0060.rs:2:8 | LL | fn printf(_: *const u8, ...) -> u32; - | ^^^^^^ + | ^^^^^^ - help: provide the argument | -LL | unsafe { printf(/* *const u8 */); } - | ~~~~~~~~~~~~~~~~~ +LL - unsafe { printf(); } +LL + unsafe { printf(/* *const u8 */); } + | error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0061.stderr b/tests/ui/error-codes/E0061.stderr index 7b180c07120..b70d607ebeb 100644 --- a/tests/ui/error-codes/E0061.stderr +++ b/tests/ui/error-codes/E0061.stderr @@ -8,11 +8,12 @@ note: function defined here --> $DIR/E0061.rs:1:4 | LL | fn f(a: u16, b: &str) {} - | ^ ------ ------- + | ^ ------- help: provide the argument | -LL | f(0, /* &str */); - | ~~~~~~~~~~~~~~~ +LL - f(0); +LL + f(0, /* &str */); + | error[E0061]: this function takes 1 argument but 0 arguments were supplied --> $DIR/E0061.rs:9:5 @@ -27,8 +28,9 @@ LL | fn f2(a: u16) {} | ^^ ------ help: provide the argument | -LL | f2(/* u16 */); - | ~~~~~~~~~~~ +LL - f2(); +LL + f2(/* u16 */); + | error: aborting due to 2 previous errors diff --git a/tests/ui/error-codes/E0121.stderr b/tests/ui/error-codes/E0121.stderr index 5f5df0fd0ae..b169373f643 100644 --- a/tests/ui/error-codes/E0121.stderr +++ b/tests/ui/error-codes/E0121.stderr @@ -15,8 +15,9 @@ LL | static BAR: _ = "test"; | help: replace this with a fully-specified type | -LL | static BAR: &str = "test"; - | ~~~~ +LL - static BAR: _ = "test"; +LL + static BAR: &str = "test"; + | error: aborting due to 2 previous errors diff --git a/tests/ui/error-codes/E0214.stderr b/tests/ui/error-codes/E0214.stderr index 76b11f30996..71ae62d64e3 100644 --- a/tests/ui/error-codes/E0214.stderr +++ b/tests/ui/error-codes/E0214.stderr @@ -6,8 +6,9 @@ LL | let v: Vec(&str) = vec!["foo"]; | help: use angle brackets instead | -LL | let v: Vec<&str> = vec!["foo"]; - | ~ ~ +LL - let v: Vec(&str) = vec!["foo"]; +LL + let v: Vec<&str> = vec!["foo"]; + | error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0221.stderr b/tests/ui/error-codes/E0221.stderr index 07e7485b67e..a18e91806d7 100644 --- a/tests/ui/error-codes/E0221.stderr +++ b/tests/ui/error-codes/E0221.stderr @@ -12,12 +12,14 @@ LL | let _: Self::A; | help: use fully-qualified syntax to disambiguate | -LL | let _: <Self as Foo>::A; - | ~~~~~~~~~~~~~~~ +LL - let _: Self::A; +LL + let _: <Self as Foo>::A; + | help: use fully-qualified syntax to disambiguate | -LL | let _: <Self as Bar>::A; - | ~~~~~~~~~~~~~~~ +LL - let _: Self::A; +LL + let _: <Self as Bar>::A; + | error[E0221]: ambiguous associated type `Err` in bounds of `Self` --> $DIR/E0221.rs:21:16 @@ -31,8 +33,9 @@ LL | let _: Self::Err; = note: associated type `Err` could derive from `FromStr` help: use fully-qualified syntax to disambiguate | -LL | let _: <Self as My>::Err; - | ~~~~~~~~~~~~~~ +LL - let _: Self::Err; +LL + let _: <Self as My>::Err; + | error: aborting due to 2 previous errors diff --git a/tests/ui/error-codes/E0259.stderr b/tests/ui/error-codes/E0259.stderr index 975d1a161a0..08d3deb68d2 100644 --- a/tests/ui/error-codes/E0259.stderr +++ b/tests/ui/error-codes/E0259.stderr @@ -10,7 +10,8 @@ LL | extern crate test as alloc; = note: `alloc` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate test as other_alloc; +LL - extern crate test as alloc; +LL + extern crate test as other_alloc; | error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0260.stderr b/tests/ui/error-codes/E0260.stderr index 35698c65359..cb47b77904a 100644 --- a/tests/ui/error-codes/E0260.stderr +++ b/tests/ui/error-codes/E0260.stderr @@ -10,7 +10,8 @@ LL | mod alloc { = note: `alloc` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate alloc as other_alloc; +LL - extern crate alloc; +LL + extern crate alloc as other_alloc; | error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0283.stderr b/tests/ui/error-codes/E0283.stderr index 381eca5f2a4..29baae5f133 100644 --- a/tests/ui/error-codes/E0283.stderr +++ b/tests/ui/error-codes/E0283.stderr @@ -30,8 +30,9 @@ LL | impl Into<u32> for Impl { where U: From<T>; help: try using a fully qualified path to specify the expected types | -LL | let bar = <Impl as Into<T>>::into(foo_impl) * 1u32; - | ++++++++++++++++++++++++ ~ +LL - let bar = foo_impl.into() * 1u32; +LL + let bar = <Impl as Into<T>>::into(foo_impl) * 1u32; + | error: aborting due to 2 previous errors diff --git a/tests/ui/error-codes/E0423.stderr b/tests/ui/error-codes/E0423.stderr index dd7a5b034c5..e50b8bd820c 100644 --- a/tests/ui/error-codes/E0423.stderr +++ b/tests/ui/error-codes/E0423.stderr @@ -51,12 +51,14 @@ LL | fn foo() { | help: use struct literal syntax instead | -LL | let f = Foo { a: val }; - | ~~~~~~~~~~~~~~ +LL - let f = Foo(); +LL + let f = Foo { a: val }; + | help: a function with a similar name exists (notice the capitalization difference) | -LL | let f = foo(); - | ~~~ +LL - let f = Foo(); +LL + let f = foo(); + | error: aborting due to 5 previous errors diff --git a/tests/ui/error-codes/E0435.stderr b/tests/ui/error-codes/E0435.stderr index 1ebb9976394..13187472e60 100644 --- a/tests/ui/error-codes/E0435.stderr +++ b/tests/ui/error-codes/E0435.stderr @@ -6,8 +6,9 @@ LL | let _: [u8; foo]; | help: consider using `const` instead of `let` | -LL | const foo: usize = 42; - | ~~~~~ +LL - let foo: usize = 42; +LL + const foo: usize = 42; + | error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0462.rs b/tests/ui/error-codes/E0462.rs index 12214331445..45d35c345cb 100644 --- a/tests/ui/error-codes/E0462.rs +++ b/tests/ui/error-codes/E0462.rs @@ -1,6 +1,6 @@ //@ aux-build:found-staticlib.rs -//@ normalize-stderr: "\.nll/" -> "/" +//@ normalize-stderr: "E0462\..+/auxiliary/" -> "E0462/auxiliary/" //@ normalize-stderr: "\\\?\\" -> "" //@ normalize-stderr: "(lib)?found_staticlib\.[a-z]+" -> "libfound_staticlib.somelib" diff --git a/tests/ui/error-codes/E0464.rs b/tests/ui/error-codes/E0464.rs index aaf4d3a8f50..d1303ae91b1 100644 --- a/tests/ui/error-codes/E0464.rs +++ b/tests/ui/error-codes/E0464.rs @@ -2,7 +2,7 @@ //@ aux-build:crateresolve1-2.rs //@ aux-build:crateresolve1-3.rs -//@ normalize-stderr: "\.nll/" -> "/" +//@ normalize-stderr: "E0464\..+/auxiliary/" -> "E0464/auxiliary/" //@ normalize-stderr: "\\\?\\" -> "" //@ normalize-stderr: "(lib)?crateresolve1-([123])\.[a-z]+" -> "libcrateresolve1-$2.somelib" diff --git a/tests/ui/error-codes/E0516.stderr b/tests/ui/error-codes/E0516.stderr index 62e70a4668d..f4127678d5b 100644 --- a/tests/ui/error-codes/E0516.stderr +++ b/tests/ui/error-codes/E0516.stderr @@ -6,8 +6,9 @@ LL | let x: typeof(92) = 92; | help: consider replacing `typeof(...)` with an actual type | -LL | let x: i32 = 92; - | ~~~ +LL - let x: typeof(92) = 92; +LL + let x: i32 = 92; + | error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0523.rs b/tests/ui/error-codes/E0523.rs index aaf4d3a8f50..7c1869c055b 100644 --- a/tests/ui/error-codes/E0523.rs +++ b/tests/ui/error-codes/E0523.rs @@ -2,7 +2,7 @@ //@ aux-build:crateresolve1-2.rs //@ aux-build:crateresolve1-3.rs -//@ normalize-stderr: "\.nll/" -> "/" +//@ normalize-stderr: "E0523\..+/auxiliary/" -> "E0523/auxiliary/" //@ normalize-stderr: "\\\?\\" -> "" //@ normalize-stderr: "(lib)?crateresolve1-([123])\.[a-z]+" -> "libcrateresolve1-$2.somelib" diff --git a/tests/ui/error-codes/E0637.stderr b/tests/ui/error-codes/E0637.stderr index d9db89ddb0c..95a5a58ab85 100644 --- a/tests/ui/error-codes/E0637.stderr +++ b/tests/ui/error-codes/E0637.stderr @@ -13,8 +13,9 @@ LL | fn underscore_lifetime<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str { = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `str1` or `str2` help: consider introducing a named lifetime parameter | -LL | fn underscore_lifetime<'a, '_>(str1: &'a str, str2: &'a str) -> &'a str { - | +++ ~~ ~~ ~~ +LL - fn underscore_lifetime<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str { +LL + fn underscore_lifetime<'a, '_>(str1: &'a str, str2: &'a str) -> &'a str { + | error[E0637]: `&` without an explicit lifetime name cannot be used here --> $DIR/E0637.rs:13:13 diff --git a/tests/ui/error-codes/E0642.stderr b/tests/ui/error-codes/E0642.stderr index dd9e28ad492..97309e95b6b 100644 --- a/tests/ui/error-codes/E0642.stderr +++ b/tests/ui/error-codes/E0642.stderr @@ -6,8 +6,9 @@ LL | fn foo((x, y): (i32, i32)); | help: give this argument a name or use an underscore to ignore it | -LL | fn foo(_: (i32, i32)); - | ~ +LL - fn foo((x, y): (i32, i32)); +LL + fn foo(_: (i32, i32)); + | error[E0642]: patterns aren't allowed in methods without bodies --> $DIR/E0642.rs:11:12 @@ -17,8 +18,9 @@ LL | fn bar((x, y): (i32, i32)) {} | help: give this argument a name or use an underscore to ignore it | -LL | fn bar(_: (i32, i32)) {} - | ~ +LL - fn bar((x, y): (i32, i32)) {} +LL + fn bar(_: (i32, i32)) {} + | error[E0642]: patterns aren't allowed in methods without bodies --> $DIR/E0642.rs:13:15 @@ -28,8 +30,9 @@ LL | fn method(S { .. }: S) {} | help: give this argument a name or use an underscore to ignore it | -LL | fn method(_: S) {} - | ~ +LL - fn method(S { .. }: S) {} +LL + fn method(_: S) {} + | error: aborting due to 3 previous errors diff --git a/tests/ui/error-codes/E0746.stderr b/tests/ui/error-codes/E0746.stderr index ce3e9736969..07d6b285f76 100644 --- a/tests/ui/error-codes/E0746.stderr +++ b/tests/ui/error-codes/E0746.stderr @@ -1,4 +1,4 @@ -error[E0746]: return type cannot have an unboxed trait object +error[E0746]: return type cannot be a trait object without pointer indirection --> $DIR/E0746.rs:8:13 | LL | fn foo() -> dyn Trait { Struct } @@ -6,14 +6,15 @@ LL | fn foo() -> dyn Trait { Struct } | help: consider returning an `impl Trait` instead of a `dyn Trait` | -LL | fn foo() -> impl Trait { Struct } - | ~~~~ +LL - fn foo() -> dyn Trait { Struct } +LL + fn foo() -> impl Trait { Struct } + | help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL | fn foo() -> Box<dyn Trait> { Box::new(Struct) } | ++++ + +++++++++ + -error[E0746]: return type cannot have an unboxed trait object +error[E0746]: return type cannot be a trait object without pointer indirection --> $DIR/E0746.rs:11:13 | LL | fn bar() -> dyn Trait { @@ -21,8 +22,9 @@ LL | fn bar() -> dyn Trait { | help: consider returning an `impl Trait` instead of a `dyn Trait` | -LL | fn bar() -> impl Trait { - | ~~~~ +LL - fn bar() -> dyn Trait { +LL + fn bar() -> impl Trait { + | help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL ~ fn bar() -> Box<dyn Trait> { diff --git a/tests/ui/error-codes/E0789.rs b/tests/ui/error-codes/E0789.rs index 3acc983edc4..08471e1b3f3 100644 --- a/tests/ui/error-codes/E0789.rs +++ b/tests/ui/error-codes/E0789.rs @@ -4,7 +4,7 @@ #![feature(staged_api)] #![unstable(feature = "foo_module", reason = "...", issue = "123")] -#[rustc_allowed_through_unstable_modules] +#[rustc_allowed_through_unstable_modules = "use stable path instead"] // #[stable(feature = "foo", since = "1.0")] struct Foo; //~^ ERROR `rustc_allowed_through_unstable_modules` attribute must be paired with a `stable` attribute diff --git a/tests/ui/error-codes/ex-E0612.stderr b/tests/ui/error-codes/ex-E0612.stderr index 23c1697b9b2..54451d3d452 100644 --- a/tests/ui/error-codes/ex-E0612.stderr +++ b/tests/ui/error-codes/ex-E0612.stderr @@ -6,8 +6,9 @@ LL | y.1; | help: a field with a similar name exists | -LL | y.0; - | ~ +LL - y.1; +LL + y.0; + | error: aborting due to 1 previous error diff --git a/tests/ui/error-emitter/E0308-clarification.rs b/tests/ui/error-emitter/E0308-clarification.rs new file mode 100644 index 00000000000..4c15ede0041 --- /dev/null +++ b/tests/ui/error-emitter/E0308-clarification.rs @@ -0,0 +1,16 @@ +//@ compile-flags: -Zunstable-options --error-format=human-unicode --color=always +//@ only-linux +// Ensure that when we have a type error where both types have the same textual representation, the +// diagnostic machinery highlights the clarifying comment that comes after in parentheses. +trait Foo: Copy + ToString {} + +impl<T: Copy + ToString> Foo for T {} + +fn hide<T: Foo>(x: T) -> impl Foo { + x +} + +fn main() { + let mut x = (hide(0_u32), hide(0_i32)); + x = (x.1, x.0); +} diff --git a/tests/ui/error-emitter/E0308-clarification.svg b/tests/ui/error-emitter/E0308-clarification.svg new file mode 100644 index 00000000000..9432e3a4ee9 --- /dev/null +++ b/tests/ui/error-emitter/E0308-clarification.svg @@ -0,0 +1,97 @@ +<svg width="740px" height="668px" xmlns="http://www.w3.org/2000/svg"> + <style> + .fg { fill: #AAAAAA } + .bg { background: #000000 } + .fg-ansi256-009 { fill: #FF5555 } + .fg-ansi256-012 { fill: #5555FF } + .fg-magenta { fill: #AA00AA } + .container { + padding: 0 10px; + line-height: 18px; + } + .bold { font-weight: bold; } + tspan { + font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace; + white-space: pre; + line-height: 18px; + } + </style> + + <rect width="100%" height="100%" y="0" rx="4.5" class="bg" /> + + <text xml:space="preserve" class="container fg"> + <tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: mismatched types</tspan> +</tspan> + <tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold"> ╭▸ </tspan><tspan>$DIR/E0308-clarification.rs:15:10</tspan> +</tspan> + <tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan> +</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 hide<T: Foo>(x: T) -> impl Foo {</tspan> +</tspan> + <tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">┬───────</tspan> +</tspan> + <tspan x="10px" y="118px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan> +</tspan> + <tspan x="10px" y="136px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">the expected opaque type</tspan> +</tspan> + <tspan x="10px" y="154px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">the found opaque type</tspan> +</tspan> + <tspan x="10px" y="172px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">‡</tspan> +</tspan> + <tspan x="10px" y="190px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> x = (x.1, x.0);</tspan> +</tspan> + <tspan x="10px" y="208px"><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">expected `u32`, found `i32`</tspan> +</tspan> + <tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan> +</tspan> + <tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">├ </tspan><tspan class="bold">note</tspan><tspan>: expected opaque type `</tspan><tspan class="fg-magenta bold">impl Foo</tspan><tspan>` (</tspan><tspan class="fg-magenta bold">`u32`</tspan><tspan>)</tspan> +</tspan> + <tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> found opaque type `</tspan><tspan class="fg-magenta bold">impl Foo</tspan><tspan>` (</tspan><tspan class="fg-magenta bold">`i32`</tspan><tspan>)</tspan> +</tspan> + <tspan x="10px" y="280px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">╰ </tspan><tspan class="bold">note</tspan><tspan>: distinct uses of `impl Trait` result in different opaque types</tspan> +</tspan> + <tspan x="10px" y="298px"> +</tspan> + <tspan x="10px" y="316px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: mismatched types</tspan> +</tspan> + <tspan x="10px" y="334px"><tspan> </tspan><tspan class="fg-ansi256-012 bold"> ╭▸ </tspan><tspan>$DIR/E0308-clarification.rs:15:15</tspan> +</tspan> + <tspan x="10px" y="352px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan> +</tspan> + <tspan x="10px" y="370px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> fn hide<T: Foo>(x: T) -> impl Foo {</tspan> +</tspan> + <tspan x="10px" y="388px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">┬───────</tspan> +</tspan> + <tspan x="10px" y="406px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan> +</tspan> + <tspan x="10px" y="424px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">the expected opaque type</tspan> +</tspan> + <tspan x="10px" y="442px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">the found opaque type</tspan> +</tspan> + <tspan x="10px" y="460px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">‡</tspan> +</tspan> + <tspan x="10px" y="478px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> x = (x.1, x.0);</tspan> +</tspan> + <tspan x="10px" y="496px"><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">expected `i32`, found `u32`</tspan> +</tspan> + <tspan x="10px" y="514px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan> +</tspan> + <tspan x="10px" y="532px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">├ </tspan><tspan class="bold">note</tspan><tspan>: expected opaque type `</tspan><tspan class="fg-magenta bold">impl Foo</tspan><tspan>` (</tspan><tspan class="fg-magenta bold">`i32`</tspan><tspan>)</tspan> +</tspan> + <tspan x="10px" y="550px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">│</tspan><tspan> found opaque type `</tspan><tspan class="fg-magenta bold">impl Foo</tspan><tspan>` (</tspan><tspan class="fg-magenta bold">`u32`</tspan><tspan>)</tspan> +</tspan> + <tspan x="10px" y="568px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">╰ </tspan><tspan class="bold">note</tspan><tspan>: distinct uses of `impl Trait` result in different opaque types</tspan> +</tspan> + <tspan x="10px" y="586px"> +</tspan> + <tspan x="10px" y="604px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="bold">: aborting due to 2 previous errors</tspan> +</tspan> + <tspan x="10px" y="622px"> +</tspan> + <tspan x="10px" y="640px"><tspan class="bold">For more information about this error, try `rustc --explain E0308`.</tspan> +</tspan> + <tspan x="10px" y="658px"> +</tspan> + </text> + +</svg> diff --git a/tests/ui/error-festival.stderr b/tests/ui/error-festival.stderr index f71fa7e685c..9db95363791 100644 --- a/tests/ui/error-festival.stderr +++ b/tests/ui/error-festival.stderr @@ -6,8 +6,9 @@ LL | y = 2; | help: a local variable with a similar name exists | -LL | x = 2; - | ~ +LL - y = 2; +LL + x = 2; + | help: you might have meant to introduce a new binding | LL | let y = 2; @@ -76,8 +77,9 @@ LL | let x_is_nonzero = x as bool; | help: compare with zero instead | -LL | let x_is_nonzero = x != 0; - | ~~~~ +LL - let x_is_nonzero = x as bool; +LL + let x_is_nonzero = x != 0; + | error[E0606]: casting `&u8` as `u32` is invalid --> $DIR/error-festival.rs:37:18 diff --git a/tests/ui/explicit-tail-calls/become-operator.stderr b/tests/ui/explicit-tail-calls/become-operator.stderr index 26e4343faae..9741fbfca6d 100644 --- a/tests/ui/explicit-tail-calls/become-operator.stderr +++ b/tests/ui/explicit-tail-calls/become-operator.stderr @@ -16,8 +16,9 @@ LL | become a + b; | help: try using the method directly | -LL | become (a).add(b); - | + ~~~~~~ + +LL - become a + b; +LL + become (a).add(b); + | error: `become` does not support operators --> $DIR/become-operator.rs:19:12 @@ -37,8 +38,9 @@ LL | become !x; | help: try using the method directly | -LL | become (x).not(); - | ~ +++++++ +LL - become !x; +LL + become (x).not(); + | error: `become` does not support operators --> $DIR/become-operator.rs:27:12 @@ -68,8 +70,9 @@ LL | become *b ^= 1; | help: try using the method directly | -LL | become (*b).bitxor_assign(1); - | + ~~~~~~~~~~~~~~~~ + +LL - become *b ^= 1; +LL + become (*b).bitxor_assign(1); + | error: aborting due to 7 previous errors diff --git a/tests/ui/explicit-tail-calls/become-trait-fn.rs b/tests/ui/explicit-tail-calls/become-trait-fn.rs new file mode 100644 index 00000000000..03255f15dd0 --- /dev/null +++ b/tests/ui/explicit-tail-calls/become-trait-fn.rs @@ -0,0 +1,19 @@ +// regression test for <https://github.com/rust-lang/rust/issues/134336> +// this previously caused an ICE, because we would compare `#[track_caller]` of +// the callee and the caller (in tailcalls specifically), leading to a problem +// since `T::f`'s instance can't be resolved (we do not know if the function is +// or isn't marked with `#[track_caller]`!) +// +//@ check-pass +#![expect(incomplete_features)] +#![feature(explicit_tail_calls)] + +trait Tr { + fn f(); +} + +fn g<T: Tr>() { + become T::f(); +} + +fn main() {} diff --git a/tests/ui/explicit-tail-calls/callee_is_track_caller.rs b/tests/ui/explicit-tail-calls/callee_is_track_caller.rs new file mode 100644 index 00000000000..bcb93fda8c8 --- /dev/null +++ b/tests/ui/explicit-tail-calls/callee_is_track_caller.rs @@ -0,0 +1,15 @@ +//@ check-pass +// FIXME(explicit_tail_calls): make this run-pass, once tail calls are properly implemented +#![expect(incomplete_features)] +#![feature(explicit_tail_calls)] + +fn a(x: u32) -> u32 { + become b(x); +} + +#[track_caller] +fn b(x: u32) -> u32 { x + 42 } + +fn main() { + assert_eq!(a(12), 54); +} diff --git a/tests/ui/explicit-tail-calls/caller_is_track_caller.rs b/tests/ui/explicit-tail-calls/caller_is_track_caller.rs new file mode 100644 index 00000000000..4e5f3f12f83 --- /dev/null +++ b/tests/ui/explicit-tail-calls/caller_is_track_caller.rs @@ -0,0 +1,16 @@ +#![expect(incomplete_features)] +#![feature(explicit_tail_calls)] + +#[track_caller] +fn a() { + become b(); //~ error: a function marked with `#[track_caller]` cannot perform a tail-call +} + +fn b() {} + +#[track_caller] +fn c() { + become a(); //~ error: a function marked with `#[track_caller]` cannot perform a tail-call +} + +fn main() {} diff --git a/tests/ui/explicit-tail-calls/caller_is_track_caller.stderr b/tests/ui/explicit-tail-calls/caller_is_track_caller.stderr new file mode 100644 index 00000000000..79b9b45986c --- /dev/null +++ b/tests/ui/explicit-tail-calls/caller_is_track_caller.stderr @@ -0,0 +1,14 @@ +error: a function marked with `#[track_caller]` cannot perform a tail-call + --> $DIR/caller_is_track_caller.rs:6:5 + | +LL | become b(); + | ^^^^^^^^^^ + +error: a function marked with `#[track_caller]` cannot perform a tail-call + --> $DIR/caller_is_track_caller.rs:13:5 + | +LL | become a(); + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/explicit/explicit-call-to-dtor.stderr b/tests/ui/explicit/explicit-call-to-dtor.stderr index 6f40f3998a9..47d2823c82d 100644 --- a/tests/ui/explicit/explicit-call-to-dtor.stderr +++ b/tests/ui/explicit/explicit-call-to-dtor.stderr @@ -6,8 +6,9 @@ LL | x.drop(); | help: consider using `drop` function | -LL | drop(x); - | +++++ ~ +LL - x.drop(); +LL + drop(x); + | error: aborting due to 1 previous error diff --git a/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr b/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr index 13b6ee9987e..9f98fb5f26c 100644 --- a/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr +++ b/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr @@ -6,8 +6,9 @@ LL | self.drop(); | help: consider using `drop` function | -LL | drop(self); - | +++++ ~ +LL - self.drop(); +LL + drop(self); + | error: aborting due to 1 previous error diff --git a/tests/ui/expr/block.rs b/tests/ui/expr/block.rs index bf626c9ead3..70f5c274c21 100644 --- a/tests/ui/expr/block.rs +++ b/tests/ui/expr/block.rs @@ -4,7 +4,7 @@ // Tests for standalone blocks as expressions -fn test_basic() { let rs: bool = { true }; assert!((rs)); } +fn test_basic() { let rs: bool = { true }; assert!(rs); } struct RS { v1: isize, v2: isize } diff --git a/tests/ui/expr/if/expr-if.rs b/tests/ui/expr/if/expr-if.rs index ae869c4b77a..68c2fc22130 100644 --- a/tests/ui/expr/if/expr-if.rs +++ b/tests/ui/expr/if/expr-if.rs @@ -1,43 +1,43 @@ //@ run-pass // Tests for if as expressions -fn test_if() { let rs: bool = if true { true } else { false }; assert!((rs)); } +fn test_if() { let rs: bool = if true { true } else { false }; assert!(rs); } fn test_else() { let rs: bool = if false { false } else { true }; - assert!((rs)); + assert!(rs); } fn test_elseif1() { let rs: bool = if true { true } else if true { false } else { false }; - assert!((rs)); + assert!(rs); } fn test_elseif2() { let rs: bool = if false { false } else if true { true } else { false }; - assert!((rs)); + assert!(rs); } fn test_elseif3() { let rs: bool = if false { false } else if false { false } else { true }; - assert!((rs)); + assert!(rs); } fn test_inferrence() { let rs = if true { true } else { false }; - assert!((rs)); + assert!(rs); } fn test_if_as_if_condition() { let rs1 = if if false { false } else { true } { true } else { false }; - assert!((rs1)); + assert!(rs1); let rs2 = if if true { false } else { true } { false } else { true }; - assert!((rs2)); + assert!(rs2); } fn test_if_as_block_result() { let rs = if true { if false { false } else { true } } else { false }; - assert!((rs)); + assert!(rs); } pub fn main() { diff --git a/tests/ui/expr/if/if-branch-types.stderr b/tests/ui/expr/if/if-branch-types.stderr index 0e86a24f31b..587d2f10a8c 100644 --- a/tests/ui/expr/if/if-branch-types.stderr +++ b/tests/ui/expr/if/if-branch-types.stderr @@ -8,8 +8,9 @@ LL | let x = if true { 10i32 } else { 10u32 }; | help: change the type of the numeric literal from `u32` to `i32` | -LL | let x = if true { 10i32 } else { 10i32 }; - | ~~~ +LL - let x = if true { 10i32 } else { 10u32 }; +LL + let x = if true { 10i32 } else { 10i32 }; + | error: aborting due to 1 previous error diff --git a/tests/ui/expr/if/if-else-type-mismatch.stderr b/tests/ui/expr/if/if-else-type-mismatch.stderr index f1fffdb1e7e..1cf94c98800 100644 --- a/tests/ui/expr/if/if-else-type-mismatch.stderr +++ b/tests/ui/expr/if/if-else-type-mismatch.stderr @@ -13,8 +13,9 @@ LL | | }; | help: change the type of the numeric literal from `u32` to `i32` | -LL | 2i32 - | ~~~ +LL - 2u32 +LL + 2i32 + | error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:8:38 @@ -26,8 +27,9 @@ LL | let _ = if true { 42i32 } else { 42u32 }; | help: change the type of the numeric literal from `u32` to `i32` | -LL | let _ = if true { 42i32 } else { 42i32 }; - | ~~~ +LL - let _ = if true { 42i32 } else { 42u32 }; +LL + let _ = if true { 42i32 } else { 42i32 }; + | error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:13:9 diff --git a/tests/ui/issues/issue-41272.rs b/tests/ui/expr/if/if-let-no-match-guards-issue-41272.rs index 255bbfe90a1..255bbfe90a1 100644 --- a/tests/ui/issues/issue-41272.rs +++ b/tests/ui/expr/if/if-let-no-match-guards-issue-41272.rs diff --git a/tests/ui/expr/issue-22933-2.stderr b/tests/ui/expr/issue-22933-2.stderr index dadc3121362..07f095f643e 100644 --- a/tests/ui/expr/issue-22933-2.stderr +++ b/tests/ui/expr/issue-22933-2.stderr @@ -9,8 +9,9 @@ LL | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, | help: there is a variant with a similar name | -LL | ApplePie = Delicious::Apple as isize | Delicious::Pie as isize, - | ~~~ +LL - ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, +LL + ApplePie = Delicious::Apple as isize | Delicious::Pie as isize, + | error: aborting due to 1 previous error diff --git a/tests/ui/extern-flag/empty-extern-arg.stderr b/tests/ui/extern-flag/empty-extern-arg.stderr index 2785b12a0ae..b9a128e02e1 100644 --- a/tests/ui/extern-flag/empty-extern-arg.stderr +++ b/tests/ui/extern-flag/empty-extern-arg.stderr @@ -8,6 +8,10 @@ error: unwinding panics are not supported without std = note: since the core library is usually precompiled with panic="unwind", rebuilding your crate with panic="abort" may not be enough to fix the problem error: requires `sized` lang_item + --> $DIR/empty-extern-arg.rs:6:11 + | +LL | fn main() {} + | ^^ error: aborting due to 4 previous errors diff --git a/tests/ui/extern/extern-const.stderr b/tests/ui/extern/extern-const.stderr index 441495866cd..c48eca8c36d 100644 --- a/tests/ui/extern/extern-const.stderr +++ b/tests/ui/extern/extern-const.stderr @@ -7,8 +7,9 @@ LL | const rust_dbg_static_mut: c_int; = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html help: try using a static value | -LL | static rust_dbg_static_mut: c_int; - | ~~~~~~ +LL - const rust_dbg_static_mut: c_int; +LL + static rust_dbg_static_mut: c_int; + | error: aborting due to 1 previous error diff --git a/tests/ui/extern/extern-crate-rename.stderr b/tests/ui/extern/extern-crate-rename.stderr index 43f6e56ab0e..4d4a585de60 100644 --- a/tests/ui/extern/extern-crate-rename.stderr +++ b/tests/ui/extern/extern-crate-rename.stderr @@ -9,8 +9,9 @@ LL | extern crate m2 as m1; = note: `m1` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate m2 as other_m1; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - extern crate m2 as m1; +LL + extern crate m2 as other_m1; + | error: aborting due to 1 previous error diff --git a/tests/ui/extern/extern-crate-visibility.stderr b/tests/ui/extern/extern-crate-visibility.stderr index b239727092a..c037da41b5e 100644 --- a/tests/ui/extern/extern-crate-visibility.stderr +++ b/tests/ui/extern/extern-crate-visibility.stderr @@ -11,8 +11,9 @@ LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ help: consider importing this module instead | -LL | use std::cell; - | ~~~~~~~~~ +LL - use foo::core::cell; +LL + use std::cell; + | error[E0603]: crate import `core` is private --> $DIR/extern-crate-visibility.rs:9:10 @@ -27,8 +28,9 @@ LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ help: consider importing this struct instead | -LL | std::cell::Cell::new(0); - | ~~~~~~~~~~~~~~~ +LL - foo::core::cell::Cell::new(0); +LL + std::cell::Cell::new(0); + | error: aborting due to 2 previous errors diff --git a/tests/ui/extern/fictional-abi.rs b/tests/ui/extern/fictional-abi.rs new file mode 100644 index 00000000000..60b24f8856e --- /dev/null +++ b/tests/ui/extern/fictional-abi.rs @@ -0,0 +1,3 @@ +#![crate_type = "lib"] + +pub extern "fictional" fn lol() {} //~ ERROR: invalid ABI diff --git a/tests/ui/abi/removed-wasm-abi.stderr b/tests/ui/extern/fictional-abi.stderr index 6007c4e2580..9784a57776f 100644 --- a/tests/ui/abi/removed-wasm-abi.stderr +++ b/tests/ui/extern/fictional-abi.stderr @@ -1,11 +1,10 @@ -error[E0703]: invalid ABI: found `wasm` - --> $DIR/removed-wasm-abi.rs:1:8 +error[E0703]: invalid ABI: found `fictional` + --> $DIR/fictional-abi.rs:3:12 | -LL | extern "wasm" fn test() {} - | ^^^^^^ invalid ABI +LL | pub extern "fictional" fn lol() {} + | ^^^^^^^^^^^ invalid ABI | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions - = note: non-standard wasm ABI is no longer supported error: aborting due to 1 previous error diff --git a/tests/ui/extern/issue-18819.stderr b/tests/ui/extern/issue-18819.stderr index 6de0ebfe9ae..566bf6a1f64 100644 --- a/tests/ui/extern/issue-18819.stderr +++ b/tests/ui/extern/issue-18819.stderr @@ -22,8 +22,9 @@ LL | print_x(&X); | + help: provide the argument | -LL | print_x(/* &dyn Foo<Item = bool> */, /* &str */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - print_x(X); +LL + print_x(/* &dyn Foo<Item = bool> */, /* &str */); + | error: aborting due to 1 previous error diff --git a/tests/ui/extern/not-in-block.stderr b/tests/ui/extern/not-in-block.stderr index f86c279a234..e35c50343fc 100644 --- a/tests/ui/extern/not-in-block.stderr +++ b/tests/ui/extern/not-in-block.stderr @@ -6,12 +6,13 @@ LL | extern fn none_fn(x: bool) -> i32; | help: provide a definition for the function | -LL | extern fn none_fn(x: bool) -> i32 { <body> } - | ~~~~~~~~~~ +LL - extern fn none_fn(x: bool) -> i32; +LL + extern fn none_fn(x: bool) -> i32 { <body> } + | help: if you meant to declare an externally defined function, use an `extern` block | LL | extern { fn none_fn(x: bool) -> i32; } - | ~~~~~~~~ + + | + + error: free function without a body --> $DIR/not-in-block.rs:6:1 @@ -21,12 +22,13 @@ LL | extern "C" fn c_fn(x: bool) -> i32; | help: provide a definition for the function | -LL | extern "C" fn c_fn(x: bool) -> i32 { <body> } - | ~~~~~~~~~~ +LL - extern "C" fn c_fn(x: bool) -> i32; +LL + extern "C" fn c_fn(x: bool) -> i32 { <body> } + | help: if you meant to declare an externally defined function, use an `extern` block | LL | extern "C" { fn c_fn(x: bool) -> i32; } - | ~~~~~~~~~~~~ + + | + + error: aborting due to 2 previous errors diff --git a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs index f37c5335deb..5386628a8e0 100644 --- a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs @@ -9,43 +9,43 @@ trait Sized { } // feature gate is not used. extern "avr-non-blocking-interrupt" fn fu() {} -//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental +//~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental extern "avr-interrupt" fn f() {} -//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental +//~^ ERROR extern "avr-interrupt" ABI is experimental trait T { extern "avr-interrupt" fn m(); - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-interrupt" ABI is experimental extern "avr-non-blocking-interrupt" fn mu(); - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental extern "avr-interrupt" fn dm() {} - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-interrupt" ABI is experimental extern "avr-non-blocking-interrupt" fn dmu() {} - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental } struct S; impl T for S { extern "avr-interrupt" fn m() {} - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-interrupt" ABI is experimental extern "avr-non-blocking-interrupt" fn mu() {} - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental } impl S { extern "avr-interrupt" fn im() {} - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-interrupt" ABI is experimental extern "avr-non-blocking-interrupt" fn imu() {} - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental } type TA = extern "avr-interrupt" fn(); -//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental +//~^ ERROR extern "avr-interrupt" ABI is experimental type TAU = extern "avr-non-blocking-interrupt" fn(); -//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental +//~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental extern "avr-interrupt" {} -//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental +//~^ ERROR extern "avr-interrupt" ABI is experimental extern "avr-non-blocking-interrupt" {} -//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental +//~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr index c6786699de1..d9f3c3adc7f 100644 --- a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr @@ -1,4 +1,4 @@ -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:11:8 | LL | extern "avr-non-blocking-interrupt" fn fu() {} @@ -8,7 +8,7 @@ LL | extern "avr-non-blocking-interrupt" fn fu() {} = help: add `#![feature(abi_avr_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:13:8 | LL | extern "avr-interrupt" fn f() {} @@ -18,7 +18,7 @@ LL | extern "avr-interrupt" fn f() {} = help: add `#![feature(abi_avr_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:17:12 | LL | extern "avr-interrupt" fn m(); @@ -28,7 +28,7 @@ LL | extern "avr-interrupt" fn m(); = help: add `#![feature(abi_avr_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:19:12 | LL | extern "avr-non-blocking-interrupt" fn mu(); @@ -38,7 +38,7 @@ LL | extern "avr-non-blocking-interrupt" fn mu(); = help: add `#![feature(abi_avr_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:22:12 | LL | extern "avr-interrupt" fn dm() {} @@ -48,7 +48,7 @@ LL | extern "avr-interrupt" fn dm() {} = help: add `#![feature(abi_avr_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:24:12 | LL | extern "avr-non-blocking-interrupt" fn dmu() {} @@ -58,7 +58,7 @@ LL | extern "avr-non-blocking-interrupt" fn dmu() {} = help: add `#![feature(abi_avr_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:30:12 | LL | extern "avr-interrupt" fn m() {} @@ -68,7 +68,7 @@ LL | extern "avr-interrupt" fn m() {} = help: add `#![feature(abi_avr_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:32:12 | LL | extern "avr-non-blocking-interrupt" fn mu() {} @@ -78,7 +78,7 @@ LL | extern "avr-non-blocking-interrupt" fn mu() {} = help: add `#![feature(abi_avr_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:37:12 | LL | extern "avr-interrupt" fn im() {} @@ -88,7 +88,7 @@ LL | extern "avr-interrupt" fn im() {} = help: add `#![feature(abi_avr_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:39:12 | LL | extern "avr-non-blocking-interrupt" fn imu() {} @@ -98,7 +98,7 @@ LL | extern "avr-non-blocking-interrupt" fn imu() {} = help: add `#![feature(abi_avr_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:43:18 | LL | type TA = extern "avr-interrupt" fn(); @@ -108,7 +108,7 @@ LL | type TA = extern "avr-interrupt" fn(); = help: add `#![feature(abi_avr_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:45:19 | LL | type TAU = extern "avr-non-blocking-interrupt" fn(); @@ -118,7 +118,7 @@ LL | type TAU = extern "avr-non-blocking-interrupt" fn(); = help: add `#![feature(abi_avr_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:48:8 | LL | extern "avr-interrupt" {} @@ -128,7 +128,7 @@ LL | extern "avr-interrupt" {} = help: add `#![feature(abi_avr_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:50:8 | LL | extern "avr-non-blocking-interrupt" {} diff --git a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs index b0fb4c414d4..bb69a638cee 100644 --- a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs @@ -6,29 +6,29 @@ trait Sized { } extern "msp430-interrupt" fn f() {} -//~^ ERROR msp430-interrupt ABI is experimental +//~^ ERROR "msp430-interrupt" ABI is experimental trait T { extern "msp430-interrupt" fn m(); - //~^ ERROR msp430-interrupt ABI is experimental + //~^ ERROR "msp430-interrupt" ABI is experimental extern "msp430-interrupt" fn dm() {} - //~^ ERROR msp430-interrupt ABI is experimental + //~^ ERROR "msp430-interrupt" ABI is experimental } struct S; impl T for S { extern "msp430-interrupt" fn m() {} - //~^ ERROR msp430-interrupt ABI is experimental + //~^ ERROR "msp430-interrupt" ABI is experimental } impl S { extern "msp430-interrupt" fn im() {} - //~^ ERROR msp430-interrupt ABI is experimental + //~^ ERROR "msp430-interrupt" ABI is experimental } type TA = extern "msp430-interrupt" fn(); -//~^ ERROR msp430-interrupt ABI is experimental +//~^ ERROR "msp430-interrupt" ABI is experimental extern "msp430-interrupt" {} -//~^ ERROR msp430-interrupt ABI is experimental +//~^ ERROR "msp430-interrupt" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr index 5dacc86dcc5..21ddbf7a86d 100644 --- a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr @@ -1,4 +1,4 @@ -error[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:8:8 | LL | extern "msp430-interrupt" fn f() {} @@ -8,7 +8,7 @@ LL | extern "msp430-interrupt" fn f() {} = help: add `#![feature(abi_msp430_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:12:12 | LL | extern "msp430-interrupt" fn m(); @@ -18,7 +18,7 @@ LL | extern "msp430-interrupt" fn m(); = help: add `#![feature(abi_msp430_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:15:12 | LL | extern "msp430-interrupt" fn dm() {} @@ -28,7 +28,7 @@ LL | extern "msp430-interrupt" fn dm() {} = help: add `#![feature(abi_msp430_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:21:12 | LL | extern "msp430-interrupt" fn m() {} @@ -38,7 +38,7 @@ LL | extern "msp430-interrupt" fn m() {} = help: add `#![feature(abi_msp430_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:26:12 | LL | extern "msp430-interrupt" fn im() {} @@ -48,7 +48,7 @@ LL | extern "msp430-interrupt" fn im() {} = help: add `#![feature(abi_msp430_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:30:18 | LL | type TA = extern "msp430-interrupt" fn(); @@ -58,7 +58,7 @@ LL | type TA = extern "msp430-interrupt" fn(); = help: add `#![feature(abi_msp430_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:33:8 | LL | extern "msp430-interrupt" {} diff --git a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs index 29820f8877d..6f4989fbd9f 100644 --- a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs @@ -9,25 +9,25 @@ trait Sized {} // feature gate is not used. extern "riscv-interrupt-m" fn f() {} -//~^ ERROR riscv-interrupt ABIs are experimental +//~^ ERROR "riscv-interrupt-m" ABI is experimental extern "riscv-interrupt-s" fn f_s() {} -//~^ ERROR riscv-interrupt ABIs are experimental +//~^ ERROR "riscv-interrupt-s" ABI is experimental trait T { extern "riscv-interrupt-m" fn m(); - //~^ ERROR riscv-interrupt ABIs are experimental + //~^ ERROR "riscv-interrupt-m" ABI is experimental } struct S; impl T for S { extern "riscv-interrupt-m" fn m() {} - //~^ ERROR riscv-interrupt ABIs are experimental + //~^ ERROR "riscv-interrupt-m" ABI is experimental } impl S { extern "riscv-interrupt-m" fn im() {} - //~^ ERROR riscv-interrupt ABIs are experimental + //~^ ERROR "riscv-interrupt-m" ABI is experimental } type TA = extern "riscv-interrupt-m" fn(); -//~^ ERROR riscv-interrupt ABIs are experimental +//~^ ERROR "riscv-interrupt-m" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr index 6b7853a320b..3c9e99aa1b9 100644 --- a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr @@ -1,4 +1,4 @@ -error[E0658]: riscv-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change --> $DIR/feature-gate-abi-riscv-interrupt.rs:11:8 | LL | extern "riscv-interrupt-m" fn f() {} @@ -8,7 +8,7 @@ LL | extern "riscv-interrupt-m" fn f() {} = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: riscv-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "riscv-interrupt-s" ABI is experimental and subject to change --> $DIR/feature-gate-abi-riscv-interrupt.rs:13:8 | LL | extern "riscv-interrupt-s" fn f_s() {} @@ -18,7 +18,7 @@ LL | extern "riscv-interrupt-s" fn f_s() {} = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: riscv-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change --> $DIR/feature-gate-abi-riscv-interrupt.rs:17:12 | LL | extern "riscv-interrupt-m" fn m(); @@ -28,7 +28,7 @@ LL | extern "riscv-interrupt-m" fn m(); = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: riscv-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change --> $DIR/feature-gate-abi-riscv-interrupt.rs:23:12 | LL | extern "riscv-interrupt-m" fn m() {} @@ -38,7 +38,7 @@ LL | extern "riscv-interrupt-m" fn m() {} = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: riscv-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change --> $DIR/feature-gate-abi-riscv-interrupt.rs:28:12 | LL | extern "riscv-interrupt-m" fn im() {} @@ -48,7 +48,7 @@ LL | extern "riscv-interrupt-m" fn im() {} = help: add `#![feature(abi_riscv_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: riscv-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change --> $DIR/feature-gate-abi-riscv-interrupt.rs:32:18 | LL | type TA = extern "riscv-interrupt-m" fn(); diff --git a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs index 812ca12c7c3..93c59364f10 100644 --- a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs @@ -5,24 +5,24 @@ #[lang="sized"] trait Sized { } -extern "x86-interrupt" fn f7() {} //~ ERROR x86-interrupt ABI is experimental +extern "x86-interrupt" fn f7() {} //~ 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(); //~ ERROR "x86-interrupt" ABI is experimental + extern "x86-interrupt" fn dm7() {} //~ 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() {} //~ 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() {} //~ ERROR "x86-interrupt" ABI is experimental } -type A7 = extern "x86-interrupt" fn(); //~ ERROR x86-interrupt ABI is experimental +type A7 = extern "x86-interrupt" fn(); //~ ERROR "x86-interrupt" ABI is experimental -extern "x86-interrupt" {} //~ ERROR x86-interrupt ABI is experimental +extern "x86-interrupt" {} //~ 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 860005cac34..231cf207c86 100644 --- a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr @@ -1,4 +1,4 @@ -error[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:8:8 | LL | extern "x86-interrupt" fn f7() {} @@ -8,7 +8,7 @@ LL | extern "x86-interrupt" fn f7() {} = help: add `#![feature(abi_x86_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:10:12 | LL | extern "x86-interrupt" fn m7(); @@ -18,7 +18,7 @@ LL | extern "x86-interrupt" fn m7(); = help: add `#![feature(abi_x86_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:11:12 | LL | extern "x86-interrupt" fn dm7() {} @@ -28,7 +28,7 @@ LL | extern "x86-interrupt" fn dm7() {} = help: add `#![feature(abi_x86_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:18:12 | LL | extern "x86-interrupt" fn m7() {} @@ -38,7 +38,7 @@ LL | extern "x86-interrupt" fn m7() {} = help: add `#![feature(abi_x86_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:23:12 | LL | extern "x86-interrupt" fn im7() {} @@ -48,7 +48,7 @@ LL | extern "x86-interrupt" fn im7() {} = help: add `#![feature(abi_x86_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:26:18 | LL | type A7 = extern "x86-interrupt" fn(); @@ -58,7 +58,7 @@ LL | type A7 = extern "x86-interrupt" fn(); = help: add `#![feature(abi_x86_interrupt)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:28:8 | LL | extern "x86-interrupt" {} diff --git a/tests/ui/feature-gates/feature-gate-abi.rs b/tests/ui/feature-gates/feature-gate-abi.rs index 3aa430e736f..7ab05889c20 100644 --- a/tests/ui/feature-gates/feature-gate-abi.rs +++ b/tests/ui/feature-gates/feature-gate-abi.rs @@ -11,49 +11,49 @@ trait Sized { } trait Tuple { } // Functions -extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to change +extern "rust-intrinsic" fn f1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in -extern "rust-intrinsic" fn f2() {} //~ ERROR intrinsics are subject to change +extern "rust-intrinsic" fn f2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in -extern "rust-call" fn f4(_: ()) {} //~ ERROR rust-call ABI is subject to change +extern "rust-call" fn f4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change // Methods in trait definition trait Tr { - extern "rust-intrinsic" fn m1(); //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" fn m1(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in - extern "rust-intrinsic" fn m2(); //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" fn m2(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in - extern "rust-call" fn m4(_: ()); //~ ERROR rust-call ABI is subject to change + extern "rust-call" fn m4(_: ()); //~ ERROR extern "rust-call" ABI is experimental and subject to change - extern "rust-call" fn dm4(_: ()) {} //~ ERROR rust-call ABI is subject to change + extern "rust-call" fn dm4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change } struct S; // Methods in trait impl impl Tr for S { - extern "rust-intrinsic" fn m1() {} //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" fn m1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in - extern "rust-intrinsic" fn m2() {} //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" fn m2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in - extern "rust-call" fn m4(_: ()) {} //~ ERROR rust-call ABI is subject to change + extern "rust-call" fn m4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change } // Methods in inherent impl impl S { - extern "rust-intrinsic" fn im1() {} //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" fn im1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in - extern "rust-intrinsic" fn im2() {} //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" fn im2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in - extern "rust-call" fn im4(_: ()) {} //~ ERROR rust-call ABI is subject to change + extern "rust-call" fn im4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change } // Function pointer types -type A1 = extern "rust-intrinsic" fn(); //~ ERROR intrinsics are subject to change -type A2 = extern "rust-intrinsic" fn(); //~ ERROR intrinsics are subject to change -type A4 = extern "rust-call" fn(_: ()); //~ ERROR rust-call ABI is subject to change +type A1 = extern "rust-intrinsic" fn(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail +type A2 = extern "rust-intrinsic" fn(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail +type A4 = extern "rust-call" fn(_: ()); //~ ERROR extern "rust-call" ABI is experimental and subject to change // Foreign modules -extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change -extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change -extern "rust-call" {} //~ ERROR rust-call ABI is subject to change +extern "rust-intrinsic" {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail +extern "rust-intrinsic" {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail +extern "rust-call" {} //~ ERROR extern "rust-call" ABI is experimental and subject to change diff --git a/tests/ui/feature-gates/feature-gate-abi.stderr b/tests/ui/feature-gates/feature-gate-abi.stderr index dbdfa7b275d..70ec64e5135 100644 --- a/tests/ui/feature-gates/feature-gate-abi.stderr +++ b/tests/ui/feature-gates/feature-gate-abi.stderr @@ -1,4 +1,4 @@ -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:14:8 | LL | extern "rust-intrinsic" fn f1() {} @@ -7,7 +7,7 @@ LL | extern "rust-intrinsic" fn f1() {} = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:16:8 | LL | extern "rust-intrinsic" fn f2() {} @@ -16,7 +16,7 @@ LL | extern "rust-intrinsic" fn f2() {} = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:18:8 | LL | extern "rust-call" fn f4(_: ()) {} @@ -26,7 +26,7 @@ LL | extern "rust-call" fn f4(_: ()) {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:22:12 | LL | extern "rust-intrinsic" fn m1(); @@ -35,7 +35,7 @@ LL | extern "rust-intrinsic" fn m1(); = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:24:12 | LL | extern "rust-intrinsic" fn m2(); @@ -44,7 +44,7 @@ LL | extern "rust-intrinsic" fn m2(); = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:26:12 | LL | extern "rust-call" fn m4(_: ()); @@ -54,7 +54,7 @@ LL | extern "rust-call" fn m4(_: ()); = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:28:12 | LL | extern "rust-call" fn dm4(_: ()) {} @@ -64,7 +64,7 @@ LL | extern "rust-call" fn dm4(_: ()) {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:35:12 | LL | extern "rust-intrinsic" fn m1() {} @@ -73,7 +73,7 @@ LL | extern "rust-intrinsic" fn m1() {} = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:37:12 | LL | extern "rust-intrinsic" fn m2() {} @@ -82,7 +82,7 @@ LL | extern "rust-intrinsic" fn m2() {} = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:39:12 | LL | extern "rust-call" fn m4(_: ()) {} @@ -92,7 +92,7 @@ LL | extern "rust-call" fn m4(_: ()) {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:44:12 | LL | extern "rust-intrinsic" fn im1() {} @@ -101,7 +101,7 @@ LL | extern "rust-intrinsic" fn im1() {} = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:46:12 | LL | extern "rust-intrinsic" fn im2() {} @@ -110,7 +110,7 @@ LL | extern "rust-intrinsic" fn im2() {} = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:48:12 | LL | extern "rust-call" fn im4(_: ()) {} @@ -120,7 +120,7 @@ LL | extern "rust-call" fn im4(_: ()) {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:52:18 | LL | type A1 = extern "rust-intrinsic" fn(); @@ -129,7 +129,7 @@ LL | type A1 = extern "rust-intrinsic" fn(); = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:53:18 | LL | type A2 = extern "rust-intrinsic" fn(); @@ -138,7 +138,7 @@ LL | type A2 = extern "rust-intrinsic" fn(); = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:54:18 | LL | type A4 = extern "rust-call" fn(_: ()); @@ -148,7 +148,7 @@ LL | type A4 = extern "rust-call" fn(_: ()); = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:57:8 | LL | extern "rust-intrinsic" {} @@ -157,7 +157,7 @@ LL | extern "rust-intrinsic" {} = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:58:8 | LL | extern "rust-intrinsic" {} @@ -166,7 +166,7 @@ LL | extern "rust-intrinsic" {} = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:59:8 | LL | extern "rust-call" {} diff --git a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs index 7d39820f086..fb04906dafe 100644 --- a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs +++ b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs @@ -10,14 +10,14 @@ trait Sized { } trait Tuple { } // Functions -extern "gpu-kernel" fn f1(_: ()) {} //~ ERROR gpu-kernel ABI is experimental and subject to change +extern "gpu-kernel" fn f1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change //~^ ERROR is not a supported ABI // Methods in trait definition trait Tr { - extern "gpu-kernel" fn m1(_: ()); //~ ERROR gpu-kernel ABI is experimental and subject to change + extern "gpu-kernel" fn m1(_: ()); //~ ERROR "gpu-kernel" ABI is experimental and subject to change - extern "gpu-kernel" fn dm1(_: ()) {} //~ ERROR gpu-kernel ABI is experimental and subject to change + extern "gpu-kernel" fn dm1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change //~^ ERROR is not a supported ABI } @@ -25,21 +25,21 @@ struct S; // Methods in trait impl impl Tr for S { - extern "gpu-kernel" fn m1(_: ()) {} //~ ERROR gpu-kernel ABI is experimental and subject to change + extern "gpu-kernel" fn m1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change //~^ ERROR is not a supported ABI } // Methods in inherent impl impl S { - extern "gpu-kernel" fn im1(_: ()) {} //~ ERROR gpu-kernel ABI is experimental and subject to change + extern "gpu-kernel" fn im1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change //~^ ERROR is not a supported ABI } // Function pointer types -type A1 = extern "gpu-kernel" fn(_: ()); //~ ERROR gpu-kernel ABI is experimental and subject to change +type A1 = extern "gpu-kernel" fn(_: ()); //~ ERROR "gpu-kernel" ABI is experimental and subject to change //~^ WARN the calling convention "gpu-kernel" is not supported on this target //~^^ WARN this was previously accepted by the compiler but is being phased out // Foreign modules -extern "gpu-kernel" {} //~ ERROR gpu-kernel ABI is experimental and subject to change +extern "gpu-kernel" {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change //~^ ERROR is not a supported ABI diff --git a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr index 771c49acb97..b05c16e3d9e 100644 --- a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr +++ b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr @@ -1,4 +1,4 @@ -error[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:13:8 | LL | extern "gpu-kernel" fn f1(_: ()) {} @@ -8,7 +8,7 @@ LL | extern "gpu-kernel" fn f1(_: ()) {} = help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:18:12 | LL | extern "gpu-kernel" fn m1(_: ()); @@ -18,7 +18,7 @@ LL | extern "gpu-kernel" fn m1(_: ()); = help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:20:12 | LL | extern "gpu-kernel" fn dm1(_: ()) {} @@ -28,7 +28,7 @@ LL | extern "gpu-kernel" fn dm1(_: ()) {} = help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:28:12 | LL | extern "gpu-kernel" fn m1(_: ()) {} @@ -38,7 +38,7 @@ LL | extern "gpu-kernel" fn m1(_: ()) {} = help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:34:12 | LL | extern "gpu-kernel" fn im1(_: ()) {} @@ -48,7 +48,7 @@ LL | extern "gpu-kernel" fn im1(_: ()) {} = help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:39:18 | LL | type A1 = extern "gpu-kernel" fn(_: ()); @@ -58,7 +58,7 @@ LL | type A1 = extern "gpu-kernel" fn(_: ()); = help: add `#![feature(abi_gpu_kernel)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:44:8 | LL | extern "gpu-kernel" {} diff --git a/tests/ui/feature-gates/feature-gate-abi_ptx.rs b/tests/ui/feature-gates/feature-gate-abi_ptx.rs index 83f48430281..e742492303a 100644 --- a/tests/ui/feature-gates/feature-gate-abi_ptx.rs +++ b/tests/ui/feature-gates/feature-gate-abi_ptx.rs @@ -5,22 +5,22 @@ #[lang="sized"] trait Sized { } -extern "ptx-kernel" fn fu() {} //~ ERROR PTX ABIs are experimental +extern "ptx-kernel" fn fu() {} //~ ERROR extern "ptx-kernel" ABI is experimental trait T { - extern "ptx-kernel" fn mu(); //~ ERROR PTX ABIs are experimental - extern "ptx-kernel" fn dmu() {} //~ ERROR PTX ABIs are experimental + extern "ptx-kernel" fn mu(); //~ ERROR extern "ptx-kernel" ABI is experimental + extern "ptx-kernel" fn dmu() {} //~ ERROR extern "ptx-kernel" ABI is experimental } struct S; impl T for S { - extern "ptx-kernel" fn mu() {} //~ ERROR PTX ABIs are experimental + extern "ptx-kernel" fn mu() {} //~ ERROR extern "ptx-kernel" ABI is experimental } impl S { - extern "ptx-kernel" fn imu() {} //~ ERROR PTX ABIs are experimental + extern "ptx-kernel" fn imu() {} //~ ERROR extern "ptx-kernel" ABI is experimental } -type TAU = extern "ptx-kernel" fn(); //~ ERROR PTX ABIs are experimental +type TAU = extern "ptx-kernel" fn(); //~ ERROR extern "ptx-kernel" ABI is experimental -extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental +extern "ptx-kernel" {} //~ ERROR extern "ptx-kernel" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-abi_ptx.stderr b/tests/ui/feature-gates/feature-gate-abi_ptx.stderr index 22b493e577d..d128075919b 100644 --- a/tests/ui/feature-gates/feature-gate-abi_ptx.stderr +++ b/tests/ui/feature-gates/feature-gate-abi_ptx.stderr @@ -1,4 +1,4 @@ -error[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:8:8 | LL | extern "ptx-kernel" fn fu() {} @@ -8,7 +8,7 @@ LL | extern "ptx-kernel" fn fu() {} = help: add `#![feature(abi_ptx)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:11:12 | LL | extern "ptx-kernel" fn mu(); @@ -18,7 +18,7 @@ LL | extern "ptx-kernel" fn mu(); = help: add `#![feature(abi_ptx)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:12:12 | LL | extern "ptx-kernel" fn dmu() {} @@ -28,7 +28,7 @@ LL | extern "ptx-kernel" fn dmu() {} = help: add `#![feature(abi_ptx)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:17:12 | LL | extern "ptx-kernel" fn mu() {} @@ -38,7 +38,7 @@ LL | extern "ptx-kernel" fn mu() {} = help: add `#![feature(abi_ptx)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:21:12 | LL | extern "ptx-kernel" fn imu() {} @@ -48,7 +48,7 @@ LL | extern "ptx-kernel" fn imu() {} = help: add `#![feature(abi_ptx)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:24:19 | LL | type TAU = extern "ptx-kernel" fn(); @@ -58,7 +58,7 @@ LL | type TAU = extern "ptx-kernel" fn(); = help: add `#![feature(abi_ptx)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:26:8 | LL | extern "ptx-kernel" {} diff --git a/tests/ui/feature-gates/feature-gate-abi_unadjusted.rs b/tests/ui/feature-gates/feature-gate-abi_unadjusted.rs index 35a7d73288b..1dc6adc0e14 100644 --- a/tests/ui/feature-gates/feature-gate-abi_unadjusted.rs +++ b/tests/ui/feature-gates/feature-gate-abi_unadjusted.rs @@ -1,5 +1,5 @@ extern "unadjusted" fn foo() { -//~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable +//~^ ERROR: "unadjusted" ABI is an implementation detail and perma-unstable } fn main() { diff --git a/tests/ui/feature-gates/feature-gate-abi_unadjusted.stderr b/tests/ui/feature-gates/feature-gate-abi_unadjusted.stderr index 1d5fb11cd3d..462fb79d557 100644 --- a/tests/ui/feature-gates/feature-gate-abi_unadjusted.stderr +++ b/tests/ui/feature-gates/feature-gate-abi_unadjusted.stderr @@ -1,4 +1,4 @@ -error[E0658]: unadjusted ABI is an implementation detail and perma-unstable +error[E0658]: the extern "unadjusted" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi_unadjusted.rs:1:8 | LL | extern "unadjusted" fn foo() { diff --git a/tests/ui/feature-gates/feature-gate-async-fn-in-dyn-trait.stderr b/tests/ui/feature-gates/feature-gate-async-fn-in-dyn-trait.stderr index b4de6b66469..ab8c092a826 100644 --- a/tests/ui/feature-gates/feature-gate-async-fn-in-dyn-trait.stderr +++ b/tests/ui/feature-gates/feature-gate-async-fn-in-dyn-trait.stderr @@ -5,7 +5,7 @@ LL | async fn takes_dyn_trait(x: &dyn Foo) { | ^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/feature-gate-async-fn-in-dyn-trait.rs:4:14 | LL | trait Foo { @@ -21,7 +21,7 @@ LL | x.bar().await; | ^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/feature-gate-async-fn-in-dyn-trait.rs:4:14 | LL | trait Foo { @@ -37,7 +37,7 @@ LL | x.bar().await; | ^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/feature-gate-async-fn-in-dyn-trait.rs:4:14 | LL | trait Foo { diff --git a/tests/ui/feature-gates/feature-gate-cfg-contract-checks.rs b/tests/ui/feature-gates/feature-gate-cfg-contract-checks.rs new file mode 100644 index 00000000000..cd9bf12b5e7 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-cfg-contract-checks.rs @@ -0,0 +1,5 @@ +#![crate_type = "lib"] + +pub fn contract_checks_are_enabled() -> bool { + cfg!(contract_checks) //~ ERROR `cfg(contract_checks)` is experimental +} diff --git a/tests/ui/feature-gates/feature-gate-cfg-contract-checks.stderr b/tests/ui/feature-gates/feature-gate-cfg-contract-checks.stderr new file mode 100644 index 00000000000..89c6d077f97 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-cfg-contract-checks.stderr @@ -0,0 +1,13 @@ +error[E0658]: `cfg(contract_checks)` is experimental and subject to change + --> $DIR/feature-gate-cfg-contract-checks.rs:4:10 + | +LL | cfg!(contract_checks) + | ^^^^^^^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = help: add `#![feature(cfg_contract_checks)]` 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-cfg-target-thread-local.rs b/tests/ui/feature-gates/feature-gate-cfg-target-thread-local.rs index 3ab5a500dfd..131a10ea03b 100644 --- a/tests/ui/feature-gates/feature-gate-cfg-target-thread-local.rs +++ b/tests/ui/feature-gates/feature-gate-cfg-target-thread-local.rs @@ -1,4 +1,4 @@ -//@ ignore-windows +//@ ignore-windows FIXME(134939): thread_local + no_mangle doesn't work on Windows //@ aux-build:cfg-target-thread-local.rs #![feature(thread_local)] diff --git a/tests/ui/feature-gates/feature-gate-contracts.rs b/tests/ui/feature-gates/feature-gate-contracts.rs new file mode 100644 index 00000000000..1759d23077b --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-contracts.rs @@ -0,0 +1,9 @@ +#![crate_type = "lib"] + +#[core::contracts::requires(x > 0)] +pub fn requires_needs_it(x: i32) { } +//~^^ ERROR use of unstable library feature `contracts` + +#[core::contracts::ensures(|ret| *ret > 0)] +pub fn ensures_needs_it() -> i32 { 10 } +//~^^ ERROR use of unstable library feature `contracts` diff --git a/tests/ui/feature-gates/feature-gate-contracts.stderr b/tests/ui/feature-gates/feature-gate-contracts.stderr new file mode 100644 index 00000000000..4b0f7150973 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-contracts.stderr @@ -0,0 +1,23 @@ +error[E0658]: use of unstable library feature `contracts` + --> $DIR/feature-gate-contracts.rs:3:3 + | +LL | #[core::contracts::requires(x > 0)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = help: add `#![feature(contracts)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: use of unstable library feature `contracts` + --> $DIR/feature-gate-contracts.rs:7:3 + | +LL | #[core::contracts::ensures(|ret| *ret > 0)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information + = help: add `#![feature(contracts)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr index f8fc086c441..6634ce12118 100644 --- a/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr +++ b/tests/ui/feature-gates/feature-gate-dispatch-from-dyn-missing-impl.stderr @@ -8,7 +8,7 @@ LL | Ptr(Box::new(4)) as Ptr<dyn Trait>; | ^^^^^^^^^^^^^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:25:18 | LL | trait Trait { @@ -27,7 +27,7 @@ LL | Ptr(Box::new(4)) as Ptr<dyn Trait>; | ^^^^^^^^^^^^^^^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/feature-gate-dispatch-from-dyn-missing-impl.rs:25:18 | LL | trait Trait { diff --git a/tests/ui/feature-gates/feature-gate-dyn_compatible_for_dispatch.stderr b/tests/ui/feature-gates/feature-gate-dyn_compatible_for_dispatch.stderr index 10540f0219d..2c3edd6e6a5 100644 --- a/tests/ui/feature-gates/feature-gate-dyn_compatible_for_dispatch.stderr +++ b/tests/ui/feature-gates/feature-gate-dyn_compatible_for_dispatch.stderr @@ -5,7 +5,7 @@ LL | fn takes_dyn_incompatible_ref<T>(obj: &dyn DynIncompatible1) { | ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible1` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:4:25 | LL | trait DynIncompatible1: Sized {} @@ -20,7 +20,7 @@ LL | fn return_dyn_incompatible_ref() -> &'static dyn DynIncompatible2 { | ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible2` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:7:8 | LL | trait DynIncompatible2 { @@ -43,7 +43,7 @@ LL | fn takes_dyn_incompatible_box(obj: Box<dyn DynIncompatible3>) { | ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible3` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:11:8 | LL | trait DynIncompatible3 { @@ -59,7 +59,7 @@ LL | fn return_dyn_incompatible_rc() -> std::rc::Rc<dyn DynIncompatible4> { | ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible4` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:15:22 | LL | trait DynIncompatible4 { @@ -75,7 +75,7 @@ LL | impl Trait for dyn DynIncompatible1 {} | ^^^^^^^^^^^^^^^^^^^^ `DynIncompatible1` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/feature-gate-dyn_compatible_for_dispatch.rs:4:25 | LL | trait DynIncompatible1: Sized {} diff --git a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr index 0234480ac5a..2f5e3650734 100644 --- a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr +++ b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr @@ -15,8 +15,9 @@ LL | let _: u8 = ::core::default::Default(); | help: try using `std` instead of `core` | -LL | let _: u8 = ::std::default::Default(); - | ~~~ +LL - let _: u8 = ::core::default::Default(); +LL + let _: u8 = ::std::default::Default(); + | help: consider importing this module | LL + use std::default; diff --git a/tests/ui/feature-gates/feature-gate-extern_system_varargs.rs b/tests/ui/feature-gates/feature-gate-extern_system_varargs.rs new file mode 100644 index 00000000000..f5cfbe72ca8 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-extern_system_varargs.rs @@ -0,0 +1,7 @@ +fn system(f: extern "system" fn(usize, ...)) { + //~^ ERROR using calling conventions other than `C` or `cdecl` for varargs functions is unstable + + f(22, 44); +} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-extern_system_varargs.stderr b/tests/ui/feature-gates/feature-gate-extern_system_varargs.stderr new file mode 100644 index 00000000000..f3206b25264 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-extern_system_varargs.stderr @@ -0,0 +1,13 @@ +error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable + --> $DIR/feature-gate-extern_system_varargs.rs:1:14 + | +LL | fn system(f: extern "system" fn(usize, ...)) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #136946 <https://github.com/rust-lang/rust/issues/136946> for more information + = help: add `#![feature(extern_system_varargs)]` 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-fn_align.rs b/tests/ui/feature-gates/feature-gate-fn_align.rs index ea873dba269..06784a45d76 100644 --- a/tests/ui/feature-gates/feature-gate-fn_align.rs +++ b/tests/ui/feature-gates/feature-gate-fn_align.rs @@ -2,3 +2,8 @@ #[repr(align(16))] //~ ERROR `repr(align)` attributes on functions are unstable fn requires_alignment() {} + +trait MyTrait { + #[repr(align)] //~ ERROR `repr(align)` attributes on functions are unstable + fn myfun(); +} diff --git a/tests/ui/feature-gates/feature-gate-fn_align.stderr b/tests/ui/feature-gates/feature-gate-fn_align.stderr index eec332792b7..cd9900c6051 100644 --- a/tests/ui/feature-gates/feature-gate-fn_align.stderr +++ b/tests/ui/feature-gates/feature-gate-fn_align.stderr @@ -8,6 +8,16 @@ LL | #[repr(align(16))] = help: add `#![feature(fn_align)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 1 previous error +error[E0658]: `repr(align)` attributes on functions are unstable + --> $DIR/feature-gate-fn_align.rs:7:12 + | +LL | #[repr(align)] + | ^^^^^ + | + = note: see issue #82232 <https://github.com/rust-lang/rust/issues/82232> for more information + = help: add `#![feature(fn_align)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-intrinsics.rs b/tests/ui/feature-gates/feature-gate-intrinsics.rs index e0dc3cc579d..65806a0223e 100644 --- a/tests/ui/feature-gates/feature-gate-intrinsics.rs +++ b/tests/ui/feature-gates/feature-gate-intrinsics.rs @@ -1,8 +1,8 @@ -extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change +extern "rust-intrinsic" { //~ ERROR "rust-intrinsic" ABI is an implementation detail fn bar(); //~ ERROR unrecognized intrinsic function: `bar` } -extern "rust-intrinsic" fn baz() {} //~ ERROR intrinsics are subject to change +extern "rust-intrinsic" fn baz() {} //~ ERROR "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-intrinsics.stderr b/tests/ui/feature-gates/feature-gate-intrinsics.stderr index 577a620e2d2..97246f05258 100644 --- a/tests/ui/feature-gates/feature-gate-intrinsics.stderr +++ b/tests/ui/feature-gates/feature-gate-intrinsics.stderr @@ -1,4 +1,4 @@ -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-intrinsics.rs:1:8 | LL | extern "rust-intrinsic" { @@ -7,7 +7,7 @@ LL | extern "rust-intrinsic" { = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-intrinsics.rs:5:8 | LL | extern "rust-intrinsic" fn baz() {} diff --git a/tests/ui/feature-gates/feature-gate-keylocker_x86.rs b/tests/ui/feature-gates/feature-gate-keylocker_x86.rs new file mode 100644 index 00000000000..cef80ad41a8 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-keylocker_x86.rs @@ -0,0 +1,6 @@ +//@ only-x86_64 +#[target_feature(enable = "kl")] +//~^ ERROR: currently unstable +unsafe fn foo() {} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-keylocker_x86.stderr b/tests/ui/feature-gates/feature-gate-keylocker_x86.stderr new file mode 100644 index 00000000000..ed814d3a3ce --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-keylocker_x86.stderr @@ -0,0 +1,13 @@ +error[E0658]: the target feature `kl` is currently unstable + --> $DIR/feature-gate-keylocker_x86.rs:2:18 + | +LL | #[target_feature(enable = "kl")] + | ^^^^^^^^^^^^^ + | + = note: see issue #134813 <https://github.com/rust-lang/rust/issues/134813> for more information + = help: add `#![feature(keylocker_x86)]` 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-more-maybe-bounds.rs b/tests/ui/feature-gates/feature-gate-more-maybe-bounds.rs index debe143b091..6a832744e3e 100644 --- a/tests/ui/feature-gates/feature-gate-more-maybe-bounds.rs +++ b/tests/ui/feature-gates/feature-gate-more-maybe-bounds.rs @@ -11,14 +11,14 @@ fn foo(_: Box<dyn Trait1 + ?Trait2>) {} //~^ ERROR `?Trait` is not permitted in trait object types fn bar<T: ?Trait1 + ?Trait2>(_: T) {} //~^ ERROR type parameter has more than one relaxed default bound, only one is supported -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default trait Trait {} // Do not suggest `#![feature(more_maybe_bounds)]` for repetitions fn baz<T: ?Trait + ?Trait>(_ : T) {} //~^ ERROR type parameter has more than one relaxed default bound, only one is supported -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-more-maybe-bounds.stderr b/tests/ui/feature-gates/feature-gate-more-maybe-bounds.stderr index e6d65e05997..729df4eb37c 100644 --- a/tests/ui/feature-gates/feature-gate-more-maybe-bounds.stderr +++ b/tests/ui/feature-gates/feature-gate-more-maybe-bounds.stderr @@ -35,13 +35,13 @@ LL | fn bar<T: ?Trait1 + ?Trait2>(_: T) {} = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/feature-gate-more-maybe-bounds.rs:12:11 | LL | fn bar<T: ?Trait1 + ?Trait2>(_: T) {} | ^^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/feature-gate-more-maybe-bounds.rs:12:21 | LL | fn bar<T: ?Trait1 + ?Trait2>(_: T) {} @@ -53,19 +53,19 @@ error[E0203]: type parameter has more than one relaxed default bound, only one i LL | fn baz<T: ?Trait + ?Trait>(_ : T) {} | ^^^^^^ ^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/feature-gate-more-maybe-bounds.rs:19:11 | LL | fn baz<T: ?Trait + ?Trait>(_ : T) {} | ^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/feature-gate-more-maybe-bounds.rs:19:20 | LL | fn baz<T: ?Trait + ?Trait>(_ : T) {} | ^^^^^^ -error: aborting due to 5 previous errors; 4 warnings emitted +error: aborting due to 9 previous errors Some errors have detailed explanations: E0203, E0658. For more information about an error, try `rustc --explain E0203`. diff --git a/tests/ui/feature-gates/feature-gate-negate-unsigned.stderr b/tests/ui/feature-gates/feature-gate-negate-unsigned.stderr index 696326157ce..a6e0e668261 100644 --- a/tests/ui/feature-gates/feature-gate-negate-unsigned.stderr +++ b/tests/ui/feature-gates/feature-gate-negate-unsigned.stderr @@ -7,8 +7,9 @@ LL | let _max: usize = -1; = note: unsigned values cannot be negated help: you may have meant the maximum value of `usize` | -LL | let _max: usize = usize::MAX; - | ~~~~~~~~~~ +LL - let _max: usize = -1; +LL + let _max: usize = usize::MAX; + | error[E0600]: cannot apply unary operator `-` to type `u8` --> $DIR/feature-gate-negate-unsigned.rs:14:14 diff --git a/tests/ui/feature-gates/feature-gate-never_patterns.stderr b/tests/ui/feature-gates/feature-gate-never_patterns.stderr index 9f94e962035..dcd5db56da8 100644 --- a/tests/ui/feature-gates/feature-gate-never_patterns.stderr +++ b/tests/ui/feature-gates/feature-gate-never_patterns.stderr @@ -10,7 +10,8 @@ LL | (Some(_),) | + + help: ...or a vertical bar to match on multiple alternatives | -LL | Some(_) | +LL - Some(_), +LL + Some(_) | | error[E0658]: `!` patterns are experimental diff --git a/tests/ui/feature-gates/feature-gate-new_range.rs b/tests/ui/feature-gates/feature-gate-new_range.rs new file mode 100644 index 00000000000..ecb73546d6a --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-new_range.rs @@ -0,0 +1,10 @@ +#![feature(new_range_api)] + +fn main() { + let a: core::range::RangeFrom<u8> = 1..; + //~^ mismatched types + let b: core::range::Range<u8> = 2..3; + //~^ mismatched types + let c: core::range::RangeInclusive<u8> = 4..=5; + //~^ mismatched types +} diff --git a/tests/ui/feature-gates/feature-gate-new_range.stderr b/tests/ui/feature-gates/feature-gate-new_range.stderr new file mode 100644 index 00000000000..c4241390418 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-new_range.stderr @@ -0,0 +1,48 @@ +error[E0308]: mismatched types + --> $DIR/feature-gate-new_range.rs:4:41 + | +LL | let a: core::range::RangeFrom<u8> = 1..; + | -------------------------- ^^^ expected `RangeFrom<u8>`, found `RangeFrom<{integer}>` + | | + | expected due to this + | + = note: expected struct `std::range::RangeFrom<u8>` + found struct `std::ops::RangeFrom<{integer}>` +help: call `Into::into` on this expression to convert `std::ops::RangeFrom<{integer}>` into `std::range::RangeFrom<u8>` + | +LL | let a: core::range::RangeFrom<u8> = 1...into(); + | +++++++ + +error[E0308]: mismatched types + --> $DIR/feature-gate-new_range.rs:6:37 + | +LL | let b: core::range::Range<u8> = 2..3; + | ---------------------- ^^^^ expected `Range<u8>`, found `Range<{integer}>` + | | + | expected due to this + | + = note: expected struct `std::range::Range<u8>` + found struct `std::ops::Range<{integer}>` +help: call `Into::into` on this expression to convert `std::ops::Range<{integer}>` into `std::range::Range<u8>` + | +LL | let b: core::range::Range<u8> = 2..3.into(); + | +++++++ + +error[E0308]: mismatched types + --> $DIR/feature-gate-new_range.rs:8:46 + | +LL | let c: core::range::RangeInclusive<u8> = 4..=5; + | ------------------------------- ^^^^^ expected `RangeInclusive<u8>`, found `RangeInclusive<{integer}>` + | | + | expected due to this + | + = note: expected struct `std::range::RangeInclusive<u8>` + found struct `std::ops::RangeInclusive<{integer}>` +help: call `Into::into` on this expression to convert `std::ops::RangeInclusive<{integer}>` into `std::range::RangeInclusive<u8>` + | +LL | let c: core::range::RangeInclusive<u8> = 4..=5.into(); + | +++++++ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.rs b/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.rs new file mode 100644 index 00000000000..d1f6f4755f0 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.rs @@ -0,0 +1,6 @@ +// check that `pattern_complexity_limit` is feature-gated + +#![pattern_complexity_limit = "42"] +//~^ ERROR: the `#[pattern_complexity_limit]` attribute is just used for rustc unit tests + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-pattern-complexity.stderr b/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.stderr index c05e6abb017..e6f17710e09 100644 --- a/tests/ui/feature-gates/feature-gate-pattern-complexity.stderr +++ b/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.stderr @@ -1,8 +1,8 @@ -error[E0658]: the `#[pattern_complexity]` attribute is just used for rustc unit tests and will never be stable - --> $DIR/feature-gate-pattern-complexity.rs:3:1 +error[E0658]: the `#[pattern_complexity_limit]` attribute is just used for rustc unit tests and will never be stable + --> $DIR/feature-gate-pattern-complexity-limit.rs:3:1 | -LL | #![pattern_complexity = "42"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![pattern_complexity_limit = "42"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date diff --git a/tests/ui/feature-gates/feature-gate-pattern-complexity.rs b/tests/ui/feature-gates/feature-gate-pattern-complexity.rs deleted file mode 100644 index 43e9a00c9a7..00000000000 --- a/tests/ui/feature-gates/feature-gate-pattern-complexity.rs +++ /dev/null @@ -1,6 +0,0 @@ -// check that `pattern_complexity` is feature-gated - -#![pattern_complexity = "42"] -//~^ ERROR: the `#[pattern_complexity]` attribute is just used for rustc unit tests - -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-rust_cold_cc.rs b/tests/ui/feature-gates/feature-gate-rust_cold_cc.rs index 9ba8e32ac07..4f47eb55b39 100644 --- a/tests/ui/feature-gates/feature-gate-rust_cold_cc.rs +++ b/tests/ui/feature-gates/feature-gate-rust_cold_cc.rs @@ -1,21 +1,21 @@ #![crate_type = "lib"] -extern "rust-cold" fn fu() {} //~ ERROR rust-cold is experimental +extern "rust-cold" fn fu() {} //~ ERROR "rust-cold" ABI is experimental trait T { - extern "rust-cold" fn mu(); //~ ERROR rust-cold is experimental - extern "rust-cold" fn dmu() {} //~ ERROR rust-cold is experimental + extern "rust-cold" fn mu(); //~ ERROR "rust-cold" ABI is experimental + extern "rust-cold" fn dmu() {} //~ ERROR "rust-cold" ABI is experimental } struct S; impl T for S { - extern "rust-cold" fn mu() {} //~ ERROR rust-cold is experimental + extern "rust-cold" fn mu() {} //~ ERROR "rust-cold" ABI is experimental } impl S { - extern "rust-cold" fn imu() {} //~ ERROR rust-cold is experimental + extern "rust-cold" fn imu() {} //~ ERROR "rust-cold" ABI is experimental } -type TAU = extern "rust-cold" fn(); //~ ERROR rust-cold is experimental +type TAU = extern "rust-cold" fn(); //~ ERROR "rust-cold" ABI is experimental -extern "rust-cold" {} //~ ERROR rust-cold is experimental +extern "rust-cold" {} //~ ERROR "rust-cold" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-rust_cold_cc.stderr b/tests/ui/feature-gates/feature-gate-rust_cold_cc.stderr index eeff9534d52..9547c64f2b2 100644 --- a/tests/ui/feature-gates/feature-gate-rust_cold_cc.stderr +++ b/tests/ui/feature-gates/feature-gate-rust_cold_cc.stderr @@ -1,4 +1,4 @@ -error[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:3:8 | LL | extern "rust-cold" fn fu() {} @@ -8,7 +8,7 @@ LL | extern "rust-cold" fn fu() {} = help: add `#![feature(rust_cold_cc)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:6:12 | LL | extern "rust-cold" fn mu(); @@ -18,7 +18,7 @@ LL | extern "rust-cold" fn mu(); = help: add `#![feature(rust_cold_cc)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:7:12 | LL | extern "rust-cold" fn dmu() {} @@ -28,7 +28,7 @@ LL | extern "rust-cold" fn dmu() {} = help: add `#![feature(rust_cold_cc)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:12:12 | LL | extern "rust-cold" fn mu() {} @@ -38,7 +38,7 @@ LL | extern "rust-cold" fn mu() {} = help: add `#![feature(rust_cold_cc)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:16:12 | LL | extern "rust-cold" fn imu() {} @@ -48,7 +48,7 @@ LL | extern "rust-cold" fn imu() {} = help: add `#![feature(rust_cold_cc)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:19:19 | LL | type TAU = extern "rust-cold" fn(); @@ -58,7 +58,7 @@ LL | type TAU = extern "rust-cold" fn(); = help: add `#![feature(rust_cold_cc)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:21:8 | LL | extern "rust-cold" {} diff --git a/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.rs b/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.rs deleted file mode 100644 index 71caf43806d..00000000000 --- a/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![crate_type = "lib"] - -// This isn't intended to compile, so it's easiest to just ignore this error. -extern crate rustc_serialize; //~ERROR can't find crate for `rustc_serialize` - -#[derive( - RustcEncodable, - //~^ ERROR use of unstable library feature `rustc_encodable_decodable` - //~^^ WARNING this was previously accepted by the compiler - //~^^^ WARNING use of deprecated macro `RustcEncodable` - RustcDecodable, - //~^ ERROR use of unstable library feature `rustc_encodable_decodable` - //~^^ WARNING this was previously accepted by the compiler - //~^^^ WARNING use of deprecated macro `RustcDecodable` -)] -struct S; diff --git a/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.stderr b/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.stderr deleted file mode 100644 index b949dbb9da2..00000000000 --- a/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.stderr +++ /dev/null @@ -1,66 +0,0 @@ -error[E0463]: can't find crate for `rustc_serialize` - --> $DIR/feature-gate-rustc_encodable_decodable.rs:4:1 - | -LL | extern crate rustc_serialize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate - | - = help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview` - -error: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code - --> $DIR/feature-gate-rustc_encodable_decodable.rs:7:5 - | -LL | RustcEncodable, - | ^^^^^^^^^^^^^^ - | - = 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 #64266 <https://github.com/rust-lang/rust/issues/64266> - = note: `#[deny(soft_unstable)]` on by default - -warning: use of deprecated macro `RustcEncodable`: rustc-serialize is deprecated and no longer supported - --> $DIR/feature-gate-rustc_encodable_decodable.rs:7:5 - | -LL | RustcEncodable, - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(deprecated)]` on by default - -error: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code - --> $DIR/feature-gate-rustc_encodable_decodable.rs:11:5 - | -LL | RustcDecodable, - | ^^^^^^^^^^^^^^ - | - = 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 #64266 <https://github.com/rust-lang/rust/issues/64266> - -warning: use of deprecated macro `RustcDecodable`: rustc-serialize is deprecated and no longer supported - --> $DIR/feature-gate-rustc_encodable_decodable.rs:11:5 - | -LL | RustcDecodable, - | ^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors; 2 warnings emitted - -For more information about this error, try `rustc --explain E0463`. -Future incompatibility report: Future breakage diagnostic: -error: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code - --> $DIR/feature-gate-rustc_encodable_decodable.rs:7:5 - | -LL | RustcEncodable, - | ^^^^^^^^^^^^^^ - | - = 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 #64266 <https://github.com/rust-lang/rust/issues/64266> - = note: `#[deny(soft_unstable)]` on by default - -Future breakage diagnostic: -error: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code - --> $DIR/feature-gate-rustc_encodable_decodable.rs:11:5 - | -LL | RustcDecodable, - | ^^^^^^^^^^^^^^ - | - = 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 #64266 <https://github.com/rust-lang/rust/issues/64266> - = note: `#[deny(soft_unstable)]` on by default - diff --git a/tests/ui/feature-gates/feature-gate-supertrait-item-shadowing.rs b/tests/ui/feature-gates/feature-gate-supertrait-item-shadowing.rs new file mode 100644 index 00000000000..218d2eefeaf --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-supertrait-item-shadowing.rs @@ -0,0 +1,22 @@ +trait Sup { + fn method(&self) {} +} + +trait Trait: Sup { + fn method(&self) {} +} + +impl Sup for i32 {} +impl Trait for i32 {} + +fn poly<T: Trait>(x: T) { + x.method(); + //~^ ERROR multiple applicable items in scope +} + +fn concrete() { + 1.method(); + //~^ ERROR multiple applicable items in scope +} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-supertrait-item-shadowing.stderr b/tests/ui/feature-gates/feature-gate-supertrait-item-shadowing.stderr new file mode 100644 index 00000000000..5669073f4ab --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-supertrait-item-shadowing.stderr @@ -0,0 +1,57 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/feature-gate-supertrait-item-shadowing.rs:13:7 + | +LL | x.method(); + | ^^^^^^ multiple `method` found + | +note: candidate #1 is defined in the trait `Sup` + --> $DIR/feature-gate-supertrait-item-shadowing.rs:2:5 + | +LL | fn method(&self) {} + | ^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in the trait `Trait` + --> $DIR/feature-gate-supertrait-item-shadowing.rs:6:5 + | +LL | fn method(&self) {} + | ^^^^^^^^^^^^^^^^ +help: disambiguate the method for candidate #1 + | +LL - x.method(); +LL + Sup::method(&x); + | +help: disambiguate the method for candidate #2 + | +LL - x.method(); +LL + Trait::method(&x); + | + +error[E0034]: multiple applicable items in scope + --> $DIR/feature-gate-supertrait-item-shadowing.rs:18:7 + | +LL | 1.method(); + | ^^^^^^ multiple `method` found + | +note: candidate #1 is defined in an impl of the trait `Sup` for the type `i32` + --> $DIR/feature-gate-supertrait-item-shadowing.rs:2:5 + | +LL | fn method(&self) {} + | ^^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl of the trait `Trait` for the type `i32` + --> $DIR/feature-gate-supertrait-item-shadowing.rs:6:5 + | +LL | fn method(&self) {} + | ^^^^^^^^^^^^^^^^ +help: disambiguate the method for candidate #1 + | +LL - 1.method(); +LL + Sup::method(&1); + | +help: disambiguate the method for candidate #2 + | +LL - 1.method(); +LL + Trait::method(&1); + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/feature-gates/feature-gate-trait_upcasting.rs b/tests/ui/feature-gates/feature-gate-trait_upcasting.rs deleted file mode 100644 index e4102f1cfa7..00000000000 --- a/tests/ui/feature-gates/feature-gate-trait_upcasting.rs +++ /dev/null @@ -1,13 +0,0 @@ -trait Foo {} - -trait Bar: Foo {} - -impl Foo for () {} - -impl Bar for () {} - -fn main() { - let bar: &dyn Bar = &(); - let foo: &dyn Foo = bar; - //~^ ERROR trait upcasting coercion is experimental [E0658] -} diff --git a/tests/ui/feature-gates/feature-gate-trait_upcasting.stderr b/tests/ui/feature-gates/feature-gate-trait_upcasting.stderr deleted file mode 100644 index 6fd277ae8cc..00000000000 --- a/tests/ui/feature-gates/feature-gate-trait_upcasting.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0658]: cannot cast `dyn Bar` to `dyn Foo`, trait upcasting coercion is experimental - --> $DIR/feature-gate-trait_upcasting.rs:11:25 - | -LL | let foo: &dyn Foo = bar; - | ^^^ - | - = note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information - = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = note: required when coercing `&dyn Bar` into `&dyn Foo` - -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-unboxed-closures-manual-impls.rs b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs index ff528274c59..7b40c8760e3 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs @@ -11,7 +11,7 @@ impl Fn<()> for Foo { //~| ERROR manual implementations of `Fn` are experimental //~| ERROR expected a `FnMut()` closure, found `Foo` extern "rust-call" fn call(self, args: ()) -> () {} - //~^ ERROR rust-call ABI is subject to change + //~^ ERROR "rust-call" ABI is experimental and subject to change //~| ERROR `call` has an incompatible type for trait } struct Foo1; @@ -20,7 +20,7 @@ impl FnOnce() for Foo1 { //~| ERROR manual implementations of `FnOnce` are experimental //~| ERROR not all trait items implemented extern "rust-call" fn call_once(self, args: ()) -> () {} - //~^ ERROR rust-call ABI is subject to change + //~^ ERROR "rust-call" ABI is experimental and subject to change } struct Bar; impl FnMut<()> for Bar { @@ -28,7 +28,7 @@ impl FnMut<()> for Bar { //~| ERROR manual implementations of `FnMut` are experimental //~| ERROR expected a `FnOnce()` closure, found `Bar` extern "rust-call" fn call_mut(&self, args: ()) -> () {} - //~^ ERROR rust-call ABI is subject to change + //~^ ERROR "rust-call" ABI is experimental and subject to change //~| ERROR incompatible type for trait } struct Baz; @@ -37,7 +37,7 @@ impl FnOnce<()> for Baz { //~| ERROR manual implementations of `FnOnce` are experimental //~| ERROR not all trait items implemented extern "rust-call" fn call_once(&self, args: ()) -> () {} - //~^ ERROR rust-call ABI is subject to change + //~^ ERROR "rust-call" ABI is experimental and subject to change } fn main() {} 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 584724dfe59..214725b77c0 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 @@ -1,4 +1,4 @@ -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:13:12 | LL | extern "rust-call" fn call(self, args: ()) -> () {} @@ -8,7 +8,7 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:22:12 | LL | extern "rust-call" fn call_once(self, args: ()) -> () {} @@ -18,7 +18,7 @@ LL | extern "rust-call" fn call_once(self, args: ()) -> () {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:30:12 | LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {} @@ -28,7 +28,7 @@ LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:39:12 | LL | extern "rust-call" fn call_once(&self, args: ()) -> () {} @@ -96,7 +96,7 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {} help: change the self-receiver type to match the trait | LL | extern "rust-call" fn call(&self, args: ()) -> () {} - | ~~~~~ + | + error[E0183]: manual implementations of `FnOnce` are experimental --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 @@ -165,8 +165,9 @@ LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {} found signature `extern "rust-call" fn(&Bar, ()) -> ()` help: change the self-receiver type to match the trait | -LL | extern "rust-call" fn call_mut(&mut self, args: ()) -> () {} - | ~~~~~~~~~ +LL - extern "rust-call" fn call_mut(&self, args: ()) -> () {} +LL + extern "rust-call" fn call_mut(&mut self, args: ()) -> () {} + | error[E0046]: not all trait items implemented, missing: `Output` --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:1 diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures.rs b/tests/ui/feature-gates/feature-gate-unboxed-closures.rs index ebc5a2536f6..74cc20c581c 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures.rs +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures.rs @@ -10,7 +10,7 @@ impl FnOnce<(u32, u32)> for Test { extern "rust-call" fn call_once(self, (a, b): (u32, u32)) -> u32 { a + b } - //~^^^ ERROR rust-call ABI is subject to change + //~^^^ ERROR "rust-call" ABI is experimental and subject to change } fn main() { diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures.stderr index 52c18ec34c5..36932c1f86f 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures.stderr @@ -1,4 +1,4 @@ -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-unboxed-closures.rs:10:12 | LL | extern "rust-call" fn call_once(self, (a, b): (u32, u32)) -> u32 { diff --git a/tests/ui/feature-gates/feature-gate-unsized_fn_params.stderr b/tests/ui/feature-gates/feature-gate-unsized_fn_params.stderr index 360c73ae2d7..30f95851768 100644 --- a/tests/ui/feature-gates/feature-gate-unsized_fn_params.stderr +++ b/tests/ui/feature-gates/feature-gate-unsized_fn_params.stderr @@ -8,8 +8,9 @@ LL | fn foo(x: dyn Foo) { = help: unsized fn params are gated as an unstable feature help: you can use `impl Trait` as the argument type | -LL | fn foo(x: impl Foo) { - | ~~~~ +LL - fn foo(x: dyn Foo) { +LL + fn foo(x: impl Foo) { + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | fn foo(x: &dyn Foo) { diff --git a/tests/ui/feature-gates/feature-gate-unsized_locals.stderr b/tests/ui/feature-gates/feature-gate-unsized_locals.stderr index f48565b922b..ce0f423fb5c 100644 --- a/tests/ui/feature-gates/feature-gate-unsized_locals.stderr +++ b/tests/ui/feature-gates/feature-gate-unsized_locals.stderr @@ -8,8 +8,9 @@ LL | fn f(f: dyn FnOnce()) {} = help: unsized fn params are gated as an unstable feature help: you can use `impl Trait` as the argument type | -LL | fn f(f: impl FnOnce()) {} - | ~~~~ +LL - fn f(f: dyn FnOnce()) {} +LL + fn f(f: impl FnOnce()) {} + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | fn f(f: &dyn FnOnce()) {} diff --git a/tests/ui/feature-gates/feature-gate-vectorcall.rs b/tests/ui/feature-gates/feature-gate-vectorcall.rs index 73a11a842f3..aafa6a2ed62 100644 --- a/tests/ui/feature-gates/feature-gate-vectorcall.rs +++ b/tests/ui/feature-gates/feature-gate-vectorcall.rs @@ -9,23 +9,23 @@ trait Sized { } // Test that the "vectorcall" ABI is feature-gated, and cannot be used when // the `vectorcall` feature gate is not used. -extern "vectorcall" fn f() {} //~ ERROR vectorcall is experimental +extern "vectorcall" fn f() {} //~ ERROR "vectorcall" ABI is experimental trait T { - extern "vectorcall" fn m(); //~ ERROR vectorcall is experimental + extern "vectorcall" fn m(); //~ ERROR "vectorcall" ABI is experimental - extern "vectorcall" fn dm() {} //~ ERROR vectorcall is experimental + extern "vectorcall" fn dm() {} //~ ERROR "vectorcall" ABI is experimental } struct S; impl T for S { - extern "vectorcall" fn m() {} //~ ERROR vectorcall is experimental + extern "vectorcall" fn m() {} //~ ERROR "vectorcall" ABI is experimental } impl S { - extern "vectorcall" fn im() {} //~ ERROR vectorcall is experimental + extern "vectorcall" fn im() {} //~ ERROR "vectorcall" ABI is experimental } -type TA = extern "vectorcall" fn(); //~ ERROR vectorcall is experimental +type TA = extern "vectorcall" fn(); //~ ERROR "vectorcall" ABI is experimental -extern "vectorcall" {} //~ ERROR vectorcall is experimental +extern "vectorcall" {} //~ ERROR "vectorcall" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-vectorcall.stderr b/tests/ui/feature-gates/feature-gate-vectorcall.stderr index b20e41887b9..8f3f47a3d48 100644 --- a/tests/ui/feature-gates/feature-gate-vectorcall.stderr +++ b/tests/ui/feature-gates/feature-gate-vectorcall.stderr @@ -1,4 +1,4 @@ -error[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:12:8 | LL | extern "vectorcall" fn f() {} @@ -8,7 +8,7 @@ LL | extern "vectorcall" fn f() {} = help: add `#![feature(abi_vectorcall)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:15:12 | LL | extern "vectorcall" fn m(); @@ -18,7 +18,7 @@ LL | extern "vectorcall" fn m(); = help: add `#![feature(abi_vectorcall)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:17:12 | LL | extern "vectorcall" fn dm() {} @@ -28,7 +28,7 @@ LL | extern "vectorcall" fn dm() {} = help: add `#![feature(abi_vectorcall)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:22:12 | LL | extern "vectorcall" fn m() {} @@ -38,7 +38,7 @@ LL | extern "vectorcall" fn m() {} = help: add `#![feature(abi_vectorcall)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:26:12 | LL | extern "vectorcall" fn im() {} @@ -48,7 +48,7 @@ LL | extern "vectorcall" fn im() {} = help: add `#![feature(abi_vectorcall)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:29:18 | LL | type TA = extern "vectorcall" fn(); @@ -58,7 +58,7 @@ LL | type TA = extern "vectorcall" fn(); = help: add `#![feature(abi_vectorcall)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:31:8 | LL | extern "vectorcall" {} diff --git a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs index 37b7d52fafc..2328798d74c 100644 --- a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs +++ b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs @@ -5,7 +5,7 @@ fn main() { let a = &[1, 2, 3]; println!("{}", { - extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" { //~ ERROR "rust-intrinsic" ABI is an implementation detail fn atomic_fence(); } atomic_fence(); //~ ERROR: is unsafe diff --git a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr index 3dc11b5612c..86f88fdff5f 100644 --- a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr +++ b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr @@ -1,4 +1,4 @@ -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gated-feature-in-macro-arg.rs:8:16 | LL | extern "rust-intrinsic" { diff --git a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr index 9a12851f20e..8987b87f84e 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr @@ -24,10 +24,12 @@ LL | #[macro_use = "2700"] struct S; | help: the following are the possible correct uses | -LL | #[macro_use(name1, name2, ...)] struct S; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | #[macro_use] struct S; - | ~~~~~~~~~~~~ +LL - #[macro_use = "2700"] struct S; +LL + #[macro_use(name1, name2, ...)] struct S; + | +LL - #[macro_use = "2700"] struct S; +LL + #[macro_use] struct S; + | error: aborting due to 4 previous errors diff --git a/tests/ui/fmt/format-args-non-identifier-diagnostics.stderr b/tests/ui/fmt/format-args-non-identifier-diagnostics.stderr index 08abba2854e..af6bb58071f 100644 --- a/tests/ui/fmt/format-args-non-identifier-diagnostics.stderr +++ b/tests/ui/fmt/format-args-non-identifier-diagnostics.stderr @@ -6,8 +6,9 @@ LL | println!("{x.0}"); | help: consider using a positional formatting argument instead | -LL | println!("{0}", x.0); - | ~ +++++ +LL - println!("{x.0}"); +LL + println!("{0}", x.0); + | error: aborting due to 1 previous error diff --git a/tests/ui/fmt/format-string-error-2.stderr b/tests/ui/fmt/format-string-error-2.stderr index a2d142e0bab..6d8c34fdb70 100644 --- a/tests/ui/fmt/format-string-error-2.stderr +++ b/tests/ui/fmt/format-string-error-2.stderr @@ -6,8 +6,9 @@ LL | println!("\x7B}\u8 {", 1); | help: format of unicode escape sequences uses braces | -LL | println!("\x7B}\u{8} {", 1); - | ~~~~~ +LL - println!("\x7B}\u8 {", 1); +LL + println!("\x7B}\u{8} {", 1); + | error: invalid format string: expected `}`, found `a` --> $DIR/format-string-error-2.rs:5:5 diff --git a/tests/ui/fmt/no-inline-literals-out-of-range.stderr b/tests/ui/fmt/no-inline-literals-out-of-range.stderr index 78ec4888c27..e1702388704 100644 --- a/tests/ui/fmt/no-inline-literals-out-of-range.stderr +++ b/tests/ui/fmt/no-inline-literals-out-of-range.stderr @@ -8,12 +8,14 @@ LL | format_args!("{}", 0x8f_i8); // issue #115423 = note: `#[deny(overflowing_literals)]` on by default help: consider using the type `u8` instead | -LL | format_args!("{}", 0x8f_u8); // issue #115423 - | ~~~~~~~ +LL - format_args!("{}", 0x8f_i8); // issue #115423 +LL + format_args!("{}", 0x8f_u8); // issue #115423 + | help: to use as a negative number (decimal `-113`), consider using the type `u8` for the literal and cast it to `i8` | -LL | format_args!("{}", 0x8f_u8 as i8); // issue #115423 - | ~~~~~~~~~~~~~ +LL - format_args!("{}", 0x8f_i8); // issue #115423 +LL + format_args!("{}", 0x8f_u8 as i8); // issue #115423 + | error: literal out of range for `u8` --> $DIR/no-inline-literals-out-of-range.rs:6:24 @@ -50,7 +52,7 @@ LL | format_args!("{}", 0xffff_ffff); // treat unsuffixed literals as i32 help: to use as a negative number (decimal `-1`), consider using the type `u32` for the literal and cast it to `i32` | LL | format_args!("{}", 0xffff_ffffu32 as i32); // treat unsuffixed literals as i32 - | ~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/fmt/struct-field-as-captured-argument.stderr b/tests/ui/fmt/struct-field-as-captured-argument.stderr index 4ef022cecb0..388c14f932b 100644 --- a/tests/ui/fmt/struct-field-as-captured-argument.stderr +++ b/tests/ui/fmt/struct-field-as-captured-argument.stderr @@ -6,8 +6,9 @@ LL | let _ = format!("{foo.field}"); | help: consider using a positional formatting argument instead | -LL | let _ = format!("{0}", foo.field); - | ~ +++++++++++ +LL - let _ = format!("{foo.field}"); +LL + let _ = format!("{0}", foo.field); + | error: invalid format string: field access isn't supported --> $DIR/struct-field-as-captured-argument.rs:12:23 @@ -17,8 +18,9 @@ LL | let _ = format!("{foo.field} {} {bar}", "aa"); | help: consider using a positional formatting argument instead | -LL | let _ = format!("{1} {} {bar}", "aa", foo.field); - | ~ +++++++++++ +LL - let _ = format!("{foo.field} {} {bar}", "aa"); +LL + let _ = format!("{1} {} {bar}", "aa", foo.field); + | error: invalid format string: field access isn't supported --> $DIR/struct-field-as-captured-argument.rs:13:23 @@ -28,8 +30,9 @@ LL | let _ = format!("{foo.field} {} {1} {bar}", "aa", "bb"); | help: consider using a positional formatting argument instead | -LL | let _ = format!("{2} {} {1} {bar}", "aa", "bb", foo.field); - | ~ +++++++++++ +LL - let _ = format!("{foo.field} {} {1} {bar}", "aa", "bb"); +LL + let _ = format!("{2} {} {1} {bar}", "aa", "bb", foo.field); + | error: invalid format string: field access isn't supported --> $DIR/struct-field-as-captured-argument.rs:14:23 @@ -39,8 +42,9 @@ LL | let _ = format!("{foo.field} {} {baz}", "aa", baz = 3); | help: consider using a positional formatting argument instead | -LL | let _ = format!("{1} {} {baz}", "aa", foo.field, baz = 3); - | ~ +++++++++++ +LL - let _ = format!("{foo.field} {} {baz}", "aa", baz = 3); +LL + let _ = format!("{1} {} {baz}", "aa", foo.field, baz = 3); + | error: invalid format string: field access isn't supported --> $DIR/struct-field-as-captured-argument.rs:15:23 @@ -50,8 +54,9 @@ LL | let _ = format!("{foo.field:?} {} {baz}", "aa", baz = 3); | help: consider using a positional formatting argument instead | -LL | let _ = format!("{1:?} {} {baz}", "aa", foo.field, baz = 3); - | ~ +++++++++++ +LL - let _ = format!("{foo.field:?} {} {baz}", "aa", baz = 3); +LL + let _ = format!("{1:?} {} {baz}", "aa", foo.field, baz = 3); + | error: invalid format string: field access isn't supported --> $DIR/struct-field-as-captured-argument.rs:16:23 @@ -61,8 +66,9 @@ LL | let _ = format!("{foo.field:#?} {} {baz}", "aa", baz = 3); | help: consider using a positional formatting argument instead | -LL | let _ = format!("{1:#?} {} {baz}", "aa", foo.field, baz = 3); - | ~ +++++++++++ +LL - let _ = format!("{foo.field:#?} {} {baz}", "aa", baz = 3); +LL + let _ = format!("{1:#?} {} {baz}", "aa", foo.field, baz = 3); + | error: invalid format string: field access isn't supported --> $DIR/struct-field-as-captured-argument.rs:17:23 @@ -72,8 +78,9 @@ LL | let _ = format!("{foo.field:.3} {} {baz}", "aa", baz = 3); | help: consider using a positional formatting argument instead | -LL | let _ = format!("{1:.3} {} {baz}", "aa", foo.field, baz = 3); - | ~ +++++++++++ +LL - let _ = format!("{foo.field:.3} {} {baz}", "aa", baz = 3); +LL + let _ = format!("{1:.3} {} {baz}", "aa", foo.field, baz = 3); + | error: aborting due to 7 previous errors diff --git a/tests/ui/fmt/suggest-wrongly-order-format-parameter.stderr b/tests/ui/fmt/suggest-wrongly-order-format-parameter.stderr index fe693d2e904..516fb870a56 100644 --- a/tests/ui/fmt/suggest-wrongly-order-format-parameter.stderr +++ b/tests/ui/fmt/suggest-wrongly-order-format-parameter.stderr @@ -6,8 +6,9 @@ LL | println!("{f:?#}"); | help: did you mean `#?`? | -LL | println!("{f:#?}"); - | ~~ +LL - println!("{f:?#}"); +LL + println!("{f:#?}"); + | error: invalid format string: expected `}`, found `x` --> $DIR/suggest-wrongly-order-format-parameter.rs:18:19 @@ -17,8 +18,9 @@ LL | println!("{f:?x}"); | help: did you mean `x?`? | -LL | println!("{f:x?}"); - | ~~ +LL - println!("{f:?x}"); +LL + println!("{f:x?}"); + | error: invalid format string: expected `}`, found `X` --> $DIR/suggest-wrongly-order-format-parameter.rs:22:19 @@ -28,8 +30,9 @@ LL | println!("{f:?X}"); | help: did you mean `X?`? | -LL | println!("{f:X?}"); - | ~~ +LL - println!("{f:?X}"); +LL + println!("{f:X?}"); + | error: aborting due to 3 previous errors diff --git a/tests/ui/fn/error-recovery-mismatch.rs b/tests/ui/fn/error-recovery-mismatch.rs new file mode 100644 index 00000000000..a50a30c8c78 --- /dev/null +++ b/tests/ui/fn/error-recovery-mismatch.rs @@ -0,0 +1,20 @@ +// Used to ICE due to a size mismatch between the actual fake signature of `fold` and the +// generated signature used reporting the parameter mismatch at the call site. +// See issue #135124 + +trait A { + fn y(&self) + { + fn call() -> impl Sized {} + self.fold(call(), call()); + } + fn fold<T>(&self, _: T, &self._) {} + //~^ ERROR unexpected `self` parameter in function + //~| ERROR expected one of `)` or `,`, found `.` + //~| ERROR identifier `self` is bound more than once in this parameter list + //~| WARNING anonymous parameters are deprecated + //~| WARNING this is accepted in the current edition + //~| ERROR the placeholder `_` is not allowed within types +} + +fn main() {} diff --git a/tests/ui/fn/error-recovery-mismatch.stderr b/tests/ui/fn/error-recovery-mismatch.stderr new file mode 100644 index 00000000000..f281e77f13b --- /dev/null +++ b/tests/ui/fn/error-recovery-mismatch.stderr @@ -0,0 +1,47 @@ +error: unexpected `self` parameter in function + --> $DIR/error-recovery-mismatch.rs:11:29 + | +LL | fn fold<T>(&self, _: T, &self._) {} + | ^^^^^ must be the first parameter of an associated function + +error: expected one of `)` or `,`, found `.` + --> $DIR/error-recovery-mismatch.rs:11:34 + | +LL | fn fold<T>(&self, _: T, &self._) {} + | ^ + | | + | expected one of `)` or `,` + | help: missing `,` + +error[E0415]: identifier `self` is bound more than once in this parameter list + --> $DIR/error-recovery-mismatch.rs:11:30 + | +LL | fn fold<T>(&self, _: T, &self._) {} + | ^^^^ used as parameter more than once + +warning: anonymous parameters are deprecated and will be removed in the next edition + --> $DIR/error-recovery-mismatch.rs:11:35 + | +LL | fn fold<T>(&self, _: T, &self._) {} + | ^ help: try naming the parameter or explicitly ignoring it: `_: _` + | + = 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 + +error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions + --> $DIR/error-recovery-mismatch.rs:11:35 + | +LL | fn fold<T>(&self, _: T, &self._) {} + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL - fn fold<T>(&self, _: T, &self._) {} +LL + fn fold<T, U>(&self, _: T, &self.U) {} + | + +error: aborting due to 4 previous errors; 1 warning emitted + +Some errors have detailed explanations: E0121, E0415. +For more information about an error, try `rustc --explain E0121`. diff --git a/tests/ui/fn/fn-pointer-mismatch.stderr b/tests/ui/fn/fn-pointer-mismatch.stderr index 9cda11639d0..051eb945467 100644 --- a/tests/ui/fn/fn-pointer-mismatch.stderr +++ b/tests/ui/fn/fn-pointer-mismatch.stderr @@ -51,8 +51,9 @@ LL | let c: fn(u32) -> u32 = &foo; found reference `&fn(_) -> _ {foo}` help: consider removing the reference | -LL | let c: fn(u32) -> u32 = foo; - | ~~~ +LL - let c: fn(u32) -> u32 = &foo; +LL + let c: fn(u32) -> u32 = foo; + | error[E0308]: mismatched types --> $DIR/fn-pointer-mismatch.rs:42:30 @@ -67,7 +68,7 @@ LL | let d: &fn(u32) -> u32 = foo; help: consider using a reference | LL | let d: &fn(u32) -> u32 = &foo; - | ~~~~ + | + error[E0308]: mismatched types --> $DIR/fn-pointer-mismatch.rs:48:30 @@ -82,8 +83,9 @@ LL | let e: &fn(u32) -> u32 = &foo; = note: fn items are distinct from fn pointers help: consider casting to a fn pointer | -LL | let e: &fn(u32) -> u32 = &(foo as fn(u32) -> u32); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let e: &fn(u32) -> u32 = &foo; +LL + let e: &fn(u32) -> u32 = &(foo as fn(u32) -> u32); + | error: aborting due to 6 previous errors diff --git a/tests/ui/fn/fn-recover-return-sign.stderr b/tests/ui/fn/fn-recover-return-sign.stderr index e6012f3f950..96aa96f00ad 100644 --- a/tests/ui/fn/fn-recover-return-sign.stderr +++ b/tests/ui/fn/fn-recover-return-sign.stderr @@ -6,8 +6,9 @@ LL | fn a() => usize { 0 } | help: use `->` instead | -LL | fn a() -> usize { 0 } - | ~~ +LL - fn a() => usize { 0 } +LL + fn a() -> usize { 0 } + | error: return types are denoted using `->` --> $DIR/fn-recover-return-sign.rs:6:7 @@ -17,8 +18,9 @@ LL | fn b(): usize { 0 } | help: use `->` instead | -LL | fn b() -> usize { 0 } - | ~~ +LL - fn b(): usize { 0 } +LL + fn b() -> usize { 0 } + | error: return types are denoted using `->` --> $DIR/fn-recover-return-sign.rs:21:25 @@ -28,8 +30,9 @@ LL | let foo = |a: bool| => bool { a }; | help: use `->` instead | -LL | let foo = |a: bool| -> bool { a }; - | ~~ +LL - let foo = |a: bool| => bool { a }; +LL + let foo = |a: bool| -> bool { a }; + | error: return types are denoted using `->` --> $DIR/fn-recover-return-sign.rs:25:24 @@ -39,8 +42,9 @@ LL | let bar = |a: bool|: bool { a }; | help: use `->` instead | -LL | let bar = |a: bool| -> bool { a }; - | ~~ +LL - let bar = |a: bool|: bool { a }; +LL + let bar = |a: bool| -> bool { a }; + | error: aborting due to 4 previous errors diff --git a/tests/ui/fn/fn-recover-return-sign2.stderr b/tests/ui/fn/fn-recover-return-sign2.stderr index fb88ff7b950..ba6662b0d46 100644 --- a/tests/ui/fn/fn-recover-return-sign2.stderr +++ b/tests/ui/fn/fn-recover-return-sign2.stderr @@ -6,8 +6,9 @@ LL | fn foo() => impl Fn() => bool { | help: use `->` instead | -LL | fn foo() -> impl Fn() => bool { - | ~~ +LL - fn foo() => impl Fn() => bool { +LL + fn foo() -> impl Fn() => bool { + | error: expected one of `+`, `->`, `::`, `where`, or `{`, found `=>` --> $DIR/fn-recover-return-sign2.rs:4:23 diff --git a/tests/ui/fn/param-mismatch-foreign.rs b/tests/ui/fn/param-mismatch-foreign.rs new file mode 100644 index 00000000000..2ab2bf95448 --- /dev/null +++ b/tests/ui/fn/param-mismatch-foreign.rs @@ -0,0 +1,11 @@ +extern "C" { + fn foo(x: i32, y: u32, z: i32); + //~^ NOTE function defined here +} + +fn main() { + foo(1i32, 2i32); + //~^ ERROR this function takes 3 arguments but 2 arguments were supplied + //~| NOTE argument #2 of type `u32` is missing + //~| HELP provide the argument +} diff --git a/tests/ui/fn/param-mismatch-foreign.stderr b/tests/ui/fn/param-mismatch-foreign.stderr new file mode 100644 index 00000000000..88aa3cd0368 --- /dev/null +++ b/tests/ui/fn/param-mismatch-foreign.stderr @@ -0,0 +1,20 @@ +error[E0061]: this function takes 3 arguments but 2 arguments were supplied + --> $DIR/param-mismatch-foreign.rs:7:5 + | +LL | foo(1i32, 2i32); + | ^^^ ---- argument #2 of type `u32` is missing + | +note: function defined here + --> $DIR/param-mismatch-foreign.rs:2:8 + | +LL | fn foo(x: i32, y: u32, z: i32); + | ^^^ - +help: provide the argument + | +LL - foo(1i32, 2i32); +LL + foo(1i32, /* u32 */, 2i32); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0061`. diff --git a/tests/ui/fn/param-mismatch-trait-fn.rs b/tests/ui/fn/param-mismatch-trait-fn.rs new file mode 100644 index 00000000000..69ded6a9068 --- /dev/null +++ b/tests/ui/fn/param-mismatch-trait-fn.rs @@ -0,0 +1,10 @@ +trait Foo { + fn same_type<T>(_: T, _: T); +} + +fn f<T: Foo, X, Y>(x: X, y: Y) { + T::same_type([x], Some(y)); + //~^ ERROR mismatched types +} + +fn main() {} diff --git a/tests/ui/fn/param-mismatch-trait-fn.stderr b/tests/ui/fn/param-mismatch-trait-fn.stderr new file mode 100644 index 00000000000..28e1bcaaf49 --- /dev/null +++ b/tests/ui/fn/param-mismatch-trait-fn.stderr @@ -0,0 +1,23 @@ +error[E0308]: mismatched types + --> $DIR/param-mismatch-trait-fn.rs:6:23 + | +LL | T::same_type([x], Some(y)); + | ------------ --- ^^^^^^^ expected `[X; 1]`, found `Option<Y>` + | | | + | | expected all arguments to be this `[X; 1]` type because they need to match the type of this parameter + | arguments to this function are incorrect + | + = note: expected array `[X; 1]` + found enum `Option<Y>` +note: associated function defined here + --> $DIR/param-mismatch-trait-fn.rs:2:8 + | +LL | fn same_type<T>(_: T, _: T); + | ^^^^^^^^^ - - - this parameter needs to match the `[X; 1]` type of parameter #1 + | | | + | | parameter #2 needs to match the `[X; 1]` type of this parameter + | parameter #1 and parameter #2 both reference this parameter `T` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/for-loop-while/break.rs b/tests/ui/for-loop-while/break.rs index 77774792262..442e07e148c 100644 --- a/tests/ui/for-loop-while/break.rs +++ b/tests/ui/for-loop-while/break.rs @@ -8,18 +8,18 @@ pub fn main() { assert_eq!(i, 20); let xs = [1, 2, 3, 4, 5, 6]; for x in &xs { - if *x == 3 { break; } assert!((*x <= 3)); + if *x == 3 { break; } assert!(*x <= 3); } i = 0; - while i < 10 { i += 1; if i % 2 == 0 { continue; } assert!((i % 2 != 0)); } + while i < 10 { i += 1; if i % 2 == 0 { continue; } assert!(i % 2 != 0); } i = 0; loop { - i += 1; if i % 2 == 0 { continue; } assert!((i % 2 != 0)); + i += 1; if i % 2 == 0 { continue; } assert!(i % 2 != 0); if i >= 10 { break; } } let ys = vec![1, 2, 3, 4, 5, 6]; for x in &ys { if *x % 2 == 0 { continue; } - assert!((*x % 2 != 0)); + assert!(*x % 2 != 0); } } diff --git a/tests/ui/for-loop-while/while-cont.rs b/tests/ui/for-loop-while/while-cont.rs index 1640b7e1803..73a08c26f9a 100644 --- a/tests/ui/for-loop-while/while-cont.rs +++ b/tests/ui/for-loop-while/while-cont.rs @@ -3,7 +3,7 @@ pub fn main() { let mut i = 1; while i > 0 { - assert!((i > 0)); + assert!(i > 0); println!("{}", i); i -= 1; continue; diff --git a/tests/ui/for-loop-while/while-loop-constraints-2.rs b/tests/ui/for-loop-while/while-loop-constraints-2.rs index 654f6769902..1d2d9c2ecfe 100644 --- a/tests/ui/for-loop-while/while-loop-constraints-2.rs +++ b/tests/ui/for-loop-while/while-loop-constraints-2.rs @@ -11,5 +11,5 @@ pub fn main() { while false { x = y; y = z; } println!("{}", y); } - assert!((y == 42 && z == 50)); + assert!(y == 42 && z == 50); } diff --git a/tests/ui/force-inlining/cast.stderr b/tests/ui/force-inlining/cast.stderr index 116919e5fe7..53132959659 100644 --- a/tests/ui/force-inlining/cast.stderr +++ b/tests/ui/force-inlining/cast.stderr @@ -12,7 +12,7 @@ LL | let _: fn(isize) -> usize = callee; help: consider casting to a fn pointer | LL | let _: fn(isize) -> usize = callee as fn(isize) -> usize; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++ error[E0605]: non-primitive cast: `fn(isize) -> usize {callee}` as `fn(isize) -> usize` --> $DIR/cast.rs:15:13 @@ -32,7 +32,7 @@ LL | callee, help: consider casting to a fn pointer | LL | callee as fn(isize) -> usize, - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/force-inlining/deny-async.rs b/tests/ui/force-inlining/deny-async.rs index bdf6271bd2a..7c95a53c26f 100644 --- a/tests/ui/force-inlining/deny-async.rs +++ b/tests/ui/force-inlining/deny-async.rs @@ -1,6 +1,6 @@ -//@ check-fail //@ compile-flags: --crate-type=lib //@ edition: 2021 + #![allow(internal_features)] #![feature(rustc_attrs)] @@ -20,5 +20,7 @@ pub fn callee_justified() { async fn async_caller() { callee(); + //~^ ERROR `callee` could not be inlined callee_justified(); + //~^ ERROR `callee_justified` could not be inlined } diff --git a/tests/ui/force-inlining/deny-async.stderr b/tests/ui/force-inlining/deny-async.stderr index 302ca419071..d6516ed875c 100644 --- a/tests/ui/force-inlining/deny-async.stderr +++ b/tests/ui/force-inlining/deny-async.stderr @@ -20,5 +20,22 @@ LL | pub fn callee_justified() { | = note: incompatible due to: #[rustc_no_mir_inline] -error: aborting due to 2 previous errors +error: `callee` could not be inlined into `async_caller::{closure#0}` but is required to be inlined + --> $DIR/deny-async.rs:22:5 + | +LL | callee(); + | ^^^^^^^^ ...`callee` called here + | + = note: could not be inlined due to: #[rustc_no_mir_inline] + +error: `callee_justified` could not be inlined into `async_caller::{closure#0}` but is required to be inlined + --> $DIR/deny-async.rs:24:5 + | +LL | callee_justified(); + | ^^^^^^^^^^^^^^^^^^ ...`callee_justified` called here + | + = note: could not be inlined due to: #[rustc_no_mir_inline] + = note: `callee_justified` is required to be inlined to: the test requires it + +error: aborting due to 4 previous errors diff --git a/tests/ui/force-inlining/invalid.stderr b/tests/ui/force-inlining/invalid.stderr index 5d280124129..92b3c314bad 100644 --- a/tests/ui/force-inlining/invalid.stderr +++ b/tests/ui/force-inlining/invalid.stderr @@ -6,9 +6,11 @@ LL | #[rustc_force_inline("foo")] | help: the following are the possible correct uses | -LL | #[rustc_force_inline = "reason"] +LL - #[rustc_force_inline("foo")] +LL + #[rustc_force_inline = "reason"] | -LL | #[rustc_force_inline] +LL - #[rustc_force_inline("foo")] +LL + #[rustc_force_inline] | error: malformed `rustc_force_inline` attribute input @@ -19,9 +21,11 @@ LL | #[rustc_force_inline(bar, baz)] | help: the following are the possible correct uses | -LL | #[rustc_force_inline = "reason"] +LL - #[rustc_force_inline(bar, baz)] +LL + #[rustc_force_inline = "reason"] | -LL | #[rustc_force_inline] +LL - #[rustc_force_inline(bar, baz)] +LL + #[rustc_force_inline] | error: malformed `rustc_force_inline` attribute input @@ -32,9 +36,11 @@ LL | #[rustc_force_inline(2)] | help: the following are the possible correct uses | -LL | #[rustc_force_inline = "reason"] +LL - #[rustc_force_inline(2)] +LL + #[rustc_force_inline = "reason"] | -LL | #[rustc_force_inline] +LL - #[rustc_force_inline(2)] +LL + #[rustc_force_inline] | error: malformed `rustc_force_inline` attribute input @@ -45,9 +51,11 @@ LL | #[rustc_force_inline = 2] | help: the following are the possible correct uses | -LL | #[rustc_force_inline = "reason"] +LL - #[rustc_force_inline = 2] +LL + #[rustc_force_inline = "reason"] | -LL | #[rustc_force_inline] +LL - #[rustc_force_inline = 2] +LL + #[rustc_force_inline] | error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters diff --git a/tests/ui/functional-struct-update/functional-struct-update-noncopyable.stderr b/tests/ui/functional-struct-update/functional-struct-update-noncopyable.stderr index d167a60dad3..b09ffb10673 100644 --- a/tests/ui/functional-struct-update/functional-struct-update-noncopyable.stderr +++ b/tests/ui/functional-struct-update/functional-struct-update-noncopyable.stderr @@ -9,8 +9,9 @@ LL | let _b = A { y: Arc::new(3), ..a }; | help: clone the value from the field instead of using the functional record update syntax | -LL | let _b = A { y: Arc::new(3), x: a.x.clone() }; - | ~~~~~~~~~~~~~~~~ +LL - let _b = A { y: Arc::new(3), ..a }; +LL + let _b = A { y: Arc::new(3), x: a.x.clone() }; + | error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr b/tests/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr index 4c5a47e73c6..c9b46de5c33 100644 --- a/tests/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr +++ b/tests/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr @@ -43,7 +43,7 @@ LL | fn _f(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/gat-in-trait-path-undeclared-lifetime.rs:2:8 | LL | trait X { diff --git a/tests/ui/generic-associated-types/gat-in-trait-path.stderr b/tests/ui/generic-associated-types/gat-in-trait-path.stderr index df79556c825..e57f6b48401 100644 --- a/tests/ui/generic-associated-types/gat-in-trait-path.stderr +++ b/tests/ui/generic-associated-types/gat-in-trait-path.stderr @@ -5,7 +5,7 @@ LL | fn f(_arg : Box<dyn for<'a> Foo<A<'a> = &'a ()>>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/gat-in-trait-path.rs:6:10 | LL | trait Foo { @@ -21,7 +21,7 @@ LL | f(Box::new(foo)); | ^^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/gat-in-trait-path.rs:6:10 | LL | trait Foo { @@ -37,7 +37,7 @@ LL | f(Box::new(foo)); | ^^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/gat-in-trait-path.rs:6:10 | LL | trait Foo { diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index 499ce8e4a32..99300ea1cb7 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -12,8 +12,9 @@ LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} | help: use angle brackets instead | -LL | fn foo<'a>(arg: Box<dyn X<Y<'a> = &'a ()>>) {} - | ~ ~ +LL - fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} +LL + fn foo<'a>(arg: Box<dyn X<Y<'a> = &'a ()>>) {} + | error: parenthesized generic arguments cannot be used in associated type constraints --> $DIR/gat-trait-path-parenthesised-args.rs:18:27 @@ -130,7 +131,7 @@ LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} | ^^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 | LL | trait X { @@ -196,7 +197,7 @@ LL | fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {} | ^^^^^^^^^^^^^^^ `X` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 | LL | trait X { diff --git a/tests/ui/generic-associated-types/impl_bounds.stderr b/tests/ui/generic-associated-types/impl_bounds.stderr index aa56505dd30..291f0ade439 100644 --- a/tests/ui/generic-associated-types/impl_bounds.stderr +++ b/tests/ui/generic-associated-types/impl_bounds.stderr @@ -18,8 +18,9 @@ LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a; | help: copy the `where` clause predicates from the trait | -LL | type B<'a, 'b> = (&'a(), &'b ()) where 'a: 'b; - | ~~~~~~~~~~~~ +LL - type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a; +LL + type B<'a, 'b> = (&'a(), &'b ()) where 'a: 'b; + | error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/impl_bounds.rs:18:33 diff --git a/tests/ui/generic-associated-types/issue-67510-pass.stderr b/tests/ui/generic-associated-types/issue-67510-pass.stderr index f6846f833fe..4b56c4ef35f 100644 --- a/tests/ui/generic-associated-types/issue-67510-pass.stderr +++ b/tests/ui/generic-associated-types/issue-67510-pass.stderr @@ -5,7 +5,7 @@ LL | fn _func1<'a>(_x: Box<dyn X<Y<'a>=&'a ()>>) {} | ^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-67510-pass.rs:4:10 | LL | trait X { diff --git a/tests/ui/generic-associated-types/issue-67510.stderr b/tests/ui/generic-associated-types/issue-67510.stderr index e8555a7aa1f..f5c494788ea 100644 --- a/tests/ui/generic-associated-types/issue-67510.stderr +++ b/tests/ui/generic-associated-types/issue-67510.stderr @@ -36,7 +36,7 @@ LL | fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {} | ^^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-67510.rs:2:10 | LL | trait X { diff --git a/tests/ui/generic-associated-types/issue-70304.stderr b/tests/ui/generic-associated-types/issue-70304.stderr index 9b02c1b0768..a181b1035b7 100644 --- a/tests/ui/generic-associated-types/issue-70304.stderr +++ b/tests/ui/generic-associated-types/issue-70304.stderr @@ -13,8 +13,9 @@ LL | fn create_doc() -> impl Document<Cursor<'_> = DocCursorImpl<'_>> { = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | fn create_doc() -> impl Document<Cursor<'_> = DocCursorImpl<'static>> { - | ~~~~~~~ +LL - fn create_doc() -> impl Document<Cursor<'_> = DocCursorImpl<'_>> { +LL + fn create_doc() -> impl Document<Cursor<'_> = DocCursorImpl<'static>> { + | error: missing required bound on `Cursor` --> $DIR/issue-70304.rs:2:5 diff --git a/tests/ui/generic-associated-types/issue-71176.stderr b/tests/ui/generic-associated-types/issue-71176.stderr index a78151384d4..56439f6dfea 100644 --- a/tests/ui/generic-associated-types/issue-71176.stderr +++ b/tests/ui/generic-associated-types/issue-71176.stderr @@ -55,7 +55,7 @@ LL | inner: Box<dyn Provider<A = B>>, | ^^^^^^^^^^^^^^^^^^^ `Provider` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-71176.rs:2:10 | LL | trait Provider { @@ -72,7 +72,7 @@ LL | inner: Box::new(()), | ^^^^^^^^^^^^ `Provider` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-71176.rs:2:10 | LL | trait Provider { @@ -89,7 +89,7 @@ LL | inner: Box::new(()), | ^^^^^^^^^^^^ `Provider` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-71176.rs:2:10 | LL | trait Provider { diff --git a/tests/ui/generic-associated-types/issue-76535.stderr b/tests/ui/generic-associated-types/issue-76535.stderr index 6b7c3bfe731..b828234afa1 100644 --- a/tests/ui/generic-associated-types/issue-76535.stderr +++ b/tests/ui/generic-associated-types/issue-76535.stderr @@ -21,7 +21,7 @@ LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruc | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-76535.rs:4:10 | LL | pub trait SuperTrait { @@ -39,7 +39,7 @@ LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruc | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-76535.rs:4:10 | LL | pub trait SuperTrait { diff --git a/tests/ui/generic-associated-types/issue-78671.stderr b/tests/ui/generic-associated-types/issue-78671.stderr index c85e97067cb..c6da137672d 100644 --- a/tests/ui/generic-associated-types/issue-78671.stderr +++ b/tests/ui/generic-associated-types/issue-78671.stderr @@ -21,7 +21,7 @@ LL | Box::new(Family) as &dyn CollectionFamily<Member=usize> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CollectionFamily` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-78671.rs:2:10 | LL | trait CollectionFamily { diff --git a/tests/ui/generic-associated-types/issue-79422.stderr b/tests/ui/generic-associated-types/issue-79422.stderr index a81217e96c3..6311e4de272 100644 --- a/tests/ui/generic-associated-types/issue-79422.stderr +++ b/tests/ui/generic-associated-types/issue-79422.stderr @@ -21,7 +21,7 @@ LL | as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-79422.rs:18:10 | LL | trait MapLike<K, V> { @@ -37,7 +37,7 @@ LL | let m = Box::new(std::collections::BTreeMap::<u8, u8>::new()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-79422.rs:18:10 | LL | trait MapLike<K, V> { diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.rs b/tests/ui/generic-associated-types/issue-90014-tait2.rs index ef54a89aaae..3f7a9ff63c3 100644 --- a/tests/ui/generic-associated-types/issue-90014-tait2.rs +++ b/tests/ui/generic-associated-types/issue-90014-tait2.rs @@ -3,8 +3,6 @@ //! Unfortunately we don't even reach opaque type collection, as we ICE in typeck before that. //! See #109281 for the original report. //@ edition:2018 -//@ error-pattern: expected generic lifetime parameter, found `'a` - #![feature(type_alias_impl_trait)] use std::future::Future; @@ -24,6 +22,7 @@ impl<'x, T: 'x> Trait<'x> for (T,) { impl Foo<'_> { fn make_fut(&self) -> Box<dyn for<'a> Trait<'a, Thing = Fut<'a>>> { Box::new((async { () },)) + //~^ ERROR expected generic lifetime parameter, found `'a` } } diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.stderr b/tests/ui/generic-associated-types/issue-90014-tait2.stderr index be6f4272ce1..aa427d42649 100644 --- a/tests/ui/generic-associated-types/issue-90014-tait2.stderr +++ b/tests/ui/generic-associated-types/issue-90014-tait2.stderr @@ -1,5 +1,5 @@ error[E0792]: expected generic lifetime parameter, found `'a` - --> $DIR/issue-90014-tait2.rs:26:9 + --> $DIR/issue-90014-tait2.rs:24:9 | LL | type Fut<'a> = impl Future<Output = ()>; | -- this generic parameter must be used with a generic lifetime parameter diff --git a/tests/ui/generic-associated-types/issue-91883.stderr b/tests/ui/generic-associated-types/issue-91883.current.stderr index ac636ebb648..0741cf9581d 100644 --- a/tests/ui/generic-associated-types/issue-91883.stderr +++ b/tests/ui/generic-associated-types/issue-91883.current.stderr @@ -1,5 +1,5 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/issue-91883.rs:30:24 + --> $DIR/issue-91883.rs:34:24 | LL | type Cursor<'tx>: Cursor<'tx> | ----------------------------- definition of `Cursor` from trait @@ -8,12 +8,12 @@ LL | type Cursor<'tx> = CursorImpl<'tx>; | ^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime `'db` as defined here - --> $DIR/issue-91883.rs:29:6 + --> $DIR/issue-91883.rs:33:6 | LL | impl<'db> Transaction<'db> for TransactionImpl<'db> { | ^^^ note: but lifetime parameter must outlive the lifetime `'tx` as defined here - --> $DIR/issue-91883.rs:30:17 + --> $DIR/issue-91883.rs:34:17 | LL | type Cursor<'tx> = CursorImpl<'tx>; | ^^^ diff --git a/tests/ui/generic-associated-types/issue-91883.next.stderr b/tests/ui/generic-associated-types/issue-91883.next.stderr new file mode 100644 index 00000000000..b3ed2d81b63 --- /dev/null +++ b/tests/ui/generic-associated-types/issue-91883.next.stderr @@ -0,0 +1,20 @@ +error[E0478]: lifetime bound not satisfied + --> $DIR/issue-91883.rs:34:24 + | +LL | type Cursor<'tx> = CursorImpl<'tx>; + | ^^^^^^^^^^^^^^^ + | +note: lifetime parameter instantiated with the lifetime `'db` as defined here + --> $DIR/issue-91883.rs:33:6 + | +LL | impl<'db> Transaction<'db> for TransactionImpl<'db> { + | ^^^ +note: but lifetime parameter must outlive the lifetime `'tx` as defined here + --> $DIR/issue-91883.rs:34:17 + | +LL | type Cursor<'tx> = CursorImpl<'tx>; + | ^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0478`. diff --git a/tests/ui/generic-associated-types/issue-91883.rs b/tests/ui/generic-associated-types/issue-91883.rs index e870e08a3a2..d31e1736cf2 100644 --- a/tests/ui/generic-associated-types/issue-91883.rs +++ b/tests/ui/generic-associated-types/issue-91883.rs @@ -1,3 +1,7 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + use std::fmt::Debug; use std::marker::PhantomData; diff --git a/tests/ui/generic-associated-types/mismatched-where-clause-regions.stderr b/tests/ui/generic-associated-types/mismatched-where-clause-regions.stderr index ee90f61aabc..9ff343c255b 100644 --- a/tests/ui/generic-associated-types/mismatched-where-clause-regions.stderr +++ b/tests/ui/generic-associated-types/mismatched-where-clause-regions.stderr @@ -9,8 +9,9 @@ LL | type T<'a2, 'b2> = () where 'b2: 'a2; | help: copy the `where` clause predicates from the trait | -LL | type T<'a2, 'b2> = () where 'a2: 'b2; - | ~~~~~~~~~~~~~~ +LL - type T<'a2, 'b2> = () where 'b2: 'a2; +LL + type T<'a2, 'b2> = () where 'a2: 'b2; + | error: aborting due to 1 previous error diff --git a/tests/ui/generic-associated-types/missing-bounds.stderr b/tests/ui/generic-associated-types/missing-bounds.stderr index 6e0700639e9..13e4d249876 100644 --- a/tests/ui/generic-associated-types/missing-bounds.stderr +++ b/tests/ui/generic-associated-types/missing-bounds.stderr @@ -7,8 +7,9 @@ LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B { = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information help: if `Output` is an associated type you're trying to set, use the associated type binding syntax | -LL | impl<B: Add> Add for E<B> where B: Add<Output = B> { - | ~~~~~~~~~~~~~~~~~~ +LL - impl<B: Add> Add for E<B> where <B as Add>::Output = B { +LL + impl<B: Add> Add for E<B> where B: Add<Output = B> { + | error[E0308]: mismatched types --> $DIR/missing-bounds.rs:11:11 diff --git a/tests/ui/generic-associated-types/missing_lifetime_args.stderr b/tests/ui/generic-associated-types/missing_lifetime_args.stderr index 6b8df5cc12f..7b6888817f4 100644 --- a/tests/ui/generic-associated-types/missing_lifetime_args.stderr +++ b/tests/ui/generic-associated-types/missing_lifetime_args.stderr @@ -55,7 +55,7 @@ LL | fn foo<'c, 'd>(_arg: Box<dyn X<Y = (&'c u32, &'d u32)>>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/missing_lifetime_args.rs:2:10 | LL | trait X { diff --git a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr index 5c9e9dbe3d7..45bca1a7628 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr +++ b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr @@ -99,7 +99,7 @@ LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} | ^^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/trait-path-type-error-once-implemented.rs:2:10 | LL | trait X { diff --git a/tests/ui/generic-associated-types/trait-objects.stderr b/tests/ui/generic-associated-types/trait-objects.stderr index 56a1cb1906f..7d95718ec87 100644 --- a/tests/ui/generic-associated-types/trait-objects.stderr +++ b/tests/ui/generic-associated-types/trait-objects.stderr @@ -5,7 +5,7 @@ LL | fn min_size(x: &mut dyn for<'a> StreamingIterator<Item<'a> = &'a i32>) -> u | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `StreamingIterator` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/trait-objects.rs:2:10 | LL | trait StreamingIterator { @@ -21,7 +21,7 @@ LL | x.size_hint().0 | ^^^^^^^^^ `StreamingIterator` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/trait-objects.rs:2:10 | LL | trait StreamingIterator { @@ -37,7 +37,7 @@ LL | x.size_hint().0 | ^^^^^^^^^^^^^ `StreamingIterator` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/trait-objects.rs:2:10 | LL | trait StreamingIterator { diff --git a/tests/ui/generic-const-items/duplicate-where-clause.stderr b/tests/ui/generic-const-items/duplicate-where-clause.stderr index 5fa61b01ee9..6b742dfafed 100644 --- a/tests/ui/generic-const-items/duplicate-where-clause.stderr +++ b/tests/ui/generic-const-items/duplicate-where-clause.stderr @@ -9,8 +9,10 @@ LL | P: Eq; | help: consider joining the two `where` clauses into one | -LL | P: Copy, - | ~ +LL - P: Copy +LL - where +LL + P: Copy, + | error: where clauses are not allowed before const item bodies --> $DIR/duplicate-where-clause.rs:19:5 diff --git a/tests/ui/generics/generic-tag-match.rs b/tests/ui/generics/generic-tag-match.rs index dd0291e9d87..378b51df287 100644 --- a/tests/ui/generics/generic-tag-match.rs +++ b/tests/ui/generics/generic-tag-match.rs @@ -7,7 +7,7 @@ enum foo<T> { arm(T), } fn altfoo<T>(f: foo<T>) { let mut hit = false; match f { foo::arm::<T>(_x) => { println!("in arm"); hit = true; } } - assert!((hit)); + assert!(hit); } pub fn main() { altfoo::<isize>(foo::arm::<isize>(10)); } diff --git a/tests/ui/generics/issue-95208-ignore-qself.stderr b/tests/ui/generics/issue-95208-ignore-qself.stderr index 7d91fbc14a1..b9a5ffac274 100644 --- a/tests/ui/generics/issue-95208-ignore-qself.stderr +++ b/tests/ui/generics/issue-95208-ignore-qself.stderr @@ -6,8 +6,9 @@ LL | impl<T: Iterator> Struct<T> where <T as std:: iter::Iterator>::Item:: std:: | help: use single colon | -LL | impl<T: Iterator> Struct<T> where <T as std:: iter::Iterator>::Item: std::fmt::Display { - | ~ +LL - impl<T: Iterator> Struct<T> where <T as std:: iter::Iterator>::Item:: std::fmt::Display { +LL + impl<T: Iterator> Struct<T> where <T as std:: iter::Iterator>::Item: std::fmt::Display { + | error: aborting due to 1 previous error diff --git a/tests/ui/generics/issue-95208.stderr b/tests/ui/generics/issue-95208.stderr index e047f1265e2..0ff6c8be9fd 100644 --- a/tests/ui/generics/issue-95208.stderr +++ b/tests/ui/generics/issue-95208.stderr @@ -6,8 +6,9 @@ LL | impl<T> Struct<T> where T:: std::fmt::Display { | help: use single colon | -LL | impl<T> Struct<T> where T: std::fmt::Display { - | ~ +LL - impl<T> Struct<T> where T:: std::fmt::Display { +LL + impl<T> Struct<T> where T: std::fmt::Display { + | error: aborting due to 1 previous error diff --git a/tests/ui/generics/overlapping-errors-span-issue-123861.stderr b/tests/ui/generics/overlapping-errors-span-issue-123861.stderr index e0a49343b0e..9622dffda9f 100644 --- a/tests/ui/generics/overlapping-errors-span-issue-123861.stderr +++ b/tests/ui/generics/overlapping-errors-span-issue-123861.stderr @@ -33,8 +33,9 @@ LL | fn mainIterator<_ = _> {} | help: use type parameters instead | -LL | fn mainIterator<T = T> {} - | ~ ~ +LL - fn mainIterator<_ = _> {} +LL + fn mainIterator<T = T> {} + | error: aborting due to 4 previous errors diff --git a/tests/ui/generics/single-colon-path-not-const-generics.stderr b/tests/ui/generics/single-colon-path-not-const-generics.stderr index 4e695b2dcd6..c14a5e62a0c 100644 --- a/tests/ui/generics/single-colon-path-not-const-generics.stderr +++ b/tests/ui/generics/single-colon-path-not-const-generics.stderr @@ -1,8 +1,6 @@ error: path separator must be a double colon --> $DIR/single-colon-path-not-const-generics.rs:8:18 | -LL | pub struct Foo { - | --- while parsing this struct LL | a: Vec<foo::bar:A>, | ^ | @@ -10,7 +8,7 @@ LL | a: Vec<foo::bar:A>, help: use a double colon instead | LL | a: Vec<foo::bar::A>, - | + + | + error: aborting due to 1 previous error diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr index aa3d2cd2d90..ec0e09a302e 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr @@ -6,8 +6,9 @@ LL | ...X => {} | help: use `..=` instead | -LL | ..=X => {} - | ~~~ +LL - ...X => {} +LL + ..=X => {} + | error: range-to patterns with `...` are not allowed --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:16:9 @@ -17,8 +18,9 @@ LL | ...0 => {} | help: use `..=` instead | -LL | ..=0 => {} - | ~~~ +LL - ...0 => {} +LL + ..=0 => {} + | error: range-to patterns with `...` are not allowed --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:17:9 @@ -28,8 +30,9 @@ LL | ...'a' => {} | help: use `..=` instead | -LL | ..='a' => {} - | ~~~ +LL - ...'a' => {} +LL + ..='a' => {} + | error: range-to patterns with `...` are not allowed --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:18:9 @@ -39,8 +42,9 @@ LL | ...0.0f32 => {} | help: use `..=` instead | -LL | ..=0.0f32 => {} - | ~~~ +LL - ...0.0f32 => {} +LL + ..=0.0f32 => {} + | error: range-to patterns with `...` are not allowed --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:25:17 @@ -54,8 +58,9 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `..=` instead | -LL | let ..=$e; - | ~~~ +LL - let ...$e; +LL + let ..=$e; + | error[E0005]: refutable pattern in local binding --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:25:17 diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr index 83a374c3d65..2d70f75f2c6 100644 --- a/tests/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr +++ b/tests/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr @@ -76,8 +76,9 @@ LL | &...0 | _ => {} | help: use `..=` instead | -LL | &..=0 | _ => {} - | ~~~ +LL - &...0 | _ => {} +LL + &..=0 | _ => {} + | error: the range pattern here has ambiguous interpretation --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:20:10 diff --git a/tests/ui/hashmap/hashmap-index-mut.stderr b/tests/ui/hashmap/hashmap-index-mut.stderr index ad33c6f9b15..e8b22350c59 100644 --- a/tests/ui/hashmap/hashmap-index-mut.stderr +++ b/tests/ui/hashmap/hashmap-index-mut.stderr @@ -7,12 +7,15 @@ LL | map[&0] = 1; = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<u32, u32>` help: use `.insert()` to insert a value into a `HashMap<u32, u32>`, `.get_mut()` to modify it, or the entry API for more flexibility | -LL | map.insert(&0, 1); - | ~~~~~~~~ ~ + -LL | if let Some(val) = map.get_mut(&0) { *val = 1; }; - | ++++++++++++++++++ ~~~~~~~~~ ~~~~~~~~ +++ -LL | let val = map.entry(&0).or_insert(1); - | +++++++++ ~~~~~~~ ~~~~~~~~~~~~ + +LL - map[&0] = 1; +LL + map.insert(&0, 1); + | +LL - map[&0] = 1; +LL + if let Some(val) = map.get_mut(&0) { *val = 1; }; + | +LL - map[&0] = 1; +LL + let val = map.entry(&0).or_insert(1); + | error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.stderr b/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.stderr index 67417a5e525..be2eca3e61a 100644 --- a/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hang-on-deeply-nested-dyn.stderr @@ -11,7 +11,7 @@ LL | | ), LL | | ) { | |_- expected `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn Fn(u32) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a))` because of return type LL | f - | ^ expected `&dyn Fn(&dyn Fn(&dyn Fn(&...)))`, found `&dyn Fn(u32)` + | ^ expected `&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&...))))`, found `&dyn Fn(u32)` | = note: expected reference `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn Fn(u32) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a))` found reference `&dyn Fn(u32)` diff --git a/tests/ui/higher-ranked/trait-bounds/issue-58451.stderr b/tests/ui/higher-ranked/trait-bounds/issue-58451.stderr index 34d7db9b3cf..4f9fc0ac649 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-58451.stderr +++ b/tests/ui/higher-ranked/trait-bounds/issue-58451.stderr @@ -11,8 +11,9 @@ LL | fn f<I>(i: I) | ^ ---- help: provide the argument | -LL | f(&[f(/* i */)]); - | ~~~~~~~~~ +LL - f(&[f()]); +LL + f(&[f(/* i */)]); + | error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.rs b/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.rs index e70f6fc3430..c8963e078f0 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.rs +++ b/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.rs @@ -36,12 +36,10 @@ trait Ty<'a> { fn main() { let v = Unit2.m( - L { - //~^ ERROR to be a closure that returns `Unit3`, but it returns `Unit4` - //~| ERROR type mismatch + L { //~ ERROR type mismatch f: |x| { drop(x); - Unit4 + Unit4 //~ ERROR to return `Unit3`, but it returns `Unit4` }, }, ); diff --git a/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr b/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr index 74610b55dc3..4302570cdbd 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr +++ b/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr @@ -1,16 +1,15 @@ -error[E0271]: type mismatch resolving `<L<{closure@issue-62203-hrtb-ice.rs:42:16}> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V` +error[E0271]: type mismatch resolving `<L<{closure@issue-62203-hrtb-ice.rs:40:16}> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V` --> $DIR/issue-62203-hrtb-ice.rs:39:9 | LL | let v = Unit2.m( | - required by a bound introduced by this call LL | / L { -LL | | -LL | | LL | | f: |x| { -... | +LL | | drop(x); +LL | | Unit4 LL | | }, LL | | }, - | |_________^ type mismatch resolving `<L<{closure@issue-62203-hrtb-ice.rs:42:16}> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V` + | |_________^ type mismatch resolving `<L<{closure@issue-62203-hrtb-ice.rs:40:16}> as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V` | note: expected this to be `<_ as Ty<'_>>::V` --> $DIR/issue-62203-hrtb-ice.rs:21:14 @@ -30,21 +29,19 @@ LL | where LL | F: for<'r> T0<'r, (<Self as Ty<'r>>::V,), O = <B as Ty<'r>>::V>, | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` -error[E0271]: expected `{closure@issue-62203-hrtb-ice.rs:42:16}` to be a closure that returns `Unit3`, but it returns `Unit4` - --> $DIR/issue-62203-hrtb-ice.rs:39:9 - | -LL | let v = Unit2.m( - | - required by a bound introduced by this call -LL | / L { -LL | | -LL | | -LL | | f: |x| { -... | -LL | | }, -LL | | }, - | |_________^ expected `Unit3`, found `Unit4` - | -note: required for `L<{closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19}>` to implement `for<'r> T0<'r, (&'r u8,)>` +error[E0271]: expected `{closure@issue-62203-hrtb-ice.rs:40:16}` to return `Unit3`, but it returns `Unit4` + --> $DIR/issue-62203-hrtb-ice.rs:42:17 + | +LL | let v = Unit2.m( + | - required by a bound introduced by this call +LL | L { +LL | f: |x| { + | --- this closure +LL | drop(x); +LL | Unit4 + | ^^^^^ expected `Unit3`, found `Unit4` + | +note: required for `L<{closure@$DIR/issue-62203-hrtb-ice.rs:40:16: 40:19}>` to implement `for<'r> T0<'r, (&'r u8,)>` --> $DIR/issue-62203-hrtb-ice.rs:17:16 | LL | impl<'a, A, T> T0<'a, A> for L<T> diff --git a/tests/ui/higher-ranked/trait-bounds/span-bug-issue-121597.stderr b/tests/ui/higher-ranked/trait-bounds/span-bug-issue-121597.stderr index fc3d9c2171d..183ee678d7a 100644 --- a/tests/ui/higher-ranked/trait-bounds/span-bug-issue-121597.stderr +++ b/tests/ui/higher-ranked/trait-bounds/span-bug-issue-121597.stderr @@ -5,7 +5,7 @@ LL | let x: &dyn Foo = &(); | ^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/span-bug-issue-121597.rs:4:12 | LL | trait Foo: for<T> Bar<T> {} @@ -21,7 +21,7 @@ LL | let x: &dyn Foo = &(); | ^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/span-bug-issue-121597.rs:4:12 | LL | trait Foo: for<T> Bar<T> {} diff --git a/tests/ui/hygiene/globs.stderr b/tests/ui/hygiene/globs.stderr index 18017264440..3f7a0ae7efa 100644 --- a/tests/ui/hygiene/globs.stderr +++ b/tests/ui/hygiene/globs.stderr @@ -9,8 +9,9 @@ LL | f(); | help: a function with a similar name exists | -LL | g(); - | ~ +LL - f(); +LL + g(); + | help: consider importing this function | LL + use foo::f; @@ -35,8 +36,9 @@ LL | | } = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: a function with a similar name exists | -LL | f(); - | ~ +LL - g(); +LL + f(); + | help: consider importing this function | LL + use bar::g; diff --git a/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-dyn-trait.rs b/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-dyn-trait.rs index 046ced072ba..901d4b39cf3 100644 --- a/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-dyn-trait.rs +++ b/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-dyn-trait.rs @@ -20,7 +20,7 @@ impl DynIncompatible for B { } fn car() -> dyn DynIncompatible { //~ ERROR the trait `DynIncompatible` is not dyn compatible -//~^ ERROR return type cannot have an unboxed trait object +//~^ ERROR return type cannot be a trait object without pointer indirection if true { return A; } diff --git a/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-dyn-trait.stderr b/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-dyn-trait.stderr index 4abd7bcf31c..2c314b07bce 100644 --- a/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-dyn-trait.stderr +++ b/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-dyn-trait.stderr @@ -5,7 +5,7 @@ LL | fn car() -> dyn DynIncompatible { | ^^^^^^^^^^^^^^^^^^^ `DynIncompatible` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-incompatible-trait-in-return-position-dyn-trait.rs:4:8 | LL | trait DynIncompatible { @@ -26,6 +26,27 @@ help: alternatively, consider constraining `foo` so it does not apply to trait o LL | fn foo() -> Self where Self: Sized; | +++++++++++++++++ +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/dyn-incompatible-trait-in-return-position-dyn-trait.rs:22:13 + | +LL | fn car() -> dyn DynIncompatible { + | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL - fn car() -> dyn DynIncompatible { +LL + fn car() -> impl DynIncompatible { + | +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` + | +LL ~ fn car() -> Box<dyn DynIncompatible> { +LL | +LL | if true { +LL ~ return Box::new(A); +LL | } +LL ~ Box::new(B) + | + error[E0038]: the trait `DynIncompatible` is not dyn compatible --> $DIR/dyn-incompatible-trait-in-return-position-dyn-trait.rs:30:17 | @@ -33,7 +54,7 @@ LL | fn cat() -> Box<dyn DynIncompatible> { | ^^^^^^^^^^^^^^^^^^^ `DynIncompatible` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-incompatible-trait-in-return-position-dyn-trait.rs:4:8 | LL | trait DynIncompatible { @@ -54,23 +75,6 @@ help: alternatively, consider constraining `foo` so it does not apply to trait o LL | fn foo() -> Self where Self: Sized; | +++++++++++++++++ -error[E0746]: return type cannot have an unboxed trait object - --> $DIR/dyn-incompatible-trait-in-return-position-dyn-trait.rs:22:13 - | -LL | fn car() -> dyn DynIncompatible { - | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: if there were a single returned type, you could use `impl Trait` instead -help: box the return type, and wrap all of the returned values in `Box::new` - | -LL ~ fn car() -> Box<dyn DynIncompatible> { -LL | -LL | if true { -LL ~ return Box::new(A); -LL | } -LL ~ Box::new(B) - | - error[E0038]: the trait `DynIncompatible` is not dyn compatible --> $DIR/dyn-incompatible-trait-in-return-position-dyn-trait.rs:32:16 | @@ -78,7 +82,7 @@ LL | return Box::new(A); | ^^^^^^^^^^^ `DynIncompatible` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-incompatible-trait-in-return-position-dyn-trait.rs:4:8 | LL | trait DynIncompatible { @@ -107,7 +111,7 @@ LL | Box::new(B) | ^^^^^^^^^^^ `DynIncompatible` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-incompatible-trait-in-return-position-dyn-trait.rs:4:8 | LL | trait DynIncompatible { diff --git a/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.rs b/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.rs index af368203de0..ccf0a1ad3d4 100644 --- a/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.rs +++ b/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.rs @@ -6,9 +6,11 @@ impl Trait for u32 {} fn fuz() -> (usize, Trait) { (42, Struct) } //~^ ERROR E0277 +//~| ERROR E0277 //~| ERROR E0308 fn bar() -> (usize, dyn Trait) { (42, Struct) } //~^ ERROR E0277 +//~| ERROR E0277 //~| ERROR E0308 fn bap() -> Trait { Struct } //~^ ERROR E0746 diff --git a/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr b/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr index 9ed3d21c13c..304d7d43b78 100644 --- a/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr +++ b/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr @@ -1,49 +1,25 @@ -error[E0308]: mismatched types - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:7:35 - | -LL | fn fuz() -> (usize, Trait) { (42, Struct) } - | ^^^^^^ expected `dyn Trait`, found `Struct` - | - = note: expected trait object `(dyn Trait + 'static)` - found struct `Struct` - = help: `Struct` implements `Trait` so you could box the found value and coerce it to the trait object `Box<dyn Trait>`, you will have to change the expected type as well - error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time --> $DIR/dyn-trait-return-should-be-impl-trait.rs:7:13 | LL | fn fuz() -> (usize, Trait) { (42, Struct) } - | ^^^^^^^^^^^^^^ ------------ this returned value is of type `(usize, (dyn Trait + 'static))` - | | - | doesn't have a size known at compile-time + | ^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)` = note: required because it appears within the type `(usize, (dyn Trait + 'static))` = note: the return type of a function must have a statically known size -error[E0308]: mismatched types - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:10:39 - | -LL | fn bar() -> (usize, dyn Trait) { (42, Struct) } - | ^^^^^^ expected `dyn Trait`, found `Struct` - | - = note: expected trait object `(dyn Trait + 'static)` - found struct `Struct` - = help: `Struct` implements `Trait` so you could box the found value and coerce it to the trait object `Box<dyn Trait>`, you will have to change the expected type as well - error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:10:13 + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:11:13 | LL | fn bar() -> (usize, dyn Trait) { (42, Struct) } - | ^^^^^^^^^^^^^^^^^^ ------------ this returned value is of type `(usize, (dyn Trait + 'static))` - | | - | doesn't have a size known at compile-time + | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)` = note: required because it appears within the type `(usize, (dyn Trait + 'static))` = note: the return type of a function must have a statically known size -error[E0746]: return type cannot have an unboxed trait object - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:13:13 +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:15:13 | LL | fn bap() -> Trait { Struct } | ^^^^^ doesn't have a size known at compile-time @@ -57,44 +33,50 @@ help: alternatively, box the return type, and wrap all of the returned values in LL | fn bap() -> Box<dyn Trait> { Box::new(Struct) } | +++++++ + +++++++++ + -error[E0746]: return type cannot have an unboxed trait object - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:15:13 +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:17:13 | LL | fn ban() -> dyn Trait { Struct } | ^^^^^^^^^ doesn't have a size known at compile-time | help: consider returning an `impl Trait` instead of a `dyn Trait` | -LL | fn ban() -> impl Trait { Struct } - | ~~~~ +LL - fn ban() -> dyn Trait { Struct } +LL + fn ban() -> impl Trait { Struct } + | help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL | fn ban() -> Box<dyn Trait> { Box::new(Struct) } | ++++ + +++++++++ + -error[E0746]: return type cannot have an unboxed trait object - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:17:13 +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:19:13 | LL | fn bak() -> dyn Trait { unimplemented!() } | ^^^^^^^^^ doesn't have a size known at compile-time | help: consider returning an `impl Trait` instead of a `dyn Trait` | -LL | fn bak() -> impl Trait { unimplemented!() } - | ~~~~ +LL - fn bak() -> dyn Trait { unimplemented!() } +LL + fn bak() -> impl Trait { unimplemented!() } + | help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL | fn bak() -> Box<dyn Trait> { Box::new(unimplemented!()) } | ++++ + +++++++++ + -error[E0746]: return type cannot have an unboxed trait object - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:19:13 +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:21:13 | LL | fn bal() -> dyn Trait { | ^^^^^^^^^ doesn't have a size known at compile-time | - = help: if there were a single returned type, you could use `impl Trait` instead -help: box the return type, and wrap all of the returned values in `Box::new` +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL - fn bal() -> dyn Trait { +LL + fn bal() -> impl Trait { + | +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL ~ fn bal() -> Box<dyn Trait> { LL | if true { @@ -103,14 +85,18 @@ LL | } LL ~ Box::new(42) | -error[E0746]: return type cannot have an unboxed trait object - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:25:13 +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:27:13 | LL | fn bax() -> dyn Trait { | ^^^^^^^^^ doesn't have a size known at compile-time | - = help: if there were a single returned type, you could use `impl Trait` instead -help: box the return type, and wrap all of the returned values in `Box::new` +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL - fn bax() -> dyn Trait { +LL + fn bax() -> impl Trait { + | +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL ~ fn bax() -> Box<dyn Trait> { LL | if true { @@ -119,8 +105,88 @@ LL | } else { LL ~ Box::new(42) | +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:62:13 + | +LL | fn bat() -> dyn Trait { + | ^^^^^^^^^ doesn't have a size known at compile-time + | +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL - fn bat() -> dyn Trait { +LL + fn bat() -> impl Trait { + | +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` + | +LL ~ fn bat() -> Box<dyn Trait> { +LL | if true { +LL ~ return Box::new(0); +LL | } +LL ~ Box::new(42) + | + +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:68:13 + | +LL | fn bay() -> dyn Trait { + | ^^^^^^^^^ doesn't have a size known at compile-time + | +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL - fn bay() -> dyn Trait { +LL + fn bay() -> impl Trait { + | +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` + | +LL ~ fn bay() -> Box<dyn Trait> { +LL | if true { +LL ~ Box::new(0) +LL | } else { +LL ~ Box::new(42) + | + error[E0308]: mismatched types - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:34:16 + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:7:35 + | +LL | fn fuz() -> (usize, Trait) { (42, Struct) } + | ^^^^^^ expected `dyn Trait`, found `Struct` + | + = note: expected trait object `(dyn Trait + 'static)` + found struct `Struct` + = help: `Struct` implements `Trait` so you could box the found value and coerce it to the trait object `Box<dyn Trait>`, you will have to change the expected type as well + +error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:7:30 + | +LL | fn fuz() -> (usize, Trait) { (42, Struct) } + | ^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)` + = note: required because it appears within the type `(usize, (dyn Trait + 'static))` + = note: tuples must have a statically known size to be initialized + +error[E0308]: mismatched types + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:11:39 + | +LL | fn bar() -> (usize, dyn Trait) { (42, Struct) } + | ^^^^^^ expected `dyn Trait`, found `Struct` + | + = note: expected trait object `(dyn Trait + 'static)` + found struct `Struct` + = help: `Struct` implements `Trait` so you could box the found value and coerce it to the trait object `Box<dyn Trait>`, you will have to change the expected type as well + +error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:11:34 + | +LL | fn bar() -> (usize, dyn Trait) { (42, Struct) } + | ^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)` + = note: required because it appears within the type `(usize, (dyn Trait + 'static))` + = note: tuples must have a statically known size to be initialized + +error[E0308]: mismatched types + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:36:16 | LL | fn bam() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type @@ -137,7 +203,7 @@ LL | return Box::new(Struct); | +++++++++ + error[E0308]: mismatched types - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:36:5 + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:38:5 | LL | fn bam() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type @@ -154,7 +220,7 @@ LL | Box::new(42) | +++++++++ + error[E0308]: mismatched types - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:40:16 + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:42:16 | LL | fn baq() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type @@ -171,7 +237,7 @@ LL | return Box::new(0); | +++++++++ + error[E0308]: mismatched types - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:42:5 + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:44:5 | LL | fn baq() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type @@ -188,7 +254,7 @@ LL | Box::new(42) | +++++++++ + error[E0308]: mismatched types - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:46:9 + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:48:9 | LL | fn baz() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type @@ -205,7 +271,7 @@ LL | Box::new(Struct) | +++++++++ + error[E0308]: mismatched types - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:48:9 + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:50:9 | LL | fn baz() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type @@ -222,7 +288,7 @@ LL | Box::new(42) | +++++++++ + error[E0308]: mismatched types - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:53:9 + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:55:9 | LL | fn baw() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type @@ -239,7 +305,7 @@ LL | Box::new(0) | +++++++++ + error[E0308]: mismatched types - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:55:9 + --> $DIR/dyn-trait-return-should-be-impl-trait.rs:57:9 | LL | fn baw() -> Box<dyn Trait> { | -------------- expected `Box<(dyn Trait + 'static)>` because of return type @@ -255,45 +321,7 @@ help: store this in the heap by calling `Box::new` LL | Box::new(42) | +++++++++ + -error[E0746]: return type cannot have an unboxed trait object - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:60:13 - | -LL | fn bat() -> dyn Trait { - | ^^^^^^^^^ doesn't have a size known at compile-time - | -help: consider returning an `impl Trait` instead of a `dyn Trait` - | -LL | fn bat() -> impl Trait { - | ~~~~ -help: alternatively, box the return type, and wrap all of the returned values in `Box::new` - | -LL ~ fn bat() -> Box<dyn Trait> { -LL | if true { -LL ~ return Box::new(0); -LL | } -LL ~ Box::new(42) - | - -error[E0746]: return type cannot have an unboxed trait object - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:66:13 - | -LL | fn bay() -> dyn Trait { - | ^^^^^^^^^ doesn't have a size known at compile-time - | -help: consider returning an `impl Trait` instead of a `dyn Trait` - | -LL | fn bay() -> impl Trait { - | ~~~~ -help: alternatively, box the return type, and wrap all of the returned values in `Box::new` - | -LL ~ fn bay() -> Box<dyn Trait> { -LL | if true { -LL ~ Box::new(0) -LL | } else { -LL ~ Box::new(42) - | - -error: aborting due to 19 previous errors +error: aborting due to 21 previous errors Some errors have detailed explanations: E0277, E0308, E0746. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/equality.stderr b/tests/ui/impl-trait/equality.stderr index fd6f4b34241..8106bab9878 100644 --- a/tests/ui/impl-trait/equality.stderr +++ b/tests/ui/impl-trait/equality.stderr @@ -19,8 +19,9 @@ LL | 0_u32 | help: change the type of the numeric literal from `u32` to `i32` | -LL | 0_i32 - | ~~~ +LL - 0_u32 +LL + 0_i32 + | error[E0277]: cannot add `impl Foo` to `u32` --> $DIR/equality.rs:24:11 diff --git a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr index 3c24eb9adbe..ce64a022214 100644 --- a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr +++ b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr @@ -23,7 +23,19 @@ error[E0271]: type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> == ()` LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ -error: aborting due to 3 previous errors +error[E0271]: type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> normalizes-to _` + --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:28:73 + | +LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} + | ^^ types differ + +error[E0271]: type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> normalizes-to _` + --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:28:5 + | +LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ + +error: aborting due to 5 previous errors Some errors have detailed explanations: E0049, E0271, E0407. For more information about an error, try `rustc --explain E0049`. diff --git a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs index c97bd179943..cb32723b22d 100644 --- a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs +++ b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs @@ -26,9 +26,11 @@ impl X for Y { //~^ ERROR type `LineStream` has 0 type parameters but its trait declaration has 1 type parameter type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>; fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} - //[current]~^ ERROR `()` is not a future - //[next]~^^ ERROR type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> == ()` - //~^^^ method `line_stream` is not a member of trait `X` + //~^ method `line_stream` is not a member of trait `X` + //[current]~^^ ERROR `()` is not a future + //[next]~^^^ ERROR type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> == ()` + //[next]~| ERROR type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> normalizes-to _` + //[next]~| ERROR type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> normalizes-to _` } pub fn main() {} diff --git a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr index d0f8f7689d1..31f39eb9004 100644 --- a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr +++ b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr @@ -7,8 +7,9 @@ LL | fn d() -> impl Fn() -> (impl Debug + '_) { = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | fn d() -> impl Fn() -> (impl Debug + 'static) { - | ~~~~~~~ +LL - fn d() -> impl Fn() -> (impl Debug + '_) { +LL + fn d() -> impl Fn() -> (impl Debug + 'static) { + | warning: elided lifetime has a name --> $DIR/impl-fn-hrtb-bounds.rs:14:52 diff --git a/tests/ui/impl-trait/impl-fn-rpit-opaque-107883.rs b/tests/ui/impl-trait/impl-fn-rpit-opaque-107883.rs new file mode 100644 index 00000000000..3655bff63eb --- /dev/null +++ b/tests/ui/impl-trait/impl-fn-rpit-opaque-107883.rs @@ -0,0 +1,37 @@ +//@ check-pass +// Regression test for <https;//github.com/rust-lang/rust/issues/107883> +#![feature(impl_trait_in_fn_trait_return)] +#![feature(unboxed_closures)] // only for `h` + +use std::fmt::Debug; + +fn f<T>() -> impl Fn(T) -> impl Debug { + |_x| 15 +} + +fn g<T>() -> impl MyFn<(T,), Out = impl Debug> { + |_x| 15 +} + +trait MyFn<T> { + type Out; +} + +impl<T, U, F: Fn(T) -> U> MyFn<(T,)> for F { + type Out = U; +} + +fn h<T>() -> impl Fn<(T,), Output = impl Debug> { + |_x| 15 +} + +fn f_<T>() -> impl Fn(T) -> impl Debug { + std::convert::identity(|_x| 15) +} + +fn f__<T>() -> impl Fn(T) -> impl Debug { + let r = |_x| 15; + r +} + +fn main() {} diff --git a/tests/ui/impl-trait/impl-generic-mismatch-ab.stderr b/tests/ui/impl-trait/impl-generic-mismatch-ab.stderr index 90c31c9e3fc..9db996cf9ce 100644 --- a/tests/ui/impl-trait/impl-generic-mismatch-ab.stderr +++ b/tests/ui/impl-trait/impl-generic-mismatch-ab.stderr @@ -17,8 +17,9 @@ LL | fn foo<A: Debug>(&self, a: &A, b: &impl Debug); = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters help: change the parameter type to match the trait | -LL | fn foo<B: Debug>(&self, a: &B, b: &B) { } - | ~~ +LL - fn foo<B: Debug>(&self, a: &impl Debug, b: &B) { } +LL + fn foo<B: Debug>(&self, a: &B, b: &B) { } + | error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/impl-generic-mismatch.stderr b/tests/ui/impl-trait/impl-generic-mismatch.stderr index 973b65bfd62..18347bd0f97 100644 --- a/tests/ui/impl-trait/impl-generic-mismatch.stderr +++ b/tests/ui/impl-trait/impl-generic-mismatch.stderr @@ -24,8 +24,9 @@ LL | fn bar(&self, _: &impl Debug) { } | help: try changing the `impl Trait` argument to a generic parameter | -LL | fn bar<U: Debug>(&self, _: &U) { } - | ++++++++++ ~ +LL - fn bar(&self, _: &impl Debug) { } +LL + fn bar<U: Debug>(&self, _: &U) { } + | error[E0643]: method `baz` has incompatible signature for trait --> $DIR/impl-generic-mismatch.rs:26:33 @@ -38,8 +39,9 @@ LL | fn baz<T: Debug>(&self, _: &impl Debug, _: &T) { } | help: try changing the `impl Trait` argument to a generic parameter | -LL | fn baz<U: Debug, T: Debug>(&self, _: &T, _: &T) { } - | ~~~~~~~~~~~~~~~~~~~~ ~ +LL - fn baz<T: Debug>(&self, _: &impl Debug, _: &T) { } +LL + fn baz<U: Debug, T: Debug>(&self, _: &T, _: &T) { } + | error[E0643]: method `hash` has incompatible signature for trait --> $DIR/impl-generic-mismatch.rs:37:33 diff --git a/tests/ui/impl-trait/impl-trait-in-macro.stderr b/tests/ui/impl-trait/impl-trait-in-macro.stderr index 4380f47c5de..2f934694f83 100644 --- a/tests/ui/impl-trait/impl-trait-in-macro.stderr +++ b/tests/ui/impl-trait/impl-trait-in-macro.stderr @@ -12,8 +12,8 @@ LL | let mut a = x; LL | a = y; | ^ expected type parameter `impl Debug`, found a different type parameter `impl Debug` | - = note: expected type parameter `impl Debug` (type parameter `impl Debug`) - found type parameter `impl Debug` (type parameter `impl Debug`) + = note: expected type parameter `impl Debug` + found type parameter `impl Debug` = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters diff --git a/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr b/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr index 75cbe43eeb4..8351175099c 100644 --- a/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr +++ b/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr @@ -43,8 +43,9 @@ LL | fn method() -> () {} | ^^^^^^ help: change the output type to match the trait | -LL | fn method() -> <() as compare_method::Trait>::Ty {} - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn method() -> () {} +LL + fn method() -> <() as compare_method::Trait>::Ty {} + | error: unconstrained opaque type --> $DIR/in-assoc-type-unconstrained.rs:20:19 diff --git a/tests/ui/impl-trait/in-trait/alias-bounds-when-not-wf.stderr b/tests/ui/impl-trait/in-trait/alias-bounds-when-not-wf.stderr index 1cfc2a6d944..a95670ced86 100644 --- a/tests/ui/impl-trait/in-trait/alias-bounds-when-not-wf.stderr +++ b/tests/ui/impl-trait/in-trait/alias-bounds-when-not-wf.stderr @@ -18,6 +18,11 @@ help: this trait has no implementations, consider adding one | LL | trait Foo {} | ^^^^^^^^^ +note: required by a bound in `A` + --> $DIR/alias-bounds-when-not-wf.rs:8:11 + | +LL | type A<T: Foo> = T; + | ^^^ required by this bound in `A` error[E0277]: the trait bound `usize: Foo` is not satisfied --> $DIR/alias-bounds-when-not-wf.rs:16:10 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 022df6f906c..d3729b6c973 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 @@ -9,8 +9,10 @@ LL | 'b: 'a; | help: copy the `where` clause predicates from the trait | -LL | where Self: 'b; - | ~~~~~~~~~~~~~~ +LL - where +LL - 'b: 'a; +LL + where Self: 'b; + | warning: impl trait in impl method signature does not match trait method signature --> $DIR/bad-item-bound-within-rpitit.rs:18:28 @@ -26,8 +28,9 @@ LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> { = note: `#[warn(refining_impl_trait_reachable)]` on by default help: replace the return type so that it matches the trait | -LL | fn iter(&self) -> impl Iterator<Item = <Self as Iterable>::Item<'_>> + '_ { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> { +LL + fn iter(&self) -> impl Iterator<Item = <Self as Iterable>::Item<'_>> + '_ { + | error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/impl-trait/in-trait/cycle-effective-visibilities-during-dyn-compatibility-check.stderr b/tests/ui/impl-trait/in-trait/cycle-effective-visibilities-during-dyn-compatibility-check.stderr index 44ca09150fe..61fe9432a1e 100644 --- a/tests/ui/impl-trait/in-trait/cycle-effective-visibilities-during-dyn-compatibility-check.stderr +++ b/tests/ui/impl-trait/in-trait/cycle-effective-visibilities-during-dyn-compatibility-check.stderr @@ -15,7 +15,7 @@ LL | MyTrait::foo(&self) | ^^^^^^^^^^^^ `MyTrait` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/cycle-effective-visibilities-during-dyn-compatibility-check.rs:5:22 | LL | trait MyTrait { @@ -40,7 +40,7 @@ LL | impl dyn MyTrait { | ^^^^^^^^^^^ `MyTrait` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/cycle-effective-visibilities-during-dyn-compatibility-check.rs:5:22 | LL | trait MyTrait { @@ -57,7 +57,7 @@ LL | fn other(&self) -> impl Marker { | ^^^^ `MyTrait` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/cycle-effective-visibilities-during-dyn-compatibility-check.rs:5:22 | LL | trait MyTrait { diff --git a/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs b/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs index c1a78bc2388..1bbff839ffa 100644 --- a/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs +++ b/tests/ui/impl-trait/in-trait/default-body-with-rpit.rs @@ -1,5 +1,8 @@ //@ edition:2021 //@ check-pass +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver use std::fmt::Debug; diff --git a/tests/ui/impl-trait/in-trait/dont-consider-unconstrained-rpitits.rs b/tests/ui/impl-trait/in-trait/dont-consider-unconstrained-rpitits.rs new file mode 100644 index 00000000000..fe73306966e --- /dev/null +++ b/tests/ui/impl-trait/in-trait/dont-consider-unconstrained-rpitits.rs @@ -0,0 +1,14 @@ +// There's a suggestion that turns `Iterator<u32>` into `Iterator<Item = u32>` +// if we have more generics than the trait wants. Let's not consider RPITITs +// for this, since that makes no sense right now. + +trait Foo { + fn bar(self) -> impl Sized; +} + +impl Foo<u8> for () { + //~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied + fn bar(self) -> impl Sized {} +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/dont-consider-unconstrained-rpitits.stderr b/tests/ui/impl-trait/in-trait/dont-consider-unconstrained-rpitits.stderr new file mode 100644 index 00000000000..fb497b89c5f --- /dev/null +++ b/tests/ui/impl-trait/in-trait/dont-consider-unconstrained-rpitits.stderr @@ -0,0 +1,17 @@ +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/dont-consider-unconstrained-rpitits.rs:9:6 + | +LL | impl Foo<u8> for () { + | ^^^---- help: remove the unnecessary generics + | | + | expected 0 generic arguments + | +note: trait defined here, with 0 generic parameters + --> $DIR/dont-consider-unconstrained-rpitits.rs:5:7 + | +LL | trait Foo { + | ^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/impl-trait/in-trait/dump.rs b/tests/ui/impl-trait/in-trait/dump.rs new file mode 100644 index 00000000000..47198d51150 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/dump.rs @@ -0,0 +1,15 @@ +//@ compile-flags: -Zverbose-internals + +#![feature(precise_capturing_in_traits, rustc_attrs)] +#![rustc_hidden_type_of_opaques] + +trait Foo { + fn hello(&self) -> impl Sized; +} + +fn hello<'s, T: Foo>(x: &'s T) -> impl Sized + use<'s, T> { +//~^ ERROR <T as Foo>::{synthetic#0}<'s/#1> + x.hello() +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/dump.stderr b/tests/ui/impl-trait/in-trait/dump.stderr new file mode 100644 index 00000000000..95805840385 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/dump.stderr @@ -0,0 +1,8 @@ +error: <T as Foo>::{synthetic#0}<'s/#1> + --> $DIR/dump.rs:10:35 + | +LL | fn hello<'s, T: Foo>(x: &'s T) -> impl Sized + use<'s, T> { + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/impl-trait/in-trait/dyn-compatibility.stderr b/tests/ui/impl-trait/in-trait/dyn-compatibility.stderr index 87a5480b1e3..840c27e183f 100644 --- a/tests/ui/impl-trait/in-trait/dyn-compatibility.stderr +++ b/tests/ui/impl-trait/in-trait/dyn-compatibility.stderr @@ -5,7 +5,7 @@ LL | let i = Box::new(42_u32) as Box<dyn Foo>; | ^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-compatibility.rs:4:22 | LL | trait Foo { @@ -22,7 +22,7 @@ LL | let s = i.baz(); | ^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-compatibility.rs:4:22 | LL | trait Foo { @@ -39,7 +39,7 @@ LL | let s = i.baz(); | ^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-compatibility.rs:4:22 | LL | trait Foo { @@ -56,7 +56,7 @@ LL | let i = Box::new(42_u32) as Box<dyn Foo>; | ^^^^^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-compatibility.rs:4:22 | LL | trait Foo { 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 94f068cabaa..b7797317ea6 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 @@ -12,8 +12,9 @@ LL | fn bar(&self) -> impl Iterator + '_ { = note: `#[warn(refining_impl_trait_internal)]` on by default help: replace the return type so that it matches the trait | -LL | fn bar(&self) -> impl Iterator<Item = impl Sized> + '_ { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn bar(&self) -> impl Iterator + '_ { +LL + fn bar(&self) -> impl Iterator<Item = impl Sized> + '_ { + | warning: 1 warning emitted diff --git a/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr b/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr index 07d09468b04..29235ca78a5 100644 --- a/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr +++ b/tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr @@ -5,7 +5,7 @@ LL | let _: &dyn rpitit::Foo = todo!(); | ^^^^^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/auxiliary/rpitit.rs:4:21 | LL | fn bar(self) -> impl Deref<Target = impl Sized>; diff --git a/tests/ui/impl-trait/in-trait/foreign.stderr b/tests/ui/impl-trait/in-trait/foreign.stderr index 36114dcf02b..8801ccc68b3 100644 --- a/tests/ui/impl-trait/in-trait/foreign.stderr +++ b/tests/ui/impl-trait/in-trait/foreign.stderr @@ -14,8 +14,9 @@ LL | #[warn(refining_impl_trait)] = note: `#[warn(refining_impl_trait_internal)]` implied by `#[warn(refining_impl_trait)]` help: replace the return type so that it matches the trait | -LL | fn bar(self) -> impl Deref<Target = impl Sized> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn bar(self) -> Arc<String> { +LL + fn bar(self) -> impl Deref<Target = impl Sized> { + | warning: impl trait in impl method signature does not match trait method signature --> $DIR/foreign.rs:31:21 @@ -32,8 +33,9 @@ LL | #[warn(refining_impl_trait)] | ^^^^^^^^^^^^^^^^^^^ help: replace the return type so that it matches the trait | -LL | fn bar(self) -> impl Deref<Target = impl Sized> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn bar(self) -> Arc<String> { +LL + fn bar(self) -> impl Deref<Target = impl Sized> { + | warning: 2 warnings emitted diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr index a23879eb6c3..97f5b2af862 100644 --- a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr +++ b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr @@ -15,8 +15,9 @@ LL | fn early<'early, T>(x: &'early T) -> impl Sized; found signature `fn(&())` help: change the parameter type to match the trait | -LL | fn early<'late, T>(_: &'early T) {} - | ~~~~~~~~~ +LL - fn early<'late, T>(_: &'late ()) {} +LL + fn early<'late, T>(_: &'early T) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr index 9e18517e48c..588b4537610 100644 --- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr +++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr @@ -13,8 +13,9 @@ LL | fn owo(x: ()) -> impl Sized; found signature `fn(u8)` help: change the parameter type to match the trait | -LL | fn owo(_: ()) {} - | ~~ +LL - fn owo(_: u8) {} +LL + fn owo(_: ()) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr index c01d7322d11..b0530045bea 100644 --- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr +++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr @@ -13,8 +13,9 @@ LL | async fn owo(x: ()) {} found signature `fn(u8) -> _` help: change the parameter type to match the trait | -LL | async fn owo(_: ()) {} - | ~~ +LL - async fn owo(_: u8) {} +LL + async fn owo(_: ()) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs b/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs index 10c2a811243..6954a7d8067 100644 --- a/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs +++ b/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs @@ -1,4 +1,7 @@ //@ check-pass +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver use std::ops::Deref; diff --git a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr index 81570781b27..d575fedbb58 100644 --- a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr +++ b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr @@ -86,8 +86,9 @@ LL | fn bar() -> Wrapper<impl Sized>; found signature `fn() -> i32` help: change the output type to match the trait | -LL | fn bar() -> Wrapper<'static> { - | ~~~~~~~~~~~~~~~~ +LL - fn bar() -> i32 { +LL + fn bar() -> Wrapper<'static> { + | error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/opaque-and-lifetime-mismatch.rs:24:17 diff --git a/tests/ui/impl-trait/in-trait/refine-captures.stderr b/tests/ui/impl-trait/in-trait/refine-captures.stderr index ad2c2a11601..8a5c8d3c77b 100644 --- a/tests/ui/impl-trait/in-trait/refine-captures.stderr +++ b/tests/ui/impl-trait/in-trait/refine-captures.stderr @@ -9,8 +9,9 @@ LL | fn test() -> impl Sized + use<> {} = note: `#[warn(refining_impl_trait_internal)]` on by default help: modify the `use<..>` bound to capture the same lifetimes that the trait does | -LL | fn test() -> impl Sized + use<'a> {} - | ~~~~~~~ +LL - fn test() -> impl Sized + use<> {} +LL + fn test() -> impl Sized + use<'a> {} + | warning: impl trait in impl method captures fewer lifetimes than in trait --> $DIR/refine-captures.rs:22:31 @@ -22,8 +23,9 @@ LL | fn test() -> impl Sized + use<> {} = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information help: modify the `use<..>` bound to capture the same lifetimes that the trait does | -LL | fn test() -> impl Sized + use<'a> {} - | ~~~~~~~ +LL - fn test() -> impl Sized + use<> {} +LL + fn test() -> impl Sized + use<'a> {} + | warning: impl trait in impl method captures fewer lifetimes than in trait --> $DIR/refine-captures.rs:27:31 @@ -35,8 +37,9 @@ LL | fn test() -> impl Sized + use<'b> {} = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information help: modify the `use<..>` bound to capture the same lifetimes that the trait does | -LL | fn test() -> impl Sized + use<'a, 'b> {} - | ~~~~~~~~~~~ +LL - fn test() -> impl Sized + use<'b> {} +LL + fn test() -> impl Sized + use<'a, 'b> {} + | error: `impl Trait` must mention all type parameters in scope in `use<...>` --> $DIR/refine-captures.rs:32:18 diff --git a/tests/ui/impl-trait/in-trait/refine.stderr b/tests/ui/impl-trait/in-trait/refine.stderr index 8d30b035921..e381ef8c3f7 100644 --- a/tests/ui/impl-trait/in-trait/refine.stderr +++ b/tests/ui/impl-trait/in-trait/refine.stderr @@ -17,8 +17,9 @@ LL | #![deny(refining_impl_trait)] = note: `#[deny(refining_impl_trait_reachable)]` implied by `#[deny(refining_impl_trait)]` help: replace the return type so that it matches the trait | -LL | fn bar() -> impl Sized {} - | ~~~~~~~~~~ +LL - fn bar() -> impl Copy {} +LL + fn bar() -> impl Sized {} + | error: impl trait in impl method signature does not match trait method signature --> $DIR/refine.rs:15:5 @@ -49,8 +50,9 @@ LL | fn bar() -> () {} = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information help: replace the return type so that it matches the trait | -LL | fn bar() -> impl Sized {} - | ~~~~~~~~~~ +LL - fn bar() -> () {} +LL + fn bar() -> impl Sized {} + | error: impl trait in impl method signature does not match trait method signature --> $DIR/refine.rs:27:17 @@ -66,8 +68,9 @@ LL | fn bar() -> () {} = note: `#[deny(refining_impl_trait_internal)]` implied by `#[deny(refining_impl_trait)]` help: replace the return type so that it matches the trait | -LL | fn bar() -> impl Sized {} - | ~~~~~~~~~~ +LL - fn bar() -> () {} +LL + fn bar() -> impl Sized {} + | error: impl trait in impl method signature does not match trait method signature --> $DIR/refine.rs:35:17 @@ -82,8 +85,9 @@ LL | fn bar() -> () {} = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information help: replace the return type so that it matches the trait | -LL | fn bar() -> impl Sized {} - | ~~~~~~~~~~ +LL - fn bar() -> () {} +LL + fn bar() -> impl Sized {} + | error: impl trait in impl method signature does not match trait method signature --> $DIR/refine.rs:45:27 @@ -98,8 +102,9 @@ LL | fn bar(&self) -> impl Copy + '_ {} = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information help: replace the return type so that it matches the trait | -LL | fn bar(&self) -> impl Sized + '_ {} - | ~~~~~~~~~~~~~~~ +LL - fn bar(&self) -> impl Copy + '_ {} +LL + fn bar(&self) -> impl Sized + '_ {} + | error: impl trait in impl method signature does not match trait method signature --> $DIR/refine.rs:56:9 diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr index 15bef5c78b0..dfcf11c57dd 100644 --- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr +++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr @@ -9,7 +9,9 @@ LL | 'a: 'static, | help: copy the `where` clause predicates from the trait | -LL | where 'a: 'a +LL - where +LL - 'a: 'static, +LL + where 'a: 'a | error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.stderr index 8c9f2656015..fbbe1ac40b9 100644 --- a/tests/ui/impl-trait/in-trait/specialization-broken.stderr +++ b/tests/ui/impl-trait/in-trait/specialization-broken.stderr @@ -16,8 +16,9 @@ LL | fn bar(&self) -> impl Sized; found signature `fn(&_) -> U` help: change the output type to match the trait | -LL | fn bar(&self) -> impl Sized { - | ~~~~~~~~~~ +LL - fn bar(&self) -> U { +LL + fn bar(&self) -> impl Sized { + | error: method with return-position `impl Trait` in trait cannot be specialized --> $DIR/specialization-broken.rs:15:5 diff --git a/tests/ui/impl-trait/issues/issue-62742.stderr b/tests/ui/impl-trait/issues/issue-62742.stderr index 98d17b02536..ee4eb98f4ea 100644 --- a/tests/ui/impl-trait/issues/issue-62742.stderr +++ b/tests/ui/impl-trait/issues/issue-62742.stderr @@ -1,3 +1,17 @@ +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<_>` + | + = help: the trait `Raw<_>` is not implemented for `RawImpl<_>` + but trait `Raw<[_]>` is implemented for it +note: required by a bound in `SafeImpl` + --> $DIR/issue-62742.rs:33:35 + | +LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>); + | ^^^^^^ required by this bound in `SafeImpl` + error[E0599]: the function or associated item `foo` exists for struct `SafeImpl<_, RawImpl<_>>`, but its trait bounds were not satisfied --> $DIR/issue-62742.rs:4:16 | @@ -23,14 +37,15 @@ note: the trait `Raw` must be implemented LL | pub trait Raw<T: ?Sized> { | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied - --> $DIR/issue-62742.rs:4:5 +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<_>` +LL | WrongImpl::<()>::foo(0i32); + | ^^^^^^^^^^^^^^^ the trait `Raw<()>` is not implemented for `RawImpl<()>` | - = help: the trait `Raw<_>` is not implemented for `RawImpl<_>` - but trait `Raw<[_]>` is implemented for it + = help: the trait `Raw<()>` is not implemented for `RawImpl<()>` + but trait `Raw<[()]>` is implemented for it + = help: for that trait implementation, expected `[()]`, found `()` note: required by a bound in `SafeImpl` --> $DIR/issue-62742.rs:33:35 | @@ -62,21 +77,6 @@ note: the trait `Raw` must be implemented LL | pub trait Raw<T: ?Sized> { | ^^^^^^^^^^^^^^^^^^^^^^^^ -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<()>` - | - = help: the trait `Raw<()>` is not implemented for `RawImpl<()>` - but trait `Raw<[()]>` is implemented for it - = help: for that trait implementation, expected `[()]`, found `()` -note: required by a bound in `SafeImpl` - --> $DIR/issue-62742.rs:33:35 - | -LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>); - | ^^^^^^ required by this bound in `SafeImpl` - error: aborting due to 4 previous errors Some errors have detailed explanations: E0277, E0599. diff --git a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr index f620bf6dc38..46561b66c8e 100644 --- a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr +++ b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr @@ -36,12 +36,14 @@ LL | fn elided2(x: &i32) -> impl Copy + 'static { x } | help: consider changing `impl Copy + 'static`'s explicit `'static` bound to the lifetime of argument `x` | -LL | fn elided2(x: &i32) -> impl Copy + '_ { x } - | ~~ +LL - fn elided2(x: &i32) -> impl Copy + 'static { x } +LL + fn elided2(x: &i32) -> impl Copy + '_ { x } + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn elided2(x: &'static i32) -> impl Copy + 'static { x } - | ~~~~~~~~~~~~ +LL - fn elided2(x: &i32) -> impl Copy + 'static { x } +LL + fn elided2(x: &'static i32) -> impl Copy + 'static { x } + | error: lifetime may not live long enough --> $DIR/must_outlive_least_region_or_bound.rs:12:55 @@ -51,12 +53,14 @@ LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x } | help: consider changing `impl Copy + 'static`'s explicit `'static` bound to the lifetime of argument `x` | -LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'a { x } - | ~~ +LL - fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x } +LL + fn explicit2<'a>(x: &'a i32) -> impl Copy + 'a { x } + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn explicit2<'a>(x: &'static i32) -> impl Copy + 'static { x } - | ~~~~~~~~~~~~ +LL - fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x } +LL + fn explicit2<'a>(x: &'static i32) -> impl Copy + 'static { x } + | error[E0621]: explicit lifetime required in the type of `x` --> $DIR/must_outlive_least_region_or_bound.rs:15:41 @@ -91,12 +95,14 @@ LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x } | help: consider changing `impl LifetimeTrait<'a> + 'static`'s explicit `'static` bound to the lifetime of argument `x` | -LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'a { x } - | ~~ +LL - fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x } +LL + fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'a { x } + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn with_bound<'a>(x: &'static i32) -> impl LifetimeTrait<'a> + 'static { x } - | ~~~~~~~~~~~~ +LL - fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x } +LL + fn with_bound<'a>(x: &'static i32) -> impl LifetimeTrait<'a> + 'static { x } + | error[E0700]: hidden type for `impl Fn(&'a u32)` captures lifetime that does not appear in bounds --> $DIR/must_outlive_least_region_or_bound.rs:42:5 @@ -161,12 +167,14 @@ LL | fn elided4(x: &i32) -> Box<dyn Debug + 'static> { Box::new(x) } | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `x` | -LL | fn elided4(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) } - | ~~ +LL - fn elided4(x: &i32) -> Box<dyn Debug + 'static> { Box::new(x) } +LL + fn elided4(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) } + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn elided4(x: &'static i32) -> Box<dyn Debug + 'static> { Box::new(x) } - | ~~~~~~~~~~~~ +LL - fn elided4(x: &i32) -> Box<dyn Debug + 'static> { Box::new(x) } +LL + fn elided4(x: &'static i32) -> Box<dyn Debug + 'static> { Box::new(x) } + | error: lifetime may not live long enough --> $DIR/must_outlive_least_region_or_bound.rs:27:60 @@ -176,12 +184,14 @@ LL | fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'static> { Box::new(x) } | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `x` | -LL | fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'a> { Box::new(x) } - | ~~ +LL - fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'static> { Box::new(x) } +LL + fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'a> { Box::new(x) } + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn explicit4<'a>(x: &'static i32) -> Box<dyn Debug + 'static> { Box::new(x) } - | ~~~~~~~~~~~~ +LL - fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'static> { Box::new(x) } +LL + fn explicit4<'a>(x: &'static i32) -> Box<dyn Debug + 'static> { Box::new(x) } + | error: aborting due to 13 previous errors diff --git a/tests/ui/impl-trait/no-method-suggested-traits.stderr b/tests/ui/impl-trait/no-method-suggested-traits.stderr index 676247d1a42..0a974668188 100644 --- a/tests/ui/impl-trait/no-method-suggested-traits.stderr +++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr @@ -18,7 +18,7 @@ LL + use no_method_suggested_traits::qux::PrivPub; help: there is a method `method2` with a similar name | LL | 1u32.method2(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for struct `Rc<&mut Box<&u32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:26:44 @@ -40,7 +40,7 @@ LL + use no_method_suggested_traits::qux::PrivPub; help: there is a method `method2` with a similar name | LL | std::rc::Rc::new(&mut Box::new(&1u32)).method2(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for type `char` in the current scope --> $DIR/no-method-suggested-traits.rs:30:9 @@ -59,7 +59,7 @@ LL + use foo::Bar; help: there is a method `method2` with a similar name | LL | 'a'.method2(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for struct `Rc<&mut Box<&char>>` in the current scope --> $DIR/no-method-suggested-traits.rs:32:43 @@ -75,7 +75,7 @@ LL + use foo::Bar; help: there is a method `method2` with a similar name | LL | std::rc::Rc::new(&mut Box::new(&'a')).method2(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for type `i32` in the current scope --> $DIR/no-method-suggested-traits.rs:35:10 @@ -96,7 +96,7 @@ LL + use no_method_suggested_traits::foo::PubPub; help: there is a method `method3` with a similar name | LL | 1i32.method3(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for struct `Rc<&mut Box<&i32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:37:44 @@ -112,7 +112,7 @@ LL + use no_method_suggested_traits::foo::PubPub; help: there is a method `method3` with a similar name | LL | std::rc::Rc::new(&mut Box::new(&1i32)).method3(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for struct `Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:40:9 diff --git a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr index 6f0f287fe12..4198095db65 100644 --- a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr +++ b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr @@ -7,8 +7,9 @@ LL | fn frob() -> impl Fn<P, Output = T> + '_ {} = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | fn frob() -> impl Fn<P, Output = T> + 'static {} - | ~~~~~~~ +LL - fn frob() -> impl Fn<P, Output = T> + '_ {} +LL + fn frob() -> impl Fn<P, Output = T> + 'static {} + | error[E0412]: cannot find type `P` in this scope --> $DIR/opaque-used-in-extraneous-argument.rs:5:22 diff --git a/tests/ui/impl-trait/opt-out-bound-not-satisfied.rs b/tests/ui/impl-trait/opt-out-bound-not-satisfied.rs new file mode 100644 index 00000000000..27c493a13bf --- /dev/null +++ b/tests/ui/impl-trait/opt-out-bound-not-satisfied.rs @@ -0,0 +1,11 @@ +//! Regression test for ICE https://github.com/rust-lang/rust/issues/135730 +//! This used + +use std::future::Future; +fn foo() -> impl ?Future<Output = impl Send> { + //~^ ERROR: relaxing a default bound only does something for `?Sized` + //~| ERROR: relaxing a default bound only does something for `?Sized` + () +} + +pub fn main() {} diff --git a/tests/ui/impl-trait/opt-out-bound-not-satisfied.stderr b/tests/ui/impl-trait/opt-out-bound-not-satisfied.stderr new file mode 100644 index 00000000000..dc4314c58ad --- /dev/null +++ b/tests/ui/impl-trait/opt-out-bound-not-satisfied.stderr @@ -0,0 +1,16 @@ +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/opt-out-bound-not-satisfied.rs:5:18 + | +LL | fn foo() -> impl ?Future<Output = impl Send> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/opt-out-bound-not-satisfied.rs:5:18 + | +LL | fn foo() -> impl ?Future<Output = impl Send> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.rs b/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.rs index a8a6288eb56..719edd525de 100644 --- a/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.rs +++ b/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.rs @@ -63,7 +63,7 @@ fn dog() -> impl std::fmt::Display { } } -fn hat() -> dyn std::fmt::Display { //~ ERROR return type cannot have an unboxed trait object +fn hat() -> dyn std::fmt::Display { //~ ERROR return type cannot be a trait object without pointer indirection match 13 { 0 => { return 0i32; @@ -74,7 +74,7 @@ fn hat() -> dyn std::fmt::Display { //~ ERROR return type cannot have an unboxed } } -fn pug() -> dyn std::fmt::Display { //~ ERROR return type cannot have an unboxed trait object +fn pug() -> dyn std::fmt::Display { //~ ERROR return type cannot be a trait object without pointer indirection match 13 { 0 => 0i32, 1 => 1u32, @@ -82,7 +82,7 @@ fn pug() -> dyn std::fmt::Display { //~ ERROR return type cannot have an unboxed } } -fn man() -> dyn std::fmt::Display { //~ ERROR return type cannot have an unboxed trait object +fn man() -> dyn std::fmt::Display { //~ ERROR return type cannot be a trait object without pointer indirection if false { 0i32 } else { diff --git a/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr b/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr index 54849c112f5..b2aa0e592df 100644 --- a/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr +++ b/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr @@ -1,3 +1,65 @@ +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:66:13 + | +LL | fn hat() -> dyn std::fmt::Display { + | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL - fn hat() -> dyn std::fmt::Display { +LL + fn hat() -> impl std::fmt::Display { + | +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` + | +LL ~ fn hat() -> Box<dyn std::fmt::Display> { +LL | match 13 { +LL | 0 => { +LL ~ return Box::new(0i32); +LL | } +LL | _ => { +LL ~ Box::new(1u32) + | + +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:77:13 + | +LL | fn pug() -> dyn std::fmt::Display { + | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL - fn pug() -> dyn std::fmt::Display { +LL + fn pug() -> impl std::fmt::Display { + | +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` + | +LL ~ fn pug() -> Box<dyn std::fmt::Display> { +LL | match 13 { +LL ~ 0 => Box::new(0i32), +LL ~ 1 => Box::new(1u32), +LL ~ _ => Box::new(2u32), + | + +error[E0746]: return type cannot be a trait object without pointer indirection + --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:85:13 + | +LL | fn man() -> dyn std::fmt::Display { + | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +help: consider returning an `impl Trait` instead of a `dyn Trait` + | +LL - fn man() -> dyn std::fmt::Display { +LL + fn man() -> impl std::fmt::Display { + | +help: alternatively, box the return type, and wrap all of the returned values in `Box::new` + | +LL ~ fn man() -> Box<dyn std::fmt::Display> { +LL | if false { +LL ~ Box::new(0i32) +LL | } else { +LL ~ Box::new(1u32) + | + error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:5:5 | @@ -9,8 +71,9 @@ LL | 1u32 | help: change the type of the numeric literal from `u32` to `i32` | -LL | 1i32 - | ~~~ +LL - 1u32 +LL + 1i32 + | error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:12:16 @@ -23,8 +86,9 @@ LL | return 1u32; | help: change the type of the numeric literal from `u32` to `i32` | -LL | return 1i32; - | ~~~ +LL - return 1u32; +LL + return 1i32; + | error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:20:9 @@ -54,8 +118,9 @@ LL | | } | help: you could change the return type to be a boxed trait object | -LL | fn qux() -> Box<dyn std::fmt::Display> { - | ~~~~~~~ + +LL - fn qux() -> impl std::fmt::Display { +LL + fn qux() -> Box<dyn std::fmt::Display> { + | help: if you change the return type to expect trait objects, box the returned expressions | LL ~ Box::new(0i32) @@ -64,8 +129,9 @@ LL ~ Box::new(1u32) | help: change the type of the numeric literal from `u32` to `i32` | -LL | 1i32 - | ~~~ +LL - 1u32 +LL + 1i32 + | error[E0308]: mismatched types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:35:14 @@ -126,8 +192,9 @@ LL | | } | help: you could change the return type to be a boxed trait object | -LL | fn dog() -> Box<dyn std::fmt::Display> { - | ~~~~~~~ + +LL - fn dog() -> impl std::fmt::Display { +LL + fn dog() -> Box<dyn std::fmt::Display> { + | help: if you change the return type to expect trait objects, box the returned expressions | LL ~ 0 => Box::new(0i32), @@ -135,8 +202,9 @@ LL ~ 1 => Box::new(1u32), | help: change the type of the numeric literal from `u32` to `i32` | -LL | 1 => 1i32, - | ~~~ +LL - 1 => 1u32, +LL + 1 => 1i32, + | error[E0308]: `if` and `else` have incompatible types --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:97:9 @@ -152,8 +220,9 @@ LL | | } | help: you could change the return type to be a boxed trait object | -LL | fn apt() -> Box<dyn std::fmt::Display> { - | ~~~~~~~ + +LL - fn apt() -> impl std::fmt::Display { +LL + fn apt() -> Box<dyn std::fmt::Display> { + | help: if you change the return type to expect trait objects, box the returned expressions | LL ~ Box::new(0i32) @@ -162,63 +231,8 @@ LL ~ Box::new(1u32) | help: change the type of the numeric literal from `u32` to `i32` | -LL | 1i32 - | ~~~ - -error[E0746]: return type cannot have an unboxed trait object - --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:66:13 - | -LL | fn hat() -> dyn std::fmt::Display { - | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | -help: consider returning an `impl Trait` instead of a `dyn Trait` - | -LL | fn hat() -> impl std::fmt::Display { - | ~~~~ -help: alternatively, box the return type, and wrap all of the returned values in `Box::new` - | -LL ~ fn hat() -> Box<dyn std::fmt::Display> { -LL | match 13 { -LL | 0 => { -LL ~ return Box::new(0i32); -LL | } -LL | _ => { -LL ~ Box::new(1u32) - | - -error[E0746]: return type cannot have an unboxed trait object - --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:77:13 - | -LL | fn pug() -> dyn std::fmt::Display { - | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | -help: consider returning an `impl Trait` instead of a `dyn Trait` - | -LL | fn pug() -> impl std::fmt::Display { - | ~~~~ -help: alternatively, box the return type, and wrap all of the returned values in `Box::new` - | -LL ~ fn pug() -> Box<dyn std::fmt::Display> { -LL | match 13 { -LL ~ 0 => Box::new(0i32), -LL ~ 1 => Box::new(1u32), -LL ~ _ => Box::new(2u32), - | - -error[E0746]: return type cannot have an unboxed trait object - --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:85:13 - | -LL | fn man() -> dyn std::fmt::Display { - | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: if there were a single returned type, you could use `impl Trait` instead -help: box the return type, and wrap all of the returned values in `Box::new` - | -LL ~ fn man() -> Box<dyn std::fmt::Display> { -LL | if false { -LL ~ Box::new(0i32) -LL | } else { -LL ~ Box::new(1u32) +LL - 1u32 +LL + 1i32 | error: aborting due to 12 previous errors diff --git a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr index a8acecf10c7..c8dac3a69cd 100644 --- a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr +++ b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr @@ -7,8 +7,9 @@ LL | fn no_elided_lt() -> impl Sized + use<'_> {} = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | fn no_elided_lt() -> impl Sized + use<'static> {} - | ~~~~~~~ +LL - fn no_elided_lt() -> impl Sized + use<'_> {} +LL + fn no_elided_lt() -> impl Sized + use<'static> {} + | error[E0261]: use of undeclared lifetime name `'missing` --> $DIR/bad-lifetimes.rs:8:37 diff --git a/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr b/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr index b0c4cc2fea0..0d8fa650df4 100644 --- a/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr +++ b/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr @@ -80,8 +80,9 @@ LL | fn no_params_yet(_: impl Sized, y: &()) -> impl Sized { | ^^^^^^^^^^ help: add a `use<...>` bound to explicitly capture `'_` after turning all argument-position `impl Trait` into type parameters, noting that this possibly affects the API of this crate | -LL | fn no_params_yet<T: Sized>(_: T, y: &()) -> impl Sized + use<'_, T> { - | ++++++++++ ~ ++++++++++++ +LL - fn no_params_yet(_: impl Sized, y: &()) -> impl Sized { +LL + fn no_params_yet<T: Sized>(_: T, y: &()) -> impl Sized + use<'_, T> { + | error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds --> $DIR/hidden-type-suggestion.rs:36:5 @@ -101,8 +102,9 @@ LL | fn yes_params_yet<'a, T>(_: impl Sized, y: &'a ()) -> impl Sized { | ^^^^^^^^^^ help: add a `use<...>` bound to explicitly capture `'a` after turning all argument-position `impl Trait` into type parameters, noting that this possibly affects the API of this crate | -LL | fn yes_params_yet<'a, T, U: Sized>(_: U, y: &'a ()) -> impl Sized + use<'a, T, U> { - | ++++++++++ ~ +++++++++++++++ +LL - fn yes_params_yet<'a, T>(_: impl Sized, y: &'a ()) -> impl Sized { +LL + fn yes_params_yet<'a, T, U: Sized>(_: U, y: &'a ()) -> impl Sized + use<'a, T, U> { + | error: aborting due to 6 previous errors diff --git a/tests/ui/impl-trait/precise-capturing/migration-note.stderr b/tests/ui/impl-trait/precise-capturing/migration-note.stderr index 9caf7a201ef..676b6c12f52 100644 --- a/tests/ui/impl-trait/precise-capturing/migration-note.stderr +++ b/tests/ui/impl-trait/precise-capturing/migration-note.stderr @@ -305,8 +305,9 @@ LL | fn capture_apit(x: &impl Sized) -> impl Sized {} | ^^^^^^^^^^ help: use the precise capturing `use<...>` syntax to make the captures explicit | -LL | fn capture_apit<T: Sized>(x: &T) -> impl Sized + use<T> {} - | ++++++++++ ~ ++++++++ +LL - fn capture_apit(x: &impl Sized) -> impl Sized {} +LL + fn capture_apit<T: Sized>(x: &T) -> impl Sized + use<T> {} + | help: consider cloning the value if the performance cost is acceptable | LL | let y = capture_apit(&x.clone()); diff --git a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr index 965f8e7b672..3f8511a21a0 100644 --- a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr +++ b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr @@ -100,8 +100,9 @@ LL | fn apit(_: &impl Sized) -> impl Sized {} | ^^^^^^^^^^ help: use the precise capturing `use<...>` syntax to make the captures explicit | -LL | fn apit<T: Sized>(_: &T) -> impl Sized + use<T> {} - | ++++++++++ ~ ++++++++ +LL - fn apit(_: &impl Sized) -> impl Sized {} +LL + fn apit<T: Sized>(_: &T) -> impl Sized + use<T> {} + | error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024 --> $DIR/overcaptures-2024.rs:37:38 @@ -124,8 +125,9 @@ LL | fn apit2<U>(_: &impl Sized, _: U) -> impl Sized {} | ^^^^^^^^^^ help: use the precise capturing `use<...>` syntax to make the captures explicit | -LL | fn apit2<U, T: Sized>(_: &T, _: U) -> impl Sized + use<U, T> {} - | ++++++++++ ~ +++++++++++ +LL - fn apit2<U>(_: &impl Sized, _: U) -> impl Sized {} +LL + fn apit2<U, T: Sized>(_: &T, _: U) -> impl Sized + use<U, T> {} + | error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024 --> $DIR/overcaptures-2024.rs:41:37 diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs b/tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs new file mode 100644 index 00000000000..6f7e1a0eaef --- /dev/null +++ b/tests/ui/impl-trait/precise-capturing/rpitit-outlives-2.rs @@ -0,0 +1,19 @@ +//@ check-pass + +// Ensure that we skip uncaptured args from RPITITs when comptuing outlives. + +#![feature(precise_capturing_in_traits)] + +struct Invariant<T>(*mut T); + +trait Foo { + fn hello<'s: 's>(&'s self) -> Invariant<impl Sized + use<Self>>; +} + +fn outlives_static(_: impl Sized + 'static) {} + +fn hello<'s, T: Foo + 'static>(x: &'s T) { + outlives_static(x.hello()); +} + +fn main() {} diff --git a/tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs b/tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs new file mode 100644 index 00000000000..94d81d766f7 --- /dev/null +++ b/tests/ui/impl-trait/precise-capturing/rpitit-outlives.rs @@ -0,0 +1,18 @@ +//@ check-pass + +// Ensure that we skip uncaptured args from RPITITs when collecting the regions +// to enforce member constraints in opaque type inference. + +#![feature(precise_capturing_in_traits)] + +struct Invariant<T>(*mut T); + +trait Foo { + fn hello<'s: 's>(&'s self) -> Invariant<impl Sized + use<Self>>; +} + +fn hello<'s, T: Foo>(x: &'s T) -> Invariant<impl Sized> { + x.hello() +} + +fn main() {} diff --git a/tests/ui/impl-trait/recursive-coroutine-indirect.current.stderr b/tests/ui/impl-trait/recursive-coroutine-indirect.current.stderr index 9814187e179..7f3691123ee 100644 --- a/tests/ui/impl-trait/recursive-coroutine-indirect.current.stderr +++ b/tests/ui/impl-trait/recursive-coroutine-indirect.current.stderr @@ -1,5 +1,5 @@ error[E0733]: recursion in a coroutine requires boxing - --> $DIR/recursive-coroutine-indirect.rs:11:18 + --> $DIR/recursive-coroutine-indirect.rs:8:18 | LL | #[coroutine] move || { | ^^^^^^^ diff --git a/tests/ui/impl-trait/recursive-coroutine-indirect.next.stderr b/tests/ui/impl-trait/recursive-coroutine-indirect.next.stderr index 9814187e179..7f3691123ee 100644 --- a/tests/ui/impl-trait/recursive-coroutine-indirect.next.stderr +++ b/tests/ui/impl-trait/recursive-coroutine-indirect.next.stderr @@ -1,5 +1,5 @@ error[E0733]: recursion in a coroutine requires boxing - --> $DIR/recursive-coroutine-indirect.rs:11:18 + --> $DIR/recursive-coroutine-indirect.rs:8:18 | LL | #[coroutine] move || { | ^^^^^^^ diff --git a/tests/ui/impl-trait/recursive-coroutine-indirect.rs b/tests/ui/impl-trait/recursive-coroutine-indirect.rs index cec2176049b..f0727ad3742 100644 --- a/tests/ui/impl-trait/recursive-coroutine-indirect.rs +++ b/tests/ui/impl-trait/recursive-coroutine-indirect.rs @@ -2,9 +2,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -//@[next] build-fail -// Deeply normalizing writeback results of opaques makes this into a post-mono error :( - #![feature(coroutines)] #![allow(unconditional_recursion)] fn coroutine_hold() -> impl Sized { diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr index b127bf41800..767bd312407 100644 --- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr +++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr @@ -11,8 +11,9 @@ LL | fn eq(&self, _other: &(Foo, i32)) -> bool { found signature `fn(&a::Bar, &(a::Foo, _)) -> _` help: change the parameter type to match the trait | -LL | fn eq(&self, _other: &(a::Bar, i32)) -> bool { - | ~~~~~~~~~~~~~~ +LL - fn eq(&self, _other: &(Foo, i32)) -> bool { +LL + fn eq(&self, _other: &(a::Bar, i32)) -> bool { + | error: item does not constrain `a::Foo::{opaque#0}`, but has it in its signature --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:9:12 @@ -45,8 +46,9 @@ LL | fn eq(&self, _other: &(Bar, i32)) -> bool { | ^^ help: change the parameter type to match the trait | -LL | fn eq(&self, _other: &(b::Foo, i32)) -> bool { - | ~~~~~~~~~~~~~~ +LL - fn eq(&self, _other: &(Bar, i32)) -> bool { +LL + fn eq(&self, _other: &(b::Foo, i32)) -> bool { + | error: unconstrained opaque type --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:18:16 diff --git a/tests/ui/impl-trait/trait_type.stderr b/tests/ui/impl-trait/trait_type.stderr index 989779a6178..ce5b2f1cca6 100644 --- a/tests/ui/impl-trait/trait_type.stderr +++ b/tests/ui/impl-trait/trait_type.stderr @@ -8,8 +8,9 @@ LL | fn fmt(&self, x: &str) -> () { } found signature `fn(&MyType, &str) -> ()` help: change the parameter type to match the trait | -LL | fn fmt(&self, x: &mut Formatter<'_>) -> () { } - | ~~~~~~~~~~~~~~~~~~ +LL - fn fmt(&self, x: &str) -> () { } +LL + fn fmt(&self, x: &mut Formatter<'_>) -> () { } + | error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2 --> $DIR/trait_type.rs:12:11 diff --git a/tests/ui/impl-trait/universal-two-impl-traits.stderr b/tests/ui/impl-trait/universal-two-impl-traits.stderr index 3b4844ab133..f2f5dd0a0c8 100644 --- a/tests/ui/impl-trait/universal-two-impl-traits.stderr +++ b/tests/ui/impl-trait/universal-two-impl-traits.stderr @@ -10,8 +10,8 @@ LL | let mut a = x; LL | a = y; | ^ expected type parameter `impl Debug`, found a different type parameter `impl Debug` | - = note: expected type parameter `impl Debug` (type parameter `impl Debug`) - found type parameter `impl Debug` (type parameter `impl Debug`) + = note: expected type parameter `impl Debug` + found type parameter `impl Debug` = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters diff --git a/tests/ui/impl-trait/unsized_coercion5.old.stderr b/tests/ui/impl-trait/unsized_coercion5.old.stderr index e56c026b037..72aa92ef6b9 100644 --- a/tests/ui/impl-trait/unsized_coercion5.old.stderr +++ b/tests/ui/impl-trait/unsized_coercion5.old.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `impl Trait + ?Sized` cannot be known at compilation time - --> $DIR/unsized_coercion5.rs:17:32 + --> $DIR/unsized_coercion5.rs:15:32 | LL | let y: Box<dyn Send> = x as Box<dyn Trait + Send>; | ^ doesn't have a size known at compile-time diff --git a/tests/ui/impl-trait/unsized_coercion5.rs b/tests/ui/impl-trait/unsized_coercion5.rs index 81f8a6afe9a..51ae4f20671 100644 --- a/tests/ui/impl-trait/unsized_coercion5.rs +++ b/tests/ui/impl-trait/unsized_coercion5.rs @@ -5,8 +5,6 @@ //@[next] compile-flags: -Znext-solver //@[next] check-pass -#![feature(trait_upcasting)] - trait Trait {} impl Trait for u32 {} diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr index 400df87ca3f..ebce9b7e445 100644 --- a/tests/ui/impl-trait/where-allowed.stderr +++ b/tests/ui/impl-trait/where-allowed.stderr @@ -364,8 +364,9 @@ LL | fn in_trait_impl_return() -> Self::Out; = note: distinct uses of `impl Trait` result in different opaque types help: change the output type to match the trait | -LL | fn in_trait_impl_return() -> <() as DummyTrait>::Out { () } - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn in_trait_impl_return() -> impl Debug { () } +LL + fn in_trait_impl_return() -> <() as DummyTrait>::Out { () } + | error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions --> $DIR/where-allowed.rs:245:36 diff --git a/tests/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr b/tests/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr index f498257e12f..f8ee6fef824 100644 --- a/tests/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr +++ b/tests/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr @@ -1,4 +1,4 @@ -error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 's in generic type due to conflicting requirements +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter 's in generic type due to conflicting requirements --> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:5 | LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { @@ -25,4 +25,4 @@ LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0495`. +For more information about this error, try `rustc --explain E0803`. diff --git a/tests/ui/imports/bad-import-with-rename.stderr b/tests/ui/imports/bad-import-with-rename.stderr index f9c5cf920e1..a8e97d13c55 100644 --- a/tests/ui/imports/bad-import-with-rename.stderr +++ b/tests/ui/imports/bad-import-with-rename.stderr @@ -6,8 +6,9 @@ LL | use crate::D::B as _; | help: consider importing this type alias instead | -LL | use A::B as _; - | ~~~~~~~~~ +LL - use crate::D::B as _; +LL + use A::B as _; + | error[E0432]: unresolved import `crate::D::B2` --> $DIR/bad-import-with-rename.rs:10:9 @@ -17,8 +18,9 @@ LL | use crate::D::B2; | help: consider importing this type alias instead | -LL | use A::B2; - | ~~~~~ +LL - use crate::D::B2; +LL + use A::B2; + | error: aborting due to 2 previous errors diff --git a/tests/ui/imports/extern-crate-self/extern-crate-self-fail.stderr b/tests/ui/imports/extern-crate-self/extern-crate-self-fail.stderr index 127765727b4..9a3ebfddc49 100644 --- a/tests/ui/imports/extern-crate-self/extern-crate-self-fail.stderr +++ b/tests/ui/imports/extern-crate-self/extern-crate-self-fail.stderr @@ -6,8 +6,9 @@ LL | extern crate self; | help: rename the `self` crate to be able to import it | -LL | extern crate self as name; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - extern crate self; +LL + extern crate self as name; + | error: `#[macro_use]` is not supported on `extern crate self` --> $DIR/extern-crate-self-fail.rs:3:1 diff --git a/tests/ui/imports/glob-resolve1.stderr b/tests/ui/imports/glob-resolve1.stderr index 4401ef58732..75e65681c3a 100644 --- a/tests/ui/imports/glob-resolve1.stderr +++ b/tests/ui/imports/glob-resolve1.stderr @@ -38,7 +38,7 @@ LL | | } help: you might have meant to use the following enum variant | LL | B::B1; - | ~~~~~ + | ++++ error[E0425]: cannot find value `C` in this scope --> $DIR/glob-resolve1.rs:29:5 diff --git a/tests/ui/imports/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr b/tests/ui/imports/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr index 80cea1a83d9..def0676a0f8 100644 --- a/tests/ui/imports/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr +++ b/tests/ui/imports/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr @@ -7,7 +7,8 @@ LL | extern crate std; = note: `std` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate std as other_std; +LL - extern crate std; +LL + extern crate std as other_std; | error: aborting due to 1 previous error diff --git a/tests/ui/imports/issue-45829/import-self.stderr b/tests/ui/imports/issue-45829/import-self.stderr index 3c9d4fe6ba6..b392d93c154 100644 --- a/tests/ui/imports/issue-45829/import-self.stderr +++ b/tests/ui/imports/issue-45829/import-self.stderr @@ -33,7 +33,7 @@ LL | use foo::{self}; help: you can use `as` to change the binding name of the import | LL | use foo::{self as other_foo}; - | ~~~~~~~~~~~~~~~~~ + | ++++++++++++ error[E0255]: the name `foo` is defined multiple times --> $DIR/import-self.rs:12:5 @@ -47,8 +47,9 @@ LL | use foo::self; = note: `foo` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use foo as other_foo; - | ~~~~~~~~~~~~ +LL - use foo::self; +LL + use foo as other_foo; + | error[E0252]: the name `A` is defined multiple times --> $DIR/import-self.rs:16:11 @@ -61,8 +62,9 @@ LL | use foo::{self as A}; = note: `A` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use foo::{self as OtherA}; - | ~~~~~~~~~~~~~~ +LL - use foo::{self as A}; +LL + use foo::{self as OtherA}; + | error: aborting due to 5 previous errors diff --git a/tests/ui/imports/issue-45829/issue-45829.stderr b/tests/ui/imports/issue-45829/issue-45829.stderr index c6835c3bd7a..9fd0e5a7672 100644 --- a/tests/ui/imports/issue-45829/issue-45829.stderr +++ b/tests/ui/imports/issue-45829/issue-45829.stderr @@ -9,8 +9,9 @@ LL | use foo::{A, B as A}; = note: `A` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use foo::{A, B as OtherA}; - | ~~~~~~~~~ +LL - use foo::{A, B as A}; +LL + use foo::{A, B as OtherA}; + | error: aborting due to 1 previous error diff --git a/tests/ui/imports/issue-45829/rename-extern-vs-use.stderr b/tests/ui/imports/issue-45829/rename-extern-vs-use.stderr index 8f2f7bbac0c..98fe16824ff 100644 --- a/tests/ui/imports/issue-45829/rename-extern-vs-use.stderr +++ b/tests/ui/imports/issue-45829/rename-extern-vs-use.stderr @@ -9,7 +9,8 @@ LL | extern crate issue_45829_b as bar; = note: `bar` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate issue_45829_b as other_bar; +LL - extern crate issue_45829_b as bar; +LL + extern crate issue_45829_b as other_bar; | error: aborting due to 1 previous error diff --git a/tests/ui/imports/issue-45829/rename-extern-with-tab.stderr b/tests/ui/imports/issue-45829/rename-extern-with-tab.stderr index ae26d1fd0bb..346f2481c21 100644 --- a/tests/ui/imports/issue-45829/rename-extern-with-tab.stderr +++ b/tests/ui/imports/issue-45829/rename-extern-with-tab.stderr @@ -9,7 +9,8 @@ LL | extern crate issue_45829_b as issue_45829_a; = note: `issue_45829_a` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate issue_45829_b as other_issue_45829_a; +LL - extern crate issue_45829_b as issue_45829_a; +LL + extern crate issue_45829_b as other_issue_45829_a; | error: aborting due to 1 previous error diff --git a/tests/ui/imports/issue-45829/rename-extern.stderr b/tests/ui/imports/issue-45829/rename-extern.stderr index 46560ef9244..f99f433c642 100644 --- a/tests/ui/imports/issue-45829/rename-extern.stderr +++ b/tests/ui/imports/issue-45829/rename-extern.stderr @@ -9,7 +9,8 @@ LL | extern crate issue_45829_b as issue_45829_a; = note: `issue_45829_a` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate issue_45829_b as other_issue_45829_a; +LL - extern crate issue_45829_b as issue_45829_a; +LL + extern crate issue_45829_b as other_issue_45829_a; | error: aborting due to 1 previous error diff --git a/tests/ui/imports/issue-45829/rename-use-vs-extern.stderr b/tests/ui/imports/issue-45829/rename-use-vs-extern.stderr index fd4fb9db0b6..e0647cd3ab6 100644 --- a/tests/ui/imports/issue-45829/rename-use-vs-extern.stderr +++ b/tests/ui/imports/issue-45829/rename-use-vs-extern.stderr @@ -9,8 +9,9 @@ LL | use std as issue_45829_b; = note: `issue_45829_b` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use std as other_issue_45829_b; - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - use std as issue_45829_b; +LL + use std as other_issue_45829_b; + | error: aborting due to 1 previous error diff --git a/tests/ui/imports/issue-45829/rename-use-with-tabs.stderr b/tests/ui/imports/issue-45829/rename-use-with-tabs.stderr index 178303bbc1d..c2e63ffa91e 100644 --- a/tests/ui/imports/issue-45829/rename-use-with-tabs.stderr +++ b/tests/ui/imports/issue-45829/rename-use-with-tabs.stderr @@ -9,8 +9,9 @@ LL | use foo::{A, bar::B as A}; = note: `A` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use foo::{A, bar::B as OtherA}; - | ~~~~~~~~~ +LL - use foo::{A, bar::B as A}; +LL + use foo::{A, bar::B as OtherA}; + | error: aborting due to 1 previous error diff --git a/tests/ui/imports/issue-45829/rename-with-path.stderr b/tests/ui/imports/issue-45829/rename-with-path.stderr index a83fdb37324..45fdd46850e 100644 --- a/tests/ui/imports/issue-45829/rename-with-path.stderr +++ b/tests/ui/imports/issue-45829/rename-with-path.stderr @@ -9,8 +9,9 @@ LL | use std::{collections::HashMap as A, sync::Arc as A}; = note: `A` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use std::{collections::HashMap as A, sync::Arc as OtherA}; - | ~~~~~~~~~ +LL - use std::{collections::HashMap as A, sync::Arc as A}; +LL + use std::{collections::HashMap as A, sync::Arc as OtherA}; + | error: aborting due to 1 previous error diff --git a/tests/ui/imports/issue-45829/rename.stderr b/tests/ui/imports/issue-45829/rename.stderr index 4977909487c..dc5775e3d56 100644 --- a/tests/ui/imports/issue-45829/rename.stderr +++ b/tests/ui/imports/issue-45829/rename.stderr @@ -9,8 +9,9 @@ LL | use std as core; = note: `core` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use std as other_core; - | ~~~~~~~~~~~~~ +LL - use std as core; +LL + use std as other_core; + | error: aborting due to 1 previous error diff --git a/tests/ui/imports/issue-56125.stderr b/tests/ui/imports/issue-56125.stderr index 0c4a569c7ea..81336d51df4 100644 --- a/tests/ui/imports/issue-56125.stderr +++ b/tests/ui/imports/issue-56125.stderr @@ -6,14 +6,18 @@ LL | use empty::issue_56125; | help: consider importing one of these modules instead | -LL | use crate::m3::last_segment::issue_56125; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | use crate::m3::non_last_segment::non_last_segment::issue_56125; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | use ::issue_56125::issue_56125; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | use ::issue_56125::last_segment::issue_56125; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - use empty::issue_56125; +LL + use crate::m3::last_segment::issue_56125; + | +LL - use empty::issue_56125; +LL + use crate::m3::non_last_segment::non_last_segment::issue_56125; + | +LL - use empty::issue_56125; +LL + use ::issue_56125::issue_56125; + | +LL - use empty::issue_56125; +LL + use ::issue_56125::last_segment::issue_56125; + | and 1 other candidate error[E0659]: `issue_56125` is ambiguous diff --git a/tests/ui/imports/issue-57015.stderr b/tests/ui/imports/issue-57015.stderr index f1ae7845241..d3b9cd21fba 100644 --- a/tests/ui/imports/issue-57015.stderr +++ b/tests/ui/imports/issue-57015.stderr @@ -6,8 +6,9 @@ LL | use single_err::something; | help: consider importing this module instead | -LL | use glob_ok::something; - | ~~~~~~~~~~~~~~~~~~ +LL - use single_err::something; +LL + use glob_ok::something; + | error: aborting due to 1 previous error diff --git a/tests/ui/imports/issue-59764.stderr b/tests/ui/imports/issue-59764.stderr index 74525c9c88f..1d31e3bda0d 100644 --- a/tests/ui/imports/issue-59764.stderr +++ b/tests/ui/imports/issue-59764.stderr @@ -182,8 +182,9 @@ LL | use issue_59764::foo::makro as baz; = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined help: a macro with this name exists at the root of the crate | -LL | use issue_59764::makro as baz; - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - use issue_59764::foo::makro as baz; +LL + use issue_59764::makro as baz; + | error[E0432]: unresolved import `issue_59764::foo::makro` --> $DIR/issue-59764.rs:107:33 @@ -223,8 +224,9 @@ LL | use issue_59764::foo::makro; = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined help: a macro with this name exists at the root of the crate | -LL | use issue_59764::makro; - | ~~~~~~~~~~~~~~~~~~ +LL - use issue_59764::foo::makro; +LL + use issue_59764::makro; + | error[E0425]: cannot find function `bar` in this scope --> $DIR/issue-59764.rs:133:5 diff --git a/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr b/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr index a84a6c42aa8..4a5c85479d3 100644 --- a/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr +++ b/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr @@ -14,7 +14,8 @@ LL | m!(); = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: you can use `as` to change the binding name of the import | -LL | extern crate std as other_core; +LL - extern crate std as core; +LL + extern crate std as other_core; | error: aborting due to 1 previous error diff --git a/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr b/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr index 556d75a4dbb..8b87ae93b4d 100644 --- a/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr +++ b/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr @@ -14,7 +14,8 @@ LL | m!(); = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: you can use `as` to change the binding name of the import | -LL | extern crate std as other_empty; +LL - extern crate std as empty; +LL + extern crate std as other_empty; | error: aborting due to 1 previous error diff --git a/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr b/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr index ec34489f232..9a9e538740d 100644 --- a/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr +++ b/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr @@ -20,7 +20,8 @@ LL | m!(); = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) help: you can use `as` to change the binding name of the import | -LL | extern crate std as other_non_existent; +LL - extern crate std as non_existent; +LL + extern crate std as other_non_existent; | error: aborting due to 2 previous errors diff --git a/tests/ui/imports/no-std-inject.stderr b/tests/ui/imports/no-std-inject.stderr index 597ecdce9eb..d3952a50cd3 100644 --- a/tests/ui/imports/no-std-inject.stderr +++ b/tests/ui/imports/no-std-inject.stderr @@ -7,8 +7,9 @@ LL | extern crate core; = note: `core` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate core as other_core; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - extern crate core; +LL + extern crate core as other_core; + | error: aborting due to 1 previous error diff --git a/tests/ui/imports/private-std-reexport-suggest-public.stderr b/tests/ui/imports/private-std-reexport-suggest-public.stderr index 222553235aa..90d84bb4f5b 100644 --- a/tests/ui/imports/private-std-reexport-suggest-public.stderr +++ b/tests/ui/imports/private-std-reexport-suggest-public.stderr @@ -15,8 +15,9 @@ note: ...and refers to the module `mem` which is defined here = note: you could import this directly help: import `mem` through the re-export | -LL | use std::mem; - | ~~~~~~~~ +LL - use foo::mem; +LL + use std::mem; + | error: aborting due to 1 previous error diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr index 414eeee0fed..10b8db62edc 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr @@ -7,7 +7,7 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); help: a similar path exists | LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); - | ~~~~~~~~ + | +++++ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr index 414eeee0fed..10b8db62edc 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr @@ -7,7 +7,7 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); help: a similar path exists | LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); - | ~~~~~~~~ + | +++++ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/include-macros/parent_dir.stderr b/tests/ui/include-macros/parent_dir.stderr index 0470d5b1f1e..23029e91120 100644 --- a/tests/ui/include-macros/parent_dir.stderr +++ b/tests/ui/include-macros/parent_dir.stderr @@ -7,8 +7,9 @@ LL | let _ = include_str!("include-macros/file.txt"); = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info) help: there is a file with the same name in a different directory | -LL | let _ = include_str!("file.txt"); - | ~~~~~~~~~~ +LL - let _ = include_str!("include-macros/file.txt"); +LL + let _ = include_str!("file.txt"); + | error: couldn't read `$DIR/hello.rs`: $FILE_NOT_FOUND_MSG --> $DIR/parent_dir.rs:6:13 @@ -19,8 +20,9 @@ LL | let _ = include_str!("hello.rs"); = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info) help: there is a file with the same name in a different directory | -LL | let _ = include_str!("../hello.rs"); - | ~~~~~~~~~~~~~ +LL - let _ = include_str!("hello.rs"); +LL + let _ = include_str!("../hello.rs"); + | error: couldn't read `$DIR/../../data.bin`: $FILE_NOT_FOUND_MSG --> $DIR/parent_dir.rs:8:13 @@ -31,8 +33,9 @@ LL | let _ = include_bytes!("../../data.bin"); = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info) help: there is a file with the same name in a different directory | -LL | let _ = include_bytes!("data.bin"); - | ~~~~~~~~~~ +LL - let _ = include_bytes!("../../data.bin"); +LL + let _ = include_bytes!("data.bin"); + | error: couldn't read `$DIR/tests/ui/include-macros/file.txt`: $FILE_NOT_FOUND_MSG --> $DIR/parent_dir.rs:10:13 @@ -43,8 +46,9 @@ LL | let _ = include_str!("tests/ui/include-macros/file.txt"); = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info) help: there is a file with the same name in a different directory | -LL | let _ = include_str!("file.txt"); - | ~~~~~~~~~~ +LL - let _ = include_str!("tests/ui/include-macros/file.txt"); +LL + let _ = include_str!("file.txt"); + | error: aborting due to 4 previous errors diff --git a/tests/ui/inference/ambiguous_type_parameter.stderr b/tests/ui/inference/ambiguous_type_parameter.stderr index 0674deb63ba..835999121d6 100644 --- a/tests/ui/inference/ambiguous_type_parameter.stderr +++ b/tests/ui/inference/ambiguous_type_parameter.stderr @@ -6,8 +6,9 @@ LL | InMemoryStore.get_raw(&String::default()); | help: try using a fully qualified path to specify the expected types | -LL | <InMemoryStore as Store<String, HashMap<K, String>>>::get_raw(&InMemoryStore, &String::default()); - | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ~ +LL - InMemoryStore.get_raw(&String::default()); +LL + <InMemoryStore as Store<String, HashMap<K, String>>>::get_raw(&InMemoryStore, &String::default()); + | error: aborting due to 1 previous error diff --git a/tests/ui/inference/cannot-infer-closure-circular.stderr b/tests/ui/inference/cannot-infer-closure-circular.stderr index a16e832f8ef..ee17f7737cf 100644 --- a/tests/ui/inference/cannot-infer-closure-circular.stderr +++ b/tests/ui/inference/cannot-infer-closure-circular.stderr @@ -9,8 +9,8 @@ LL | Ok(v) | help: consider giving this closure parameter an explicit type, where the type for type parameter `E` is specified | -LL | let x = |r: Result<(), E>| { - | +++++++++++++++ +LL | let x = |r: Result<_, E>| { + | ++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/inference/char-as-str-single.stderr b/tests/ui/inference/char-as-str-single.stderr index 9149efe3240..5455a0fd7ee 100644 --- a/tests/ui/inference/char-as-str-single.stderr +++ b/tests/ui/inference/char-as-str-single.stderr @@ -8,8 +8,9 @@ LL | let _: char = "a"; | help: if you meant to write a `char` literal, use single quotes | -LL | let _: char = 'a'; - | ~~~ +LL - let _: char = "a"; +LL + let _: char = 'a'; + | error[E0308]: mismatched types --> $DIR/char-as-str-single.rs:10:19 @@ -21,8 +22,9 @@ LL | let _: char = "人"; | help: if you meant to write a `char` literal, use single quotes | -LL | let _: char = '人'; - | ~~~~ +LL - let _: char = "人"; +LL + let _: char = '人'; + | error[E0308]: mismatched types --> $DIR/char-as-str-single.rs:11:19 @@ -34,8 +36,9 @@ LL | let _: char = "'"; | help: if you meant to write a `char` literal, use single quotes | -LL | let _: char = '\''; - | ~~~~ +LL - let _: char = "'"; +LL + let _: char = '\''; + | error[E0308]: mismatched types --> $DIR/char-as-str-single.rs:18:9 @@ -47,8 +50,9 @@ LL | "A" => {} | help: if you meant to write a `char` literal, use single quotes | -LL | 'A' => {} - | ~~~ +LL - "A" => {} +LL + 'A' => {} + | error: aborting due to 4 previous errors diff --git a/tests/ui/inference/erase-type-params-in-label.stderr b/tests/ui/inference/erase-type-params-in-label.stderr index 4e9a74c1e40..1ec8a33eb82 100644 --- a/tests/ui/inference/erase-type-params-in-label.stderr +++ b/tests/ui/inference/erase-type-params-in-label.stderr @@ -12,8 +12,8 @@ LL | fn foo<T, K, W: Default, Z: Default>(t: T, k: K) -> Foo<T, K, W, Z> { | ^^^^^^^ required by this bound in `foo` help: consider giving `foo` an explicit type, where the type for type parameter `W` is specified | -LL | let foo: Foo<i32, &str, W, Z> = foo(1, ""); - | ++++++++++++++++++++++ +LL | let foo: Foo<_, &_, W, Z> = foo(1, ""); + | ++++++++++++++++++ error[E0283]: type annotations needed for `Bar<i32, &str, _>` --> $DIR/erase-type-params-in-label.rs:5:9 @@ -29,8 +29,8 @@ LL | fn bar<T, K, Z: Default>(t: T, k: K) -> Bar<T, K, Z> { | ^^^^^^^ required by this bound in `bar` help: consider giving `bar` an explicit type, where the type for type parameter `Z` is specified | -LL | let bar: Bar<i32, &str, Z> = bar(1, ""); - | +++++++++++++++++++ +LL | let bar: Bar<_, &_, Z> = bar(1, ""); + | +++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/inference/inference_unstable.stderr b/tests/ui/inference/inference_unstable.stderr index 51f086177db..395dcb2661f 100644 --- a/tests/ui/inference/inference_unstable.stderr +++ b/tests/ui/inference/inference_unstable.stderr @@ -65,8 +65,9 @@ LL | assert_eq!(char::C, 1); = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919> help: use the fully qualified path to the associated const | -LL | assert_eq!(<char as IpuItertools>::C, 1); - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - assert_eq!(char::C, 1); +LL + assert_eq!(<char as IpuItertools>::C, 1); + | help: add `#![feature(assoc_const_ipu_iter)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::C` | LL + #![feature(assoc_const_ipu_iter)] diff --git a/tests/ui/inference/inference_unstable_featured.stderr b/tests/ui/inference/inference_unstable_featured.stderr index b908c7142d4..b267ca497de 100644 --- a/tests/ui/inference/inference_unstable_featured.stderr +++ b/tests/ui/inference/inference_unstable_featured.stderr @@ -8,12 +8,14 @@ LL | assert_eq!('x'.ipu_flatten(), 0); = note: candidate #2 is defined in an impl of the trait `IpuItertools` for the type `char` help: disambiguate the method for candidate #1 | -LL | assert_eq!(IpuIterator::ipu_flatten(&'x'), 0); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - assert_eq!('x'.ipu_flatten(), 0); +LL + assert_eq!(IpuIterator::ipu_flatten(&'x'), 0); + | help: disambiguate the method for candidate #2 | -LL | assert_eq!(IpuItertools::ipu_flatten(&'x'), 0); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - assert_eq!('x'.ipu_flatten(), 0); +LL + assert_eq!(IpuItertools::ipu_flatten(&'x'), 0); + | error: aborting due to 1 previous error diff --git a/tests/ui/inference/issue-103587.stderr b/tests/ui/inference/issue-103587.stderr index 589cb7ea7b1..bd6a9b71b86 100644 --- a/tests/ui/inference/issue-103587.stderr +++ b/tests/ui/inference/issue-103587.stderr @@ -6,8 +6,9 @@ LL | if let Some(_) == x {} | help: consider using `=` here | -LL | if let Some(_) = x {} - | ~ +LL - if let Some(_) == x {} +LL + if let Some(_) = x {} + | error[E0308]: mismatched types --> $DIR/issue-103587.rs:7:8 diff --git a/tests/ui/inference/issue-104649.stderr b/tests/ui/inference/issue-104649.stderr index 391ed16f349..27382e30134 100644 --- a/tests/ui/inference/issue-104649.stderr +++ b/tests/ui/inference/issue-104649.stderr @@ -6,8 +6,8 @@ LL | let a = A(Result::Ok(Result::Ok(()))); | help: consider giving `a` an explicit type, where the type for type parameter `E` is specified | -LL | let a: A<std::result::Result<std::result::Result<(), E>, Error>> = A(Result::Ok(Result::Ok(()))); - | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | let a: A<std::result::Result<std::result::Result<_, E>, _>> = A(Result::Ok(Result::Ok(()))); + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/inference/issue-12028.stderr b/tests/ui/inference/issue-12028.stderr index 3d7fb13d447..0d8ef1c938d 100644 --- a/tests/ui/inference/issue-12028.stderr +++ b/tests/ui/inference/issue-12028.stderr @@ -7,8 +7,9 @@ LL | self.input_stream(&mut stream); = note: cannot satisfy `<_ as StreamHasher>::S == <H as StreamHasher>::S` help: try using a fully qualified path to specify the expected types | -LL | <u8 as StreamHash<H>>::input_stream(self, &mut stream); - | ++++++++++++++++++++++++++++++++++++ ~ +LL - self.input_stream(&mut stream); +LL + <u8 as StreamHash<H>>::input_stream(self, &mut stream); + | error: aborting due to 1 previous error diff --git a/tests/ui/inference/issue-70082.stderr b/tests/ui/inference/issue-70082.stderr index 442e7479a9e..926ecff4a4f 100644 --- a/tests/ui/inference/issue-70082.stderr +++ b/tests/ui/inference/issue-70082.stderr @@ -9,8 +9,9 @@ LL | let y: f64 = 0.01f64 * 1i16.into(); = note: cannot satisfy `<f64 as Mul<_>>::Output == f64` help: try using a fully qualified path to specify the expected types | -LL | let y: f64 = 0.01f64 * <i16 as Into<T>>::into(1i16); - | +++++++++++++++++++++++ ~ +LL - let y: f64 = 0.01f64 * 1i16.into(); +LL + let y: f64 = 0.01f64 * <i16 as Into<T>>::into(1i16); + | error: aborting due to 1 previous error diff --git a/tests/ui/inference/issue-71584.rs b/tests/ui/inference/issue-71584.rs index 7e4d45ec4a0..61568e5467c 100644 --- a/tests/ui/inference/issue-71584.rs +++ b/tests/ui/inference/issue-71584.rs @@ -1,4 +1,4 @@ -//@ ignore-windows different list of satisfying impls +//@ ignore-windows FIXME: We get an extra E0283 on Windows fn main() { let n: u32 = 1; let mut d: u64 = 2; diff --git a/tests/ui/inference/issue-71584.stderr b/tests/ui/inference/issue-71584.stderr index 391d3e7613e..4bbfef6c44a 100644 --- a/tests/ui/inference/issue-71584.stderr +++ b/tests/ui/inference/issue-71584.stderr @@ -9,8 +9,9 @@ LL | d = d % n.into(); = note: cannot satisfy `<u64 as Rem<_>>::Output == u64` help: try using a fully qualified path to specify the expected types | -LL | d = d % <u32 as Into<T>>::into(n); - | +++++++++++++++++++++++ ~ +LL - d = d % n.into(); +LL + d = d % <u32 as Into<T>>::into(n); + | error: aborting due to 1 previous error diff --git a/tests/ui/inference/issue-72616.stderr b/tests/ui/inference/issue-72616.stderr index a26f9a1ff56..31a0586301d 100644 --- a/tests/ui/inference/issue-72616.stderr +++ b/tests/ui/inference/issue-72616.stderr @@ -16,8 +16,9 @@ LL | if String::from("a") == "a".try_into().unwrap() {} `String` implements `PartialEq` help: try using a fully qualified path to specify the expected types | -LL | if String::from("a") == <&str as TryInto<T>>::try_into("a").unwrap() {} - | +++++++++++++++++++++++++++++++ ~ +LL - if String::from("a") == "a".try_into().unwrap() {} +LL + if String::from("a") == <&str as TryInto<T>>::try_into("a").unwrap() {} + | error[E0283]: type annotations needed --> $DIR/issue-72616.rs:22:37 @@ -26,14 +27,15 @@ LL | if String::from("a") == "a".try_into().unwrap() {} | ^^^^^^^^ | = note: multiple `impl`s satisfying `_: TryFrom<&str>` found in the following crates: `core`, `std`: - - impl TryFrom<&str> for std::sys_common::net::LookupHost; + - impl TryFrom<&str> for std::sys::net::connection::socket::LookupHost; - impl<T, U> TryFrom<U> for T where U: Into<T>; = note: required for `&str` to implement `TryInto<_>` help: try using a fully qualified path to specify the expected types | -LL | if String::from("a") == <&str as TryInto<T>>::try_into("a").unwrap() {} - | +++++++++++++++++++++++++++++++ ~ +LL - if String::from("a") == "a".try_into().unwrap() {} +LL + if String::from("a") == <&str as TryInto<T>>::try_into("a").unwrap() {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/inference/issue-72690.stderr b/tests/ui/inference/issue-72690.stderr index 2d09f667ae2..4926cf9e981 100644 --- a/tests/ui/inference/issue-72690.stderr +++ b/tests/ui/inference/issue-72690.stderr @@ -22,8 +22,9 @@ LL | String::from("x".as_ref()); - impl AsRef<str> for str; help: try using a fully qualified path to specify the expected types | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ +LL - String::from("x".as_ref()); +LL + String::from(<str as AsRef<T>>::as_ref("x")); + | error[E0283]: type annotations needed --> $DIR/issue-72690.rs:12:9 @@ -49,8 +50,9 @@ LL | |x| String::from("x".as_ref()); - impl AsRef<str> for str; help: try using a fully qualified path to specify the expected types | -LL | |x| String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ +LL - |x| String::from("x".as_ref()); +LL + |x| String::from(<str as AsRef<T>>::as_ref("x")); + | error[E0283]: type annotations needed for `&_` --> $DIR/issue-72690.rs:17:9 @@ -93,8 +95,9 @@ LL | String::from("x".as_ref()); - impl AsRef<str> for str; help: try using a fully qualified path to specify the expected types | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ +LL - String::from("x".as_ref()); +LL + String::from(<str as AsRef<T>>::as_ref("x")); + | error[E0283]: type annotations needed --> $DIR/issue-72690.rs:28:5 @@ -120,8 +123,9 @@ LL | String::from("x".as_ref()); - impl AsRef<str> for str; help: try using a fully qualified path to specify the expected types | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ +LL - String::from("x".as_ref()); +LL + String::from(<str as AsRef<T>>::as_ref("x")); + | error[E0283]: type annotations needed --> $DIR/issue-72690.rs:37:5 @@ -147,8 +151,9 @@ LL | String::from("x".as_ref()); - impl AsRef<str> for str; help: try using a fully qualified path to specify the expected types | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ +LL - String::from("x".as_ref()); +LL + String::from(<str as AsRef<T>>::as_ref("x")); + | error[E0283]: type annotations needed --> $DIR/issue-72690.rs:46:5 @@ -174,8 +179,9 @@ LL | String::from("x".as_ref()); - impl AsRef<str> for str; help: try using a fully qualified path to specify the expected types | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ +LL - String::from("x".as_ref()); +LL + String::from(<str as AsRef<T>>::as_ref("x")); + | error[E0283]: type annotations needed --> $DIR/issue-72690.rs:53:5 @@ -201,8 +207,9 @@ LL | String::from("x".as_ref()); - impl AsRef<str> for str; help: try using a fully qualified path to specify the expected types | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ +LL - String::from("x".as_ref()); +LL + String::from(<str as AsRef<T>>::as_ref("x")); + | error[E0283]: type annotations needed --> $DIR/issue-72690.rs:62:5 @@ -228,8 +235,9 @@ LL | String::from("x".as_ref()); - impl AsRef<str> for str; help: try using a fully qualified path to specify the expected types | -LL | String::from(<str as AsRef<T>>::as_ref("x")); - | ++++++++++++++++++++++++++ ~ +LL - String::from("x".as_ref()); +LL + String::from(<str as AsRef<T>>::as_ref("x")); + | error: aborting due to 17 previous errors diff --git a/tests/ui/inference/issue-80816.stderr b/tests/ui/inference/issue-80816.stderr index ab62db8e6af..bca7cd4c3ad 100644 --- a/tests/ui/inference/issue-80816.stderr +++ b/tests/ui/inference/issue-80816.stderr @@ -21,8 +21,9 @@ LL | impl<T, A: Access<T>, P: Deref<Target = A>> Access<T> for P { | unsatisfied trait bound introduced here help: try using a fully qualified path to specify the expected types | -LL | let guard: Guard<Arc<usize>> = <Arc<ArcSwapAny<Arc<usize>>> as Access<T>>::load(&s); - | ++++++++++++++++++++++++++++++++++++++++++++++++++ ~ +LL - let guard: Guard<Arc<usize>> = s.load(); +LL + let guard: Guard<Arc<usize>> = <Arc<ArcSwapAny<Arc<usize>>> as Access<T>>::load(&s); + | error: aborting due to 1 previous error diff --git a/tests/ui/inference/issue-83606.stderr b/tests/ui/inference/issue-83606.stderr index 69d1d71ef3c..97ccad9e785 100644 --- a/tests/ui/inference/issue-83606.stderr +++ b/tests/ui/inference/issue-83606.stderr @@ -11,8 +11,8 @@ LL | fn foo<const N: usize>(_: impl std::fmt::Display) -> [usize; N] { | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` help: consider giving this pattern a type, where the value of const parameter `N` is specified | -LL | let _: [usize; N] = foo("foo"); - | ++++++++++++ +LL | let _: [_; N] = foo("foo"); + | ++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/inference/need_type_info/type-alias.stderr b/tests/ui/inference/need_type_info/type-alias.stderr index 2c39a3f5646..47393557828 100644 --- a/tests/ui/inference/need_type_info/type-alias.stderr +++ b/tests/ui/inference/need_type_info/type-alias.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed --> $DIR/type-alias.rs:12:5 | LL | DirectAlias::new() - | ^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T` + | ^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the type alias `DirectAlias` error[E0282]: type annotations needed --> $DIR/type-alias.rs:18:5 @@ -14,7 +14,7 @@ error[E0282]: type annotations needed --> $DIR/type-alias.rs:32:5 | LL | DirectButWithDefaultAlias::new(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the type alias `DirectButWithDefaultAlias` error: aborting due to 3 previous errors diff --git a/tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.rs b/tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.rs new file mode 100644 index 00000000000..4fd15eea9e0 --- /dev/null +++ b/tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.rs @@ -0,0 +1,10 @@ +type A = (i32, i32, i32, i32); +type B = (A, A, A, A); +type C = (B, B, B, B); +type D = (C, C, C, C); + +fn foo(x: D) { + let y = Err(x); //~ ERROR type annotations needed for `Result<_ +} + +fn main() {} diff --git a/tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.stderr b/tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.stderr new file mode 100644 index 00000000000..65fe2ffcb7f --- /dev/null +++ b/tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed for `Result<_, ((((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32))), (((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32))), (((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32))), (((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32))))>` + --> $DIR/really-long-type-in-let-binding-without-sufficient-type-info.rs:7:9 + | +LL | let y = Err(x); + | ^ ------ type must be known at this point + | +help: consider giving `y` an explicit type, where the type for type parameter `T` is specified + | +LL | let y: Result<T, _> = Err(x); + | ++++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/inference/str-as-char.stderr b/tests/ui/inference/str-as-char.stderr index 4ca71c5f067..2e70faa8cfa 100644 --- a/tests/ui/inference/str-as-char.stderr +++ b/tests/ui/inference/str-as-char.stderr @@ -6,8 +6,9 @@ LL | let _: &str = '"""'; | help: if you meant to write a string literal, use double quotes | -LL | let _: &str = "\"\"\""; - | ~~~~~~~~ +LL - let _: &str = '"""'; +LL + let _: &str = "\"\"\""; + | error: character literal may only contain one codepoint --> $DIR/str-as-char.rs:9:19 @@ -17,8 +18,9 @@ LL | let _: &str = '\"\"\"'; | help: if you meant to write a string literal, use double quotes | -LL | let _: &str = "\"\"\""; - | ~ ~ +LL - let _: &str = '\"\"\"'; +LL + let _: &str = "\"\"\""; + | error: character literal may only contain one codepoint --> $DIR/str-as-char.rs:10:19 @@ -28,8 +30,9 @@ LL | let _: &str = '"\"\"\\"\\"'; | help: if you meant to write a string literal, use double quotes | -LL | let _: &str = "\"\"\\"\\"\\\""; - | ~~~~~~~~~~~~~~~~~~~~ +LL - let _: &str = '"\"\"\\"\\"'; +LL + let _: &str = "\"\"\\"\\"\\\""; + | error[E0308]: mismatched types --> $DIR/str-as-char.rs:7:19 @@ -41,8 +44,9 @@ LL | let _: &str = 'a'; | help: if you meant to write a string literal, use double quotes | -LL | let _: &str = "a"; - | ~ ~ +LL - let _: &str = 'a'; +LL + let _: &str = "a"; + | error: aborting due to 4 previous errors diff --git a/tests/ui/infinite/infinite-assoc.stderr b/tests/ui/infinite/infinite-assoc.stderr index e6b91f13241..c55d85942a4 100644 --- a/tests/ui/infinite/infinite-assoc.stderr +++ b/tests/ui/infinite/infinite-assoc.stderr @@ -6,8 +6,9 @@ LL | struct A((A, <S as Trait>::T<NOT_EXIST?>)); | help: if you meant to express that the type might not contain a value, use the `Option` wrapper type | -LL | struct A((A, <S as Trait>::T<Option<NOT_EXIST>>)); - | +++++++ ~ +LL - struct A((A, <S as Trait>::T<NOT_EXIST?>)); +LL + struct A((A, <S as Trait>::T<Option<NOT_EXIST>>)); + | error[E0072]: recursive type `A` has infinite size --> $DIR/infinite-assoc.rs:12:1 diff --git a/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.rs b/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.rs index e28b8f373da..62fc079d9d9 100644 --- a/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.rs +++ b/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.rs @@ -3,6 +3,9 @@ //@ error-pattern: reached the recursion limit while instantiating //@ error-pattern: reached the recursion limit finding the struct tail +// The regex below normalizes the long type file name to make it suitable for compare-modes. +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" + // Regression test for #114484: This used to ICE during monomorphization, because we treated // `<VirtualWrapper<...> as Pointee>::Metadata` as a rigid projection after reaching the recursion // limit when finding the struct tail. diff --git a/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.stderr b/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.stderr index 7c961b79c0c..b67e000bf74 100644 --- a/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.stderr +++ b/tests/ui/infinite/infinite-instantiation-struct-tail-ice-114484.stderr @@ -18,7 +18,7 @@ error: reached the recursion limit finding the struct tail for `[u8; 256]` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` note: the above error was encountered while instantiating `fn virtualize_my_trait::<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<SomeData<256>, 0>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>>` - --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:26:18 + --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:29:18 | LL | unsafe { virtualize_my_trait(L, self) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -43,7 +43,7 @@ error: reached the recursion limit finding the struct tail for `SomeData<256>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` note: the above error was encountered while instantiating `fn virtualize_my_trait::<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<SomeData<256>, 0>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>>` - --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:26:18 + --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:29:18 | LL | unsafe { virtualize_my_trait(L, self) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -68,7 +68,7 @@ error: reached the recursion limit finding the struct tail for `VirtualWrapper<S = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` note: the above error was encountered while instantiating `fn virtualize_my_trait::<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<SomeData<256>, 0>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>, 1>>` - --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:26:18 + --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:29:18 | LL | unsafe { virtualize_my_trait(L, self) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -76,11 +76,11 @@ LL | unsafe { virtualize_my_trait(L, self) } error: reached the recursion limit while instantiating `<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<VirtualWrapper<..., 1>, 1>, 1>, 1>, 1> as MyTrait>::virtualize` | note: `<VirtualWrapper<T, L> as MyTrait>::virtualize` defined here - --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:25:5 + --> $DIR/infinite-instantiation-struct-tail-ice-114484.rs:28:5 | LL | fn virtualize(&self) -> &dyn MyTrait { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: the full type name has been written to '$TEST_BUILD_DIR/infinite/infinite-instantiation-struct-tail-ice-114484/infinite-instantiation-struct-tail-ice-114484.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' error: aborting due to 13 previous errors diff --git a/tests/ui/infinite/infinite-instantiation.rs b/tests/ui/infinite/infinite-instantiation.rs index 7e1bff6b124..d5cb8e79592 100644 --- a/tests/ui/infinite/infinite-instantiation.rs +++ b/tests/ui/infinite/infinite-instantiation.rs @@ -1,5 +1,6 @@ //@ build-fail -//@ normalize-stderr: ".nll/" -> "/" +// The regex below normalizes the long type file name to make it suitable for compare-modes. +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" trait ToOpt: Sized { fn to_option(&self) -> Option<Self>; diff --git a/tests/ui/infinite/infinite-instantiation.stderr b/tests/ui/infinite/infinite-instantiation.stderr index 43d267fa46b..71c745cf5eb 100644 --- a/tests/ui/infinite/infinite-instantiation.stderr +++ b/tests/ui/infinite/infinite-instantiation.stderr @@ -1,15 +1,15 @@ error: reached the recursion limit while instantiating `function::<Option<Option<Option<Option<Option<...>>>>>>` - --> $DIR/infinite-instantiation.rs:22:9 + --> $DIR/infinite-instantiation.rs:23:9 | LL | function(counter - 1, t.to_option()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `function` defined here - --> $DIR/infinite-instantiation.rs:20:1 + --> $DIR/infinite-instantiation.rs:21:1 | LL | fn function<T:ToOpt + Clone>(counter: usize, t: T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: the full type name has been written to '$TEST_BUILD_DIR/infinite/infinite-instantiation/infinite-instantiation.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' error: aborting due to 1 previous error diff --git a/tests/ui/inline-const/cross-const-control-flow-125846.stderr b/tests/ui/inline-const/cross-const-control-flow-125846.stderr index 4aa1c273504..0a910e70d09 100644 --- a/tests/ui/inline-const/cross-const-control-flow-125846.stderr +++ b/tests/ui/inline-const/cross-const-control-flow-125846.stderr @@ -26,8 +26,9 @@ LL | const { &x }; | help: consider using `const` instead of `let` | -LL | const x: /* Type */ = 1; - | ~~~~~ ++++++++++++ +LL - let x = 1; +LL + const x: /* Type */ = 1; + | error[E0728]: `await` is only allowed inside `async` functions and blocks --> $DIR/cross-const-control-flow-125846.rs:35:22 diff --git a/tests/ui/intrinsics/const-eval-select-bad.rs b/tests/ui/intrinsics/const-eval-select-bad.rs index 7e75de88d29..3365d57af7c 100644 --- a/tests/ui/intrinsics/const-eval-select-bad.rs +++ b/tests/ui/intrinsics/const-eval-select-bad.rs @@ -30,7 +30,7 @@ fn baz(n: bool) -> i32 { const fn return_ty_mismatch() { const_eval_select((1,), foo, bar); - //~^ ERROR expected `bar` to be a fn item that returns `i32`, but it returns `bool` + //~^ ERROR expected `bar` to return `i32`, but it returns `bool` } const fn args_ty_mismatch() { diff --git a/tests/ui/intrinsics/const-eval-select-bad.stderr b/tests/ui/intrinsics/const-eval-select-bad.stderr index e317ed23ab1..bb159bed282 100644 --- a/tests/ui/intrinsics/const-eval-select-bad.stderr +++ b/tests/ui/intrinsics/const-eval-select-bad.stderr @@ -60,7 +60,7 @@ LL | const_eval_select((), 42, 0xDEADBEEF); = note: expected a function item, found {integer} = help: consult the documentation on `const_eval_select` for more information -error[E0271]: expected `bar` to be a fn item that returns `i32`, but it returns `bool` +error[E0271]: expected `bar` to return `i32`, but it returns `bool` --> $DIR/const-eval-select-bad.rs:32:34 | LL | const_eval_select((1,), foo, bar); diff --git a/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs b/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs index 66de1f60ed9..5520430e140 100644 --- a/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs +++ b/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs @@ -3,5 +3,5 @@ fn main() { } extern "rust-intrinsic" fn read_via_copy() {} -//~^ ERROR intrinsics are subject to change +//~^ ERROR "rust-intrinsic" ABI is an implementation detail //~| ERROR intrinsic must be in `extern "rust-intrinsic" { ... }` block diff --git a/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr b/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr index 362ee185b7b..c6682693f74 100644 --- a/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr +++ b/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr @@ -1,4 +1,4 @@ -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/incorrect-read_via_copy-defn.rs:5:8 | LL | extern "rust-intrinsic" fn read_via_copy() {} diff --git a/tests/ui/intrinsics/incorrect-transmute.rs b/tests/ui/intrinsics/incorrect-transmute.rs index eed524ae8a8..15d1ab939ed 100644 --- a/tests/ui/intrinsics/incorrect-transmute.rs +++ b/tests/ui/intrinsics/incorrect-transmute.rs @@ -3,5 +3,5 @@ fn main() { } extern "rust-intrinsic" fn transmute() {} -//~^ ERROR intrinsics are subject to change +//~^ ERROR "rust-intrinsic" ABI is an implementation detail //~| ERROR intrinsic must be in `extern "rust-intrinsic" { ... }` block diff --git a/tests/ui/intrinsics/incorrect-transmute.stderr b/tests/ui/intrinsics/incorrect-transmute.stderr index 8123f3d71a2..99dfb9847ff 100644 --- a/tests/ui/intrinsics/incorrect-transmute.stderr +++ b/tests/ui/intrinsics/incorrect-transmute.stderr @@ -1,4 +1,4 @@ -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/incorrect-transmute.rs:5:8 | LL | extern "rust-intrinsic" fn transmute() {} diff --git a/tests/ui/invalid-compile-flags/crate-type-flag.rs b/tests/ui/invalid-compile-flags/crate-type-flag.rs index bc7a0bc46c3..07d853b3307 100644 --- a/tests/ui/invalid-compile-flags/crate-type-flag.rs +++ b/tests/ui/invalid-compile-flags/crate-type-flag.rs @@ -17,12 +17,12 @@ //@[staticlib] compile-flags: --crate-type=staticlib //@[staticlib] check-pass -//@[dylib] ignore-musl (dylibs are not supported) -//@[dylib] ignore-wasm (dylibs are not supported) +//@[dylib] ignore-musl (dylib is supported, but musl libc is statically linked by default) +//@[dylib] ignore-wasm (dylib is not supported) //@[dylib] compile-flags: --crate-type=dylib //@[dylib] check-pass -//@[cdylib] ignore-musl (cdylibs are not supported) +//@[cdylib] ignore-musl (cdylib is supported, but musl libc is statically linked by default) //@[cdylib] compile-flags: --crate-type=cdylib //@[cdylib] check-pass @@ -39,9 +39,7 @@ //@[multivalue] compile-flags: --crate-type=lib,rlib,staticlib //@[multivalue] check-pass -//@[multivalue_combined] ignore-musl (dylibs are not supported) -//@[multivalue_combined] ignore-wasm (dylibs are not supported) -//@[multivalue_combined] compile-flags: --crate-type=lib,rlib,staticlib --crate-type=dylib +//@[multivalue_combined] compile-flags: --crate-type=lib,rlib --crate-type=staticlib //@[multivalue_combined] check-pass // `proc-macro` is accepted, but `proc_macro` is not. diff --git a/tests/ui/command/need-crate-arg-ignore-tidy$x.rs b/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.rs index b1ac4a4ae21..b1ac4a4ae21 100644 --- a/tests/ui/command/need-crate-arg-ignore-tidy$x.rs +++ b/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.rs diff --git a/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.stderr b/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.stderr new file mode 100644 index 00000000000..861510212f9 --- /dev/null +++ b/tests/ui/invalid-compile-flags/need-crate-arg-ignore-tidy$x.stderr @@ -0,0 +1,6 @@ +error: invalid character '$' in crate name: `need_crate_arg_ignore_tidy$x` + | + = help: you can either pass `--crate-name` on the command line or add `#![crate_name = "…"]` to set the crate name + +error: aborting due to 1 previous error + 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 new file mode 100644 index 00000000000..c7f3c2c5403 --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.rs @@ -0,0 +1,5 @@ +// Ensure we validate `#![crate_name]` on print requests and reject macro calls inside of it. +// 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 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 new file mode 100644 index 00000000000..6bf09a2b131 --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-crate-name-request-malformed-crate-name.stderr @@ -0,0 +1,8 @@ +error: malformed `crate_name` attribute input + --> $DIR/print-crate-name-request-malformed-crate-name.rs:5:1 + | +LL | #![crate_name = concat!("wrapped")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` + +error: aborting due to 1 previous error + diff --git a/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.rs b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.rs new file mode 100644 index 00000000000..5cf1ae36b42 --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.rs @@ -0,0 +1,4 @@ +// Ensure we validate `#![crate_name]` on print requests. + +//@ compile-flags: --print=file-names +#![crate_name] //~ ERROR malformed `crate_name` attribute input 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 new file mode 100644 index 00000000000..de62aed79fc --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-1.stderr @@ -0,0 +1,8 @@ +error: 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"]` + +error: aborting due to 1 previous error + 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 new file mode 100644 index 00000000000..13c9d1e0027 --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.rs @@ -0,0 +1,7 @@ +// Ensure that we validate *all* `#![crate_name]`s on print requests, not just the first, +// and that we reject macro calls inside of them. +// See also <https://github.com/rust-lang/rust/issues/122001>. + +//@ compile-flags: --print=file-names +#![crate_name = "this_one_is_okay"] +#![crate_name = concat!("this_one_is_not")] //~ ERROR malformed `crate_name` attribute input 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 new file mode 100644 index 00000000000..42c33de1221 --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name-2.stderr @@ -0,0 +1,8 @@ +error: malformed `crate_name` attribute input + --> $DIR/print-file-names-request-malformed-crate-name-2.rs:7:1 + | +LL | #![crate_name = concat!("this_one_is_not")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` + +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 new file mode 100644 index 00000000000..5fe8bd7945f --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.rs @@ -0,0 +1,5 @@ +// Ensure we validate `#![crate_name]` on print requests and reject macro calls inside of it. +// 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 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 new file mode 100644 index 00000000000..cb5ffaab9ca --- /dev/null +++ b/tests/ui/invalid-compile-flags/print-file-names-request-malformed-crate-name.stderr @@ -0,0 +1,8 @@ +error: malformed `crate_name` attribute input + --> $DIR/print-file-names-request-malformed-crate-name.rs:5:1 + | +LL | #![crate_name = concat!("wrapped")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![crate_name = "name"]` + +error: aborting due to 1 previous error + diff --git a/tests/ui/invalid/invalid-rustc_legacy_const_generics-issue-123077.stderr b/tests/ui/invalid/invalid-rustc_legacy_const_generics-issue-123077.stderr index 7e05ae4f20c..d92836aa063 100644 --- a/tests/ui/invalid/invalid-rustc_legacy_const_generics-issue-123077.stderr +++ b/tests/ui/invalid/invalid-rustc_legacy_const_generics-issue-123077.stderr @@ -6,8 +6,9 @@ LL | std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, || ()); | help: try using a const generic argument instead | -LL | std::arch::x86_64::_mm_blend_ps::<{ || () }>(loop {}, loop {}); - | +++++++++++++ ~~~~~~~~~~~~~~~~ +LL - std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, || ()); +LL + std::arch::x86_64::_mm_blend_ps::<{ || () }>(loop {}, loop {}); + | error: invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items --> $DIR/invalid-rustc_legacy_const_generics-issue-123077.rs:11:59 @@ -17,8 +18,9 @@ LL | std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, 5 + || ()); | help: try using a const generic argument instead | -LL | std::arch::x86_64::_mm_blend_ps::<{ 5 + (|| ()) }>(loop {}, loop {}); - | +++++++++++++++++++ ~~~~~~~~~~~~~~~~ +LL - std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, 5 + || ()); +LL + std::arch::x86_64::_mm_blend_ps::<{ 5 + (|| ()) }>(loop {}, loop {}); + | error: invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items --> $DIR/invalid-rustc_legacy_const_generics-issue-123077.rs:14:61 @@ -28,8 +30,9 @@ LL | std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, foo::<{ 1 + 2 }>()); | help: try using a const generic argument instead | -LL | std::arch::x86_64::_mm_blend_ps::<{ foo::<{ 1 + 2 }>() }>(loop {}, loop {}); - | ++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~~ +LL - std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, foo::<{ 1 + 2 }>()); +LL + std::arch::x86_64::_mm_blend_ps::<{ foo::<{ 1 + 2 }>() }>(loop {}, loop {}); + | error: invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items --> $DIR/invalid-rustc_legacy_const_generics-issue-123077.rs:17:61 @@ -39,8 +42,9 @@ LL | std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, foo::<3>()); | help: try using a const generic argument instead | -LL | std::arch::x86_64::_mm_blend_ps::<{ foo::<3>() }>(loop {}, loop {}); - | ++++++++++++++++++ ~~~~~~~~~~~~~~~~ +LL - std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, foo::<3>()); +LL + std::arch::x86_64::_mm_blend_ps::<{ foo::<3>() }>(loop {}, loop {}); + | error: invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items --> $DIR/invalid-rustc_legacy_const_generics-issue-123077.rs:20:56 @@ -50,8 +54,9 @@ LL | std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, &const {}); | help: try using a const generic argument instead | -LL | std::arch::x86_64::_mm_blend_ps::<{ &const {} }>(loop {}, loop {}); - | +++++++++++++++++ ~~~~~~~~~~~~~~~~ +LL - std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, &const {}); +LL + std::arch::x86_64::_mm_blend_ps::<{ &const {} }>(loop {}, loop {}); + | error: invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items --> $DIR/invalid-rustc_legacy_const_generics-issue-123077.rs:24:9 @@ -75,8 +80,9 @@ LL | std::arch::x86_64::_mm_inserti_si64(loop {}, loop {}, || (), 1 + || ()) | help: try using a const generic argument instead | -LL | std::arch::x86_64::_mm_inserti_si64::<{ || () }, { 1 + (|| ()) }>(loop {}, loop {}); - | ++++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~~ +LL - std::arch::x86_64::_mm_inserti_si64(loop {}, loop {}, || (), 1 + || ()); +LL + std::arch::x86_64::_mm_inserti_si64::<{ || () }, { 1 + (|| ()) }>(loop {}, loop {}); + | error: aborting due to 7 previous errors diff --git a/tests/ui/issues/issue-13497.stderr b/tests/ui/issues/issue-13497.stderr index 7630848f6a5..8016b55d6aa 100644 --- a/tests/ui/issues/issue-13497.stderr +++ b/tests/ui/issues/issue-13497.stderr @@ -11,8 +11,9 @@ LL | &'static str | +++++++ help: instead, you are more likely to want to return an owned value | -LL | String - | ~~~~~~ +LL - &str +LL + String + | error[E0515]: cannot return value referencing local variable `rawLines` --> $DIR/issue-13497.rs:5:5 diff --git a/tests/ui/issues/issue-17546.stderr b/tests/ui/issues/issue-17546.stderr index cf7ed1bbd66..25a94dd9723 100644 --- a/tests/ui/issues/issue-17546.stderr +++ b/tests/ui/issues/issue-17546.stderr @@ -9,12 +9,14 @@ LL | fn new() -> NoResult<MyEnum, String> { | help: try using the variant's enum | -LL | fn new() -> foo::MyEnum { - | ~~~~~~~~~~~ +LL - fn new() -> NoResult<MyEnum, String> { +LL + fn new() -> foo::MyEnum { + | help: an enum with a similar name exists | -LL | fn new() -> Result<MyEnum, String> { - | ~~~~~~ +LL - fn new() -> NoResult<MyEnum, String> { +LL + fn new() -> Result<MyEnum, String> { + | error[E0573]: expected type, found variant `Result` --> $DIR/issue-17546.rs:24:17 @@ -61,12 +63,14 @@ LL | fn newer() -> NoResult<foo::MyEnum, String> { | help: try using the variant's enum | -LL | fn newer() -> foo::MyEnum { - | ~~~~~~~~~~~ +LL - fn newer() -> NoResult<foo::MyEnum, String> { +LL + fn newer() -> foo::MyEnum { + | help: an enum with a similar name exists | -LL | fn newer() -> Result<foo::MyEnum, String> { - | ~~~~~~ +LL - fn newer() -> NoResult<foo::MyEnum, String> { +LL + fn newer() -> Result<foo::MyEnum, String> { + | error: aborting due to 4 previous errors diff --git a/tests/ui/issues/issue-17800.stderr b/tests/ui/issues/issue-17800.stderr index 2a15af50d02..322c77eaa1d 100644 --- a/tests/ui/issues/issue-17800.stderr +++ b/tests/ui/issues/issue-17800.stderr @@ -6,8 +6,9 @@ LL | MyOption::MySome { x: 42 } => (), | help: use the tuple variant pattern syntax instead | -LL | MyOption::MySome(42) => (), - | ~~~~ +LL - MyOption::MySome { x: 42 } => (), +LL + MyOption::MySome(42) => (), + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-17954.stderr b/tests/ui/issues/issue-17954.stderr index bba7e725b12..0dddea83364 100644 --- a/tests/ui/issues/issue-17954.stderr +++ b/tests/ui/issues/issue-17954.stderr @@ -5,7 +5,7 @@ LL | let a = &FOO; | ^^^^ thread-local variables cannot be borrowed beyond the end of the function ... LL | } - | - end of enclosing function is here + | - end of enclosing function is here error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-18107.rs b/tests/ui/issues/issue-18107.rs index 4bf5b6c0f30..b1b6ff4f7ad 100644 --- a/tests/ui/issues/issue-18107.rs +++ b/tests/ui/issues/issue-18107.rs @@ -2,7 +2,7 @@ pub trait AbstractRenderer {} fn _create_render(_: &()) -> dyn AbstractRenderer -//~^ ERROR return type cannot have an unboxed trait object +//~^ ERROR return type cannot be a trait object without pointer indirection { match 0 { _ => unimplemented!() diff --git a/tests/ui/issues/issue-18107.stderr b/tests/ui/issues/issue-18107.stderr index 705f7d0df12..177ef2f1c33 100644 --- a/tests/ui/issues/issue-18107.stderr +++ b/tests/ui/issues/issue-18107.stderr @@ -1,4 +1,4 @@ -error[E0746]: return type cannot have an unboxed trait object +error[E0746]: return type cannot be a trait object without pointer indirection --> $DIR/issue-18107.rs:4:5 | LL | dyn AbstractRenderer @@ -6,8 +6,9 @@ LL | dyn AbstractRenderer | help: consider returning an `impl Trait` instead of a `dyn Trait` | -LL | impl AbstractRenderer - | ~~~~ +LL - dyn AbstractRenderer +LL + impl AbstractRenderer + | help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL ~ Box<dyn AbstractRenderer> diff --git a/tests/ui/issues/issue-18446.stderr b/tests/ui/issues/issue-18446.stderr index 08a9cfc644f..25ae303e902 100644 --- a/tests/ui/issues/issue-18446.stderr +++ b/tests/ui/issues/issue-18446.stderr @@ -16,8 +16,9 @@ LL | fn foo(&self) {} | ^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | T::foo(&x); - | ~~~~~~~~~~ +LL - x.foo(); +LL + T::foo(&x); + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-18959.stderr b/tests/ui/issues/issue-18959.stderr index 49d501c397f..c37c4177bfc 100644 --- a/tests/ui/issues/issue-18959.stderr +++ b/tests/ui/issues/issue-18959.stderr @@ -5,7 +5,7 @@ LL | fn foo(b: &dyn Bar) { | ^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-18959.rs:1:20 | LL | pub trait Foo { fn foo<T>(&self, ext_thing: &T); } @@ -21,7 +21,7 @@ LL | b.foo(&0) | ^^^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-18959.rs:1:20 | LL | pub trait Foo { fn foo<T>(&self, ext_thing: &T); } @@ -37,7 +37,7 @@ LL | let test: &dyn Bar = &mut thing; | ^^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-18959.rs:1:20 | LL | pub trait Foo { fn foo<T>(&self, ext_thing: &T); } @@ -53,7 +53,7 @@ LL | let test: &dyn Bar = &mut thing; | ^^^^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-18959.rs:1:20 | LL | pub trait Foo { fn foo<T>(&self, ext_thing: &T); } @@ -70,7 +70,7 @@ LL | foo(test); | ^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-18959.rs:1:20 | LL | pub trait Foo { fn foo<T>(&self, ext_thing: &T); } diff --git a/tests/ui/issues/issue-19380.stderr b/tests/ui/issues/issue-19380.stderr index 7d4812c3693..f8509891d3a 100644 --- a/tests/ui/issues/issue-19380.stderr +++ b/tests/ui/issues/issue-19380.stderr @@ -5,7 +5,7 @@ LL | foos: &'static [&'static (dyn Qiz + 'static)] | ^^^^^^^^^^^^^^^^^ `Qiz` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-19380.rs:2:6 | LL | trait Qiz { @@ -29,7 +29,7 @@ LL | const BAR : Bar = Bar { foos: &[&FOO]}; | ^^^^ `Qiz` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-19380.rs:2:6 | LL | trait Qiz { @@ -54,7 +54,7 @@ LL | const BAR : Bar = Bar { foos: &[&FOO]}; | ^^^^^^^ `Qiz` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-19380.rs:2:6 | LL | trait Qiz { diff --git a/tests/ui/issues/issue-20225.stderr b/tests/ui/issues/issue-20225.stderr index 7d6b09cf7f8..6a3c4e2a836 100644 --- a/tests/ui/issues/issue-20225.stderr +++ b/tests/ui/issues/issue-20225.stderr @@ -10,8 +10,9 @@ LL | extern "rust-call" fn call(&self, (_,): (T,)) {} found signature `extern "rust-call" fn(&Foo, (_,))` help: change the parameter type to match the trait | -LL | extern "rust-call" fn call(&self, (_,): (&'a T,)) {} - | ~~~~~~~~ +LL - extern "rust-call" fn call(&self, (_,): (T,)) {} +LL + extern "rust-call" fn call(&self, (_,): (&'a T,)) {} + | error[E0053]: method `call_mut` has an incompatible type for trait --> $DIR/issue-20225.rs:11:51 @@ -25,8 +26,9 @@ LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {} found signature `extern "rust-call" fn(&mut Foo, (_,))` help: change the parameter type to match the trait | -LL | extern "rust-call" fn call_mut(&mut self, (_,): (&'a T,)) {} - | ~~~~~~~~ +LL - extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {} +LL + extern "rust-call" fn call_mut(&mut self, (_,): (&'a T,)) {} + | error[E0053]: method `call_once` has an incompatible type for trait --> $DIR/issue-20225.rs:18:47 @@ -41,8 +43,9 @@ LL | extern "rust-call" fn call_once(self, (_,): (T,)) {} found signature `extern "rust-call" fn(Foo, (_,))` help: change the parameter type to match the trait | -LL | extern "rust-call" fn call_once(self, (_,): (&'a T,)) {} - | ~~~~~~~~ +LL - extern "rust-call" fn call_once(self, (_,): (T,)) {} +LL + extern "rust-call" fn call_once(self, (_,): (&'a T,)) {} + | error: aborting due to 3 previous errors diff --git a/tests/ui/issues/issue-20831-debruijn.stderr b/tests/ui/issues/issue-20831-debruijn.stderr index fe310998f09..bed75ed6ba2 100644 --- a/tests/ui/issues/issue-20831-debruijn.stderr +++ b/tests/ui/issues/issue-20831-debruijn.stderr @@ -1,4 +1,4 @@ -error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements --> $DIR/issue-20831-debruijn.rs:28:33 | LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) { @@ -48,4 +48,4 @@ LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0495`. +For more information about this error, try `rustc --explain E0803`. diff --git a/tests/ui/issues/issue-21332.stderr b/tests/ui/issues/issue-21332.stderr index 7c960f7646d..237b3acc9b4 100644 --- a/tests/ui/issues/issue-21332.stderr +++ b/tests/ui/issues/issue-21332.stderr @@ -8,8 +8,9 @@ LL | fn next(&mut self) -> Result<i32, i32> { Ok(7) } found signature `fn(&mut S) -> Result<i32, i32>` help: change the output type to match the trait | -LL | fn next(&mut self) -> Option<i32> { Ok(7) } - | ~~~~~~~~~~~ +LL - fn next(&mut self) -> Result<i32, i32> { Ok(7) } +LL + fn next(&mut self) -> Option<i32> { Ok(7) } + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-23041.stderr b/tests/ui/issues/issue-23041.stderr index 0142926dd15..bd0e457fa9d 100644 --- a/tests/ui/issues/issue-23041.stderr +++ b/tests/ui/issues/issue-23041.stderr @@ -6,8 +6,9 @@ LL | b.downcast_ref::<fn(_)->_>(); | help: consider specifying the generic argument | -LL | b.downcast_ref::<fn(_) -> _>(); - | ~~~~~~~~~~~~~~ +LL - b.downcast_ref::<fn(_)->_>(); +LL + b.downcast_ref::<fn(_) -> _>(); + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-23073.stderr b/tests/ui/issues/issue-23073.stderr index 6a61df8d46b..8aa86887bcf 100644 --- a/tests/ui/issues/issue-23073.stderr +++ b/tests/ui/issues/issue-23073.stderr @@ -6,8 +6,9 @@ LL | type FooT = <<Self as Bar>::Foo>::T; | help: if there were a trait named `Example` with associated type `T` implemented for `<Self as Bar>::Foo`, you could use the fully-qualified path | -LL | type FooT = <<Self as Bar>::Foo as Example>::T; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - type FooT = <<Self as Bar>::Foo>::T; +LL + type FooT = <<Self as Bar>::Foo as Example>::T; + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-23217.stderr b/tests/ui/issues/issue-23217.stderr index d14da75ab72..830d260f99d 100644 --- a/tests/ui/issues/issue-23217.stderr +++ b/tests/ui/issues/issue-23217.stderr @@ -8,8 +8,9 @@ LL | B = SomeEnum::A, | help: there is a variant with a similar name | -LL | B = SomeEnum::B, - | ~ +LL - B = SomeEnum::A, +LL + B = SomeEnum::B, + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-23589.stderr b/tests/ui/issues/issue-23589.stderr index 21d383b0e8c..726efea1d6f 100644 --- a/tests/ui/issues/issue-23589.stderr +++ b/tests/ui/issues/issue-23589.stderr @@ -6,8 +6,9 @@ LL | let v: Vec(&str) = vec!['1', '2']; | help: use angle brackets instead | -LL | let v: Vec<&str> = vec!['1', '2']; - | ~ ~ +LL - let v: Vec(&str) = vec!['1', '2']; +LL + let v: Vec<&str> = vec!['1', '2']; + | error[E0308]: mismatched types --> $DIR/issue-23589.rs:2:29 @@ -17,8 +18,9 @@ LL | let v: Vec(&str) = vec!['1', '2']; | help: if you meant to write a string literal, use double quotes | -LL | let v: Vec(&str) = vec!["1", '2']; - | ~ ~ +LL - let v: Vec(&str) = vec!['1', '2']; +LL + let v: Vec(&str) = vec!["1", '2']; + | error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-26056.stderr b/tests/ui/issues/issue-26056.stderr index d1cdf43351e..c2168af9496 100644 --- a/tests/ui/issues/issue-26056.stderr +++ b/tests/ui/issues/issue-26056.stderr @@ -5,7 +5,7 @@ LL | as &dyn Map<Key=u32,MapValue=u32>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ `Map` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-26056.rs:9:12 | LL | trait Map: MapLookup<<Self as Map>::Key> { diff --git a/tests/ui/issues/issue-27433.stderr b/tests/ui/issues/issue-27433.stderr index f6d5fc2b768..d8fd3d84ecb 100644 --- a/tests/ui/issues/issue-27433.stderr +++ b/tests/ui/issues/issue-27433.stderr @@ -6,8 +6,9 @@ LL | const FOO : u32 = foo; | help: consider using `let` instead of `const` | -LL | let FOO : u32 = foo; - | ~~~ +LL - const FOO : u32 = foo; +LL + let FOO : u32 = foo; + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-28971.stderr b/tests/ui/issues/issue-28971.stderr index 7ca57d6b998..fd689a2b36e 100644 --- a/tests/ui/issues/issue-28971.stderr +++ b/tests/ui/issues/issue-28971.stderr @@ -9,8 +9,9 @@ LL | Foo::Baz(..) => (), | help: there is a variant with a similar name | -LL | Foo::Bar(..) => (), - | ~~~ +LL - Foo::Baz(..) => (), +LL + Foo::Bar(..) => (), + | error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable --> $DIR/issue-28971.rs:15:5 diff --git a/tests/ui/issues/issue-32004.stderr b/tests/ui/issues/issue-32004.stderr index 2d2ed5a6301..fcbec97661b 100644 --- a/tests/ui/issues/issue-32004.stderr +++ b/tests/ui/issues/issue-32004.stderr @@ -12,11 +12,12 @@ LL | Foo::Bar => {} help: use the tuple variant pattern syntax instead | LL | Foo::Bar(_) => {} - | ~~~~~~~~~~~ + | +++ help: a unit variant with a similar name exists | -LL | Foo::Baz => {} - | ~~~ +LL - Foo::Bar => {} +LL + Foo::Baz => {} + | error[E0532]: expected tuple struct or tuple variant, found unit struct `S` --> $DIR/issue-32004.rs:16:9 diff --git a/tests/ui/issues/issue-34209.stderr b/tests/ui/issues/issue-34209.stderr index 4c61d250f52..83b40d0c081 100644 --- a/tests/ui/issues/issue-34209.stderr +++ b/tests/ui/issues/issue-34209.stderr @@ -9,8 +9,9 @@ LL | S::B {} => {}, | help: there is a variant with a similar name | -LL | S::A {} => {}, - | ~ +LL - S::B {} => {}, +LL + S::A {} => {}, + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-3521-2.stderr b/tests/ui/issues/issue-3521-2.stderr index a12241cb1df..ecf1ad0403d 100644 --- a/tests/ui/issues/issue-3521-2.stderr +++ b/tests/ui/issues/issue-3521-2.stderr @@ -6,8 +6,9 @@ LL | static y: isize = foo + 1; | help: consider using `let` instead of `static` | -LL | let y: isize = foo + 1; - | ~~~ +LL - static y: isize = foo + 1; +LL + let y: isize = foo + 1; + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.stderr b/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.stderr index 9661dbf2f62..f87514ba83b 100644 --- a/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.stderr +++ b/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.stderr @@ -6,8 +6,9 @@ LL | static child: isize = x + 1; | help: consider using `let` instead of `static` | -LL | let child: isize = x + 1; - | ~~~ +LL - static child: isize = x + 1; +LL + let child: isize = x + 1; + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.stderr b/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.stderr index 7fad45f4b1a..06e0192d957 100644 --- a/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.stderr +++ b/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.stderr @@ -6,8 +6,9 @@ LL | static childVal: Box<P> = self.child.get(); | help: consider using `let` instead of `static` | -LL | let childVal: Box<P> = self.child.get(); - | ~~~ +LL - static childVal: Box<P> = self.child.get(); +LL + let childVal: Box<P> = self.child.get(); + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-3702-2.stderr b/tests/ui/issues/issue-3702-2.stderr index 7ab6520a0ca..448263aafd4 100644 --- a/tests/ui/issues/issue-3702-2.stderr +++ b/tests/ui/issues/issue-3702-2.stderr @@ -16,12 +16,14 @@ LL | fn to_int(&self) -> isize { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | Add::to_int(&self) + other.to_int() - | ~~~~~~~~~~~~~~~~~~ +LL - self.to_int() + other.to_int() +LL + Add::to_int(&self) + other.to_int() + | help: disambiguate the method for candidate #2 | -LL | ToPrimitive::to_int(&self) + other.to_int() - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - self.to_int() + other.to_int() +LL + ToPrimitive::to_int(&self) + other.to_int() + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs index edf4f2fce26..ebaf244ac9c 100644 --- a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs +++ b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.rs @@ -1,5 +1,6 @@ //@ build-fail -//@ normalize-stderr: ".nll/" -> "/" +// The regex below normalizes the long type file name to make it suitable for compare-modes. +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" trait Mirror { type Image; diff --git a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr index 84ed97572b3..fbbf80021be 100644 --- a/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr +++ b/tests/ui/issues/issue-37311-type-length-limit/issue-37311.stderr @@ -1,15 +1,15 @@ error: reached the recursion limit while instantiating `<(&(&(..., ...), ...), ...) as Foo>::recurse` - --> $DIR/issue-37311.rs:17:9 + --> $DIR/issue-37311.rs:18:9 | LL | (self, self).recurse(); | ^^^^^^^^^^^^^^^^^^^^^^ | note: `<T as Foo>::recurse` defined here - --> $DIR/issue-37311.rs:16:5 + --> $DIR/issue-37311.rs:17:5 | LL | fn recurse(&self) { | ^^^^^^^^^^^^^^^^^ - = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-37311-type-length-limit/issue-37311/issue-37311.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-37534.rs b/tests/ui/issues/issue-37534.rs index dff89d3888d..09d60b7786b 100644 --- a/tests/ui/issues/issue-37534.rs +++ b/tests/ui/issues/issue-37534.rs @@ -1,5 +1,5 @@ struct Foo<T: ?Hash> {} //~^ ERROR expected trait, found derive macro `Hash` -//~| WARN relaxing a default bound only does something for `?Sized` +//~| ERROR relaxing a default bound only does something for `?Sized` fn main() {} diff --git a/tests/ui/issues/issue-37534.stderr b/tests/ui/issues/issue-37534.stderr index 8747bd5ac6f..3219854bc70 100644 --- a/tests/ui/issues/issue-37534.stderr +++ b/tests/ui/issues/issue-37534.stderr @@ -9,12 +9,12 @@ help: consider importing this trait instead LL + use std::hash::Hash; | -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/issue-37534.rs:1:15 | LL | struct Foo<T: ?Hash> {} | ^^^^^ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0404`. diff --git a/tests/ui/issues/issue-41652/issue-41652.stderr b/tests/ui/issues/issue-41652/issue-41652.stderr index a5a2fab2ede..4a81e76af75 100644 --- a/tests/ui/issues/issue-41652/issue-41652.stderr +++ b/tests/ui/issues/issue-41652/issue-41652.stderr @@ -7,7 +7,7 @@ LL | 3.f() help: you must specify a concrete type for this numeric value, like `i32` | LL | 3_i32.f() - | ~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-41726.stderr b/tests/ui/issues/issue-41726.stderr index 250bba222bf..d5123ab679f 100644 --- a/tests/ui/issues/issue-41726.stderr +++ b/tests/ui/issues/issue-41726.stderr @@ -7,8 +7,9 @@ LL | things[src.as_str()].sort(); = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<String, Vec<String>>` help: to modify a `HashMap<String, Vec<String>>` use `.get_mut()` | -LL | if let Some(val) = things.get_mut(src.as_str()) { val.sort(); }; - | ++++++++++++++++++ ~~~~~~~~~ ~~~~~~~ +++ +LL - things[src.as_str()].sort(); +LL + if let Some(val) = things.get_mut(src.as_str()) { val.sort(); }; + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-42312.stderr b/tests/ui/issues/issue-42312.stderr index cbdc9ce0f83..68d9912e3b1 100644 --- a/tests/ui/issues/issue-42312.stderr +++ b/tests/ui/issues/issue-42312.stderr @@ -25,8 +25,9 @@ LL | pub fn f(_: dyn ToString) {} = help: unsized fn params are gated as an unstable feature help: you can use `impl Trait` as the argument type | -LL | pub fn f(_: impl ToString) {} - | ~~~~ +LL - pub fn f(_: dyn ToString) {} +LL + pub fn f(_: impl ToString) {} + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | pub fn f(_: &dyn ToString) {} diff --git a/tests/ui/issues/issue-44239.stderr b/tests/ui/issues/issue-44239.stderr index 1a047d4c63b..8048e32f149 100644 --- a/tests/ui/issues/issue-44239.stderr +++ b/tests/ui/issues/issue-44239.stderr @@ -6,8 +6,9 @@ LL | const N: usize = n; | help: consider using `const` instead of `let` | -LL | const n: usize = 0; - | ~~~~~ +LL - let n: usize = 0; +LL + const n: usize = 0; + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr b/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr index 0aa1ae7222f..0a6fe24d5e3 100644 --- a/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr +++ b/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr @@ -6,8 +6,9 @@ LL | let _condemned = justice.00; | help: a field with a similar name exists | -LL | let _condemned = justice.0; - | ~ +LL - let _condemned = justice.00; +LL + let _condemned = justice.0; + | error[E0609]: no field `001` on type `Verdict` --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:10:31 diff --git a/tests/ui/issues/issue-4736.stderr b/tests/ui/issues/issue-4736.stderr index c1ae2c47b43..b099e528ca8 100644 --- a/tests/ui/issues/issue-4736.stderr +++ b/tests/ui/issues/issue-4736.stderr @@ -9,8 +9,9 @@ LL | let z = NonCopyable{ p: () }; | help: `NonCopyable` is a tuple struct, use the appropriate syntax | -LL | let z = NonCopyable(/* () */); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - let z = NonCopyable{ p: () }; +LL + let z = NonCopyable(/* () */); + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-4935.stderr b/tests/ui/issues/issue-4935.stderr index 7ee895d91c7..918f74256c0 100644 --- a/tests/ui/issues/issue-4935.stderr +++ b/tests/ui/issues/issue-4935.stderr @@ -8,7 +8,7 @@ note: function defined here --> $DIR/issue-4935.rs:3:4 | LL | fn foo(a: usize) {} - | ^^^ -------- + | ^^^ help: remove the extra argument | LL - fn main() { foo(5, 6) } diff --git a/tests/ui/issues/issue-50571.stderr b/tests/ui/issues/issue-50571.stderr index 12256ded1c0..86709410670 100644 --- a/tests/ui/issues/issue-50571.stderr +++ b/tests/ui/issues/issue-50571.stderr @@ -6,8 +6,9 @@ LL | fn foo([a, b]: [i32; 2]) {} | help: give this argument a name or use an underscore to ignore it | -LL | fn foo(_: [i32; 2]) {} - | ~ +LL - fn foo([a, b]: [i32; 2]) {} +LL + fn foo(_: [i32; 2]) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-50781.stderr b/tests/ui/issues/issue-50781.stderr index 293e9839944..88b83a83e0c 100644 --- a/tests/ui/issues/issue-50781.stderr +++ b/tests/ui/issues/issue-50781.stderr @@ -5,7 +5,7 @@ LL | impl Trait for dyn X {} | ^^^^^ `X` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-50781.rs:4:8 | LL | trait X { @@ -22,7 +22,7 @@ LL | <dyn X as X>::foo(&()); | ^^^ `X` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-50781.rs:4:8 | LL | trait X { @@ -40,7 +40,7 @@ LL | <dyn X as X>::foo(&()); | ^^^^^ `X` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-50781.rs:4:8 | LL | trait X { diff --git a/tests/ui/issues/issue-51874.stderr b/tests/ui/issues/issue-51874.stderr index 5be3695dd45..5c9331b4e1e 100644 --- a/tests/ui/issues/issue-51874.stderr +++ b/tests/ui/issues/issue-51874.stderr @@ -7,7 +7,7 @@ LL | let a = (1.0).pow(1.0); help: you must specify a concrete type for this numeric value, like `f32` | LL | let a = (1.0_f32).pow(1.0); - | ~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-5358-1.stderr b/tests/ui/issues/issue-5358-1.stderr index 1bb946ce4cb..e68db865dc4 100644 --- a/tests/ui/issues/issue-5358-1.stderr +++ b/tests/ui/issues/issue-5358-1.stderr @@ -15,7 +15,7 @@ LL | S(Either::Right(_)) => {} help: you might have meant to use field `0` whose type is `Either<usize, usize>` | LL | match S(Either::Left(5)).0 { - | ~~~~~~~~~~~~~~~~~~~~ + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr index 6ed35c3a3d3..df4cd6ce8a7 100644 --- a/tests/ui/issues/issue-56175.stderr +++ b/tests/ui/issues/issue-56175.stderr @@ -17,7 +17,7 @@ LL + use reexported_trait::Trait; help: there is a method `trait_method_b` with a similar name | LL | reexported_trait::FooStruct.trait_method_b(); - | ~~~~~~~~~~~~~~ + | ++ error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope --> $DIR/issue-56175.rs:7:33 @@ -37,8 +37,9 @@ LL + use reexported_trait::TraitBRename; | help: there is a method `trait_method` with a similar name | -LL | reexported_trait::FooStruct.trait_method(); - | ~~~~~~~~~~~~ +LL - reexported_trait::FooStruct.trait_method_b(); +LL + reexported_trait::FooStruct.trait_method(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr index 3c19b68cffb..62d83a54614 100644 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr +++ b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr @@ -11,7 +11,7 @@ LL | T::A(a) | T::B(a) => a, help: consider dereferencing the boxed value | LL | let y = match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/issue-57741.rs:20:19 @@ -26,7 +26,7 @@ LL | T::A(a) | T::B(a) => a, help: consider dereferencing the boxed value | LL | let y = match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:9 @@ -41,7 +41,7 @@ LL | S::A { a } | S::B { b: a } => a, help: consider dereferencing the boxed value | LL | let y = match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:22 @@ -56,7 +56,7 @@ LL | S::A { a } | S::B { b: a } => a, help: consider dereferencing the boxed value | LL | let y = match *x { - | ~~ + | + error: aborting due to 4 previous errors diff --git a/tests/ui/issues/issue-58734.rs b/tests/ui/issues/issue-58734.rs index 9b630666baf..ee23be87b6b 100644 --- a/tests/ui/issues/issue-58734.rs +++ b/tests/ui/issues/issue-58734.rs @@ -21,4 +21,5 @@ fn main() { //~^ ERROR no function or associated item named `nonexistent` found //~| WARN trait objects without an explicit `dyn` are deprecated //~| WARN this is accepted in the current edition + //~| ERROR the trait `Trait` is not dyn compatible } diff --git a/tests/ui/issues/issue-58734.stderr b/tests/ui/issues/issue-58734.stderr index a2acd9dcf81..c4624cecc62 100644 --- a/tests/ui/issues/issue-58734.stderr +++ b/tests/ui/issues/issue-58734.stderr @@ -12,12 +12,38 @@ help: if this is a dyn-compatible trait, use `dyn` LL | <dyn Trait>::nonexistent(()); | ++++ + +error[E0038]: the trait `Trait` is not dyn compatible + --> $DIR/issue-58734.rs:20:5 + | +LL | Trait::nonexistent(()); + | ^^^^^ `Trait` is not dyn compatible + | +note: for a trait to be dyn compatible it needs to allow building a vtable + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/issue-58734.rs:4:8 + | +LL | trait Trait { + | ----- this trait is not dyn compatible... +... +LL | fn dyn_incompatible() -> Self; + | ^^^^^^^^^^^^^^^^ ...because associated function `dyn_incompatible` has no `self` parameter + = help: only type `()` implements `Trait`; consider using it directly instead. +help: consider turning `dyn_incompatible` into a method by giving it a `&self` argument + | +LL | fn dyn_incompatible(&self) -> Self; + | +++++ +help: alternatively, consider constraining `dyn_incompatible` so it does not apply to trait objects + | +LL | fn dyn_incompatible() -> Self where Self: Sized; + | +++++++++++++++++ + error[E0599]: no function or associated item named `nonexistent` found for trait object `dyn Trait` in the current scope --> $DIR/issue-58734.rs:20:12 | LL | Trait::nonexistent(()); | ^^^^^^^^^^^ function or associated item not found in `dyn Trait` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 2 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0599`. +Some errors have detailed explanations: E0038, E0599. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/issues/issue-5883.rs b/tests/ui/issues/issue-5883.rs index f9dd2c54d99..dd4753e0344 100644 --- a/tests/ui/issues/issue-5883.rs +++ b/tests/ui/issues/issue-5883.rs @@ -6,7 +6,7 @@ struct Struct { fn new_struct( r: dyn A + 'static //~ ERROR the size for values of type -) -> Struct { +) -> Struct { //~ ERROR the size for values of type Struct { r: r } } diff --git a/tests/ui/issues/issue-5883.stderr b/tests/ui/issues/issue-5883.stderr index d481d0ef94e..2ca437b8c47 100644 --- a/tests/ui/issues/issue-5883.stderr +++ b/tests/ui/issues/issue-5883.stderr @@ -1,4 +1,18 @@ error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time + --> $DIR/issue-5883.rs:9:6 + | +LL | ) -> Struct { + | ^^^^^^ doesn't have a size known at compile-time + | + = help: within `Struct`, the trait `Sized` is not implemented for `(dyn A + 'static)` +note: required because it appears within the type `Struct` + --> $DIR/issue-5883.rs:3:8 + | +LL | struct Struct { + | ^^^^^^ + = note: the return type of a function must have a statically known size + +error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time --> $DIR/issue-5883.rs:8:8 | LL | r: dyn A + 'static @@ -8,13 +22,14 @@ LL | r: dyn A + 'static = help: unsized fn params are gated as an unstable feature help: you can use `impl Trait` as the argument type | -LL | r: impl A + 'static - | ~~~~ +LL - r: dyn A + 'static +LL + r: impl A + 'static + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | r: &dyn A + 'static | + -error: aborting due to 1 previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-67552.rs b/tests/ui/issues/issue-67552.rs index 343ae4f262f..8c7e95bd2e3 100644 --- a/tests/ui/issues/issue-67552.rs +++ b/tests/ui/issues/issue-67552.rs @@ -1,6 +1,7 @@ //@ build-fail //@ compile-flags: -Copt-level=0 -//@ normalize-stderr: ".nll/" -> "/" +// The regex below normalizes the long type file name to make it suitable for compare-modes. +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" fn main() { rec(Empty); diff --git a/tests/ui/issues/issue-67552.stderr b/tests/ui/issues/issue-67552.stderr index 1a8d7248b45..f94cd78c870 100644 --- a/tests/ui/issues/issue-67552.stderr +++ b/tests/ui/issues/issue-67552.stderr @@ -1,17 +1,17 @@ error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut ...>` - --> $DIR/issue-67552.rs:29:9 + --> $DIR/issue-67552.rs:30:9 | LL | rec(identity(&mut it)) | ^^^^^^^^^^^^^^^^^^^^^^ | note: `rec` defined here - --> $DIR/issue-67552.rs:22:1 + --> $DIR/issue-67552.rs:23:1 | LL | / fn rec<T>(mut it: T) LL | | where LL | | T: Iterator, | |________________^ - = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-67552/issue-67552.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-69683.stderr b/tests/ui/issues/issue-69683.stderr index c428ea9ea2c..b8e9e89e56e 100644 --- a/tests/ui/issues/issue-69683.stderr +++ b/tests/ui/issues/issue-69683.stderr @@ -7,8 +7,9 @@ LL | 0u16.foo(b); = note: cannot satisfy `<u8 as Element<_>>::Array == [u8; 3]` help: try using a fully qualified path to specify the expected types | -LL | <u16 as Foo<I>>::foo(0u16, b); - | +++++++++++++++++++++ ~ +LL - 0u16.foo(b); +LL + <u16 as Foo<I>>::foo(0u16, b); + | error[E0283]: type annotations needed --> $DIR/issue-69683.rs:30:10 @@ -34,8 +35,9 @@ LL | fn foo(self, x: <u8 as Element<I>>::Array); | --- required by a bound in this associated function help: try using a fully qualified path to specify the expected types | -LL | <u16 as Foo<I>>::foo(0u16, b); - | +++++++++++++++++++++ ~ +LL - 0u16.foo(b); +LL + <u16 as Foo<I>>::foo(0u16, b); + | error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr b/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr index 8e77662b4ba..eabb0842112 100644 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr +++ b/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr @@ -6,8 +6,9 @@ LL | let foo::Foo {} = foo::Foo::default(); | help: ignore the inaccessible and unused fields | -LL | let foo::Foo { .. } = foo::Foo::default(); - | ~~~~~~ +LL - let foo::Foo {} = foo::Foo::default(); +LL + let foo::Foo { .. } = foo::Foo::default(); + | error: pattern requires `..` due to inaccessible fields --> $DIR/issue-76077-1.rs:16:9 diff --git a/tests/ui/issues/issue-76191.stderr b/tests/ui/issues/issue-76191.stderr index 3702bfb7769..a397d082142 100644 --- a/tests/ui/issues/issue-76191.stderr +++ b/tests/ui/issues/issue-76191.stderr @@ -21,11 +21,12 @@ LL | RANGE => {} | `RANGE` is interpreted as a constant, not a new binding | = note: expected type `i32` - found struct `RangeInclusive<i32>` + found struct `std::ops::RangeInclusive<i32>` help: you may want to move the range into the match block | -LL | 0..=255 => {} - | ~~~~~~~ +LL - RANGE => {} +LL + 0..=255 => {} + | error[E0308]: mismatched types --> $DIR/issue-76191.rs:16:9 @@ -43,7 +44,7 @@ LL | RANGE2 => {} | `RANGE2` is interpreted as a constant, not a new binding | = note: expected type `i32` - found struct `RangeInclusive<i32>` + found struct `std::ops::RangeInclusive<i32>` = note: constants only support matching by type, if you meant to match against a range of values, consider using a range pattern like `min ..= max` in the match block error: aborting due to 3 previous errors diff --git a/tests/ui/issues/issue-78622.stderr b/tests/ui/issues/issue-78622.stderr index 985d6dde9f2..432913a0fc9 100644 --- a/tests/ui/issues/issue-78622.stderr +++ b/tests/ui/issues/issue-78622.stderr @@ -6,8 +6,9 @@ LL | S::A::<f> {} | help: if there were a trait named `Example` with associated type `A` implemented for `S`, you could use the fully-qualified path | -LL | <S as Example>::A::<f> {} - | ~~~~~~~~~~~~~~~~~ +LL - S::A::<f> {} +LL + <S as Example>::A::<f> {} + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-80607.stderr b/tests/ui/issues/issue-80607.stderr index d096910297b..8f9f494c8b7 100644 --- a/tests/ui/issues/issue-80607.stderr +++ b/tests/ui/issues/issue-80607.stderr @@ -9,8 +9,9 @@ LL | Enum::V1 { x } | help: `Enum::V1` is a tuple variant, use the appropriate syntax | -LL | Enum::V1(/* i32 */) - | ~~~~~~~~~~~ +LL - Enum::V1 { x } +LL + Enum::V1(/* i32 */) + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-87199.rs b/tests/ui/issues/issue-87199.rs index 34879c5a7ca..6664119e579 100644 --- a/tests/ui/issues/issue-87199.rs +++ b/tests/ui/issues/issue-87199.rs @@ -6,12 +6,12 @@ // Check that these function definitions only emit warnings, not errors fn arg<T: ?Send>(_: T) {} -//~^ warning: relaxing a default bound only does something for `?Sized` +//~^ ERROR: relaxing a default bound only does something for `?Sized` fn ref_arg<T: ?Send>(_: &T) {} -//~^ warning: relaxing a default bound only does something for `?Sized` +//~^ ERROR: relaxing a default bound only does something for `?Sized` fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() } -//~^ warning: relaxing a default bound only does something for `?Sized` -//~| warning: relaxing a default bound only does something for `?Sized` +//~^ ERROR: relaxing a default bound only does something for `?Sized` +//~| ERROR: relaxing a default bound only does something for `?Sized` // Check that there's no `?Sized` relaxation! fn main() { diff --git a/tests/ui/issues/issue-87199.stderr b/tests/ui/issues/issue-87199.stderr index a0ed2946fb4..acc4e84779c 100644 --- a/tests/ui/issues/issue-87199.stderr +++ b/tests/ui/issues/issue-87199.stderr @@ -1,22 +1,22 @@ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/issue-87199.rs:8:11 | LL | fn arg<T: ?Send>(_: T) {} | ^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/issue-87199.rs:10:15 | LL | fn ref_arg<T: ?Send>(_: &T) {} | ^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/issue-87199.rs:12:40 | LL | fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() } | ^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/issue-87199.rs:12:40 | LL | fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() } @@ -41,6 +41,6 @@ help: consider relaxing the implicit `Sized` restriction LL | fn ref_arg<T: ?Send + ?Sized>(_: &T) {} | ++++++++ -error: aborting due to 1 previous error; 4 warnings emitted +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-8727.rs b/tests/ui/issues/issue-8727.rs index b824be7c12f..7767729109e 100644 --- a/tests/ui/issues/issue-8727.rs +++ b/tests/ui/issues/issue-8727.rs @@ -2,7 +2,8 @@ // recursions. //@ build-fail -//@ normalize-stderr: ".nll/" -> "/" +// The regex below normalizes the long type file name to make it suitable for compare-modes. +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" fn generic<T>() { //~ WARN function cannot return without recursing generic::<Option<T>>(); diff --git a/tests/ui/issues/issue-8727.stderr b/tests/ui/issues/issue-8727.stderr index 9af598fe43f..22286eb8d7b 100644 --- a/tests/ui/issues/issue-8727.stderr +++ b/tests/ui/issues/issue-8727.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/issue-8727.rs:7:1 + --> $DIR/issue-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<Option<...>>>>>>` - --> $DIR/issue-8727.rs:8:5 + --> $DIR/issue-8727.rs:9:5 | LL | generic::<Option<T>>(); | ^^^^^^^^^^^^^^^^^^^^^^ | note: `generic` defined here - --> $DIR/issue-8727.rs:7:1 + --> $DIR/issue-8727.rs:8:1 | LL | fn generic<T>() { | ^^^^^^^^^^^^^^^ - = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-8727/issue-8727.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/issues/issue-8761.stderr b/tests/ui/issues/issue-8761.stderr index c70093bafb6..4a9db568913 100644 --- a/tests/ui/issues/issue-8761.stderr +++ b/tests/ui/issues/issue-8761.stderr @@ -6,8 +6,9 @@ LL | A = 1i64, | help: change the type of the numeric literal from `i64` to `isize` | -LL | A = 1isize, - | ~~~~~ +LL - A = 1i64, +LL + A = 1isize, + | error[E0308]: mismatched types --> $DIR/issue-8761.rs:5:9 @@ -17,8 +18,9 @@ LL | B = 2u8 | help: change the type of the numeric literal from `u8` to `isize` | -LL | B = 2isize - | ~~~~~ +LL - B = 2u8 +LL + B = 2isize + | error: aborting due to 2 previous errors diff --git a/tests/ui/iterators/into-iter-on-arrays-2018.stderr b/tests/ui/iterators/into-iter-on-arrays-2018.stderr index 9d6bbf06c36..d4055c74f7c 100644 --- a/tests/ui/iterators/into-iter-on-arrays-2018.stderr +++ b/tests/ui/iterators/into-iter-on-arrays-2018.stderr @@ -9,12 +9,14 @@ LL | let _: Iter<'_, i32> = array.into_iter(); = note: `#[warn(array_into_iter)]` on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | let _: Iter<'_, i32> = array.iter(); - | ~~~~ +LL - let _: Iter<'_, i32> = array.into_iter(); +LL + let _: Iter<'_, i32> = array.iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | let _: Iter<'_, i32> = IntoIterator::into_iter(array); - | ++++++++++++++++++++++++ ~ +LL - let _: Iter<'_, i32> = array.into_iter(); +LL + let _: Iter<'_, i32> = IntoIterator::into_iter(array); + | warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-2018.rs:18:44 @@ -53,8 +55,9 @@ LL | for _ in [1, 2, 3].into_iter() {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | for _ in [1, 2, 3].iter() {} - | ~~~~ +LL - for _ in [1, 2, 3].into_iter() {} +LL + for _ in [1, 2, 3].iter() {} + | help: or remove `.into_iter()` to iterate by value | LL - for _ in [1, 2, 3].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 da388d6b848..fb8fe79c7c9 100644 --- a/tests/ui/iterators/into-iter-on-arrays-lint.stderr +++ b/tests/ui/iterators/into-iter-on-arrays-lint.stderr @@ -9,12 +9,14 @@ LL | small.into_iter(); = note: `#[warn(array_into_iter)]` on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | small.iter(); - | ~~~~ +LL - small.into_iter(); +LL + small.iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | IntoIterator::into_iter(small); - | ++++++++++++++++++++++++ ~ +LL - small.into_iter(); +LL + IntoIterator::into_iter(small); + | warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:14:12 @@ -26,12 +28,14 @@ LL | [1, 2].into_iter(); = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | [1, 2].iter(); - | ~~~~ +LL - [1, 2].into_iter(); +LL + [1, 2].iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | IntoIterator::into_iter([1, 2]); - | ++++++++++++++++++++++++ ~ +LL - [1, 2].into_iter(); +LL + IntoIterator::into_iter([1, 2]); + | warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:17:9 @@ -43,12 +47,14 @@ LL | big.into_iter(); = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | big.iter(); - | ~~~~ +LL - big.into_iter(); +LL + big.iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | IntoIterator::into_iter(big); - | ++++++++++++++++++++++++ ~ +LL - big.into_iter(); +LL + IntoIterator::into_iter(big); + | warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:20:15 @@ -60,12 +66,14 @@ LL | [0u8; 33].into_iter(); = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | [0u8; 33].iter(); - | ~~~~ +LL - [0u8; 33].into_iter(); +LL + [0u8; 33].iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | IntoIterator::into_iter([0u8; 33]); - | ++++++++++++++++++++++++ ~ +LL - [0u8; 33].into_iter(); +LL + IntoIterator::into_iter([0u8; 33]); + | warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:24:21 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 e8298030399..7a5a2be5ef0 100644 --- a/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr +++ b/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr @@ -9,12 +9,14 @@ LL | let _: Iter<'_, i32> = boxed_slice.into_iter(); = note: `#[warn(boxed_slice_into_iter)]` on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | let _: Iter<'_, i32> = boxed_slice.iter(); - | ~~~~ +LL - let _: Iter<'_, i32> = boxed_slice.into_iter(); +LL + let _: Iter<'_, i32> = boxed_slice.iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | let _: Iter<'_, i32> = IntoIterator::into_iter(boxed_slice); - | ++++++++++++++++++++++++ ~ +LL - let _: Iter<'_, i32> = boxed_slice.into_iter(); +LL + let _: Iter<'_, i32> = IntoIterator::into_iter(boxed_slice); + | warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<Box<[T]> as IntoIterator>::into_iter` in Rust 2024 --> $DIR/into-iter-on-boxed-slices-2021.rs:18:58 @@ -53,8 +55,9 @@ LL | for _ in (Box::new([1, 2, 3]) as Box<[_]>).into_iter() {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/intoiterator-box-slice.html> help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | for _ in (Box::new([1, 2, 3]) as Box<[_]>).iter() {} - | ~~~~ +LL - for _ in (Box::new([1, 2, 3]) as Box<[_]>).into_iter() {} +LL + for _ in (Box::new([1, 2, 3]) as Box<[_]>).iter() {} + | help: or remove `.into_iter()` to iterate by value | LL - for _ in (Box::new([1, 2, 3]) as Box<[_]>).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 8a88c7816d2..6762ed28d36 100644 --- a/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr +++ b/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr @@ -9,12 +9,14 @@ LL | boxed.into_iter(); = note: `#[warn(boxed_slice_into_iter)]` on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | boxed.iter(); - | ~~~~ +LL - boxed.into_iter(); +LL + boxed.iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | IntoIterator::into_iter(boxed); - | ++++++++++++++++++++++++ ~ +LL - boxed.into_iter(); +LL + IntoIterator::into_iter(boxed); + | warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<Box<[T]> as IntoIterator>::into_iter` in Rust 2024 --> $DIR/into-iter-on-boxed-slices-lint.rs:13:29 diff --git a/tests/ui/iterators/iter-range.rs b/tests/ui/iterators/iter-range.rs index 9594729c06c..ec993317539 100644 --- a/tests/ui/iterators/iter-range.rs +++ b/tests/ui/iterators/iter-range.rs @@ -2,7 +2,7 @@ fn range_<F>(a: isize, b: isize, mut it: F) where F: FnMut(isize) { - assert!((a < b)); + assert!(a < b); let mut i: isize = a; while i < b { it(i); i += 1; } } diff --git a/tests/ui/json/json-multiple.rs b/tests/ui/json/json-multiple.rs index 296a60d2453..8ad57939d5d 100644 --- a/tests/ui/json/json-multiple.rs +++ b/tests/ui/json/json-multiple.rs @@ -1,5 +1,6 @@ //@ build-pass //@ ignore-pass (different metadata emitted in different modes) //@ compile-flags: --json=diagnostic-short --json artifacts --error-format=json +//@ normalize-stderr: "json-multiple\..+/libjson_multiple.rlib" -> "json-multiple/libjson_multiple.rlib" #![crate_type = "lib"] diff --git a/tests/ui/json/json-options.rs b/tests/ui/json/json-options.rs index 33df25e27b6..a6654bfcac6 100644 --- a/tests/ui/json/json-options.rs +++ b/tests/ui/json/json-options.rs @@ -1,5 +1,6 @@ //@ build-pass //@ ignore-pass (different metadata emitted in different modes) //@ compile-flags: --json=diagnostic-short,artifacts --error-format=json +//@ normalize-stderr: "json-options\..+/libjson_options.rlib" -> "json-options/libjson_options.rlib" #![crate_type = "lib"] diff --git a/tests/ui/kindck/kindck-copy.rs b/tests/ui/kindck/kindck-copy.rs index 6df98c230ea..36bf0d2b785 100644 --- a/tests/ui/kindck/kindck-copy.rs +++ b/tests/ui/kindck/kindck-copy.rs @@ -45,7 +45,7 @@ fn test<'a,T,U:Copy>(_: &'a isize) { // mutable object types are not ok assert_copy::<&'a mut (dyn Dummy + Send)>(); //~ ERROR : Copy` is not satisfied - // unsafe ptrs are ok + // raw ptrs are ok assert_copy::<*const isize>(); assert_copy::<*const &'a mut isize>(); diff --git a/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr b/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr index 83446fc9ec0..95048c4454b 100644 --- a/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr +++ b/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr @@ -26,7 +26,7 @@ LL | let z = &x as &dyn Foo; | ^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/kindck-inherited-copy-bound.rs:10:13 | LL | trait Foo : Copy { @@ -41,7 +41,7 @@ LL | let z = &x as &dyn Foo; | ^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/kindck-inherited-copy-bound.rs:10:13 | LL | trait Foo : Copy { diff --git a/tests/ui/kindck/kindck-inherited-copy-bound.dyn_compatible_for_dispatch.stderr b/tests/ui/kindck/kindck-inherited-copy-bound.dyn_compatible_for_dispatch.stderr index 271e5afb9e7..296f011193e 100644 --- a/tests/ui/kindck/kindck-inherited-copy-bound.dyn_compatible_for_dispatch.stderr +++ b/tests/ui/kindck/kindck-inherited-copy-bound.dyn_compatible_for_dispatch.stderr @@ -26,7 +26,7 @@ LL | let z = &x as &dyn Foo; | ^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/kindck-inherited-copy-bound.rs:10:13 | LL | trait Foo : Copy { diff --git a/tests/ui/label/label_misspelled.stderr b/tests/ui/label/label_misspelled.stderr index 4b5b9e92ca0..3f4020e7be0 100644 --- a/tests/ui/label/label_misspelled.stderr +++ b/tests/ui/label/label_misspelled.stderr @@ -157,12 +157,14 @@ LL | break foo; | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break foo; +LL + break; + | help: alternatively, you might have meant to use the available loop label | -LL | break 'while_loop; - | ~~~~~~~~~~~ +LL - break foo; +LL + break 'while_loop; + | error[E0571]: `break` with value from a `while` loop --> $DIR/label_misspelled.rs:54:9 @@ -175,12 +177,14 @@ LL | break foo; | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break foo; +LL + break; + | help: alternatively, you might have meant to use the available loop label | -LL | break 'while_let; - | ~~~~~~~~~~ +LL - break foo; +LL + break 'while_let; + | error[E0571]: `break` with value from a `for` loop --> $DIR/label_misspelled.rs:59:9 @@ -193,12 +197,14 @@ LL | break foo; | help: use `break` on its own without a value inside this `for` loop | -LL | break; - | ~~~~~ +LL - break foo; +LL + break; + | help: alternatively, you might have meant to use the available loop label | -LL | break 'for_loop; - | ~~~~~~~~~ +LL - break foo; +LL + break 'for_loop; + | error: aborting due to 11 previous errors; 10 warnings emitted diff --git a/tests/ui/lang-items/lang-item-missing.stderr b/tests/ui/lang-items/lang-item-missing.stderr index 08e679a7c55..63bca95adf7 100644 --- a/tests/ui/lang-items/lang-item-missing.stderr +++ b/tests/ui/lang-items/lang-item-missing.stderr @@ -1,4 +1,8 @@ error: requires `sized` lang_item + --> $DIR/lang-item-missing.rs:11:60 + | +LL | extern "C" fn main(_argc: i32, _argv: *const *const u8) -> i32 { + | ^^^ error: aborting due to 1 previous error diff --git a/tests/ui/lang-items/start_lang_item_with_target_feature.rs b/tests/ui/lang-items/start_lang_item_with_target_feature.rs index eb712ba4092..18cd4c97040 100644 --- a/tests/ui/lang-items/start_lang_item_with_target_feature.rs +++ b/tests/ui/lang-items/start_lang_item_with_target_feature.rs @@ -1,7 +1,7 @@ //@ only-x86_64 //@ check-fail -#![feature(lang_items, no_core, target_feature_11)] +#![feature(lang_items, no_core)] #![no_core] #[lang = "copy"] diff --git a/tests/ui/layout/debug.rs b/tests/ui/layout/debug.rs index 81dc7285254..b87a1d2031d 100644 --- a/tests/ui/layout/debug.rs +++ b/tests/ui/layout/debug.rs @@ -82,3 +82,8 @@ type Impossible = (str, str); //~ ERROR: cannot be known at compilation time #[rustc_layout(debug)] union EmptyUnion {} //~ ERROR: has an unknown layout //~^ ERROR: unions cannot have zero fields + +// Test the error message of `LayoutError::TooGeneric` +// (this error is never emitted to users). +#[rustc_layout(debug)] +type TooGeneric<T> = T; //~ ERROR: does not have a fixed layout diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr index 319c0de26a9..0daf2d3b9e7 100644 --- a/tests/ui/layout/debug.stderr +++ b/tests/ui/layout/debug.stderr @@ -596,12 +596,18 @@ error: the type has an unknown layout LL | union EmptyUnion {} | ^^^^^^^^^^^^^^^^ +error: the type `T` does not have a fixed layout + --> $DIR/debug.rs:89:1 + | +LL | type TooGeneric<T> = T; + | ^^^^^^^^^^^^^^^^^^ + error: `#[rustc_layout]` can only be applied to `struct`/`enum`/`union` declarations and type aliases --> $DIR/debug.rs:75:5 | LL | const C: () = (); | ^^^^^^^^^^^ -error: aborting due to 19 previous errors +error: aborting due to 20 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/layout/malformed-unsized-type-in-union.rs b/tests/ui/layout/malformed-unsized-type-in-union.rs index 5d8ec576cf0..e97024ce9d7 100644 --- a/tests/ui/layout/malformed-unsized-type-in-union.rs +++ b/tests/ui/layout/malformed-unsized-type-in-union.rs @@ -2,6 +2,7 @@ union W { s: dyn Iterator<Item = Missing> } //~^ ERROR cannot find type `Missing` in this scope +//~| ERROR field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union static ONCE: W = todo!(); diff --git a/tests/ui/layout/malformed-unsized-type-in-union.stderr b/tests/ui/layout/malformed-unsized-type-in-union.stderr index ad4f0cda19e..bdfabc0b151 100644 --- a/tests/ui/layout/malformed-unsized-type-in-union.stderr +++ b/tests/ui/layout/malformed-unsized-type-in-union.stderr @@ -4,6 +4,19 @@ error[E0412]: cannot find type `Missing` in this scope LL | union W { s: dyn Iterator<Item = Missing> } | ^^^^^^^ not found in this scope -error: aborting due to 1 previous error +error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union + --> $DIR/malformed-unsized-type-in-union.rs:3:11 + | +LL | union W { s: dyn Iterator<Item = Missing> } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>` +help: wrap the field type in `ManuallyDrop<...>` + | +LL | union W { s: std::mem::ManuallyDrop<dyn Iterator<Item = Missing>> } + | +++++++++++++++++++++++ + + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0412`. +Some errors have detailed explanations: E0412, E0740. +For more information about an error, try `rustc --explain E0412`. diff --git a/tests/ui/layout/normalization-failure.rs b/tests/ui/layout/normalization-failure.rs new file mode 100644 index 00000000000..c0f8710c03c --- /dev/null +++ b/tests/ui/layout/normalization-failure.rs @@ -0,0 +1,57 @@ +//! This test demonstrates how `LayoutError::NormalizationFailure` can happen and why +//! it is necessary. +//! +//! This code does not cause an immediate normalization error in typeck, because we +//! don't reveal the hidden type returned by `opaque<T>` in the analysis typing mode. +//! Instead, `<{opaque} as Project2>::Assoc2` is a *rigid projection*, because we know +//! that `{opaque}: Project2` holds, due to the opaque type's `impl Project2` bound, +//! but cannot normalize `<{opaque} as Project2>::Assoc2` any further. +//! +//! However, in the post-analysis typing mode, which is used for the layout computation, +//! the opaque's hidden type is revealed to be `PhantomData<T>`, and now we fail to +//! normalize `<PhantomData<T> as Project2>::Assoc2` if there is a `T: Project1` bound +//! in the param env! This happens, because `PhantomData<T>: Project2` only holds if +//! `<T as Project1>::Assoc1 == ()` holds. This would usually be satisfied by the +//! blanket `impl<T> Project1 for T`, but due to the `T: Project1` bound we do not +//! normalize `<T as Project1>::Assoc1` via the impl and treat it as rigid instead. +//! Therefore, `PhantomData<T>: Project2` does NOT hold and normalizing +//! `<PhantomData<T> as Project2>::Assoc2` fails. +//! +//! Note that this layout error can only happen when computing the layout in a generic +//! context, which is not required for codegen, but may happen for lints, MIR optimizations, +//! and the transmute check. + +use std::marker::PhantomData; + +trait Project1 { + type Assoc1; +} + +impl<T> Project1 for T { + type Assoc1 = (); +} + +trait Project2 { + type Assoc2; + fn get(self) -> Self::Assoc2; +} + +impl<T: Project1<Assoc1 = ()>> Project2 for PhantomData<T> { + type Assoc2 = (); + fn get(self) -> Self::Assoc2 {} +} + +fn opaque<T>() -> impl Project2 { + PhantomData::<T> +} + +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) + } +} + +fn main() {} diff --git a/tests/ui/layout/normalization-failure.stderr b/tests/ui/layout/normalization-failure.stderr new file mode 100644 index 00000000000..5fe38d4403a --- /dev/null +++ b/tests/ui/layout/normalization-failure.stderr @@ -0,0 +1,12 @@ +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/normalization-failure.rs:50:9 + | +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: target type: `()` (0 bits) + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0512`. diff --git a/tests/ui/lazy-type-alias/def-site-param-defaults-wf.rs b/tests/ui/lazy-type-alias/def-site-param-defaults-wf.rs new file mode 100644 index 00000000000..90bb0a294f8 --- /dev/null +++ b/tests/ui/lazy-type-alias/def-site-param-defaults-wf.rs @@ -0,0 +1,9 @@ +//! Ensure that we check generic parameter defaults for well-formedness at the definition site. +#![feature(lazy_type_alias)] +#![allow(incomplete_features)] + +type Alias<T = Vec<str>, const N: usize = {0 - 1}> = T; +//~^ ERROR evaluation of constant value failed +//~| ERROR the size for values of type `str` cannot be known at compilation time + +fn main() {} diff --git a/tests/ui/lazy-type-alias/def-site-param-defaults-wf.stderr b/tests/ui/lazy-type-alias/def-site-param-defaults-wf.stderr new file mode 100644 index 00000000000..da0021ccaf4 --- /dev/null +++ b/tests/ui/lazy-type-alias/def-site-param-defaults-wf.stderr @@ -0,0 +1,20 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/def-site-param-defaults-wf.rs:5:44 + | +LL | type Alias<T = Vec<str>, const N: usize = {0 - 1}> = T; + | ^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow + +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/def-site-param-defaults-wf.rs:5:16 + | +LL | type Alias<T = Vec<str>, const N: usize = {0 - 1}> = T; + | ^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` +note: required by an implicit `Sized` bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0080, E0277. +For more information about an error, try `rustc --explain E0080`. diff --git a/tests/ui/lazy-type-alias/def-site-predicates-wf.rs b/tests/ui/lazy-type-alias/def-site-predicates-wf.rs new file mode 100644 index 00000000000..5d9235347cb --- /dev/null +++ b/tests/ui/lazy-type-alias/def-site-predicates-wf.rs @@ -0,0 +1,13 @@ +//! Ensure that we check the predicates at the definition site for well-formedness. +#![feature(lazy_type_alias)] +#![allow(incomplete_features)] + +type Alias0 = () +where + Vec<str>:; //~ ERROR the size for values of type `str` cannot be known at compilation time + +type Alias1 = () +where + Vec<str>: Sized; //~ ERROR the size for values of type `str` cannot be known at compilation time + +fn main() {} diff --git a/tests/ui/lazy-type-alias/def-site-predicates-wf.stderr b/tests/ui/lazy-type-alias/def-site-predicates-wf.stderr new file mode 100644 index 00000000000..b44e702c35c --- /dev/null +++ b/tests/ui/lazy-type-alias/def-site-predicates-wf.stderr @@ -0,0 +1,23 @@ +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/def-site-predicates-wf.rs:7:5 + | +LL | Vec<str>:; + | ^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` +note: required by an implicit `Sized` bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/def-site-predicates-wf.rs:11:15 + | +LL | Vec<str>: Sized; + | ^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` +note: required by an implicit `Sized` bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/let-else/let-else-deref-coercion.stderr b/tests/ui/let-else/let-else-deref-coercion.stderr index da8b1f4c48e..543737868c9 100644 --- a/tests/ui/let-else/let-else-deref-coercion.stderr +++ b/tests/ui/let-else/let-else-deref-coercion.stderr @@ -9,7 +9,7 @@ LL | let Bar::Present(z) = self else { help: consider dereferencing to access the inner value using the Deref trait | LL | let Bar::Present(z) = &**self else { - | ~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/let-else-deref-coercion.rs:68:13 @@ -22,7 +22,7 @@ LL | let Bar(z) = x; help: consider dereferencing to access the inner value using the Deref trait | LL | let Bar(z) = &**x; - | ~~~~ + | +++ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-40408.rs b/tests/ui/lexer/floating-point-0e10-issue-40408.rs index a1c1c582181..a1c1c582181 100644 --- a/tests/ui/issues/issue-40408.rs +++ b/tests/ui/lexer/floating-point-0e10-issue-40408.rs diff --git a/tests/ui/lexer/lex-bad-char-literals-1.stderr b/tests/ui/lexer/lex-bad-char-literals-1.stderr index 9dc0a338063..0985e274c02 100644 --- a/tests/ui/lexer/lex-bad-char-literals-1.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-1.stderr @@ -19,8 +19,9 @@ LL | '\●' = help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals> help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | -LL | r"\●" - | ~~~~~ +LL - '\●' +LL + r"\●" + | error: unknown character escape: `\u{25cf}` --> $DIR/lex-bad-char-literals-1.rs:14:7 @@ -32,7 +33,7 @@ LL | "\●" help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | LL | r"\●" - | ~~~~~ + | + error: aborting due to 4 previous errors diff --git a/tests/ui/lexer/lex-bad-char-literals-2.stderr b/tests/ui/lexer/lex-bad-char-literals-2.stderr index 76cde00404a..fa063072865 100644 --- a/tests/ui/lexer/lex-bad-char-literals-2.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-2.stderr @@ -6,8 +6,9 @@ LL | 'nope' | help: if you meant to write a string literal, use double quotes | -LL | "nope" - | ~ ~ +LL - 'nope' +LL + "nope" + | error: aborting due to 1 previous error diff --git a/tests/ui/lexer/lex-bad-char-literals-3.stderr b/tests/ui/lexer/lex-bad-char-literals-3.stderr index 3f339b2ef7d..d8ce17d13a9 100644 --- a/tests/ui/lexer/lex-bad-char-literals-3.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-3.stderr @@ -6,8 +6,9 @@ LL | static c: char = '●●'; | help: if you meant to write a string literal, use double quotes | -LL | static c: char = "●●"; - | ~ ~ +LL - static c: char = '●●'; +LL + static c: char = "●●"; + | error: character literal may only contain one codepoint --> $DIR/lex-bad-char-literals-3.rs:5:20 @@ -17,8 +18,9 @@ LL | let ch: &str = '●●'; | help: if you meant to write a string literal, use double quotes | -LL | let ch: &str = "●●"; - | ~ ~ +LL - let ch: &str = '●●'; +LL + let ch: &str = "●●"; + | error: aborting due to 2 previous errors diff --git a/tests/ui/lexer/lex-bad-char-literals-5.stderr b/tests/ui/lexer/lex-bad-char-literals-5.stderr index 8004157e87f..0322783871e 100644 --- a/tests/ui/lexer/lex-bad-char-literals-5.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-5.stderr @@ -6,8 +6,9 @@ LL | static c: char = '\x10\x10'; | help: if you meant to write a string literal, use double quotes | -LL | static c: char = "\x10\x10"; - | ~ ~ +LL - static c: char = '\x10\x10'; +LL + static c: char = "\x10\x10"; + | error: character literal may only contain one codepoint --> $DIR/lex-bad-char-literals-5.rs:5:20 @@ -17,8 +18,9 @@ LL | let ch: &str = '\x10\x10'; | help: if you meant to write a string literal, use double quotes | -LL | let ch: &str = "\x10\x10"; - | ~ ~ +LL - let ch: &str = '\x10\x10'; +LL + let ch: &str = "\x10\x10"; + | error: aborting due to 2 previous errors diff --git a/tests/ui/lexer/lex-bad-char-literals-6.stderr b/tests/ui/lexer/lex-bad-char-literals-6.stderr index 96d409d59bb..e5fd62bc0a9 100644 --- a/tests/ui/lexer/lex-bad-char-literals-6.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-6.stderr @@ -6,8 +6,9 @@ LL | let x: &str = 'ab'; | help: if you meant to write a string literal, use double quotes | -LL | let x: &str = "ab"; - | ~ ~ +LL - let x: &str = 'ab'; +LL + let x: &str = "ab"; + | error: character literal may only contain one codepoint --> $DIR/lex-bad-char-literals-6.rs:4:19 @@ -17,8 +18,9 @@ LL | let y: char = 'cd'; | help: if you meant to write a string literal, use double quotes | -LL | let y: char = "cd"; - | ~ ~ +LL - let y: char = 'cd'; +LL + let y: char = "cd"; + | error: character literal may only contain one codepoint --> $DIR/lex-bad-char-literals-6.rs:6:13 @@ -28,8 +30,9 @@ LL | let z = 'ef'; | help: if you meant to write a string literal, use double quotes | -LL | let z = "ef"; - | ~ ~ +LL - let z = 'ef'; +LL + let z = "ef"; + | error[E0308]: mismatched types --> $DIR/lex-bad-char-literals-6.rs:13:20 diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-1.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-1.stderr index 57c5f82704e..81ee697802b 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-1.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-1.stderr @@ -6,8 +6,9 @@ LL | println!('1 + 1'); | help: if you meant to write a string literal, use double quotes | -LL | println!("1 + 1"); - | ~ ~ +LL - println!('1 + 1'); +LL + println!("1 + 1"); + | error: lifetimes cannot start with a number --> $DIR/lex-bad-str-literal-as-char-1.rs:3:14 diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-2.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-2.stderr index f64761af641..ed1303cd428 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-2.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-2.stderr @@ -6,8 +6,9 @@ LL | println!(' 1 + 1'); | help: if you meant to write a string literal, use double quotes | -LL | println!(" 1 + 1"); - | ~ ~ +LL - println!(' 1 + 1'); +LL + println!(" 1 + 1"); + | error: aborting due to 1 previous error diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr index 06f12742667..2f92225de1f 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr @@ -6,8 +6,9 @@ LL | println!('hello world'); | help: if you meant to write a string literal, use double quotes | -LL | println!("hello world"); - | ~ ~ +LL - println!('hello world'); +LL + println!("hello world"); + | error: aborting due to 1 previous error diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr index 06f12742667..2f92225de1f 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr @@ -6,8 +6,9 @@ LL | println!('hello world'); | help: if you meant to write a string literal, use double quotes | -LL | println!("hello world"); - | ~ ~ +LL - println!('hello world'); +LL + println!("hello world"); + | error: aborting due to 1 previous error diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr index 4170560cfcb..e10046e58e4 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr @@ -7,8 +7,9 @@ LL | println!('hello world'); = note: prefixed identifiers and literals are reserved since Rust 2021 help: if you meant to write a string literal, use double quotes | -LL | println!("hello world"); - | ~ ~ +LL - println!('hello world'); +LL + println!("hello world"); + | error[E0762]: unterminated character literal --> $DIR/lex-bad-str-literal-as-char-3.rs:5:26 @@ -18,8 +19,9 @@ LL | println!('hello world'); | help: if you meant to write a string literal, use double quotes | -LL | println!("hello world"); - | ~ ~ +LL - println!('hello world'); +LL + println!("hello world"); + | error: aborting due to 2 previous errors diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-4.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-4.stderr index af42b5b7f7b..5633783e738 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-4.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-4.stderr @@ -7,8 +7,9 @@ LL | println!('hello world'); = note: prefixed identifiers and literals are reserved since Rust 2021 help: if you meant to write a string literal, use double quotes | -LL | println!("hello world"); - | ~ ~ +LL - println!('hello world'); +LL + println!("hello world"); + | error[E0762]: unterminated character literal --> $DIR/lex-bad-str-literal-as-char-4.rs:4:30 @@ -18,8 +19,9 @@ LL | println!('hello world'); | help: if you meant to write a string literal, use double quotes | -LL | println!("hello world"); - | ~ ~ +LL - println!('hello world'); +LL + println!("hello world"); + | error: aborting due to 2 previous errors diff --git a/tests/ui/lifetimes/borrowck-let-suggestion.stderr b/tests/ui/lifetimes/borrowck-let-suggestion.stderr index cca7f52957e..4703d7f10dc 100644 --- a/tests/ui/lifetimes/borrowck-let-suggestion.stderr +++ b/tests/ui/lifetimes/borrowck-let-suggestion.stderr @@ -13,7 +13,7 @@ LL | x.use_mut(); help: consider consuming the `Vec<i32>` when turning it into an `Iterator` | LL | let mut x = vec![1].into_iter(); - | ~~~~~~~~~ + | +++++ help: consider using a `let` binding to create a longer lived value | LL ~ let binding = vec![1]; diff --git a/tests/ui/lifetimes/fullwidth-ampersand.stderr b/tests/ui/lifetimes/fullwidth-ampersand.stderr index 4645254f4b7..7fa7343620b 100644 --- a/tests/ui/lifetimes/fullwidth-ampersand.stderr +++ b/tests/ui/lifetimes/fullwidth-ampersand.stderr @@ -6,8 +6,9 @@ LL | fn f(_: &&()) -> &() { todo!() } | help: Unicode character '&' (Fullwidth Ampersand) looks like '&' (Ampersand), but it is not | -LL | fn f(_: &&()) -> &() { todo!() } - | ~ +LL - fn f(_: &&()) -> &() { todo!() } +LL + fn f(_: &&()) -> &() { todo!() } + | error[E0106]: missing lifetime specifier --> $DIR/fullwidth-ampersand.rs:3:18 diff --git a/tests/ui/lifetimes/issue-26638.stderr b/tests/ui/lifetimes/issue-26638.stderr index dc18e0f1f7a..8aa94f66812 100644 --- a/tests/ui/lifetimes/issue-26638.stderr +++ b/tests/ui/lifetimes/issue-26638.stderr @@ -27,8 +27,9 @@ LL | fn parse_type_2(iter: &fn(&u8)->&u8) -> &str { iter() } | + help: ...or alternatively, you might want to return an owned value | -LL | fn parse_type_2(iter: fn(&u8)->&u8) -> String { iter() } - | ~~~~~~ +LL - fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } +LL + fn parse_type_2(iter: fn(&u8)->&u8) -> String { iter() } + | error[E0106]: missing lifetime specifier --> $DIR/issue-26638.rs:9:22 @@ -43,8 +44,9 @@ LL | fn parse_type_3() -> &'static str { unimplemented!() } | +++++++ help: instead, you are more likely to want to return an owned value | -LL | fn parse_type_3() -> String { unimplemented!() } - | ~~~~~~ +LL - fn parse_type_3() -> &str { unimplemented!() } +LL + fn parse_type_3() -> String { unimplemented!() } + | error[E0061]: this function takes 1 argument but 0 arguments were supplied --> $DIR/issue-26638.rs:4:47 @@ -54,8 +56,9 @@ LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } | help: provide the argument | -LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter(/* &u8 */) } - | ~~~~~~~~~~~ +LL - fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } +LL + fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter(/* &u8 */) } + | error[E0308]: mismatched types --> $DIR/issue-26638.rs:4:47 diff --git a/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr b/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr index 5e16c57a618..e03910ec79e 100644 --- a/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr +++ b/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr @@ -29,8 +29,9 @@ LL | pub fn foo2(x: &mut Vec<&'_ u8>, y: &u8) { x.push(y); } = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance help: consider introducing a named lifetime parameter | -LL | pub fn foo2<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } - | ++++ ~~ ++ +LL - pub fn foo2(x: &mut Vec<&'_ u8>, y: &u8) { x.push(y); } +LL + pub fn foo2<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } + | error: lifetime may not live long enough --> $DIR/issue-90170-elision-mismatch.rs:7:63 diff --git a/tests/ui/lifetimes/raw/immediately-followed-by-lt.e2021.stderr b/tests/ui/lifetimes/raw/immediately-followed-by-lt.e2021.stderr index e600cc37fc4..f16c18f85d3 100644 --- a/tests/ui/lifetimes/raw/immediately-followed-by-lt.e2021.stderr +++ b/tests/ui/lifetimes/raw/immediately-followed-by-lt.e2021.stderr @@ -6,8 +6,9 @@ LL | w!('r#long'id); | help: if you meant to write a string literal, use double quotes | -LL | w!("r#long"id); - | ~ ~ +LL - w!('r#long'id); +LL + w!("r#long"id); + | error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/tail-expr-lock-poisoning.rs b/tests/ui/lifetimes/tail-expr-lock-poisoning.rs index d7c7b2e2414..1c838a9e5e1 100644 --- a/tests/ui/lifetimes/tail-expr-lock-poisoning.rs +++ b/tests/ui/lifetimes/tail-expr-lock-poisoning.rs @@ -1,5 +1,4 @@ //@ revisions: edition2021 edition2024 -//@ ignore-wasm no panic support //@ needs-subprocess //@ [edition2024] edition: 2024 //@ run-pass diff --git a/tests/ui/link-native-libs/suggest-libname-only-1.stderr b/tests/ui/link-native-libs/suggest-libname-only-1.stderr index aae8f7de966..47f7d92c9f9 100644 --- a/tests/ui/link-native-libs/suggest-libname-only-1.stderr +++ b/tests/ui/link-native-libs/suggest-libname-only-1.stderr @@ -2,7 +2,7 @@ warning: extern declarations without an explicit ABI are deprecated --> $DIR/suggest-libname-only-1.rs:7:1 | LL | extern { } - | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | = note: `#[warn(missing_abi)]` on by default diff --git a/tests/ui/link-native-libs/suggest-libname-only-2.stderr b/tests/ui/link-native-libs/suggest-libname-only-2.stderr index a2adaee3f97..a2d8f4c8191 100644 --- a/tests/ui/link-native-libs/suggest-libname-only-2.stderr +++ b/tests/ui/link-native-libs/suggest-libname-only-2.stderr @@ -2,7 +2,7 @@ warning: extern declarations without an explicit ABI are deprecated --> $DIR/suggest-libname-only-2.rs:7:1 | LL | extern { } - | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | = note: `#[warn(missing_abi)]` on by default diff --git a/tests/ui/linkage-attr/linkage-attr-does-not-panic-llvm-issue-33992.rs b/tests/ui/linkage-attr/linkage-attr-does-not-panic-llvm-issue-33992.rs index a169997927e..0717a2d5a6c 100644 --- a/tests/ui/linkage-attr/linkage-attr-does-not-panic-llvm-issue-33992.rs +++ b/tests/ui/linkage-attr/linkage-attr-does-not-panic-llvm-issue-33992.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-windows //@ ignore-apple //@ ignore-wasm32 common linkage not implemented right now @@ -11,15 +10,14 @@ pub static TEST2: bool = true; #[linkage = "internal"] pub static TEST3: bool = true; +#[cfg(not(target_env = "msvc"))] #[linkage = "linkonce"] pub static TEST4: bool = true; +#[cfg(not(target_env = "msvc"))] #[linkage = "linkonce_odr"] pub static TEST5: bool = true; -#[linkage = "private"] -pub static TEST6: bool = true; - #[linkage = "weak"] pub static TEST7: bool = true; diff --git a/tests/ui/linkage-attr/propagate-generic-issue-18804/main.rs b/tests/ui/linkage-attr/propagate-generic-issue-18804/main.rs index 56a9358cce3..8c194ec50df 100644 --- a/tests/ui/linkage-attr/propagate-generic-issue-18804/main.rs +++ b/tests/ui/linkage-attr/propagate-generic-issue-18804/main.rs @@ -3,7 +3,6 @@ // functions. Failure results in a linker error. //@ ignore-emscripten no weak symbol support -//@ ignore-windows no extern_weak linkage //@ ignore-apple no extern_weak linkage //@ aux-build:lib.rs diff --git a/tests/ui/lint/ambiguous_wide_pointer_comparisons_suggestions.stderr b/tests/ui/lint/ambiguous_wide_pointer_comparisons_suggestions.stderr index d9190dbb813..30d7683ef4b 100644 --- a/tests/ui/lint/ambiguous_wide_pointer_comparisons_suggestions.stderr +++ b/tests/ui/lint/ambiguous_wide_pointer_comparisons_suggestions.stderr @@ -7,12 +7,14 @@ LL | let _ = a == b; = note: `#[warn(ambiguous_wide_pointer_comparisons)]` on by default help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ++++++++++++++++++ ~ + +LL - let _ = a == b; +LL + let _ = std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = std::ptr::eq(a, b); - | +++++++++++++ ~ + +LL - let _ = a == b; +LL + let _ = std::ptr::eq(a, b); + | warning: 1 warning emitted diff --git a/tests/ui/lint/clashing-extern-fn.rs b/tests/ui/lint/clashing-extern-fn.rs index 9bbb20246df..e4477c96202 100644 --- a/tests/ui/lint/clashing-extern-fn.rs +++ b/tests/ui/lint/clashing-extern-fn.rs @@ -1,7 +1,7 @@ //@ check-pass //@ aux-build:external_extern_fn.rs #![crate_type = "lib"] - +#![feature(pattern_type_macro, pattern_types)] mod redeclared_different_signature { mod a { extern "C" { @@ -490,3 +490,33 @@ mod hidden_niche { } } } + +mod pattern_types { + mod a { + use std::pat::pattern_type; + #[repr(transparent)] + struct NonZeroUsize(pattern_type!(usize is 1..)); + extern "C" { + fn pt_non_zero_usize() -> pattern_type!(usize is 1..); + fn pt_non_zero_usize_opt() -> Option<pattern_type!(usize is 1..)>; + fn pt_non_zero_usize_opt_full_range() -> Option<pattern_type!(usize is 0..)>; + //~^ WARN not FFI-safe + fn pt_non_null_ptr() -> pattern_type!(usize is 1..); + fn pt_non_zero_usize_wrapper() -> NonZeroUsize; + fn pt_non_zero_usize_wrapper_opt() -> Option<NonZeroUsize>; + } + } + mod b { + extern "C" { + // If there's a clash in either of these cases you're either gaining an incorrect + // invariant that the value is non-zero, or you're missing out on that invariant. Both + // cases are warning for, from both a caller-convenience and optimisation perspective. + fn pt_non_zero_usize() -> usize; + fn pt_non_zero_usize_opt() -> usize; + fn pt_non_null_ptr() -> *const (); + //~^ WARN `pt_non_null_ptr` redeclared with a different signature + fn pt_non_zero_usize_wrapper() -> usize; + fn pt_non_zero_usize_wrapper_opt() -> usize; + } + } +} diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr index 48dd1adbc1f..118b18b224c 100644 --- a/tests/ui/lint/clashing-extern-fn.stderr +++ b/tests/ui/lint/clashing-extern-fn.stderr @@ -17,6 +17,15 @@ LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZero<usiz = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint +warning: `extern` block uses type `Option<(usize) is 0..=>`, which is not FFI-safe + --> $DIR/clashing-extern-fn.rs:502:54 + | +LL | fn pt_non_zero_usize_opt_full_range() -> Option<pattern_type!(usize is 0..)>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + warning: `clash` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:13:13 | @@ -258,5 +267,17 @@ LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZero<usiz = note: expected `unsafe extern "C" fn() -> usize` found `unsafe extern "C" fn() -> Option<UnsafeCell<NonZero<usize>>>` -warning: 22 warnings emitted +warning: `pt_non_null_ptr` redeclared with a different signature + --> $DIR/clashing-extern-fn.rs:516:13 + | +LL | fn pt_non_null_ptr() -> pattern_type!(usize is 1..); + | ---------------------------------------------------- `pt_non_null_ptr` previously declared here +... +LL | fn pt_non_null_ptr() -> *const (); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | + = note: expected `unsafe extern "C" fn() -> (usize) is 1..=` + found `unsafe extern "C" fn() -> *const ()` + +warning: 24 warnings emitted diff --git a/tests/ui/lint/cli-lint-override.forbid_warn.stderr b/tests/ui/lint/cli-lint-override.forbid_warn.stderr index 169be997b48..fb8779ad4f1 100644 --- a/tests/ui/lint/cli-lint-override.forbid_warn.stderr +++ b/tests/ui/lint/cli-lint-override.forbid_warn.stderr @@ -2,7 +2,7 @@ error: extern declarations without an explicit ABI are deprecated --> $DIR/cli-lint-override.rs:12:1 | LL | extern fn foo() {} - | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | = note: requested on the command line with `-F missing-abi` diff --git a/tests/ui/lint/cli-lint-override.force_warn_deny.stderr b/tests/ui/lint/cli-lint-override.force_warn_deny.stderr index 574f2ca66a4..10fc13e3f52 100644 --- a/tests/ui/lint/cli-lint-override.force_warn_deny.stderr +++ b/tests/ui/lint/cli-lint-override.force_warn_deny.stderr @@ -2,7 +2,7 @@ warning: extern declarations without an explicit ABI are deprecated --> $DIR/cli-lint-override.rs:12:1 | LL | extern fn foo() {} - | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | = note: requested on the command line with `--force-warn missing-abi` diff --git a/tests/ui/lint/cli-lint-override.warn_deny.stderr b/tests/ui/lint/cli-lint-override.warn_deny.stderr index bfec37ada95..979ca22324f 100644 --- a/tests/ui/lint/cli-lint-override.warn_deny.stderr +++ b/tests/ui/lint/cli-lint-override.warn_deny.stderr @@ -2,7 +2,7 @@ error: extern declarations without an explicit ABI are deprecated --> $DIR/cli-lint-override.rs:12:1 | LL | extern fn foo() {} - | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | = note: requested on the command line with `-D missing-abi` diff --git a/tests/ui/lint/dead-code/tuple-struct-field.stderr b/tests/ui/lint/dead-code/tuple-struct-field.stderr index 434554d7ae5..3e1d4e77274 100644 --- a/tests/ui/lint/dead-code/tuple-struct-field.stderr +++ b/tests/ui/lint/dead-code/tuple-struct-field.stderr @@ -33,8 +33,9 @@ LL | struct UnusedInTheMiddle(i32, f32, String, u8, u32); | help: consider changing the fields to be of unit type to suppress this warning while preserving the field numbering, or remove the fields | -LL | struct UnusedInTheMiddle(i32, (), (), u8, ()); - | ~~ ~~ ~~ +LL - struct UnusedInTheMiddle(i32, f32, String, u8, u32); +LL + struct UnusedInTheMiddle(i32, (), (), u8, ()); + | error: aborting due to 3 previous errors diff --git a/tests/ui/lint/elided-named-lifetimes/static.stderr b/tests/ui/lint/elided-named-lifetimes/static.stderr index fa2a2d3460f..7ad08dbf04b 100644 --- a/tests/ui/lint/elided-named-lifetimes/static.stderr +++ b/tests/ui/lint/elided-named-lifetimes/static.stderr @@ -44,8 +44,9 @@ LL | fn underscore(x: &'static u8) -> &'_ u8 { | help: consider specifying it explicitly | -LL | fn underscore(x: &'static u8) -> &'static u8 { - | ~~~~~~~ +LL - fn underscore(x: &'static u8) -> &'_ u8 { +LL + fn underscore(x: &'static u8) -> &'static u8 { + | error: aborting due to 4 previous errors diff --git a/tests/ui/lint/fn-ptr-comparisons.stderr b/tests/ui/lint/fn-ptr-comparisons.stderr index eaba23a461a..e6993323898 100644 --- a/tests/ui/lint/fn-ptr-comparisons.stderr +++ b/tests/ui/lint/fn-ptr-comparisons.stderr @@ -10,8 +10,9 @@ LL | let _ = f == a; = note: `#[warn(unpredictable_function_pointer_comparisons)]` on by default help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(f, a as fn()); - | +++++++++++++++++++++ ~ ++++++++ +LL - let _ = f == a; +LL + let _ = std::ptr::fn_addr_eq(f, a as fn()); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:28:13 @@ -24,8 +25,9 @@ LL | let _ = f != a; = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html> help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = !std::ptr::fn_addr_eq(f, a as fn()); - | ++++++++++++++++++++++ ~ ++++++++ +LL - let _ = f != a; +LL + let _ = !std::ptr::fn_addr_eq(f, a as fn()); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:30:13 @@ -38,8 +40,9 @@ LL | let _ = f == g; = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html> help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(f, g); - | +++++++++++++++++++++ ~ + +LL - let _ = f == g; +LL + let _ = std::ptr::fn_addr_eq(f, g); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:32:13 @@ -52,8 +55,9 @@ LL | let _ = f == f; = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html> help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(f, f); - | +++++++++++++++++++++ ~ + +LL - let _ = f == f; +LL + let _ = std::ptr::fn_addr_eq(f, f); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:34:13 @@ -66,8 +70,9 @@ LL | let _ = g == g; = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html> help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(g, g); - | +++++++++++++++++++++ ~ + +LL - let _ = g == g; +LL + let _ = std::ptr::fn_addr_eq(g, g); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:36:13 @@ -80,8 +85,9 @@ LL | let _ = g == g; = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html> help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(g, g); - | +++++++++++++++++++++ ~ + +LL - let _ = g == g; +LL + let _ = std::ptr::fn_addr_eq(g, g); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:38:13 @@ -94,8 +100,9 @@ LL | let _ = &g == &g; = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html> help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(g, g); - | ~~~~~~~~~~~~~~~~~~~~~ ~ + +LL - let _ = &g == &g; +LL + let _ = std::ptr::fn_addr_eq(g, g); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:40:13 @@ -108,8 +115,9 @@ LL | let _ = a as fn() == g; = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html> help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(a as fn(), g); - | +++++++++++++++++++++ ~ + +LL - let _ = a as fn() == g; +LL + let _ = std::ptr::fn_addr_eq(a as fn(), g); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:44:13 @@ -122,8 +130,9 @@ LL | let _ = cfn == c; = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html> help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(cfn, c as extern "C" fn()); - | +++++++++++++++++++++ ~ +++++++++++++++++++ +LL - let _ = cfn == c; +LL + let _ = std::ptr::fn_addr_eq(cfn, c as extern "C" fn()); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:48:13 @@ -136,8 +145,9 @@ LL | let _ = argsfn == args; = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html> help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(argsfn, args as extern "C" fn(i32) -> i32); - | +++++++++++++++++++++ ~ +++++++++++++++++++++++++++++ +LL - let _ = argsfn == args; +LL + let _ = std::ptr::fn_addr_eq(argsfn, args as extern "C" fn(i32) -> i32); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:52:13 @@ -150,8 +160,9 @@ LL | let _ = t == test; = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html> help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(t, test as unsafe extern "C" fn()); - | +++++++++++++++++++++ ~ ++++++++++++++++++++++++++ +LL - let _ = t == test; +LL + let _ = std::ptr::fn_addr_eq(t, test as unsafe extern "C" fn()); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:56:13 @@ -164,8 +175,9 @@ LL | let _ = a1.f == a2.f; = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html> help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(a1.f, a2.f); - | +++++++++++++++++++++ ~ + +LL - let _ = a1.f == a2.f; +LL + let _ = std::ptr::fn_addr_eq(a1.f, a2.f); + | warning: 12 warnings emitted diff --git a/tests/ui/lint/for_loop_over_fallibles.stderr b/tests/ui/lint/for_loop_over_fallibles.stderr index f695de08257..dae5e6428c8 100644 --- a/tests/ui/lint/for_loop_over_fallibles.stderr +++ b/tests/ui/lint/for_loop_over_fallibles.stderr @@ -7,12 +7,14 @@ LL | for _ in Some(1) {} = note: `#[warn(for_loops_over_fallibles)]` on by default help: to check pattern in a loop use `while let` | -LL | while let Some(_) = Some(1) {} - | ~~~~~~~~~~~~~~~ ~~~ +LL - for _ in Some(1) {} +LL + while let Some(_) = Some(1) {} + | help: consider using `if let` to clear intent | -LL | if let Some(_) = Some(1) {} - | ~~~~~~~~~~~~ ~~~ +LL - for _ in Some(1) {} +LL + if let Some(_) = Some(1) {} + | warning: for loop over a `Result`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:9:14 @@ -22,12 +24,14 @@ LL | for _ in Ok::<_, ()>(1) {} | help: to check pattern in a loop use `while let` | -LL | while let Ok(_) = Ok::<_, ()>(1) {} - | ~~~~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>(1) {} +LL + while let Ok(_) = Ok::<_, ()>(1) {} + | help: consider using `if let` to clear intent | -LL | if let Ok(_) = Ok::<_, ()>(1) {} - | ~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>(1) {} +LL + if let Ok(_) = Ok::<_, ()>(1) {} + | warning: for loop over an `Option`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:15:14 @@ -37,12 +41,14 @@ LL | for _ in [0; 0].iter().next() {} | help: to iterate over `[0; 0].iter()` remove the call to `next` | -LL | for _ in [0; 0].iter().by_ref() {} - | ~~~~~~~~~ +LL - for _ in [0; 0].iter().next() {} +LL + for _ in [0; 0].iter().by_ref() {} + | help: consider using `if let` to clear intent | -LL | if let Some(_) = [0; 0].iter().next() {} - | ~~~~~~~~~~~~ ~~~ +LL - for _ in [0; 0].iter().next() {} +LL + if let Some(_) = [0; 0].iter().next() {} + | warning: for loop over a `Result`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:21:14 @@ -52,12 +58,14 @@ LL | for _ in Ok::<_, ()>([0; 0].iter()) {} | help: to check pattern in a loop use `while let` | -LL | while let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} - | ~~~~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>([0; 0].iter()) {} +LL + while let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} + | help: consider using `if let` to clear intent | -LL | if let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} - | ~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>([0; 0].iter()) {} +LL + if let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} + | warning: for loop over a `Result`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:29:14 @@ -67,16 +75,18 @@ LL | for _ in Ok::<_, ()>([0; 0].iter()) {} | help: to check pattern in a loop use `while let` | -LL | while let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} - | ~~~~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>([0; 0].iter()) {} +LL + while let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} + | help: consider unwrapping the `Result` with `?` to iterate over its contents | LL | for _ in Ok::<_, ()>([0; 0].iter())? {} | + help: consider using `if let` to clear intent | -LL | if let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} - | ~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>([0; 0].iter()) {} +LL + if let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} + | warning: for loop over a `Result`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:36:14 @@ -86,16 +96,18 @@ LL | for _ in Ok::<_, ()>([0; 0]) {} | help: to check pattern in a loop use `while let` | -LL | while let Ok(_) = Ok::<_, ()>([0; 0]) {} - | ~~~~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>([0; 0]) {} +LL + while let Ok(_) = Ok::<_, ()>([0; 0]) {} + | help: consider unwrapping the `Result` with `?` to iterate over its contents | LL | for _ in Ok::<_, ()>([0; 0])? {} | + help: consider using `if let` to clear intent | -LL | if let Ok(_) = Ok::<_, ()>([0; 0]) {} - | ~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>([0; 0]) {} +LL + if let Ok(_) = Ok::<_, ()>([0; 0]) {} + | warning: for loop over a `&Option`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:47:14 @@ -105,12 +117,14 @@ LL | for _ in &Some(1) {} | help: to check pattern in a loop use `while let` | -LL | while let Some(_) = &Some(1) {} - | ~~~~~~~~~~~~~~~ ~~~ +LL - for _ in &Some(1) {} +LL + while let Some(_) = &Some(1) {} + | help: consider using `if let` to clear intent | -LL | if let Some(_) = &Some(1) {} - | ~~~~~~~~~~~~ ~~~ +LL - for _ in &Some(1) {} +LL + if let Some(_) = &Some(1) {} + | warning: for loop over a `&Result`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:51:14 @@ -120,12 +134,14 @@ LL | for _ in &Ok::<_, ()>(1) {} | help: to check pattern in a loop use `while let` | -LL | while let Ok(_) = &Ok::<_, ()>(1) {} - | ~~~~~~~~~~~~~ ~~~ +LL - for _ in &Ok::<_, ()>(1) {} +LL + while let Ok(_) = &Ok::<_, ()>(1) {} + | help: consider using `if let` to clear intent | -LL | if let Ok(_) = &Ok::<_, ()>(1) {} - | ~~~~~~~~~~ ~~~ +LL - for _ in &Ok::<_, ()>(1) {} +LL + if let Ok(_) = &Ok::<_, ()>(1) {} + | warning: for loop over a `&mut Option`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:57:14 @@ -135,12 +151,14 @@ LL | for _ in &mut Some(1) {} | help: to check pattern in a loop use `while let` | -LL | while let Some(_) = &mut Some(1) {} - | ~~~~~~~~~~~~~~~ ~~~ +LL - for _ in &mut Some(1) {} +LL + while let Some(_) = &mut Some(1) {} + | help: consider using `if let` to clear intent | -LL | if let Some(_) = &mut Some(1) {} - | ~~~~~~~~~~~~ ~~~ +LL - for _ in &mut Some(1) {} +LL + if let Some(_) = &mut Some(1) {} + | warning: for loop over a `&mut Result`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:61:14 @@ -150,12 +168,14 @@ LL | for _ in &mut Ok::<_, ()>(1) {} | help: to check pattern in a loop use `while let` | -LL | while let Ok(_) = &mut Ok::<_, ()>(1) {} - | ~~~~~~~~~~~~~ ~~~ +LL - for _ in &mut Ok::<_, ()>(1) {} +LL + while let Ok(_) = &mut Ok::<_, ()>(1) {} + | help: consider using `if let` to clear intent | -LL | if let Ok(_) = &mut Ok::<_, ()>(1) {} - | ~~~~~~~~~~ ~~~ +LL - for _ in &mut Ok::<_, ()>(1) {} +LL + if let Ok(_) = &mut Ok::<_, ()>(1) {} + | warning: 10 warnings emitted diff --git a/tests/ui/lint/invalid_from_utf8.rs b/tests/ui/lint/invalid_from_utf8.rs index 2d1822a54ac..8f8000fe34d 100644 --- a/tests/ui/lint/invalid_from_utf8.rs +++ b/tests/ui/lint/invalid_from_utf8.rs @@ -1,7 +1,7 @@ //@ check-pass #![feature(concat_bytes)] - +#![feature(inherent_str_constructors)] #![warn(invalid_from_utf8_unchecked)] #![warn(invalid_from_utf8)] @@ -9,7 +9,9 @@ pub fn from_utf8_unchecked_mut() { // Valid unsafe { std::str::from_utf8_unchecked_mut(&mut [99, 108, 105, 112, 112, 121]); + str::from_utf8_unchecked_mut(&mut [99, 108, 105, 112, 112, 121]); std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'i', b'p', b'p', b'y']); + str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'i', b'p', b'p', b'y']); let x = 0xA0; std::str::from_utf8_unchecked_mut(&mut [0xC0, x]); @@ -19,8 +21,12 @@ pub fn from_utf8_unchecked_mut() { unsafe { std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]); //~^ WARN calls to `std::str::from_utf8_unchecked_mut` + str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]); + //~^ WARN calls to `str::from_utf8_unchecked_mut` std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); //~^ WARN calls to `std::str::from_utf8_unchecked_mut` + str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + //~^ WARN calls to `str::from_utf8_unchecked_mut` } } @@ -28,23 +34,35 @@ pub fn from_utf8_unchecked() { // Valid unsafe { std::str::from_utf8_unchecked(&[99, 108, 105, 112, 112, 121]); + str::from_utf8_unchecked(&[99, 108, 105, 112, 112, 121]); std::str::from_utf8_unchecked(&[b'c', b'l', b'i', b'p', b'p', b'y']); + str::from_utf8_unchecked(&[b'c', b'l', b'i', b'p', b'p', b'y']); std::str::from_utf8_unchecked(b"clippy"); + str::from_utf8_unchecked(b"clippy"); let x = 0xA0; std::str::from_utf8_unchecked(&[0xC0, x]); + str::from_utf8_unchecked(&[0xC0, x]); } // Invalid unsafe { std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]); //~^ WARN calls to `std::str::from_utf8_unchecked` + str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]); + //~^ WARN calls to `str::from_utf8_unchecked` std::str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); //~^ WARN calls to `std::str::from_utf8_unchecked` + str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + //~^ WARN calls to `str::from_utf8_unchecked` std::str::from_utf8_unchecked(b"cl\x82ippy"); //~^ WARN calls to `std::str::from_utf8_unchecked` + str::from_utf8_unchecked(b"cl\x82ippy"); + //~^ WARN calls to `str::from_utf8_unchecked` std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy")); //~^ WARN calls to `std::str::from_utf8_unchecked` + str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy")); + //~^ WARN calls to `str::from_utf8_unchecked` } } @@ -52,18 +70,25 @@ pub fn from_utf8_mut() { // Valid { std::str::from_utf8_mut(&mut [99, 108, 105, 112, 112, 121]); + str::from_utf8_mut(&mut [99, 108, 105, 112, 112, 121]); std::str::from_utf8_mut(&mut [b'c', b'l', b'i', b'p', b'p', b'y']); + str::from_utf8_mut(&mut [b'c', b'l', b'i', b'p', b'p', b'y']); let x = 0xa0; std::str::from_utf8_mut(&mut [0xc0, x]); + str::from_utf8_mut(&mut [0xc0, x]); } // Invalid { std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]); //~^ WARN calls to `std::str::from_utf8_mut` + str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]); + //~^ WARN calls to `str::from_utf8_mut` std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); //~^ WARN calls to `std::str::from_utf8_mut` + str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + //~^ WARN calls to `str::from_utf8_mut` } } @@ -71,23 +96,35 @@ pub fn from_utf8() { // Valid { std::str::from_utf8(&[99, 108, 105, 112, 112, 121]); + str::from_utf8(&[99, 108, 105, 112, 112, 121]); std::str::from_utf8(&[b'c', b'l', b'i', b'p', b'p', b'y']); + str::from_utf8(&[b'c', b'l', b'i', b'p', b'p', b'y']); std::str::from_utf8(b"clippy"); + str::from_utf8(b"clippy"); let x = 0xA0; std::str::from_utf8(&[0xC0, x]); + str::from_utf8(&[0xC0, x]); } // Invalid { std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]); + //~^ WARN calls to `str::from_utf8` std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + //~^ WARN calls to `str::from_utf8` std::str::from_utf8(b"cl\x82ippy"); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(b"cl\x82ippy"); + //~^ WARN calls to `str::from_utf8` std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy")); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(concat_bytes!(b"cl", b"\x82ippy")); + //~^ WARN calls to `str::from_utf8` } } @@ -95,25 +132,39 @@ pub fn from_utf8_with_indirections() { let mut a = [99, 108, 130, 105, 112, 112, 121]; std::str::from_utf8_mut(&mut a); //~^ WARN calls to `std::str::from_utf8_mut` + str::from_utf8_mut(&mut a); + //~^ WARN calls to `str::from_utf8_mut` let mut b = &mut a; let mut c = b; std::str::from_utf8_mut(c); //~^ WARN calls to `std::str::from_utf8_mut` + str::from_utf8_mut(c); + //~^ WARN calls to `str::from_utf8_mut` let mut c = &[99, 108, 130, 105, 112, 112, 121]; std::str::from_utf8(c); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(c); + //~^ WARN calls to `str::from_utf8` const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121]; std::str::from_utf8(&INVALID_1); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(&INVALID_1); + //~^ WARN calls to `str::from_utf8` static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121]; std::str::from_utf8(&INVALID_2); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(&INVALID_2); + //~^ WARN calls to `str::from_utf8` const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121]; std::str::from_utf8(INVALID_3); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(INVALID_3); + //~^ WARN calls to `str::from_utf8` const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] }; std::str::from_utf8(INVALID_4); //~^ WARN calls to `std::str::from_utf8` + str::from_utf8(INVALID_4); + //~^ WARN calls to `str::from_utf8` } fn main() {} diff --git a/tests/ui/lint/invalid_from_utf8.stderr b/tests/ui/lint/invalid_from_utf8.stderr index 07616e11801..715ecf56f21 100644 --- a/tests/ui/lint/invalid_from_utf8.stderr +++ b/tests/ui/lint/invalid_from_utf8.stderr @@ -1,5 +1,5 @@ -warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior - --> $DIR/invalid_from_utf8.rs:20:9 +warning: calls to `std::str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:22:9 | LL | std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^ @@ -12,48 +12,96 @@ note: the lint level is defined here LL | #![warn(invalid_from_utf8_unchecked)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior - --> $DIR/invalid_from_utf8.rs:22:9 +warning: calls to `str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:24:9 + | +LL | str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:26:9 | LL | std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior - --> $DIR/invalid_from_utf8.rs:40:9 +warning: calls to `str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:28:9 + | +LL | str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:50:9 | LL | std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior - --> $DIR/invalid_from_utf8.rs:42:9 +warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:52:9 + | +LL | str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:54:9 | LL | std::str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior - --> $DIR/invalid_from_utf8.rs:44:9 +warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:56:9 + | +LL | str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:58:9 | LL | std::str::from_utf8_unchecked(b"cl\x82ippy"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior - --> $DIR/invalid_from_utf8.rs:46:9 +warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:60:9 + | +LL | str::from_utf8_unchecked(b"cl\x82ippy"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^-------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:62:9 | LL | std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:63:9 +warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior + --> $DIR/invalid_from_utf8.rs:64:9 + | +LL | str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:84:9 | LL | std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^ @@ -66,56 +114,113 @@ note: the lint level is defined here LL | #![warn(invalid_from_utf8)] | ^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:65:9 +warning: calls to `str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:86:9 + | +LL | str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]); + | ^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:88:9 | LL | std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:83:9 +warning: calls to `str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:90:9 + | +LL | str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + | ^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:112:9 | LL | std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]); | ^^^^^^^^^^^^^^^^^^^^^----------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:85:9 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:114:9 + | +LL | str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]); + | ^^^^^^^^^^^^^^^^----------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:116:9 | LL | std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); | ^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:87:9 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:118:9 + | +LL | str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']); + | ^^^^^^^^^^^^^^^^---------------------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:120:9 | LL | std::str::from_utf8(b"cl\x82ippy"); | ^^^^^^^^^^^^^^^^^^^^-------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:89:9 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:122:9 + | +LL | str::from_utf8(b"cl\x82ippy"); + | ^^^^^^^^^^^^^^^-------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:124:9 | LL | std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy")); | ^^^^^^^^^^^^^^^^^^^^---------------------------------^ | | | the literal was valid UTF-8 up to the 2 bytes -warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:96:5 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:126:9 + | +LL | str::from_utf8(concat_bytes!(b"cl", b"\x82ippy")); + | ^^^^^^^^^^^^^^^---------------------------------^ + | | + | the literal was valid UTF-8 up to the 2 bytes + +warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:133:5 | LL | let mut a = [99, 108, 130, 105, 112, 112, 121]; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes LL | std::str::from_utf8_mut(&mut a); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:100:5 +warning: calls to `str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:135:5 + | +LL | let mut a = [99, 108, 130, 105, 112, 112, 121]; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8_mut(&mut a); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:139:5 | LL | let mut a = [99, 108, 130, 105, 112, 112, 121]; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes @@ -123,45 +228,99 @@ LL | let mut a = [99, 108, 130, 105, 112, 112, 121]; LL | std::str::from_utf8_mut(c); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:103:5 +warning: calls to `str::from_utf8_mut` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:141:5 + | +LL | let mut a = [99, 108, 130, 105, 112, 112, 121]; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8_mut(c); + | ^^^^^^^^^^^^^^^^^^^^^ + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:144:5 | LL | let mut c = &[99, 108, 130, 105, 112, 112, 121]; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes LL | std::str::from_utf8(c); | ^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:106:5 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:146:5 + | +LL | let mut c = &[99, 108, 130, 105, 112, 112, 121]; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8(c); + | ^^^^^^^^^^^^^^^^^ + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:149:5 | LL | const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121]; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes LL | std::str::from_utf8(&INVALID_1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:109:5 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:151:5 + | +LL | const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121]; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8(&INVALID_1); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:154:5 | LL | static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121]; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes LL | std::str::from_utf8(&INVALID_2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:112:5 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:156:5 + | +LL | static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121]; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8(&INVALID_2); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:159:5 | LL | const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121]; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes LL | std::str::from_utf8(INVALID_3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: calls to `std::str::from_utf8` with a invalid literal always return an error - --> $DIR/invalid_from_utf8.rs:115:5 +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:161:5 + | +LL | const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121]; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8(INVALID_3); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: calls to `std::str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:164:5 | LL | const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] }; | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes LL | std::str::from_utf8(INVALID_4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: 19 warnings emitted +warning: calls to `str::from_utf8` with an invalid literal always return an error + --> $DIR/invalid_from_utf8.rs:166:5 + | +LL | const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] }; + | ---------------------------------- the literal was valid UTF-8 up to the 2 bytes +... +LL | str::from_utf8(INVALID_4); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 38 warnings emitted diff --git a/tests/ui/lint/issue-106991.rs b/tests/ui/lint/issue-106991.rs index e4d7f765b4a..b70f751195a 100644 --- a/tests/ui/lint/issue-106991.rs +++ b/tests/ui/lint/issue-106991.rs @@ -3,7 +3,7 @@ fn foo(items: &mut Vec<u8>) { } fn bar() -> impl Iterator<Item = i32> { - //~^ ERROR expected `foo` to be a fn item that returns `i32`, but it returns `()` [E0271] + //~^ ERROR expected `foo` to return `i32`, but it returns `()` [E0271] let mut x: Vec<Vec<u8>> = vec![vec![0, 2, 1], vec![5, 4, 3]]; x.iter_mut().map(foo) } diff --git a/tests/ui/lint/issue-106991.stderr b/tests/ui/lint/issue-106991.stderr index 0441a6377d0..15e0ba5337f 100644 --- a/tests/ui/lint/issue-106991.stderr +++ b/tests/ui/lint/issue-106991.stderr @@ -1,4 +1,4 @@ -error[E0271]: expected `foo` to be a fn item that returns `i32`, but it returns `()` +error[E0271]: expected `foo` to return `i32`, but it returns `()` --> $DIR/issue-106991.rs:5:13 | LL | fn bar() -> impl Iterator<Item = i32> { diff --git a/tests/ui/lint/issue-109152.stderr b/tests/ui/lint/issue-109152.stderr index a175964ccf6..01aa9068da5 100644 --- a/tests/ui/lint/issue-109152.stderr +++ b/tests/ui/lint/issue-109152.stderr @@ -16,8 +16,9 @@ LL | #![deny(map_unit_fn)] | ^^^^^^^^^^^ help: you might have meant to use `Iterator::for_each` | -LL | vec![42].iter().for_each(drop); - | ~~~~~~~~ +LL - vec![42].iter().map(drop); +LL + vec![42].iter().for_each(drop); + | error: aborting due to 1 previous error diff --git a/tests/ui/lint/issue-109529.stderr b/tests/ui/lint/issue-109529.stderr index 9e857d1b0ab..51b71cb1007 100644 --- a/tests/ui/lint/issue-109529.stderr +++ b/tests/ui/lint/issue-109529.stderr @@ -16,8 +16,9 @@ LL | for _ in 0..(256 as u8) {} | help: use an inclusive range instead | -LL | for _ in 0..=(255 as u8) {} - | + ~~~ +LL - for _ in 0..(256 as u8) {} +LL + for _ in 0..=(255 as u8) {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/lint/issue-35075.stderr b/tests/ui/lint/issue-35075.stderr index 08bdaa72858..f02f9e678b4 100644 --- a/tests/ui/lint/issue-35075.stderr +++ b/tests/ui/lint/issue-35075.stderr @@ -6,8 +6,9 @@ LL | inner: Foo<T> | help: there is an enum variant `Baz::Foo`; try using the variant's enum | -LL | inner: Baz - | ~~~ +LL - inner: Foo<T> +LL + inner: Baz + | error[E0412]: cannot find type `Foo` in this scope --> $DIR/issue-35075.rs:6:9 @@ -17,8 +18,9 @@ LL | Foo(Foo<T>) | help: there is an enum variant `Baz::Foo`; try using the variant's enum | -LL | Foo(Baz) - | ~~~ +LL - Foo(Foo<T>) +LL + Foo(Baz) + | error: aborting due to 2 previous errors diff --git a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr index 70f9979556a..105506968b1 100644 --- a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr +++ b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr @@ -12,11 +12,12 @@ LL | #![deny(let_underscore_drop)] help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = foo(); - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | -LL | drop(foo()); - | ~~~~~ + +LL - let _ = foo(); +LL + drop(foo()); + | error: aborting due to 1 previous error diff --git a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr index e4b1872bba5..3ff57ab441d 100644 --- a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr +++ b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr @@ -11,12 +11,14 @@ LL | #![deny(let_underscore_drop)] | ^^^^^^^^^^^^^^^^^^^ help: consider binding to an unused variable to avoid immediately dropping the value | -LL | let _unused = field; - | ~~~~~~~~~~~ +LL - _ = field; +LL + let _unused = field; + | help: consider immediately dropping the value | -LL | drop(field); - | ~~~~~ + +LL - _ = field; +LL + drop(field); + | error: non-binding let on a type that has a destructor --> $DIR/issue-119697-extra-let.rs:17:5 @@ -27,11 +29,12 @@ LL | let _ = field; help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = field; - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | -LL | drop(field); - | ~~~~~ + +LL - let _ = field; +LL + drop(field); + | error: aborting due to 2 previous errors diff --git a/tests/ui/lint/let_underscore/let_underscore_drop.stderr b/tests/ui/lint/let_underscore/let_underscore_drop.stderr index 09f2587063b..001827b0d37 100644 --- a/tests/ui/lint/let_underscore/let_underscore_drop.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_drop.stderr @@ -12,11 +12,12 @@ LL | #![warn(let_underscore_drop)] help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = NontrivialDrop; - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | -LL | drop(NontrivialDrop); - | ~~~~~ + +LL - let _ = NontrivialDrop; +LL + drop(NontrivialDrop); + | warning: 1 warning emitted diff --git a/tests/ui/lint/let_underscore/let_underscore_lock.stderr b/tests/ui/lint/let_underscore/let_underscore_lock.stderr index fb8b9ec2203..a54a23e364b 100644 --- a/tests/ui/lint/let_underscore/let_underscore_lock.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_lock.stderr @@ -8,11 +8,12 @@ LL | let _ = data.lock().unwrap(); help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = data.lock().unwrap(); - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | -LL | drop(data.lock().unwrap()); - | ~~~~~ + +LL - let _ = data.lock().unwrap(); +LL + drop(data.lock().unwrap()); + | error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:12:9 @@ -23,11 +24,12 @@ LL | let _ = data.lock(); help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = data.lock(); - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | -LL | drop(data.lock()); - | ~~~~~ + +LL - let _ = data.lock(); +LL + drop(data.lock()); + | error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:14:10 @@ -39,7 +41,7 @@ LL | let (_, _) = (data.lock(), 1); help: consider binding to an unused variable to avoid immediately dropping the value | LL | let (_unused, _) = (data.lock(), 1); - | ~~~~~~~ + | ++++++ error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:16:26 @@ -51,7 +53,7 @@ LL | let (_a, Struct { a: _ }) = (0, Struct { a: data.lock() }); help: consider binding to an unused variable to avoid immediately dropping the value | LL | let (_a, Struct { a: _unused }) = (0, Struct { a: data.lock() }); - | ~~~~~~~ + | ++++++ error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:18:6 diff --git a/tests/ui/lint/lint-ctypes-enum.rs b/tests/ui/lint/lint-ctypes-enum.rs index 19af1de9576..0d19d5b5347 100644 --- a/tests/ui/lint/lint-ctypes-enum.rs +++ b/tests/ui/lint/lint-ctypes-enum.rs @@ -94,6 +94,7 @@ extern "C" { fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>); //~^ ERROR `extern` block uses type fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>); //~ ERROR `extern` block uses type + fn option_u8(x: Option<u8>); //~ ERROR `extern` block uses type fn result_ref_t(x: Result<&'static u8, ()>); fn result_fn_t(x: Result<extern "C" fn(), ()>); diff --git a/tests/ui/lint/lint-ctypes-enum.stderr b/tests/ui/lint/lint-ctypes-enum.stderr index 8e92e7e6946..a491bd19605 100644 --- a/tests/ui/lint/lint-ctypes-enum.stderr +++ b/tests/ui/lint/lint-ctypes-enum.stderr @@ -79,8 +79,17 @@ LL | fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint +error: `extern` block uses type `Option<u8>`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:97:21 + | +LL | fn option_u8(x: Option<u8>); + | ^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:106:33 + --> $DIR/lint-ctypes-enum.rs:107:33 | LL | fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -88,7 +97,7 @@ LL | fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:113:33 + --> $DIR/lint-ctypes-enum.rs:114:33 | LL | fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -96,7 +105,7 @@ LL | fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `Result<TransparentUnion<NonZero<u8>>, ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:118:38 + --> $DIR/lint-ctypes-enum.rs:119:38 | LL | fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u8>>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -105,7 +114,7 @@ LL | fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u = note: enum has no representation hint error: `extern` block uses type `Result<Rust<NonZero<u8>>, ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:120:30 + --> $DIR/lint-ctypes-enum.rs:121:30 | LL | fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -114,7 +123,7 @@ LL | fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>); = note: enum has no representation hint error: `extern` block uses type `Result<NonZero<u8>, U>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:124:51 + --> $DIR/lint-ctypes-enum.rs:125:51 | LL | fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>, U>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -123,7 +132,7 @@ LL | fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>, = note: enum has no representation hint error: `extern` block uses type `Result<NonZero<u8>, B>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:126:53 + --> $DIR/lint-ctypes-enum.rs:127:53 | LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8>, B>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -132,7 +141,7 @@ LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8> = note: enum has no representation hint error: `extern` block uses type `Result<NonZero<u8>, NonExhaustive>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:128:51 + --> $DIR/lint-ctypes-enum.rs:129:51 | LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, NonExhaustive>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -141,7 +150,7 @@ LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, = note: enum has no representation hint error: `extern` block uses type `Result<NonZero<u8>, Field>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:131:49 + --> $DIR/lint-ctypes-enum.rs:132:49 | LL | fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Field>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -150,7 +159,7 @@ LL | fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Fi = note: enum has no representation hint error: `extern` block uses type `Result<Result<(), NonZero<u8>>, ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:133:30 + --> $DIR/lint-ctypes-enum.rs:134:30 | LL | fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -159,7 +168,7 @@ LL | fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>); = note: enum has no representation hint error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:144:33 + --> $DIR/lint-ctypes-enum.rs:145:33 | LL | fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -167,7 +176,7 @@ LL | fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:151:33 + --> $DIR/lint-ctypes-enum.rs:152:33 | LL | fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -175,7 +184,7 @@ LL | fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `Result<(), TransparentUnion<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:156:38 + --> $DIR/lint-ctypes-enum.rs:157:38 | LL | fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZero<u8>>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -184,7 +193,7 @@ LL | fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZe = note: enum has no representation hint error: `extern` block uses type `Result<(), Rust<NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:158:30 + --> $DIR/lint-ctypes-enum.rs:159:30 | LL | fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -193,7 +202,7 @@ LL | fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>); = note: enum has no representation hint error: `extern` block uses type `Result<U, NonZero<u8>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:162:51 + --> $DIR/lint-ctypes-enum.rs:163:51 | LL | fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -202,7 +211,7 @@ LL | fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8 = note: enum has no representation hint error: `extern` block uses type `Result<B, NonZero<u8>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:164:53 + --> $DIR/lint-ctypes-enum.rs:165:53 | LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero<u8>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -211,7 +220,7 @@ LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero< = note: enum has no representation hint error: `extern` block uses type `Result<NonExhaustive, NonZero<u8>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:166:51 + --> $DIR/lint-ctypes-enum.rs:167:51 | LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num::NonZero<u8>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -220,7 +229,7 @@ LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num = note: enum has no representation hint error: `extern` block uses type `Result<Field, NonZero<u8>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:169:49 + --> $DIR/lint-ctypes-enum.rs:170:49 | LL | fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero<u8>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -229,7 +238,7 @@ LL | fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero< = note: enum has no representation hint error: `extern` block uses type `Result<(), Result<(), NonZero<u8>>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:171:30 + --> $DIR/lint-ctypes-enum.rs:172:30 | LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -238,7 +247,7 @@ LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>); = note: enum has no representation hint error: `extern` block uses type `Result<(), ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:173:27 + --> $DIR/lint-ctypes-enum.rs:174:27 | LL | fn result_unit_t_e(x: Result<(), ()>); | ^^^^^^^^^^^^^^ not FFI-safe @@ -246,5 +255,5 @@ LL | fn result_unit_t_e(x: Result<(), ()>); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -error: aborting due to 26 previous errors +error: aborting due to 27 previous errors diff --git a/tests/ui/lint/lint-overflowing-int-136675.rs b/tests/ui/lint/lint-overflowing-int-136675.rs new file mode 100644 index 00000000000..616531519a6 --- /dev/null +++ b/tests/ui/lint/lint-overflowing-int-136675.rs @@ -0,0 +1,4 @@ +fn main() { + if let -129 = 0i8 {} //~ ERROR literal out of range for `i8` + let x: i8 = -129; //~ ERROR literal out of range for `i8` +} diff --git a/tests/ui/lint/lint-overflowing-int-136675.stderr b/tests/ui/lint/lint-overflowing-int-136675.stderr new file mode 100644 index 00000000000..3b67c663ac2 --- /dev/null +++ b/tests/ui/lint/lint-overflowing-int-136675.stderr @@ -0,0 +1,21 @@ +error: literal out of range for `i8` + --> $DIR/lint-overflowing-int-136675.rs:2:12 + | +LL | if let -129 = 0i8 {} + | ^^^^ + | + = note: the literal `-129` does not fit into the type `i8` whose range is `-128..=127` + = help: consider using the type `i16` instead + = note: `#[deny(overflowing_literals)]` on by default + +error: literal out of range for `i8` + --> $DIR/lint-overflowing-int-136675.rs:3:17 + | +LL | let x: i8 = -129; + | ^^^^ + | + = note: the literal `-129` does not fit into the type `i8` whose range is `-128..=127` + = help: consider using the type `i16` instead + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr b/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr index 24f2500abf8..f5eec6fc656 100644 --- a/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr +++ b/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr @@ -12,8 +12,9 @@ LL | #![deny(fuzzy_provenance_casts)] | ^^^^^^^^^^^^^^^^^^^^^^ help: use `.with_addr()` to adjust a valid pointer in the same allocation, to this address | -LL | let dangling = (...).with_addr(16_usize); - | ++++++++++++++++ ~ +LL - let dangling = 16_usize as *const u8; +LL + let dangling = (...).with_addr(16_usize); + | error: aborting due to 1 previous error diff --git a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr index 390028b349e..bcef0ae424e 100644 --- a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr +++ b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr @@ -12,8 +12,9 @@ LL | #![deny(lossy_provenance_casts)] | ^^^^^^^^^^^^^^^^^^^^^^ help: use `.addr()` to obtain the address of a pointer | -LL | let addr: usize = (&x as *const u8).addr(); - | + ~~~~~~~~ +LL - let addr: usize = &x as *const u8 as usize; +LL + let addr: usize = (&x as *const u8).addr(); + | error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `u32` --> $DIR/lint-strict-provenance-lossy-casts.rs:9:22 @@ -25,7 +26,7 @@ LL | let addr_32bit = &x as *const u8 as u32; help: use `.addr()` to obtain the address of a pointer | LL | let addr_32bit = (&x as *const u8).addr() as u32; - | + ~~~~~~~~~~~~~~~ + | + ++++++++ error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `usize` --> $DIR/lint-strict-provenance-lossy-casts.rs:14:20 diff --git a/tests/ui/lint/lint_map_unit_fn.stderr b/tests/ui/lint/lint_map_unit_fn.stderr index fbf689c5421..91542af0f6d 100644 --- a/tests/ui/lint/lint_map_unit_fn.stderr +++ b/tests/ui/lint/lint_map_unit_fn.stderr @@ -18,8 +18,9 @@ LL | #![deny(map_unit_fn)] | ^^^^^^^^^^^ help: you might have meant to use `Iterator::for_each` | -LL | x.iter_mut().for_each(foo); - | ~~~~~~~~ +LL - x.iter_mut().map(foo); +LL + x.iter_mut().for_each(foo); + | error: `Iterator::map` call that discard the iterator's values --> $DIR/lint_map_unit_fn.rs:11:18 @@ -41,8 +42,9 @@ LL | | | }); = note: `Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated help: you might have meant to use `Iterator::for_each` | -LL | x.iter_mut().for_each(|items| { - | ~~~~~~~~ +LL - x.iter_mut().map(|items| { +LL + x.iter_mut().for_each(|items| { + | error: `Iterator::map` call that discard the iterator's values --> $DIR/lint_map_unit_fn.rs:18:18 @@ -59,8 +61,9 @@ LL | x.iter_mut().map(f); = note: `Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated help: you might have meant to use `Iterator::for_each` | -LL | x.iter_mut().for_each(f); - | ~~~~~~~~ +LL - x.iter_mut().map(f); +LL + x.iter_mut().for_each(f); + | error: aborting due to 3 previous errors diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-identifiers-suggestion-reserved.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-identifiers-suggestion-reserved.stderr index 2841815ecf2..ae2a00d3f90 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-identifiers-suggestion-reserved.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-identifiers-suggestion-reserved.stderr @@ -30,8 +30,9 @@ LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ help: rename the identifier or convert it to a snake case raw identifier | -LL | mod r#impl {} - | ~~~~~~ +LL - mod Impl {} +LL + mod r#impl {} + | error: function `While` should have a snake case name --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:8:4 @@ -41,8 +42,9 @@ LL | fn While() {} | help: rename the identifier or convert it to a snake case raw identifier | -LL | fn r#while() {} - | ~~~~~~~ +LL - fn While() {} +LL + fn r#while() {} + | error: variable `Mod` should have a snake case name --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:12:9 @@ -52,8 +54,9 @@ LL | let Mod: usize = 0; | help: rename the identifier or convert it to a snake case raw identifier | -LL | let r#mod: usize = 0; - | ~~~~~ +LL - let Mod: usize = 0; +LL + let r#mod: usize = 0; + | error: variable `Super` should have a snake case name --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:16:9 diff --git a/tests/ui/lint/recommend-literal.stderr b/tests/ui/lint/recommend-literal.stderr index 424ecadd4b8..263071ca9a7 100644 --- a/tests/ui/lint/recommend-literal.stderr +++ b/tests/ui/lint/recommend-literal.stderr @@ -33,12 +33,14 @@ LL | let v2: Bool = true; | help: a builtin type with a similar name exists | -LL | let v2: bool = true; - | ~~~~ +LL - let v2: Bool = true; +LL + let v2: bool = true; + | help: perhaps you intended to use this type | -LL | let v2: bool = true; - | ~~~~ +LL - let v2: Bool = true; +LL + let v2: bool = true; + | error[E0412]: cannot find type `boolean` in this scope --> $DIR/recommend-literal.rs:19:9 @@ -75,8 +77,9 @@ LL | depth: Option<int>, | help: perhaps you intended to use this type | -LL | depth: Option<i32>, - | ~~~ +LL - depth: Option<int>, +LL + depth: Option<i32>, + | help: you might be missing a type parameter | LL | struct Data<int> { diff --git a/tests/ui/lint/static-mut-refs.e2021.stderr b/tests/ui/lint/static-mut-refs.e2021.stderr index 5a4e712b3c0..337d5d0b307 100644 --- a/tests/ui/lint/static-mut-refs.e2021.stderr +++ b/tests/ui/lint/static-mut-refs.e2021.stderr @@ -10,7 +10,7 @@ LL | let _y = &X; help: use `&raw const` instead to create a raw pointer | LL | let _y = &raw const X; - | ~~~~~~~~~~ + | +++++++++ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -22,8 +22,9 @@ LL | let _y = &mut X; = 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 help: use `&raw mut` instead to create a raw pointer | -LL | let _y = &raw mut X; - | ~~~~~~~~ +LL - let _y = &mut X; +LL + let _y = &raw mut X; + | warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:50:22 @@ -45,7 +46,7 @@ LL | let (_b, _c) = (&X, &Y); help: use `&raw const` instead to create a raw pointer | LL | let (_b, _c) = (&raw const X, &Y); - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -58,7 +59,7 @@ LL | let (_b, _c) = (&X, &Y); help: use `&raw const` instead to create a raw pointer | LL | let (_b, _c) = (&X, &raw const Y); - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -71,7 +72,7 @@ LL | foo(&X); help: use `&raw const` instead to create a raw pointer | LL | foo(&raw const X); - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -102,7 +103,7 @@ LL | let _v = &A.value; help: use `&raw const` instead to create a raw pointer | LL | let _v = &raw const A.value; - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -115,7 +116,7 @@ LL | let _s = &A.s.value; help: use `&raw const` instead to create a raw pointer | LL | let _s = &raw const A.s.value; - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/static-mut-refs.e2024.stderr b/tests/ui/lint/static-mut-refs.e2024.stderr index 1b549272bd5..cf7f0a86f4f 100644 --- a/tests/ui/lint/static-mut-refs.e2024.stderr +++ b/tests/ui/lint/static-mut-refs.e2024.stderr @@ -10,7 +10,7 @@ LL | let _y = &X; help: use `&raw const` instead to create a raw pointer | LL | let _y = &raw const X; - | ~~~~~~~~~~ + | +++++++++ error: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -22,8 +22,9 @@ LL | let _y = &mut X; = 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 help: use `&raw mut` instead to create a raw pointer | -LL | let _y = &raw mut X; - | ~~~~~~~~ +LL - let _y = &mut X; +LL + let _y = &raw mut X; + | error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:50:22 @@ -45,7 +46,7 @@ LL | let (_b, _c) = (&X, &Y); help: use `&raw const` instead to create a raw pointer | LL | let (_b, _c) = (&raw const X, &Y); - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -58,7 +59,7 @@ LL | let (_b, _c) = (&X, &Y); help: use `&raw const` instead to create a raw pointer | LL | let (_b, _c) = (&X, &raw const Y); - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -71,7 +72,7 @@ LL | foo(&X); help: use `&raw const` instead to create a raw pointer | LL | foo(&raw const X); - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -102,7 +103,7 @@ LL | let _v = &A.value; help: use `&raw const` instead to create a raw pointer | LL | let _v = &raw const A.value; - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -115,7 +116,7 @@ LL | let _s = &A.s.value; help: use `&raw const` instead to create a raw pointer | LL | let _s = &raw const A.s.value; - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/type-overflow.stderr b/tests/ui/lint/type-overflow.stderr index 9fdb05ed1c0..6ba0c9d907c 100644 --- a/tests/ui/lint/type-overflow.stderr +++ b/tests/ui/lint/type-overflow.stderr @@ -21,12 +21,14 @@ LL | let fail = 0b1000_0001i8; = note: the literal `0b1000_0001i8` (decimal `129`) does not fit into the type `i8` and will become `-127i8` help: consider using the type `u8` instead | -LL | let fail = 0b1000_0001u8; - | ~~~~~~~~~~~~~ +LL - let fail = 0b1000_0001i8; +LL + let fail = 0b1000_0001u8; + | help: to use as a negative number (decimal `-127`), consider using the type `u8` for the literal and cast it to `i8` | -LL | let fail = 0b1000_0001u8 as i8; - | ~~~~~~~~~~~~~~~~~~~ +LL - let fail = 0b1000_0001i8; +LL + let fail = 0b1000_0001u8 as i8; + | warning: literal out of range for `i64` --> $DIR/type-overflow.rs:15:16 @@ -37,12 +39,14 @@ LL | let fail = 0x8000_0000_0000_0000i64; = note: the literal `0x8000_0000_0000_0000i64` (decimal `9223372036854775808`) does not fit into the type `i64` and will become `-9223372036854775808i64` help: consider using the type `u64` instead | -LL | let fail = 0x8000_0000_0000_0000u64; - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let fail = 0x8000_0000_0000_0000i64; +LL + let fail = 0x8000_0000_0000_0000u64; + | help: to use as a negative number (decimal `-9223372036854775808`), consider using the type `u64` for the literal and cast it to `i64` | -LL | let fail = 0x8000_0000_0000_0000u64 as i64; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let fail = 0x8000_0000_0000_0000i64; +LL + let fail = 0x8000_0000_0000_0000u64 as i64; + | warning: literal out of range for `u32` --> $DIR/type-overflow.rs:19:16 @@ -63,7 +67,7 @@ LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; help: to use as a negative number (decimal `-170141183460469231731687303715884105728`), consider using the type `u128` for the literal and cast it to `i128` | LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++ warning: literal out of range for `i32` --> $DIR/type-overflow.rs:27:16 @@ -113,7 +117,7 @@ LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; help: to use as a negative number (decimal `-2`), consider using the type `u32` for the literal and cast it to `i32` | LL | let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++ warning: literal out of range for `i8` --> $DIR/type-overflow.rs:46:17 diff --git a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr index 8fc2d1bc88f..2d43e612580 100644 --- a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr +++ b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr @@ -13,7 +13,7 @@ LL | #![deny(unused)] help: try ignoring the field | LL | A { i, j: _ } | B { i, j: _ } => { - | ~~~~ ~~~~ + | +++ +++ error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:30:16 @@ -23,8 +23,9 @@ LL | A { i, ref j } | B { i, ref j } => { | help: try ignoring the field | -LL | A { i, j: _ } | B { i, j: _ } => { - | ~~~~ ~~~~ +LL - A { i, ref j } | B { i, ref j } => { +LL + A { i, j: _ } | B { i, j: _ } => { + | error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:40:21 @@ -35,7 +36,7 @@ LL | Some(A { i, j } | B { i, j }) => { help: try ignoring the field | LL | Some(A { i, j: _ } | B { i, j: _ }) => { - | ~~~~ ~~~~ + | +++ +++ error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:52:21 @@ -45,8 +46,9 @@ LL | Some(A { i, ref j } | B { i, ref j }) => { | help: try ignoring the field | -LL | Some(A { i, j: _ } | B { i, j: _ }) => { - | ~~~~ ~~~~ +LL - Some(A { i, ref j } | B { i, ref j }) => { +LL + Some(A { i, j: _ } | B { i, j: _ }) => { + | error: unused variable: `i` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:62:24 @@ -56,8 +58,9 @@ LL | MixedEnum::A { i } | MixedEnum::B(i) => { | help: try ignoring the field | -LL | MixedEnum::A { i: _ } | MixedEnum::B(_) => { - | ~~~~ ~ +LL - MixedEnum::A { i } | MixedEnum::B(i) => { +LL + MixedEnum::A { i: _ } | MixedEnum::B(_) => { + | error: unused variable: `i` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:70:24 @@ -67,8 +70,9 @@ LL | MixedEnum::A { ref i } | MixedEnum::B(ref i) => { | help: try ignoring the field | -LL | MixedEnum::A { i: _ } | MixedEnum::B(_) => { - | ~~~~ ~ +LL - MixedEnum::A { ref i } | MixedEnum::B(ref i) => { +LL + MixedEnum::A { i: _ } | MixedEnum::B(_) => { + | error: aborting due to 6 previous errors diff --git a/tests/ui/lint/wide_pointer_comparisons.stderr b/tests/ui/lint/wide_pointer_comparisons.stderr index 78548e308ed..5a0b914d832 100644 --- a/tests/ui/lint/wide_pointer_comparisons.stderr +++ b/tests/ui/lint/wide_pointer_comparisons.stderr @@ -7,8 +7,9 @@ LL | let _ = a == b; = note: `#[warn(ambiguous_wide_pointer_comparisons)]` on by default help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ++++++++++++++++++ ~ + +LL - let _ = a == b; +LL + let _ = std::ptr::addr_eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:22:13 @@ -18,8 +19,9 @@ LL | let _ = a != b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(a, b); - | +++++++++++++++++++ ~ + +LL - let _ = a != b; +LL + let _ = !std::ptr::addr_eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:24:13 @@ -73,8 +75,9 @@ LL | let _ = PartialEq::eq(&a, &b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ~~~~~~~~~~~~~~~~~~ ~ +LL - let _ = PartialEq::eq(&a, &b); +LL + let _ = std::ptr::addr_eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:35:13 @@ -84,8 +87,9 @@ LL | let _ = PartialEq::ne(&a, &b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(a, b); - | ~~~~~~~~~~~~~~~~~~~ ~ +LL - let _ = PartialEq::ne(&a, &b); +LL + let _ = !std::ptr::addr_eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:37:13 @@ -95,8 +99,9 @@ LL | let _ = a.eq(&b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ++++++++++++++++++ ~ +LL - let _ = a.eq(&b); +LL + let _ = std::ptr::addr_eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:39:13 @@ -106,8 +111,9 @@ LL | let _ = a.ne(&b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(a, b); - | +++++++++++++++++++ ~ +LL - let _ = a.ne(&b); +LL + let _ = !std::ptr::addr_eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:41:13 @@ -183,8 +189,9 @@ LL | let _ = a == b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a.as_ptr(), b.as_ptr()); - | ++++++++++++++++++ ~~~~~~~~~~ ++++++++++ +LL - let _ = a == b; +LL + let _ = std::ptr::addr_eq(a.as_ptr(), b.as_ptr()); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:59:17 @@ -205,8 +212,9 @@ LL | let _ = &a == &b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a.as_ptr(), b.as_ptr()); - | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ++++++++++ +LL - let _ = &a == &b; +LL + let _ = std::ptr::addr_eq(a.as_ptr(), b.as_ptr()); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:70:17 @@ -216,8 +224,9 @@ LL | let _ = a == b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(*a, *b); - | +++++++++++++++++++ ~~~ + +LL - let _ = a == b; +LL + let _ = std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:72:17 @@ -227,8 +236,9 @@ LL | let _ = a != b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(*a, *b); - | ++++++++++++++++++++ ~~~ + +LL - let _ = a != b; +LL + let _ = !std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:74:17 @@ -282,8 +292,9 @@ LL | let _ = PartialEq::eq(a, b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(*a, *b); - | ~~~~~~~~~~~~~~~~~~~ ~~~ +LL - let _ = PartialEq::eq(a, b); +LL + let _ = std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:85:17 @@ -293,8 +304,9 @@ LL | let _ = PartialEq::ne(a, b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(*a, *b); - | ~~~~~~~~~~~~~~~~~~~~ ~~~ +LL - let _ = PartialEq::ne(a, b); +LL + let _ = !std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:87:17 @@ -304,8 +316,9 @@ LL | let _ = PartialEq::eq(&a, &b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(*a, *b); - | ~~~~~~~~~~~~~~~~~~~ ~~~ +LL - let _ = PartialEq::eq(&a, &b); +LL + let _ = std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:89:17 @@ -315,8 +328,9 @@ LL | let _ = PartialEq::ne(&a, &b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(*a, *b); - | ~~~~~~~~~~~~~~~~~~~~ ~~~ +LL - let _ = PartialEq::ne(&a, &b); +LL + let _ = !std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:91:17 @@ -326,8 +340,9 @@ LL | let _ = a.eq(b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(*a, *b); - | +++++++++++++++++++ ~~~ +LL - let _ = a.eq(b); +LL + let _ = std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:93:17 @@ -337,8 +352,9 @@ LL | let _ = a.ne(b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(*a, *b); - | ++++++++++++++++++++ ~~~ +LL - let _ = a.ne(b); +LL + let _ = !std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:95:17 @@ -414,12 +430,14 @@ LL | let _ = s == s; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(s, s); - | ++++++++++++++++++ ~ + +LL - let _ = s == s; +LL + let _ = std::ptr::addr_eq(s, s); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = std::ptr::eq(s, s); - | +++++++++++++ ~ + +LL - let _ = s == s; +LL + let _ = std::ptr::eq(s, s); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:114:13 @@ -429,12 +447,14 @@ LL | let _ = s == s; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(s, s); - | ++++++++++++++++++ ~ + +LL - let _ = s == s; +LL + let _ = std::ptr::addr_eq(s, s); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = std::ptr::eq(s, s); - | +++++++++++++ ~ + +LL - let _ = s == s; +LL + let _ = std::ptr::eq(s, s); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:118:17 @@ -444,12 +464,14 @@ LL | let _ = a == b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ++++++++++++++++++ ~ + +LL - let _ = a == b; +LL + let _ = std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = std::ptr::eq(a, b); - | +++++++++++++ ~ + +LL - let _ = a == b; +LL + let _ = std::ptr::eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:120:17 @@ -459,12 +481,14 @@ LL | let _ = a != b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(a, b); - | +++++++++++++++++++ ~ + +LL - let _ = a != b; +LL + let _ = !std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = !std::ptr::eq(a, b); - | ++++++++++++++ ~ + +LL - let _ = a != b; +LL + let _ = !std::ptr::eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:122:17 @@ -518,12 +542,14 @@ LL | let _ = PartialEq::eq(&a, &b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ~~~~~~~~~~~~~~~~~~ ~ +LL - let _ = PartialEq::eq(&a, &b); +LL + let _ = std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = std::ptr::eq(a, b); - | ~~~~~~~~~~~~~ ~ +LL - let _ = PartialEq::eq(&a, &b); +LL + let _ = std::ptr::eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:133:17 @@ -533,12 +559,14 @@ LL | let _ = PartialEq::ne(&a, &b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(a, b); - | ~~~~~~~~~~~~~~~~~~~ ~ +LL - let _ = PartialEq::ne(&a, &b); +LL + let _ = !std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = !std::ptr::eq(a, b); - | ~~~~~~~~~~~~~~ ~ +LL - let _ = PartialEq::ne(&a, &b); +LL + let _ = !std::ptr::eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:135:17 @@ -548,12 +576,14 @@ LL | let _ = a.eq(&b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ++++++++++++++++++ ~ +LL - let _ = a.eq(&b); +LL + let _ = std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = std::ptr::eq(a, b); - | +++++++++++++ ~ +LL - let _ = a.eq(&b); +LL + let _ = std::ptr::eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:137:17 @@ -563,12 +593,14 @@ LL | let _ = a.ne(&b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(a, b); - | +++++++++++++++++++ ~ +LL - let _ = a.ne(&b); +LL + let _ = !std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = !std::ptr::eq(a, b); - | ++++++++++++++ ~ +LL - let _ = a.ne(&b); +LL + let _ = !std::ptr::eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:142:9 @@ -578,12 +610,14 @@ LL | &*a == &*b | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | std::ptr::addr_eq(*a, *b) - | ~~~~~~~~~~~~~~~~~~ ~ + +LL - &*a == &*b +LL + std::ptr::addr_eq(*a, *b) + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | std::ptr::eq(*a, *b) - | ~~~~~~~~~~~~~ ~ + +LL - &*a == &*b +LL + std::ptr::eq(*a, *b) + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:153:14 @@ -608,8 +642,9 @@ LL | cmp!(a, b); = note: this warning originates in the macro `cmp` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | ($a:ident, $b:ident) => { std::ptr::addr_eq($a, $b) } - | ++++++++++++++++++ ~ + +LL - ($a:ident, $b:ident) => { $a == $b } +LL + ($a:ident, $b:ident) => { std::ptr::addr_eq($a, $b) } + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:169:37 diff --git a/tests/ui/liveness/liveness-unused.rs b/tests/ui/liveness/liveness-unused.rs index ba635e6638c..49e7044aeda 100644 --- a/tests/ui/liveness/liveness-unused.rs +++ b/tests/ui/liveness/liveness-unused.rs @@ -2,6 +2,7 @@ #![deny(unused_variables)] #![deny(unused_assignments)] #![allow(dead_code, non_camel_case_types, trivial_numeric_casts, dropping_copy_types)] +#![feature(intrinsics)] use std::ops::AddAssign; @@ -137,5 +138,10 @@ fn f7() { drop(a); } +// unused params warnings are not needed for intrinsic functions without bodies +#[rustc_intrinsic] +unsafe fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U; + + fn main() { } diff --git a/tests/ui/liveness/liveness-unused.stderr b/tests/ui/liveness/liveness-unused.stderr index f6c478ddbc7..a69fc10dff2 100644 --- a/tests/ui/liveness/liveness-unused.stderr +++ b/tests/ui/liveness/liveness-unused.stderr @@ -1,5 +1,5 @@ warning: unreachable statement - --> $DIR/liveness-unused.rs:92:9 + --> $DIR/liveness-unused.rs:93:9 | LL | continue; | -------- any code following this expression is unreachable @@ -14,7 +14,7 @@ LL | #![warn(unused)] = note: `#[warn(unreachable_code)]` implied by `#[warn(unused)]` error: unused variable: `x` - --> $DIR/liveness-unused.rs:8:7 + --> $DIR/liveness-unused.rs:9:7 | LL | fn f1(x: isize) { | ^ help: if this is intentional, prefix it with an underscore: `_x` @@ -26,25 +26,25 @@ LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ error: unused variable: `x` - --> $DIR/liveness-unused.rs:12:8 + --> $DIR/liveness-unused.rs:13:8 | LL | fn f1b(x: &mut isize) { | ^ help: if this is intentional, prefix it with an underscore: `_x` error: unused variable: `x` - --> $DIR/liveness-unused.rs:20:9 + --> $DIR/liveness-unused.rs:21:9 | LL | let x: isize; | ^ help: if this is intentional, prefix it with an underscore: `_x` error: unused variable: `x` - --> $DIR/liveness-unused.rs:25:9 + --> $DIR/liveness-unused.rs:26:9 | LL | let x = 3; | ^ help: if this is intentional, prefix it with an underscore: `_x` error: variable `x` is assigned to, but never used - --> $DIR/liveness-unused.rs:30:13 + --> $DIR/liveness-unused.rs:31:13 | LL | let mut x = 3; | ^ @@ -52,7 +52,7 @@ LL | let mut x = 3; = note: consider using `_x` instead error: value assigned to `x` is never read - --> $DIR/liveness-unused.rs:32:5 + --> $DIR/liveness-unused.rs:33:5 | LL | x += 4; | ^ @@ -65,7 +65,7 @@ LL | #![deny(unused_assignments)] | ^^^^^^^^^^^^^^^^^^ error: variable `z` is assigned to, but never used - --> $DIR/liveness-unused.rs:37:13 + --> $DIR/liveness-unused.rs:38:13 | LL | let mut z = 3; | ^ @@ -73,31 +73,31 @@ LL | let mut z = 3; = note: consider using `_z` instead error: unused variable: `i` - --> $DIR/liveness-unused.rs:59:12 + --> $DIR/liveness-unused.rs:60:12 | LL | Some(i) => { | ^ help: if this is intentional, prefix it with an underscore: `_i` error: unused variable: `x` - --> $DIR/liveness-unused.rs:79:9 + --> $DIR/liveness-unused.rs:80:9 | LL | for x in 1..10 { } | ^ help: if this is intentional, prefix it with an underscore: `_x` error: unused variable: `x` - --> $DIR/liveness-unused.rs:84:10 + --> $DIR/liveness-unused.rs:85:10 | LL | for (x, _) in [1, 2, 3].iter().enumerate() { } | ^ help: if this is intentional, prefix it with an underscore: `_x` error: unused variable: `x` - --> $DIR/liveness-unused.rs:89:13 + --> $DIR/liveness-unused.rs:90:13 | LL | for (_, x) in [1, 2, 3].iter().enumerate() { | ^ help: if this is intentional, prefix it with an underscore: `_x` error: variable `x` is assigned to, but never used - --> $DIR/liveness-unused.rs:112:9 + --> $DIR/liveness-unused.rs:113:9 | LL | let x; | ^ @@ -105,7 +105,7 @@ LL | let x; = note: consider using `_x` instead error: value assigned to `x` is never read - --> $DIR/liveness-unused.rs:116:9 + --> $DIR/liveness-unused.rs:117:9 | LL | x = 0; | ^ diff --git a/tests/ui/logging-only-prints-once.rs b/tests/ui/logging-only-prints-once.rs index 5377d5eeae2..bb8c29694b5 100644 --- a/tests/ui/logging-only-prints-once.rs +++ b/tests/ui/logging-only-prints-once.rs @@ -1,5 +1,4 @@ //@ run-pass -//@ ignore-windows //@ needs-threads use std::cell::Cell; diff --git a/tests/ui/loops/loop-break-value-no-repeat.stderr b/tests/ui/loops/loop-break-value-no-repeat.stderr index 946057d0543..918ea81a2ed 100644 --- a/tests/ui/loops/loop-break-value-no-repeat.stderr +++ b/tests/ui/loops/loop-break-value-no-repeat.stderr @@ -8,8 +8,9 @@ LL | break 22 | help: use `break` on its own without a value inside this `for` loop | -LL | break - | ~~~~~ +LL - break 22 +LL + break + | error: aborting due to 1 previous error diff --git a/tests/ui/loops/loop-break-value.stderr b/tests/ui/loops/loop-break-value.stderr index 0912bdbb221..3b9735510bd 100644 --- a/tests/ui/loops/loop-break-value.stderr +++ b/tests/ui/loops/loop-break-value.stderr @@ -46,12 +46,14 @@ LL | break (); | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break (); +LL + break; + | help: alternatively, you might have meant to use the available loop label | -LL | break 'while_loop; - | ~~~~~~~~~~~ +LL - break (); +LL + break 'while_loop; + | error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:34:13 @@ -64,8 +66,9 @@ LL | break 'while_loop 123; | help: use `break` on its own without a value inside this `while` loop | -LL | break 'while_loop; - | ~~~~~~~~~~~~~~~~~ +LL - break 'while_loop 123; +LL + break 'while_loop; + | error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:42:12 @@ -77,8 +80,9 @@ LL | if break () { | help: use `break` on its own without a value inside this `while` loop | -LL | if break { - | ~~~~~ +LL - if break () { +LL + if break { + | error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:47:9 @@ -90,8 +94,9 @@ LL | break None; | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break None; +LL + break; + | error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:53:13 @@ -104,8 +109,9 @@ LL | break 'while_let_loop "nope"; | help: use `break` on its own without a value inside this `while` loop | -LL | break 'while_let_loop; - | ~~~~~~~~~~~~~~~~~~~~~ +LL - break 'while_let_loop "nope"; +LL + break 'while_let_loop; + | error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value.rs:60:9 @@ -117,8 +123,9 @@ LL | break (); | help: use `break` on its own without a value inside this `for` loop | -LL | break; - | ~~~~~ +LL - break (); +LL + break; + | error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value.rs:61:9 @@ -131,8 +138,9 @@ LL | break [()]; | help: use `break` on its own without a value inside this `for` loop | -LL | break; - | ~~~~~ +LL - break [()]; +LL + break; + | error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value.rs:68:13 @@ -145,8 +153,9 @@ LL | break 'for_loop Some(17); | help: use `break` on its own without a value inside this `for` loop | -LL | break 'for_loop; - | ~~~~~~~~~~~~~~~ +LL - break 'for_loop Some(17); +LL + break 'for_loop; + | error[E0308]: mismatched types --> $DIR/loop-break-value.rs:4:31 diff --git a/tests/ui/lto/auxiliary/dwarf-mixed-versions-lto-aux.rs b/tests/ui/lto/auxiliary/dwarf-mixed-versions-lto-aux.rs new file mode 100644 index 00000000000..3c81127ee65 --- /dev/null +++ b/tests/ui/lto/auxiliary/dwarf-mixed-versions-lto-aux.rs @@ -0,0 +1,5 @@ +//@ compile-flags: -g --crate-type=rlib -Zdwarf-version=4 + +pub fn say_hi() { + println!("hello there") +} diff --git a/tests/ui/lto/dwarf-mixed-versions-lto.rs b/tests/ui/lto/dwarf-mixed-versions-lto.rs new file mode 100644 index 00000000000..14ef65a868e --- /dev/null +++ b/tests/ui/lto/dwarf-mixed-versions-lto.rs @@ -0,0 +1,15 @@ +// This test verifies that we do not produce a warning when performing LTO on a +// crate graph that contains a mix of different DWARF version settings. This +// matches Clang's behavior. + +//@ ignore-msvc Platform must use DWARF +//@ aux-build:dwarf-mixed-versions-lto-aux.rs +//@ compile-flags: -C lto -g -Zdwarf-version=5 +//@ no-prefer-dynamic +//@ build-pass + +extern crate dwarf_mixed_versions_lto_aux; + +fn main() { + dwarf_mixed_versions_lto_aux::say_hi(); +} diff --git a/tests/ui/lto/weak-works.rs b/tests/ui/lto/weak-works.rs index 00e10b97d60..1ff47ca602d 100644 --- a/tests/ui/lto/weak-works.rs +++ b/tests/ui/lto/weak-works.rs @@ -1,7 +1,8 @@ //@ run-pass //@ compile-flags: -C codegen-units=8 -Z thinlto -//@ ignore-windows +//@ ignore-i686-pc-windows-gnu +//@ ignore-x86_64-pc-windows-gnu #![feature(linkage)] diff --git a/tests/ui/issues/issue-40136.rs b/tests/ui/macros/const-expr-invocations-issue-40136.rs index d5ccebdc85d..d5ccebdc85d 100644 --- a/tests/ui/issues/issue-40136.rs +++ b/tests/ui/macros/const-expr-invocations-issue-40136.rs diff --git a/tests/ui/macros/expand-full-no-resolution.stderr b/tests/ui/macros/expand-full-no-resolution.stderr index df6f20332bf..b836ac51ad9 100644 --- a/tests/ui/macros/expand-full-no-resolution.stderr +++ b/tests/ui/macros/expand-full-no-resolution.stderr @@ -9,8 +9,9 @@ LL | format_args!(a!()); | help: the leading underscore in `_a` marks it as unused, consider renaming it to `a` | -LL | macro_rules! a { - | ~ +LL - macro_rules! _a { +LL + macro_rules! a { + | error: cannot find macro `a` in this scope --> $DIR/expand-full-no-resolution.rs:19:10 @@ -23,8 +24,9 @@ LL | env!(a!()); | help: the leading underscore in `_a` marks it as unused, consider renaming it to `a` | -LL | macro_rules! a { - | ~ +LL - macro_rules! _a { +LL + macro_rules! a { + | error: aborting due to 2 previous errors diff --git a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr index fe1fd4a26a0..a2c281d9c0a 100644 --- a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr +++ b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr @@ -14,7 +14,7 @@ LL | #![warn(edition_2024_expr_fragment_specifier)] help: to keep the existing behavior, use the `expr_2021` fragment specifier | LL | ($e:expr_2021) => { - | ~~~~~~~~~ + | +++++ warning: the `expr` fragment specifier will accept more expressions in the 2024 edition --> $DIR/expr_2021_cargo_fix_edition.rs:11:11 @@ -27,7 +27,7 @@ LL | ($($i:expr)*) => { }; help: to keep the existing behavior, use the `expr_2021` fragment specifier | LL | ($($i:expr_2021)*) => { }; - | ~~~~~~~~~ + | +++++ warning: 2 warnings emitted diff --git a/tests/ui/macros/format-foreign.stderr b/tests/ui/macros/format-foreign.stderr index 7971c2ab2b9..ccb6583615c 100644 --- a/tests/ui/macros/format-foreign.stderr +++ b/tests/ui/macros/format-foreign.stderr @@ -11,8 +11,9 @@ LL | println!("%.*3$s %s!\n", "Hello,", "World", 4); = note: printf formatting is not supported; see the documentation for `std::fmt` help: format specifiers use curly braces | -LL | println!("{:.2$} {}!\n", "Hello,", "World", 4); - | ~~~~~~ ~~ +LL - println!("%.*3$s %s!\n", "Hello,", "World", 4); +LL + println!("{:.2$} {}!\n", "Hello,", "World", 4); + | error: argument never used --> $DIR/format-foreign.rs:3:29 @@ -75,8 +76,9 @@ LL | println!("$1 $0 $$ $NAME", 1, 2, NAME=3); = note: shell formatting is not supported; see the documentation for `std::fmt` help: format specifiers use curly braces | -LL | println!("{1} {0} $$ {NAME}", 1, 2, NAME=3); - | ~~~ ~~~ ~~~~~~ +LL - println!("$1 $0 $$ $NAME", 1, 2, NAME=3); +LL + println!("{1} {0} $$ {NAME}", 1, 2, NAME=3); + | error: aborting due to 6 previous errors diff --git a/tests/ui/macros/issue-103529.stderr b/tests/ui/macros/issue-103529.stderr index 61e322afc77..985d9ace818 100644 --- a/tests/ui/macros/issue-103529.stderr +++ b/tests/ui/macros/issue-103529.stderr @@ -21,8 +21,9 @@ LL | m! { auto x } | help: write `let` instead of `auto` to introduce a new variable | -LL | m! { let x } - | ~~~ +LL - m! { auto x } +LL + m! { let x } + | error: invalid variable declaration --> $DIR/issue-103529.rs:10:6 @@ -32,8 +33,9 @@ LL | m! { var x } | help: write `let` instead of `var` to introduce a new variable | -LL | m! { let x } - | ~~~ +LL - m! { var x } +LL + m! { let x } + | error: aborting due to 4 previous errors diff --git a/tests/ui/macros/issue-109237.stderr b/tests/ui/macros/issue-109237.stderr index a335786df86..9d25420af25 100644 --- a/tests/ui/macros/issue-109237.stderr +++ b/tests/ui/macros/issue-109237.stderr @@ -11,8 +11,9 @@ LL | let _ = statement!(); = note: this error originates in the macro `statement` (in Nightly builds, run with -Z macro-backtrace for more info) help: surround the macro invocation with `{}` to interpret the expansion as a statement | -LL | let _ = { statement!(); }; - | ~~~~~~~~~~~~~~~~~ +LL - let _ = statement!(); +LL + let _ = { statement!(); }; + | error: aborting due to 1 previous error diff --git a/tests/ui/macros/issue-118786.stderr b/tests/ui/macros/issue-118786.stderr index 7fa5c2b83dd..af4cc9ad863 100644 --- a/tests/ui/macros/issue-118786.stderr +++ b/tests/ui/macros/issue-118786.stderr @@ -6,8 +6,9 @@ LL | make_macro!((meow)); | help: change the delimiters to curly braces | -LL | make_macro!({meow}); - | ~ ~ +LL - make_macro!((meow)); +LL + make_macro!({meow}); + | help: add a semicolon | LL | macro_rules! $macro_name; { diff --git a/tests/ui/macros/issue-99265.stderr b/tests/ui/macros/issue-99265.stderr index 9185dbff61e..a4200bf02cf 100644 --- a/tests/ui/macros/issue-99265.stderr +++ b/tests/ui/macros/issue-99265.stderr @@ -74,8 +74,9 @@ LL | println!("Hello {:1$}!", "x", width = 5); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {:width$}!", "x", width = 5); - | ~~~~~~ +LL - println!("Hello {:1$}!", "x", width = 5); +LL + println!("Hello {:width$}!", "x", width = 5); + | warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:23:33 @@ -100,8 +101,9 @@ LL | println!("Hello {:1$.2$}!", f = 0.02f32, width = 5, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {:1$.precision$}!", f = 0.02f32, width = 5, precision = 2); - | ~~~~~~~~~~ +LL - println!("Hello {:1$.2$}!", f = 0.02f32, width = 5, precision = 2); +LL + println!("Hello {:1$.precision$}!", f = 0.02f32, width = 5, precision = 2); + | warning: named argument `width` is not used by name --> $DIR/issue-99265.rs:23:46 @@ -113,8 +115,9 @@ LL | println!("Hello {:1$.2$}!", f = 0.02f32, width = 5, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {:width$.2$}!", f = 0.02f32, width = 5, precision = 2); - | ~~~~~~ +LL - println!("Hello {:1$.2$}!", f = 0.02f32, width = 5, precision = 2); +LL + println!("Hello {:width$.2$}!", f = 0.02f32, width = 5, precision = 2); + | warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:31:34 @@ -126,8 +129,9 @@ LL | println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {f:1$.2$}!", f = 0.02f32, width = 5, precision = 2); - | ~ +LL - println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); +LL + println!("Hello {f:1$.2$}!", f = 0.02f32, width = 5, precision = 2); + | warning: named argument `precision` is not used by name --> $DIR/issue-99265.rs:31:58 @@ -139,8 +143,9 @@ LL | println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {0:1$.precision$}!", f = 0.02f32, width = 5, precision = 2); - | ~~~~~~~~~~ +LL - println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); +LL + println!("Hello {0:1$.precision$}!", f = 0.02f32, width = 5, precision = 2); + | warning: named argument `width` is not used by name --> $DIR/issue-99265.rs:31:47 @@ -152,8 +157,9 @@ LL | println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {0:width$.2$}!", f = 0.02f32, width = 5, precision = 2); - | ~~~~~~ +LL - println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); +LL + println!("Hello {0:width$.2$}!", f = 0.02f32, width = 5, precision = 2); + | warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:49:9 @@ -166,8 +172,9 @@ LL | f = 0.02f32, | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {f:2$.3$} {4:5$.6$}! {1}", - | ~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {f:2$.3$} {4:5$.6$}! {1}", + | warning: named argument `precision` is not used by name --> $DIR/issue-99265.rs:54:9 @@ -180,8 +187,9 @@ LL | precision = 2, | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {1:2$.precision$} {4:5$.6$}! {1}", - | ~~~~~~~~~~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {1:2$.precision$} {4:5$.6$}! {1}", + | warning: named argument `width` is not used by name --> $DIR/issue-99265.rs:52:9 @@ -194,8 +202,9 @@ LL | width = 5, | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {1:width$.3$} {4:5$.6$}! {1}", - | ~~~~~~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {1:width$.3$} {4:5$.6$}! {1}", + | warning: named argument `g` is not used by name --> $DIR/issue-99265.rs:56:9 @@ -208,8 +217,9 @@ LL | g = 0.02f32, | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {1:2$.3$} {g:5$.6$}! {1}", - | ~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {1:2$.3$} {g:5$.6$}! {1}", + | warning: named argument `precision2` is not used by name --> $DIR/issue-99265.rs:60:9 @@ -222,8 +232,9 @@ LL | precision2 = 2 | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {1:2$.3$} {4:5$.precision2$}! {1}", - | ~~~~~~~~~~~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {1:2$.3$} {4:5$.precision2$}! {1}", + | warning: named argument `width2` is not used by name --> $DIR/issue-99265.rs:58:9 @@ -236,8 +247,9 @@ LL | width2 = 5, | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {1:2$.3$} {4:width2$.6$}! {1}", - | ~~~~~~~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {1:2$.3$} {4:width2$.6$}! {1}", + | warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:49:9 @@ -250,8 +262,9 @@ LL | f = 0.02f32, | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {1:2$.3$} {4:5$.6$}! {f}", - | ~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {1:2$.3$} {4:5$.6$}! {f}", + | warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:64:31 @@ -276,8 +289,9 @@ LL | println!("Hello {0:0.1}!", f = 0.02f32); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {f:0.1}!", f = 0.02f32); - | ~ +LL - println!("Hello {0:0.1}!", f = 0.02f32); +LL + println!("Hello {f:0.1}!", f = 0.02f32); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:79:23 @@ -302,8 +316,9 @@ LL | println!("{:0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{:v$}", v = val); - | ~~ +LL - println!("{:0$}", v = val); +LL + println!("{:v$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:84:24 @@ -315,8 +330,9 @@ LL | println!("{0:0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{v:0$}", v = val); - | ~ +LL - println!("{0:0$}", v = val); +LL + println!("{v:0$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:84:24 @@ -328,8 +344,9 @@ LL | println!("{0:0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{0:v$}", v = val); - | ~~ +LL - println!("{0:0$}", v = val); +LL + println!("{0:v$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:89:26 @@ -354,8 +371,9 @@ LL | println!("{:0$.0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{:0$.v$}", v = val); - | ~~ +LL - println!("{:0$.0$}", v = val); +LL + println!("{:0$.v$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:89:26 @@ -367,8 +385,9 @@ LL | println!("{:0$.0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{:v$.0$}", v = val); - | ~~ +LL - println!("{:0$.0$}", v = val); +LL + println!("{:v$.0$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:96:27 @@ -380,8 +399,9 @@ LL | println!("{0:0$.0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{v:0$.0$}", v = val); - | ~ +LL - println!("{0:0$.0$}", v = val); +LL + println!("{v:0$.0$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:96:27 @@ -393,8 +413,9 @@ LL | println!("{0:0$.0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{0:0$.v$}", v = val); - | ~~ +LL - println!("{0:0$.0$}", v = val); +LL + println!("{0:0$.v$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:96:27 @@ -406,8 +427,9 @@ LL | println!("{0:0$.0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{0:v$.0$}", v = val); - | ~~ +LL - println!("{0:0$.0$}", v = val); +LL + println!("{0:v$.0$}", v = val); + | warning: named argument `a` is not used by name --> $DIR/issue-99265.rs:104:28 @@ -432,8 +454,9 @@ LL | println!("{} {a} {0}", a = 1); | help: use the named argument by name to avoid ambiguity | -LL | println!("{} {a} {a}", a = 1); - | ~ +LL - println!("{} {a} {0}", a = 1); +LL + println!("{} {a} {a}", a = 1); + | warning: named argument `a` is not used by name --> $DIR/issue-99265.rs:115:14 @@ -460,8 +483,9 @@ LL | a = 1.0, b = 1, c = 2, | help: use the named argument by name to avoid ambiguity | -LL | {:1$.c$}", - | ~~ +LL - {:1$.2$}", +LL + {:1$.c$}", + | warning: named argument `b` is not used by name --> $DIR/issue-99265.rs:115:23 @@ -474,8 +498,9 @@ LL | a = 1.0, b = 1, c = 2, | help: use the named argument by name to avoid ambiguity | -LL | {:b$.2$}", - | ~~ +LL - {:1$.2$}", +LL + {:b$.2$}", + | warning: named argument `a` is not used by name --> $DIR/issue-99265.rs:126:14 @@ -488,8 +513,9 @@ LL | a = 1.0, b = 1, c = 2, | help: use the named argument by name to avoid ambiguity | -LL | {a:1$.2$}", - | ~ +LL - {0:1$.2$}", +LL + {a:1$.2$}", + | warning: named argument `c` is not used by name --> $DIR/issue-99265.rs:126:30 @@ -502,8 +528,9 @@ LL | a = 1.0, b = 1, c = 2, | help: use the named argument by name to avoid ambiguity | -LL | {0:1$.c$}", - | ~~ +LL - {0:1$.2$}", +LL + {0:1$.c$}", + | warning: named argument `b` is not used by name --> $DIR/issue-99265.rs:126:23 @@ -516,8 +543,9 @@ LL | a = 1.0, b = 1, c = 2, | help: use the named argument by name to avoid ambiguity | -LL | {0:b$.2$}", - | ~~ +LL - {0:1$.2$}", +LL + {0:b$.2$}", + | warning: named argument `x` is not used by name --> $DIR/issue-99265.rs:132:30 @@ -542,8 +570,9 @@ LL | println!("{{{:1$.2$}}}", x = 1.0, width = 3, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("{{{:1$.precision$}}}", x = 1.0, width = 3, precision = 2); - | ~~~~~~~~~~ +LL - println!("{{{:1$.2$}}}", x = 1.0, width = 3, precision = 2); +LL + println!("{{{:1$.precision$}}}", x = 1.0, width = 3, precision = 2); + | warning: named argument `width` is not used by name --> $DIR/issue-99265.rs:132:39 @@ -555,8 +584,9 @@ LL | println!("{{{:1$.2$}}}", x = 1.0, width = 3, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("{{{:width$.2$}}}", x = 1.0, width = 3, precision = 2); - | ~~~~~~ +LL - println!("{{{:1$.2$}}}", x = 1.0, width = 3, precision = 2); +LL + println!("{{{:width$.2$}}}", x = 1.0, width = 3, precision = 2); + | warning: 42 warnings emitted diff --git a/tests/ui/macros/macro-backtrace-invalid-internals.stderr b/tests/ui/macros/macro-backtrace-invalid-internals.stderr index aa8f06a0df1..836098bd9c0 100644 --- a/tests/ui/macros/macro-backtrace-invalid-internals.stderr +++ b/tests/ui/macros/macro-backtrace-invalid-internals.stderr @@ -44,7 +44,7 @@ LL | real_method_stmt!(); help: you must specify a concrete type for this numeric value, like `f32` | LL | 2.0_f32.neg() - | ~~~~~~~ + | ++++ error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:23:13 @@ -92,7 +92,7 @@ LL | let _ = real_method_expr!(); help: you must specify a concrete type for this numeric value, like `f32` | LL | 2.0_f32.neg() - | ~~~~~~~ + | ++++ error: aborting due to 8 previous errors diff --git a/tests/ui/macros/macro-inner-attributes.stderr b/tests/ui/macros/macro-inner-attributes.stderr index 947e33b08f4..d74b64db5ac 100644 --- a/tests/ui/macros/macro-inner-attributes.stderr +++ b/tests/ui/macros/macro-inner-attributes.stderr @@ -6,8 +6,9 @@ LL | a::bar(); | help: there is a crate or module with a similar name | -LL | b::bar(); - | ~ +LL - a::bar(); +LL + b::bar(); + | error: aborting due to 1 previous error diff --git a/tests/ui/macros/macro-use-wrong-name.stderr b/tests/ui/macros/macro-use-wrong-name.stderr index 89345866be8..c7f214db225 100644 --- a/tests/ui/macros/macro-use-wrong-name.stderr +++ b/tests/ui/macros/macro-use-wrong-name.stderr @@ -11,8 +11,9 @@ LL | macro_rules! macro_one { () => ("one") } | help: a macro with a similar name exists | -LL | macro_one!(); - | ~~~~~~~~~ +LL - macro_two!(); +LL + macro_one!(); + | help: consider importing this macro | LL + use two_macros::macro_two; diff --git a/tests/ui/issues/issue-40845.rs b/tests/ui/macros/macros-in-trait-positions-issue-40845.rs index a4ede6adfa3..a4ede6adfa3 100644 --- a/tests/ui/issues/issue-40845.rs +++ b/tests/ui/macros/macros-in-trait-positions-issue-40845.rs diff --git a/tests/ui/issues/issue-40845.stderr b/tests/ui/macros/macros-in-trait-positions-issue-40845.stderr index 66bf053204c..5c1b5f51e44 100644 --- a/tests/ui/issues/issue-40845.stderr +++ b/tests/ui/macros/macros-in-trait-positions-issue-40845.stderr @@ -1,11 +1,11 @@ error: cannot find macro `m` in this scope - --> $DIR/issue-40845.rs:1:11 + --> $DIR/macros-in-trait-positions-issue-40845.rs:1:11 | LL | trait T { m!(); } | ^ error: cannot find macro `m` in this scope - --> $DIR/issue-40845.rs:4:10 + --> $DIR/macros-in-trait-positions-issue-40845.rs:4:10 | LL | impl S { m!(); } | ^ diff --git a/tests/ui/macros/recovery-allowed.stderr b/tests/ui/macros/recovery-allowed.stderr index 825f7a8faf8..00bc65ed914 100644 --- a/tests/ui/macros/recovery-allowed.stderr +++ b/tests/ui/macros/recovery-allowed.stderr @@ -6,8 +6,9 @@ LL | please_recover! { not 1 } | help: use `!` to perform bitwise not | -LL | please_recover! { !1 } - | ~ +LL - please_recover! { not 1 } +LL + please_recover! { !1 } + | error: aborting due to 1 previous error diff --git a/tests/ui/macros/syntax-extension-source-utils.rs b/tests/ui/macros/syntax-extension-source-utils.rs index a16ebdc7504..2f88e508058 100644 --- a/tests/ui/macros/syntax-extension-source-utils.rs +++ b/tests/ui/macros/syntax-extension-source-utils.rs @@ -16,7 +16,7 @@ pub fn main() { assert_eq!(line!(), 16); assert_eq!(column!(), 16); assert_eq!(indirect_line!(), 18); - assert!((file!().ends_with("syntax-extension-source-utils.rs"))); + assert!(file!().ends_with("syntax-extension-source-utils.rs")); assert_eq!(stringify!((2*3) + 5).to_string(), "(2*3) + 5".to_string()); assert!(include!("syntax-extension-source-utils-files/includeme.\ fragment").to_string() @@ -30,7 +30,7 @@ pub fn main() { include_bytes!("syntax-extension-source-utils-files/includeme.fragment") [1] == (42 as u8)); // '*' // The Windows tests are wrapped in an extra module for some reason - assert!((m1::m2::where_am_i().ends_with("m1::m2"))); + assert!(m1::m2::where_am_i().ends_with("m1::m2")); assert_eq!((35, "(2*3) + 5"), (line!(), stringify!((2*3) + 5))); } diff --git a/tests/ui/malformed/malformed-meta-delim.stderr b/tests/ui/malformed/malformed-meta-delim.stderr index 27636c3d546..3f2357c435f 100644 --- a/tests/ui/malformed/malformed-meta-delim.stderr +++ b/tests/ui/malformed/malformed-meta-delim.stderr @@ -6,8 +6,9 @@ LL | #[allow { foo_lint } ] | help: the delimiters should be `(` and `)` | -LL | #[allow ( foo_lint ) ] - | ~ ~ +LL - #[allow { foo_lint } ] +LL + #[allow ( foo_lint ) ] + | error: wrong meta list delimiters --> $DIR/malformed-meta-delim.rs:8:9 @@ -17,8 +18,9 @@ LL | #[allow [ foo_lint ] ] | help: the delimiters should be `(` and `)` | -LL | #[allow ( foo_lint ) ] - | ~ ~ +LL - #[allow [ foo_lint ] ] +LL + #[allow ( foo_lint ) ] + | error: aborting due to 2 previous errors diff --git a/tests/ui/malformed/malformed-special-attrs.stderr b/tests/ui/malformed/malformed-special-attrs.stderr index 8f2ce20593f..a6220710cf9 100644 --- a/tests/ui/malformed/malformed-special-attrs.stderr +++ b/tests/ui/malformed/malformed-special-attrs.stderr @@ -7,8 +7,9 @@ LL | #[cfg_attr] = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> help: missing condition and attribute | -LL | #[cfg_attr(condition, attribute, other_attribute, ...)] - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - #[cfg_attr] +LL + #[cfg_attr(condition, attribute, other_attribute, ...)] + | error: malformed `cfg_attr` attribute input --> $DIR/malformed-special-attrs.rs:4:1 @@ -19,8 +20,9 @@ LL | #[cfg_attr = ""] = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute> help: missing condition and attribute | -LL | #[cfg_attr(condition, attribute, other_attribute, ...)] - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - #[cfg_attr = ""] +LL + #[cfg_attr(condition, attribute, other_attribute, ...)] + | error: malformed `derive` attribute input --> $DIR/malformed-special-attrs.rs:7:1 diff --git a/tests/ui/issues/issue-41213.rs b/tests/ui/match/enum-and-break-in-match-issue-41213.rs index 97f80a99a83..7c42a3629c9 100644 --- a/tests/ui/issues/issue-41213.rs +++ b/tests/ui/match/enum-and-break-in-match-issue-41213.rs @@ -1,4 +1,4 @@ -//@ run-pass +//@ check-pass #![allow(dead_code)] enum A { A1, diff --git a/tests/ui/match/issue-56685.stderr b/tests/ui/match/issue-56685.stderr index ccf357d4aa0..6a1d152ed5b 100644 --- a/tests/ui/match/issue-56685.stderr +++ b/tests/ui/match/issue-56685.stderr @@ -12,7 +12,7 @@ LL | #![deny(unused_variables)] help: if this is intentional, prefix it with an underscore | LL | E::A(_x) | E::B(_x) => {} - | ~~ ~~ + | + + error: unused variable: `x` --> $DIR/issue-56685.rs:25:14 @@ -23,7 +23,7 @@ LL | F::A(x, y) | F::B(x, y) => { y }, help: if this is intentional, prefix it with an underscore | LL | F::A(_x, y) | F::B(_x, y) => { y }, - | ~~ ~~ + | + + error: unused variable: `a` --> $DIR/issue-56685.rs:27:14 @@ -46,7 +46,7 @@ LL | let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { help: if this is intentional, prefix it with an underscore | LL | let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | ~~ ~~ + | + + error: unused variable: `x` --> $DIR/issue-56685.rs:39:20 @@ -57,7 +57,7 @@ LL | while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { help: if this is intentional, prefix it with an underscore | LL | while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | ~~ ~~ + | + + error: aborting due to 6 previous errors diff --git a/tests/ui/match/match-pattern-field-mismatch.stderr b/tests/ui/match/match-pattern-field-mismatch.stderr index cde7ac972ca..ea5f6f0f22b 100644 --- a/tests/ui/match/match-pattern-field-mismatch.stderr +++ b/tests/ui/match/match-pattern-field-mismatch.stderr @@ -13,8 +13,9 @@ LL | Color::Rgb(_, _, _) => { } | +++ help: use `..` to ignore all fields | -LL | Color::Rgb(..) => { } - | ~~ +LL - Color::Rgb(_, _) => { } +LL + Color::Rgb(..) => { } + | error: aborting due to 1 previous error diff --git a/tests/ui/meta/expected-error-correct-rev.a.stderr b/tests/ui/meta/expected-error-correct-rev.a.stderr index d5b7603d346..ae8dd86d360 100644 --- a/tests/ui/meta/expected-error-correct-rev.a.stderr +++ b/tests/ui/meta/expected-error-correct-rev.a.stderr @@ -8,8 +8,9 @@ LL | let x: u32 = 22_usize; | help: change the type of the numeric literal from `usize` to `u32` | -LL | let x: u32 = 22_u32; - | ~~~ +LL - let x: u32 = 22_usize; +LL + let x: u32 = 22_u32; + | error: aborting due to 1 previous error diff --git a/tests/ui/meta/meta-expected-error-wrong-rev.a.stderr b/tests/ui/meta/meta-expected-error-wrong-rev.a.stderr index a489040f32d..48fea28024f 100644 --- a/tests/ui/meta/meta-expected-error-wrong-rev.a.stderr +++ b/tests/ui/meta/meta-expected-error-wrong-rev.a.stderr @@ -8,8 +8,9 @@ LL | let x: u32 = 22_usize; | help: change the type of the numeric literal from `usize` to `u32` | -LL | let x: u32 = 22_u32; - | ~~~ +LL - let x: u32 = 22_usize; +LL + let x: u32 = 22_u32; + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/disambiguate-associated-function-first-arg.stderr b/tests/ui/methods/disambiguate-associated-function-first-arg.stderr index 341b7a91003..381e29667c8 100644 --- a/tests/ui/methods/disambiguate-associated-function-first-arg.stderr +++ b/tests/ui/methods/disambiguate-associated-function-first-arg.stderr @@ -25,16 +25,19 @@ LL | fn new(_a: Self, _b: i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function for candidate #1 | -LL | <A as M>::new(1); - | ~~~~~~~~~~~~~~~~ +LL - _a.new(1); +LL + <A as M>::new(1); + | help: disambiguate the associated function for candidate #2 | -LL | <A as N>::new(_a, 1); - | ~~~~~~~~~~~~~~~~~~~~ +LL - _a.new(1); +LL + <A as N>::new(_a, 1); + | help: disambiguate the associated function for candidate #3 | -LL | <A as O>::new(_a, 1); - | ~~~~~~~~~~~~~~~~~~~~ +LL - _a.new(1); +LL + <A as O>::new(_a, 1); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-associated-function-first-arg.rs:47:7 @@ -54,12 +57,14 @@ LL | fn f(self) {} | ^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | TraitA::f(S); - | ~~~~~~~~~~~~ +LL - S.f(); +LL + TraitA::f(S); + | help: disambiguate the method for candidate #2 | -LL | TraitB::f(S); - | ~~~~~~~~~~~~ +LL - S.f(); +LL + TraitB::f(S); + | error: aborting due to 2 previous errors diff --git a/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr b/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr index ccdd9a95451..1b81dc5aafb 100644 --- a/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr +++ b/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr @@ -6,10 +6,12 @@ LL | let _: S::Type; | help: use fully-qualified syntax | -LL | let _: <S as A>::Type; - | ~~~~~~~~~~~~~~ -LL | let _: <S as B>::Type; - | ~~~~~~~~~~~~~~ +LL - let _: S::Type; +LL + let _: <S as A>::Type; + | +LL - let _: S::Type; +LL + let _: <S as B>::Type; + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-blanket-impl.rs:30:8 @@ -29,10 +31,12 @@ LL | fn foo(&self) {} | ^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | A::foo(&s); - | ~~~ -LL | B::foo(&s); - | ~~~ +LL - S::foo(&s); +LL + A::foo(&s); + | +LL - S::foo(&s); +LL + B::foo(&s); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-blanket-impl.rs:33:8 @@ -52,10 +56,12 @@ LL | const CONST: usize = 2; | ^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | <S as A>::CONST; - | ~~~~~~~~~~ -LL | <S as B>::CONST; - | ~~~~~~~~~~ +LL - S::CONST; +LL + <S as A>::CONST; + | +LL - S::CONST; +LL + <S as B>::CONST; + | error: aborting due to 3 previous errors diff --git a/tests/ui/methods/disambiguate-multiple-impl.stderr b/tests/ui/methods/disambiguate-multiple-impl.stderr index 4172120770c..2563c2327b7 100644 --- a/tests/ui/methods/disambiguate-multiple-impl.stderr +++ b/tests/ui/methods/disambiguate-multiple-impl.stderr @@ -6,10 +6,12 @@ LL | let _: S::Type = (); | help: use fully-qualified syntax | -LL | let _: <S as A>::Type = (); - | ~~~~~~~~~~~~~~ -LL | let _: <S as B>::Type = (); - | ~~~~~~~~~~~~~~ +LL - let _: S::Type = (); +LL + let _: <S as A>::Type = (); + | +LL - let _: S::Type = (); +LL + let _: <S as B>::Type = (); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-impl.rs:29:8 @@ -29,10 +31,12 @@ LL | fn foo(&self) {} | ^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | A::foo(&s); - | ~~~ -LL | B::foo(&s); - | ~~~ +LL - S::foo(&s); +LL + A::foo(&s); + | +LL - S::foo(&s); +LL + B::foo(&s); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-impl.rs:34:16 @@ -52,10 +56,12 @@ LL | const CONST: usize = 2; | ^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | let _ = <S as A>::CONST; - | ~~~~~~~~~~ -LL | let _ = <S as B>::CONST; - | ~~~~~~~~~~ +LL - let _ = S::CONST; +LL + let _ = <S as A>::CONST; + | +LL - let _ = S::CONST; +LL + let _ = <S as B>::CONST; + | error: aborting due to 3 previous errors diff --git a/tests/ui/methods/disambiguate-multiple-trait-2.stderr b/tests/ui/methods/disambiguate-multiple-trait-2.stderr index 2778f254a56..08e264c20c8 100644 --- a/tests/ui/methods/disambiguate-multiple-trait-2.stderr +++ b/tests/ui/methods/disambiguate-multiple-trait-2.stderr @@ -12,12 +12,14 @@ LL | let _: T::Type; | help: use fully-qualified syntax to disambiguate | -LL | let _: <T as A>::Type; - | ~~~~~~~~~~ +LL - let _: T::Type; +LL + let _: <T as A>::Type; + | help: use fully-qualified syntax to disambiguate | -LL | let _: <T as B>::Type; - | ~~~~~~~~~~ +LL - let _: T::Type; +LL + let _: <T as B>::Type; + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-trait-2.rs:16:7 @@ -37,12 +39,14 @@ LL | fn foo(&self); | ^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | A::foo(&t); - | ~~~~~~~~~~ +LL - t.foo(); +LL + A::foo(&t); + | help: disambiguate the method for candidate #2 | -LL | B::foo(&t); - | ~~~~~~~~~~ +LL - t.foo(); +LL + B::foo(&t); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-trait-2.rs:20:16 @@ -62,10 +66,12 @@ LL | const CONST: usize; | ^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | let _ = <T as A>::CONST; - | ~~~~~~~~~~ -LL | let _ = <T as B>::CONST; - | ~~~~~~~~~~ +LL - let _ = T::CONST; +LL + let _ = <T as A>::CONST; + | +LL - let _ = T::CONST; +LL + let _ = <T as B>::CONST; + | error[E0223]: ambiguous associated type --> $DIR/disambiguate-multiple-trait-2.rs:52:12 @@ -75,10 +81,12 @@ LL | let _: S::Type; | help: use fully-qualified syntax | -LL | let _: <S as A>::Type; - | ~~~~~~~~~~~~~~ -LL | let _: <S as B>::Type; - | ~~~~~~~~~~~~~~ +LL - let _: S::Type; +LL + let _: <S as A>::Type; + | +LL - let _: S::Type; +LL + let _: <S as B>::Type; + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-trait-2.rs:46:8 @@ -98,10 +106,12 @@ LL | fn foo(&self) {} | ^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | A::foo(&s); - | ~~~ -LL | B::foo(&s); - | ~~~ +LL - S::foo(&s); +LL + A::foo(&s); + | +LL - S::foo(&s); +LL + B::foo(&s); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-trait-2.rs:49:16 @@ -121,10 +131,12 @@ LL | const CONST: usize = 1; | ^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | let _ = <S as A>::CONST; - | ~~~~~~~~~~ -LL | let _ = <S as B>::CONST; - | ~~~~~~~~~~ +LL - let _ = S::CONST; +LL + let _ = <S as A>::CONST; + | +LL - let _ = S::CONST; +LL + let _ = <S as B>::CONST; + | error: aborting due to 6 previous errors diff --git a/tests/ui/methods/disambiguate-multiple-trait.stderr b/tests/ui/methods/disambiguate-multiple-trait.stderr index e00498ca62b..a977fe2cd03 100644 --- a/tests/ui/methods/disambiguate-multiple-trait.stderr +++ b/tests/ui/methods/disambiguate-multiple-trait.stderr @@ -6,10 +6,12 @@ LL | let _: S::Type; | help: use fully-qualified syntax | -LL | let _: <S as A>::Type; - | ~~~~~~~~~~~~~~ -LL | let _: <S as B>::Type; - | ~~~~~~~~~~~~~~ +LL - let _: S::Type; +LL + let _: <S as A>::Type; + | +LL - let _: S::Type; +LL + let _: <S as B>::Type; + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-trait.rs:24:8 @@ -29,10 +31,12 @@ LL | fn foo(&self) {} | ^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | A::foo(&s); - | ~~~ -LL | B::foo(&s); - | ~~~ +LL - S::foo(&s); +LL + A::foo(&s); + | +LL - S::foo(&s); +LL + B::foo(&s); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-trait.rs:27:16 @@ -52,10 +56,12 @@ LL | const CONST: usize = 2; | ^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | let _ = <S as A>::CONST; - | ~~~~~~~~~~ -LL | let _ = <S as B>::CONST; - | ~~~~~~~~~~ +LL - let _ = S::CONST; +LL + let _ = <S as A>::CONST; + | +LL - let _ = S::CONST; +LL + let _ = <S as B>::CONST; + | error: aborting due to 3 previous errors diff --git a/tests/ui/methods/inherent-bound-in-probe.stderr b/tests/ui/methods/inherent-bound-in-probe.stderr index 8d7cc462280..433ef02a2aa 100644 --- a/tests/ui/methods/inherent-bound-in-probe.stderr +++ b/tests/ui/methods/inherent-bound-in-probe.stderr @@ -9,10 +9,10 @@ note: required by a bound in `std::iter::IntoIterator::IntoIter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL error[E0275]: overflow evaluating the requirement `&_: IntoIterator` - --> $DIR/inherent-bound-in-probe.rs:44:17 + --> $DIR/inherent-bound-in-probe.rs:44:9 | LL | Helper::new(&self.0) - | ^^^ + | ^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inherent_bound_in_probe`) note: required for `&BitReaderWrapper<_>` to implement `IntoIterator` @@ -25,11 +25,14 @@ LL | &'a T: IntoIterator<Item = &'a u8>, | ------------- unsatisfied trait bound introduced here = note: 126 redundant requirements hidden = note: required for `&BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<BitReaderWrapper<_>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` to implement `IntoIterator` -note: required by a bound in `Helper<'a, T>` - --> $DIR/inherent-bound-in-probe.rs:25:25 +note: required by a bound in `Helper` + --> $DIR/inherent-bound-in-probe.rs:18:12 | +LL | struct Helper<'a, T> + | ------ required by a bound in this struct +LL | where LL | &'a T: IntoIterator<Item = &'a u8>, - | ^^^^^^^^^^^^^ required by this bound in `Helper<'a, T>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Helper` error: aborting due to 2 previous errors diff --git a/tests/ui/methods/issues/issue-105732.stderr b/tests/ui/methods/issues/issue-105732.stderr index a4924b3e663..6244f983550 100644 --- a/tests/ui/methods/issues/issue-105732.stderr +++ b/tests/ui/methods/issues/issue-105732.stderr @@ -14,8 +14,9 @@ LL | self.g(); | help: there is a method `f` with a similar name | -LL | self.f(); - | ~ +LL - self.g(); +LL + self.f(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/methods/issues/issue-61525.stderr b/tests/ui/methods/issues/issue-61525.stderr index 35001ae22a6..7ac3d3dc0cf 100644 --- a/tests/ui/methods/issues/issue-61525.stderr +++ b/tests/ui/methods/issues/issue-61525.stderr @@ -32,7 +32,7 @@ note: method defined here --> $DIR/issue-61525.rs:2:8 | LL | fn query<Q>(self, q: Q); - | ^^^^^ + | ^^^^^ - error: aborting due to 2 previous errors diff --git a/tests/ui/methods/issues/issue-90315.stderr b/tests/ui/methods/issues/issue-90315.stderr index 0466bb0a0c9..e495701a3d7 100644 --- a/tests/ui/methods/issues/issue-90315.stderr +++ b/tests/ui/methods/issues/issue-90315.stderr @@ -182,7 +182,7 @@ LL | let _res: i32 = ..6.take(2).sum(); help: you must specify a concrete type for this numeric value, like `i32` | LL | let _res: i32 = ..6_i32.take(2).sum(); - | ~~~~~ + | ++++ error: aborting due to 18 previous errors diff --git a/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr index b2d2d039ff6..a5f1b76702f 100644 --- a/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr +++ b/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr @@ -25,8 +25,9 @@ LL | impl Foo for Vec<isize> { | ^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Vec<T> as Foo>::foo(&x); - | ++++++++++++++++++++++ ~ +LL - x.foo(); +LL + <Vec<T> as Foo>::foo(&x); + | error[E0308]: mismatched types --> $DIR/method-ambig-one-trait-unknown-int-type.rs:33:20 diff --git a/tests/ui/methods/method-ambig-two-traits-cross-crate.stderr b/tests/ui/methods/method-ambig-two-traits-cross-crate.stderr index 0fc0c909ea8..707c33c3d94 100644 --- a/tests/ui/methods/method-ambig-two-traits-cross-crate.stderr +++ b/tests/ui/methods/method-ambig-two-traits-cross-crate.stderr @@ -12,12 +12,14 @@ LL | impl Me2 for usize { fn me(&self) -> usize { *self } } = note: candidate #2 is defined in an impl of the trait `Me` for the type `usize` help: disambiguate the method for candidate #1 | -LL | fn main() { Me2::me(&1_usize); } - | ~~~~~~~~~~~~~~~~~ +LL - fn main() { 1_usize.me(); } +LL + fn main() { Me2::me(&1_usize); } + | help: disambiguate the method for candidate #2 | -LL | fn main() { Me::me(&1_usize); } - | ~~~~~~~~~~~~~~~~ +LL - fn main() { 1_usize.me(); } +LL + fn main() { Me::me(&1_usize); } + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr b/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr index 690f979fa37..f3aa1582398 100644 --- a/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr +++ b/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr @@ -16,12 +16,14 @@ LL | trait B { fn foo(&self); } | ^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | A::foo(&t); - | ~~~~~~~~~~ +LL - t.foo(); +LL + A::foo(&t); + | help: disambiguate the method for candidate #2 | -LL | B::foo(&t); - | ~~~~~~~~~~ +LL - t.foo(); +LL + B::foo(&t); + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-ambig-two-traits-from-impls.stderr b/tests/ui/methods/method-ambig-two-traits-from-impls.stderr index 8be6d6d64f7..d1c50e8b3d0 100644 --- a/tests/ui/methods/method-ambig-two-traits-from-impls.stderr +++ b/tests/ui/methods/method-ambig-two-traits-from-impls.stderr @@ -16,12 +16,14 @@ LL | fn foo(self) {} | ^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | A::foo(AB {}); - | ~~~~~~~~~~~~~ +LL - AB {}.foo(); +LL + A::foo(AB {}); + | help: disambiguate the method for candidate #2 | -LL | B::foo(AB {}); - | ~~~~~~~~~~~~~ +LL - AB {}.foo(); +LL + B::foo(AB {}); + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr b/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr index 333520847f8..788f1a4c4b3 100644 --- a/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr +++ b/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr @@ -16,10 +16,12 @@ LL | fn foo() {} | ^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | <AB as A>::foo(); - | ~~~~~~~~~~~ -LL | <AB as B>::foo(); - | ~~~~~~~~~~~ +LL - AB::foo(); +LL + <AB as A>::foo(); + | +LL - AB::foo(); +LL + <AB as B>::foo(); + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-ambig-two-traits-with-default-method.stderr b/tests/ui/methods/method-ambig-two-traits-with-default-method.stderr index b36ef77fb7e..605c2a85b07 100644 --- a/tests/ui/methods/method-ambig-two-traits-with-default-method.stderr +++ b/tests/ui/methods/method-ambig-two-traits-with-default-method.stderr @@ -16,12 +16,14 @@ LL | trait Foo { fn method(&self) {} } | ^^^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | Bar::method(&1_usize); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - 1_usize.method(); +LL + Bar::method(&1_usize); + | help: disambiguate the method for candidate #2 | -LL | Foo::method(&1_usize); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - 1_usize.method(); +LL + Foo::method(&1_usize); + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-ambiguity-no-rcvr.stderr b/tests/ui/methods/method-ambiguity-no-rcvr.stderr index 3b6eb07393a..c1a77a99739 100644 --- a/tests/ui/methods/method-ambiguity-no-rcvr.stderr +++ b/tests/ui/methods/method-ambiguity-no-rcvr.stderr @@ -20,12 +20,14 @@ LL | fn foo() {} | ^^^^^^^^ help: disambiguate the associated function for candidate #1 | -LL | <Qux as Foo>::foo(); - | ~~~~~~~~~~~~~~~~~~~ +LL - Qux.foo(); +LL + <Qux as Foo>::foo(); + | help: disambiguate the associated function for candidate #2 | -LL | <Qux as FooBar>::foo(); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - Qux.foo(); +LL + <Qux as FooBar>::foo(); + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-call-err-msg.stderr b/tests/ui/methods/method-call-err-msg.stderr index 84005119a87..7cda928aca9 100644 --- a/tests/ui/methods/method-call-err-msg.stderr +++ b/tests/ui/methods/method-call-err-msg.stderr @@ -28,8 +28,9 @@ LL | fn one(self, _: isize) -> Foo { self } | ^^^ -------- help: provide the argument | -LL | .one(/* isize */) - | ~~~~~~~~~~~~~ +LL - .one() +LL + .one(/* isize */) + | error[E0061]: this method takes 2 arguments but 1 argument was supplied --> $DIR/method-call-err-msg.rs:15:7 @@ -41,11 +42,12 @@ note: method defined here --> $DIR/method-call-err-msg.rs:7:8 | LL | fn two(self, _: isize, _: isize) -> Foo { self } - | ^^^ -------- -------- + | ^^^ -------- help: provide the argument | -LL | .two(0, /* isize */); - | ~~~~~~~~~~~~~~~~ +LL - .two(0); +LL + .two(0, /* isize */); + | error[E0599]: `Foo` is not an iterator --> $DIR/method-call-err-msg.rs:19:7 @@ -82,8 +84,9 @@ LL | fn three<T>(self, _: T, _: T, _: T) -> Foo { self } | ^^^^^ ---- ---- ---- help: provide the arguments | -LL | y.three::<usize>(/* usize */, /* usize */, /* usize */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - y.three::<usize>(); +LL + y.three::<usize>(/* usize */, /* usize */, /* usize */); + | error: aborting due to 5 previous errors diff --git a/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr b/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr index 6159d87c73e..d6da3f2cc39 100644 --- a/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr +++ b/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr @@ -46,16 +46,19 @@ LL | fn foo(self: Smaht<Self, u64>) -> u64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | let z = FinalFoo::foo(&x); - | ~~~~~~~~~~~~~~~~~ +LL - let z = x.foo(); +LL + let z = FinalFoo::foo(&x); + | help: disambiguate the method for candidate #2 | -LL | let z = NuisanceFoo::foo(x); - | ~~~~~~~~~~~~~~~~~~~ +LL - let z = x.foo(); +LL + let z = NuisanceFoo::foo(x); + | help: disambiguate the method for candidate #3 | -LL | let z = X::foo(x); - | ~~~~~~~~~ +LL - let z = x.foo(); +LL + let z = X::foo(x); + | error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:139:24 diff --git a/tests/ui/methods/method-not-found-but-doc-alias.stderr b/tests/ui/methods/method-not-found-but-doc-alias.stderr index c49ffa8971f..2164b7cbbf8 100644 --- a/tests/ui/methods/method-not-found-but-doc-alias.stderr +++ b/tests/ui/methods/method-not-found-but-doc-alias.stderr @@ -9,8 +9,9 @@ LL | Foo.quux(); | help: there is a method `bar` with a similar name | -LL | Foo.bar(); - | ~~~ +LL - Foo.quux(); +LL + Foo.bar(); + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr index 12427040272..c9a54951307 100644 --- a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr +++ b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr @@ -7,7 +7,7 @@ LL | let x = 2.0.neg(); help: you must specify a concrete type for this numeric value, like `f32` | LL | let x = 2.0_f32.neg(); - | ~~~~~~~ + | ++++ error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` --> $DIR/method-on-ambiguous-numeric-type.rs:17:15 diff --git a/tests/ui/methods/suggest-convert-ptr-to-ref.stderr b/tests/ui/methods/suggest-convert-ptr-to-ref.stderr index 0e1565e251a..7d52b20121e 100644 --- a/tests/ui/methods/suggest-convert-ptr-to-ref.stderr +++ b/tests/ui/methods/suggest-convert-ptr-to-ref.stderr @@ -47,8 +47,9 @@ LL | let _ = t.as_mut_ref(); | help: there is a method `as_mut` with a similar name | -LL | let _ = t.as_mut(); - | ~~~~~~ +LL - let _ = t.as_mut_ref(); +LL + let _ = t.as_mut(); + | error[E0599]: no method named `as_ref_mut` found for raw pointer `*mut u8` in the current scope --> $DIR/suggest-convert-ptr-to-ref.rs:13:15 @@ -58,8 +59,9 @@ LL | let _ = t.as_ref_mut(); | help: there is a method `as_mut` with a similar name | -LL | let _ = t.as_mut(); - | ~~~~~~ +LL - let _ = t.as_ref_mut(); +LL + let _ = t.as_mut(); + | error[E0599]: no method named `make_ascii_lowercase` found for raw pointer `*const u8` in the current scope --> $DIR/suggest-convert-ptr-to-ref.rs:16:7 diff --git a/tests/ui/methods/supertrait-shadowing/assoc-const.rs b/tests/ui/methods/supertrait-shadowing/assoc-const.rs new file mode 100644 index 00000000000..a542ce7d326 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/assoc-const.rs @@ -0,0 +1,23 @@ +//@ run-pass +//@ check-run-results + +#![feature(supertrait_item_shadowing)] +#![allow(dead_code)] + +trait A { + const CONST: i32; +} +impl<T> A for T { + const CONST: i32 = 1; +} + +trait B: A { + const CONST: i32; +} +impl<T> B for T { + const CONST: i32 = 2; +} + +fn main() { + println!("{}", i32::CONST); +} diff --git a/tests/ui/methods/supertrait-shadowing/assoc-const.run.stdout b/tests/ui/methods/supertrait-shadowing/assoc-const.run.stdout new file mode 100644 index 00000000000..0cfbf08886f --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/assoc-const.run.stdout @@ -0,0 +1 @@ +2 diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor-2.rs b/tests/ui/methods/supertrait-shadowing/common-ancestor-2.rs new file mode 100644 index 00000000000..cecf6dccf9d --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor-2.rs @@ -0,0 +1,34 @@ +//@ run-pass +//@ check-run-results + +#![feature(supertrait_item_shadowing)] +#![warn(supertrait_item_shadowing_usage)] +#![warn(supertrait_item_shadowing_definition)] +#![allow(dead_code)] + +trait A { + fn hello(&self) { + println!("A"); + } +} +impl<T> A for T {} + +trait B { + fn hello(&self) { + println!("B"); + } +} +impl<T> B for T {} + +trait C: A + B { + fn hello(&self) { + //~^ WARN trait item `hello` from `C` shadows identically named item + println!("C"); + } +} +impl<T> C for T {} + +fn main() { + ().hello(); + //~^ WARN trait item `hello` from `C` shadows identically named item from supertrait +} diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor-2.run.stdout b/tests/ui/methods/supertrait-shadowing/common-ancestor-2.run.stdout new file mode 100644 index 00000000000..3cc58df8375 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor-2.run.stdout @@ -0,0 +1 @@ +C diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor-2.stderr b/tests/ui/methods/supertrait-shadowing/common-ancestor-2.stderr new file mode 100644 index 00000000000..934d5a0f7cf --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor-2.stderr @@ -0,0 +1,47 @@ +warning: trait item `hello` from `C` shadows identically named item from supertrait + --> $DIR/common-ancestor-2.rs:24:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ + | +note: items from several supertraits are shadowed: `B` and `A` + --> $DIR/common-ancestor-2.rs:10:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +... +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/common-ancestor-2.rs:6:9 + | +LL | #![warn(supertrait_item_shadowing_definition)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: trait item `hello` from `C` shadows identically named item from supertrait + --> $DIR/common-ancestor-2.rs:32:8 + | +LL | ().hello(); + | ^^^^^ + | +note: item from `C` shadows a supertrait item + --> $DIR/common-ancestor-2.rs:24:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +note: items from several supertraits are shadowed: `A` and `B` + --> $DIR/common-ancestor-2.rs:10:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +... +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/common-ancestor-2.rs:5:9 + | +LL | #![warn(supertrait_item_shadowing_usage)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 2 warnings emitted + diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor-3.rs b/tests/ui/methods/supertrait-shadowing/common-ancestor-3.rs new file mode 100644 index 00000000000..040fa9aab39 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor-3.rs @@ -0,0 +1,44 @@ +//@ run-pass +//@ check-run-results + +#![feature(supertrait_item_shadowing)] +#![warn(supertrait_item_shadowing_usage)] +#![warn(supertrait_item_shadowing_definition)] +#![allow(dead_code)] + +trait A { + fn hello(&self) { + println!("A"); + } +} +impl<T> A for T {} + +trait B { + fn hello(&self) { + println!("B"); + } +} +impl<T> B for T {} + +trait C: A + B { + fn hello(&self) { + //~^ WARN trait item `hello` from `C` shadows identically named item + println!("C"); + } +} +impl<T> C for T {} + +// `D` extends `C` which extends `B` and `A` + +trait D: C { + fn hello(&self) { + //~^ WARN trait item `hello` from `D` shadows identically named item + println!("D"); + } +} +impl<T> D for T {} + +fn main() { + ().hello(); + //~^ WARN trait item `hello` from `D` shadows identically named item from supertrait +} diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor-3.run.stdout b/tests/ui/methods/supertrait-shadowing/common-ancestor-3.run.stdout new file mode 100644 index 00000000000..17848105018 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor-3.run.stdout @@ -0,0 +1 @@ +D diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor-3.stderr b/tests/ui/methods/supertrait-shadowing/common-ancestor-3.stderr new file mode 100644 index 00000000000..28e44a2ff20 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor-3.stderr @@ -0,0 +1,68 @@ +warning: trait item `hello` from `C` shadows identically named item from supertrait + --> $DIR/common-ancestor-3.rs:24:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ + | +note: items from several supertraits are shadowed: `B` and `A` + --> $DIR/common-ancestor-3.rs:10:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +... +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/common-ancestor-3.rs:6:9 + | +LL | #![warn(supertrait_item_shadowing_definition)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: trait item `hello` from `D` shadows identically named item from supertrait + --> $DIR/common-ancestor-3.rs:34:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ + | +note: items from several supertraits are shadowed: `C`, `B`, and `A` + --> $DIR/common-ancestor-3.rs:10:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +... +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +... +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ + +warning: trait item `hello` from `D` shadows identically named item from supertrait + --> $DIR/common-ancestor-3.rs:42:8 + | +LL | ().hello(); + | ^^^^^ + | +note: item from `D` shadows a supertrait item + --> $DIR/common-ancestor-3.rs:34:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +note: items from several supertraits are shadowed: `A`, `B`, and `C` + --> $DIR/common-ancestor-3.rs:10:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +... +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +... +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/common-ancestor-3.rs:5:9 + | +LL | #![warn(supertrait_item_shadowing_usage)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 3 warnings emitted + diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor.rs b/tests/ui/methods/supertrait-shadowing/common-ancestor.rs new file mode 100644 index 00000000000..8e67c935367 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor.rs @@ -0,0 +1,27 @@ +//@ run-pass +//@ check-run-results + +#![feature(supertrait_item_shadowing)] +#![warn(supertrait_item_shadowing_usage)] +#![warn(supertrait_item_shadowing_definition)] +#![allow(dead_code)] + +trait A { + fn hello(&self) { + println!("A"); + } +} +impl<T> A for T {} + +trait B: A { + fn hello(&self) { + //~^ WARN trait item `hello` from `B` shadows identically named item + println!("B"); + } +} +impl<T> B for T {} + +fn main() { + ().hello(); + //~^ WARN trait item `hello` from `B` shadows identically named item from supertrait +} diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor.run.stdout b/tests/ui/methods/supertrait-shadowing/common-ancestor.run.stdout new file mode 100644 index 00000000000..223b7836fb1 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor.run.stdout @@ -0,0 +1 @@ +B diff --git a/tests/ui/methods/supertrait-shadowing/common-ancestor.stderr b/tests/ui/methods/supertrait-shadowing/common-ancestor.stderr new file mode 100644 index 00000000000..f404fa6b53a --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/common-ancestor.stderr @@ -0,0 +1,41 @@ +warning: trait item `hello` from `B` shadows identically named item from supertrait + --> $DIR/common-ancestor.rs:17:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ + | +note: item from `A` is shadowed by a subtrait item + --> $DIR/common-ancestor.rs:10:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/common-ancestor.rs:6:9 + | +LL | #![warn(supertrait_item_shadowing_definition)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: trait item `hello` from `B` shadows identically named item from supertrait + --> $DIR/common-ancestor.rs:25:8 + | +LL | ().hello(); + | ^^^^^ + | +note: item from `B` shadows a supertrait item + --> $DIR/common-ancestor.rs:17:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +note: item from `A` is shadowed by a subtrait item + --> $DIR/common-ancestor.rs:10:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/common-ancestor.rs:5:9 + | +LL | #![warn(supertrait_item_shadowing_usage)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 2 warnings emitted + diff --git a/tests/ui/methods/supertrait-shadowing/definition-site.rs b/tests/ui/methods/supertrait-shadowing/definition-site.rs new file mode 100644 index 00000000000..2768a6a6b27 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/definition-site.rs @@ -0,0 +1,18 @@ +#![feature(supertrait_item_shadowing)] +#![deny(supertrait_item_shadowing_definition)] + +trait SuperSuper { + fn method(); +} + +trait Super: SuperSuper { + fn method(); + //~^ ERROR trait item `method` from `Super` shadows identically named item +} + +trait Sub: Super { + fn method(); + //~^ ERROR trait item `method` from `Sub` shadows identically named item +} + +fn main() {} diff --git a/tests/ui/methods/supertrait-shadowing/definition-site.stderr b/tests/ui/methods/supertrait-shadowing/definition-site.stderr new file mode 100644 index 00000000000..f0bbf414a69 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/definition-site.stderr @@ -0,0 +1,34 @@ +error: trait item `method` from `Super` shadows identically named item from supertrait + --> $DIR/definition-site.rs:9:5 + | +LL | fn method(); + | ^^^^^^^^^^^^ + | +note: item from `SuperSuper` is shadowed by a subtrait item + --> $DIR/definition-site.rs:5:5 + | +LL | fn method(); + | ^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/definition-site.rs:2:9 + | +LL | #![deny(supertrait_item_shadowing_definition)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: trait item `method` from `Sub` shadows identically named item from supertrait + --> $DIR/definition-site.rs:14:5 + | +LL | fn method(); + | ^^^^^^^^^^^^ + | +note: items from several supertraits are shadowed: `Super` and `SuperSuper` + --> $DIR/definition-site.rs:5:5 + | +LL | fn method(); + | ^^^^^^^^^^^^ +... +LL | fn method(); + | ^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/methods/supertrait-shadowing/false-subtrait-after-inference.rs b/tests/ui/methods/supertrait-shadowing/false-subtrait-after-inference.rs new file mode 100644 index 00000000000..c3bc47e6740 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/false-subtrait-after-inference.rs @@ -0,0 +1,26 @@ +#![feature(supertrait_item_shadowing)] +#![warn(supertrait_item_shadowing_usage)] +#![warn(supertrait_item_shadowing_definition)] + +struct W<T>(T); + +trait Upstream { + fn hello(&self) {} +} +impl<T> Upstream for T {} + +trait Downstream: Upstream { + fn hello(&self) {} + //~^ WARN trait item `hello` from `Downstream` shadows identically named item +} +impl<T> Downstream for W<T> where T: Foo {} + +trait Foo {} + +fn main() { + let x = W(Default::default()); + x.hello(); + //~^ ERROR the trait bound `i32: Foo` is not satisfied + //~| WARN trait item `hello` from `Downstream` shadows identically named item from supertrait + let _: i32 = x.0; +} diff --git a/tests/ui/methods/supertrait-shadowing/false-subtrait-after-inference.stderr b/tests/ui/methods/supertrait-shadowing/false-subtrait-after-inference.stderr new file mode 100644 index 00000000000..47019ca7a32 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/false-subtrait-after-inference.stderr @@ -0,0 +1,59 @@ +warning: trait item `hello` from `Downstream` shadows identically named item from supertrait + --> $DIR/false-subtrait-after-inference.rs:13:5 + | +LL | fn hello(&self) {} + | ^^^^^^^^^^^^^^^ + | +note: item from `Upstream` is shadowed by a subtrait item + --> $DIR/false-subtrait-after-inference.rs:8:5 + | +LL | fn hello(&self) {} + | ^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/false-subtrait-after-inference.rs:3:9 + | +LL | #![warn(supertrait_item_shadowing_definition)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: trait item `hello` from `Downstream` shadows identically named item from supertrait + --> $DIR/false-subtrait-after-inference.rs:22:7 + | +LL | x.hello(); + | ^^^^^ + | +note: item from `Downstream` shadows a supertrait item + --> $DIR/false-subtrait-after-inference.rs:13:5 + | +LL | fn hello(&self) {} + | ^^^^^^^^^^^^^^^ +note: item from `Upstream` is shadowed by a subtrait item + --> $DIR/false-subtrait-after-inference.rs:8:5 + | +LL | fn hello(&self) {} + | ^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/false-subtrait-after-inference.rs:2:9 + | +LL | #![warn(supertrait_item_shadowing_usage)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0277]: the trait bound `i32: Foo` is not satisfied + --> $DIR/false-subtrait-after-inference.rs:22:7 + | +LL | x.hello(); + | ^^^^^ the trait `Foo` is not implemented for `i32` + | +help: this trait has no implementations, consider adding one + --> $DIR/false-subtrait-after-inference.rs:18:1 + | +LL | trait Foo {} + | ^^^^^^^^^ +note: required for `W<i32>` to implement `Downstream` + --> $DIR/false-subtrait-after-inference.rs:16:9 + | +LL | impl<T> Downstream for W<T> where T: Foo {} + | ^^^^^^^^^^ ^^^^ --- unsatisfied trait bound introduced here + +error: aborting due to 1 previous error; 2 warnings emitted + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.rs b/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.rs new file mode 100644 index 00000000000..2834ca31b71 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.rs @@ -0,0 +1,37 @@ +#![feature(supertrait_item_shadowing)] + +trait A { + fn hello(&self) { + println!("A"); + } +} +impl<T> A for T {} + +trait B { + fn hello(&self) { + println!("B"); + } +} +impl<T> B for T {} + +trait C: A + B { + fn hello(&self) { + println!("C"); + } +} +impl<T> C for T {} + +// Since `D` is not a subtrait of `C`, +// we have no obvious lower bound. + +trait D: B { + fn hello(&self) { + println!("D"); + } +} +impl<T> D for T {} + +fn main() { + ().hello(); + //~^ ERROR multiple applicable items in scope +} diff --git a/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.stderr b/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.stderr new file mode 100644 index 00000000000..231cb9b1cb2 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/no-common-ancestor-2.stderr @@ -0,0 +1,50 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/no-common-ancestor-2.rs:35:8 + | +LL | ().hello(); + | ^^^^^ multiple `hello` found + | +note: candidate #1 is defined in an impl of the trait `A` for the type `T` + --> $DIR/no-common-ancestor-2.rs:4:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl of the trait `B` for the type `T` + --> $DIR/no-common-ancestor-2.rs:11:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +note: candidate #3 is defined in an impl of the trait `C` for the type `T` + --> $DIR/no-common-ancestor-2.rs:18:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +note: candidate #4 is defined in an impl of the trait `D` for the type `T` + --> $DIR/no-common-ancestor-2.rs:28:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +help: disambiguate the method for candidate #1 + | +LL - ().hello(); +LL + A::hello(&()); + | +help: disambiguate the method for candidate #2 + | +LL - ().hello(); +LL + B::hello(&()); + | +help: disambiguate the method for candidate #3 + | +LL - ().hello(); +LL + C::hello(&()); + | +help: disambiguate the method for candidate #4 + | +LL - ().hello(); +LL + D::hello(&()); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/methods/supertrait-shadowing/no-common-ancestor.rs b/tests/ui/methods/supertrait-shadowing/no-common-ancestor.rs new file mode 100644 index 00000000000..7323439d588 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/no-common-ancestor.rs @@ -0,0 +1,20 @@ +#![feature(supertrait_item_shadowing)] + +trait A { + fn hello(&self) { + println!("A"); + } +} +impl<T> A for T {} + +trait B { + fn hello(&self) { + println!("B"); + } +} +impl<T> B for T {} + +fn main() { + ().hello(); + //~^ ERROR multiple applicable items in scope +} diff --git a/tests/ui/methods/supertrait-shadowing/no-common-ancestor.stderr b/tests/ui/methods/supertrait-shadowing/no-common-ancestor.stderr new file mode 100644 index 00000000000..4e83f60c765 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/no-common-ancestor.stderr @@ -0,0 +1,30 @@ +error[E0034]: multiple applicable items in scope + --> $DIR/no-common-ancestor.rs:18:8 + | +LL | ().hello(); + | ^^^^^ multiple `hello` found + | +note: candidate #1 is defined in an impl of the trait `A` for the type `T` + --> $DIR/no-common-ancestor.rs:4:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +note: candidate #2 is defined in an impl of the trait `B` for the type `T` + --> $DIR/no-common-ancestor.rs:11:5 + | +LL | fn hello(&self) { + | ^^^^^^^^^^^^^^^ +help: disambiguate the method for candidate #1 + | +LL - ().hello(); +LL + A::hello(&()); + | +help: disambiguate the method for candidate #2 + | +LL - ().hello(); +LL + B::hello(&()); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0034`. diff --git a/tests/ui/methods/supertrait-shadowing/out-of-scope.rs b/tests/ui/methods/supertrait-shadowing/out-of-scope.rs new file mode 100644 index 00000000000..bd263be59cc --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/out-of-scope.rs @@ -0,0 +1,25 @@ +//@ run-pass +//@ check-run-results + +#![feature(supertrait_item_shadowing)] +#![allow(dead_code)] + +mod out_of_scope { + pub trait Subtrait: super::Supertrait { + fn hello(&self) { + println!("subtrait"); + } + } + impl<T> Subtrait for T {} +} + +trait Supertrait { + fn hello(&self) { + println!("supertrait"); + } +} +impl<T> Supertrait for T {} + +fn main() { + ().hello(); +} diff --git a/tests/ui/methods/supertrait-shadowing/out-of-scope.run.stdout b/tests/ui/methods/supertrait-shadowing/out-of-scope.run.stdout new file mode 100644 index 00000000000..1019e5f3543 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/out-of-scope.run.stdout @@ -0,0 +1 @@ +supertrait diff --git a/tests/ui/methods/supertrait-shadowing/trivially-false-subtrait.rs b/tests/ui/methods/supertrait-shadowing/trivially-false-subtrait.rs new file mode 100644 index 00000000000..e44c7c18083 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/trivially-false-subtrait.rs @@ -0,0 +1,26 @@ +//@ check-pass + +// Make sure we don't prefer a subtrait that we would've otherwise eliminated +// in `consider_probe` during method probing. + +#![feature(supertrait_item_shadowing)] +#![allow(dead_code)] + +struct W<T>(T); + +trait Upstream { + fn hello(&self) {} +} +impl<T> Upstream for T {} + +trait Downstream: Upstream { + fn hello(&self) {} +} +impl<T> Downstream for W<T> where T: Foo {} + +trait Foo {} + +fn main() { + let x = W(1i32); + x.hello(); +} diff --git a/tests/ui/methods/supertrait-shadowing/type-dependent.rs b/tests/ui/methods/supertrait-shadowing/type-dependent.rs new file mode 100644 index 00000000000..3af884fd52d --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/type-dependent.rs @@ -0,0 +1,29 @@ +//@ run-pass +//@ check-run-results + +// Makes sure we can shadow with type-dependent method syntax. + +#![feature(supertrait_item_shadowing)] +#![allow(dead_code)] + +trait A { + fn hello() { + println!("A"); + } +} +impl<T> A for T {} + +trait B: A { + fn hello() { + println!("B"); + } +} +impl<T> B for T {} + +fn foo<T>() { + T::hello(); +} + +fn main() { + foo::<()>(); +} diff --git a/tests/ui/methods/supertrait-shadowing/type-dependent.run.stdout b/tests/ui/methods/supertrait-shadowing/type-dependent.run.stdout new file mode 100644 index 00000000000..223b7836fb1 --- /dev/null +++ b/tests/ui/methods/supertrait-shadowing/type-dependent.run.stdout @@ -0,0 +1 @@ +B diff --git a/tests/ui/mir/issue-106062.stderr b/tests/ui/mir/issue-106062.stderr index 30635148dae..19a1d06e0be 100644 --- a/tests/ui/mir/issue-106062.stderr +++ b/tests/ui/mir/issue-106062.stderr @@ -6,10 +6,12 @@ LL | async fn connection_handler(handler: impl Sized) -> Result<Ok, std::io: | help: try using the variant's enum | -LL | async fn connection_handler(handler: impl Sized) -> Result<core::result::Result, std::io::Error> { - | ~~~~~~~~~~~~~~~~~~~~ -LL | async fn connection_handler(handler: impl Sized) -> Result<std::result::Result, std::io::Error> { - | ~~~~~~~~~~~~~~~~~~~ +LL - async fn connection_handler(handler: impl Sized) -> Result<Ok, std::io::Error> { +LL + async fn connection_handler(handler: impl Sized) -> Result<core::result::Result, std::io::Error> { + | +LL - async fn connection_handler(handler: impl Sized) -> Result<Ok, std::io::Error> { +LL + async fn connection_handler(handler: impl Sized) -> Result<std::result::Result, std::io::Error> { + | error: aborting due to 1 previous error diff --git a/tests/ui/mir/issue-112269.stderr b/tests/ui/mir/issue-112269.stderr index 80f329e2ce0..fc8bf5d67b5 100644 --- a/tests/ui/mir/issue-112269.stderr +++ b/tests/ui/mir/issue-112269.stderr @@ -12,7 +12,7 @@ LL | let x: i32 = 3; help: introduce a variable instead | LL | let x_var: i32 = 3; - | ~~~~~ + | ++++ error[E0005]: refutable pattern in local binding --> $DIR/issue-112269.rs:7:9 @@ -28,7 +28,7 @@ LL | let y = 4; help: introduce a variable instead | LL | let y_var = 4; - | ~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/mir/null/addrof_null.rs b/tests/ui/mir/null/addrof_null.rs new file mode 100644 index 00000000000..0d0b7edeef6 --- /dev/null +++ b/tests/ui/mir/null/addrof_null.rs @@ -0,0 +1,14 @@ +// Make sure that we don't insert a check for `addr_of!`. +//@ run-pass +//@ compile-flags: -C debug-assertions + +struct Field { + a: u32, +} + +fn main() { + unsafe { + let ptr: *const Field = std::ptr::null(); + let _ptr = core::ptr::addr_of!((*ptr).a); + } +} diff --git a/tests/ui/mir/null/borrowed_mut_null.rs b/tests/ui/mir/null/borrowed_mut_null.rs new file mode 100644 index 00000000000..d26452b9dac --- /dev/null +++ b/tests/ui/mir/null/borrowed_mut_null.rs @@ -0,0 +1,8 @@ +//@ run-fail +//@ compile-flags: -C debug-assertions +//@ error-pattern: null pointer dereference occurred + +fn main() { + let ptr: *mut u32 = std::ptr::null_mut(); + let _ptr: &mut u32 = unsafe { &mut *ptr }; +} diff --git a/tests/ui/mir/null/borrowed_null.rs b/tests/ui/mir/null/borrowed_null.rs new file mode 100644 index 00000000000..fefac3a7212 --- /dev/null +++ b/tests/ui/mir/null/borrowed_null.rs @@ -0,0 +1,8 @@ +//@ run-fail +//@ compile-flags: -C debug-assertions +//@ error-pattern: null pointer dereference occurred + +fn main() { + let ptr: *const u32 = std::ptr::null(); + let _ptr: &u32 = unsafe { &*ptr }; +} diff --git a/tests/ui/mir/null/borrowed_null_zst.rs b/tests/ui/mir/null/borrowed_null_zst.rs new file mode 100644 index 00000000000..835727c068b --- /dev/null +++ b/tests/ui/mir/null/borrowed_null_zst.rs @@ -0,0 +1,8 @@ +//@ run-fail +//@ compile-flags: -C debug-assertions +//@ error-pattern: null pointer dereference occurred + +fn main() { + let ptr: *const () = std::ptr::null(); + let _ptr: &() = unsafe { &*ptr }; +} diff --git a/tests/ui/mir/null/null_lhs.rs b/tests/ui/mir/null/null_lhs.rs new file mode 100644 index 00000000000..238d350d1bd --- /dev/null +++ b/tests/ui/mir/null/null_lhs.rs @@ -0,0 +1,10 @@ +//@ run-fail +//@ compile-flags: -C debug-assertions +//@ error-pattern: null pointer dereference occurred + +fn main() { + let ptr: *mut u32 = std::ptr::null_mut(); + unsafe { + *(ptr) = 42; + } +} diff --git a/tests/ui/mir/null/null_rhs.rs b/tests/ui/mir/null/null_rhs.rs new file mode 100644 index 00000000000..18eafb61869 --- /dev/null +++ b/tests/ui/mir/null/null_rhs.rs @@ -0,0 +1,10 @@ +//@ run-fail +//@ compile-flags: -C debug-assertions +//@ error-pattern: null pointer dereference occurred + +fn main() { + let ptr: *mut u32 = std::ptr::null_mut(); + unsafe { + let _v = *ptr; + } +} diff --git a/tests/ui/mir/null/place_without_read.rs b/tests/ui/mir/null/place_without_read.rs new file mode 100644 index 00000000000..a259053d22b --- /dev/null +++ b/tests/ui/mir/null/place_without_read.rs @@ -0,0 +1,11 @@ +// Make sure that we don't insert a check for places that do not read. +//@ run-pass +//@ compile-flags: -C debug-assertions + +fn main() { + let ptr: *const u16 = std::ptr::null(); + unsafe { + let _ = *ptr; + let _ = &raw const *ptr; + } +} diff --git a/tests/ui/mir/null/place_without_read_zst.rs b/tests/ui/mir/null/place_without_read_zst.rs new file mode 100644 index 00000000000..c923ccea9a8 --- /dev/null +++ b/tests/ui/mir/null/place_without_read_zst.rs @@ -0,0 +1,11 @@ +// Make sure that we don't insert a check for places that do not read. +//@ run-pass +//@ compile-flags: -C debug-assertions + +fn main() { + let ptr: *const () = std::ptr::null(); + unsafe { + let _ = *ptr; + let _ = &raw const *ptr; + } +} diff --git a/tests/ui/mir/null/two_pointers.rs b/tests/ui/mir/null/two_pointers.rs new file mode 100644 index 00000000000..52b9510be12 --- /dev/null +++ b/tests/ui/mir/null/two_pointers.rs @@ -0,0 +1,12 @@ +//@ run-fail +//@ compile-flags: -C debug-assertions +//@ error-pattern: null pointer dereference occurred + +fn main() { + let ptr = std::ptr::null(); + let mut dest = 0u32; + let dest_ptr = &mut dest as *mut u32; + unsafe { + *dest_ptr = *(ptr); + } +} diff --git a/tests/ui/mir/null/zero_sized_access.rs b/tests/ui/mir/null/zero_sized_access.rs new file mode 100644 index 00000000000..e8aaf820c49 --- /dev/null +++ b/tests/ui/mir/null/zero_sized_access.rs @@ -0,0 +1,15 @@ +// Make sure that we don't insert a check for zero-sized reads or writes to +// null, because they are allowed. +//@ run-pass +//@ compile-flags: -C debug-assertions + +fn main() { + let ptr: *mut () = std::ptr::null_mut(); + unsafe { + *(ptr) = (); + } + let ptr1: *const () = std::ptr::null_mut(); + unsafe { + let _ptr = *ptr1; + } +} diff --git a/tests/ui/mismatched_types/E0053.stderr b/tests/ui/mismatched_types/E0053.stderr index 2559d448749..32452af5ced 100644 --- a/tests/ui/mismatched_types/E0053.stderr +++ b/tests/ui/mismatched_types/E0053.stderr @@ -13,8 +13,9 @@ LL | fn foo(x: u16); found signature `fn(i16)` help: change the parameter type to match the trait | -LL | fn foo(x: u16) { } - | ~~~ +LL - fn foo(x: i16) { } +LL + fn foo(x: u16) { } + | error[E0053]: method `bar` has an incompatible type for trait --> $DIR/E0053.rs:11:12 @@ -31,8 +32,9 @@ LL | fn bar(&self); found signature `fn(&mut Bar)` help: change the self-receiver type to match the trait | -LL | fn bar(&self) { } - | ~~~~~ +LL - fn bar(&mut self) { } +LL + fn bar(&self) { } + | error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/cast-rfc0401.stderr b/tests/ui/mismatched_types/cast-rfc0401.stderr index 2e5cbb90036..a4276395944 100644 --- a/tests/ui/mismatched_types/cast-rfc0401.stderr +++ b/tests/ui/mismatched_types/cast-rfc0401.stderr @@ -90,8 +90,9 @@ LL | let _ = 3_i32 as bool; | help: compare with zero instead | -LL | let _ = 3_i32 != 0; - | ~~~~ +LL - let _ = 3_i32 as bool; +LL + let _ = 3_i32 != 0; + | error[E0054]: cannot cast `E` as `bool` --> $DIR/cast-rfc0401.rs:40:13 diff --git a/tests/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr b/tests/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr index 801e8a0ff1d..b29abfe59c5 100644 --- a/tests/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr +++ b/tests/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr @@ -8,8 +8,9 @@ LL | let _n = m.iter().map(|_, b| { | help: change the closure to accept a tuple instead of individual arguments | -LL | let _n = m.iter().map(|(_, b)| { - | ~~~~~~~~ +LL - let _n = m.iter().map(|_, b| { +LL + let _n = m.iter().map(|(_, b)| { + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/closure-arg-count.stderr b/tests/ui/mismatched_types/closure-arg-count.stderr index 0e2ca8feec5..8704d0f661b 100644 --- a/tests/ui/mismatched_types/closure-arg-count.stderr +++ b/tests/ui/mismatched_types/closure-arg-count.stderr @@ -8,8 +8,9 @@ LL | [1, 2, 3].sort_by(|| panic!()); | help: consider changing the closure to take and ignore the expected arguments | -LL | [1, 2, 3].sort_by(|_, _| panic!()); - | ~~~~~~ +LL - [1, 2, 3].sort_by(|| panic!()); +LL + [1, 2, 3].sort_by(|_, _| panic!()); + | error[E0593]: closure is expected to take 2 arguments, but it takes 1 argument --> $DIR/closure-arg-count.rs:7:15 @@ -29,8 +30,9 @@ LL | [1, 2, 3].sort_by(|(tuple, tuple2)| panic!()); | help: change the closure to take multiple arguments instead of a single tuple | -LL | [1, 2, 3].sort_by(|tuple, tuple2| panic!()); - | ~~~~~~~~~~~~~~~ +LL - [1, 2, 3].sort_by(|(tuple, tuple2)| panic!()); +LL + [1, 2, 3].sort_by(|tuple, tuple2| panic!()); + | error[E0593]: closure is expected to take 2 distinct arguments, but it takes a single 2-tuple as argument --> $DIR/closure-arg-count.rs:11:15 @@ -42,8 +44,9 @@ LL | [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!()); | help: change the closure to take multiple arguments instead of a single tuple | -LL | [1, 2, 3].sort_by(|tuple, tuple2| panic!()); - | ~~~~~~~~~~~~~~~ +LL - [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!()); +LL + [1, 2, 3].sort_by(|tuple, tuple2| panic!()); + | error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments --> $DIR/closure-arg-count.rs:13:5 @@ -61,8 +64,9 @@ LL | fn f<F: Fn<(usize,)>>(_: F) {} | ^^^^^^^^^^^^ required by this bound in `f` help: consider changing the closure to take and ignore the expected argument | -LL | f(|_| panic!()); - | ~~~ +LL - f(|| panic!()); +LL + f(|_| panic!()); + | error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments --> $DIR/closure-arg-count.rs:15:5 @@ -80,8 +84,9 @@ LL | fn f<F: Fn<(usize,)>>(_: F) {} | ^^^^^^^^^^^^ required by this bound in `f` help: consider changing the closure to take and ignore the expected argument | -LL | f( move |_| panic!()); - | ~~~ +LL - f( move || panic!()); +LL + f( move |_| panic!()); + | error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments --> $DIR/closure-arg-count.rs:18:53 @@ -93,8 +98,9 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i); | help: change the closure to accept a tuple instead of individual arguments | -LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i); - | ~~~~~~~~ +LL - let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i); +LL + let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i); + | error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments --> $DIR/closure-arg-count.rs:20:53 @@ -106,8 +112,9 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i); | help: change the closure to accept a tuple instead of individual arguments | -LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i); - | ~~~~~~~~ +LL - let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i); +LL + let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i); + | error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments --> $DIR/closure-arg-count.rs:22:53 diff --git a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.current.fixed b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.current.fixed index 25943d11fc4..ba46a447802 100644 --- a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.current.fixed +++ b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.current.fixed @@ -5,9 +5,9 @@ fn main() { let _ = (-10..=10).find(|x: &i32| x.signum() == 0); //[current]~^ ERROR type mismatch in closure arguments - //[next]~^^ ERROR expected a `FnMut(&<RangeInclusive<{integer}> as Iterator>::Item)` closure, found + //[next]~^^ ERROR expected a `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found let _ = (-10..=10).find(|x: &i32| x.signum() == 0); //[current]~^ ERROR type mismatch in closure arguments //[next]~^^ ERROR expected `RangeInclusive<{integer}>` to be an iterator that yields `&&i32`, but it yields `{integer}` - //[next]~| ERROR expected a `FnMut(&<RangeInclusive<{integer}> as Iterator>::Item)` closure, found + //[next]~| ERROR expected a `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found } diff --git a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.next.stderr b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.next.stderr index 696214c0a3c..b7161310619 100644 --- a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.next.stderr +++ b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.next.stderr @@ -1,14 +1,14 @@ -error[E0277]: expected a `FnMut(&<RangeInclusive<{integer}> as Iterator>::Item)` closure, found `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:6:29: 6:37}` +error[E0277]: expected a `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:6:29: 6:37}` --> $DIR/closure-arg-type-mismatch-issue-45727.rs:6:29 | LL | let _ = (-10..=10).find(|x: i32| x.signum() == 0); - | ---- ^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnMut(&<RangeInclusive<{integer}> as Iterator>::Item)` closure, found `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:6:29: 6:37}` + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:6:29: 6:37}` | | | required by a bound introduced by this call | - = help: the trait `for<'a> FnMut(&'a <RangeInclusive<{integer}> as Iterator>::Item)` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:6:29: 6:37}` + = help: the trait `for<'a> FnMut(&'a <std::ops::RangeInclusive<{integer}> as Iterator>::Item)` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:6:29: 6:37}` = note: expected a closure with arguments `(i32,)` - found a closure with arguments `(&<RangeInclusive<{integer}> as Iterator>::Item,)` + found a closure with arguments `(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item,)` note: required by a bound in `find` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL @@ -18,17 +18,17 @@ error[E0271]: expected `RangeInclusive<{integer}>` to be an iterator that yields LL | let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0); | ^^^^ expected `&&i32`, found integer -error[E0277]: expected a `FnMut(&<RangeInclusive<{integer}> as Iterator>::Item)` closure, found `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:9:29: 9:40}` +error[E0277]: expected a `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:9:29: 9:40}` --> $DIR/closure-arg-type-mismatch-issue-45727.rs:9:29 | LL | let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0); - | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnMut(&<RangeInclusive<{integer}> as Iterator>::Item)` closure, found `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:9:29: 9:40}` + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:9:29: 9:40}` | | | required by a bound introduced by this call | - = help: the trait `for<'a> FnMut(&'a <RangeInclusive<{integer}> as Iterator>::Item)` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:9:29: 9:40}` + = help: the trait `for<'a> FnMut(&'a <std::ops::RangeInclusive<{integer}> as Iterator>::Item)` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:9:29: 9:40}` = note: expected a closure with arguments `(&&&i32,)` - found a closure with arguments `(&<RangeInclusive<{integer}> as Iterator>::Item,)` + found a closure with arguments `(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item,)` note: required by a bound in `find` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL diff --git a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.rs b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.rs index 9e44489cbf1..0fd56707763 100644 --- a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.rs +++ b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.rs @@ -5,9 +5,9 @@ fn main() { let _ = (-10..=10).find(|x: i32| x.signum() == 0); //[current]~^ ERROR type mismatch in closure arguments - //[next]~^^ ERROR expected a `FnMut(&<RangeInclusive<{integer}> as Iterator>::Item)` closure, found + //[next]~^^ ERROR expected a `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0); //[current]~^ ERROR type mismatch in closure arguments //[next]~^^ ERROR expected `RangeInclusive<{integer}>` to be an iterator that yields `&&i32`, but it yields `{integer}` - //[next]~| ERROR expected a `FnMut(&<RangeInclusive<{integer}> as Iterator>::Item)` closure, found + //[next]~| ERROR expected a `FnMut(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item)` closure, found } diff --git a/tests/ui/mismatched_types/float-literal-inference-restrictions.stderr b/tests/ui/mismatched_types/float-literal-inference-restrictions.stderr index 6b3e0cb505f..b345d5e049e 100644 --- a/tests/ui/mismatched_types/float-literal-inference-restrictions.stderr +++ b/tests/ui/mismatched_types/float-literal-inference-restrictions.stderr @@ -21,8 +21,9 @@ LL | let y: f32 = 1f64; | help: change the type of the numeric literal from `f64` to `f32` | -LL | let y: f32 = 1f32; - | ~~~ +LL - let y: f32 = 1f64; +LL + let y: f32 = 1f32; + | error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/generic-mismatch-reporting-issue-116615.stderr b/tests/ui/mismatched_types/generic-mismatch-reporting-issue-116615.stderr index 0a86f884e70..9fc3a914447 100644 --- a/tests/ui/mismatched_types/generic-mismatch-reporting-issue-116615.stderr +++ b/tests/ui/mismatched_types/generic-mismatch-reporting-issue-116615.stderr @@ -31,9 +31,8 @@ note: function defined here --> $DIR/generic-mismatch-reporting-issue-116615.rs:2:4 | LL | fn foo_multi_same<T>(a: T, b: T, c: T, d: T, e: T, f: i32) {} - | ^^^^^^^^^^^^^^ - ---- ---- ---- ---- ---- ------ - | | | | | | | - | | | | | | this parameter needs to match the `&str` type of `a` and `b` + | ^^^^^^^^^^^^^^ - ---- ---- ---- ---- ---- this parameter needs to match the `&str` type of `a` and `b` + | | | | | | | | | | | this parameter needs to match the `&str` type of `a` and `b` | | | | this parameter needs to match the `&str` type of `a` and `b` | | | `c`, `d` and `e` need to match the `&str` type of this parameter @@ -83,9 +82,8 @@ note: function defined here --> $DIR/generic-mismatch-reporting-issue-116615.rs:2:4 | LL | fn foo_multi_same<T>(a: T, b: T, c: T, d: T, e: T, f: i32) {} - | ^^^^^^^^^^^^^^ - ---- ---- ---- ---- ---- ------ - | | | | | | | - | | | | | | `b` and `c` need to match the `&str` type of this parameter + | ^^^^^^^^^^^^^^ - ---- ---- ---- ---- ---- `b` and `c` need to match the `&str` type of this parameter + | | | | | | | | | | | `b` and `c` need to match the `&str` type of this parameter | | | | this parameter needs to match the `&str` type of `a`, `d` and `e` | | | this parameter needs to match the `&str` type of `a`, `d` and `e` diff --git a/tests/ui/mismatched_types/issue-106182.stderr b/tests/ui/mismatched_types/issue-106182.stderr index 2f33628a491..647a7313344 100644 --- a/tests/ui/mismatched_types/issue-106182.stderr +++ b/tests/ui/mismatched_types/issue-106182.stderr @@ -10,8 +10,9 @@ LL | _S(& (mut _y), _v) => { found reference `&_` help: consider removing `&` from the pattern | -LL | _S(mut _y, _v) => { - | ~~~~~~ +LL - _S(& (mut _y), _v) => { +LL + _S(mut _y, _v) => { + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/issue-112036.stderr b/tests/ui/mismatched_types/issue-112036.stderr index bd446b3d78c..fed6b11a7b2 100644 --- a/tests/ui/mismatched_types/issue-112036.stderr +++ b/tests/ui/mismatched_types/issue-112036.stderr @@ -9,7 +9,7 @@ LL | fn drop(self) {} help: change the self-receiver type to match the trait | LL | fn drop(&mut self) {} - | ~~~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/issue-13033.stderr b/tests/ui/mismatched_types/issue-13033.stderr index 2a266d40e77..7756217b560 100644 --- a/tests/ui/mismatched_types/issue-13033.stderr +++ b/tests/ui/mismatched_types/issue-13033.stderr @@ -13,8 +13,9 @@ LL | fn bar(&mut self, other: &mut dyn Foo); found signature `fn(&mut Baz, &dyn Foo)` help: change the parameter type to match the trait | -LL | fn bar(&mut self, other: &mut dyn Foo) {} - | ~~~~~~~~~~~~ +LL - fn bar(&mut self, other: &dyn Foo) {} +LL + fn bar(&mut self, other: &mut dyn Foo) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/issue-1362.stderr b/tests/ui/mismatched_types/issue-1362.stderr index 6f6fdff6678..4a2d4c1b459 100644 --- a/tests/ui/mismatched_types/issue-1362.stderr +++ b/tests/ui/mismatched_types/issue-1362.stderr @@ -8,8 +8,9 @@ LL | let x: u32 = 20i32; | help: change the type of the numeric literal from `i32` to `u32` | -LL | let x: u32 = 20u32; - | ~~~ +LL - let x: u32 = 20i32; +LL + let x: u32 = 20u32; + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/issue-1448-2.stderr b/tests/ui/mismatched_types/issue-1448-2.stderr index a6f1daefe63..85730a18d9d 100644 --- a/tests/ui/mismatched_types/issue-1448-2.stderr +++ b/tests/ui/mismatched_types/issue-1448-2.stderr @@ -13,8 +13,9 @@ LL | fn foo(a: u32) -> u32 { a } | ^^^ ------ help: change the type of the numeric literal from `i32` to `u32` | -LL | println!("{}", foo(10u32)); - | ~~~ +LL - println!("{}", foo(10i32)); +LL + println!("{}", foo(10u32)); + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/issue-26480.stderr b/tests/ui/mismatched_types/issue-26480.stderr index ae10a00671e..da8d73225f3 100644 --- a/tests/ui/mismatched_types/issue-26480.stderr +++ b/tests/ui/mismatched_types/issue-26480.stderr @@ -13,7 +13,7 @@ note: function defined here --> $DIR/issue-26480.rs:2:8 | LL | fn write(fildes: i32, buf: *const i8, nbyte: u64) -> i64; - | ^^^^^ + | ^^^^^ ----- = note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info) help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit | diff --git a/tests/ui/mismatched_types/mismatch-args-crash-issue-128848.stderr b/tests/ui/mismatched_types/mismatch-args-crash-issue-128848.stderr index 899cf435ddf..dbd313fada9 100644 --- a/tests/ui/mismatched_types/mismatch-args-crash-issue-128848.stderr +++ b/tests/ui/mismatched_types/mismatch-args-crash-issue-128848.stderr @@ -8,8 +8,9 @@ note: method defined here --> $SRC_DIR/core/src/ops/function.rs:LL:COL help: provide the argument | -LL | f.call_once(/* args */) - | ~~~~~~~~~~~~ +LL - f.call_once() +LL + f.call_once(/* args */) + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/mismatch-args-crash-issue-130400.stderr b/tests/ui/mismatched_types/mismatch-args-crash-issue-130400.stderr index 0e4b94b98e2..d9d99f3d1cf 100644 --- a/tests/ui/mismatched_types/mismatch-args-crash-issue-130400.stderr +++ b/tests/ui/mismatched_types/mismatch-args-crash-issue-130400.stderr @@ -11,8 +11,9 @@ LL | fn foo(&mut self) -> _ { | ^^^ --------- help: provide the argument | -LL | Self::foo(/* value */) - | ~~~~~~~~~~~~~ +LL - Self::foo() +LL + Self::foo(/* value */) + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/mismatch-args-crash-issue-130400.rs:2:26 diff --git a/tests/ui/mismatched_types/mismatch-args-vargs-issue-130372.stderr b/tests/ui/mismatched_types/mismatch-args-vargs-issue-130372.stderr index 38f76970358..7acc361fdb8 100644 --- a/tests/ui/mismatched_types/mismatch-args-vargs-issue-130372.stderr +++ b/tests/ui/mismatched_types/mismatch-args-vargs-issue-130372.stderr @@ -11,8 +11,9 @@ LL | unsafe extern "C" fn test_va_copy(_: u64, mut ap: ...) {} | ^^^^^^^^^^^^ ------ help: provide the argument | -LL | test_va_copy(/* u64 */); - | ~~~~~~~~~~~ +LL - test_va_copy(); +LL + test_va_copy(/* u64 */); + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/numeric-literal-cast.stderr b/tests/ui/mismatched_types/numeric-literal-cast.stderr index fcf3eccbcba..8ddadcc5a94 100644 --- a/tests/ui/mismatched_types/numeric-literal-cast.stderr +++ b/tests/ui/mismatched_types/numeric-literal-cast.stderr @@ -13,8 +13,9 @@ LL | fn foo(_: u16) {} | ^^^ ------ help: change the type of the numeric literal from `u8` to `u16` | -LL | foo(1u16); - | ~~~ +LL - foo(1u8); +LL + foo(1u16); + | error[E0308]: mismatched types --> $DIR/numeric-literal-cast.rs:8:10 @@ -31,8 +32,9 @@ LL | fn foo1(_: f64) {} | ^^^^ ------ help: change the type of the numeric literal from `f32` to `f64` | -LL | foo1(2f64); - | ~~~ +LL - foo1(2f32); +LL + foo1(2f64); + | error[E0308]: mismatched types --> $DIR/numeric-literal-cast.rs:10:10 @@ -49,8 +51,9 @@ LL | fn foo2(_: i32) {} | ^^^^ ------ help: change the type of the numeric literal from `i16` to `i32` | -LL | foo2(3i32); - | ~~~ +LL - foo2(3i16); +LL + foo2(3i32); + | error: aborting due to 3 previous errors diff --git a/tests/ui/mismatched_types/overloaded-calls-bad.stderr b/tests/ui/mismatched_types/overloaded-calls-bad.stderr index c52fa713615..9f5c35a3009 100644 --- a/tests/ui/mismatched_types/overloaded-calls-bad.stderr +++ b/tests/ui/mismatched_types/overloaded-calls-bad.stderr @@ -25,8 +25,9 @@ LL | impl FnMut<(isize,)> for S { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: provide the argument | -LL | let ans = s(/* isize */); - | ~~~~~~~~~~~~~ +LL - let ans = s(); +LL + let ans = s(/* isize */); + | error[E0057]: this function takes 1 argument but 2 arguments were supplied --> $DIR/overloaded-calls-bad.rs:37:15 diff --git a/tests/ui/mismatched_types/ref-pat-suggestions.stderr b/tests/ui/mismatched_types/ref-pat-suggestions.stderr index 148ed00b01d..d3b605fabf5 100644 --- a/tests/ui/mismatched_types/ref-pat-suggestions.stderr +++ b/tests/ui/mismatched_types/ref-pat-suggestions.stderr @@ -336,8 +336,9 @@ LL | let S(&mut _b) = S(0); | ^^^^^^^ help: consider removing `&mut` from the pattern | -LL | let S(_b) = S(0); - | ~~ +LL - let S(&mut _b) = S(0); +LL + let S(_b) = S(0); + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:31:14 diff --git a/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr b/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr index 40182a75a98..3f58efe19f5 100644 --- a/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr +++ b/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr @@ -12,8 +12,9 @@ LL | | } | help: you could change the return type to be a boxed trait object | -LL | fn foo() -> Box<dyn Trait> { - | ~~~~~~~ + +LL - fn foo() -> impl Trait { +LL + fn foo() -> Box<dyn Trait> { + | help: if you change the return type to expect trait objects, box the returned expressions | LL ~ Box::new(S) @@ -34,8 +35,9 @@ LL | | } | help: you could change the return type to be a boxed trait object | -LL | fn bar() -> Box<dyn Trait> { - | ~~~~~~~ + +LL - fn bar() -> impl Trait { +LL + fn bar() -> Box<dyn Trait> { + | help: if you change the return type to expect trait objects, box the returned expressions | LL ~ true => Box::new(S), diff --git a/tests/ui/mismatched_types/trait-impl-fn-incompatibility.stderr b/tests/ui/mismatched_types/trait-impl-fn-incompatibility.stderr index 2e544a62223..d232cc50e52 100644 --- a/tests/ui/mismatched_types/trait-impl-fn-incompatibility.stderr +++ b/tests/ui/mismatched_types/trait-impl-fn-incompatibility.stderr @@ -13,8 +13,9 @@ LL | fn foo(x: u16); found signature `fn(i16)` help: change the parameter type to match the trait | -LL | fn foo(x: u16) { } - | ~~~ +LL - fn foo(x: i16) { } +LL + fn foo(x: u16) { } + | error[E0053]: method `bar` has an incompatible type for trait --> $DIR/trait-impl-fn-incompatibility.rs:10:28 @@ -31,8 +32,9 @@ LL | fn bar(&mut self, bar: &mut Bar); found signature `fn(&mut Bar, &Bar)` help: change the parameter type to match the trait | -LL | fn bar(&mut self, bar: &mut Bar) { } - | ~~~~~~~~ +LL - fn bar(&mut self, bar: &Bar) { } +LL + fn bar(&mut self, bar: &mut Bar) { } + | error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/transforming-option-ref-issue-127545.stderr b/tests/ui/mismatched_types/transforming-option-ref-issue-127545.stderr index ad423f86ef9..9a18798db21 100644 --- a/tests/ui/mismatched_types/transforming-option-ref-issue-127545.stderr +++ b/tests/ui/mismatched_types/transforming-option-ref-issue-127545.stderr @@ -34,8 +34,9 @@ note: method defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: use `Option::map_or` to deref inner value of `Option` | -LL | arg.map_or(&[], |v| v) - | ~~~~~~ +++++++ +LL - arg.unwrap_or(&[]) +LL + arg.map_or(&[], |v| v) + | error[E0308]: mismatched types --> $DIR/transforming-option-ref-issue-127545.rs:13:19 @@ -58,8 +59,9 @@ note: method defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: use `Option::map_or` to deref inner value of `Option` | -LL | arg.map_or(v, |v| v) - | ~~~~~~ +++++++ +LL - arg.unwrap_or(v) +LL + arg.map_or(v, |v| v) + | error[E0308]: mismatched types --> $DIR/transforming-option-ref-issue-127545.rs:17:19 @@ -82,8 +84,9 @@ note: method defined here --> $SRC_DIR/core/src/result.rs:LL:COL help: use `Result::map_or` to deref inner value of `Result` | -LL | arg.map_or(&[], |v| v) - | ~~~~~~ +++++++ +LL - arg.unwrap_or(&[]) +LL + arg.map_or(&[], |v| v) + | error: aborting due to 4 previous errors diff --git a/tests/ui/missing/missing-block-hint.stderr b/tests/ui/missing/missing-block-hint.stderr index 7a08d70d0ce..15bf59f1482 100644 --- a/tests/ui/missing/missing-block-hint.stderr +++ b/tests/ui/missing/missing-block-hint.stderr @@ -11,8 +11,9 @@ LL | if (foo) => {} | ^^^^^ help: you might have meant to write a "greater than or equal to" comparison | -LL | if (foo) >= {} - | ~~ +LL - if (foo) => {} +LL + if (foo) >= {} + | error: expected `{`, found `bar` --> $DIR/missing-block-hint.rs:7:13 diff --git a/tests/ui/missing/missing-fields-in-struct-pattern.stderr b/tests/ui/missing/missing-fields-in-struct-pattern.stderr index 91a7bd3540e..1c69592985f 100644 --- a/tests/ui/missing/missing-fields-in-struct-pattern.stderr +++ b/tests/ui/missing/missing-fields-in-struct-pattern.stderr @@ -6,8 +6,9 @@ LL | if let S { a, b, c, d } = S(1, 2, 3, 4) { | help: use the tuple variant pattern syntax instead | -LL | if let S(a, b, c, d) = S(1, 2, 3, 4) { - | ~~~~~~~~~~~~ +LL - if let S { a, b, c, d } = S(1, 2, 3, 4) { +LL + if let S(a, b, c, d) = S(1, 2, 3, 4) { + | error: aborting due to 1 previous error diff --git a/tests/ui/missing/missing-items/missing-const-parameter.stderr b/tests/ui/missing/missing-items/missing-const-parameter.stderr index d9fea130651..c873e244815 100644 --- a/tests/ui/missing/missing-items/missing-const-parameter.stderr +++ b/tests/ui/missing/missing-items/missing-const-parameter.stderr @@ -52,8 +52,9 @@ LL | struct Image<const R: usize>([[u32; C]; R]); | help: a const parameter with a similar name exists | -LL | struct Image<const R: usize>([[u32; R]; R]); - | ~ +LL - struct Image<const R: usize>([[u32; C]; R]); +LL + struct Image<const R: usize>([[u32; R]; R]); + | help: you might be missing a const parameter | LL | struct Image<const R: usize, const C: /* Type */>([[u32; C]; R]); diff --git a/tests/ui/missing/missing-items/missing-type-parameter2.stderr b/tests/ui/missing/missing-items/missing-type-parameter2.stderr index f33951c98bf..f6418de20b6 100644 --- a/tests/ui/missing/missing-items/missing-type-parameter2.stderr +++ b/tests/ui/missing/missing-items/missing-type-parameter2.stderr @@ -9,8 +9,9 @@ LL | impl X<N> {} | help: a struct with a similar name exists | -LL | impl X<X> {} - | ~ +LL - impl X<N> {} +LL + impl X<X> {} + | help: you might be missing a type parameter | LL | impl<N> X<N> {} @@ -26,8 +27,9 @@ LL | impl<T, const A: u8 = 2> X<N> {} | help: a type parameter with a similar name exists | -LL | impl<T, const A: u8 = 2> X<T> {} - | ~ +LL - impl<T, const A: u8 = 2> X<N> {} +LL + impl<T, const A: u8 = 2> X<T> {} + | help: you might be missing a type parameter | LL | impl<T, const A: u8 = 2, N> X<N> {} @@ -44,8 +46,9 @@ LL | fn foo(_: T) where T: Send {} | help: a struct with a similar name exists | -LL | fn foo(_: T) where X: Send {} - | ~ +LL - fn foo(_: T) where T: Send {} +LL + fn foo(_: T) where X: Send {} + | help: you might be missing a type parameter | LL | fn foo<T>(_: T) where T: Send {} @@ -62,8 +65,9 @@ LL | fn foo(_: T) where T: Send {} | help: a struct with a similar name exists | -LL | fn foo(_: X) where T: Send {} - | ~ +LL - fn foo(_: T) where T: Send {} +LL + fn foo(_: X) where T: Send {} + | help: you might be missing a type parameter | LL | fn foo<T>(_: T) where T: Send {} @@ -80,8 +84,9 @@ LL | fn bar<const N: u8>(_: A) {} | help: a struct with a similar name exists | -LL | fn bar<const N: u8>(_: X) {} - | ~ +LL - fn bar<const N: u8>(_: A) {} +LL + fn bar<const N: u8>(_: X) {} + | help: you might be missing a type parameter | LL | fn bar<const N: u8, A>(_: A) {} diff --git a/tests/ui/moves/needs-clone-through-deref.stderr b/tests/ui/moves/needs-clone-through-deref.stderr index 1f9aefeb4dd..9890ad480a6 100644 --- a/tests/ui/moves/needs-clone-through-deref.stderr +++ b/tests/ui/moves/needs-clone-through-deref.stderr @@ -10,8 +10,9 @@ note: `into_iter` takes ownership of the receiver `self`, which moves value --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL help: you can `clone` the value and consume it, but this might not be your desired behavior | -LL | for _ in <Vec<usize> as Clone>::clone(&self).into_iter() {} - | ++++++++++++++++++++++++++++++ ~ +LL - for _ in self.clone().into_iter() {} +LL + for _ in <Vec<usize> as Clone>::clone(&self).into_iter() {} + | error: aborting due to 1 previous error diff --git a/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.stderr b/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.stderr index 755bbc5c21b..c626796e01d 100644 --- a/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.stderr +++ b/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.stderr @@ -10,8 +10,9 @@ note: `HashMap::<K, V, S>::into_values` takes ownership of the receiver `self`, --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL help: you could `clone` the value and consume it, if the `Hash128_1: Clone` trait bound could be satisfied | -LL | let mut copy: Vec<U> = <HashMap<T, U, Hash128_1> as Clone>::clone(&map).into_values().collect(); - | ++++++++++++++++++++++++++++++++++++++++++++ ~ +LL - let mut copy: Vec<U> = map.clone().into_values().collect(); +LL + let mut copy: Vec<U> = <HashMap<T, U, Hash128_1> as Clone>::clone(&map).into_values().collect(); + | help: consider annotating `Hash128_1` with `#[derive(Clone)]` | LL + #[derive(Clone)] diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr index 784945dbbae..d69e83cce9a 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr @@ -196,7 +196,7 @@ LL | [t, t]; help: consider further restricting type parameter `T` with trait `Copy` | LL | T:, T: Copy - | ~~~~~~~~~ + | +++++++ error: aborting due to 11 previous errors diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr index b80363fe8f8..412ea4aba30 100644 --- a/tests/ui/namespace/namespace-mix.stderr +++ b/tests/ui/namespace/namespace-mix.stderr @@ -11,7 +11,7 @@ LL | check(m1::S); help: a tuple struct with a similar name exists | LL | check(m1::TS); - | ~~ + | + help: consider importing one of these constants instead | LL + use m2::S; @@ -39,7 +39,7 @@ LL | pub struct TS(); help: a tuple struct with a similar name exists | LL | check(xm1::TS); - | ~~ + | + help: consider importing one of these constants instead | LL + use m2::S; @@ -65,7 +65,7 @@ LL | check(m7::V); help: a tuple variant with a similar name exists | LL | check(m7::TV); - | ~~ + | + help: consider importing one of these constants instead | LL + use m8::V; @@ -93,7 +93,7 @@ LL | TV(), help: a tuple variant with a similar name exists | LL | check(xm7::TV); - | ~~ + | + help: consider importing one of these constants instead | LL + use m8::V; 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 ea3b39c3000..bf37cc7b4b4 100644 --- a/tests/ui/never_type/dependency-on-fallback-to-unit.stderr +++ b/tests/ui/never_type/dependency-on-fallback-to-unit.stderr @@ -15,8 +15,9 @@ LL | false => <_>::default(), = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default help: use `()` annotations to avoid fallback changes | -LL | false => <()>::default(), - | ~~ +LL - false => <_>::default(), +LL + false => <()>::default(), + | warning: this function depends on never type fallback being `()` --> $DIR/dependency-on-fallback-to-unit.rs:19:1 diff --git a/tests/ui/never_type/dont-suggest-turbofish-from-expansion.rs b/tests/ui/never_type/dont-suggest-turbofish-from-expansion.rs new file mode 100644 index 00000000000..9a53358464d --- /dev/null +++ b/tests/ui/never_type/dont-suggest-turbofish-from-expansion.rs @@ -0,0 +1,20 @@ +#![deny(dependency_on_unit_never_type_fallback)] + +fn create_ok_default<C>() -> Result<C, ()> +where + C: Default, +{ + Ok(C::default()) +} + +fn main() -> Result<(), ()> { + //~^ ERROR this function depends on never type fallback being `()` + //~| WARN this was previously accepted by the compiler but is being phased out + let (returned_value, _) = (|| { + let created = create_ok_default()?; + Ok((created, ())) + })()?; + + let _ = format_args!("{:?}", returned_value); + Ok(()) +} diff --git a/tests/ui/never_type/dont-suggest-turbofish-from-expansion.stderr b/tests/ui/never_type/dont-suggest-turbofish-from-expansion.stderr new file mode 100644 index 00000000000..3fe642a8401 --- /dev/null +++ b/tests/ui/never_type/dont-suggest-turbofish-from-expansion.stderr @@ -0,0 +1,26 @@ +error: this function depends on never type fallback being `()` + --> $DIR/dont-suggest-turbofish-from-expansion.rs:10:1 + | +LL | fn main() -> Result<(), ()> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/never-type-fallback.html> + = help: specify the types explicitly +note: in edition 2024, the requirement `!: Default` will fail + --> $DIR/dont-suggest-turbofish-from-expansion.rs:14:23 + | +LL | let created = create_ok_default()?; + | ^^^^^^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/dont-suggest-turbofish-from-expansion.rs:1:9 + | +LL | #![deny(dependency_on_unit_never_type_fallback)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: use `()` annotations to avoid fallback changes + | +LL | let created: () = create_ok_default()?; + | ++++ + +error: aborting due to 1 previous error + diff --git a/tests/ui/never_type/fallback-closure-wrap.fallback.stderr b/tests/ui/never_type/fallback-closure-wrap.fallback.stderr index aa4a2760ffd..ac99a1fc24c 100644 --- a/tests/ui/never_type/fallback-closure-wrap.fallback.stderr +++ b/tests/ui/never_type/fallback-closure-wrap.fallback.stderr @@ -1,16 +1,15 @@ -error[E0271]: expected `{closure@fallback-closure-wrap.rs:18:40}` to be a closure that returns `()`, but it returns `!` - --> $DIR/fallback-closure-wrap.rs:18:31 +error[E0271]: expected `{closure@fallback-closure-wrap.rs:18:40}` to return `()`, but it returns `!` + --> $DIR/fallback-closure-wrap.rs:19:9 | -LL | let error = Closure::wrap(Box::new(move || { - | _______________________________^ -LL | | -LL | | panic!("Can't connect to server."); -LL | | }) as Box<dyn FnMut()>); - | |______^ expected `()`, found `!` +LL | let error = Closure::wrap(Box::new(move || { + | ------- this closure +LL | panic!("Can't connect to server."); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `!` | = note: expected unit type `()` found type `!` = note: required for the cast from `Box<{closure@$DIR/fallback-closure-wrap.rs:18:40: 18:47}>` to `Box<dyn FnMut()>` + = note: this error originates in the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/never_type/fallback-closure-wrap.rs b/tests/ui/never_type/fallback-closure-wrap.rs index 27020289c68..e7f7d5aae3f 100644 --- a/tests/ui/never_type/fallback-closure-wrap.rs +++ b/tests/ui/never_type/fallback-closure-wrap.rs @@ -16,8 +16,8 @@ use std::marker::PhantomData; fn main() { let error = Closure::wrap(Box::new(move || { - //[fallback]~^ to be a closure that returns `()`, but it returns `!` panic!("Can't connect to server."); + //[fallback]~^ to return `()`, but it returns `!` }) as Box<dyn FnMut()>); } diff --git a/tests/ui/never_type/issue-52443.stderr b/tests/ui/never_type/issue-52443.stderr index 1c5a0d65142..bb60c33595c 100644 --- a/tests/ui/never_type/issue-52443.stderr +++ b/tests/ui/never_type/issue-52443.stderr @@ -31,7 +31,7 @@ help: give the `break` a value of the expected type LL | [(); loop { break 42 }]; | ++ -error[E0015]: cannot use `for` loop on `RangeFrom<usize>` in constants +error[E0015]: cannot use `for` loop on `std::ops::RangeFrom<usize>` in constants --> $DIR/issue-52443.rs:9:21 | LL | [(); { for _ in 0usize.. {}; 0}]; @@ -39,7 +39,7 @@ LL | [(); { for _ in 0usize.. {}; 0}]; | = note: calls in constants are limited to constant functions, tuple structs and tuple variants -error[E0015]: cannot use `for` loop on `RangeFrom<usize>` in constants +error[E0015]: cannot use `for` loop on `std::ops::RangeFrom<usize>` in constants --> $DIR/issue-52443.rs:9:21 | LL | [(); { for _ in 0usize.. {}; 0}]; diff --git a/tests/ui/never_type/issue-96335.stderr b/tests/ui/never_type/issue-96335.stderr index c3d80a425e0..1193973d5ee 100644 --- a/tests/ui/never_type/issue-96335.stderr +++ b/tests/ui/never_type/issue-96335.stderr @@ -6,12 +6,14 @@ LL | 0.....{loop{}1}; | help: use `..` for an exclusive range | -LL | 0....{loop{}1}; - | ~~ +LL - 0.....{loop{}1}; +LL + 0....{loop{}1}; + | help: or `..=` for an inclusive range | -LL | 0..=..{loop{}1}; - | ~~~ +LL - 0.....{loop{}1}; +LL + 0..=..{loop{}1}; + | error[E0308]: mismatched types --> $DIR/issue-96335.rs:2:9 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 04cd2fcafd6..49b966f32ce 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 @@ -130,10 +130,6 @@ LL | msg_send!(); = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly = note: this warning originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) -help: use `()` annotations to avoid fallback changes - | -LL | match send_message::<() /* ?0 */>() { - | ~~ warning: 10 warnings emitted 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 7adba2cc709..4d3692a7b04 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 @@ -130,10 +130,6 @@ LL | msg_send!(); = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/never-type-fallback.html> = help: specify the type explicitly = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) -help: use `()` annotations to avoid fallback changes - | -LL | match send_message::<() /* ?0 */>() { - | ~~ warning: the type `!` does not permit zero-initialization --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:12:18 diff --git a/tests/ui/new-range/disabled.rs b/tests/ui/new-range/disabled.rs new file mode 100644 index 00000000000..1a5fe3f9743 --- /dev/null +++ b/tests/ui/new-range/disabled.rs @@ -0,0 +1,27 @@ +//@ check-pass + +#![feature(new_range_api)] + +fn main() { + // Unchanged + let a: core::range::RangeFull = ..; + let b: core::range::RangeTo<u8> = ..2; + let c: core::range::RangeToInclusive<u8> = ..=3; + + let _: core::ops::RangeFull = a; + let _: core::ops::RangeTo<u8> = b; + let _: core::ops::RangeToInclusive<u8> = c; + + // Changed + let a: core::range::legacy::RangeFrom<u8> = 1..; + let b: core::range::legacy::Range<u8> = 2..3; + let c: core::range::legacy::RangeInclusive<u8> = 4..=5; + + let a: core::ops::RangeFrom<u8> = a; + let b: core::ops::Range<u8> = b; + let c: core::ops::RangeInclusive<u8> = c; + + let _: core::ops::RangeFrom<u8> = a.into_iter(); + let _: core::ops::Range<u8> = b.into_iter(); + let _: core::ops::RangeInclusive<u8> = c.into_iter(); +} diff --git a/tests/ui/new-range/enabled.rs b/tests/ui/new-range/enabled.rs new file mode 100644 index 00000000000..a5fb76ad52b --- /dev/null +++ b/tests/ui/new-range/enabled.rs @@ -0,0 +1,24 @@ +//@ check-pass + +#![feature(new_range_api)] +#![feature(new_range)] + +fn main() { + // Unchanged + let a: core::range::RangeFull = ..; + let b: core::range::RangeTo<u8> = ..2; + let c: core::range::RangeToInclusive<u8> = ..=3; + + let _: core::ops::RangeFull = a; + let _: core::ops::RangeTo<u8> = b; + let _: core::ops::RangeToInclusive<u8> = c; + + // Changed + let a: core::range::RangeFrom<u8> = 1..; + let b: core::range::Range<u8> = 2..3; + let c: core::range::RangeInclusive<u8> = 4..=5; + + let _: core::range::IterRangeFrom<u8> = a.into_iter(); + let _: core::range::IterRange<u8> = b.into_iter(); + let _: core::range::IterRangeInclusive<u8> = c.into_iter(); +} 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 1f01d3e8260..7e11b23d681 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 @@ -9,8 +9,9 @@ LL | S1 { a: unsafe { &mut X1 } } = note: `#[warn(static_mut_refs)]` on by default help: use `&raw mut` instead to create a raw pointer | -LL | S1 { a: unsafe { &raw mut X1 } } - | ~~~~~~~~ +LL - S1 { a: unsafe { &mut X1 } } +LL + S1 { a: unsafe { &raw mut X1 } } + | warning: 1 warning emitted diff --git a/tests/ui/nll/check-normalized-sig-for-wf.stderr b/tests/ui/nll/check-normalized-sig-for-wf.current.stderr index 5c96b0c6561..b25ae72f7fb 100644 --- a/tests/ui/nll/check-normalized-sig-for-wf.stderr +++ b/tests/ui/nll/check-normalized-sig-for-wf.current.stderr @@ -1,5 +1,5 @@ error[E0597]: `s` does not live long enough - --> $DIR/check-normalized-sig-for-wf.rs:7:7 + --> $DIR/check-normalized-sig-for-wf.rs:11:7 | LL | s: String, | - binding `s` declared here @@ -14,7 +14,7 @@ LL | } | - `s` dropped here while still borrowed error[E0521]: borrowed data escapes outside of function - --> $DIR/check-normalized-sig-for-wf.rs:15:5 + --> $DIR/check-normalized-sig-for-wf.rs:19:5 | LL | fn extend<T>(input: &T) -> &'static T { | ----- - let's call the lifetime of this reference `'1` @@ -28,7 +28,7 @@ LL | n(input).0 | argument requires that `'1` must outlive `'static` error[E0521]: borrowed data escapes outside of function - --> $DIR/check-normalized-sig-for-wf.rs:23:5 + --> $DIR/check-normalized-sig-for-wf.rs:27:5 | LL | fn extend_mut<'a, T>(input: &'a mut T) -> &'static mut T { | -- ----- `input` is a reference that is only valid in the function body diff --git a/tests/ui/nll/check-normalized-sig-for-wf.next.stderr b/tests/ui/nll/check-normalized-sig-for-wf.next.stderr new file mode 100644 index 00000000000..b25ae72f7fb --- /dev/null +++ b/tests/ui/nll/check-normalized-sig-for-wf.next.stderr @@ -0,0 +1,47 @@ +error[E0597]: `s` does not live long enough + --> $DIR/check-normalized-sig-for-wf.rs:11:7 + | +LL | s: String, + | - binding `s` declared here +... +LL | f(&s).0 + | --^^- + | | | + | | borrowed value does not live long enough + | argument requires that `s` is borrowed for `'static` +LL | +LL | } + | - `s` dropped here while still borrowed + +error[E0521]: borrowed data escapes outside of function + --> $DIR/check-normalized-sig-for-wf.rs:19:5 + | +LL | fn extend<T>(input: &T) -> &'static T { + | ----- - let's call the lifetime of this reference `'1` + | | + | `input` is a reference that is only valid in the function body +... +LL | n(input).0 + | ^^^^^^^^ + | | + | `input` escapes the function body here + | argument requires that `'1` must outlive `'static` + +error[E0521]: borrowed data escapes outside of function + --> $DIR/check-normalized-sig-for-wf.rs:27:5 + | +LL | fn extend_mut<'a, T>(input: &'a mut T) -> &'static mut T { + | -- ----- `input` is a reference that is only valid in the function body + | | + | lifetime `'a` defined here +... +LL | n(input).0 + | ^^^^^^^^ + | | + | `input` escapes the function body here + | argument requires that `'a` must outlive `'static` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0521, E0597. +For more information about an error, try `rustc --explain E0521`. diff --git a/tests/ui/nll/check-normalized-sig-for-wf.rs b/tests/ui/nll/check-normalized-sig-for-wf.rs index cb0f34ce02f..9d7411fd812 100644 --- a/tests/ui/nll/check-normalized-sig-for-wf.rs +++ b/tests/ui/nll/check-normalized-sig-for-wf.rs @@ -1,3 +1,7 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + // <https://github.com/rust-lang/rust/issues/114936> fn whoops( s: String, diff --git a/tests/ui/nll/get_default.legacy.stderr b/tests/ui/nll/get_default.legacy.stderr new file mode 100644 index 00000000000..699250312dc --- /dev/null +++ b/tests/ui/nll/get_default.legacy.stderr @@ -0,0 +1,18 @@ +error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable + --> $DIR/get_default.rs:35:17 + | +LL | fn err(map: &mut Map) -> &String { + | - let's call the lifetime of this reference `'1` +LL | loop { +LL | match map.get() { + | --- immutable borrow occurs here +LL | Some(v) => { +LL | map.set(String::new()); // We always expect an error here. + | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here +LL | +LL | return v; + | - returning this value requires that `*map` is borrowed for `'1` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/nll/get_default.stderr b/tests/ui/nll/get_default.nll.stderr index af79771e7e1..9b5976ca717 100644 --- a/tests/ui/nll/get_default.stderr +++ b/tests/ui/nll/get_default.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable - --> $DIR/get_default.rs:21:17 + --> $DIR/get_default.rs:24:17 | LL | fn ok(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` @@ -14,7 +14,7 @@ LL | map.set(String::new()); // Ideally, this would not error. | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable - --> $DIR/get_default.rs:32:17 + --> $DIR/get_default.rs:35:17 | LL | fn err(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` @@ -22,14 +22,14 @@ LL | loop { LL | match map.get() { | --- immutable borrow occurs here LL | Some(v) => { -LL | map.set(String::new()); // Both AST and MIR error here +LL | map.set(String::new()); // We always expect an error here. | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | LL | return v; | - returning this value requires that `*map` is borrowed for `'1` error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable - --> $DIR/get_default.rs:37:17 + --> $DIR/get_default.rs:40:17 | LL | fn err(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` @@ -40,7 +40,7 @@ LL | match map.get() { LL | return v; | - returning this value requires that `*map` is borrowed for `'1` ... -LL | map.set(String::new()); // Ideally, just AST would error here +LL | map.set(String::new()); // Ideally, this would not error. | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here error: aborting due to 3 previous errors diff --git a/tests/ui/nll/get_default.polonius.stderr b/tests/ui/nll/get_default.polonius.stderr new file mode 100644 index 00000000000..699250312dc --- /dev/null +++ b/tests/ui/nll/get_default.polonius.stderr @@ -0,0 +1,18 @@ +error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable + --> $DIR/get_default.rs:35:17 + | +LL | fn err(map: &mut Map) -> &String { + | - let's call the lifetime of this reference `'1` +LL | loop { +LL | match map.get() { + | --- immutable borrow occurs here +LL | Some(v) => { +LL | map.set(String::new()); // We always expect an error here. + | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here +LL | +LL | return v; + | - returning this value requires that `*map` is borrowed for `'1` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/nll/get_default.rs b/tests/ui/nll/get_default.rs index ffac8a33da1..c3c09e9c2c5 100644 --- a/tests/ui/nll/get_default.rs +++ b/tests/ui/nll/get_default.rs @@ -1,7 +1,10 @@ // Basic test for free regions in the NLL code. This test ought to -// report an error due to a reborrowing constraint. Right now, we get -// a variety of errors from the older, AST-based machinery (notably -// borrowck), and then we get the NLL error at the end. +// report an error due to a reborrowing constraint. + +//@ ignore-compare-mode-polonius (explicit revisions) +//@ revisions: nll polonius legacy +//@ [polonius] compile-flags: -Z polonius=next +//@ [legacy] compile-flags: -Z polonius=legacy struct Map { } @@ -19,7 +22,7 @@ fn ok(map: &mut Map) -> &String { } None => { map.set(String::new()); // Ideally, this would not error. - //~^ ERROR borrowed as immutable + //[nll]~^ ERROR borrowed as immutable } } } @@ -29,13 +32,13 @@ fn err(map: &mut Map) -> &String { loop { match map.get() { Some(v) => { - map.set(String::new()); // Both AST and MIR error here + map.set(String::new()); // We always expect an error here. //~^ ERROR borrowed as immutable return v; } None => { - map.set(String::new()); // Ideally, just AST would error here - //~^ ERROR borrowed as immutable + map.set(String::new()); // Ideally, this would not error. + //[nll]~^ ERROR borrowed as immutable } } } diff --git a/tests/ui/nll/issue-46589.stderr b/tests/ui/nll/issue-46589.nll.stderr index abf62aaa510..dc80c1d08de 100644 --- a/tests/ui/nll/issue-46589.stderr +++ b/tests/ui/nll/issue-46589.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `**other` as mutable more than once at a time - --> $DIR/issue-46589.rs:23:21 + --> $DIR/issue-46589.rs:24:21 | LL | *other = match (*other).get_self() { | -------- first mutable borrow occurs here diff --git a/tests/ui/nll/issue-46589.rs b/tests/ui/nll/issue-46589.rs index 417d9cab657..10aff0d7b4e 100644 --- a/tests/ui/nll/issue-46589.rs +++ b/tests/ui/nll/issue-46589.rs @@ -1,8 +1,9 @@ -// This tests passes in Polonius mode, so is skipped in the automated compare-mode. -// We will manually check it passes in Polonius tests, as we can't have a test here -// which conditionally passes depending on a test revision/compile-flags. - -//@ ignore-compare-mode-polonius +//@ ignore-compare-mode-polonius (explicit revisions) +//@ revisions: nll polonius_next polonius +//@ [polonius_next] check-pass +//@ [polonius_next] compile-flags: -Zpolonius=next +//@ [polonius] check-pass +//@ [polonius] compile-flags: -Zpolonius struct Foo; @@ -21,7 +22,7 @@ impl Foo { *other = match (*other).get_self() { Some(s) => s, None => (*other).new_self() - //~^ ERROR cannot borrow `**other` as mutable more than once at a time [E0499] + //[nll]~^ ERROR cannot borrow `**other` as mutable more than once at a time [E0499] }; let c = other; diff --git a/tests/ui/nll/normalization-bounds-error.stderr b/tests/ui/nll/normalization-bounds-error.stderr index d4254881863..47d2663313d 100644 --- a/tests/ui/nll/normalization-bounds-error.stderr +++ b/tests/ui/nll/normalization-bounds-error.stderr @@ -1,4 +1,4 @@ -error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'d` due to conflicting requirements +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'d` due to conflicting requirements --> $DIR/normalization-bounds-error.rs:12:31 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} @@ -36,4 +36,4 @@ LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0495`. +For more information about this error, try `rustc --explain E0803`. diff --git a/tests/ui/nll/polonius/assignment-kills-loans.rs b/tests/ui/nll/polonius/assignment-kills-loans.rs index 182262e5c4b..56ea9c2f1f9 100644 --- a/tests/ui/nll/polonius/assignment-kills-loans.rs +++ b/tests/ui/nll/polonius/assignment-kills-loans.rs @@ -4,8 +4,11 @@ // facts only on simple assignments, but not projections, incorrectly causing errors to be emitted // for code accepted by NLL. They are all variations from example code in the NLL RFC. +//@ ignore-compare-mode-polonius (explicit revisions) +//@ revisions: polonius_next polonius //@ check-pass -//@ compile-flags: -Z polonius +//@ [polonius_next] compile-flags: -Z polonius=next +//@ [polonius] compile-flags: -Z polonius struct List<T> { value: T, diff --git a/tests/ui/nll/polonius/assignment-to-differing-field.stderr b/tests/ui/nll/polonius/assignment-to-differing-field.legacy.stderr index c46d010e4f5..cf5594dbd07 100644 --- a/tests/ui/nll/polonius/assignment-to-differing-field.stderr +++ b/tests/ui/nll/polonius/assignment-to-differing-field.legacy.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `list.0.value` as mutable more than once at a time - --> $DIR/assignment-to-differing-field.rs:20:21 + --> $DIR/assignment-to-differing-field.rs:23:21 | LL | fn assignment_to_field_projection<'a, T>( | -- lifetime `'a` defined here @@ -11,7 +11,7 @@ LL | return result; | ------ returning this value requires that `list.0.value` is borrowed for `'a` error[E0499]: cannot borrow `list.0.next` as mutable more than once at a time - --> $DIR/assignment-to-differing-field.rs:23:26 + --> $DIR/assignment-to-differing-field.rs:26:26 | LL | fn assignment_to_field_projection<'a, T>( | -- lifetime `'a` defined here @@ -23,7 +23,7 @@ LL | list.1 = n; | ---------- assignment requires that `list.0.next` is borrowed for `'a` error[E0499]: cannot borrow `list.0.0.0.0.0.value` as mutable more than once at a time - --> $DIR/assignment-to-differing-field.rs:37:21 + --> $DIR/assignment-to-differing-field.rs:40:21 | LL | fn assignment_through_projection_chain<'a, T>( | -- lifetime `'a` defined here @@ -35,7 +35,7 @@ LL | return result; | ------ returning this value requires that `list.0.0.0.0.0.value` is borrowed for `'a` error[E0499]: cannot borrow `list.0.0.0.0.0.next` as mutable more than once at a time - --> $DIR/assignment-to-differing-field.rs:40:26 + --> $DIR/assignment-to-differing-field.rs:43:26 | LL | fn assignment_through_projection_chain<'a, T>( | -- lifetime `'a` defined here diff --git a/tests/ui/nll/polonius/assignment-to-differing-field.polonius.stderr b/tests/ui/nll/polonius/assignment-to-differing-field.polonius.stderr new file mode 100644 index 00000000000..cf5594dbd07 --- /dev/null +++ b/tests/ui/nll/polonius/assignment-to-differing-field.polonius.stderr @@ -0,0 +1,51 @@ +error[E0499]: cannot borrow `list.0.value` as mutable more than once at a time + --> $DIR/assignment-to-differing-field.rs:23:21 + | +LL | fn assignment_to_field_projection<'a, T>( + | -- lifetime `'a` defined here +... +LL | result.push(&mut (list.0).value); + | ^^^^^^^^^^^^^^^^^^^ `list.0.value` was mutably borrowed here in the previous iteration of the loop +... +LL | return result; + | ------ returning this value requires that `list.0.value` is borrowed for `'a` + +error[E0499]: cannot borrow `list.0.next` as mutable more than once at a time + --> $DIR/assignment-to-differing-field.rs:26:26 + | +LL | fn assignment_to_field_projection<'a, T>( + | -- lifetime `'a` defined here +... +LL | if let Some(n) = (list.0).next.as_mut() { + | ^^^^^^^^^^^^^ `list.0.next` was mutably borrowed here in the previous iteration of the loop +LL | +LL | list.1 = n; + | ---------- assignment requires that `list.0.next` is borrowed for `'a` + +error[E0499]: cannot borrow `list.0.0.0.0.0.value` as mutable more than once at a time + --> $DIR/assignment-to-differing-field.rs:40:21 + | +LL | fn assignment_through_projection_chain<'a, T>( + | -- lifetime `'a` defined here +... +LL | result.push(&mut ((((list.0).0).0).0).0.value); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `list.0.0.0.0.0.value` was mutably borrowed here in the previous iteration of the loop +... +LL | return result; + | ------ returning this value requires that `list.0.0.0.0.0.value` is borrowed for `'a` + +error[E0499]: cannot borrow `list.0.0.0.0.0.next` as mutable more than once at a time + --> $DIR/assignment-to-differing-field.rs:43:26 + | +LL | fn assignment_through_projection_chain<'a, T>( + | -- lifetime `'a` defined here +... +LL | if let Some(n) = ((((list.0).0).0).0).0.next.as_mut() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `list.0.0.0.0.0.next` was mutably borrowed here in the previous iteration of the loop +LL | +LL | *((((list.0).0).0).0).1 = n; + | --------------------------- assignment requires that `list.0.0.0.0.0.next` is borrowed for `'a` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/nll/polonius/assignment-to-differing-field.rs b/tests/ui/nll/polonius/assignment-to-differing-field.rs index fb6c9569525..9701cd2bb5e 100644 --- a/tests/ui/nll/polonius/assignment-to-differing-field.rs +++ b/tests/ui/nll/polonius/assignment-to-differing-field.rs @@ -4,7 +4,10 @@ // that we do not kill too many borrows. Assignments to the `.1` // field projections should leave the borrows on `.0` intact. -//@ compile-flags: -Z polonius +//@ ignore-compare-mode-polonius (explicit revisions) +//@ revisions: polonius legacy +//@ [polonius] compile-flags: -Z polonius=next +//@ [legacy] compile-flags: -Z polonius=legacy struct List<T> { value: T, diff --git a/tests/ui/nll/polonius/call-kills-loans.rs b/tests/ui/nll/polonius/call-kills-loans.rs index c02293c9a78..0657c42f48c 100644 --- a/tests/ui/nll/polonius/call-kills-loans.rs +++ b/tests/ui/nll/polonius/call-kills-loans.rs @@ -4,8 +4,11 @@ // by NLL but was incorrectly rejected by Polonius because of these // missing `killed` facts. +//@ ignore-compare-mode-polonius (explicit revisions) +//@ revisions: polonius_next polonius //@ check-pass -//@ compile-flags: -Z polonius +//@ [polonius_next] compile-flags: -Z polonius=next +//@ [polonius] compile-flags: -Z polonius struct Thing; diff --git a/tests/ui/nll/polonius/issue-46589.rs b/tests/ui/nll/polonius/issue-46589.rs deleted file mode 100644 index af791f7e24d..00000000000 --- a/tests/ui/nll/polonius/issue-46589.rs +++ /dev/null @@ -1,31 +0,0 @@ -// This test is a copy of `ui/nll/issue-46589.rs` which fails in NLL but succeeds in Polonius. -// As we can't have a test here which conditionally passes depending on a test -// revision/compile-flags. We ensure here that it passes in Polonius mode. - -//@ check-pass -//@ compile-flags: -Z polonius - -struct Foo; - -impl Foo { - fn get_self(&mut self) -> Option<&mut Self> { - Some(self) - } - - fn new_self(&mut self) -> &mut Self { - self - } - - fn trigger_bug(&mut self) { - let other = &mut (&mut *self); - - *other = match (*other).get_self() { - Some(s) => s, - None => (*other).new_self() - }; - - let c = other; - } -} - -fn main() {} diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-liveness.rs b/tests/ui/nll/polonius/location-insensitive-scopes-liveness.rs index cb56c8f6deb..677b7aa1df8 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-liveness.rs +++ b/tests/ui/nll/polonius/location-insensitive-scopes-liveness.rs @@ -5,9 +5,11 @@ // than `liveness::trace`, on some specific CFGs shapes: a variable was dead during tracing but its // regions were marked live later, and live loans were not recomputed at this point. +//@ ignore-compare-mode-polonius (explicit revisions) +//@ revisions: polonius_next polonius //@ check-pass -//@ revisions: nll polonius -//@ [polonius] compile-flags: -Zpolonius=next +//@ [polonius_next] compile-flags: -Z polonius=next +//@ [polonius] compile-flags: -Z polonius // minimized from wavefc-cli-3.0.0 fn repro1() { diff --git a/tests/ui/nll/polonius/polonius-smoke-test.stderr b/tests/ui/nll/polonius/polonius-smoke-test.legacy.stderr index a8a8267290d..1268f6167f8 100644 --- a/tests/ui/nll/polonius/polonius-smoke-test.stderr +++ b/tests/ui/nll/polonius/polonius-smoke-test.legacy.stderr @@ -1,11 +1,11 @@ error[E0515]: cannot return reference to local variable `x` - --> $DIR/polonius-smoke-test.rs:6:5 + --> $DIR/polonius-smoke-test.rs:10:5 | LL | &x | ^^ returns a reference to data owned by the current function error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/polonius-smoke-test.rs:12:13 + --> $DIR/polonius-smoke-test.rs:16:13 | LL | let y = &mut x; | ------ `x` is borrowed here @@ -15,7 +15,7 @@ LL | let w = y; | - borrow later used here error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/polonius-smoke-test.rs:18:13 + --> $DIR/polonius-smoke-test.rs:22:13 | LL | pub fn use_while_mut_fr(x: &mut i32) -> &mut i32 { | - - let's call the lifetime of this reference `'1` @@ -35,7 +35,7 @@ LL + let y = &mut x.clone(); | error[E0505]: cannot move out of `s` because it is borrowed - --> $DIR/polonius-smoke-test.rs:42:5 + --> $DIR/polonius-smoke-test.rs:46:5 | LL | let s = &mut 1; | - binding `s` declared here diff --git a/tests/ui/nll/polonius/polonius-smoke-test.polonius.stderr b/tests/ui/nll/polonius/polonius-smoke-test.polonius.stderr new file mode 100644 index 00000000000..1268f6167f8 --- /dev/null +++ b/tests/ui/nll/polonius/polonius-smoke-test.polonius.stderr @@ -0,0 +1,59 @@ +error[E0515]: cannot return reference to local variable `x` + --> $DIR/polonius-smoke-test.rs:10:5 + | +LL | &x + | ^^ returns a reference to data owned by the current function + +error[E0503]: cannot use `x` because it was mutably borrowed + --> $DIR/polonius-smoke-test.rs:16:13 + | +LL | let y = &mut x; + | ------ `x` is borrowed here +LL | let z = x; + | ^ use of borrowed `x` +LL | let w = y; + | - borrow later used here + +error[E0505]: cannot move out of `x` because it is borrowed + --> $DIR/polonius-smoke-test.rs:22:13 + | +LL | pub fn use_while_mut_fr(x: &mut i32) -> &mut i32 { + | - - let's call the lifetime of this reference `'1` + | | + | binding `x` declared here +LL | let y = &mut *x; + | ------- borrow of `*x` occurs here +LL | let z = x; + | ^ move out of `x` occurs here +LL | y + | - returning this value requires that `*x` is borrowed for `'1` + | +help: consider cloning the value if the performance cost is acceptable + | +LL - let y = &mut *x; +LL + let y = &mut x.clone(); + | + +error[E0505]: cannot move out of `s` because it is borrowed + --> $DIR/polonius-smoke-test.rs:46:5 + | +LL | let s = &mut 1; + | - binding `s` declared here +LL | let r = &mut *s; + | ------- borrow of `*s` occurs here +LL | let tmp = foo(&r); +LL | s; + | ^ move out of `s` occurs here +LL | tmp; + | --- borrow later used here + | +help: consider cloning the value if the performance cost is acceptable + | +LL - let r = &mut *s; +LL + let r = &mut s.clone(); + | + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0503, E0505, E0515. +For more information about an error, try `rustc --explain E0503`. diff --git a/tests/ui/nll/polonius/polonius-smoke-test.rs b/tests/ui/nll/polonius/polonius-smoke-test.rs index ea5cdb263f5..7fbb3f9b47c 100644 --- a/tests/ui/nll/polonius/polonius-smoke-test.rs +++ b/tests/ui/nll/polonius/polonius-smoke-test.rs @@ -1,5 +1,9 @@ -// Check that Polonius borrow check works for simple cases. -//@ compile-flags: -Z polonius +// Check that Polonius works for simple cases. + +//@ ignore-compare-mode-polonius (explicit revisions) +//@ revisions: polonius legacy +//@ [polonius] compile-flags: -Z polonius=next +//@ [legacy] compile-flags: -Z polonius=legacy pub fn return_ref_to_local() -> &'static i32 { let x = 0; diff --git a/tests/ui/nll/polonius/storagedead-kills-loans.rs b/tests/ui/nll/polonius/storagedead-kills-loans.rs index 89cf919bb48..75a37e6ece5 100644 --- a/tests/ui/nll/polonius/storagedead-kills-loans.rs +++ b/tests/ui/nll/polonius/storagedead-kills-loans.rs @@ -3,8 +3,11 @@ // is correctly accepted by NLL but was incorrectly rejected by // Polonius because of these missing `killed` facts. +//@ ignore-compare-mode-polonius (explicit revisions) +//@ revisions: polonius_next polonius //@ check-pass -//@ compile-flags: -Z polonius +//@ [polonius_next] compile-flags: -Z polonius=next +//@ [polonius] compile-flags: -Z polonius use std::{io, mem}; use std::io::Read; diff --git a/tests/ui/nll/polonius/subset-relations.stderr b/tests/ui/nll/polonius/subset-relations.legacy.stderr index 9deca6449a8..10d42ca58d9 100644 --- a/tests/ui/nll/polonius/subset-relations.stderr +++ b/tests/ui/nll/polonius/subset-relations.legacy.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/subset-relations.rs:10:5 + --> $DIR/subset-relations.rs:13:5 | LL | fn missing_subset<'a, 'b>(x: &'a u32, y: &'b u32) -> &'a u32 { | -- -- lifetime `'b` defined here diff --git a/tests/ui/nll/polonius/subset-relations.polonius.stderr b/tests/ui/nll/polonius/subset-relations.polonius.stderr new file mode 100644 index 00000000000..10d42ca58d9 --- /dev/null +++ b/tests/ui/nll/polonius/subset-relations.polonius.stderr @@ -0,0 +1,14 @@ +error: lifetime may not live long enough + --> $DIR/subset-relations.rs:13:5 + | +LL | fn missing_subset<'a, 'b>(x: &'a u32, y: &'b u32) -> &'a u32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | y + | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + | + = help: consider adding the following bound: `'b: 'a` + +error: aborting due to 1 previous error + diff --git a/tests/ui/nll/polonius/subset-relations.rs b/tests/ui/nll/polonius/subset-relations.rs index 3c1af1983cf..d47e4e05533 100644 --- a/tests/ui/nll/polonius/subset-relations.rs +++ b/tests/ui/nll/polonius/subset-relations.rs @@ -3,7 +3,10 @@ // two free regions outlive each other, without any evidence that this // relation holds. -//@ compile-flags: -Z polonius +//@ ignore-compare-mode-polonius (explicit revisions) +//@ revisions: polonius legacy +//@ [polonius] compile-flags: -Z polonius=next +//@ [legacy] compile-flags: -Z polonius=legacy // returning `y` requires that `'b: 'a`, but it's not known to be true fn missing_subset<'a, 'b>(x: &'a u32, y: &'b u32) -> &'a u32 { @@ -22,7 +25,7 @@ fn implied_bounds_subset<'a, 'b>(x: &'a &'b mut u32) -> &'a u32 { // `'b: 'a` is declared, and `'a: 'c` is known via implied bounds: // `'b: 'c` is therefore known to hold transitively -fn transitively_valid_subset<'a, 'b: 'a, 'c>(x: &'c &'a u32, y: &'b u32) -> &'c u32 { +fn transitively_valid_subset<'a, 'b: 'a, 'c>(x: &'c &'a u32, y: &'b u32) -> &'c u32 { y } diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr index 4f93fb4eaea..a01b1d5174d 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -34,7 +34,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) help: consider adding an explicit lifetime bound | LL | T: Iterator, <T as Iterator>::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ note: external requirements --> $DIR/projection-no-regions-closure.rs:34:23 @@ -96,7 +96,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) help: consider adding an explicit lifetime bound | LL | T: 'b + Iterator, <T as Iterator>::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ note: external requirements --> $DIR/projection-no-regions-closure.rs:52:23 diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr index da76ac1c474..07debd308c2 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr @@ -10,7 +10,7 @@ LL | Box::new(x.next()) help: consider adding an explicit lifetime bound | LL | T: Iterator, <T as Iterator>::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough --> $DIR/projection-no-regions-fn.rs:28:5 @@ -24,7 +24,7 @@ LL | Box::new(x.next()) help: consider adding an explicit lifetime bound | LL | T: 'b + Iterator, <T as Iterator>::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index f8dbe08af61..4b779103a6d 100644 --- a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -23,16 +23,19 @@ LL | | T: Anything<'b, 'c>, | = note: defining type: no_relationships_late::<'?1, '?2, T> -error[E0309]: the associated type `<T as Anything<'?5, '?6>>::AssocType` may not live long enough +error[E0309]: the associated type `<T as Anything<'b/#0, 'c/#1>>::AssocType` may not live long enough --> $DIR/projection-two-region-trait-bound-closure.rs:38:39 | LL | fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) - | -- the associated type `<T as Anything<'?5, '?6>>::AssocType` must be valid for the lifetime `'a` as defined here... + | -- the associated type `<T as Anything<'b/#0, 'c/#1>>::AssocType` must be valid for the lifetime `'a` as defined here... ... LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^^^^^^^^ ...so that the type `<T as Anything<'?5, '?6>>::AssocType` will meet its required lifetime bounds + | ^^^^^^^^^^^^^^^^ ...so that the type `<T as Anything<'b/#0, 'c/#1>>::AssocType` will meet its required lifetime bounds | - = help: consider adding an explicit lifetime bound `<T as Anything<'?5, '?6>>::AssocType: 'a`... +help: consider adding an explicit lifetime bound + | +LL | T: Anything<'b, 'c>, <T as Anything<'b/#0, 'c/#1>>::AssocType: 'a + | ++++++++++++++++++++++++++++++++++++++++++++ note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 @@ -59,16 +62,19 @@ LL | | 'a: 'a, | = note: defining type: no_relationships_early::<'?1, '?2, '?3, T> -error[E0309]: the associated type `<T as Anything<'?6, '?7>>::AssocType` may not live long enough +error[E0309]: the associated type `<T as Anything<'b/#1, 'c/#2>>::AssocType` may not live long enough --> $DIR/projection-two-region-trait-bound-closure.rs:48:39 | LL | fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) - | -- the associated type `<T as Anything<'?6, '?7>>::AssocType` must be valid for the lifetime `'a` as defined here... + | -- the associated type `<T as Anything<'b/#1, 'c/#2>>::AssocType` must be valid for the lifetime `'a` as defined here... ... LL | with_signature(cell, t, |cell, t| require(cell, t)); - | ^^^^^^^^^^^^^^^^ ...so that the type `<T as Anything<'?6, '?7>>::AssocType` will meet its required lifetime bounds + | ^^^^^^^^^^^^^^^^ ...so that the type `<T as Anything<'b/#1, 'c/#2>>::AssocType` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound | - = help: consider adding an explicit lifetime bound `<T as Anything<'?6, '?7>>::AssocType: 'a`... +LL | 'a: 'a, <T as Anything<'b/#1, 'c/#2>>::AssocType: 'a + | ++++++++++++++++++++++++++++++++++++++++++++ note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:61:29 diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr index f8ecc0c6826..4b1e59053c9 100644 --- a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr +++ b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr @@ -1,13 +1,16 @@ -error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough +error[E0309]: the associated type `<T as MyTrait<'a>>::Output` may not live long enough --> $DIR/projection-where-clause-env-wrong-bound.rs:15:5 | LL | fn foo1<'a, 'b, T>() -> &'a () - | -- the associated type `<T as MyTrait<'_>>::Output` must be valid for the lifetime `'a` as defined here... + | -- the associated type `<T as MyTrait<'a>>::Output` must be valid for the lifetime `'a` as defined here... ... LL | bar::<T::Output>() - | ^^^^^^^^^^^^^^^^ ...so that the type `<T as MyTrait<'_>>::Output` will meet its required lifetime bounds + | ^^^^^^^^^^^^^^^^ ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds | - = help: consider adding an explicit lifetime bound `<T as MyTrait<'_>>::Output: 'a`... +help: consider adding an explicit lifetime bound + | +LL | <T as MyTrait<'a>>::Output: 'b, <T as MyTrait<'a>>::Output: 'a + | ++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs index 987148dcefb..9e3590ca715 100644 --- a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs +++ b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs @@ -12,7 +12,7 @@ where <T as MyTrait<'b>>::Output: 'a, { bar::<<T as MyTrait<'a>>::Output>() - //~^ ERROR the associated type `<T as MyTrait<'_>>::Output` may not live long enough + //~^ ERROR the associated type `<T as MyTrait<'a>>::Output` may not live long enough } fn bar<'a, T>() -> &'a () diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr index 13ad665e261..9c93d663e2d 100644 --- a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr +++ b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr @@ -1,13 +1,16 @@ -error[E0309]: the associated type `<T as MyTrait<'_>>::Output` may not live long enough +error[E0309]: the associated type `<T as MyTrait<'a>>::Output` may not live long enough --> $DIR/projection-where-clause-env-wrong-lifetime.rs:14:5 | LL | fn foo1<'a, 'b, T>() -> &'a () - | -- the associated type `<T as MyTrait<'_>>::Output` must be valid for the lifetime `'a` as defined here... + | -- the associated type `<T as MyTrait<'a>>::Output` must be valid for the lifetime `'a` as defined here... ... LL | bar::<<T as MyTrait<'a>>::Output>() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `<T as MyTrait<'_>>::Output` will meet its required lifetime bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds | - = help: consider adding an explicit lifetime bound `<T as MyTrait<'_>>::Output: 'a`... +help: consider adding an explicit lifetime bound + | +LL | <T as MyTrait<'b>>::Output: 'a, <T as MyTrait<'a>>::Output: 'a + | ++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/non-fmt-panic.stderr b/tests/ui/non-fmt-panic.stderr index 162802b7f61..0134a8ddf29 100644 --- a/tests/ui/non-fmt-panic.stderr +++ b/tests/ui/non-fmt-panic.stderr @@ -184,8 +184,9 @@ LL | std::panic!("{}", 123); | +++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(123); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - std::panic!(123); +LL + std::panic::panic_any(123); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:31:18 @@ -214,8 +215,9 @@ LL | panic!("{:?}", Some(123)); | +++++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(Some(123)); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - panic!(Some(123)); +LL + std::panic::panic_any(Some(123)); + | warning: panic message contains an unused formatting placeholder --> $DIR/non-fmt-panic.rs:33:12 @@ -267,8 +269,9 @@ LL | panic!("{}", a!()); | +++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(a!()); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - panic!(a!()); +LL + std::panic::panic_any(a!()); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:47:18 @@ -357,8 +360,9 @@ LL | panic!["{}", 123]; | +++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(123); - | ~~~~~~~~~~~~~~~~~~~~~~ ~ +LL - panic![123]; +LL + std::panic::panic_any(123); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:55:12 @@ -374,8 +378,9 @@ LL | panic!{"{}", 123}; | +++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(123); - | ~~~~~~~~~~~~~~~~~~~~~~ ~ +LL - panic!{123}; +LL + std::panic::panic_any(123); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:72:12 @@ -411,8 +416,9 @@ LL | panic!("{:?}", v); | +++++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(v); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - panic!(v); +LL + std::panic::panic_any(v); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:78:20 @@ -441,8 +447,9 @@ LL | panic!("{}", v); | +++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(v); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - panic!(v); +LL + std::panic::panic_any(v); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:83:20 @@ -471,8 +478,9 @@ LL | panic!("{}", v); | +++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(v); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - panic!(v); +LL + std::panic::panic_any(v); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:88:20 diff --git a/tests/ui/not-enough-arguments.stderr b/tests/ui/not-enough-arguments.stderr index 89e98866667..637c2774d5a 100644 --- a/tests/ui/not-enough-arguments.stderr +++ b/tests/ui/not-enough-arguments.stderr @@ -8,11 +8,12 @@ note: function defined here --> $DIR/not-enough-arguments.rs:5:4 | LL | fn foo(a: isize, b: isize, c: isize, d:isize) { - | ^^^ -------- -------- -------- ------- + | ^^^ ------- help: provide the argument | -LL | foo(1, 2, 3, /* isize */); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - foo(1, 2, 3); +LL + foo(1, 2, 3, /* isize */); + | error[E0061]: this function takes 6 arguments but 3 arguments were supplied --> $DIR/not-enough-arguments.rs:29:3 @@ -25,12 +26,7 @@ note: function defined here | LL | fn bar( | ^^^ -LL | a: i32, - | ------ -LL | b: i32, - | ------ -LL | c: i32, - | ------ +... LL | d: i32, | ------ LL | e: i32, @@ -39,8 +35,9 @@ LL | f: i32, | ------ help: provide the arguments | -LL | bar(1, 2, 3, /* i32 */, /* i32 */, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - bar(1, 2, 3); +LL + bar(1, 2, 3, /* i32 */, /* i32 */, /* i32 */); + | error: aborting due to 2 previous errors diff --git a/tests/ui/numbers-arithmetic/arith-unsigned.rs b/tests/ui/numbers-arithmetic/arith-unsigned.rs index 5a285ceca32..4a1bae438ca 100644 --- a/tests/ui/numbers-arithmetic/arith-unsigned.rs +++ b/tests/ui/numbers-arithmetic/arith-unsigned.rs @@ -3,22 +3,22 @@ // Unsigned integer operations pub fn main() { - assert!((0u8 < 255u8)); - assert!((0u8 <= 255u8)); - assert!((255u8 > 0u8)); - assert!((255u8 >= 0u8)); + assert!(0u8 < 255u8); + assert!(0u8 <= 255u8); + assert!(255u8 > 0u8); + assert!(255u8 >= 0u8); assert_eq!(250u8 / 10u8, 25u8); assert_eq!(255u8 % 10u8, 5u8); - assert!((0u16 < 60000u16)); - assert!((0u16 <= 60000u16)); - assert!((60000u16 > 0u16)); - assert!((60000u16 >= 0u16)); + assert!(0u16 < 60000u16); + assert!(0u16 <= 60000u16); + assert!(60000u16 > 0u16); + assert!(60000u16 >= 0u16); assert_eq!(60000u16 / 10u16, 6000u16); assert_eq!(60005u16 % 10u16, 5u16); - assert!((0u32 < 4000000000u32)); - assert!((0u32 <= 4000000000u32)); - assert!((4000000000u32 > 0u32)); - assert!((4000000000u32 >= 0u32)); + assert!(0u32 < 4000000000u32); + assert!(0u32 <= 4000000000u32); + assert!(4000000000u32 > 0u32); + assert!(4000000000u32 >= 0u32); assert_eq!(4000000000u32 / 10u32, 400000000u32); assert_eq!(4000000005u32 % 10u32, 5u32); // 64-bit numbers have some flakiness yet. Not tested diff --git a/tests/ui/numbers-arithmetic/float-nan.rs b/tests/ui/numbers-arithmetic/float-nan.rs index 7d1af0155da..ee3718f6f93 100644 --- a/tests/ui/numbers-arithmetic/float-nan.rs +++ b/tests/ui/numbers-arithmetic/float-nan.rs @@ -2,7 +2,7 @@ pub fn main() { let nan: f64 = f64::NAN; - assert!((nan).is_nan()); + assert!(nan.is_nan()); let inf: f64 = f64::INFINITY; let neg_inf: f64 = -f64::INFINITY; diff --git a/tests/ui/numbers-arithmetic/float2.rs b/tests/ui/numbers-arithmetic/float2.rs index 1b7add01cc6..515220fee9f 100644 --- a/tests/ui/numbers-arithmetic/float2.rs +++ b/tests/ui/numbers-arithmetic/float2.rs @@ -15,12 +15,12 @@ pub fn main() { let j = 3.1e+9f64; let k = 3.2e-10f64; assert_eq!(a, b); - assert!((c < b)); + assert!(c < b); assert_eq!(c, d); - assert!((e < g)); - assert!((f < h)); + assert!(e < g); + assert!(f < h); assert_eq!(g, 1000000.0f32); assert_eq!(h, i); - assert!((j > k)); - assert!((k < a)); + assert!(j > k); + assert!(k < a); } diff --git a/tests/ui/numbers-arithmetic/floatlits.rs b/tests/ui/numbers-arithmetic/floatlits.rs index 21f19b69c49..2dab2242011 100644 --- a/tests/ui/numbers-arithmetic/floatlits.rs +++ b/tests/ui/numbers-arithmetic/floatlits.rs @@ -4,9 +4,9 @@ pub fn main() { let f = 4.999999999999f64; - assert!((f > 4.90f64)); - assert!((f < 5.0f64)); + assert!(f > 4.90f64); + assert!(f < 5.0f64); let g = 4.90000000001e-10f64; - assert!((g > 5e-11f64)); - assert!((g < 5e-9f64)); + assert!(g > 5e-11f64); + assert!(g < 5e-9f64); } diff --git a/tests/ui/numeric/const-scope.stderr b/tests/ui/numeric/const-scope.stderr index 4e4bcdf234d..2c8d4da9d21 100644 --- a/tests/ui/numeric/const-scope.stderr +++ b/tests/ui/numeric/const-scope.stderr @@ -6,8 +6,9 @@ LL | const C: i32 = 1i8; | help: change the type of the numeric literal from `i8` to `i32` | -LL | const C: i32 = 1i32; - | ~~~ +LL - const C: i32 = 1i8; +LL + const C: i32 = 1i32; + | error[E0308]: mismatched types --> $DIR/const-scope.rs:2:15 @@ -25,8 +26,9 @@ LL | let c: i32 = 1i8; | help: change the type of the numeric literal from `i8` to `i32` | -LL | let c: i32 = 1i32; - | ~~~ +LL - let c: i32 = 1i8; +LL + let c: i32 = 1i32; + | error[E0308]: mismatched types --> $DIR/const-scope.rs:6:17 @@ -46,8 +48,9 @@ LL | let c: i32 = 1i8; | help: change the type of the numeric literal from `i8` to `i32` | -LL | let c: i32 = 1i32; - | ~~~ +LL - let c: i32 = 1i8; +LL + let c: i32 = 1i32; + | error[E0308]: mismatched types --> $DIR/const-scope.rs:11:17 diff --git a/tests/ui/numeric/numeric-fields.stderr b/tests/ui/numeric/numeric-fields.stderr index 8ab1718ff5e..6877bb3bef4 100644 --- a/tests/ui/numeric/numeric-fields.stderr +++ b/tests/ui/numeric/numeric-fields.stderr @@ -9,8 +9,9 @@ LL | let s = S{0b1: 10, 0: 11}; | help: `S` is a tuple struct, use the appropriate syntax | -LL | let s = S(/* u8 */, /* u16 */); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - let s = S{0b1: 10, 0: 11}; +LL + let s = S(/* u8 */, /* u16 */); + | error[E0026]: struct `S` does not have a field named `0x1` --> $DIR/numeric-fields.rs:7:17 diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.stderr index f4fb14e7992..6c6b8b51c22 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.stderr @@ -13,8 +13,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `i32` | -LL | foo::<i32>(42_i32); - | ~~~ +LL - foo::<i32>(42_usize); +LL + foo::<i32>(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:32:16 @@ -31,8 +32,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `i32` | -LL | foo::<i32>(42_i32); - | ~~~ +LL - foo::<i32>(42_u64); +LL + foo::<i32>(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:36:16 @@ -49,8 +51,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `i32` | -LL | foo::<i32>(42_i32); - | ~~~ +LL - foo::<i32>(42_u32); +LL + foo::<i32>(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:40:16 @@ -67,8 +70,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `i32` | -LL | foo::<i32>(42_i32); - | ~~~ +LL - foo::<i32>(42_u16); +LL + foo::<i32>(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:44:16 @@ -85,8 +89,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `i32` | -LL | foo::<i32>(42_i32); - | ~~~ +LL - foo::<i32>(42_u8); +LL + foo::<i32>(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:48:16 @@ -103,8 +108,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `i32` | -LL | foo::<i32>(42_i32); - | ~~~ +LL - foo::<i32>(42_isize); +LL + foo::<i32>(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:52:16 @@ -121,8 +127,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `i32` | -LL | foo::<i32>(42_i32); - | ~~~ +LL - foo::<i32>(42_i64); +LL + foo::<i32>(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:57:16 @@ -139,8 +146,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `i32` | -LL | foo::<i32>(42_i32); - | ~~~ +LL - foo::<i32>(42_i16); +LL + foo::<i32>(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:61:16 @@ -157,8 +165,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `i32` | -LL | foo::<i32>(42_i32); - | ~~~ +LL - foo::<i32>(42_i8); +LL + foo::<i32>(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:65:16 @@ -175,8 +184,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `i32` | -LL | foo::<i32>(42i32); - | ~~~ +LL - foo::<i32>(42.0_f64); +LL + foo::<i32>(42i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:69:16 @@ -193,8 +203,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `i32` | -LL | foo::<i32>(42i32); - | ~~~ +LL - foo::<i32>(42.0_f32); +LL + foo::<i32>(42i32); + | error: aborting due to 11 previous errors diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.stderr index 47efe9f08bb..7c26dd7be1c 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.stderr @@ -13,8 +13,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `i64` | -LL | foo::<i64>(42_i64); - | ~~~ +LL - foo::<i64>(42_usize); +LL + foo::<i64>(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:32:16 @@ -31,8 +32,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `i64` | -LL | foo::<i64>(42_i64); - | ~~~ +LL - foo::<i64>(42_u64); +LL + foo::<i64>(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:36:16 @@ -49,8 +51,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `i64` | -LL | foo::<i64>(42_i64); - | ~~~ +LL - foo::<i64>(42_u32); +LL + foo::<i64>(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:40:16 @@ -67,8 +70,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `i64` | -LL | foo::<i64>(42_i64); - | ~~~ +LL - foo::<i64>(42_u16); +LL + foo::<i64>(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:44:16 @@ -85,8 +89,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `i64` | -LL | foo::<i64>(42_i64); - | ~~~ +LL - foo::<i64>(42_u8); +LL + foo::<i64>(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:48:16 @@ -103,8 +108,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `i64` | -LL | foo::<i64>(42_i64); - | ~~~ +LL - foo::<i64>(42_isize); +LL + foo::<i64>(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:53:16 @@ -121,8 +127,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `i64` | -LL | foo::<i64>(42_i64); - | ~~~ +LL - foo::<i64>(42_i32); +LL + foo::<i64>(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:57:16 @@ -139,8 +146,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `i64` | -LL | foo::<i64>(42_i64); - | ~~~ +LL - foo::<i64>(42_i16); +LL + foo::<i64>(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:61:16 @@ -157,8 +165,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `i64` | -LL | foo::<i64>(42_i64); - | ~~~ +LL - foo::<i64>(42_i8); +LL + foo::<i64>(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:65:16 @@ -175,8 +184,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `i64` | -LL | foo::<i64>(42i64); - | ~~~ +LL - foo::<i64>(42.0_f64); +LL + foo::<i64>(42i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:69:16 @@ -193,8 +203,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `i64` | -LL | foo::<i64>(42i64); - | ~~~ +LL - foo::<i64>(42.0_f32); +LL + foo::<i64>(42i64); + | error: aborting due to 11 previous errors diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.stderr index 28b79413f68..8365350f2bf 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.stderr @@ -13,8 +13,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `isize` | -LL | foo::<isize>(42_isize); - | ~~~~~ +LL - foo::<isize>(42_usize); +LL + foo::<isize>(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:32:18 @@ -31,8 +32,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `isize` | -LL | foo::<isize>(42_isize); - | ~~~~~ +LL - foo::<isize>(42_u64); +LL + foo::<isize>(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:36:18 @@ -49,8 +51,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `isize` | -LL | foo::<isize>(42_isize); - | ~~~~~ +LL - foo::<isize>(42_u32); +LL + foo::<isize>(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:40:18 @@ -67,8 +70,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `isize` | -LL | foo::<isize>(42_isize); - | ~~~~~ +LL - foo::<isize>(42_u16); +LL + foo::<isize>(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:44:18 @@ -85,8 +89,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `isize` | -LL | foo::<isize>(42_isize); - | ~~~~~ +LL - foo::<isize>(42_u8); +LL + foo::<isize>(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:49:18 @@ -103,8 +108,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `isize` | -LL | foo::<isize>(42_isize); - | ~~~~~ +LL - foo::<isize>(42_i64); +LL + foo::<isize>(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:53:18 @@ -121,8 +127,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `isize` | -LL | foo::<isize>(42_isize); - | ~~~~~ +LL - foo::<isize>(42_i32); +LL + foo::<isize>(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:57:18 @@ -139,8 +146,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `isize` | -LL | foo::<isize>(42_isize); - | ~~~~~ +LL - foo::<isize>(42_i16); +LL + foo::<isize>(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:61:18 @@ -157,8 +165,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `isize` | -LL | foo::<isize>(42_isize); - | ~~~~~ +LL - foo::<isize>(42_i8); +LL + foo::<isize>(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:65:18 @@ -175,8 +184,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `isize` | -LL | foo::<isize>(42isize); - | ~~~~~ +LL - foo::<isize>(42.0_f64); +LL + foo::<isize>(42isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:69:18 @@ -193,8 +203,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `isize` | -LL | foo::<isize>(42isize); - | ~~~~~ +LL - foo::<isize>(42.0_f32); +LL + foo::<isize>(42isize); + | error: aborting due to 11 previous errors diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.stderr index d966893a83b..610e6ece276 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.stderr @@ -13,8 +13,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `u32` | -LL | foo::<u32>(42_u32); - | ~~~ +LL - foo::<u32>(42_usize); +LL + foo::<u32>(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:32:16 @@ -31,8 +32,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `u32` | -LL | foo::<u32>(42_u32); - | ~~~ +LL - foo::<u32>(42_u64); +LL + foo::<u32>(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:37:16 @@ -49,8 +51,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `u32` | -LL | foo::<u32>(42_u32); - | ~~~ +LL - foo::<u32>(42_u16); +LL + foo::<u32>(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:41:16 @@ -67,8 +70,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `u32` | -LL | foo::<u32>(42_u32); - | ~~~ +LL - foo::<u32>(42_u8); +LL + foo::<u32>(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:45:16 @@ -85,8 +89,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `u32` | -LL | foo::<u32>(42_u32); - | ~~~ +LL - foo::<u32>(42_isize); +LL + foo::<u32>(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:49:16 @@ -103,8 +108,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `u32` | -LL | foo::<u32>(42_u32); - | ~~~ +LL - foo::<u32>(42_i64); +LL + foo::<u32>(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:53:16 @@ -121,8 +127,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `u32` | -LL | foo::<u32>(42_u32); - | ~~~ +LL - foo::<u32>(42_i32); +LL + foo::<u32>(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:57:16 @@ -139,8 +146,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `u32` | -LL | foo::<u32>(42_u32); - | ~~~ +LL - foo::<u32>(42_i16); +LL + foo::<u32>(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:61:16 @@ -157,8 +165,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `u32` | -LL | foo::<u32>(42_u32); - | ~~~ +LL - foo::<u32>(42_i8); +LL + foo::<u32>(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:65:16 @@ -175,8 +184,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `u32` | -LL | foo::<u32>(42u32); - | ~~~ +LL - foo::<u32>(42.0_f64); +LL + foo::<u32>(42u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:69:16 @@ -193,8 +203,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `u32` | -LL | foo::<u32>(42u32); - | ~~~ +LL - foo::<u32>(42.0_f32); +LL + foo::<u32>(42u32); + | error: aborting due to 11 previous errors diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.stderr index ff332fa914d..112dddccd6f 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.stderr @@ -13,8 +13,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `u64` | -LL | foo::<u64>(42_u64); - | ~~~ +LL - foo::<u64>(42_usize); +LL + foo::<u64>(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:33:16 @@ -31,8 +32,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `u64` | -LL | foo::<u64>(42_u64); - | ~~~ +LL - foo::<u64>(42_u32); +LL + foo::<u64>(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:37:16 @@ -49,8 +51,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `u64` | -LL | foo::<u64>(42_u64); - | ~~~ +LL - foo::<u64>(42_u16); +LL + foo::<u64>(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:41:16 @@ -67,8 +70,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `u64` | -LL | foo::<u64>(42_u64); - | ~~~ +LL - foo::<u64>(42_u8); +LL + foo::<u64>(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:45:16 @@ -85,8 +89,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `u64` | -LL | foo::<u64>(42_u64); - | ~~~ +LL - foo::<u64>(42_isize); +LL + foo::<u64>(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:49:16 @@ -103,8 +108,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `u64` | -LL | foo::<u64>(42_u64); - | ~~~ +LL - foo::<u64>(42_i64); +LL + foo::<u64>(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:53:16 @@ -121,8 +127,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `u64` | -LL | foo::<u64>(42_u64); - | ~~~ +LL - foo::<u64>(42_i32); +LL + foo::<u64>(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:57:16 @@ -139,8 +146,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `u64` | -LL | foo::<u64>(42_u64); - | ~~~ +LL - foo::<u64>(42_i16); +LL + foo::<u64>(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:61:16 @@ -157,8 +165,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `u64` | -LL | foo::<u64>(42_u64); - | ~~~ +LL - foo::<u64>(42_i8); +LL + foo::<u64>(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:65:16 @@ -175,8 +184,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `u64` | -LL | foo::<u64>(42u64); - | ~~~ +LL - foo::<u64>(42.0_f64); +LL + foo::<u64>(42u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:69:16 @@ -193,8 +203,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `u64` | -LL | foo::<u64>(42u64); - | ~~~ +LL - foo::<u64>(42.0_f32); +LL + foo::<u64>(42u64); + | error: aborting due to 11 previous errors diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.stderr index 4889abee69c..e7d6a04f18e 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.stderr @@ -13,8 +13,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `usize` | -LL | foo::<usize>(42_usize); - | ~~~~~ +LL - foo::<usize>(42_u64); +LL + foo::<usize>(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:33:18 @@ -31,8 +32,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `usize` | -LL | foo::<usize>(42_usize); - | ~~~~~ +LL - foo::<usize>(42_u32); +LL + foo::<usize>(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:37:18 @@ -49,8 +51,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `usize` | -LL | foo::<usize>(42_usize); - | ~~~~~ +LL - foo::<usize>(42_u16); +LL + foo::<usize>(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:41:18 @@ -67,8 +70,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `usize` | -LL | foo::<usize>(42_usize); - | ~~~~~ +LL - foo::<usize>(42_u8); +LL + foo::<usize>(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:45:18 @@ -85,8 +89,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `usize` | -LL | foo::<usize>(42_usize); - | ~~~~~ +LL - foo::<usize>(42_isize); +LL + foo::<usize>(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:49:18 @@ -103,8 +108,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `usize` | -LL | foo::<usize>(42_usize); - | ~~~~~ +LL - foo::<usize>(42_i64); +LL + foo::<usize>(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:53:18 @@ -121,8 +127,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `usize` | -LL | foo::<usize>(42_usize); - | ~~~~~ +LL - foo::<usize>(42_i32); +LL + foo::<usize>(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:57:18 @@ -139,8 +146,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `usize` | -LL | foo::<usize>(42_usize); - | ~~~~~ +LL - foo::<usize>(42_i16); +LL + foo::<usize>(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:61:18 @@ -157,8 +165,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `usize` | -LL | foo::<usize>(42_usize); - | ~~~~~ +LL - foo::<usize>(42_i8); +LL + foo::<usize>(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:65:18 @@ -175,8 +184,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `usize` | -LL | foo::<usize>(42usize); - | ~~~~~ +LL - foo::<usize>(42.0_f64); +LL + foo::<usize>(42usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:69:18 @@ -193,8 +203,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `usize` | -LL | foo::<usize>(42usize); - | ~~~~~ +LL - foo::<usize>(42.0_f32); +LL + foo::<usize>(42usize); + | error: aborting due to 11 previous errors diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix.stderr index e05913b9c62..d26639a76f0 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix.stderr @@ -13,8 +13,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `u16` | -LL | foo::<u16>(42_u16); - | ~~~ +LL - foo::<u16>(42_usize); +LL + foo::<u16>(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:147:16 @@ -31,8 +32,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `u16` | -LL | foo::<u16>(42_u16); - | ~~~ +LL - foo::<u16>(42_u64); +LL + foo::<u16>(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:151:16 @@ -49,8 +51,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `u16` | -LL | foo::<u16>(42_u16); - | ~~~ +LL - foo::<u16>(42_u32); +LL + foo::<u16>(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:156:16 @@ -67,8 +70,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `u16` | -LL | foo::<u16>(42_u16); - | ~~~ +LL - foo::<u16>(42_u8); +LL + foo::<u16>(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:160:16 @@ -85,8 +89,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `u16` | -LL | foo::<u16>(42_u16); - | ~~~ +LL - foo::<u16>(42_isize); +LL + foo::<u16>(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:164:16 @@ -103,8 +108,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `u16` | -LL | foo::<u16>(42_u16); - | ~~~ +LL - foo::<u16>(42_i64); +LL + foo::<u16>(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:168:16 @@ -121,8 +127,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `u16` | -LL | foo::<u16>(42_u16); - | ~~~ +LL - foo::<u16>(42_i32); +LL + foo::<u16>(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:172:16 @@ -139,8 +146,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `u16` | -LL | foo::<u16>(42_u16); - | ~~~ +LL - foo::<u16>(42_i16); +LL + foo::<u16>(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:176:16 @@ -157,8 +165,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `u16` | -LL | foo::<u16>(42_u16); - | ~~~ +LL - foo::<u16>(42_i8); +LL + foo::<u16>(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:180:16 @@ -175,8 +184,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `u16` | -LL | foo::<u16>(42u16); - | ~~~ +LL - foo::<u16>(42.0_f64); +LL + foo::<u16>(42u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:184:16 @@ -193,8 +203,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `u16` | -LL | foo::<u16>(42u16); - | ~~~ +LL - foo::<u16>(42.0_f32); +LL + foo::<u16>(42u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:189:16 @@ -211,8 +222,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `i16` | -LL | foo::<i16>(42_i16); - | ~~~ +LL - foo::<i16>(42_usize); +LL + foo::<i16>(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:193:16 @@ -229,8 +241,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `i16` | -LL | foo::<i16>(42_i16); - | ~~~ +LL - foo::<i16>(42_u64); +LL + foo::<i16>(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:197:16 @@ -247,8 +260,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `i16` | -LL | foo::<i16>(42_i16); - | ~~~ +LL - foo::<i16>(42_u32); +LL + foo::<i16>(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:201:16 @@ -265,8 +279,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `i16` | -LL | foo::<i16>(42_i16); - | ~~~ +LL - foo::<i16>(42_u16); +LL + foo::<i16>(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:205:16 @@ -283,8 +298,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `i16` | -LL | foo::<i16>(42_i16); - | ~~~ +LL - foo::<i16>(42_u8); +LL + foo::<i16>(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:209:16 @@ -301,8 +317,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `i16` | -LL | foo::<i16>(42_i16); - | ~~~ +LL - foo::<i16>(42_isize); +LL + foo::<i16>(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:213:16 @@ -319,8 +336,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `i16` | -LL | foo::<i16>(42_i16); - | ~~~ +LL - foo::<i16>(42_i64); +LL + foo::<i16>(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:217:16 @@ -337,8 +355,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `i16` | -LL | foo::<i16>(42_i16); - | ~~~ +LL - foo::<i16>(42_i32); +LL + foo::<i16>(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:222:16 @@ -355,8 +374,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `i16` | -LL | foo::<i16>(42_i16); - | ~~~ +LL - foo::<i16>(42_i8); +LL + foo::<i16>(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:226:16 @@ -373,8 +393,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `i16` | -LL | foo::<i16>(42i16); - | ~~~ +LL - foo::<i16>(42.0_f64); +LL + foo::<i16>(42i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:230:16 @@ -391,8 +412,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `i16` | -LL | foo::<i16>(42i16); - | ~~~ +LL - foo::<i16>(42.0_f32); +LL + foo::<i16>(42i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:235:15 @@ -409,8 +431,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `u8` | -LL | foo::<u8>(42_u8); - | ~~ +LL - foo::<u8>(42_usize); +LL + foo::<u8>(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:239:15 @@ -427,8 +450,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `u8` | -LL | foo::<u8>(42_u8); - | ~~ +LL - foo::<u8>(42_u64); +LL + foo::<u8>(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:243:15 @@ -445,8 +469,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `u8` | -LL | foo::<u8>(42_u8); - | ~~ +LL - foo::<u8>(42_u32); +LL + foo::<u8>(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:247:15 @@ -463,8 +488,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `u8` | -LL | foo::<u8>(42_u8); - | ~~ +LL - foo::<u8>(42_u16); +LL + foo::<u8>(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:252:15 @@ -481,8 +507,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `u8` | -LL | foo::<u8>(42_u8); - | ~~ +LL - foo::<u8>(42_isize); +LL + foo::<u8>(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:256:15 @@ -499,8 +526,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `u8` | -LL | foo::<u8>(42_u8); - | ~~ +LL - foo::<u8>(42_i64); +LL + foo::<u8>(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:260:15 @@ -517,8 +545,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `u8` | -LL | foo::<u8>(42_u8); - | ~~ +LL - foo::<u8>(42_i32); +LL + foo::<u8>(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:264:15 @@ -535,8 +564,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `u8` | -LL | foo::<u8>(42_u8); - | ~~ +LL - foo::<u8>(42_i16); +LL + foo::<u8>(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:268:15 @@ -553,8 +583,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `u8` | -LL | foo::<u8>(42_u8); - | ~~ +LL - foo::<u8>(42_i8); +LL + foo::<u8>(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:272:15 @@ -571,8 +602,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `u8` | -LL | foo::<u8>(42u8); - | ~~ +LL - foo::<u8>(42.0_f64); +LL + foo::<u8>(42u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:276:15 @@ -589,8 +621,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `u8` | -LL | foo::<u8>(42u8); - | ~~ +LL - foo::<u8>(42.0_f32); +LL + foo::<u8>(42u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:281:15 @@ -607,8 +640,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `i8` | -LL | foo::<i8>(42_i8); - | ~~ +LL - foo::<i8>(42_usize); +LL + foo::<i8>(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:285:15 @@ -625,8 +659,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `i8` | -LL | foo::<i8>(42_i8); - | ~~ +LL - foo::<i8>(42_u64); +LL + foo::<i8>(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:289:15 @@ -643,8 +678,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `i8` | -LL | foo::<i8>(42_i8); - | ~~ +LL - foo::<i8>(42_u32); +LL + foo::<i8>(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:293:15 @@ -661,8 +697,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `i8` | -LL | foo::<i8>(42_i8); - | ~~ +LL - foo::<i8>(42_u16); +LL + foo::<i8>(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:297:15 @@ -679,8 +716,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `i8` | -LL | foo::<i8>(42_i8); - | ~~ +LL - foo::<i8>(42_u8); +LL + foo::<i8>(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:301:15 @@ -697,8 +735,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `i8` | -LL | foo::<i8>(42_i8); - | ~~ +LL - foo::<i8>(42_isize); +LL + foo::<i8>(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:305:15 @@ -715,8 +754,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `i8` | -LL | foo::<i8>(42_i8); - | ~~ +LL - foo::<i8>(42_i64); +LL + foo::<i8>(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:309:15 @@ -733,8 +773,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `i8` | -LL | foo::<i8>(42_i8); - | ~~ +LL - foo::<i8>(42_i32); +LL + foo::<i8>(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:313:15 @@ -751,8 +792,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `i8` | -LL | foo::<i8>(42_i8); - | ~~ +LL - foo::<i8>(42_i16); +LL + foo::<i8>(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:318:15 @@ -769,8 +811,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `i8` | -LL | foo::<i8>(42i8); - | ~~ +LL - foo::<i8>(42.0_f64); +LL + foo::<i8>(42i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:322:15 @@ -787,8 +830,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `i8` | -LL | foo::<i8>(42i8); - | ~~ +LL - foo::<i8>(42.0_f32); +LL + foo::<i8>(42i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:327:16 @@ -805,8 +849,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `f64` | -LL | foo::<f64>(42_f64); - | ~~~ +LL - foo::<f64>(42_usize); +LL + foo::<f64>(42_f64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:331:16 @@ -823,8 +868,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `f64` | -LL | foo::<f64>(42_f64); - | ~~~ +LL - foo::<f64>(42_u64); +LL + foo::<f64>(42_f64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:335:16 @@ -895,8 +941,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `f64` | -LL | foo::<f64>(42_f64); - | ~~~ +LL - foo::<f64>(42_isize); +LL + foo::<f64>(42_f64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:351:16 @@ -913,8 +960,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `f64` | -LL | foo::<f64>(42_f64); - | ~~~ +LL - foo::<f64>(42_i64); +LL + foo::<f64>(42_f64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:355:16 @@ -985,8 +1033,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `f64` | -LL | foo::<f64>(42.0_f64); - | ~~~ +LL - foo::<f64>(42.0_f32); +LL + foo::<f64>(42.0_f64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:373:16 @@ -1003,8 +1052,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `f32` | -LL | foo::<f32>(42_f32); - | ~~~ +LL - foo::<f32>(42_usize); +LL + foo::<f32>(42_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:377:16 @@ -1021,8 +1071,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `f32` | -LL | foo::<f32>(42_f32); - | ~~~ +LL - foo::<f32>(42_u64); +LL + foo::<f32>(42_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:381:16 @@ -1039,8 +1090,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `f32` | -LL | foo::<f32>(42_f32); - | ~~~ +LL - foo::<f32>(42_u32); +LL + foo::<f32>(42_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:385:16 @@ -1093,8 +1145,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `f32` | -LL | foo::<f32>(42_f32); - | ~~~ +LL - foo::<f32>(42_isize); +LL + foo::<f32>(42_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:397:16 @@ -1111,8 +1164,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `f32` | -LL | foo::<f32>(42_f32); - | ~~~ +LL - foo::<f32>(42_i64); +LL + foo::<f32>(42_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:401:16 @@ -1129,8 +1183,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `f32` | -LL | foo::<f32>(42_f32); - | ~~~ +LL - foo::<f32>(42_i32); +LL + foo::<f32>(42_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:405:16 @@ -1183,8 +1238,9 @@ LL | fn foo<N>(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `f32` | -LL | foo::<f32>(42.0_f32); - | ~~~ +LL - foo::<f32>(42.0_f64); +LL + foo::<f32>(42.0_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:419:16 diff --git a/tests/ui/object-pointer-types.stderr b/tests/ui/object-pointer-types.stderr index 7d915ebdab6..ac8e069cfd2 100644 --- a/tests/ui/object-pointer-types.stderr +++ b/tests/ui/object-pointer-types.stderr @@ -10,7 +10,7 @@ LL | x.owned(); help: there is a method `to_owned` with a similar name | LL | x.to_owned(); - | ~~~~~~~~ + | +++ error[E0599]: no method named `owned` found for mutable reference `&mut dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:17:7 diff --git a/tests/ui/obsolete-in-place/bad.stderr b/tests/ui/obsolete-in-place/bad.stderr index 363dfb77628..1409a663789 100644 --- a/tests/ui/obsolete-in-place/bad.stderr +++ b/tests/ui/obsolete-in-place/bad.stderr @@ -6,8 +6,9 @@ LL | x <- y; | help: if you meant to write a comparison against a negative value, add a space in between `<` and `-` | -LL | x < - y; - | ~~~ +LL - x <- y; +LL + x < - y; + | error: expected expression, found keyword `in` --> $DIR/bad.rs:10:5 diff --git a/tests/ui/on-unimplemented/bad-annotation.stderr b/tests/ui/on-unimplemented/bad-annotation.stderr index 9bb9423788c..0482a5c5855 100644 --- a/tests/ui/on-unimplemented/bad-annotation.stderr +++ b/tests/ui/on-unimplemented/bad-annotation.stderr @@ -6,9 +6,11 @@ LL | #[rustc_on_unimplemented] | help: the following are the possible correct uses | -LL | #[rustc_on_unimplemented = "message"] +LL - #[rustc_on_unimplemented] +LL + #[rustc_on_unimplemented = "message"] | -LL | #[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")] +LL - #[rustc_on_unimplemented] +LL + #[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")] | error[E0230]: there is no parameter `C` on trait `BadAnnotation2` diff --git a/tests/ui/on-unimplemented/issue-104140.stderr b/tests/ui/on-unimplemented/issue-104140.stderr index 4ba5475d9ec..5c9d5e8d553 100644 --- a/tests/ui/on-unimplemented/issue-104140.stderr +++ b/tests/ui/on-unimplemented/issue-104140.stderr @@ -6,10 +6,12 @@ LL | #[rustc_on_unimplemented] | help: the following are the possible correct uses | -LL | #[rustc_on_unimplemented = "message"] - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | #[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")] - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - #[rustc_on_unimplemented] +LL + #[rustc_on_unimplemented = "message"] + | +LL - #[rustc_on_unimplemented] +LL + #[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")] + | error: aborting due to 1 previous error diff --git a/tests/ui/operator-recovery/less-than-greater-than.stderr b/tests/ui/operator-recovery/less-than-greater-than.stderr index 36a4a81035f..429bda9cefc 100644 --- a/tests/ui/operator-recovery/less-than-greater-than.stderr +++ b/tests/ui/operator-recovery/less-than-greater-than.stderr @@ -6,8 +6,9 @@ LL | println!("{}", 1 <> 2); | help: `<>` is not a valid comparison operator, use `!=` | -LL | println!("{}", 1 != 2); - | ~~ +LL - println!("{}", 1 <> 2); +LL + println!("{}", 1 != 2); + | error: aborting due to 1 previous error diff --git a/tests/ui/or-patterns/multiple-pattern-typo.stderr b/tests/ui/or-patterns/multiple-pattern-typo.stderr index 2e66f54979b..fea3ed76691 100644 --- a/tests/ui/or-patterns/multiple-pattern-typo.stderr +++ b/tests/ui/or-patterns/multiple-pattern-typo.stderr @@ -8,8 +8,9 @@ LL | 1 | 2 || 3 => (), | help: use a single `|` to separate multiple alternative patterns | -LL | 1 | 2 | 3 => (), - | ~ +LL - 1 | 2 || 3 => (), +LL + 1 | 2 | 3 => (), + | error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:12:16 @@ -21,8 +22,9 @@ LL | (1 | 2 || 3) => (), | help: use a single `|` to separate multiple alternative patterns | -LL | (1 | 2 | 3) => (), - | ~ +LL - (1 | 2 || 3) => (), +LL + (1 | 2 | 3) => (), + | error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:17:16 @@ -34,8 +36,9 @@ LL | (1 | 2 || 3,) => (), | help: use a single `|` to separate multiple alternative patterns | -LL | (1 | 2 | 3,) => (), - | ~ +LL - (1 | 2 || 3,) => (), +LL + (1 | 2 | 3,) => (), + | error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:24:18 @@ -47,8 +50,9 @@ LL | TS(1 | 2 || 3) => (), | help: use a single `|` to separate multiple alternative patterns | -LL | TS(1 | 2 | 3) => (), - | ~ +LL - TS(1 | 2 || 3) => (), +LL + TS(1 | 2 | 3) => (), + | error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:31:23 @@ -60,8 +64,9 @@ LL | NS { f: 1 | 2 || 3 } => (), | help: use a single `|` to separate multiple alternative patterns | -LL | NS { f: 1 | 2 | 3 } => (), - | ~ +LL - NS { f: 1 | 2 || 3 } => (), +LL + NS { f: 1 | 2 | 3 } => (), + | error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:36:16 @@ -73,8 +78,9 @@ LL | [1 | 2 || 3] => (), | help: use a single `|` to separate multiple alternative patterns | -LL | [1 | 2 | 3] => (), - | ~ +LL - [1 | 2 || 3] => (), +LL + [1 | 2 | 3] => (), + | error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:41:9 @@ -84,8 +90,9 @@ LL | || 1 | 2 | 3 => (), | help: use a single `|` to separate multiple alternative patterns | -LL | | 1 | 2 | 3 => (), - | ~ +LL - || 1 | 2 | 3 => (), +LL + | 1 | 2 | 3 => (), + | error: aborting due to 7 previous errors diff --git a/tests/ui/or-patterns/remove-leading-vert.stderr b/tests/ui/or-patterns/remove-leading-vert.stderr index 5177e98f0d9..b92fcb89a40 100644 --- a/tests/ui/or-patterns/remove-leading-vert.stderr +++ b/tests/ui/or-patterns/remove-leading-vert.stderr @@ -31,8 +31,9 @@ LL | let ( || A): (E); | help: use a single `|` to separate multiple alternative patterns | -LL | let ( | A): (E); - | ~ +LL - let ( || A): (E); +LL + let ( | A): (E); + | error: unexpected token `||` in pattern --> $DIR/remove-leading-vert.rs:17:11 @@ -42,8 +43,9 @@ LL | let [ || A ]: [E; 1]; | help: use a single `|` to separate multiple alternative patterns | -LL | let [ | A ]: [E; 1]; - | ~ +LL - let [ || A ]: [E; 1]; +LL + let [ | A ]: [E; 1]; + | error: unexpected token `||` in pattern --> $DIR/remove-leading-vert.rs:19:13 @@ -53,8 +55,9 @@ LL | let TS( || A ): TS; | help: use a single `|` to separate multiple alternative patterns | -LL | let TS( | A ): TS; - | ~ +LL - let TS( || A ): TS; +LL + let TS( | A ): TS; + | error: unexpected token `||` in pattern --> $DIR/remove-leading-vert.rs:21:17 @@ -64,8 +67,9 @@ LL | let NS { f: || A }: NS; | help: use a single `|` to separate multiple alternative patterns | -LL | let NS { f: | A }: NS; - | ~ +LL - let NS { f: || A }: NS; +LL + let NS { f: | A }: NS; + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:26:13 @@ -147,8 +151,9 @@ LL | let ( A || B | ): E; | help: use a single `|` to separate multiple alternative patterns | -LL | let ( A | B | ): E; - | ~ +LL - let ( A || B | ): E; +LL + let ( A | B | ): E; + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:31:18 @@ -203,8 +208,9 @@ LL | A || B | => {} | help: use a single `|` to separate multiple alternative patterns | -LL | A | B | => {} - | ~ +LL - A || B | => {} +LL + A | B | => {} + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:36:16 diff --git a/tests/ui/panic-handler/panic-handler-with-target-feature.rs b/tests/ui/panic-handler/panic-handler-with-target-feature.rs index 8d5ea0703af..aec00c637be 100644 --- a/tests/ui/panic-handler/panic-handler-with-target-feature.rs +++ b/tests/ui/panic-handler/panic-handler-with-target-feature.rs @@ -1,7 +1,6 @@ //@ compile-flags:-C panic=abort //@ only-x86_64 -#![feature(target_feature_11)] #![no_std] #![no_main] diff --git a/tests/ui/panic-handler/panic-handler-with-target-feature.stderr b/tests/ui/panic-handler/panic-handler-with-target-feature.stderr index cb17da3a4ef..ddf0ae77a0a 100644 --- a/tests/ui/panic-handler/panic-handler-with-target-feature.stderr +++ b/tests/ui/panic-handler/panic-handler-with-target-feature.stderr @@ -1,5 +1,5 @@ error: `#[panic_handler]` function is not allowed to have `#[target_feature]` - --> $DIR/panic-handler-with-target-feature.rs:11:1 + --> $DIR/panic-handler-with-target-feature.rs:10:1 | LL | #[target_feature(enable = "avx2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/panic-handler/weak-lang-item.stderr b/tests/ui/panic-handler/weak-lang-item.stderr index de351d2c3e4..e9d444c1c4d 100644 --- a/tests/ui/panic-handler/weak-lang-item.stderr +++ b/tests/ui/panic-handler/weak-lang-item.stderr @@ -7,7 +7,8 @@ LL | extern crate core; = note: `core` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate core as other_core; +LL - extern crate core; +LL + extern crate core as other_core; | error: `#[panic_handler]` function required, but not found diff --git a/tests/ui/panics/issue-47429-short-backtraces.rs b/tests/ui/panics/issue-47429-short-backtraces.rs index 4a73ebe8712..378ade67bfd 100644 --- a/tests/ui/panics/issue-47429-short-backtraces.rs +++ b/tests/ui/panics/issue-47429-short-backtraces.rs @@ -17,8 +17,6 @@ //@ ignore-msvc see #62897 and `backtrace-debuginfo.rs` test //@ ignore-android FIXME #17520 //@ ignore-openbsd no support for libbacktrace without filename -//@ ignore-wasm no panic support -//@ ignore-emscripten no panic support //@ ignore-fuchsia Backtraces not symbolized //@ needs-subprocess diff --git a/tests/ui/panics/issue-47429-short-backtraces.run.stderr b/tests/ui/panics/issue-47429-short-backtraces.run.stderr index c6e2d13fb5d..32dc6592271 100644 --- a/tests/ui/panics/issue-47429-short-backtraces.run.stderr +++ b/tests/ui/panics/issue-47429-short-backtraces.run.stderr @@ -1,5 +1,5 @@ -thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:26:5: +thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:24:5: explicit panic stack backtrace: 0: std::panicking::begin_panic diff --git a/tests/ui/panics/runtime-switch.rs b/tests/ui/panics/runtime-switch.rs index 9f0be8c7ddf..7d5b4169340 100644 --- a/tests/ui/panics/runtime-switch.rs +++ b/tests/ui/panics/runtime-switch.rs @@ -18,7 +18,6 @@ //@ ignore-android FIXME #17520 //@ ignore-openbsd no support for libbacktrace without filename //@ ignore-wasm no backtrace support -//@ ignore-emscripten no panic support //@ ignore-fuchsia Backtrace not symbolized //@ needs-subprocess diff --git a/tests/ui/panics/runtime-switch.run.stderr b/tests/ui/panics/runtime-switch.run.stderr index 458a0ee534a..70ed127af86 100644 --- a/tests/ui/panics/runtime-switch.run.stderr +++ b/tests/ui/panics/runtime-switch.run.stderr @@ -1,5 +1,5 @@ -thread 'main' panicked at $DIR/runtime-switch.rs:29:5: +thread 'main' panicked at $DIR/runtime-switch.rs:28:5: explicit panic stack backtrace: 0: std::panicking::begin_panic diff --git a/tests/ui/panics/short-ice-remove-middle-frames-2.rs b/tests/ui/panics/short-ice-remove-middle-frames-2.rs index 48f60b14170..660530f0ead 100644 --- a/tests/ui/panics/short-ice-remove-middle-frames-2.rs +++ b/tests/ui/panics/short-ice-remove-middle-frames-2.rs @@ -5,7 +5,6 @@ //@ needs-unwind //@ ignore-android FIXME #17520 //@ ignore-openbsd no support for libbacktrace without filename -//@ ignore-emscripten no panic //@ ignore-sgx Backtraces not symbolized //@ ignore-fuchsia Backtraces not symbolized //@ ignore-msvc the `__rust_{begin,end}_short_backtrace` symbols aren't reliable. diff --git a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr index 1fddcca6951..664d51e185d 100644 --- a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr +++ b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr @@ -1,5 +1,5 @@ -thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:63:5: +thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:62:5: debug!!! stack backtrace: 0: std::panicking::begin_panic diff --git a/tests/ui/panics/short-ice-remove-middle-frames.rs b/tests/ui/panics/short-ice-remove-middle-frames.rs index 216c5127799..41fb6e9950e 100644 --- a/tests/ui/panics/short-ice-remove-middle-frames.rs +++ b/tests/ui/panics/short-ice-remove-middle-frames.rs @@ -5,7 +5,6 @@ //@ needs-unwind //@ ignore-android FIXME #17520 //@ ignore-openbsd no support for libbacktrace without filename -//@ ignore-emscripten no panic //@ ignore-sgx Backtraces not symbolized //@ ignore-fuchsia Backtraces not symbolized //@ ignore-msvc the `__rust_{begin,end}_short_backtrace` symbols aren't reliable. diff --git a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr index 630b09d8d1e..e966462331f 100644 --- a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr +++ b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr @@ -1,5 +1,5 @@ -thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:59:5: +thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:58:5: debug!!! stack backtrace: 0: std::panicking::begin_panic diff --git a/tests/ui/parser/attribute/attr-pat-struct-rest.rs b/tests/ui/parser/attribute/attr-pat-struct-rest.rs new file mode 100644 index 00000000000..b2bfcf82df8 --- /dev/null +++ b/tests/ui/parser/attribute/attr-pat-struct-rest.rs @@ -0,0 +1,8 @@ +// #81282: Attributes are not allowed on struct field rest patterns (the ..). + +struct S {} + +fn main() { + let S { #[cfg(any())] .. } = S {}; + //~^ ERROR expected identifier, found `..` +} diff --git a/tests/ui/parser/attribute/attr-pat-struct-rest.stderr b/tests/ui/parser/attribute/attr-pat-struct-rest.stderr new file mode 100644 index 00000000000..f72c54973fc --- /dev/null +++ b/tests/ui/parser/attribute/attr-pat-struct-rest.stderr @@ -0,0 +1,10 @@ +error: expected identifier, found `..` + --> $DIR/attr-pat-struct-rest.rs:6:27 + | +LL | let S { #[cfg(any())] .. } = S {}; + | - ^^ expected identifier + | | + | while parsing the fields for this pattern + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/bad-char-literals.stderr b/tests/ui/parser/bad-char-literals.stderr index 5a81ede0336..b5b05c2c142 100644 --- a/tests/ui/parser/bad-char-literals.stderr +++ b/tests/ui/parser/bad-char-literals.stderr @@ -7,7 +7,7 @@ LL | '''; help: escape the character | LL | '\''; - | ~~ + | + error: character constant must be escaped: `\n` --> $DIR/bad-char-literals.rs:10:6 @@ -41,8 +41,9 @@ LL | '-␀-'; | help: if you meant to write a string literal, use double quotes | -LL | "-␀-"; - | ~ ~ +LL - '-␀-'; +LL + "-␀-"; + | error: character constant must be escaped: `\t` --> $DIR/bad-char-literals.rs:21:6 diff --git a/tests/ui/parser/bad-crate-name.stderr b/tests/ui/parser/bad-crate-name.stderr index c98a620f123..2218062fa28 100644 --- a/tests/ui/parser/bad-crate-name.stderr +++ b/tests/ui/parser/bad-crate-name.stderr @@ -6,8 +6,9 @@ LL | extern crate krate-name-here; | help: if the original crate name uses dashes you need to use underscores in the code | -LL | extern crate krate_name_here; - | ~ ~ +LL - extern crate krate-name-here; +LL + extern crate krate_name_here; + | error[E0463]: can't find crate for `krate_name_here` --> $DIR/bad-crate-name.rs:1:1 diff --git a/tests/ui/parser/bad-escape-suggest-raw-string.stderr b/tests/ui/parser/bad-escape-suggest-raw-string.stderr index 6dd4ad512a8..15e99b3cb32 100644 --- a/tests/ui/parser/bad-escape-suggest-raw-string.stderr +++ b/tests/ui/parser/bad-escape-suggest-raw-string.stderr @@ -8,7 +8,7 @@ LL | let bad = "ab\[c"; help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | LL | let bad = r"ab\[c"; - | ~~~~~~~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/bad-let-else-statement.stderr b/tests/ui/parser/bad-let-else-statement.stderr index 79d722bb7ac..ba564529983 100644 --- a/tests/ui/parser/bad-let-else-statement.stderr +++ b/tests/ui/parser/bad-let-else-statement.stderr @@ -225,8 +225,9 @@ LL | let bad = format_args! {""} else { return; }; | help: use parentheses instead of braces for this macro | -LL | let bad = format_args! ("") else { return; }; - | ~ ~ +LL - let bad = format_args! {""} else { return; }; +LL + let bad = format_args! ("") else { return; }; + | error: right curly brace `}` before `else` in a `let...else` statement not allowed --> $DIR/bad-let-else-statement.rs:207:5 @@ -254,8 +255,9 @@ LL | b!(2); = note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info) help: use parentheses instead of braces for this macro | -LL | let 0 = a! () else { return; }; - | ~~ +LL - let 0 = a! {} else { return; }; +LL + let 0 = a! () else { return; }; + | warning: irrefutable `let...else` pattern --> $DIR/bad-let-else-statement.rs:95:5 diff --git a/tests/ui/parser/bad-lit-suffixes.stderr b/tests/ui/parser/bad-lit-suffixes.stderr index 121db2058f1..d6b50b0e0d1 100644 --- a/tests/ui/parser/bad-lit-suffixes.stderr +++ b/tests/ui/parser/bad-lit-suffixes.stderr @@ -30,9 +30,11 @@ LL | #[must_use = "string"suffix] | help: the following are the possible correct uses | -LL | #[must_use = "reason"] +LL - #[must_use = "string"suffix] +LL + #[must_use = "reason"] | -LL | #[must_use] +LL - #[must_use = "string"suffix] +LL + #[must_use] | error: suffixes on string literals are invalid @@ -53,7 +55,7 @@ warning: extern declarations without an explicit ABI are deprecated --> $DIR/bad-lit-suffixes.rs:3:1 | LL | extern - | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | = note: `#[warn(missing_abi)]` on by default @@ -61,7 +63,7 @@ warning: extern declarations without an explicit ABI are deprecated --> $DIR/bad-lit-suffixes.rs:7:1 | LL | extern - | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` error: suffixes on string literals are invalid --> $DIR/bad-lit-suffixes.rs:12:5 diff --git a/tests/ui/parser/byte-literals.stderr b/tests/ui/parser/byte-literals.stderr index 25e31995441..1c89e8e2864 100644 --- a/tests/ui/parser/byte-literals.stderr +++ b/tests/ui/parser/byte-literals.stderr @@ -40,7 +40,7 @@ LL | b'''; help: escape the character | LL | b'\''; - | ~~ + | + error: non-ASCII character in byte literal --> $DIR/byte-literals.rs:10:7 @@ -50,8 +50,9 @@ LL | b'é'; | help: if you meant to use the unicode code point for 'é', use a \xHH escape | -LL | b'\xE9'; - | ~~~~ +LL - b'é'; +LL + b'\xE9'; + | error[E0763]: unterminated byte constant --> $DIR/byte-literals.rs:11:6 diff --git a/tests/ui/parser/byte-string-literals.stderr b/tests/ui/parser/byte-string-literals.stderr index 24e0eaac8fa..08633742557 100644 --- a/tests/ui/parser/byte-string-literals.stderr +++ b/tests/ui/parser/byte-string-literals.stderr @@ -28,8 +28,9 @@ LL | b"é"; | help: if you meant to use the unicode code point for 'é', use a \xHH escape | -LL | b"\xE9"; - | ~~~~ +LL - b"é"; +LL + b"\xE9"; + | error: non-ASCII character in raw byte string literal --> $DIR/byte-string-literals.rs:7:10 diff --git a/tests/ui/parser/const-param-decl-on-type-instead-of-impl.stderr b/tests/ui/parser/const-param-decl-on-type-instead-of-impl.stderr index 104dbd02685..855163e3d3b 100644 --- a/tests/ui/parser/const-param-decl-on-type-instead-of-impl.stderr +++ b/tests/ui/parser/const-param-decl-on-type-instead-of-impl.stderr @@ -6,8 +6,9 @@ LL | impl NInts<const N: usize> {} | help: `const` parameters must be declared for the `impl` | -LL | impl<const N: usize> NInts<N> {} - | ++++++++++++++++ ~ +LL - impl NInts<const N: usize> {} +LL + impl<const N: usize> NInts<N> {} + | error: unexpected `const` parameter declaration --> $DIR/const-param-decl-on-type-instead-of-impl.rs:8:17 diff --git a/tests/ui/parser/default-on-wrong-item-kind.stderr b/tests/ui/parser/default-on-wrong-item-kind.stderr index 392c85e0c43..56641565b16 100644 --- a/tests/ui/parser/default-on-wrong-item-kind.stderr +++ b/tests/ui/parser/default-on-wrong-item-kind.stderr @@ -159,8 +159,9 @@ LL | default const foo: u8; = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html help: try using a static value | -LL | static foo: u8; - | ~~~~~~ +LL - default const foo: u8; +LL + static foo: u8; + | error: a module cannot be `default` --> $DIR/default-on-wrong-item-kind.rs:41:5 diff --git a/tests/ui/parser/do-catch-suggests-try.stderr b/tests/ui/parser/do-catch-suggests-try.stderr index fd3406ae29f..2eaab836075 100644 --- a/tests/ui/parser/do-catch-suggests-try.stderr +++ b/tests/ui/parser/do-catch-suggests-try.stderr @@ -7,8 +7,9 @@ LL | let _: Option<()> = do catch {}; = note: following RFC #2388, the new non-placeholder syntax is `try` help: replace with the new syntax | -LL | let _: Option<()> = try {}; - | ~~~ +LL - let _: Option<()> = do catch {}; +LL + let _: Option<()> = try {}; + | error[E0308]: mismatched types --> $DIR/do-catch-suggests-try.rs:9:33 diff --git a/tests/ui/parser/dotdotdot-expr.stderr b/tests/ui/parser/dotdotdot-expr.stderr index 208c04bd3df..f0bc57264a6 100644 --- a/tests/ui/parser/dotdotdot-expr.stderr +++ b/tests/ui/parser/dotdotdot-expr.stderr @@ -6,12 +6,14 @@ LL | let _redemptive = 1...21; | help: use `..` for an exclusive range | -LL | let _redemptive = 1..21; - | ~~ +LL - let _redemptive = 1...21; +LL + let _redemptive = 1..21; + | help: or `..=` for an inclusive range | -LL | let _redemptive = 1..=21; - | ~~~ +LL - let _redemptive = 1...21; +LL + let _redemptive = 1..=21; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/duplicate-where-clauses.stderr b/tests/ui/parser/duplicate-where-clauses.stderr index 8250d4f1e05..298cdab0c68 100644 --- a/tests/ui/parser/duplicate-where-clauses.stderr +++ b/tests/ui/parser/duplicate-where-clauses.stderr @@ -8,8 +8,9 @@ LL | struct A where (): Sized where (): Sized {} | help: consider joining the two `where` clauses into one | -LL | struct A where (): Sized, (): Sized {} - | ~ +LL - struct A where (): Sized where (): Sized {} +LL + struct A where (): Sized, (): Sized {} + | error: cannot define duplicate `where` clauses on an item --> $DIR/duplicate-where-clauses.rs:4:30 @@ -21,8 +22,9 @@ LL | fn b() where (): Sized where (): Sized {} | help: consider joining the two `where` clauses into one | -LL | fn b() where (): Sized, (): Sized {} - | ~ +LL - fn b() where (): Sized where (): Sized {} +LL + fn b() where (): Sized, (): Sized {} + | error: cannot define duplicate `where` clauses on an item --> $DIR/duplicate-where-clauses.rs:7:30 @@ -34,8 +36,9 @@ LL | enum C where (): Sized where (): Sized {} | help: consider joining the two `where` clauses into one | -LL | enum C where (): Sized, (): Sized {} - | ~ +LL - enum C where (): Sized where (): Sized {} +LL + enum C where (): Sized, (): Sized {} + | error: cannot define duplicate `where` clauses on an item --> $DIR/duplicate-where-clauses.rs:10:33 @@ -47,8 +50,9 @@ LL | struct D where (): Sized, where (): Sized {} | help: consider joining the two `where` clauses into one | -LL | struct D where (): Sized, (): Sized {} - | ~ +LL - struct D where (): Sized, where (): Sized {} +LL + struct D where (): Sized, (): Sized {} + | error: cannot define duplicate `where` clauses on an item --> $DIR/duplicate-where-clauses.rs:13:31 @@ -60,8 +64,9 @@ LL | fn e() where (): Sized, where (): Sized {} | help: consider joining the two `where` clauses into one | -LL | fn e() where (): Sized, (): Sized {} - | ~ +LL - fn e() where (): Sized, where (): Sized {} +LL + fn e() where (): Sized, (): Sized {} + | error: cannot define duplicate `where` clauses on an item --> $DIR/duplicate-where-clauses.rs:16:31 @@ -73,8 +78,9 @@ LL | enum F where (): Sized, where (): Sized {} | help: consider joining the two `where` clauses into one | -LL | enum F where (): Sized, (): Sized {} - | ~ +LL - enum F where (): Sized, where (): Sized {} +LL + enum F where (): Sized, (): Sized {} + | error: aborting due to 6 previous errors diff --git a/tests/ui/parser/emoji-identifiers.stderr b/tests/ui/parser/emoji-identifiers.stderr index 536afc53f0c..f0e90082bff 100644 --- a/tests/ui/parser/emoji-identifiers.stderr +++ b/tests/ui/parser/emoji-identifiers.stderr @@ -6,8 +6,9 @@ LL | let _ = i_like_to_😄_a_lot() ➖ 4; | help: Unicode character '➖' (Heavy Minus Sign) looks like '-' (Minus/Hyphen), but it is not | -LL | let _ = i_like_to_😄_a_lot() - 4; - | ~ +LL - let _ = i_like_to_😄_a_lot() ➖ 4; +LL + let _ = i_like_to_😄_a_lot() - 4; + | error: identifiers cannot contain emoji: `ABig👩👩👧👧Family` --> $DIR/emoji-identifiers.rs:1:8 @@ -80,8 +81,9 @@ LL | fn full_of_✨() -> 👀 { | ^^^^^^^^^^^^^^^^^^^^^ help: there is an associated function `full_of_✨` with a similar name | -LL | 👀::full_of_✨() - | ~~~~~~~~~~ +LL - 👀::full_of✨() +LL + 👀::full_of_✨() + | error[E0425]: cannot find function `i_like_to_😄_a_lot` in this scope --> $DIR/emoji-identifiers.rs:13:13 diff --git a/tests/ui/parser/eq-gt-to-gt-eq.stderr b/tests/ui/parser/eq-gt-to-gt-eq.stderr index 73f465f7b9b..aa47ddecce9 100644 --- a/tests/ui/parser/eq-gt-to-gt-eq.stderr +++ b/tests/ui/parser/eq-gt-to-gt-eq.stderr @@ -11,8 +11,9 @@ LL | if a => b {} | ^ help: you might have meant to write a "greater than or equal to" comparison | -LL | if a >= b {} - | ~~ +LL - if a => b {} +LL + if a >= b {} + | error: expected `{`, found `=>` --> $DIR/eq-gt-to-gt-eq.rs:13:10 @@ -27,8 +28,9 @@ LL | if a => 1 {} | ^ help: you might have meant to write a "greater than or equal to" comparison | -LL | if a >= 1 {} - | ~~ +LL - if a => 1 {} +LL + if a >= 1 {} + | error: expected `{`, found `=>` --> $DIR/eq-gt-to-gt-eq.rs:18:10 @@ -43,8 +45,9 @@ LL | if 1 => a {} | ^ help: you might have meant to write a "greater than or equal to" comparison | -LL | if 1 >= a {} - | ~~ +LL - if 1 => a {} +LL + if 1 >= a {} + | error: expected `{`, found `=>` --> $DIR/eq-gt-to-gt-eq.rs:24:10 @@ -59,8 +62,9 @@ LL | if a => b && a != b {} | ^ help: you might have meant to write a "greater than or equal to" comparison | -LL | if a >= b && a != b {} - | ~~ +LL - if a => b && a != b {} +LL + if a >= b && a != b {} + | error: expected `{`, found `=>` --> $DIR/eq-gt-to-gt-eq.rs:30:20 @@ -75,8 +79,9 @@ LL | if a != b && a => b {} | ^^^^^^^^^^^ help: you might have meant to write a "greater than or equal to" comparison | -LL | if a != b && a >= b {} - | ~~ +LL - if a != b && a => b {} +LL + if a != b && a >= b {} + | error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `=>` --> $DIR/eq-gt-to-gt-eq.rs:36:15 @@ -86,8 +91,9 @@ LL | let _ = a => b; | help: you might have meant to write a "greater than or equal to" comparison | -LL | let _ = a >= b; - | ~~ +LL - let _ = a => b; +LL + let _ = a >= b; + | error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `=>` --> $DIR/eq-gt-to-gt-eq.rs:42:13 @@ -99,8 +105,9 @@ LL | match a => b { | help: you might have meant to write a "greater than or equal to" comparison | -LL | match a >= b { - | ~~ +LL - match a => b { +LL + match a >= b { + | error: aborting due to 7 previous errors diff --git a/tests/ui/parser/expr-rarrow-call.stderr b/tests/ui/parser/expr-rarrow-call.stderr index 221e3a74d79..2e168ca26fe 100644 --- a/tests/ui/parser/expr-rarrow-call.stderr +++ b/tests/ui/parser/expr-rarrow-call.stderr @@ -7,8 +7,9 @@ LL | named->foo; = help: the `.` operator will dereference the value if needed help: try using `.` instead | -LL | named.foo; - | ~ +LL - named->foo; +LL + named.foo; + | error: `->` used for field access or method call --> $DIR/expr-rarrow-call.rs:18:12 @@ -19,8 +20,9 @@ LL | unnamed->0; = help: the `.` operator will dereference the value if needed help: try using `.` instead | -LL | unnamed.0; - | ~ +LL - unnamed->0; +LL + unnamed.0; + | error: `->` used for field access or method call --> $DIR/expr-rarrow-call.rs:22:6 @@ -31,8 +33,9 @@ LL | t->0; = help: the `.` operator will dereference the value if needed help: try using `.` instead | -LL | t.0; - | ~ +LL - t->0; +LL + t.0; + | error: `->` used for field access or method call --> $DIR/expr-rarrow-call.rs:23:6 @@ -43,8 +46,9 @@ LL | t->1; = help: the `.` operator will dereference the value if needed help: try using `.` instead | -LL | t.1; - | ~ +LL - t->1; +LL + t.1; + | error: `->` used for field access or method call --> $DIR/expr-rarrow-call.rs:30:8 @@ -55,8 +59,9 @@ LL | foo->clone(); = help: the `.` operator will dereference the value if needed help: try using `.` instead | -LL | foo.clone(); - | ~ +LL - foo->clone(); +LL + foo.clone(); + | error: aborting due to 5 previous errors diff --git a/tests/ui/parser/extern-crate-unexpected-token.stderr b/tests/ui/parser/extern-crate-unexpected-token.stderr index 951b0274b0d..3d48f0adfa1 100644 --- a/tests/ui/parser/extern-crate-unexpected-token.stderr +++ b/tests/ui/parser/extern-crate-unexpected-token.stderr @@ -6,8 +6,9 @@ LL | extern crte foo; | help: there is a keyword `crate` with a similar name | -LL | extern crate foo; - | ~~~~~ +LL - extern crte foo; +LL + extern crate foo; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/extern-no-fn.stderr b/tests/ui/parser/extern-no-fn.stderr index 03826e4a93b..67acbf9b87f 100644 --- a/tests/ui/parser/extern-no-fn.stderr +++ b/tests/ui/parser/extern-no-fn.stderr @@ -12,7 +12,7 @@ LL | } help: if you meant to call a macro, try | LL | f!(); - | ~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/fn-body-eq-expr-semi.stderr b/tests/ui/parser/fn-body-eq-expr-semi.stderr index f1255d8642a..adcb4fef0a3 100644 --- a/tests/ui/parser/fn-body-eq-expr-semi.stderr +++ b/tests/ui/parser/fn-body-eq-expr-semi.stderr @@ -6,8 +6,9 @@ LL | fn foo() = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn foo() { 42 } - | ~ ~ +LL - fn foo() = 42; +LL + fn foo() { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:5:20 @@ -17,8 +18,9 @@ LL | fn bar() -> u8 = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn bar() -> u8 { 42 } - | ~ ~ +LL - fn bar() -> u8 = 42; +LL + fn bar() -> u8 { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:9:14 @@ -28,8 +30,9 @@ LL | fn foo() = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn foo() { 42 } - | ~ ~ +LL - fn foo() = 42; +LL + fn foo() { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:11:20 @@ -39,8 +42,9 @@ LL | fn bar() -> u8 = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn bar() -> u8 { 42 } - | ~ ~ +LL - fn bar() -> u8 = 42; +LL + fn bar() -> u8 { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:16:14 @@ -50,8 +54,9 @@ LL | fn foo() = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn foo() { 42 } - | ~ ~ +LL - fn foo() = 42; +LL + fn foo() { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:17:20 @@ -61,8 +66,9 @@ LL | fn bar() -> u8 = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn bar() -> u8 { 42 } - | ~ ~ +LL - fn bar() -> u8 = 42; +LL + fn bar() -> u8 { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:21:14 @@ -72,8 +78,9 @@ LL | fn foo() = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn foo() { 42 } - | ~ ~ +LL - fn foo() = 42; +LL + fn foo() { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:22:20 @@ -83,8 +90,9 @@ LL | fn bar() -> u8 = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn bar() -> u8 { 42 } - | ~ ~ +LL - fn bar() -> u8 = 42; +LL + fn bar() -> u8 { 42 } + | error: incorrect function inside `extern` block --> $DIR/fn-body-eq-expr-semi.rs:9:8 diff --git a/tests/ui/parser/fn-colon-return-type.stderr b/tests/ui/parser/fn-colon-return-type.stderr index c1cdf4d4975..d6d30c5fd07 100644 --- a/tests/ui/parser/fn-colon-return-type.stderr +++ b/tests/ui/parser/fn-colon-return-type.stderr @@ -6,8 +6,9 @@ LL | fn foo(x: i32): i32 { | help: use `->` instead | -LL | fn foo(x: i32) -> i32 { - | ~~ +LL - fn foo(x: i32): i32 { +LL + fn foo(x: i32) -> i32 { + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/foreign-const-semantic-fail.stderr b/tests/ui/parser/foreign-const-semantic-fail.stderr index d317847f98a..b2240738c49 100644 --- a/tests/ui/parser/foreign-const-semantic-fail.stderr +++ b/tests/ui/parser/foreign-const-semantic-fail.stderr @@ -7,8 +7,9 @@ LL | const A: isize; = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html help: try using a static value | -LL | static A: isize; - | ~~~~~~ +LL - const A: isize; +LL + static A: isize; + | error: extern items cannot be `const` --> $DIR/foreign-const-semantic-fail.rs:6:11 @@ -19,8 +20,9 @@ LL | const B: isize = 42; = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html help: try using a static value | -LL | static B: isize = 42; - | ~~~~~~ +LL - const B: isize = 42; +LL + static B: isize = 42; + | error: incorrect `static` inside `extern` block --> $DIR/foreign-const-semantic-fail.rs:6:11 diff --git a/tests/ui/parser/foreign-const-syntactic-fail.stderr b/tests/ui/parser/foreign-const-syntactic-fail.stderr index 7da2c019022..f7466d5d6cd 100644 --- a/tests/ui/parser/foreign-const-syntactic-fail.stderr +++ b/tests/ui/parser/foreign-const-syntactic-fail.stderr @@ -7,8 +7,9 @@ LL | const A: isize; = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html help: try using a static value | -LL | static A: isize; - | ~~~~~~ +LL - const A: isize; +LL + static A: isize; + | error: extern items cannot be `const` --> $DIR/foreign-const-syntactic-fail.rs:8:11 @@ -19,8 +20,9 @@ LL | const B: isize = 42; = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html help: try using a static value | -LL | static B: isize = 42; - | ~~~~~~ +LL - const B: isize = 42; +LL + static B: isize = 42; + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/increment-autofix-2.stderr b/tests/ui/parser/increment-autofix-2.stderr index 11e985480d6..3fee9672796 100644 --- a/tests/ui/parser/increment-autofix-2.stderr +++ b/tests/ui/parser/increment-autofix-2.stderr @@ -6,8 +6,9 @@ LL | i++; | help: use `+= 1` instead | -LL | i += 1; - | ~~~~ +LL - i++; +LL + i += 1; + | error: Rust has no postfix increment operator --> $DIR/increment-autofix-2.rs:19:12 @@ -19,8 +20,9 @@ LL | while i++ < 5 { | help: use `+= 1` instead | -LL | while { let tmp = i; i += 1; tmp } < 5 { - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - while i++ < 5 { +LL + while { let tmp = i; i += 1; tmp } < 5 { + | error: Rust has no postfix increment operator --> $DIR/increment-autofix-2.rs:27:8 @@ -30,8 +32,9 @@ LL | tmp++; | help: use `+= 1` instead | -LL | tmp += 1; - | ~~~~ +LL - tmp++; +LL + tmp += 1; + | error: Rust has no postfix increment operator --> $DIR/increment-autofix-2.rs:33:14 @@ -43,8 +46,9 @@ LL | while tmp++ < 5 { | help: use `+= 1` instead | -LL | while { let tmp_ = tmp; tmp += 1; tmp_ } < 5 { - | ++++++++++++ ~~~~~~~~~~~~~~~~~~ +LL - while tmp++ < 5 { +LL + while { let tmp_ = tmp; tmp += 1; tmp_ } < 5 { + | error: Rust has no postfix increment operator --> $DIR/increment-autofix-2.rs:41:16 @@ -54,8 +58,9 @@ LL | foo.bar.qux++; | help: use `+= 1` instead | -LL | foo.bar.qux += 1; - | ~~~~ +LL - foo.bar.qux++; +LL + foo.bar.qux += 1; + | error: Rust has no postfix increment operator --> $DIR/increment-autofix-2.rs:51:10 @@ -65,8 +70,9 @@ LL | s.tmp++; | help: use `+= 1` instead | -LL | s.tmp += 1; - | ~~~~ +LL - s.tmp++; +LL + s.tmp += 1; + | error: Rust has no prefix increment operator --> $DIR/increment-autofix-2.rs:58:5 diff --git a/tests/ui/parser/increment-autofix.stderr b/tests/ui/parser/increment-autofix.stderr index 1dc69fd9f46..ffff91abee9 100644 --- a/tests/ui/parser/increment-autofix.stderr +++ b/tests/ui/parser/increment-autofix.stderr @@ -20,8 +20,9 @@ LL | while ++i < 5 { | help: use `+= 1` instead | -LL | while { i += 1; i } < 5 { - | ~ +++++++++ +LL - while ++i < 5 { +LL + while { i += 1; i } < 5 { + | error: Rust has no prefix increment operator --> $DIR/increment-autofix.rs:19:5 @@ -45,8 +46,9 @@ LL | while ++tmp < 5 { | help: use `+= 1` instead | -LL | while { tmp += 1; tmp } < 5 { - | ~ +++++++++++ +LL - while ++tmp < 5 { +LL + while { tmp += 1; tmp } < 5 { + | error: aborting due to 4 previous errors diff --git a/tests/ui/parser/intersection-patterns-1.stderr b/tests/ui/parser/intersection-patterns-1.stderr index ed2466b21a7..c191b46fa45 100644 --- a/tests/ui/parser/intersection-patterns-1.stderr +++ b/tests/ui/parser/intersection-patterns-1.stderr @@ -9,8 +9,9 @@ LL | Some(x) @ y => {} | help: switch the order | -LL | y @ Some(x) => {} - | ~~~~~~~~~~~ +LL - Some(x) @ y => {} +LL + y @ Some(x) => {} + | error: pattern on wrong side of `@` --> $DIR/intersection-patterns-1.rs:27:9 @@ -23,8 +24,9 @@ LL | 1 ..= 5 @ e => {} | help: switch the order | -LL | e @ 1..=5 => {} - | ~~~~~~~~~ +LL - 1 ..= 5 @ e => {} +LL + e @ 1..=5 => {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-100197-mut-let.stderr b/tests/ui/parser/issues/issue-100197-mut-let.stderr index 252ed7d0715..e43d5f68607 100644 --- a/tests/ui/parser/issues/issue-100197-mut-let.stderr +++ b/tests/ui/parser/issues/issue-100197-mut-let.stderr @@ -6,8 +6,9 @@ LL | mut let _x = 123; | help: switch the order of `mut` and `let` | -LL | let mut _x = 123; - | ~~~~~~~ +LL - mut let _x = 123; +LL + let mut _x = 123; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-101477-enum.stderr b/tests/ui/parser/issues/issue-101477-enum.stderr index 8d4efdd17f7..c6dadeab8b3 100644 --- a/tests/ui/parser/issues/issue-101477-enum.stderr +++ b/tests/ui/parser/issues/issue-101477-enum.stderr @@ -7,8 +7,9 @@ LL | B == 2 = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` help: try using `=` instead | -LL | B = 2 - | ~ +LL - B == 2 +LL + B = 2 + | error: expected item, found `==` --> $DIR/issue-101477-enum.rs:6:7 diff --git a/tests/ui/parser/issues/issue-101477-let.stderr b/tests/ui/parser/issues/issue-101477-let.stderr index d2671abbdea..59e90c8102f 100644 --- a/tests/ui/parser/issues/issue-101477-let.stderr +++ b/tests/ui/parser/issues/issue-101477-let.stderr @@ -6,8 +6,9 @@ LL | let x == 2; | help: try using `=` instead | -LL | let x = 2; - | ~ +LL - let x == 2; +LL + let x = 2; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-102806.stderr b/tests/ui/parser/issues/issue-102806.stderr index ba8174a823b..cd447c6dec0 100644 --- a/tests/ui/parser/issues/issue-102806.stderr +++ b/tests/ui/parser/issues/issue-102806.stderr @@ -6,8 +6,9 @@ LL | let _ = V3 { z: 0.0, ...v}; | help: use `..` to fill in the rest of the fields | -LL | let _ = V3 { z: 0.0, ..v}; - | ~~ +LL - let _ = V3 { z: 0.0, ...v}; +LL + let _ = V3 { z: 0.0, ..v}; + | error: expected `..`, found `...` --> $DIR/issue-102806.rs:14:26 @@ -17,8 +18,9 @@ LL | let _ = V3 { z: 0.0, ...Default::default() }; | help: use `..` to fill in the rest of the fields | -LL | let _ = V3 { z: 0.0, ..Default::default() }; - | ~~ +LL - let _ = V3 { z: 0.0, ...Default::default() }; +LL + let _ = V3 { z: 0.0, ..Default::default() }; + | error: expected identifier, found `...` --> $DIR/issue-102806.rs:17:26 @@ -36,8 +38,9 @@ LL | let V3 { z: val, ... } = v; | help: to omit remaining fields, use `..` | -LL | let V3 { z: val, .. } = v; - | ~~ +LL - let V3 { z: val, ... } = v; +LL + let V3 { z: val, .. } = v; + | error[E0063]: missing fields `x` and `y` in initializer of `V3` --> $DIR/issue-102806.rs:17:13 diff --git a/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr index b0d8b03ae08..97a73b4fd5e 100644 --- a/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr +++ b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr @@ -6,8 +6,9 @@ LL | struct Apple((Apple, Option(Banana ? Citron))); | help: if you meant to express that the type might not contain a value, use the `Option` wrapper type | -LL | struct Apple((Apple, Option(Option<Banana > Citron))); - | +++++++ ~ +LL - struct Apple((Apple, Option(Banana ? Citron))); +LL + struct Apple((Apple, Option(Option<Banana > Citron))); + | error: expected one of `)` or `,`, found `Citron` --> $DIR/issue-103748-ICE-wrong-braces.rs:3:38 @@ -31,8 +32,9 @@ LL | struct Apple((Apple, Option(Banana ? Citron))); | help: use angle brackets instead | -LL | struct Apple((Apple, Option<Banana ? Citron>)); - | ~ ~ +LL - struct Apple((Apple, Option(Banana ? Citron))); +LL + struct Apple((Apple, Option<Banana ? Citron>)); + | error[E0072]: recursive type `Apple` has infinite size --> $DIR/issue-103748-ICE-wrong-braces.rs:3:1 diff --git a/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr b/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr index 4e2d0546851..f2412dda050 100644 --- a/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr +++ b/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr @@ -6,8 +6,9 @@ LL | let _ = i + ++i; | help: use `+= 1` instead | -LL | let _ = i + { i += 1; i }; - | ~ +++++++++ +LL - let _ = i + ++i; +LL + let _ = i + { i += 1; i }; + | error: Rust has no prefix increment operator --> $DIR/issue-104867-inc-dec-2.rs:8:13 @@ -17,8 +18,9 @@ LL | let _ = ++i + i; | help: use `+= 1` instead | -LL | let _ = { i += 1; i } + i; - | ~ +++++++++ +LL - let _ = ++i + i; +LL + let _ = { i += 1; i } + i; + | error: Rust has no prefix increment operator --> $DIR/issue-104867-inc-dec-2.rs:13:13 @@ -28,8 +30,9 @@ LL | let _ = ++i + ++i; | help: use `+= 1` instead | -LL | let _ = { i += 1; i } + ++i; - | ~ +++++++++ +LL - let _ = ++i + ++i; +LL + let _ = { i += 1; i } + ++i; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec-2.rs:18:18 @@ -45,8 +48,9 @@ LL | let _ = i++ + i; | help: use `+= 1` instead | -LL | let _ = { let tmp = i; i += 1; tmp } + i; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = i++ + i; +LL + let _ = { let tmp = i; i += 1; tmp } + i; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec-2.rs:29:14 @@ -56,8 +60,9 @@ LL | let _ = i++ + i++; | help: use `+= 1` instead | -LL | let _ = { let tmp = i; i += 1; tmp } + i++; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = i++ + i++; +LL + let _ = { let tmp = i; i += 1; tmp } + i++; + | error: Rust has no prefix increment operator --> $DIR/issue-104867-inc-dec-2.rs:34:13 @@ -67,8 +72,9 @@ LL | let _ = ++i + i++; | help: use `+= 1` instead | -LL | let _ = { i += 1; i } + i++; - | ~ +++++++++ +LL - let _ = ++i + i++; +LL + let _ = { i += 1; i } + i++; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec-2.rs:39:14 @@ -78,8 +84,9 @@ LL | let _ = i++ + ++i; | help: use `+= 1` instead | -LL | let _ = { let tmp = i; i += 1; tmp } + ++i; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = i++ + ++i; +LL + let _ = { let tmp = i; i += 1; tmp } + ++i; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec-2.rs:44:24 @@ -89,8 +96,9 @@ LL | let _ = (1 + 2 + i)++; | help: use `+= 1` instead | -LL | let _ = { let tmp = (1 + 2 + i); (1 + 2 + i) += 1; tmp }; - | +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = (1 + 2 + i)++; +LL + let _ = { let tmp = (1 + 2 + i); (1 + 2 + i) += 1; tmp }; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec-2.rs:49:15 @@ -100,8 +108,9 @@ LL | let _ = (i++ + 1) + 2; | help: use `+= 1` instead | -LL | let _ = ({ let tmp = i; i += 1; tmp } + 1) + 2; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = (i++ + 1) + 2; +LL + let _ = ({ let tmp = i; i += 1; tmp } + 1) + 2; + | error: aborting due to 10 previous errors diff --git a/tests/ui/parser/issues/issue-104867-inc-dec.stderr b/tests/ui/parser/issues/issue-104867-inc-dec.stderr index 78bfd3e82f0..309f8b56933 100644 --- a/tests/ui/parser/issues/issue-104867-inc-dec.stderr +++ b/tests/ui/parser/issues/issue-104867-inc-dec.stderr @@ -6,8 +6,9 @@ LL | i++; | help: use `+= 1` instead | -LL | i += 1; - | ~~~~ +LL - i++; +LL + i += 1; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec.rs:12:8 @@ -17,8 +18,9 @@ LL | s.x++; | help: use `+= 1` instead | -LL | s.x += 1; - | ~~~~ +LL - s.x++; +LL + s.x += 1; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec.rs:17:9 @@ -28,8 +30,9 @@ LL | if i++ == 1 {} | help: use `+= 1` instead | -LL | if { let tmp = i; i += 1; tmp } == 1 {} - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - if i++ == 1 {} +LL + if { let tmp = i; i += 1; tmp } == 1 {} + | error: Rust has no prefix increment operator --> $DIR/issue-104867-inc-dec.rs:22:5 @@ -51,8 +54,9 @@ LL | if ++i == 1 { } | help: use `+= 1` instead | -LL | if { i += 1; i } == 1 { } - | ~ +++++++++ +LL - if ++i == 1 { } +LL + if { i += 1; i } == 1 { } + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec.rs:33:6 @@ -62,8 +66,9 @@ LL | i++; | help: use `+= 1` instead | -LL | i += 1; - | ~~~~ +LL - i++; +LL + i += 1; + | error: Rust has no prefix increment operator --> $DIR/issue-104867-inc-dec.rs:41:5 diff --git a/tests/ui/parser/issues/issue-105366.stderr b/tests/ui/parser/issues/issue-105366.stderr index 18c04dfaf20..d8c79a0e0ea 100644 --- a/tests/ui/parser/issues/issue-105366.stderr +++ b/tests/ui/parser/issues/issue-105366.stderr @@ -6,8 +6,9 @@ LL | fn From<i32> for Foo { | help: replace `fn` with `impl` here | -LL | impl From<i32> for Foo { - | ~~~~ +LL - fn From<i32> for Foo { +LL + impl From<i32> for Foo { + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-108495-dec.stderr b/tests/ui/parser/issues/issue-108495-dec.stderr index 85b29038f7c..b058dae4a6f 100644 --- a/tests/ui/parser/issues/issue-108495-dec.stderr +++ b/tests/ui/parser/issues/issue-108495-dec.stderr @@ -12,8 +12,9 @@ LL | let _ = i-- + i--; | help: use `-= 1` instead | -LL | let _ = { let tmp = i; i -= 1; tmp } + i--; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = i-- + i--; +LL + let _ = { let tmp = i; i -= 1; tmp } + i--; + | error: Rust has no postfix decrement operator --> $DIR/issue-108495-dec.rs:14:20 @@ -29,8 +30,9 @@ LL | let _ = i-- + --i; | help: use `-= 1` instead | -LL | let _ = { let tmp = i; i -= 1; tmp } + --i; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = i-- + --i; +LL + let _ = { let tmp = i; i -= 1; tmp } + --i; + | error: Rust has no postfix decrement operator --> $DIR/issue-108495-dec.rs:24:24 @@ -40,8 +42,9 @@ LL | let _ = (1 + 2 + i)--; | help: use `-= 1` instead | -LL | let _ = { let tmp = (1 + 2 + i); (1 + 2 + i) -= 1; tmp }; - | +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = (1 + 2 + i)--; +LL + let _ = { let tmp = (1 + 2 + i); (1 + 2 + i) -= 1; tmp }; + | error: Rust has no postfix decrement operator --> $DIR/issue-108495-dec.rs:29:15 @@ -51,8 +54,9 @@ LL | let _ = (i-- + 1) + 2; | help: use `-= 1` instead | -LL | let _ = ({ let tmp = i; i -= 1; tmp } + 1) + 2; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = (i-- + 1) + 2; +LL + let _ = ({ let tmp = i; i -= 1; tmp } + 1) + 2; + | error: Rust has no postfix decrement operator --> $DIR/issue-108495-dec.rs:35:10 @@ -62,8 +66,9 @@ LL | i--; | help: use `-= 1` instead | -LL | i -= 1; - | ~~~~ +LL - i--; +LL + i -= 1; + | error: aborting due to 7 previous errors diff --git a/tests/ui/parser/issues/issue-110014.stderr b/tests/ui/parser/issues/issue-110014.stderr index 7f1dd592e12..57420bb3496 100644 --- a/tests/ui/parser/issues/issue-110014.stderr +++ b/tests/ui/parser/issues/issue-110014.stderr @@ -6,8 +6,9 @@ LL | fn`2222222222222222222222222222222222222222() {} | help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not | -LL | fn'2222222222222222222222222222222222222222() {} - | ~ +LL - fn`2222222222222222222222222222222222222222() {} +LL + fn'2222222222222222222222222222222222222222() {} + | error: expected identifier, found `2222222222222222222222222222222222222222` --> $DIR/issue-110014.rs:1:4 diff --git a/tests/ui/parser/issues/issue-111416.stderr b/tests/ui/parser/issues/issue-111416.stderr index 36f6c5b018f..50ff209afff 100644 --- a/tests/ui/parser/issues/issue-111416.stderr +++ b/tests/ui/parser/issues/issue-111416.stderr @@ -6,8 +6,9 @@ LL | let my = monad_bind(mx, T: Try); | help: if `monad_bind` is a struct, use braces as delimiters | -LL | let my = monad_bind { mx, T: Try }; - | ~ ~ +LL - let my = monad_bind(mx, T: Try); +LL + let my = monad_bind { mx, T: Try }; + | help: if `monad_bind` is a function, use the arguments directly | LL - let my = monad_bind(mx, T: Try); diff --git a/tests/ui/parser/issues/issue-118530-ice.stderr b/tests/ui/parser/issues/issue-118530-ice.stderr index 3519fb8777f..72c0397e9c9 100644 --- a/tests/ui/parser/issues/issue-118530-ice.stderr +++ b/tests/ui/parser/issues/issue-118530-ice.stderr @@ -42,8 +42,9 @@ LL | attr::fn bar() -> String { = help: the `.` operator will dereference the value if needed help: try using `.` instead | -LL | attr::fn bar() . String { - | ~ +LL - attr::fn bar() -> String { +LL + attr::fn bar() . String { + | error: expected one of `(`, `.`, `::`, `;`, `?`, `}`, or an operator, found `{` --> $DIR/issue-118530-ice.rs:5:30 diff --git a/tests/ui/parser/issues/issue-17718-const-mut.stderr b/tests/ui/parser/issues/issue-17718-const-mut.stderr index 54b819c3cfb..16eb773e7f6 100644 --- a/tests/ui/parser/issues/issue-17718-const-mut.stderr +++ b/tests/ui/parser/issues/issue-17718-const-mut.stderr @@ -6,7 +6,8 @@ LL | mut | help: you might want to declare a static instead | -LL | static +LL - const +LL + static | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-23620-invalid-escapes.stderr b/tests/ui/parser/issues/issue-23620-invalid-escapes.stderr index 4a3743579e7..0cedc178001 100644 --- a/tests/ui/parser/issues/issue-23620-invalid-escapes.stderr +++ b/tests/ui/parser/issues/issue-23620-invalid-escapes.stderr @@ -90,8 +90,9 @@ LL | let _ = "\u8f"; | help: format of unicode escape sequences uses braces | -LL | let _ = "\u{8f}"; - | ~~~~~~ +LL - let _ = "\u8f"; +LL + let _ = "\u{8f}"; + | error: aborting due to 13 previous errors diff --git a/tests/ui/parser/issues/issue-24375.stderr b/tests/ui/parser/issues/issue-24375.stderr index 03cd33f1875..2af57a52035 100644 --- a/tests/ui/parser/issues/issue-24375.stderr +++ b/tests/ui/parser/issues/issue-24375.stderr @@ -7,8 +7,9 @@ LL | tmp[0] => {} = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == tmp[0] => {} - | ~~~ ++++++++++++++++ +LL - tmp[0] => {} +LL + val if val == tmp[0] => {} + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = tmp[0]; diff --git a/tests/ui/parser/issues/issue-30318.stderr b/tests/ui/parser/issues/issue-30318.stderr index 56bc200db1d..cd03bd5fecc 100644 --- a/tests/ui/parser/issues/issue-30318.stderr +++ b/tests/ui/parser/issues/issue-30318.stderr @@ -9,8 +9,9 @@ LL | fn bar() { } | help: to annotate the function, change the doc comment from inner to outer style | -LL | /// Misplaced comment... - | ~ +LL - //! Misplaced comment... +LL + /// Misplaced comment... + | error: an inner attribute is not permitted in this context --> $DIR/issue-30318.rs:9:1 @@ -38,8 +39,9 @@ LL | fn bat() { } | help: to annotate the function, change the doc comment from inner to outer style | -LL | /** Misplaced comment... */ - | ~ +LL - /*! Misplaced comment... */ +LL + /** Misplaced comment... */ + | error[E0753]: expected outer doc comment --> $DIR/issue-30318.rs:19:1 diff --git a/tests/ui/parser/issues/issue-32214.stderr b/tests/ui/parser/issues/issue-32214.stderr index 2ef4305dfd0..5ccd651bb96 100644 --- a/tests/ui/parser/issues/issue-32214.stderr +++ b/tests/ui/parser/issues/issue-32214.stderr @@ -8,8 +8,9 @@ LL | pub fn test<W, I: Trait<Item=(), W> >() {} | help: move the constraint after the generic argument | -LL | pub fn test<W, I: Trait<W, Item = ()> >() {} - | ~~~~~~~~~~~~~~ +LL - pub fn test<W, I: Trait<Item=(), W> >() {} +LL + pub fn test<W, I: Trait<W, Item = ()> >() {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-34255-1.stderr b/tests/ui/parser/issues/issue-34255-1.stderr index 1e72f040b03..cd2baaee408 100644 --- a/tests/ui/parser/issues/issue-34255-1.stderr +++ b/tests/ui/parser/issues/issue-34255-1.stderr @@ -6,8 +6,9 @@ LL | Test::Drill(field: 42); | help: if `Test::Drill` is a struct, use braces as delimiters | -LL | Test::Drill { field: 42 }; - | ~ ~ +LL - Test::Drill(field: 42); +LL + Test::Drill { field: 42 }; + | help: if `Test::Drill` is a function, use the arguments directly | LL - Test::Drill(field: 42); diff --git a/tests/ui/parser/issues/issue-44406.stderr b/tests/ui/parser/issues/issue-44406.stderr index 78cde9b6dca..b2367ce15ea 100644 --- a/tests/ui/parser/issues/issue-44406.stderr +++ b/tests/ui/parser/issues/issue-44406.stderr @@ -10,8 +10,9 @@ LL | foo!(true); = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) help: if `bar` is a struct, use braces as delimiters | -LL | bar { baz: $rest } - | ~ ~ +LL - bar(baz: $rest) +LL + bar { baz: $rest } + | help: if `bar` is a function, use the arguments directly | LL - bar(baz: $rest) diff --git a/tests/ui/parser/issues/issue-57684.stderr b/tests/ui/parser/issues/issue-57684.stderr index 39e1c8cd7cc..5fc55efff0a 100644 --- a/tests/ui/parser/issues/issue-57684.stderr +++ b/tests/ui/parser/issues/issue-57684.stderr @@ -6,8 +6,9 @@ LL | let _ = X { f1 = 5 }; | help: replace equals symbol with a colon | -LL | let _ = X { f1: 5 }; - | ~ +LL - let _ = X { f1 = 5 }; +LL + let _ = X { f1: 5 }; + | error: expected `:`, found `=` --> $DIR/issue-57684.rs:32:12 @@ -17,8 +18,9 @@ LL | f1 = 5, | help: replace equals symbol with a colon | -LL | f1: 5, - | ~ +LL - f1 = 5, +LL + f1: 5, + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-64732.stderr b/tests/ui/parser/issues/issue-64732.stderr index 7ec2df6d3bf..d9f8091d2df 100644 --- a/tests/ui/parser/issues/issue-64732.stderr +++ b/tests/ui/parser/issues/issue-64732.stderr @@ -6,8 +6,9 @@ LL | let _foo = b'hello\0'; | help: if you meant to write a byte string literal, use double quotes | -LL | let _foo = b"hello\0"; - | ~~ ~ +LL - let _foo = b'hello\0'; +LL + let _foo = b"hello\0"; + | error: character literal may only contain one codepoint --> $DIR/issue-64732.rs:6:16 @@ -17,8 +18,9 @@ LL | let _bar = 'hello'; | help: if you meant to write a string literal, use double quotes | -LL | let _bar = "hello"; - | ~ ~ +LL - let _bar = 'hello'; +LL + let _bar = "hello"; + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr index 49d091cf391..7146949ca2f 100644 --- a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr +++ b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr @@ -6,8 +6,9 @@ LL | auto n = 0; | help: write `let` instead of `auto` to introduce a new variable | -LL | let n = 0; - | ~~~ +LL - auto n = 0; +LL + let n = 0; + | error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:4:5 @@ -17,8 +18,9 @@ LL | auto m; | help: write `let` instead of `auto` to introduce a new variable | -LL | let m; - | ~~~ +LL - auto m; +LL + let m; + | error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:8:5 @@ -28,8 +30,9 @@ LL | var n = 0; | help: write `let` instead of `var` to introduce a new variable | -LL | let n = 0; - | ~~~ +LL - var n = 0; +LL + let n = 0; + | error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:10:5 @@ -39,8 +42,9 @@ LL | var m; | help: write `let` instead of `var` to introduce a new variable | -LL | let m; - | ~~~ +LL - var m; +LL + let m; + | error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:14:5 @@ -51,7 +55,7 @@ LL | mut n = 0; help: missing keyword | LL | let mut n = 0; - | ~~~~~~~ + | +++ error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:16:5 @@ -62,7 +66,7 @@ LL | mut var; help: missing keyword | LL | let mut var; - | ~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/issue-65257-invalid-var-decl-recovery.rs:20:33 diff --git a/tests/ui/parser/issues/issue-68730.stderr b/tests/ui/parser/issues/issue-68730.stderr index 9bd98287db3..838a6569bdc 100644 --- a/tests/ui/parser/issues/issue-68730.stderr +++ b/tests/ui/parser/issues/issue-68730.stderr @@ -23,8 +23,9 @@ LL | enum␀em␀˂˂ = note: character appears once more help: Unicode character '˂' (Modifier Letter Left Arrowhead) looks like '<' (Less-Than Sign), but it is not | -LL | enum␀em␀<< - | ~~ +LL - enum␀em␀˂˂ +LL + enum␀em␀<< + | error: unknown start of token: \u{2c2} --> $DIR/issue-68730.rs:5:10 @@ -34,8 +35,9 @@ LL | enum␀em␀˂˂ | help: Unicode character '˂' (Modifier Letter Left Arrowhead) looks like '<' (Less-Than Sign), but it is not | -LL | enum␀em␀˂< - | ~ +LL - enum␀em␀˂˂ +LL + enum␀em␀˂< + | error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `<` --> $DIR/issue-68730.rs:5:10 diff --git a/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr b/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr index c2c0faa21d1..9c632a8332a 100644 --- a/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr +++ b/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr @@ -12,8 +12,9 @@ LL | fn foo(&mur Self) {} | help: there is a keyword `mut` with a similar name | -LL | fn foo(&mut Self) {} - | ~~~ +LL - fn foo(&mur Self) {} +LL + fn foo(&mut Self) {} + | error: unexpected lifetime `'static` in pattern --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:13 @@ -41,8 +42,9 @@ LL | fn bar(&'static mur Self) {} | help: there is a keyword `mut` with a similar name | -LL | fn bar(&'static mut Self) {} - | ~~~ +LL - fn bar(&'static mur Self) {} +LL + fn bar(&'static mut Self) {} + | error: expected one of `:`, `@`, or `|`, found keyword `Self` --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:14:17 @@ -52,8 +54,9 @@ LL | fn baz(&mur Self @ _) {} | help: there is a keyword `mut` with a similar name | -LL | fn baz(&mut Self @ _) {} - | ~~~ +LL - fn baz(&mur Self @ _) {} +LL + fn baz(&mut Self @ _) {} + | error[E0533]: expected unit struct, found self constructor `Self` --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:4:17 diff --git a/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr b/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr index 2f8728bd78b..6b8f8e4fe4e 100644 --- a/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr +++ b/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr @@ -6,8 +6,9 @@ LL | fn x<'a>(x: &mut 'a i32){} | help: place the lifetime before `mut` | -LL | fn x<'a>(x: &'a mut i32){} - | ~~~~~~~ +LL - fn x<'a>(x: &mut 'a i32){} +LL + fn x<'a>(x: &'a mut i32){} + | error[E0178]: expected a path on the left-hand side of `+`, not `&mut 'a` --> $DIR/issue-73568-lifetime-after-mut.rs:14:13 @@ -32,8 +33,9 @@ LL | mac!('a); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) help: place the lifetime before `mut` | -LL | fn w<$lt>(w: &$lt mut i32) {} - | ~~~~~~~~ +LL - fn w<$lt>(w: &mut $lt i32) {} +LL + fn w<$lt>(w: &$lt mut i32) {} + | error[E0423]: expected value, found trait `Send` --> $DIR/issue-73568-lifetime-after-mut.rs:17:28 diff --git a/tests/ui/parser/issues/issue-84117.stderr b/tests/ui/parser/issues/issue-84117.stderr index 9f603b84434..e358bc4a2fb 100644 --- a/tests/ui/parser/issues/issue-84117.stderr +++ b/tests/ui/parser/issues/issue-84117.stderr @@ -12,8 +12,9 @@ LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str>, } | + help: use `=` if you meant to assign | -LL | let outer_local:e_outer<&str, { let inner_local =e_inner<&str, } - | ~ +LL - let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } +LL + let outer_local:e_outer<&str, { let inner_local =e_inner<&str, } + | error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,` --> $DIR/issue-84117.rs:2:65 @@ -36,8 +37,9 @@ LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }> | + help: use `=` if you meant to assign | -LL | let outer_local =e_outer<&str, { let inner_local:e_inner<&str, } - | ~ +LL - let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } +LL + let outer_local =e_outer<&str, { let inner_local:e_inner<&str, } + | error: expected one of `>`, a const expression, lifetime, or type, found `}` --> $DIR/issue-84117.rs:2:67 @@ -54,8 +56,9 @@ LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str>, } | + help: use `=` if you meant to assign | -LL | let outer_local:e_outer<&str, { let inner_local =e_inner<&str, } - | ~ +LL - let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } +LL + let outer_local:e_outer<&str, { let inner_local =e_inner<&str, } + | error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,` --> $DIR/issue-84117.rs:2:65 diff --git a/tests/ui/parser/issues/issue-84148-1.stderr b/tests/ui/parser/issues/issue-84148-1.stderr index 9261067c221..ebe9807dfe3 100644 --- a/tests/ui/parser/issues/issue-84148-1.stderr +++ b/tests/ui/parser/issues/issue-84148-1.stderr @@ -6,8 +6,9 @@ LL | fn f(t:for<>t?) | help: if you meant to express that the type might not contain a value, use the `Option` wrapper type | -LL | fn f(t:Option<for<>t>) - | +++++++ ~ +LL - fn f(t:for<>t?) +LL + fn f(t:Option<for<>t>) + | error: expected one of `->`, `where`, or `{`, found `<eof>` --> $DIR/issue-84148-1.rs:1:15 diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr index b6e24faf5da..a9bad96f9af 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -9,7 +9,7 @@ LL | Foo:Bar => {} help: maybe write a path separator here | LL | Foo::Bar => {} - | ~~ + | + error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `{`, or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:23:17 @@ -22,7 +22,7 @@ LL | qux::Foo:Bar => {} help: maybe write a path separator here | LL | qux::Foo::Bar => {} - | ~~ + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:29:12 @@ -35,7 +35,7 @@ LL | qux:Foo::Baz => {} help: maybe write a path separator here | LL | qux::Foo::Baz => {} - | ~~ + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:35:12 @@ -61,7 +61,7 @@ LL | if let Foo:Bar = f() { help: maybe write a path separator here | LL | if let Foo::Bar = f() { - | ~~ + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:49:16 @@ -100,7 +100,7 @@ LL | Foo:Bar::Baz => {} help: maybe write a path separator here | LL | Foo::Bar::Baz => {} - | ~~ + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:75:12 @@ -113,7 +113,7 @@ LL | Foo:Bar => {} help: maybe write a path separator here | LL | Foo::Bar => {} - | ~~ + | + warning: irrefutable `if let` pattern --> $DIR/issue-87086-colon-path-sep.rs:40:8 diff --git a/tests/ui/parser/issues/issue-90993.stderr b/tests/ui/parser/issues/issue-90993.stderr index a18e93f1f1a..e9ecc59ec49 100644 --- a/tests/ui/parser/issues/issue-90993.stderr +++ b/tests/ui/parser/issues/issue-90993.stderr @@ -6,12 +6,14 @@ LL | ...=. | help: use `..` for an exclusive range | -LL | ..=. - | ~~ +LL - ...=. +LL + ..=. + | help: or `..=` for an inclusive range | -LL | ..==. - | ~~~ +LL - ...=. +LL + ..==. + | error: unexpected `=` after inclusive range --> $DIR/issue-90993.rs:2:5 @@ -22,8 +24,9 @@ LL | ...=. = note: inclusive ranges end with a single equals sign (`..=`) help: use `..=` instead | -LL | ..=. - | ~~~ +LL - ...=. +LL + ..=. + | error: expected one of `-`, `;`, `}`, or path, found `.` --> $DIR/issue-90993.rs:2:9 diff --git a/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr index c98b8fa1f1e..a4e0efcaeb0 100644 --- a/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr +++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr @@ -6,8 +6,9 @@ LL | pub enum struct Range { | help: replace `enum struct` with | -LL | pub enum Range { - | ~~~~ +LL - pub enum struct Range { +LL + pub enum Range { + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr index 1ccf44a350d..73043de5290 100644 --- a/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr +++ b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr @@ -6,8 +6,9 @@ LL | const let _FOO: i32 = 123; | help: remove `let` | -LL | const _FOO: i32 = 123; - | ~~~~~ +LL - const let _FOO: i32 = 123; +LL + const _FOO: i32 = 123; + | error: `const` and `let` are mutually exclusive --> $DIR/issue-99910-const-let-mutually-exclusive.rs:6:5 @@ -17,8 +18,9 @@ LL | let const _BAR: i32 = 123; | help: remove `let` | -LL | const _BAR: i32 = 123; - | ~~~~~ +LL - let const _BAR: i32 = 123; +LL + const _BAR: i32 = 123; + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr b/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr index 2df5cca24f0..997d080f1de 100644 --- a/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr +++ b/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr @@ -17,8 +17,9 @@ LL | _ => { let _: u16 = 2u8; } | help: change the type of the numeric literal from `u8` to `u16` | -LL | _ => { let _: u16 = 2u16; } - | ~~~ +LL - _ => { let _: u16 = 2u8; } +LL + _ => { let _: u16 = 2u16; } + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/item-kw-case-mismatch.stderr b/tests/ui/parser/item-kw-case-mismatch.stderr index 36df72b5cad..df39eb10fdb 100644 --- a/tests/ui/parser/item-kw-case-mismatch.stderr +++ b/tests/ui/parser/item-kw-case-mismatch.stderr @@ -6,8 +6,9 @@ LL | Use std::ptr::read; | help: write it in the correct case (notice the capitalization difference) | -LL | use std::ptr::read; - | ~~~ +LL - Use std::ptr::read; +LL + use std::ptr::read; + | error: keyword `use` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:8:1 @@ -17,8 +18,9 @@ LL | USE std::ptr::write; | help: write it in the correct case | -LL | use std::ptr::write; - | ~~~ +LL - USE std::ptr::write; +LL + use std::ptr::write; + | error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:10:7 @@ -28,8 +30,9 @@ LL | async Fn _a() {} | help: write it in the correct case (notice the capitalization difference) | -LL | async fn _a() {} - | ~~ +LL - async Fn _a() {} +LL + async fn _a() {} + | error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:13:1 @@ -39,8 +42,9 @@ LL | Fn _b() {} | help: write it in the correct case (notice the capitalization difference) | -LL | fn _b() {} - | ~~ +LL - Fn _b() {} +LL + fn _b() {} + | error: keyword `async` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:16:1 @@ -50,8 +54,9 @@ LL | aSYNC fN _c() {} | help: write it in the correct case | -LL | async fN _c() {} - | ~~~~~ +LL - aSYNC fN _c() {} +LL + async fN _c() {} + | error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:16:7 @@ -61,8 +66,9 @@ LL | aSYNC fN _c() {} | help: write it in the correct case | -LL | aSYNC fn _c() {} - | ~~ +LL - aSYNC fN _c() {} +LL + aSYNC fn _c() {} + | error: keyword `async` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:20:1 @@ -72,8 +78,9 @@ LL | Async fn _d() {} | help: write it in the correct case | -LL | async fn _d() {} - | ~~~~~ +LL - Async fn _d() {} +LL + async fn _d() {} + | error: keyword `const` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:23:1 @@ -83,8 +90,9 @@ LL | CONST UNSAFE FN _e() {} | help: write it in the correct case | -LL | const UNSAFE FN _e() {} - | ~~~~~ +LL - CONST UNSAFE FN _e() {} +LL + const UNSAFE FN _e() {} + | error: keyword `unsafe` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:23:7 @@ -94,8 +102,9 @@ LL | CONST UNSAFE FN _e() {} | help: write it in the correct case | -LL | CONST unsafe FN _e() {} - | ~~~~~~ +LL - CONST UNSAFE FN _e() {} +LL + CONST unsafe FN _e() {} + | error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:23:14 @@ -105,8 +114,9 @@ LL | CONST UNSAFE FN _e() {} | help: write it in the correct case | -LL | CONST UNSAFE fn _e() {} - | ~~ +LL - CONST UNSAFE FN _e() {} +LL + CONST UNSAFE fn _e() {} + | error: keyword `unsafe` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:28:1 @@ -116,8 +126,9 @@ LL | unSAFE EXTern "C" fn _f() {} | help: write it in the correct case | -LL | unsafe EXTern "C" fn _f() {} - | ~~~~~~ +LL - unSAFE EXTern "C" fn _f() {} +LL + unsafe EXTern "C" fn _f() {} + | error: keyword `extern` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:28:8 @@ -127,8 +138,9 @@ LL | unSAFE EXTern "C" fn _f() {} | help: write it in the correct case | -LL | unSAFE extern "C" fn _f() {} - | ~~~~~~ +LL - unSAFE EXTern "C" fn _f() {} +LL + unSAFE extern "C" fn _f() {} + | error: keyword `extern` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:32:1 @@ -138,8 +150,9 @@ LL | EXTERN "C" FN _g() {} | help: write it in the correct case | -LL | extern "C" FN _g() {} - | ~~~~~~ +LL - EXTERN "C" FN _g() {} +LL + extern "C" FN _g() {} + | error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:32:12 @@ -149,8 +162,9 @@ LL | EXTERN "C" FN _g() {} | help: write it in the correct case | -LL | EXTERN "C" fn _g() {} - | ~~ +LL - EXTERN "C" FN _g() {} +LL + EXTERN "C" fn _g() {} + | error: aborting due to 14 previous errors diff --git a/tests/ui/parser/kw-in-trait-bounds.stderr b/tests/ui/parser/kw-in-trait-bounds.stderr index 3c54e031950..1892d0b6226 100644 --- a/tests/ui/parser/kw-in-trait-bounds.stderr +++ b/tests/ui/parser/kw-in-trait-bounds.stderr @@ -6,8 +6,9 @@ LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) | help: use `Fn` to refer to the trait (notice the capitalization difference) | -LL | fn _f<F: Fn(), G>(_: impl fn(), _: &dyn fn()) - | ~~ +LL - fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) +LL + fn _f<F: Fn(), G>(_: impl fn(), _: &dyn fn()) + | error: expected identifier, found keyword `fn` --> $DIR/kw-in-trait-bounds.rs:3:27 @@ -17,8 +18,9 @@ LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) | help: use `Fn` to refer to the trait (notice the capitalization difference) | -LL | fn _f<F: fn(), G>(_: impl Fn(), _: &dyn fn()) - | ~~ +LL - fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) +LL + fn _f<F: fn(), G>(_: impl Fn(), _: &dyn fn()) + | error: expected identifier, found keyword `fn` --> $DIR/kw-in-trait-bounds.rs:3:41 @@ -28,8 +30,9 @@ LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) | help: use `Fn` to refer to the trait (notice the capitalization difference) | -LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn Fn()) - | ~~ +LL - fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) +LL + fn _f<F: fn(), G>(_: impl fn(), _: &dyn Fn()) + | error: expected identifier, found keyword `fn` --> $DIR/kw-in-trait-bounds.rs:11:4 @@ -39,8 +42,9 @@ LL | G: fn(), | help: use `Fn` to refer to the trait (notice the capitalization difference) | -LL | G: Fn(), - | ~~ +LL - G: fn(), +LL + G: Fn(), + | error: expected identifier, found keyword `struct` --> $DIR/kw-in-trait-bounds.rs:16:10 diff --git a/tests/ui/parser/lifetime-in-pattern.stderr b/tests/ui/parser/lifetime-in-pattern.stderr index 55f9e56a429..ffda28b202b 100644 --- a/tests/ui/parser/lifetime-in-pattern.stderr +++ b/tests/ui/parser/lifetime-in-pattern.stderr @@ -23,8 +23,9 @@ LL | fn test(self: &'a str) { | +++++ help: if this is a parameter name, give it a type | -LL | fn test(str: &TypeName) { - | ~~~~~~~~~~~~~~ +LL - fn test(&'a str) { +LL + fn test(str: &TypeName) { + | help: if this is a type, explicitly ignore the parameter name | LL | fn test(_: &'a str) { diff --git a/tests/ui/parser/lifetime-semicolon.stderr b/tests/ui/parser/lifetime-semicolon.stderr index 4f8e2835e08..f0e42c36c5a 100644 --- a/tests/ui/parser/lifetime-semicolon.stderr +++ b/tests/ui/parser/lifetime-semicolon.stderr @@ -6,8 +6,9 @@ LL | fn foo<'a, 'b>(_x: &mut Foo<'a; 'b>) {} | help: use a comma to separate type parameters | -LL | fn foo<'a, 'b>(_x: &mut Foo<'a, 'b>) {} - | ~ +LL - fn foo<'a, 'b>(_x: &mut Foo<'a; 'b>) {} +LL + fn foo<'a, 'b>(_x: &mut Foo<'a, 'b>) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/lit-err-in-macro.stderr b/tests/ui/parser/lit-err-in-macro.stderr index fc2603d0b10..9422f22f9c8 100644 --- a/tests/ui/parser/lit-err-in-macro.stderr +++ b/tests/ui/parser/lit-err-in-macro.stderr @@ -8,7 +8,7 @@ warning: extern declarations without an explicit ABI are deprecated --> $DIR/lit-err-in-macro.rs:3:9 | LL | extern $abi fn f() {} - | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` ... LL | f!("Foo"__); | ----------- in this macro invocation diff --git a/tests/ui/parser/macros-no-semicolon-items.stderr b/tests/ui/parser/macros-no-semicolon-items.stderr index 6d2431c4aec..07fa2439df5 100644 --- a/tests/ui/parser/macros-no-semicolon-items.stderr +++ b/tests/ui/parser/macros-no-semicolon-items.stderr @@ -6,8 +6,9 @@ LL | macro_rules! foo() | help: change the delimiters to curly braces | -LL | macro_rules! foo{} - | ~~ +LL - macro_rules! foo() +LL + macro_rules! foo{} + | help: add a semicolon | LL | macro_rules! foo(); diff --git a/tests/ui/parser/match-arm-without-body.stderr b/tests/ui/parser/match-arm-without-body.stderr index 53cf3480dbf..9df8485972f 100644 --- a/tests/ui/parser/match-arm-without-body.stderr +++ b/tests/ui/parser/match-arm-without-body.stderr @@ -18,7 +18,8 @@ LL | (Some(_),) | + + help: ...or a vertical bar to match on multiple alternatives | -LL | Some(_) | +LL - Some(_), +LL + Some(_) | | error: unexpected `,` in pattern diff --git a/tests/ui/parser/match-arm-without-braces.stderr b/tests/ui/parser/match-arm-without-braces.stderr index 4a4a154d860..70cbdcfde0b 100644 --- a/tests/ui/parser/match-arm-without-braces.stderr +++ b/tests/ui/parser/match-arm-without-braces.stderr @@ -8,8 +8,9 @@ LL | Some(Val::Foo) => 3; | help: replace `;` with `,` to end a `match` arm expression | -LL | Some(Val::Foo) => 3, - | ~ +LL - Some(Val::Foo) => 3; +LL + Some(Val::Foo) => 3, + | error: `match` arm body without braces --> $DIR/match-arm-without-braces.rs:31:11 diff --git a/tests/ui/parser/missing-fn-issue-65381-2.stderr b/tests/ui/parser/missing-fn-issue-65381-2.stderr index e13d395d70d..17a25bc6671 100644 --- a/tests/ui/parser/missing-fn-issue-65381-2.stderr +++ b/tests/ui/parser/missing-fn-issue-65381-2.stderr @@ -7,7 +7,7 @@ LL | main(); help: if you meant to call a macro, try | LL | main!(); - | ~~~~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/assoc-type.stderr b/tests/ui/parser/misspelled-keywords/assoc-type.stderr index 677da53e340..e529b477c05 100644 --- a/tests/ui/parser/misspelled-keywords/assoc-type.stderr +++ b/tests/ui/parser/misspelled-keywords/assoc-type.stderr @@ -11,8 +11,9 @@ LL | } | help: write keyword `type` in lowercase | -LL | type Result = u8; - | ~~~~ +LL - Type Result = u8; +LL + type Result = u8; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/async-move.stderr b/tests/ui/parser/misspelled-keywords/async-move.stderr index 4be4b56e505..a002d54dc91 100644 --- a/tests/ui/parser/misspelled-keywords/async-move.stderr +++ b/tests/ui/parser/misspelled-keywords/async-move.stderr @@ -6,8 +6,9 @@ LL | async Move {} | help: write keyword `move` in lowercase | -LL | async move {} - | ~~~~ +LL - async Move {} +LL + async move {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/const-fn.stderr b/tests/ui/parser/misspelled-keywords/const-fn.stderr index 5646b26143c..46a6d8ca779 100644 --- a/tests/ui/parser/misspelled-keywords/const-fn.stderr +++ b/tests/ui/parser/misspelled-keywords/const-fn.stderr @@ -6,8 +6,9 @@ LL | cnst fn code() {} | help: there is a keyword `const` with a similar name | -LL | const fn code() {} - | ~~~~~ +LL - cnst fn code() {} +LL + const fn code() {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/const-generics.stderr b/tests/ui/parser/misspelled-keywords/const-generics.stderr index fd59999ab63..2d37656278e 100644 --- a/tests/ui/parser/misspelled-keywords/const-generics.stderr +++ b/tests/ui/parser/misspelled-keywords/const-generics.stderr @@ -6,8 +6,9 @@ LL | fn foo<consta N: usize>(_arr: [i32; N]) {} | help: there is a keyword `const` with a similar name | -LL | fn foo<const N: usize>(_arr: [i32; N]) {} - | ~~~~~ +LL - fn foo<consta N: usize>(_arr: [i32; N]) {} +LL + fn foo<const N: usize>(_arr: [i32; N]) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/const.stderr b/tests/ui/parser/misspelled-keywords/const.stderr index 35e4d731db7..59346461ce7 100644 --- a/tests/ui/parser/misspelled-keywords/const.stderr +++ b/tests/ui/parser/misspelled-keywords/const.stderr @@ -7,7 +7,7 @@ LL | cons A: u8 = 10; help: there is a keyword `const` with a similar name | LL | const A: u8 = 10; - | ~~~~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/for-loop.stderr b/tests/ui/parser/misspelled-keywords/for-loop.stderr index d2236ab074d..6b94e60452a 100644 --- a/tests/ui/parser/misspelled-keywords/for-loop.stderr +++ b/tests/ui/parser/misspelled-keywords/for-loop.stderr @@ -6,8 +6,9 @@ LL | form i in 1..10 {} | help: there is a keyword `for` with a similar name | -LL | for i in 1..10 {} - | ~~~ +LL - form i in 1..10 {} +LL + for i in 1..10 {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/hrdt.stderr b/tests/ui/parser/misspelled-keywords/hrdt.stderr index 5393a730506..e5fc1a50382 100644 --- a/tests/ui/parser/misspelled-keywords/hrdt.stderr +++ b/tests/ui/parser/misspelled-keywords/hrdt.stderr @@ -6,8 +6,9 @@ LL | Where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8, | help: write keyword `where` in lowercase (notice the capitalization difference) | -LL | where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8, - | ~~~~~ +LL - Where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8, +LL + where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8, + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/impl-block.stderr b/tests/ui/parser/misspelled-keywords/impl-block.stderr index d86ae326ce2..8219ed6bfe9 100644 --- a/tests/ui/parser/misspelled-keywords/impl-block.stderr +++ b/tests/ui/parser/misspelled-keywords/impl-block.stderr @@ -6,8 +6,9 @@ LL | ipml Human {} | help: there is a keyword `impl` with a similar name | -LL | impl Human {} - | ~~~~ +LL - ipml Human {} +LL + impl Human {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/impl-return.stderr b/tests/ui/parser/misspelled-keywords/impl-return.stderr index 883f5cea73e..ff5391461a9 100644 --- a/tests/ui/parser/misspelled-keywords/impl-return.stderr +++ b/tests/ui/parser/misspelled-keywords/impl-return.stderr @@ -6,8 +6,9 @@ LL | fn code() -> Impl Display {} | help: write keyword `impl` in lowercase (notice the capitalization difference) | -LL | fn code() -> impl Display {} - | ~~~~ +LL - fn code() -> Impl Display {} +LL + fn code() -> impl Display {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/impl-trait-for.stderr b/tests/ui/parser/misspelled-keywords/impl-trait-for.stderr index 8dd5a4645f3..fe2356da4bd 100644 --- a/tests/ui/parser/misspelled-keywords/impl-trait-for.stderr +++ b/tests/ui/parser/misspelled-keywords/impl-trait-for.stderr @@ -6,8 +6,9 @@ LL | impl Debug form Human {} | help: there is a keyword `for` with a similar name | -LL | impl Debug for Human {} - | ~~~ +LL - impl Debug form Human {} +LL + impl Debug for Human {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/impl-trait.stderr b/tests/ui/parser/misspelled-keywords/impl-trait.stderr index 02a0c808311..4b0c9222a8c 100644 --- a/tests/ui/parser/misspelled-keywords/impl-trait.stderr +++ b/tests/ui/parser/misspelled-keywords/impl-trait.stderr @@ -6,8 +6,9 @@ LL | fn code<T: impll Debug>() -> u8 {} | help: there is a keyword `impl` with a similar name | -LL | fn code<T: impl Debug>() -> u8 {} - | ~~~~ +LL - fn code<T: impll Debug>() -> u8 {} +LL + fn code<T: impl Debug>() -> u8 {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/let-else.stderr b/tests/ui/parser/misspelled-keywords/let-else.stderr index 6f41a0d99db..1dde67638ce 100644 --- a/tests/ui/parser/misspelled-keywords/let-else.stderr +++ b/tests/ui/parser/misspelled-keywords/let-else.stderr @@ -6,8 +6,9 @@ LL | let Some(a) = Some(10) elze {} | help: there is a keyword `else` with a similar name | -LL | let Some(a) = Some(10) else {} - | ~~~~ +LL - let Some(a) = Some(10) elze {} +LL + let Some(a) = Some(10) else {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/let-mut.stderr b/tests/ui/parser/misspelled-keywords/let-mut.stderr index 766d2a04909..aee457e135b 100644 --- a/tests/ui/parser/misspelled-keywords/let-mut.stderr +++ b/tests/ui/parser/misspelled-keywords/let-mut.stderr @@ -6,8 +6,9 @@ LL | let muta a = 10; | help: there is a keyword `mut` with a similar name | -LL | let mut a = 10; - | ~~~ +LL - let muta a = 10; +LL + let mut a = 10; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/let.stderr b/tests/ui/parser/misspelled-keywords/let.stderr index c2dcdef541d..9ebc4b5afa6 100644 --- a/tests/ui/parser/misspelled-keywords/let.stderr +++ b/tests/ui/parser/misspelled-keywords/let.stderr @@ -6,8 +6,9 @@ LL | Let a = 10; | help: write keyword `let` in lowercase | -LL | let a = 10; - | ~~~ +LL - Let a = 10; +LL + let a = 10; + | error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `a` --> $DIR/let.rs:7:10 @@ -17,8 +18,9 @@ LL | lett a = 10; | help: there is a keyword `let` with a similar name | -LL | let a = 10; - | ~~~ +LL - lett a = 10; +LL + let a = 10; + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/misspelled-keywords/match.stderr b/tests/ui/parser/misspelled-keywords/match.stderr index 90780ebd38e..1ec8f7c3b81 100644 --- a/tests/ui/parser/misspelled-keywords/match.stderr +++ b/tests/ui/parser/misspelled-keywords/match.stderr @@ -6,8 +6,9 @@ LL | matche a {} | help: there is a keyword `match` with a similar name | -LL | match a {} - | ~~~~~ +LL - matche a {} +LL + match a {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/mod.stderr b/tests/ui/parser/misspelled-keywords/mod.stderr index 6daeb4e5a15..1c1866279ce 100644 --- a/tests/ui/parser/misspelled-keywords/mod.stderr +++ b/tests/ui/parser/misspelled-keywords/mod.stderr @@ -6,8 +6,9 @@ LL | mode parser; | help: there is a keyword `mod` with a similar name | -LL | mod parser; - | ~~~ +LL - mode parser; +LL + mod parser; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/pub-fn.stderr b/tests/ui/parser/misspelled-keywords/pub-fn.stderr index 82ca7105a49..1123c652c0e 100644 --- a/tests/ui/parser/misspelled-keywords/pub-fn.stderr +++ b/tests/ui/parser/misspelled-keywords/pub-fn.stderr @@ -6,8 +6,9 @@ LL | puB fn code() {} | help: write keyword `pub` in lowercase | -LL | pub fn code() {} - | ~~~ +LL - puB fn code() {} +LL + pub fn code() {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/ref.stderr b/tests/ui/parser/misspelled-keywords/ref.stderr index 398d9d6bb99..21b99d6e663 100644 --- a/tests/ui/parser/misspelled-keywords/ref.stderr +++ b/tests/ui/parser/misspelled-keywords/ref.stderr @@ -6,8 +6,9 @@ LL | Some(refe list) => println!("{list:?}"), | help: there is a keyword `ref` with a similar name | -LL | Some(ref list) => println!("{list:?}"), - | ~~~ +LL - Some(refe list) => println!("{list:?}"), +LL + Some(ref list) => println!("{list:?}"), + | error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field --> $DIR/ref.rs:4:14 diff --git a/tests/ui/parser/misspelled-keywords/return.stderr b/tests/ui/parser/misspelled-keywords/return.stderr index efa45f32299..21188ff8cb7 100644 --- a/tests/ui/parser/misspelled-keywords/return.stderr +++ b/tests/ui/parser/misspelled-keywords/return.stderr @@ -6,8 +6,9 @@ LL | returnn a; | help: there is a keyword `return` with a similar name | -LL | return a; - | ~~~~~~ +LL - returnn a; +LL + return a; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/static-mut.stderr b/tests/ui/parser/misspelled-keywords/static-mut.stderr index 3c25af548a3..10cdfe1adc6 100644 --- a/tests/ui/parser/misspelled-keywords/static-mut.stderr +++ b/tests/ui/parser/misspelled-keywords/static-mut.stderr @@ -6,8 +6,9 @@ LL | static muta a: u8 = 0; | help: there is a keyword `mut` with a similar name | -LL | static mut a: u8 = 0; - | ~~~ +LL - static muta a: u8 = 0; +LL + static mut a: u8 = 0; + | error: missing type for `static` item --> $DIR/static-mut.rs:1:12 diff --git a/tests/ui/parser/misspelled-keywords/static.stderr b/tests/ui/parser/misspelled-keywords/static.stderr index 003aa3929bc..e559f2be109 100644 --- a/tests/ui/parser/misspelled-keywords/static.stderr +++ b/tests/ui/parser/misspelled-keywords/static.stderr @@ -6,8 +6,9 @@ LL | Static a = 0; | help: write keyword `static` in lowercase (notice the capitalization difference) | -LL | static a = 0; - | ~~~~~~ +LL - Static a = 0; +LL + static a = 0; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/struct.stderr b/tests/ui/parser/misspelled-keywords/struct.stderr index 559182f9c8f..edbec3b9456 100644 --- a/tests/ui/parser/misspelled-keywords/struct.stderr +++ b/tests/ui/parser/misspelled-keywords/struct.stderr @@ -6,8 +6,9 @@ LL | Struct Foor { | help: write keyword `struct` in lowercase (notice the capitalization difference) | -LL | struct Foor { - | ~~~~~~ +LL - Struct Foor { +LL + struct Foor { + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/unsafe-fn.stderr b/tests/ui/parser/misspelled-keywords/unsafe-fn.stderr index b13281b0395..679dbb6af37 100644 --- a/tests/ui/parser/misspelled-keywords/unsafe-fn.stderr +++ b/tests/ui/parser/misspelled-keywords/unsafe-fn.stderr @@ -6,8 +6,9 @@ LL | unsafee fn code() {} | help: there is a keyword `unsafe` with a similar name | -LL | unsafe fn code() {} - | ~~~~~~ +LL - unsafee fn code() {} +LL + unsafe fn code() {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/use.stderr b/tests/ui/parser/misspelled-keywords/use.stderr index db6dffdb613..40584c835b7 100644 --- a/tests/ui/parser/misspelled-keywords/use.stderr +++ b/tests/ui/parser/misspelled-keywords/use.stderr @@ -6,8 +6,9 @@ LL | usee a::b; | help: there is a keyword `use` with a similar name | -LL | use a::b; - | ~~~ +LL - usee a::b; +LL + use a::b; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/where-clause.stderr b/tests/ui/parser/misspelled-keywords/where-clause.stderr index 5143c30ca51..f0835f6e7da 100644 --- a/tests/ui/parser/misspelled-keywords/where-clause.stderr +++ b/tests/ui/parser/misspelled-keywords/where-clause.stderr @@ -8,7 +8,8 @@ LL | wheree | help: there is a keyword `where` with a similar name | -LL | where +LL - wheree +LL + where | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/while-loop.stderr b/tests/ui/parser/misspelled-keywords/while-loop.stderr index 7d150443f57..2d1136285c8 100644 --- a/tests/ui/parser/misspelled-keywords/while-loop.stderr +++ b/tests/ui/parser/misspelled-keywords/while-loop.stderr @@ -6,8 +6,9 @@ LL | whilee a < b { | help: there is a keyword `while` with a similar name | -LL | while a < b { - | ~~~~~ +LL - whilee a < b { +LL + while a < b { + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/mod_file_not_exist.rs b/tests/ui/parser/mod_file_not_exist.rs index e7727944147..49ce44982ab 100644 --- a/tests/ui/parser/mod_file_not_exist.rs +++ b/tests/ui/parser/mod_file_not_exist.rs @@ -1,5 +1,3 @@ -//@ ignore-windows - mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file` //~^ HELP to create the module `not_a_real_file`, create file diff --git a/tests/ui/parser/mod_file_not_exist.stderr b/tests/ui/parser/mod_file_not_exist.stderr index 40041b11c8b..d9e4e8f31f5 100644 --- a/tests/ui/parser/mod_file_not_exist.stderr +++ b/tests/ui/parser/mod_file_not_exist.stderr @@ -1,5 +1,5 @@ error[E0583]: file not found for module `not_a_real_file` - --> $DIR/mod_file_not_exist.rs:3:1 + --> $DIR/mod_file_not_exist.rs:1:1 | LL | mod not_a_real_file; | ^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | mod not_a_real_file; = note: if there is a `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::...` instead error[E0433]: failed to resolve: use of unresolved module or unlinked crate `mod_file_aux` - --> $DIR/mod_file_not_exist.rs:7:16 + --> $DIR/mod_file_not_exist.rs:5:16 | LL | assert_eq!(mod_file_aux::bar(), 10); | ^^^^^^^^^^^^ use of unresolved module or unlinked crate `mod_file_aux` diff --git a/tests/ui/parser/mut-patterns.stderr b/tests/ui/parser/mut-patterns.stderr index ad19a60af34..43f6a344bf3 100644 --- a/tests/ui/parser/mut-patterns.stderr +++ b/tests/ui/parser/mut-patterns.stderr @@ -33,8 +33,9 @@ LL | let mut (x @ y) = 0; = note: `mut` may be followed by `variable` and `variable @ pattern` help: add `mut` to each binding | -LL | let (mut x @ mut y) = 0; - | ~~~~~~~~~~~~~~~ +LL - let mut (x @ y) = 0; +LL + let (mut x @ mut y) = 0; + | error: `mut` on a binding may not be repeated --> $DIR/mut-patterns.rs:14:13 @@ -69,8 +70,9 @@ LL | let mut Foo { x: x } = Foo { x: 3 }; = note: `mut` may be followed by `variable` and `variable @ pattern` help: add `mut` to each binding | -LL | let Foo { x: mut x } = Foo { x: 3 }; - | ~~~~~~~~~~~~~~~~ +LL - let mut Foo { x: x } = Foo { x: 3 }; +LL + let Foo { x: mut x } = Foo { x: 3 }; + | error: `mut` must be attached to each individual binding --> $DIR/mut-patterns.rs:27:9 @@ -81,8 +83,9 @@ LL | let mut Foo { x } = Foo { x: 3 }; = note: `mut` may be followed by `variable` and `variable @ pattern` help: add `mut` to each binding | -LL | let Foo { mut x } = Foo { x: 3 }; - | ~~~~~~~~~~~~~ +LL - let mut Foo { x } = Foo { x: 3 }; +LL + let Foo { mut x } = Foo { x: 3 }; + | error: `mut` on a binding may not be repeated --> $DIR/mut-patterns.rs:32:13 @@ -151,8 +154,9 @@ LL | let mut W(mut a, W(b, W(ref c, W(d, B { box f })))) = note: `mut` may be followed by `variable` and `variable @ pattern` help: add `mut` to each binding | -LL | let W(mut a, W(mut b, W(ref c, W(mut d, B { box mut f })))) - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let mut W(mut a, W(b, W(ref c, W(d, B { box f })))) +LL + let W(mut a, W(mut b, W(ref c, W(mut d, B { box mut f })))) + | error: expected identifier, found `x` --> $DIR/mut-patterns.rs:48:21 diff --git a/tests/ui/parser/not-a-pred.stderr b/tests/ui/parser/not-a-pred.stderr index 6f6a332cb81..9fedd208e1a 100644 --- a/tests/ui/parser/not-a-pred.stderr +++ b/tests/ui/parser/not-a-pred.stderr @@ -6,8 +6,9 @@ LL | fn f(a: isize, b: isize) : lt(a, b) { } | help: use `->` instead | -LL | fn f(a: isize, b: isize) -> lt(a, b) { } - | ~~ +LL - fn f(a: isize, b: isize) : lt(a, b) { } +LL + fn f(a: isize, b: isize) -> lt(a, b) { } + | error[E0573]: expected type, found function `lt` --> $DIR/not-a-pred.rs:1:28 diff --git a/tests/ui/parser/public-instead-of-pub-1.stderr b/tests/ui/parser/public-instead-of-pub-1.stderr index 3fbe8d0b164..5695624d3b6 100644 --- a/tests/ui/parser/public-instead-of-pub-1.stderr +++ b/tests/ui/parser/public-instead-of-pub-1.stderr @@ -6,8 +6,9 @@ LL | public enum Test { | help: write `pub` instead of `public` to make the item public | -LL | pub enum Test { - | ~~~ +LL - public enum Test { +LL + pub enum Test { + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/public-instead-of-pub-3.stderr b/tests/ui/parser/public-instead-of-pub-3.stderr index b9b924e670a..856bdf18570 100644 --- a/tests/ui/parser/public-instead-of-pub-3.stderr +++ b/tests/ui/parser/public-instead-of-pub-3.stderr @@ -6,8 +6,9 @@ LL | public const X: i32 = 123; | help: write `pub` instead of `public` to make the item public | -LL | pub const X: i32 = 123; - | ~~~ +LL - public const X: i32 = 123; +LL + pub const X: i32 = 123; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/public-instead-of-pub.stderr b/tests/ui/parser/public-instead-of-pub.stderr index c98f8a9914e..29a208cd484 100644 --- a/tests/ui/parser/public-instead-of-pub.stderr +++ b/tests/ui/parser/public-instead-of-pub.stderr @@ -6,8 +6,9 @@ LL | public struct X; | help: write `pub` instead of `public` to make the item public | -LL | pub struct X; - | ~~~ +LL - public struct X; +LL + pub struct X; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/range-inclusive-extra-equals.stderr b/tests/ui/parser/range-inclusive-extra-equals.stderr index a573cdf950c..db18cef81b1 100644 --- a/tests/ui/parser/range-inclusive-extra-equals.stderr +++ b/tests/ui/parser/range-inclusive-extra-equals.stderr @@ -7,8 +7,9 @@ LL | if let 1..==3 = 1 {} = note: inclusive ranges end with a single equals sign (`..=`) help: use `..=` instead | -LL | if let 1..=3 = 1 {} - | ~~~ +LL - if let 1..==3 = 1 {} +LL + if let 1..=3 = 1 {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/range_inclusive_dotdotdot.stderr b/tests/ui/parser/range_inclusive_dotdotdot.stderr index 2dc2c87eb7b..069133a43a3 100644 --- a/tests/ui/parser/range_inclusive_dotdotdot.stderr +++ b/tests/ui/parser/range_inclusive_dotdotdot.stderr @@ -6,12 +6,14 @@ LL | return ...1; | help: use `..` for an exclusive range | -LL | return ..1; - | ~~ +LL - return ...1; +LL + return ..1; + | help: or `..=` for an inclusive range | -LL | return ..=1; - | ~~~ +LL - return ...1; +LL + return ..=1; + | error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:12:13 @@ -21,12 +23,14 @@ LL | let x = ...0; | help: use `..` for an exclusive range | -LL | let x = ..0; - | ~~ +LL - let x = ...0; +LL + let x = ..0; + | help: or `..=` for an inclusive range | -LL | let x = ..=0; - | ~~~ +LL - let x = ...0; +LL + let x = ..=0; + | error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:16:14 @@ -36,12 +40,14 @@ LL | let x = 5...5; | help: use `..` for an exclusive range | -LL | let x = 5..5; - | ~~ +LL - let x = 5...5; +LL + let x = 5..5; + | help: or `..=` for an inclusive range | -LL | let x = 5..=5; - | ~~~ +LL - let x = 5...5; +LL + let x = 5..=5; + | error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:20:15 @@ -51,12 +57,14 @@ LL | for _ in 0...1 {} | help: use `..` for an exclusive range | -LL | for _ in 0..1 {} - | ~~ +LL - for _ in 0...1 {} +LL + for _ in 0..1 {} + | help: or `..=` for an inclusive range | -LL | for _ in 0..=1 {} - | ~~~ +LL - for _ in 0...1 {} +LL + for _ in 0..=1 {} + | error: aborting due to 4 previous errors diff --git a/tests/ui/parser/raw/raw-idents.rs b/tests/ui/parser/raw/raw-idents.rs new file mode 100644 index 00000000000..93015ee6c49 --- /dev/null +++ b/tests/ui/parser/raw/raw-idents.rs @@ -0,0 +1,158 @@ +//@ check-pass +//@ revisions:e2015 e2018 e2021 e2024 +//@[e2015] edition:2015 +//@[e2018] edition:2018 +//@[e2021] edition:2021 +//@[e2024] edition:2024 + +// Ensure that all (usable as identifier) keywords work as raw identifiers in all positions. +// This was motivated by issue #137128, where `r#move`/`r#static`` did not work as `const` names +// due to a parser check not acounting for raw identifiers. + +#![crate_type = "lib"] +#![allow(dead_code, nonstandard_style)] + +// NOTE: It is vital to only use a `tt` fragment to avoid confusing +// the parser with nonterminals that can mask bugs. + +macro_rules! tests { + ($kw:tt) => { + mod $kw { + mod const_item { + const $kw: () = (); + } + mod static_item { + static $kw: () = (); + } + mod fn_item { + fn $kw() {} + } + mod mod_and_use_item { + mod $kw { + use super::$kw; + } + } + mod ty_alias_item { + type $kw = (); + } + mod struct_item { + struct $kw { $kw: () } + } + mod enum_item { + enum $kw { $kw } + } + mod union_item { + union $kw { $kw: () } + } + mod trait_item { + trait $kw { + fn $kw() {} + } + } + mod generics_and_impl { + struct A<$kw>($kw); + enum B<$kw> { A($kw) } + trait Tr<$kw> { + type $kw; + } + + impl<$kw> Tr<$kw> for A<$kw> { + type $kw = (); + } + impl<$kw> B<$kw> {} + } + mod extern_crate { + #[cfg(any())] + extern crate $kw; + } + mod body { + fn expr() { + let $kw = 0; + let b = $kw; + assert_eq!($kw, b); + type $kw = (); + let $kw: $kw = (); + let _ = $kw as $kw; + } + fn pat_const() { + const $kw: u8 = 0; + + // Ensure that $kw actually matches the constant. + #[forbid(unreachable_patterns)] + match 1 { + $kw => {} + _ => {} + } + } + fn pat_binding() { + match 1 { + $kw => {} + _ => {} + } + } + } + } + }; +} + +tests!(r#break); +tests!(r#const); +tests!(r#continue); +tests!(r#else); +tests!(r#enum); +tests!(r#extern); +tests!(r#false); +tests!(r#fn); +tests!(r#for); +tests!(r#if); +tests!(r#impl); +tests!(r#in); +tests!(r#let); +tests!(r#loop); +tests!(r#match); +tests!(r#mod); +tests!(r#move); +tests!(r#mut); +tests!(r#pub); +tests!(r#ref); +tests!(r#return); +tests!(r#static); +tests!(r#struct); +tests!(r#trait); +tests!(r#true); +tests!(r#type); +tests!(r#unsafe); +tests!(r#use); +tests!(r#where); +tests!(r#while); +tests!(r#abstract); +tests!(r#become); +tests!(r#box); +tests!(r#do); +tests!(r#final); +tests!(r#macro); +tests!(r#override); +tests!(r#priv); +tests!(r#typeof); +tests!(r#unsized); +tests!(r#virtual); +tests!(r#yield); +tests!(r#async); +tests!(r#await); +tests!(r#dyn); +tests!(r#gen); +tests!(r#try); + +// Weak keywords: +tests!(auto); +tests!(builtin); +tests!(catch); +tests!(default); +tests!(macro_rules); +tests!(raw); +tests!(reuse); +tests!(contract_ensures); +tests!(contract_requires); +tests!(safe); +tests!(union); +tests!(yeet); diff --git a/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr b/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr index 606b737e723..d1c803863a2 100644 --- a/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr +++ b/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr @@ -10,8 +10,9 @@ LL | bar::<Item = 'a>(); = help: if you meant to specify a trait object, write `dyn /* Trait */ + 'a` help: you might have meant to write a bound here | -LL | bar::<Item: 'a>(); - | ~ +LL - bar::<Item = 'a>(); +LL + bar::<Item: 'a>(); + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr index aee31d08fe0..4e1fcaf4936 100644 --- a/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr +++ b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr @@ -6,8 +6,9 @@ LL | fn foo(_: impl fn() -> i32) {} | help: use `Fn` to refer to the trait (notice the capitalization difference) | -LL | fn foo(_: impl Fn() -> i32) {} - | ~~ +LL - fn foo(_: impl fn() -> i32) {} +LL + fn foo(_: impl Fn() -> i32) {} + | error: expected identifier, found keyword `fn` --> $DIR/recover-fn-trait-from-fn-kw.rs:4:12 @@ -17,8 +18,9 @@ LL | fn foo2<T: fn(i32)>(_: T) {} | help: use `Fn` to refer to the trait (notice the capitalization difference) | -LL | fn foo2<T: Fn(i32)>(_: T) {} - | ~~ +LL - fn foo2<T: fn(i32)>(_: T) {} +LL + fn foo2<T: Fn(i32)>(_: T) {} + | error[E0308]: mismatched types --> $DIR/recover-fn-trait-from-fn-kw.rs:8:12 diff --git a/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr b/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr index beaa346e76c..2bc7952def7 100644 --- a/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr +++ b/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr @@ -18,8 +18,9 @@ LL | const _RECOVERY_WITNESS: u32 = 0u8; | help: change the type of the numeric literal from `u8` to `u32` | -LL | const _RECOVERY_WITNESS: u32 = 0u32; - | ~~~ +LL - const _RECOVERY_WITNESS: u32 = 0u8; +LL + const _RECOVERY_WITNESS: u32 = 0u32; + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/recover/recover-from-bad-variant.stderr b/tests/ui/parser/recover/recover-from-bad-variant.stderr index 0339f869515..9359ede1346 100644 --- a/tests/ui/parser/recover/recover-from-bad-variant.stderr +++ b/tests/ui/parser/recover/recover-from-bad-variant.stderr @@ -6,8 +6,9 @@ LL | let x = Enum::Foo(a: 3, b: 4); | help: if `Enum::Foo` is a struct, use braces as delimiters | -LL | let x = Enum::Foo { a: 3, b: 4 }; - | ~ ~ +LL - let x = Enum::Foo(a: 3, b: 4); +LL + let x = Enum::Foo { a: 3, b: 4 }; + | help: if `Enum::Foo` is a function, use the arguments directly | LL - let x = Enum::Foo(a: 3, b: 4); @@ -22,8 +23,9 @@ LL | Enum::Foo(a, b) => {} | help: the struct variant's fields are being ignored | -LL | Enum::Foo { a: _, b: _ } => {} - | ~~~~~~~~~~~~~~ +LL - Enum::Foo(a, b) => {} +LL + Enum::Foo { a: _, b: _ } => {} + | error[E0769]: tuple variant `Enum::Bar` written as struct variant --> $DIR/recover-from-bad-variant.rs:12:9 @@ -33,8 +35,9 @@ LL | Enum::Bar { a, b } => {} | help: use the tuple variant pattern syntax instead | -LL | Enum::Bar(a, b) => {} - | ~~~~~~ +LL - Enum::Bar { a, b } => {} +LL + Enum::Bar(a, b) => {} + | error: aborting due to 3 previous errors diff --git a/tests/ui/parser/recover/recover-from-homoglyph.stderr b/tests/ui/parser/recover/recover-from-homoglyph.stderr index f11ca9fd584..38ca0259366 100644 --- a/tests/ui/parser/recover/recover-from-homoglyph.stderr +++ b/tests/ui/parser/recover/recover-from-homoglyph.stderr @@ -6,8 +6,9 @@ LL | println!(""); | help: Unicode character ';' (Greek Question Mark) looks like ';' (Semicolon), but it is not | -LL | println!(""); - | ~ +LL - println!(""); +LL + println!(""); + | error[E0308]: mismatched types --> $DIR/recover-from-homoglyph.rs:3:20 diff --git a/tests/ui/parser/recover/recover-pat-exprs.stderr b/tests/ui/parser/recover/recover-pat-exprs.stderr index 281eeced402..dcc1945d569 100644 --- a/tests/ui/parser/recover/recover-pat-exprs.stderr +++ b/tests/ui/parser/recover/recover-pat-exprs.stderr @@ -7,8 +7,9 @@ LL | x.y => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == x.y => (), - | ~~~ +++++++++++++ +LL - x.y => (), +LL + val if val == x.y => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.y; @@ -30,8 +31,9 @@ LL | x.0 => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == x.0 => (), - | ~~~ +++++++++++++ +LL - x.0 => (), +LL + val if val == x.0 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.0; @@ -54,8 +56,9 @@ LL | x._0 => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == x._0 => (), - | ~~~ ++++++++++++++ +LL - x._0 => (), +LL + val if val == x._0 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x._0; @@ -79,8 +82,9 @@ LL | x.0.1 => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == x.0.1 => (), - | ~~~ +++++++++++++++ +LL - x.0.1 => (), +LL + val if val == x.0.1 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.0.1; @@ -104,8 +108,9 @@ LL | x.4.y.17.__z => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == x.4.y.17.__z => (), - | ~~~ ++++++++++++++++++++++ +LL - x.4.y.17.__z => (), +LL + val if val == x.4.y.17.__z => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.4.y.17.__z; @@ -159,8 +164,9 @@ LL | x[0] => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == x[0] => (), - | ~~~ ++++++++++++++ +LL - x[0] => (), +LL + val if val == x[0] => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x[0]; @@ -181,8 +187,9 @@ LL | x[..] => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == x[..] => (), - | ~~~ +++++++++++++++ +LL - x[..] => (), +LL + val if val == x[..] => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x[..]; @@ -231,8 +238,9 @@ LL | x.f() => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == x.f() => (), - | ~~~ +++++++++++++++ +LL - x.f() => (), +LL + val if val == x.f() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.f(); @@ -253,8 +261,9 @@ LL | x._f() => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == x._f() => (), - | ~~~ ++++++++++++++++ +LL - x._f() => (), +LL + val if val == x._f() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x._f(); @@ -276,8 +285,9 @@ LL | x? => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == x? => (), - | ~~~ ++++++++++++ +LL - x? => (), +LL + val if val == x? => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x?; @@ -300,8 +310,9 @@ LL | ().f() => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == ().f() => (), - | ~~~ ++++++++++++++++ +LL - ().f() => (), +LL + val if val == ().f() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = ().f(); @@ -325,8 +336,9 @@ LL | (0, x)?.f() => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == (0, x)?.f() => (), - | ~~~ +++++++++++++++++++++ +LL - (0, x)?.f() => (), +LL + val if val == (0, x)?.f() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = (0, x)?.f(); @@ -350,8 +362,9 @@ LL | x.f().g() => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == x.f().g() => (), - | ~~~ +++++++++++++++++++ +LL - x.f().g() => (), +LL + val if val == x.f().g() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.f().g(); @@ -375,8 +388,9 @@ LL | 0.f()?.g()?? => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == 0.f()?.g()?? => (), - | ~~~ ++++++++++++++++++++++ +LL - 0.f()?.g()?? => (), +LL + val if val == 0.f()?.g()?? => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = 0.f()?.g()??; @@ -400,8 +414,9 @@ LL | x as usize => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == x as usize => (), - | ~~~ ++++++++++++++++++++ +LL - x as usize => (), +LL + val if val == x as usize => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x as usize; @@ -422,8 +437,9 @@ LL | 0 as usize => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == 0 as usize => (), - | ~~~ ++++++++++++++++++++ +LL - 0 as usize => (), +LL + val if val == 0 as usize => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = 0 as usize; @@ -445,8 +461,9 @@ LL | x.f().0.4 as f32 => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == x.f().0.4 as f32 => (), - | ~~~ ++++++++++++++++++++++++++ +LL - x.f().0.4 as f32 => (), +LL + val if val == x.f().0.4 as f32 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.f().0.4 as f32; @@ -469,8 +486,9 @@ LL | 1 + 1 => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == 1 + 1 => (), - | ~~~ +++++++++++++++ +LL - 1 + 1 => (), +LL + val if val == 1 + 1 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = 1 + 1; @@ -491,8 +509,9 @@ LL | (1 + 2) * 3 => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == (1 + 2) * 3 => (), - | ~~~ +++++++++++++++++++++ +LL - (1 + 2) * 3 => (), +LL + val if val == (1 + 2) * 3 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = (1 + 2) * 3; @@ -514,8 +533,9 @@ LL | x.0 > 2 => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == (x.0 > 2) => (), - | ~~~ +++++++++++++++++++ +LL - x.0 > 2 => (), +LL + val if val == (x.0 > 2) => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.0 > 2; @@ -539,8 +559,9 @@ LL | x.0 == 2 => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == (x.0 == 2) => (), - | ~~~ ++++++++++++++++++++ +LL - x.0 == 2 => (), +LL + val if val == (x.0 == 2) => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.0 == 2; @@ -564,8 +585,9 @@ LL | (x, y.0 > 2) if x != 0 => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to the match arm guard | -LL | (x, val) if x != 0 && val == (y.0 > 2) => (), - | ~~~ +++++++++++++++++++ +LL - (x, y.0 > 2) if x != 0 => (), +LL + (x, val) if x != 0 && val == (y.0 > 2) => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = y.0 > 2; @@ -586,8 +608,9 @@ LL | (x, y.0 > 2) if x != 0 || x != 1 => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to the match arm guard | -LL | (x, val) if (x != 0 || x != 1) && val == (y.0 > 2) => (), - | ~~~ + +++++++++++++++++++++ +LL - (x, y.0 > 2) if x != 0 || x != 1 => (), +LL + (x, val) if (x != 0 || x != 1) && val == (y.0 > 2) => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = y.0 > 2; @@ -626,8 +649,9 @@ LL | u8::MAX.abs() => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == u8::MAX.abs() => (), - | ~~~ +++++++++++++++++++++++ +LL - u8::MAX.abs() => (), +LL + val if val == u8::MAX.abs() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = u8::MAX.abs(); @@ -648,8 +672,9 @@ LL | z @ w @ v.u() => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | z @ w @ val if val == v.u() => (), - | ~~~ +++++++++++++++ +LL - z @ w @ v.u() => (), +LL + z @ w @ val if val == v.u() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = v.u(); @@ -673,8 +698,9 @@ LL | y.ilog(3) => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == y.ilog(3) => (), - | ~~~ +++++++++++++++++++ +LL - y.ilog(3) => (), +LL + val if val == y.ilog(3) => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = y.ilog(3); @@ -698,8 +724,9 @@ LL | n + 1 => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == n + 1 => (), - | ~~~ +++++++++++++++ +LL - n + 1 => (), +LL + val if val == n + 1 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = n + 1; @@ -723,8 +750,9 @@ LL | ("".f() + 14 * 8) => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | (val) if val == "".f() + 14 * 8 => (), - | ~~~ +++++++++++++++++++++++++ +LL - ("".f() + 14 * 8) => (), +LL + (val) if val == "".f() + 14 * 8 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = "".f() + 14 * 8; @@ -748,8 +776,9 @@ LL | f?() => (), = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | val if val == f?() => (), - | ~~~ ++++++++++++++ +LL - f?() => (), +LL + val if val == f?() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = f?(); diff --git a/tests/ui/parser/recover/recover-pat-issues.stderr b/tests/ui/parser/recover/recover-pat-issues.stderr index bdd0b2b260e..0c65b16dd95 100644 --- a/tests/ui/parser/recover/recover-pat-issues.stderr +++ b/tests/ui/parser/recover/recover-pat-issues.stderr @@ -7,8 +7,9 @@ LL | Foo("hi".to_owned()) => true, = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | Foo(val) if val == "hi".to_owned() => true, - | ~~~ +++++++++++++++++++++++++ +LL - Foo("hi".to_owned()) => true, +LL + Foo(val) if val == "hi".to_owned() => true, + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = "hi".to_owned(); @@ -29,8 +30,9 @@ LL | Bar { baz: "hi".to_owned() } => true, = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | Bar { baz } if baz == "hi".to_owned() => true, - | ~~~ +++++++++++++++++++++++++ +LL - Bar { baz: "hi".to_owned() } => true, +LL + Bar { baz } if baz == "hi".to_owned() => true, + | help: consider extracting the expression into a `const` | LL + const BAZ: /* Type */ = "hi".to_owned(); @@ -51,8 +53,9 @@ LL | &["foo".to_string()] => {} = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html> help: consider moving the expression to a match arm guard | -LL | &[val] if val == "foo".to_string() => {} - | ~~~ +++++++++++++++++++++++++++ +LL - &["foo".to_string()] => {} +LL + &[val] if val == "foo".to_string() => {} + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = "foo".to_string(); diff --git a/tests/ui/parser/recover/recover-range-pats.stderr b/tests/ui/parser/recover/recover-range-pats.stderr index 5c134bd4a82..a2f3ba4dd94 100644 --- a/tests/ui/parser/recover/recover-range-pats.stderr +++ b/tests/ui/parser/recover/recover-range-pats.stderr @@ -231,8 +231,9 @@ LL | if let ...3 = 0 {} | help: use `..=` instead | -LL | if let ..=3 = 0 {} - | ~~~ +LL - if let ...3 = 0 {} +LL + if let ..=3 = 0 {} + | error: range-to patterns with `...` are not allowed --> $DIR/recover-range-pats.rs:121:12 @@ -242,8 +243,9 @@ LL | if let ...Y = 0 {} | help: use `..=` instead | -LL | if let ..=Y = 0 {} - | ~~~ +LL - if let ...Y = 0 {} +LL + if let ..=Y = 0 {} + | error: range-to patterns with `...` are not allowed --> $DIR/recover-range-pats.rs:123:12 @@ -253,8 +255,9 @@ LL | if let ...true = 0 {} | help: use `..=` instead | -LL | if let ..=true = 0 {} - | ~~~ +LL - if let ...true = 0 {} +LL + if let ..=true = 0 {} + | error: float literals must have an integer part --> $DIR/recover-range-pats.rs:126:15 @@ -275,8 +278,9 @@ LL | if let ....3 = 0 {} | help: use `..=` instead | -LL | if let ..=.3 = 0 {} - | ~~~ +LL - if let ....3 = 0 {} +LL + if let ..=.3 = 0 {} + | error: range-to patterns with `...` are not allowed --> $DIR/recover-range-pats.rs:152:17 @@ -290,8 +294,9 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `..=` instead | -LL | let ..=$e; - | ~~~ +LL - let ...$e; +LL + let ..=$e; + | error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:159:19 diff --git a/tests/ui/parser/recover/recover-ref-dyn-mut.stderr b/tests/ui/parser/recover/recover-ref-dyn-mut.stderr index bb0f0b0214c..2f1649f01c9 100644 --- a/tests/ui/parser/recover/recover-ref-dyn-mut.stderr +++ b/tests/ui/parser/recover/recover-ref-dyn-mut.stderr @@ -6,8 +6,9 @@ LL | let r: &dyn mut Trait; | help: place `mut` before `dyn` | -LL | let r: &mut dyn Trait; - | ~~~~~~~~ +LL - let r: &dyn mut Trait; +LL + let r: &mut dyn Trait; + | error[E0405]: cannot find trait `Trait` in this scope --> $DIR/recover-ref-dyn-mut.rs:5:21 diff --git a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr index 551b2e3ff09..583b98c650f 100644 --- a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr +++ b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr @@ -8,7 +8,7 @@ LL | let x = Tr<A, A:>; help: maybe write a path separator here | LL | let x = Tr<A, A::>; - | ~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover/unicode-double-equals-recovery.stderr b/tests/ui/parser/recover/unicode-double-equals-recovery.stderr index 6e10dcce04a..1931fd4ee45 100644 --- a/tests/ui/parser/recover/unicode-double-equals-recovery.stderr +++ b/tests/ui/parser/recover/unicode-double-equals-recovery.stderr @@ -6,8 +6,9 @@ LL | const A: usize ⩵ 2; | help: Unicode character '⩵' (Two Consecutive Equals Signs) looks like '==' (Double Equals Sign), but it is not | -LL | const A: usize == 2; - | ~~ +LL - const A: usize ⩵ 2; +LL + const A: usize == 2; + | error: unexpected `==` --> $DIR/unicode-double-equals-recovery.rs:1:16 @@ -17,8 +18,9 @@ LL | const A: usize ⩵ 2; | help: try using `=` instead | -LL | const A: usize = 2; - | ~ +LL - const A: usize ⩵ 2; +LL + const A: usize = 2; + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/removed-syntax/removed-syntax-box.stderr b/tests/ui/parser/removed-syntax/removed-syntax-box.stderr index 60c39fd37c4..04e84a10fad 100644 --- a/tests/ui/parser/removed-syntax/removed-syntax-box.stderr +++ b/tests/ui/parser/removed-syntax/removed-syntax-box.stderr @@ -6,8 +6,9 @@ LL | let _ = box (); | help: use `Box::new()` instead | -LL | let _ = Box::new(()); - | ~~~~~~~~~ + +LL - let _ = box (); +LL + let _ = Box::new(()); + | error: `box_syntax` has been removed --> $DIR/removed-syntax-box.rs:10:13 @@ -17,8 +18,9 @@ LL | let _ = box 1; | help: use `Box::new()` instead | -LL | let _ = Box::new(1); - | ~~~~~~~~~ + +LL - let _ = box 1; +LL + let _ = Box::new(1); + | error: `box_syntax` has been removed --> $DIR/removed-syntax-box.rs:11:13 @@ -28,8 +30,9 @@ LL | let _ = box T { a: 12, b: 18 }; | help: use `Box::new()` instead | -LL | let _ = Box::new(T { a: 12, b: 18 }); - | ~~~~~~~~~ + +LL - let _ = box T { a: 12, b: 18 }; +LL + let _ = Box::new(T { a: 12, b: 18 }); + | error: `box_syntax` has been removed --> $DIR/removed-syntax-box.rs:12:13 @@ -39,8 +42,9 @@ LL | let _ = box [5; 30]; | help: use `Box::new()` instead | -LL | let _ = Box::new([5; 30]); - | ~~~~~~~~~ + +LL - let _ = box [5; 30]; +LL + let _ = Box::new([5; 30]); + | error: `box_syntax` has been removed --> $DIR/removed-syntax-box.rs:13:22 @@ -50,8 +54,9 @@ LL | let _: Box<()> = box (); | help: use `Box::new()` instead | -LL | let _: Box<()> = Box::new(()); - | ~~~~~~~~~ + +LL - let _: Box<()> = box (); +LL + let _: Box<()> = Box::new(()); + | error: aborting due to 5 previous errors diff --git a/tests/ui/parser/suggest-assoc-const.stderr b/tests/ui/parser/suggest-assoc-const.stderr index 70ebeded313..8cb304ced37 100644 --- a/tests/ui/parser/suggest-assoc-const.stderr +++ b/tests/ui/parser/suggest-assoc-const.stderr @@ -6,8 +6,9 @@ LL | let _X: i32; | help: consider using `const` instead of `let` for associated const | -LL | const _X: i32; - | ~~~~~ +LL - let _X: i32; +LL + const _X: i32; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest-remove-compount-assign-let-ice.stderr b/tests/ui/parser/suggest-remove-compount-assign-let-ice.stderr index 59716d69b50..477ec516d66 100644 --- a/tests/ui/parser/suggest-remove-compount-assign-let-ice.stderr +++ b/tests/ui/parser/suggest-remove-compount-assign-let-ice.stderr @@ -6,8 +6,9 @@ LL | let x ➖= 1; | help: Unicode character '➖' (Heavy Minus Sign) looks like '-' (Minus/Hyphen), but it is not | -LL | let x -= 1; - | ~ +LL - let x ➖= 1; +LL + let x -= 1; + | error: can't reassign to an uninitialized variable --> $DIR/suggest-remove-compount-assign-let-ice.rs:13:11 diff --git a/tests/ui/parser/trailing-question-in-type.stderr b/tests/ui/parser/trailing-question-in-type.stderr index a3cd419c0c7..066c38d4c4f 100644 --- a/tests/ui/parser/trailing-question-in-type.stderr +++ b/tests/ui/parser/trailing-question-in-type.stderr @@ -6,8 +6,9 @@ LL | fn foo() -> i32? { | help: if you meant to express that the type might not contain a value, use the `Option` wrapper type | -LL | fn foo() -> Option<i32> { - | +++++++ ~ +LL - fn foo() -> i32? { +LL + fn foo() -> Option<i32> { + | error: invalid `?` in type --> $DIR/trailing-question-in-type.rs:4:15 @@ -17,8 +18,9 @@ LL | let x: i32? = Some(1); | help: if you meant to express that the type might not contain a value, use the `Option` wrapper type | -LL | let x: Option<i32> = Some(1); - | +++++++ ~ +LL - let x: i32? = Some(1); +LL + let x: Option<i32> = Some(1); + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/typod-const-in-const-param-def.stderr b/tests/ui/parser/typod-const-in-const-param-def.stderr index 80c0f1deae6..bf7168a0157 100644 --- a/tests/ui/parser/typod-const-in-const-param-def.stderr +++ b/tests/ui/parser/typod-const-in-const-param-def.stderr @@ -6,8 +6,9 @@ LL | pub fn foo<Const N: u8>() {} | help: use the `const` keyword (notice the capitalization difference) | -LL | pub fn foo<const N: u8>() {} - | ~~~~~ +LL - pub fn foo<Const N: u8>() {} +LL + pub fn foo<const N: u8>() {} + | error: `const` keyword was mistyped as `Const` --> $DIR/typod-const-in-const-param-def.rs:7:12 @@ -17,8 +18,9 @@ LL | pub fn baz<Const N: u8, T>() {} | help: use the `const` keyword (notice the capitalization difference) | -LL | pub fn baz<const N: u8, T>() {} - | ~~~~~ +LL - pub fn baz<Const N: u8, T>() {} +LL + pub fn baz<const N: u8, T>() {} + | error: `const` keyword was mistyped as `Const` --> $DIR/typod-const-in-const-param-def.rs:10:15 @@ -28,8 +30,9 @@ LL | pub fn qux<T, Const N: u8>() {} | help: use the `const` keyword (notice the capitalization difference) | -LL | pub fn qux<T, const N: u8>() {} - | ~~~~~ +LL - pub fn qux<T, Const N: u8>() {} +LL + pub fn qux<T, const N: u8>() {} + | error: `const` keyword was mistyped as `Const` --> $DIR/typod-const-in-const-param-def.rs:13:16 @@ -39,8 +42,9 @@ LL | pub fn quux<T, Const N: u8, U>() {} | help: use the `const` keyword (notice the capitalization difference) | -LL | pub fn quux<T, const N: u8, U>() {} - | ~~~~~ +LL - pub fn quux<T, Const N: u8, U>() {} +LL + pub fn quux<T, const N: u8, U>() {} + | error: aborting due to 4 previous errors diff --git a/tests/ui/parser/unicode-character-literal.stderr b/tests/ui/parser/unicode-character-literal.stderr index a1561e7f04b..8ce2354f0b9 100644 --- a/tests/ui/parser/unicode-character-literal.stderr +++ b/tests/ui/parser/unicode-character-literal.stderr @@ -11,8 +11,9 @@ LL | let _spade = '♠️'; | ^ help: if you meant to write a string literal, use double quotes | -LL | let _spade = "♠️"; - | ~ ~ +LL - let _spade = '♠️'; +LL + let _spade = "♠️"; + | error: character literal may only contain one codepoint --> $DIR/unicode-character-literal.rs:12:14 @@ -27,8 +28,9 @@ LL | let _s = 'ṩ̂̊'; | ^ help: if you meant to write a string literal, use double quotes | -LL | let _s = "ṩ̂̊"; - | ~ ~ +LL - let _s = 'ṩ̂̊'; +LL + let _s = "ṩ̂̊"; + | error: character literal may only contain one codepoint --> $DIR/unicode-character-literal.rs:17:14 @@ -43,8 +45,9 @@ LL | let _a = 'Å'; | ^ help: consider using the normalized form `\u{c5}` of this character | -LL | let _a = 'Å'; - | ~ +LL - let _a = 'Å'; +LL + let _a = 'Å'; + | error: aborting due to 3 previous errors diff --git a/tests/ui/parser/unicode-chars.stderr b/tests/ui/parser/unicode-chars.stderr index 086de5ec099..a18a6ad10dd 100644 --- a/tests/ui/parser/unicode-chars.stderr +++ b/tests/ui/parser/unicode-chars.stderr @@ -6,8 +6,9 @@ LL | let y = 0; | help: Unicode character ';' (Greek Question Mark) looks like ';' (Semicolon), but it is not | -LL | let y = 0; - | ~ +LL - let y = 0; +LL + let y = 0; + | error: unknown start of token: \u{a0} --> $DIR/unicode-chars.rs:5:5 @@ -29,8 +30,9 @@ LL | let _ = 1 ⩵ 2; | help: Unicode character '⩵' (Two Consecutive Equals Signs) looks like '==' (Double Equals Sign), but it is not | -LL | let _ = 1 == 2; - | ~~ +LL - let _ = 1 ⩵ 2; +LL + let _ = 1 == 2; + | error: aborting due to 3 previous errors diff --git a/tests/ui/parser/unicode-control-codepoints.stderr b/tests/ui/parser/unicode-control-codepoints.stderr index 2893194308e..27b95f9ac61 100644 --- a/tests/ui/parser/unicode-control-codepoints.stderr +++ b/tests/ui/parser/unicode-control-codepoints.stderr @@ -22,8 +22,9 @@ LL | println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); | help: if you meant to use the UTF-8 encoding of '\u{202e}', use \xHH escapes | -LL | println!("{:?}", b"/*\xE2\x80\xAE } �if isAdmin� � begin admins only "); - | ~~~~~~~~~~~~ +LL - println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); +LL + println!("{:?}", b"/*\xE2\x80\xAE } �if isAdmin� � begin admins only "); + | error: non-ASCII character in byte string literal --> $DIR/unicode-control-codepoints.rs:18:30 @@ -33,8 +34,9 @@ LL | println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); | help: if you meant to use the UTF-8 encoding of '\u{2066}', use \xHH escapes | -LL | println!("{:?}", b"/*� } \xE2\x81\xA6if isAdmin� � begin admins only "); - | ~~~~~~~~~~~~ +LL - println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); +LL + println!("{:?}", b"/*� } \xE2\x81\xA6if isAdmin� � begin admins only "); + | error: non-ASCII character in byte string literal --> $DIR/unicode-control-codepoints.rs:18:41 @@ -44,8 +46,9 @@ LL | println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); | help: if you meant to use the UTF-8 encoding of '\u{2069}', use \xHH escapes | -LL | println!("{:?}", b"/*� } �if isAdmin\xE2\x81\xA9 � begin admins only "); - | ~~~~~~~~~~~~ +LL - println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); +LL + println!("{:?}", b"/*� } �if isAdmin\xE2\x81\xA9 � begin admins only "); + | error: non-ASCII character in byte string literal --> $DIR/unicode-control-codepoints.rs:18:43 @@ -55,8 +58,9 @@ LL | println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); | help: if you meant to use the UTF-8 encoding of '\u{2066}', use \xHH escapes | -LL | println!("{:?}", b"/*� } �if isAdmin� \xE2\x81\xA6 begin admins only "); - | ~~~~~~~~~~~~ +LL - println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); +LL + println!("{:?}", b"/*� } �if isAdmin� \xE2\x81\xA6 begin admins only "); + | error: non-ASCII character in raw byte string literal --> $DIR/unicode-control-codepoints.rs:23:29 @@ -128,8 +132,9 @@ LL | println!("{:?}", "/*� } �if isAdmin� � begin admins only "); = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | -LL | println!("{:?}", "/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} begin admins only "); - | ~~~~~~~~ ~~~~~~~~ ~~~~~~~~ ~~~~~~~~ +LL - println!("{:?}", "/*� } �if isAdmin� � begin admins only "); +LL + println!("{:?}", "/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} begin admins only "); + | error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:16:22 @@ -147,8 +152,9 @@ LL | println!("{:?}", r##"/*� } �if isAdmin� � begin admins only "## = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | -LL | println!("{:?}", r##"/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} begin admins only "##); - | ~~~~~~~~ ~~~~~~~~ ~~~~~~~~ ~~~~~~~~ +LL - println!("{:?}", r##"/*� } �if isAdmin� � begin admins only "##); +LL + println!("{:?}", r##"/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} begin admins only "##); + | error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:28:22 @@ -163,8 +169,9 @@ LL | println!("{:?}", '�'); = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | -LL | println!("{:?}", '\u{202e}'); - | ~~~~~~~~ +LL - println!("{:?}", '�'); +LL + println!("{:?}", '\u{202e}'); + | error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:31:13 @@ -179,8 +186,9 @@ LL | let _ = c"�"; = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | -LL | let _ = c"\u{202e}"; - | ~~~~~~~~ +LL - let _ = c"�"; +LL + let _ = c"\u{202e}"; + | error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:33:13 @@ -195,8 +203,9 @@ LL | let _ = cr#"�"#; = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | -LL | let _ = cr#"\u{202e}"#; - | ~~~~~~~~ +LL - let _ = cr#"�"#; +LL + let _ = cr#"\u{202e}"#; + | error: unicode codepoint changing visible direction of text present in format string --> $DIR/unicode-control-codepoints.rs:36:14 @@ -211,8 +220,9 @@ LL | println!("{{�}}"); = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | -LL | println!("{{\u{202e}}}"); - | ~~~~~~~~ +LL - println!("{{�}}"); +LL + println!("{{\u{202e}}}"); + | error: unicode codepoint changing visible direction of text present in doc comment --> $DIR/unicode-control-codepoints.rs:43:1 diff --git a/tests/ui/parser/unicode-quote-chars.stderr b/tests/ui/parser/unicode-quote-chars.stderr index 092abeb53cd..0ffb204d64a 100644 --- a/tests/ui/parser/unicode-quote-chars.stderr +++ b/tests/ui/parser/unicode-quote-chars.stderr @@ -6,8 +6,9 @@ LL | println!(“hello world”); | help: Unicode characters '“' (Left Double Quotation Mark) and '”' (Right Double Quotation Mark) look like '"' (Quotation Mark), but are not | -LL | println!("hello world"); - | ~~~~~~~~~~~~~ +LL - println!(“hello world”); +LL + println!("hello world"); + | error: unknown start of token: \u{201d} --> $DIR/unicode-quote-chars.rs:2:26 @@ -17,8 +18,9 @@ LL | println!(“hello world”); | help: Unicode character '”' (Right Double Quotation Mark) looks like '"' (Quotation Mark), but it is not | -LL | println!(“hello world"); - | ~ +LL - println!(“hello world”); +LL + println!(“hello world"); + | error: expected `,`, found `world` --> $DIR/unicode-quote-chars.rs:2:21 diff --git a/tests/ui/parser/unnecessary-let.stderr b/tests/ui/parser/unnecessary-let.stderr index 0b28123747a..d75d1943f2f 100644 --- a/tests/ui/parser/unnecessary-let.stderr +++ b/tests/ui/parser/unnecessary-let.stderr @@ -18,8 +18,9 @@ LL | for let _x of [1, 2, 3] {} | help: try using `in` here instead | -LL | for let _x in [1, 2, 3] {} - | ~~ +LL - for let _x of [1, 2, 3] {} +LL + for let _x in [1, 2, 3] {} + | error: expected pattern, found `let` --> $DIR/unnecessary-let.rs:9:9 diff --git a/tests/ui/parser/use-colon-as-mod-sep.stderr b/tests/ui/parser/use-colon-as-mod-sep.stderr index 347b271df99..9b4cc0ca237 100644 --- a/tests/ui/parser/use-colon-as-mod-sep.stderr +++ b/tests/ui/parser/use-colon-as-mod-sep.stderr @@ -8,7 +8,7 @@ LL | use std::process:Command; help: use double colon | LL | use std::process::Command; - | ~~ + | + error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:5:8 @@ -20,7 +20,7 @@ LL | use std:fs::File; help: use double colon | LL | use std::fs::File; - | ~~ + | + error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:8 @@ -32,7 +32,7 @@ LL | use std:collections:HashMap; help: use double colon | LL | use std::collections:HashMap; - | ~~ + | + error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:20 @@ -44,7 +44,7 @@ LL | use std:collections:HashMap; help: use double colon | LL | use std:collections::HashMap; - | ~~ + | + error: aborting due to 4 previous errors diff --git a/tests/ui/parser/utf16-be-without-bom.stderr b/tests/ui/parser/utf16-be-without-bom.stderr index b915c7941b3..0493bcbc77a 100644 --- a/tests/ui/parser/utf16-be-without-bom.stderr +++ b/tests/ui/parser/utf16-be-without-bom.stderr @@ -110,8 +110,9 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | help: consider removing the space to spell keyword `fn` | -LL | ␀fn␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ - | ~~ +LL - ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ +LL + ␀fn␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ + | error: aborting due to 14 previous errors diff --git a/tests/ui/parser/utf16-le-without-bom.stderr b/tests/ui/parser/utf16-le-without-bom.stderr index d937a07bc66..4b195ed0da1 100644 --- a/tests/ui/parser/utf16-le-without-bom.stderr +++ b/tests/ui/parser/utf16-le-without-bom.stderr @@ -110,8 +110,9 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | help: consider removing the space to spell keyword `fn` | -LL | fn␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ - | ~~ +LL - f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ +LL + fn␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ + | error: aborting due to 14 previous errors diff --git a/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr b/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr index 1599edd7a99..0960af705ce 100644 --- a/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr +++ b/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr @@ -9,8 +9,9 @@ LL | let _ @ a = 0; | help: switch the order | -LL | let a @ _ = 0; - | ~~~~~ +LL - let _ @ a = 0; +LL + let a @ _ = 0; + | error: pattern on wrong side of `@` --> $DIR/wild-before-at-syntactically-rejected.rs:10:9 @@ -23,8 +24,9 @@ LL | let _ @ ref a = 0; | help: switch the order | -LL | let ref a @ _ = 0; - | ~~~~~~~~~ +LL - let _ @ ref a = 0; +LL + let ref a @ _ = 0; + | error: pattern on wrong side of `@` --> $DIR/wild-before-at-syntactically-rejected.rs:12:9 @@ -37,8 +39,9 @@ LL | let _ @ ref mut a = 0; | help: switch the order | -LL | let ref mut a @ _ = 0; - | ~~~~~~~~~~~~~ +LL - let _ @ ref mut a = 0; +LL + let ref mut a @ _ = 0; + | error: left-hand side of `@` must be a binding --> $DIR/wild-before-at-syntactically-rejected.rs:14:9 diff --git a/tests/ui/pattern/complexity_limit.rs b/tests/ui/pattern/complexity_limit.rs index c9a3f99bccd..7c127820511 100644 --- a/tests/ui/pattern/complexity_limit.rs +++ b/tests/ui/pattern/complexity_limit.rs @@ -1,5 +1,5 @@ #![feature(rustc_attrs)] -#![pattern_complexity = "10000"] +#![pattern_complexity_limit = "10000"] #[derive(Default)] struct BaseCommand { diff --git a/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr index e80789253c0..31f8feb1a71 100644 --- a/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr +++ b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr @@ -50,8 +50,9 @@ LL | let _: usize = 3u8; | help: change the type of the numeric literal from `u8` to `usize` | -LL | let _: usize = 3usize; - | ~~~~~ +LL - let _: usize = 3u8; +LL + let _: usize = 3usize; + | error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/issue-72574-1.stderr b/tests/ui/pattern/issue-72574-1.stderr index 653869a237d..a9076c3dff6 100644 --- a/tests/ui/pattern/issue-72574-1.stderr +++ b/tests/ui/pattern/issue-72574-1.stderr @@ -7,8 +7,9 @@ LL | (_a, _x @ ..) => {} = help: remove this and bind each tuple field independently help: if you don't need to use the contents of _x, discard the tuple's remaining fields | -LL | (_a, ..) => {} - | ~~ +LL - (_a, _x @ ..) => {} +LL + (_a, ..) => {} + | error: `..` patterns are not allowed here --> $DIR/issue-72574-1.rs:4:19 diff --git a/tests/ui/pattern/issue-72574-2.stderr b/tests/ui/pattern/issue-72574-2.stderr index 05650f05cbf..8edc2634eed 100644 --- a/tests/ui/pattern/issue-72574-2.stderr +++ b/tests/ui/pattern/issue-72574-2.stderr @@ -7,8 +7,9 @@ LL | Binder(_a, _x @ ..) => {} = help: remove this and bind each tuple field independently help: if you don't need to use the contents of _x, discard the tuple's remaining fields | -LL | Binder(_a, ..) => {} - | ~~ +LL - Binder(_a, _x @ ..) => {} +LL + Binder(_a, ..) => {} + | error: `..` patterns are not allowed here --> $DIR/issue-72574-2.rs:6:25 diff --git a/tests/ui/pattern/issue-74539.stderr b/tests/ui/pattern/issue-74539.stderr index 7443946c013..b6bd084ca4b 100644 --- a/tests/ui/pattern/issue-74539.stderr +++ b/tests/ui/pattern/issue-74539.stderr @@ -7,8 +7,9 @@ LL | E::A(x @ ..) => { = help: remove this and bind each tuple field independently help: if you don't need to use the contents of x, discard the tuple's remaining fields | -LL | E::A(..) => { - | ~~ +LL - E::A(x @ ..) => { +LL + E::A(..) => { + | error: `..` patterns are not allowed here --> $DIR/issue-74539.rs:8:18 diff --git a/tests/ui/pattern/issue-74702.stderr b/tests/ui/pattern/issue-74702.stderr index f2e2c8f021b..5bb58de1c6e 100644 --- a/tests/ui/pattern/issue-74702.stderr +++ b/tests/ui/pattern/issue-74702.stderr @@ -7,8 +7,9 @@ LL | let (foo @ ..,) = (0, 0); = help: remove this and bind each tuple field independently help: if you don't need to use the contents of foo, discard the tuple's remaining fields | -LL | let (..,) = (0, 0); - | ~~ +LL - let (foo @ ..,) = (0, 0); +LL + let (..,) = (0, 0); + | error: `..` patterns are not allowed here --> $DIR/issue-74702.rs:2:16 diff --git a/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr b/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr index 622358126b0..b61f8dbab00 100644 --- a/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr +++ b/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr @@ -7,8 +7,9 @@ LL | let mut &x = &0; = note: `mut` may be followed by `variable` and `variable @ pattern` help: add `mut` to each binding | -LL | let &(mut x) = &0; - | ~~~~~~~~ +LL - let mut &x = &0; +LL + let &(mut x) = &0; + | error: aborting due to 1 previous error diff --git a/tests/ui/pattern/overflowing-literals.rs b/tests/ui/pattern/overflowing-literals.rs new file mode 100644 index 00000000000..13016d3f7d1 --- /dev/null +++ b/tests/ui/pattern/overflowing-literals.rs @@ -0,0 +1,21 @@ +//! Check that overflowing literals are in patterns are rejected + +#![feature(pattern_types)] +#![feature(pattern_type_macro)] + +use std::pat::pattern_type; + +type TooBig = pattern_type!(u8 is 500..); +//~^ ERROR: literal out of range for `u8` +type TooSmall = pattern_type!(i8 is -500..); +//~^ ERROR: literal out of range for `i8` +type TooBigSigned = pattern_type!(i8 is 200..); +//~^ ERROR: literal out of range for `i8` + +fn main() { + match 5_u8 { + 500 => {} + //~^ ERROR literal out of range for `u8` + _ => {} + } +} diff --git a/tests/ui/pattern/overflowing-literals.stderr b/tests/ui/pattern/overflowing-literals.stderr new file mode 100644 index 00000000000..8164b97fd47 --- /dev/null +++ b/tests/ui/pattern/overflowing-literals.stderr @@ -0,0 +1,37 @@ +error: literal out of range for `u8` + --> $DIR/overflowing-literals.rs:8:35 + | +LL | type TooBig = pattern_type!(u8 is 500..); + | ^^^ + | + = note: the literal `500` does not fit into the type `u8` whose range is `0..=255` + = note: `#[deny(overflowing_literals)]` on by default + +error: literal out of range for `i8` + --> $DIR/overflowing-literals.rs:10:37 + | +LL | type TooSmall = pattern_type!(i8 is -500..); + | ^^^^ + | + = note: the literal `-500` does not fit into the type `i8` whose range is `-128..=127` + = help: consider using the type `i16` instead + +error: literal out of range for `i8` + --> $DIR/overflowing-literals.rs:12:41 + | +LL | type TooBigSigned = pattern_type!(i8 is 200..); + | ^^^ + | + = note: the literal `200` does not fit into the type `i8` whose range is `-128..=127` + = help: consider using the type `u8` instead + +error: literal out of range for `u8` + --> $DIR/overflowing-literals.rs:17:9 + | +LL | 500 => {} + | ^^^ + | + = note: the literal `500` does not fit into the type `u8` whose range is `0..=255` + +error: aborting due to 4 previous errors + diff --git a/tests/ui/pattern/pat-tuple-field-count-cross.stderr b/tests/ui/pattern/pat-tuple-field-count-cross.stderr index 0d7f2e4af69..e164281826b 100644 --- a/tests/ui/pattern/pat-tuple-field-count-cross.stderr +++ b/tests/ui/pattern/pat-tuple-field-count-cross.stderr @@ -25,12 +25,14 @@ LL | pub struct Z1(); | help: use this syntax instead | -LL | Z0 => {} - | ~~ +LL - Z0() => {} +LL + Z0 => {} + | help: a tuple struct with a similar name exists | -LL | Z1() => {} - | ~~ +LL - Z0() => {} +LL + Z1() => {} + | error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0` --> $DIR/pat-tuple-field-count-cross.rs:10:9 @@ -47,12 +49,14 @@ LL | pub struct Z1(); | help: use this syntax instead | -LL | Z0 => {} - | ~~ +LL - Z0(x) => {} +LL + Z0 => {} + | help: a tuple struct with a similar name exists | -LL | Z1(x) => {} - | ~~ +LL - Z0(x) => {} +LL + Z1(x) => {} + | error[E0532]: expected tuple struct or tuple variant, found unit variant `E1::Z0` --> $DIR/pat-tuple-field-count-cross.rs:31:9 @@ -69,12 +73,14 @@ LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } | help: use this syntax instead | -LL | E1::Z0 => {} - | ~~~~~~ +LL - E1::Z0() => {} +LL + E1::Z0 => {} + | help: a tuple variant with a similar name exists | -LL | E1::Z1() => {} - | ~~ +LL - E1::Z0() => {} +LL + E1::Z1() => {} + | error[E0532]: expected tuple struct or tuple variant, found unit variant `E1::Z0` --> $DIR/pat-tuple-field-count-cross.rs:32:9 @@ -91,12 +97,14 @@ LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } | help: use this syntax instead | -LL | E1::Z0 => {} - | ~~~~~~ +LL - E1::Z0(x) => {} +LL + E1::Z0 => {} + | help: a tuple variant with a similar name exists | -LL | E1::Z1(x) => {} - | ~~ +LL - E1::Z0(x) => {} +LL + E1::Z1(x) => {} + | error[E0532]: expected unit struct, unit variant or constant, found tuple variant `E1::Z1` --> $DIR/pat-tuple-field-count-cross.rs:35:9 @@ -114,11 +122,12 @@ LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } help: use the tuple variant pattern syntax instead | LL | E1::Z1() => {} - | ~~~~~~~~ + | ++ help: a unit variant with a similar name exists | -LL | E1::Z0 => {} - | ~~ +LL - E1::Z1 => {} +LL + E1::Z0 => {} + | error[E0023]: this pattern has 1 field, but the corresponding tuple struct has 0 fields --> $DIR/pat-tuple-field-count-cross.rs:14:12 diff --git a/tests/ui/pattern/pat-tuple-overfield.stderr b/tests/ui/pattern/pat-tuple-overfield.stderr index 54d89e03101..b19b9d19347 100644 --- a/tests/ui/pattern/pat-tuple-overfield.stderr +++ b/tests/ui/pattern/pat-tuple-overfield.stderr @@ -23,12 +23,14 @@ LL | Z0() => {} | help: use this syntax instead | -LL | Z0 => {} - | ~~ +LL - Z0() => {} +LL + Z0 => {} + | help: a tuple struct with a similar name exists | -LL | Z1() => {} - | ~~ +LL - Z0() => {} +LL + Z1() => {} + | error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0` --> $DIR/pat-tuple-overfield.rs:53:9 @@ -43,12 +45,14 @@ LL | Z0(_) => {} | help: use this syntax instead | -LL | Z0 => {} - | ~~ +LL - Z0(_) => {} +LL + Z0 => {} + | help: a tuple struct with a similar name exists | -LL | Z1(_) => {} - | ~~ +LL - Z0(_) => {} +LL + Z1(_) => {} + | error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0` --> $DIR/pat-tuple-overfield.rs:54:9 @@ -63,12 +67,14 @@ LL | Z0(_, _) => {} | help: use this syntax instead | -LL | Z0 => {} - | ~~ +LL - Z0(_, _) => {} +LL + Z0 => {} + | help: a tuple struct with a similar name exists | -LL | Z1(_, _) => {} - | ~~ +LL - Z0(_, _) => {} +LL + Z1(_, _) => {} + | error[E0532]: expected tuple struct or tuple variant, found unit variant `E1::Z0` --> $DIR/pat-tuple-overfield.rs:64:9 @@ -83,12 +89,14 @@ LL | E1::Z0() => {} | help: use this syntax instead | -LL | E1::Z0 => {} - | ~~~~~~ +LL - E1::Z0() => {} +LL + E1::Z0 => {} + | help: a tuple variant with a similar name exists | -LL | E1::Z1() => {} - | ~~ +LL - E1::Z0() => {} +LL + E1::Z1() => {} + | error[E0532]: expected tuple struct or tuple variant, found unit variant `E1::Z0` --> $DIR/pat-tuple-overfield.rs:65:9 @@ -103,12 +111,14 @@ LL | E1::Z0(_) => {} | help: use this syntax instead | -LL | E1::Z0 => {} - | ~~~~~~ +LL - E1::Z0(_) => {} +LL + E1::Z0 => {} + | help: a tuple variant with a similar name exists | -LL | E1::Z1(_) => {} - | ~~ +LL - E1::Z0(_) => {} +LL + E1::Z1(_) => {} + | error[E0532]: expected tuple struct or tuple variant, found unit variant `E1::Z0` --> $DIR/pat-tuple-overfield.rs:66:9 @@ -123,12 +133,14 @@ LL | E1::Z0(_, _) => {} | help: use this syntax instead | -LL | E1::Z0 => {} - | ~~~~~~ +LL - E1::Z0(_, _) => {} +LL + E1::Z0 => {} + | help: a tuple variant with a similar name exists | -LL | E1::Z1(_, _) => {} - | ~~ +LL - E1::Z0(_, _) => {} +LL + E1::Z1(_, _) => {} + | error[E0532]: expected unit struct, unit variant or constant, found tuple variant `E1::Z1` --> $DIR/pat-tuple-overfield.rs:69:9 @@ -144,11 +156,12 @@ LL | E1::Z1 => {} help: use the tuple variant pattern syntax instead | LL | E1::Z1() => {} - | ~~~~~~~~ + | ++ help: a unit variant with a similar name exists | -LL | E1::Z0 => {} - | ~~ +LL - E1::Z1 => {} +LL + E1::Z0 => {} + | error[E0308]: mismatched types --> $DIR/pat-tuple-overfield.rs:19:9 diff --git a/tests/ui/pattern/pat-tuple-underfield.stderr b/tests/ui/pattern/pat-tuple-underfield.stderr index e75f9b38da5..c8620fe85c3 100644 --- a/tests/ui/pattern/pat-tuple-underfield.stderr +++ b/tests/ui/pattern/pat-tuple-underfield.stderr @@ -36,8 +36,9 @@ LL | S(_, _) => {} | +++ help: use `..` to ignore all fields | -LL | S(..) => {} - | ~~ +LL - S(_) => {} +LL + S(..) => {} + | error[E0023]: this pattern has 0 fields, but the corresponding tuple struct has 2 fields --> $DIR/pat-tuple-underfield.rs:20:9 @@ -104,8 +105,9 @@ LL | E::S(_, _) => {} | +++ help: use `..` to ignore all fields | -LL | E::S(..) => {} - | ~~ +LL - E::S(_) => {} +LL + E::S(..) => {} + | error[E0023]: this pattern has 0 fields, but the corresponding tuple variant has 2 fields --> $DIR/pat-tuple-underfield.rs:44:9 @@ -158,8 +160,9 @@ LL | Point4( a , _ , _, _) => {} | ++++++ help: use `..` to ignore the rest of the fields | -LL | Point4( a, ..) => {} - | ~~~~ +LL - Point4( a , _ ) => {} +LL + Point4( a, ..) => {} + | error: aborting due to 10 previous errors diff --git a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr index e9c2fccaba2..a6623c6306b 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr @@ -7,7 +7,7 @@ LL | b.make_ascii_uppercase(); help: consider changing this to be mutable | LL | let &(mut b) = a; - | ~~~~~ + + | ++++ + error: aborting due to 1 previous error diff --git a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr index e93b8bbaccc..7fa65e3d6bd 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr @@ -7,7 +7,7 @@ LL | mutate(&mut x); help: consider changing this to be mutable | LL | fn foo(&(mut x): &i32) { - | ~~~~~ + + | ++++ + error: aborting due to 1 previous error diff --git a/tests/ui/pattern/pattern-bad-ref-box-order.stderr b/tests/ui/pattern/pattern-bad-ref-box-order.stderr index a89d3ed21b6..6f47f704688 100644 --- a/tests/ui/pattern/pattern-bad-ref-box-order.stderr +++ b/tests/ui/pattern/pattern-bad-ref-box-order.stderr @@ -6,8 +6,9 @@ LL | Some(ref box _i) => {}, | help: swap them | -LL | Some(box ref _i) => {}, - | ~~~~~~~ +LL - Some(ref box _i) => {}, +LL + Some(box ref _i) => {}, + | error: aborting due to 1 previous error diff --git a/tests/ui/pattern/pattern-error-continue.stderr b/tests/ui/pattern/pattern-error-continue.stderr index 10fcccb0301..bb5582dd873 100644 --- a/tests/ui/pattern/pattern-error-continue.stderr +++ b/tests/ui/pattern/pattern-error-continue.stderr @@ -12,12 +12,14 @@ LL | A::D(_) => (), | help: use this syntax instead | -LL | A::D => (), - | ~~~~ +LL - A::D(_) => (), +LL + A::D => (), + | help: a tuple variant with a similar name exists | -LL | A::B(_) => (), - | ~ +LL - A::D(_) => (), +LL + A::B(_) => (), + | error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields --> $DIR/pattern-error-continue.rs:17:14 diff --git a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr index 9d642b9245a..37b2d96bb01 100644 --- a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr +++ b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr @@ -6,8 +6,9 @@ LL | [_, ...tail] => println!("{tail}"), | help: use `..=` instead | -LL | [_, ..=tail] => println!("{tail}"), - | ~~~ +LL - [_, ...tail] => println!("{tail}"), +LL + [_, ..=tail] => println!("{tail}"), + | error[E0425]: cannot find value `rest` in this scope --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:3:13 @@ -34,8 +35,9 @@ LL | [_, ..tail] => println!("{tail}"), | help: if you meant to collect the rest of the slice in `tail`, use the at operator | -LL | [_, tail @ ..] => println!("{tail}"), - | ~~~~~~~~~ +LL - [_, ..tail] => println!("{tail}"), +LL + [_, tail @ ..] => println!("{tail}"), + | error[E0425]: cannot find value `tail` in this scope --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:11:35 @@ -51,8 +53,9 @@ LL | [_, ...tail] => println!("{tail}"), | help: if you meant to collect the rest of the slice in `tail`, use the at operator | -LL | [_, tail @ ..] => println!("{tail}"), - | ~~~~~~~~~ +LL - [_, ...tail] => println!("{tail}"), +LL + [_, tail @ ..] => println!("{tail}"), + | error[E0425]: cannot find value `tail` in this scope --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:17:36 diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/auxiliary/migration_lint_macros.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/auxiliary/migration_lint_macros.rs index daa9b7368fd..b18f87fd569 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/auxiliary/migration_lint_macros.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/auxiliary/migration_lint_macros.rs @@ -9,3 +9,10 @@ macro_rules! mixed_edition_pat { Some(mut $foo) }; } + +#[macro_export] +macro_rules! bind_ref { + ($foo:ident) => { + ref $foo + }; +} diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.classic2024.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.classic2024.stderr new file mode 100644 index 00000000000..1c446178308 --- /dev/null +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.classic2024.stderr @@ -0,0 +1,79 @@ +error[E0508]: cannot move out of type `[&mut u32; 1]`, a non-copy array + --> $DIR/borrowck-errors.rs:13:16 + | +LL | let [&x] = &[&mut 0]; + | - ^^^^^^^^^ cannot move out of here + | | + | data moved here + | move occurs because `x` has type `&mut u32`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | let [&ref x] = &[&mut 0]; + | +++ + +error[E0508]: cannot move out of type `[&mut u32; 1]`, a non-copy array + --> $DIR/borrowck-errors.rs:19:16 + | +LL | let [&x] = &mut [&mut 0]; + | - ^^^^^^^^^^^^^ cannot move out of here + | | + | data moved here + | move occurs because `x` has type `&mut u32`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | let [&ref x] = &mut [&mut 0]; + | +++ + +error[E0507]: cannot move out of a shared reference + --> $DIR/borrowck-errors.rs:27:29 + | +LL | if let Some(&Some(x)) = Some(&Some(&mut 0)) { + | - ^^^^^^^^^^^^^^^^^^^ + | | + | data moved here + | move occurs because `x` has type `&mut u32`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - if let Some(&Some(x)) = Some(&Some(&mut 0)) { +LL + if let Some(Some(x)) = Some(&Some(&mut 0)) { + | + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/borrowck-errors.rs:32:10 + | +LL | let &ref mut x = &0; + | ^^^^^^^^^ cannot borrow as mutable + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/borrowck-errors.rs:37:23 + | +LL | if let &Some(Some(x)) = &Some(&mut Some(0)) { + | ^ cannot borrow as mutable + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/borrowck-errors.rs:42:11 + | +LL | let &[x] = &&mut [0]; + | ^ cannot borrow as mutable + +error[E0508]: cannot move out of type `[&mut i32; 1]`, a non-copy array + --> $DIR/borrowck-errors.rs:46:20 + | +LL | let [&mut x] = &mut [&mut 0]; + | - ^^^^^^^^^^^^^ cannot move out of here + | | + | data moved here + | move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | let [&mut ref x] = &mut [&mut 0]; + | +++ + +error: aborting due to 7 previous errors + +Some errors have detailed explanations: E0507, E0508, E0596. +For more information about an error, try `rustc --explain E0507`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs index a01e9ca2657..59cafc50d86 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs @@ -1,9 +1,27 @@ -//@ edition: 2024 -//@ revisions: classic structural +//@ revisions: stable2021 classic2024 structural2024 +//@[stable2021] edition: 2021 +//@[classic2024] edition: 2024 +//@[structural2024] edition: 2024 //! Tests for pattern errors not handled by the pattern typing rules, but by borrowck. #![allow(incomplete_features)] -#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))] -#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))] +#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))] +#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))] + +/// These patterns additionally use `&` to match a `&mut` reference type, which causes compilation +/// to fail in HIR typeck on stable. As such, they need to be separate from the other tests. +fn errors_caught_in_hir_typeck_on_stable() { + let [&x] = &[&mut 0]; + //[stable2021]~^ mismatched types + //[stable2021]~| types differ in mutability + //[classic2024]~^^^ ERROR: cannot move out of type + let _: &u32 = x; + + let [&x] = &mut [&mut 0]; + //[stable2021]~^ mismatched types + //[stable2021]~| types differ in mutability + //[classic2024]~^^^ ERROR: cannot move out of type + let _: &u32 = x; +} pub fn main() { if let Some(&Some(x)) = Some(&Some(&mut 0)) { @@ -13,4 +31,20 @@ pub fn main() { let &ref mut x = &0; //~^ cannot borrow data in a `&` reference as mutable [E0596] + + // For 2021 edition, this is also a regression test for #136223 + // since the maximum mutability is downgraded during the pattern check process. + if let &Some(Some(x)) = &Some(&mut Some(0)) { + //[stable2021,classic2024]~^ ERROR: cannot borrow data in a `&` reference as mutable + let _: &u32 = x; + } + + let &[x] = &&mut [0]; + //[stable2021,classic2024]~^ ERROR: cannot borrow data in a `&` reference as mutable + let _: &u32 = x; + + let [&mut x] = &mut [&mut 0]; + //[classic2024]~^ ERROR: cannot move out of type + #[cfg(stable2021)] let _: u32 = x; + #[cfg(structural2024)] let _: &mut u32 = x; } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.stable2021.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.stable2021.stderr new file mode 100644 index 00000000000..deefe21ca7d --- /dev/null +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.stable2021.stderr @@ -0,0 +1,69 @@ +error[E0308]: mismatched types + --> $DIR/borrowck-errors.rs:13:10 + | +LL | let [&x] = &[&mut 0]; + | ^^ --------- this expression has type `&[&mut {integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut {integer}` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - let [&x] = &[&mut 0]; +LL + let [x] = &[&mut 0]; + | + +error[E0308]: mismatched types + --> $DIR/borrowck-errors.rs:19:10 + | +LL | let [&x] = &mut [&mut 0]; + | ^^ ------------- this expression has type `&mut [&mut {integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut {integer}` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - let [&x] = &mut [&mut 0]; +LL + let [x] = &mut [&mut 0]; + | + +error[E0507]: cannot move out of a shared reference + --> $DIR/borrowck-errors.rs:27:29 + | +LL | if let Some(&Some(x)) = Some(&Some(&mut 0)) { + | - ^^^^^^^^^^^^^^^^^^^ + | | + | data moved here + | move occurs because `x` has type `&mut u32`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - if let Some(&Some(x)) = Some(&Some(&mut 0)) { +LL + if let Some(Some(x)) = Some(&Some(&mut 0)) { + | + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/borrowck-errors.rs:32:10 + | +LL | let &ref mut x = &0; + | ^^^^^^^^^ cannot borrow as mutable + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/borrowck-errors.rs:37:23 + | +LL | if let &Some(Some(x)) = &Some(&mut Some(0)) { + | ^ cannot borrow as mutable + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/borrowck-errors.rs:42:11 + | +LL | let &[x] = &&mut [0]; + | ^ cannot borrow as mutable + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0308, E0507, E0596. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.structural.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.structural.stderr deleted file mode 100644 index c6246114075..00000000000 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.structural.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0507]: cannot move out of a shared reference - --> $DIR/borrowck-errors.rs:9:29 - | -LL | if let Some(&Some(x)) = Some(&Some(&mut 0)) { - | - ^^^^^^^^^^^^^^^^^^^ - | | - | data moved here - | move occurs because `x` has type `&mut u32`, which does not implement the `Copy` trait - | -help: consider removing the borrow - | -LL - if let Some(&Some(x)) = Some(&Some(&mut 0)) { -LL + if let Some(Some(x)) = Some(&Some(&mut 0)) { - | - -error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-errors.rs:14:10 - | -LL | let &ref mut x = &0; - | ^^^^^^^^^ cannot borrow as mutable - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0507, E0596. -For more information about an error, try `rustc --explain E0507`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.classic.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.structural2024.stderr index c6246114075..30d2f9f3d70 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.classic.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.structural2024.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of a shared reference - --> $DIR/borrowck-errors.rs:9:29 + --> $DIR/borrowck-errors.rs:27:29 | LL | if let Some(&Some(x)) = Some(&Some(&mut 0)) { | - ^^^^^^^^^^^^^^^^^^^ @@ -14,7 +14,7 @@ LL + if let Some(Some(x)) = Some(&Some(&mut 0)) { | error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-errors.rs:14:10 + --> $DIR/borrowck-errors.rs:32:10 | LL | let &ref mut x = &0; | ^^^^^^^^^ cannot borrow as mutable diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/cannot-mutably-deref-shared-ref.classic.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/cannot-mutably-deref-shared-ref.classic2024.stderr index 89a52ba7d1d..89a52ba7d1d 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/cannot-mutably-deref-shared-ref.classic.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/cannot-mutably-deref-shared-ref.classic2024.stderr diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/cannot-mutably-deref-shared-ref.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/cannot-mutably-deref-shared-ref.rs index e22bd1f8f6c..a493b672c92 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/cannot-mutably-deref-shared-ref.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/cannot-mutably-deref-shared-ref.rs @@ -1,9 +1,9 @@ //@ edition: 2024 -//@ revisions: classic structural +//@ revisions: classic2024 structural2024 //! Test that `&mut` patterns don't match shared reference types under new typing rules in Rust 2024 #![allow(incomplete_features)] -#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))] -#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))] +#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))] +#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))] pub fn main() { let &mut _ = &&0; diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/cannot-mutably-deref-shared-ref.structural.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/cannot-mutably-deref-shared-ref.structural2024.stderr index 89a52ba7d1d..89a52ba7d1d 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/cannot-mutably-deref-shared-ref.structural.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/cannot-mutably-deref-shared-ref.structural2024.stderr diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/feature-gate-ref_pat_eat_one_layer_2024.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/feature-gate-ref_pat_eat_one_layer_2024.stderr index 132fe421a18..912eeb1c9c0 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/feature-gate-ref_pat_eat_one_layer_2024.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/feature-gate-ref_pat_eat_one_layer_2024.stderr @@ -10,8 +10,9 @@ LL | if let Some(Some(&x)) = &Some(&Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(Some(x)) = &Some(&Some(0)) { - | ~ +LL - if let Some(Some(&x)) = &Some(&Some(0)) { +LL + if let Some(Some(x)) = &Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/feature-gate-ref_pat_eat_one_layer_2024.rs:10:23 @@ -70,8 +71,9 @@ LL | if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { | ^^^^^^ help: consider removing `&mut` from the pattern | -LL | if let Some(Some(x)) = &mut Some(&mut Some(0)) { - | ~ +LL - if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { +LL + if let Some(Some(x)) = &mut Some(&mut Some(0)) { + | error[E0308]: mismatched types --> $DIR/feature-gate-ref_pat_eat_one_layer_2024.rs:25:22 @@ -85,8 +87,9 @@ LL | if let Some(Some(&x)) = &Some(&Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(Some(x)) = &Some(&Some(0)) { - | ~ +LL - if let Some(Some(&x)) = &Some(&Some(0)) { +LL + if let Some(Some(x)) = &Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/feature-gate-ref_pat_eat_one_layer_2024.rs:29:27 @@ -100,8 +103,9 @@ LL | if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(&mut Some(x)) = &Some(&mut Some(0)) { - | ~ +LL - if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { +LL + if let Some(&mut Some(x)) = &Some(&mut Some(0)) { + | error[E0308]: mismatched types --> $DIR/feature-gate-ref_pat_eat_one_layer_2024.rs:33:23 @@ -120,8 +124,9 @@ LL | if let Some(&Some(&mut x)) = &mut Some(&Some(0)) { | ^^^^^^ help: consider removing `&mut` from the pattern | -LL | if let Some(&Some(x)) = &mut Some(&Some(0)) { - | ~ +LL - if let Some(&Some(&mut x)) = &mut Some(&Some(0)) { +LL + if let Some(&Some(x)) = &mut Some(&Some(0)) { + | error: aborting due to 8 previous errors diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.classic.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.classic2024.stderr index 43560a18030..fa95b2b5a57 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.classic.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.classic2024.stderr @@ -1,5 +1,5 @@ error[E0658]: binding cannot be both mutable and by-reference - --> $DIR/mut-ref-mut.rs:11:13 + --> $DIR/mut-ref-mut.rs:14:13 | LL | let Foo(mut a) = &Foo(0); | ^^^^ @@ -9,7 +9,7 @@ LL | let Foo(mut a) = &Foo(0); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: binding cannot be both mutable and by-reference - --> $DIR/mut-ref-mut.rs:15:13 + --> $DIR/mut-ref-mut.rs:19:13 | LL | let Foo(mut a) = &mut Foo(0); | ^^^^ @@ -18,6 +18,20 @@ LL | let Foo(mut a) = &mut Foo(0); = help: add `#![feature(mut_ref)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/mut-ref-mut.rs:24:10 + | +LL | let [&mut mut x] = &[&mut 0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let [&mut mut x] = &[&mut 0]; +LL + let [&mut x] = &[&mut 0]; + | + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0308, E0658. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.rs index 786587984ba..fbd6514df73 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.rs @@ -1,18 +1,29 @@ -//@ edition: 2024 -//@ revisions: classic structural +//@ revisions: stable2021 classic2024 structural2024 +//@[stable2021] edition: 2021 +//@[classic2024] edition: 2024 +//@[structural2024] edition: 2024 +//@[stable2021] run-pass //! Test diagnostics for binding with `mut` when the default binding mode is by-ref. -#![allow(incomplete_features)] -#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))] -#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))] +#![allow(incomplete_features, unused_assignments, unused_variables)] +#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))] +#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))] pub fn main() { struct Foo(u8); let Foo(mut a) = &Foo(0); - //~^ ERROR: binding cannot be both mutable and by-reference - a = &42; + //[classic2024,structural2024]~^ ERROR: binding cannot be both mutable and by-reference + #[cfg(stable2021)] { a = 42 } + #[cfg(any(classic2024, structural2024))] { a = &42 } let Foo(mut a) = &mut Foo(0); - //~^ ERROR: binding cannot be both mutable and by-reference - a = &mut 42; + //[classic2024,structural2024]~^ ERROR: binding cannot be both mutable and by-reference + #[cfg(stable2021)] { a = 42 } + #[cfg(any(classic2024, structural2024))] { a = &mut 42 } + + let [&mut mut x] = &[&mut 0]; + //[classic2024]~^ ERROR: mismatched types + //[classic2024]~| cannot match inherited `&` with `&mut` pattern + //[structural2024]~^^^ binding cannot be both mutable and by-reference + #[cfg(stable2021)] { x = 0 } } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.structural.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.structural2024.stderr index 43560a18030..fd82da70a18 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.structural.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.structural2024.stderr @@ -1,5 +1,5 @@ error[E0658]: binding cannot be both mutable and by-reference - --> $DIR/mut-ref-mut.rs:11:13 + --> $DIR/mut-ref-mut.rs:14:13 | LL | let Foo(mut a) = &Foo(0); | ^^^^ @@ -9,7 +9,7 @@ LL | let Foo(mut a) = &Foo(0); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: binding cannot be both mutable and by-reference - --> $DIR/mut-ref-mut.rs:15:13 + --> $DIR/mut-ref-mut.rs:19:13 | LL | let Foo(mut a) = &mut Foo(0); | ^^^^ @@ -18,6 +18,16 @@ LL | let Foo(mut a) = &mut Foo(0); = help: add `#![feature(mut_ref)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 2 previous errors +error[E0658]: binding cannot be both mutable and by-reference + --> $DIR/mut-ref-mut.rs:24:15 + | +LL | let [&mut mut x] = &[&mut 0]; + | ^^^^ + | + = note: see issue #123076 <https://github.com/rust-lang/rust/issues/123076> for more information + = help: add `#![feature(mut_ref)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.classic.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.classic2024.stderr index 2bc3ecb7636..6726a726315 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.classic.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.classic2024.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:15:17 + --> $DIR/pattern-errors.rs:12:17 | LL | if let Some(&mut x) = &Some(&mut 0) { | ^^^^^ @@ -7,11 +7,12 @@ LL | if let Some(&mut x) = &Some(&mut 0) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&x) = &Some(&mut 0) { - | ~ +LL - if let Some(&mut x) = &Some(&mut 0) { +LL + if let Some(&x) = &Some(&mut 0) { + | error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:19:17 + --> $DIR/pattern-errors.rs:18:17 | LL | if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { | ^^^^^ @@ -19,11 +20,12 @@ LL | if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(&x)) = &Some(&mut Some(0)) { - | ~ +LL - if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { +LL + if let Some(&Some(&x)) = &Some(&mut Some(0)) { + | error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:23:22 + --> $DIR/pattern-errors.rs:24:22 | LL | if let Some(Some(&mut x)) = &Some(Some(&mut 0)) { | ^^^^^ @@ -31,11 +33,12 @@ LL | if let Some(Some(&mut x)) = &Some(Some(&mut 0)) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(Some(&x)) = &Some(Some(&mut 0)) { - | ~ +LL - if let Some(Some(&mut x)) = &Some(Some(&mut 0)) { +LL + if let Some(Some(&x)) = &Some(Some(&mut 0)) { + | error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:28:17 + --> $DIR/pattern-errors.rs:31:17 | LL | if let Some(&mut Some(&_)) = &Some(&Some(0)) { | ^^^^^ @@ -43,69 +46,88 @@ LL | if let Some(&mut Some(&_)) = &Some(&Some(0)) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(&_)) = &Some(&Some(0)) { - | ~ +LL - if let Some(&mut Some(&_)) = &Some(&Some(0)) { +LL + if let Some(&Some(&_)) = &Some(&Some(0)) { + | error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:31:23 + --> $DIR/pattern-errors.rs:41:23 | -LL | if let Some(&Some(&mut _)) = &Some(&mut Some(0)) { +LL | if let Some(&Some(&mut _)) = &mut Some(&Some(0)) { | ^^^^^ | = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(&_)) = &Some(&mut Some(0)) { - | ~ +LL - if let Some(&Some(&mut _)) = &mut Some(&Some(0)) { +LL + if let Some(&Some(&_)) = &mut Some(&Some(0)) { + | error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:34:23 + --> $DIR/pattern-errors.rs:51:17 | -LL | if let Some(&Some(&mut _)) = &mut Some(&Some(0)) { - | ^^^^^ +LL | if let Some(&mut Some(x)) = &Some(Some(0)) { + | ^^^^^ | = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(&_)) = &mut Some(&Some(0)) { - | ~ +LL - if let Some(&mut Some(x)) = &Some(Some(0)) { +LL + if let Some(&Some(x)) = &Some(Some(0)) { + | error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:37:29 + --> $DIR/pattern-errors.rs:147:10 | -LL | if let Some(&Some(Some((&mut _)))) = &Some(Some(&mut Some(0))) { - | ^^^^^ +LL | let [&mut x] = &[&mut 0]; + | ^^^^^ | = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(Some((&_)))) = &Some(Some(&mut Some(0))) { - | ~ +LL - let [&mut x] = &[&mut 0]; +LL + let [&x] = &[&mut 0]; + | error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:40:17 + --> $DIR/pattern-errors.rs:153:10 | -LL | if let Some(&mut Some(x)) = &Some(Some(0)) { - | ^^^^^ +LL | let [&mut &x] = &[&mut 0]; + | ^^^^^ | = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(x)) = &Some(Some(0)) { - | ~ +LL - let [&mut &x] = &[&mut 0]; +LL + let [&&x] = &[&mut 0]; + | error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:43:17 + --> $DIR/pattern-errors.rs:159:10 | -LL | if let Some(&mut Some(x)) = &Some(Some(0)) { - | ^^^^^ +LL | let [&mut &ref x] = &[&mut 0]; + | ^^^^^ | = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(x)) = &Some(Some(0)) { - | ~ +LL - let [&mut &ref x] = &[&mut 0]; +LL + let [&&ref x] = &[&mut 0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:165:10 + | +LL | let [&mut &(mut x)] = &[&mut 0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let [&mut &(mut x)] = &[&mut 0]; +LL + let [&&(mut x)] = &[&mut 0]; + | -error: aborting due to 9 previous errors +error: aborting due to 10 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.rs index 3535ba9c701..c07c2972cd0 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.rs @@ -1,46 +1,170 @@ -//@ edition: 2024 -//@ revisions: classic structural +//@ revisions: stable2021 classic2024 structural2024 +//@[stable2021] edition: 2021 +//@[classic2024] edition: 2024 +//@[structural2024] edition: 2024 //! Test cases for poorly-typed patterns in edition 2024 which are caught by HIR typeck. These must //! be separate from cases caught by MIR borrowck or the latter errors may not be emitted. #![allow(incomplete_features)] -#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))] -#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))] +#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))] +#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))] pub fn main() { - if let Some(&mut x) = &mut Some(&0) { - //[structural]~^ ERROR: mismatched types - let _: &u32 = x; - } - if let Some(&mut x) = &Some(&mut 0) { - //[classic]~^ ERROR: mismatched types - let _: &u32 = x; + //[classic2024]~^ ERROR: mismatched types + //[classic2024]~| cannot match inherited `&` with `&mut` pattern + #[cfg(stable2021)] let _: u32 = x; + #[cfg(structural2024)] let _: &u32 = x; } if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { - //[classic]~^ ERROR: mismatched types + //[stable2021,classic2024]~^ ERROR: mismatched types + //[stable2021]~| expected integer, found `&_` + //[classic2024]~| cannot match inherited `&` with `&mut` pattern let _: u32 = x; } if let Some(Some(&mut x)) = &Some(Some(&mut 0)) { - //[classic]~^ ERROR: mismatched types - let _: &u32 = x; + //[classic2024]~^ ERROR: mismatched types + //[classic2024]~| cannot match inherited `&` with `&mut` pattern + #[cfg(stable2021)] let _: u32 = x; + #[cfg(structural2024)] let _: &u32 = x; } if let Some(&mut Some(&_)) = &Some(&Some(0)) { //~^ ERROR: mismatched types + //[stable2021]~| types differ in mutability + //[classic2024,structural2024]~| cannot match inherited `&` with `&mut` pattern } if let Some(&Some(&mut _)) = &Some(&mut Some(0)) { - //~^ ERROR: mismatched types + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| types differ in mutability + //[structural2024]~| cannot match inherited `&` with `&mut` pattern } if let Some(&Some(&mut _)) = &mut Some(&Some(0)) { //~^ ERROR: mismatched types + //[stable2021]~| expected integer, found `&mut _` + //[classic2024,structural2024]~| cannot match inherited `&` with `&mut` pattern } - if let Some(&Some(Some((&mut _)))) = &Some(Some(&mut Some(0))) { - //~^ ERROR: mismatched types - } - if let Some(&mut Some(x)) = &Some(Some(0)) { - //~^ ERROR: mismatched types + if let Some(&Some(Some(&mut _))) = &Some(Some(&mut Some(0))) { + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| expected `Option<&mut Option<{integer}>>`, found `&_` + //[structural2024]~| cannot match inherited `&` with `&mut` pattern } if let Some(&mut Some(x)) = &Some(Some(0)) { //~^ ERROR: mismatched types + //[stable2021]~| expected `Option<{integer}>`, found `&mut _` + //[classic2024,structural2024]~| cannot match inherited `&` with `&mut` pattern } } + +fn structural_errors_0() { + let &[&mut x] = &&mut [0]; + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| expected integer, found `&mut _` + //[structural2024]~| cannot match inherited `&` with `&mut` pattern + let _: u32 = x; + + let &[&mut x] = &mut &mut [0]; + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| types differ in mutability + //[structural2024]~| cannot match inherited `&` with `&mut` pattern + let _: u32 = x; + + let &[&mut ref x] = &&mut [0]; + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| expected integer, found `&mut _` + //[structural2024]~| cannot match inherited `&` with `&mut` pattern + let _: &u32 = x; + + let &[&mut ref x] = &mut &mut [0]; + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| types differ in mutability + //[structural2024]~| cannot match inherited `&` with `&mut` pattern + let _: &u32 = x; + + let &[&mut mut x] = &&mut [0]; + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| expected integer, found `&mut _` + //[structural2024]~| cannot match inherited `&` with `&mut` pattern + let _: u32 = x; + + let &[&mut mut x] = &mut &mut [0]; + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| types differ in mutability + //[structural2024]~| cannot match inherited `&` with `&mut` pattern + let _: u32 = x; +} + +fn structural_errors_1() { + let [&(mut x)] = &[&0]; + //[structural2024]~^ ERROR: binding cannot be both mutable and by-reference + #[cfg(stable2021)] let _: u32 = x; + #[cfg(classic2024)] let _: &u32 = x; + + let [&(mut x)] = &mut [&0]; + //[structural2024]~^ ERROR: binding cannot be both mutable and by-reference + #[cfg(stable2021)] let _: u32 = x; + #[cfg(classic2024)] let _: &u32 = x; +} + +fn structural_errors_2() { + let [&&mut x] = &[&mut 0]; + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| types differ in mutability + //[structural2024]~| cannot match inherited `&` with `&mut` pattern + let _: u32 = x; + + let [&&mut x] = &mut [&mut 0]; + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| types differ in mutability + //[structural2024]~| cannot match inherited `&` with `&mut` pattern + let _: u32 = x; + + let [&&mut ref x] = &[&mut 0]; + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| types differ in mutability + //[structural2024]~| cannot match inherited `&` with `&mut` pattern + let _: &u32 = x; + + let [&&mut ref x] = &mut [&mut 0]; + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| types differ in mutability + //[structural2024]~| cannot match inherited `&` with `&mut` pattern + let _: &u32 = x; + + let [&&mut mut x] = &[&mut 0]; + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| types differ in mutability + //[structural2024]~| cannot match inherited `&` with `&mut` pattern + let _: u32 = x; + + let [&&mut mut x] = &mut [&mut 0]; + //[stable2021,structural2024]~^ ERROR: mismatched types + //[stable2021]~| types differ in mutability + //[structural2024]~| cannot match inherited `&` with `&mut` pattern + let _: u32 = x; +} + +fn classic_errors_0() { + let [&mut x] = &[&mut 0]; + //[classic2024]~^ ERROR: mismatched types + //[classic2024]~| cannot match inherited `&` with `&mut` pattern + #[cfg(stable2021)] let _: u32 = x; + #[cfg(structural2024)] let _: &u32 = x; + + let [&mut &x] = &[&mut 0]; + //[stable2021,classic2024]~^ ERROR: mismatched types + //[stable2021]~| expected integer, found `&_` + //[classic2024]~| cannot match inherited `&` with `&mut` pattern + let _: u32 = x; + + let [&mut &ref x] = &[&mut 0]; + //[stable2021,classic2024]~^ ERROR: mismatched types + //[stable2021]~| expected integer, found `&_` + //[classic2024]~| cannot match inherited `&` with `&mut` pattern + let _: &u32 = x; + + let [&mut &(mut x)] = &[&mut 0]; + //[stable2021,classic2024]~^ ERROR: mismatched types + //[stable2021]~| expected integer, found `&_` + //[classic2024]~| cannot match inherited `&` with `&mut` pattern + let _: u32 = x; +} diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.stable2021.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.stable2021.stderr new file mode 100644 index 00000000000..ad19b122c20 --- /dev/null +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.stable2021.stderr @@ -0,0 +1,284 @@ +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:18:27 + | +LL | if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { + | ^^ ------------------- this expression has type `&Option<&mut Option<{integer}>>` + | | + | expected integer, found `&_` + | + = note: expected type `{integer}` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { +LL + if let Some(&mut Some(x)) = &Some(&mut Some(0)) { + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:31:17 + | +LL | if let Some(&mut Some(&_)) = &Some(&Some(0)) { + | ^^^^^^^^^^^^^ --------------- this expression has type `&Option<&Option<{integer}>>` + | | + | types differ in mutability + | + = note: expected reference `&Option<{integer}>` + found mutable reference `&mut _` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:36:17 + | +LL | if let Some(&Some(&mut _)) = &Some(&mut Some(0)) { + | ^^^^^^^^^^^^^ ------------------- this expression has type `&Option<&mut Option<{integer}>>` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut Option<{integer}>` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:41:23 + | +LL | if let Some(&Some(&mut _)) = &mut Some(&Some(0)) { + | ^^^^^^ ------------------- this expression has type `&mut Option<&Option<{integer}>>` + | | + | expected integer, found `&mut _` + | + = note: expected type `{integer}` + found mutable reference `&mut _` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:46:17 + | +LL | if let Some(&Some(Some(&mut _))) = &Some(Some(&mut Some(0))) { + | ^^^^^^^^^^^^^^^^^^^ ------------------------- this expression has type `&Option<Option<&mut Option<{integer}>>>` + | | + | expected `Option<&mut Option<{integer}>>`, found `&_` + | + = note: expected enum `Option<&mut Option<{integer}>>` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:51:17 + | +LL | if let Some(&mut Some(x)) = &Some(Some(0)) { + | ^^^^^^^^^^^^ -------------- this expression has type `&Option<Option<{integer}>>` + | | + | expected `Option<{integer}>`, found `&mut _` + | + = note: expected enum `Option<{integer}>` + found mutable reference `&mut _` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:59:11 + | +LL | let &[&mut x] = &&mut [0]; + | ^^^^^^ --------- this expression has type `&&mut [{integer}; 1]` + | | + | expected integer, found `&mut _` + | + = note: expected type `{integer}` + found mutable reference `&mut _` +note: to declare a mutable binding use: `mut x` + --> $DIR/pattern-errors.rs:59:11 + | +LL | let &[&mut x] = &&mut [0]; + | ^^^^^^ +help: consider removing `&mut` from the pattern + | +LL - let &[&mut x] = &&mut [0]; +LL + let &[x] = &&mut [0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:65:9 + | +LL | let &[&mut x] = &mut &mut [0]; + | ^^^^^^^^^ ------------- this expression has type `&mut &mut [{integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut &mut [{integer}; 1]` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:71:11 + | +LL | let &[&mut ref x] = &&mut [0]; + | ^^^^^^^^^^ --------- this expression has type `&&mut [{integer}; 1]` + | | + | expected integer, found `&mut _` + | + = note: expected type `{integer}` + found mutable reference `&mut _` +note: to declare a mutable binding use: `mut x` + --> $DIR/pattern-errors.rs:71:11 + | +LL | let &[&mut ref x] = &&mut [0]; + | ^^^^^^^^^^ +help: consider removing `&mut` from the pattern + | +LL - let &[&mut ref x] = &&mut [0]; +LL + let &[ref x] = &&mut [0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:77:9 + | +LL | let &[&mut ref x] = &mut &mut [0]; + | ^^^^^^^^^^^^^ ------------- this expression has type `&mut &mut [{integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut &mut [{integer}; 1]` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:83:11 + | +LL | let &[&mut mut x] = &&mut [0]; + | ^^^^^^^^^^ --------- this expression has type `&&mut [{integer}; 1]` + | | + | expected integer, found `&mut _` + | + = note: expected type `{integer}` + found mutable reference `&mut _` +note: to declare a mutable binding use: `mut x` + --> $DIR/pattern-errors.rs:83:11 + | +LL | let &[&mut mut x] = &&mut [0]; + | ^^^^^^^^^^ +help: consider removing `&mut` from the pattern + | +LL - let &[&mut mut x] = &&mut [0]; +LL + let &[mut x] = &&mut [0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:89:9 + | +LL | let &[&mut mut x] = &mut &mut [0]; + | ^^^^^^^^^^^^^ ------------- this expression has type `&mut &mut [{integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut &mut [{integer}; 1]` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:109:10 + | +LL | let [&&mut x] = &[&mut 0]; + | ^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut {integer}` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:115:10 + | +LL | let [&&mut x] = &mut [&mut 0]; + | ^^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut {integer}` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:121:10 + | +LL | let [&&mut ref x] = &[&mut 0]; + | ^^^^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut {integer}` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:127:10 + | +LL | let [&&mut ref x] = &mut [&mut 0]; + | ^^^^^^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut {integer}` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:133:10 + | +LL | let [&&mut mut x] = &[&mut 0]; + | ^^^^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut {integer}` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:139:10 + | +LL | let [&&mut mut x] = &mut [&mut 0]; + | ^^^^^^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut {integer}` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:153:15 + | +LL | let [&mut &x] = &[&mut 0]; + | ^^ --------- this expression has type `&[&mut {integer}; 1]` + | | + | expected integer, found `&_` + | + = note: expected type `{integer}` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - let [&mut &x] = &[&mut 0]; +LL + let [&mut x] = &[&mut 0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:159:15 + | +LL | let [&mut &ref x] = &[&mut 0]; + | ^^^^^^ --------- this expression has type `&[&mut {integer}; 1]` + | | + | expected integer, found `&_` + | + = note: expected type `{integer}` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - let [&mut &ref x] = &[&mut 0]; +LL + let [&mut ref x] = &[&mut 0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:165:15 + | +LL | let [&mut &(mut x)] = &[&mut 0]; + | ^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]` + | | + | expected integer, found `&_` + | + = note: expected type `{integer}` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - let [&mut &(mut x)] = &[&mut 0]; +LL + let [&mut mut x)] = &[&mut 0]; + | + +error: aborting due to 21 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.structural.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.structural.stderr deleted file mode 100644 index 59d65553fae..00000000000 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.structural.stderr +++ /dev/null @@ -1,89 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:10:17 - | -LL | if let Some(&mut x) = &mut Some(&0) { - | ^^^^^^ ------------- this expression has type `&mut Option<&{integer}>` - | | - | types differ in mutability - | - = note: expected reference `&{integer}` - found mutable reference `&mut _` -note: to declare a mutable binding use: `mut x` - --> $DIR/pattern-errors.rs:10:17 - | -LL | if let Some(&mut x) = &mut Some(&0) { - | ^^^^^^ -help: consider removing `&mut` from the pattern - | -LL | if let Some(x) = &mut Some(&0) { - | ~ - -error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:28:17 - | -LL | if let Some(&mut Some(&_)) = &Some(&Some(0)) { - | ^^^^^^^^^^^^^ --------------- this expression has type `&Option<&Option<{integer}>>` - | | - | types differ in mutability - | - = note: expected reference `&Option<{integer}>` - found mutable reference `&mut _` - -error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:31:23 - | -LL | if let Some(&Some(&mut _)) = &Some(&mut Some(0)) { - | ^^^^^^ ------------------- this expression has type `&Option<&mut Option<{integer}>>` - | | - | expected integer, found `&mut _` - | - = note: expected type `{integer}` - found mutable reference `&mut _` - -error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:34:23 - | -LL | if let Some(&Some(&mut _)) = &mut Some(&Some(0)) { - | ^^^^^^ ------------------- this expression has type `&mut Option<&Option<{integer}>>` - | | - | expected integer, found `&mut _` - | - = note: expected type `{integer}` - found mutable reference `&mut _` - -error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:37:29 - | -LL | if let Some(&Some(Some((&mut _)))) = &Some(Some(&mut Some(0))) { - | ^^^^^^ ------------------------- this expression has type `&Option<Option<&mut Option<{integer}>>>` - | | - | expected integer, found `&mut _` - | - = note: expected type `{integer}` - found mutable reference `&mut _` - -error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:40:17 - | -LL | if let Some(&mut Some(x)) = &Some(Some(0)) { - | ^^^^^^^^^^^^ -------------- this expression has type `&Option<Option<{integer}>>` - | | - | expected `Option<{integer}>`, found `&mut _` - | - = note: expected enum `Option<{integer}>` - found mutable reference `&mut _` - -error[E0308]: mismatched types - --> $DIR/pattern-errors.rs:43:17 - | -LL | if let Some(&mut Some(x)) = &Some(Some(0)) { - | ^^^^^^^^^^^^ -------------- this expression has type `&Option<Option<{integer}>>` - | | - | expected `Option<{integer}>`, found `&mut _` - | - = note: expected enum `Option<{integer}>` - found mutable reference `&mut _` - -error: aborting due to 7 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.structural2024.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.structural2024.stderr new file mode 100644 index 00000000000..fdf48a5a71b --- /dev/null +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.structural2024.stderr @@ -0,0 +1,245 @@ +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:31:17 + | +LL | if let Some(&mut Some(&_)) = &Some(&Some(0)) { + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - if let Some(&mut Some(&_)) = &Some(&Some(0)) { +LL + if let Some(&Some(&_)) = &Some(&Some(0)) { + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:36:23 + | +LL | if let Some(&Some(&mut _)) = &Some(&mut Some(0)) { + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - if let Some(&Some(&mut _)) = &Some(&mut Some(0)) { +LL + if let Some(&Some(&_)) = &Some(&mut Some(0)) { + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:41:23 + | +LL | if let Some(&Some(&mut _)) = &mut Some(&Some(0)) { + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - if let Some(&Some(&mut _)) = &mut Some(&Some(0)) { +LL + if let Some(&Some(&_)) = &mut Some(&Some(0)) { + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:46:28 + | +LL | if let Some(&Some(Some(&mut _))) = &Some(Some(&mut Some(0))) { + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - if let Some(&Some(Some(&mut _))) = &Some(Some(&mut Some(0))) { +LL + if let Some(&Some(Some(&_))) = &Some(Some(&mut Some(0))) { + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:51:17 + | +LL | if let Some(&mut Some(x)) = &Some(Some(0)) { + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - if let Some(&mut Some(x)) = &Some(Some(0)) { +LL + if let Some(&Some(x)) = &Some(Some(0)) { + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:59:11 + | +LL | let &[&mut x] = &&mut [0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let &[&mut x] = &&mut [0]; +LL + let &[&x] = &&mut [0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:65:11 + | +LL | let &[&mut x] = &mut &mut [0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let &[&mut x] = &mut &mut [0]; +LL + let &[&x] = &mut &mut [0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:71:11 + | +LL | let &[&mut ref x] = &&mut [0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let &[&mut ref x] = &&mut [0]; +LL + let &[&ref x] = &&mut [0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:77:11 + | +LL | let &[&mut ref x] = &mut &mut [0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let &[&mut ref x] = &mut &mut [0]; +LL + let &[&ref x] = &mut &mut [0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:83:11 + | +LL | let &[&mut mut x] = &&mut [0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let &[&mut mut x] = &&mut [0]; +LL + let &[&mut x] = &&mut [0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:89:11 + | +LL | let &[&mut mut x] = &mut &mut [0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let &[&mut mut x] = &mut &mut [0]; +LL + let &[&mut x] = &mut &mut [0]; + | + +error[E0658]: binding cannot be both mutable and by-reference + --> $DIR/pattern-errors.rs:97:12 + | +LL | let [&(mut x)] = &[&0]; + | ^^^^ + | + = note: see issue #123076 <https://github.com/rust-lang/rust/issues/123076> for more information + = help: add `#![feature(mut_ref)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: binding cannot be both mutable and by-reference + --> $DIR/pattern-errors.rs:102:12 + | +LL | let [&(mut x)] = &mut [&0]; + | ^^^^ + | + = note: see issue #123076 <https://github.com/rust-lang/rust/issues/123076> for more information + = help: add `#![feature(mut_ref)]` 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[E0308]: mismatched types + --> $DIR/pattern-errors.rs:109:11 + | +LL | let [&&mut x] = &[&mut 0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let [&&mut x] = &[&mut 0]; +LL + let [&&x] = &[&mut 0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:115:11 + | +LL | let [&&mut x] = &mut [&mut 0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let [&&mut x] = &mut [&mut 0]; +LL + let [&&x] = &mut [&mut 0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:121:11 + | +LL | let [&&mut ref x] = &[&mut 0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let [&&mut ref x] = &[&mut 0]; +LL + let [&&ref x] = &[&mut 0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:127:11 + | +LL | let [&&mut ref x] = &mut [&mut 0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let [&&mut ref x] = &mut [&mut 0]; +LL + let [&&ref x] = &mut [&mut 0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:133:11 + | +LL | let [&&mut mut x] = &[&mut 0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let [&&mut mut x] = &[&mut 0]; +LL + let [&&mut x] = &[&mut 0]; + | + +error[E0308]: mismatched types + --> $DIR/pattern-errors.rs:139:11 + | +LL | let [&&mut mut x] = &mut [&mut 0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let [&&mut mut x] = &mut [&mut 0]; +LL + let [&&mut x] = &mut [&mut 0]; + | + +error: aborting due to 19 previous errors + +Some errors have detailed explanations: E0308, E0658. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr new file mode 100644 index 00000000000..56125be2d6f --- /dev/null +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr @@ -0,0 +1,91 @@ +error[E0308]: mismatched types + --> $DIR/ref-binding-on-inh-ref-errors.rs:54:10 + | +LL | let [&mut ref x] = &[&mut 0]; + | ^^^^^ + | + = note: cannot match inherited `&` with `&mut` pattern +help: replace this `&mut` pattern with `&` + | +LL - let [&mut ref x] = &[&mut 0]; +LL + let [&ref x] = &[&mut 0]; + | + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:67:10 + | +LL | let [ref mut x] = &[0]; + | ^^^^^^^ binding modifier not allowed under `ref` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:67:9 + | +LL | let [ref mut x] = &[0]; + | ^^^^^^^^^^^ this matches on type `&_` +help: make the implied reference pattern explicit + | +LL | let &[ref mut x] = &[0]; + | + + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/ref-binding-on-inh-ref-errors.rs:67:10 + | +LL | let [ref mut x] = &[0]; + | ^^^^^^^^^ cannot borrow as mutable + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:75:10 + | +LL | let [ref x] = &[0]; + | ^^^ binding modifier not allowed under `ref` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:75:9 + | +LL | let [ref x] = &[0]; + | ^^^^^^^ this matches on type `&_` +help: make the implied reference pattern explicit + | +LL | let &[ref x] = &[0]; + | + + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:79:10 + | +LL | let [ref x] = &mut [0]; + | ^^^ binding modifier not allowed under `ref mut` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:79:9 + | +LL | let [ref x] = &mut [0]; + | ^^^^^^^ this matches on type `&mut _` +help: make the implied reference pattern explicit + | +LL | let &mut [ref x] = &mut [0]; + | ++++ + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:83:10 + | +LL | let [ref mut x] = &mut [0]; + | ^^^^^^^ binding modifier not allowed under `ref mut` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:83:9 + | +LL | let [ref mut x] = &mut [0]; + | ^^^^^^^^^^^ this matches on type `&mut _` +help: make the implied reference pattern explicit + | +LL | let &mut [ref mut x] = &mut [0]; + | ++++ + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0308, E0596. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.rs new file mode 100644 index 00000000000..4e048570c33 --- /dev/null +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.rs @@ -0,0 +1,86 @@ +//@ revisions: stable2021 classic2024 structural2024 +//@[stable2021] edition: 2021 +//@[classic2024] edition: 2024 +//@[structural2024] edition: 2024 +//! Tests for errors from binding with `ref x` under a by-ref default binding mode in edition 2024. +//! These can't be in the same body as tests for other errors, since they're emitted during THIR +//! construction. The errors on stable edition 2021 Rust are unrelated. +#![allow(incomplete_features)] +#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))] +#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))] + +/// These only fail on the eat-inner variant of the new edition 2024 pattern typing rules. +/// The eat-outer variant eats the inherited reference, so binding with `ref` isn't a problem. +fn errors_from_eating_the_real_reference() { + let [&ref x] = &[&0]; + //[structural2024]~^ ERROR: binding modifiers may only be written when the default binding mode is `move` + #[cfg(stable2021)] let _: &u32 = x; + #[cfg(classic2024)] let _: &&u32 = x; + + let [&ref x] = &mut [&0]; + //[structural2024]~^ ERROR: binding modifiers may only be written when the default binding mode is `move` + #[cfg(stable2021)] let _: &u32 = x; + #[cfg(classic2024)] let _: &&u32 = x; + + let [&mut ref x] = &mut [&mut 0]; + //[structural2024]~^ ERROR: binding modifiers may only be written when the default binding mode is `move` + #[cfg(stable2021)] let _: &u32 = x; + #[cfg(classic2024)] let _: &&mut u32 = x; + + let [&mut ref mut x] = &mut [&mut 0]; + //[structural2024]~^ ERROR: binding modifiers may only be written when the default binding mode is `move` + #[cfg(stable2021)] let _: &mut u32 = x; + #[cfg(classic2024)] let _: &mut &mut u32 = x; +} + +/// To make absolutely sure binding with `ref` ignores inherited references on stable, let's +/// quarantine these typeck errors (from using a `&` pattern to match a `&mut` reference type). +fn errors_from_eating_the_real_reference_caught_in_hir_typeck_on_stable() { + let [&ref x] = &[&mut 0]; + //[stable2021]~^ ERROR: mismatched types + //[stable2021]~| types differ in mutability + //[structural2024]~^^^ ERROR: binding modifiers may only be written when the default binding mode is `move` + #[cfg(classic2024)] let _: &&mut u32 = x; + + let [&ref x] = &mut [&mut 0]; + //[stable2021]~^ ERROR: mismatched types + //[stable2021]~| types differ in mutability + //[structural2024]~^^^ ERROR: binding modifiers may only be written when the default binding mode is `move` + #[cfg(classic2024)] let _: &&mut u32 = x; +} + +/// This one also needs to be quarantined for a typeck error on `classic2024` (eat-outer). +fn errors_dependent_on_eating_order_caught_in_hir_typeck_when_eating_outer() { + let [&mut ref x] = &[&mut 0]; + //[classic2024]~^ ERROR: mismatched types + //[classic2024]~| cannot match inherited `&` with `&mut` pattern + //[structural2024]~^^^ ERROR: binding modifiers may only be written when the default binding mode is `move` + #[cfg(stable2021)] let _: &u32 = x; +} + +/// These should be errors in all editions. In edition 2024, they should be caught by the pattern +/// typing rules disallowing `ref` when there's an inherited reference. In old editions where that +/// resets the binding mode, they're borrowck errors due to binding with `ref mut`. +/// As a quirk of how the edition 2024 error is emitted during THIR construction, it ends up going +/// through borrowck as well, using the old `ref` behavior as a fallback, so we get that error too. +fn borrowck_errors_in_old_editions() { + let [ref mut x] = &[0]; + //~^ ERROR: cannot borrow data in a `&` reference as mutable + //[classic2024,structural2024]~| ERROR: binding modifiers may only be written when the default binding mode is `move` +} + +/// The remaining tests are purely for testing `ref` bindings in the presence of an inherited +/// reference. These should always fail on edition 2024 and succeed on edition 2021. +pub fn main() { + let [ref x] = &[0]; + //[classic2024,structural2024]~^ ERROR: binding modifiers may only be written when the default binding mode is `move` + #[cfg(stable2021)] let _: &u32 = x; + + let [ref x] = &mut [0]; + //[classic2024,structural2024]~^ ERROR: binding modifiers may only be written when the default binding mode is `move` + #[cfg(stable2021)] let _: &u32 = x; + + let [ref mut x] = &mut [0]; + //[classic2024,structural2024]~^ ERROR: binding modifiers may only be written when the default binding mode is `move` + #[cfg(stable2021)] let _: &mut u32 = x; +} diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.stable2021.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.stable2021.stderr new file mode 100644 index 00000000000..26095d84605 --- /dev/null +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.stable2021.stderr @@ -0,0 +1,42 @@ +error[E0308]: mismatched types + --> $DIR/ref-binding-on-inh-ref-errors.rs:39:10 + | +LL | let [&ref x] = &[&mut 0]; + | ^^^^^^ --------- this expression has type `&[&mut {integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut {integer}` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - let [&ref x] = &[&mut 0]; +LL + let [ref x] = &[&mut 0]; + | + +error[E0308]: mismatched types + --> $DIR/ref-binding-on-inh-ref-errors.rs:45:10 + | +LL | let [&ref x] = &mut [&mut 0]; + | ^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut {integer}` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - let [&ref x] = &mut [&mut 0]; +LL + let [ref x] = &mut [&mut 0]; + | + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/ref-binding-on-inh-ref-errors.rs:67:10 + | +LL | let [ref mut x] = &[0]; + | ^^^^^^^^^ cannot borrow as mutable + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0308, E0596. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.structural2024.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.structural2024.stderr new file mode 100644 index 00000000000..31930e8c033 --- /dev/null +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.structural2024.stderr @@ -0,0 +1,196 @@ +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:15:11 + | +LL | let [&ref x] = &[&0]; + | ^^^ binding modifier not allowed under `ref` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:15:9 + | +LL | let [&ref x] = &[&0]; + | ^^^^^^^^ this matches on type `&_` +help: make the implied reference pattern explicit + | +LL | let &[&ref x] = &[&0]; + | + + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:20:11 + | +LL | let [&ref x] = &mut [&0]; + | ^^^ binding modifier not allowed under `ref` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:20:9 + | +LL | let [&ref x] = &mut [&0]; + | ^^^^^^^^ this matches on type `&mut _` +help: make the implied reference pattern explicit + | +LL | let &mut [&ref x] = &mut [&0]; + | ++++ + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:25:15 + | +LL | let [&mut ref x] = &mut [&mut 0]; + | ^^^ binding modifier not allowed under `ref mut` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:25:9 + | +LL | let [&mut ref x] = &mut [&mut 0]; + | ^^^^^^^^^^^^ this matches on type `&mut _` +help: make the implied reference pattern explicit + | +LL | let &mut [&mut ref x] = &mut [&mut 0]; + | ++++ + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:30:15 + | +LL | let [&mut ref mut x] = &mut [&mut 0]; + | ^^^^^^^ binding modifier not allowed under `ref mut` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:30:9 + | +LL | let [&mut ref mut x] = &mut [&mut 0]; + | ^^^^^^^^^^^^^^^^ this matches on type `&mut _` +help: make the implied reference pattern explicit + | +LL | let &mut [&mut ref mut x] = &mut [&mut 0]; + | ++++ + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:39:11 + | +LL | let [&ref x] = &[&mut 0]; + | ^^^ binding modifier not allowed under `ref` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:39:9 + | +LL | let [&ref x] = &[&mut 0]; + | ^^^^^^^^ this matches on type `&_` +help: make the implied reference pattern explicit + | +LL | let &[&ref x] = &[&mut 0]; + | + + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:45:11 + | +LL | let [&ref x] = &mut [&mut 0]; + | ^^^ binding modifier not allowed under `ref` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:45:9 + | +LL | let [&ref x] = &mut [&mut 0]; + | ^^^^^^^^ this matches on type `&mut _` +help: make the implied reference pattern explicit + | +LL | let &mut [&ref x] = &mut [&mut 0]; + | ++++ + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:54:15 + | +LL | let [&mut ref x] = &[&mut 0]; + | ^^^ binding modifier not allowed under `ref` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:54:9 + | +LL | let [&mut ref x] = &[&mut 0]; + | ^^^^^^^^^^^^ this matches on type `&_` +help: make the implied reference pattern explicit + | +LL | let &[&mut ref x] = &[&mut 0]; + | + + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:67:10 + | +LL | let [ref mut x] = &[0]; + | ^^^^^^^ binding modifier not allowed under `ref` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:67:9 + | +LL | let [ref mut x] = &[0]; + | ^^^^^^^^^^^ this matches on type `&_` +help: make the implied reference pattern explicit + | +LL | let &[ref mut x] = &[0]; + | + + +error[E0596]: cannot borrow data in a `&` reference as mutable + --> $DIR/ref-binding-on-inh-ref-errors.rs:67:10 + | +LL | let [ref mut x] = &[0]; + | ^^^^^^^^^ cannot borrow as mutable + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:75:10 + | +LL | let [ref x] = &[0]; + | ^^^ binding modifier not allowed under `ref` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:75:9 + | +LL | let [ref x] = &[0]; + | ^^^^^^^ this matches on type `&_` +help: make the implied reference pattern explicit + | +LL | let &[ref x] = &[0]; + | + + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:79:10 + | +LL | let [ref x] = &mut [0]; + | ^^^ binding modifier not allowed under `ref mut` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:79:9 + | +LL | let [ref x] = &mut [0]; + | ^^^^^^^ this matches on type `&mut _` +help: make the implied reference pattern explicit + | +LL | let &mut [ref x] = &mut [0]; + | ++++ + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/ref-binding-on-inh-ref-errors.rs:83:10 + | +LL | let [ref mut x] = &mut [0]; + | ^^^^^^^ binding modifier not allowed under `ref mut` default binding mode + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/ref-binding-on-inh-ref-errors.rs:83:9 + | +LL | let [ref mut x] = &mut [0]; + | ^^^^^^^^^^^ this matches on type `&mut _` +help: make the implied reference pattern explicit + | +LL | let &mut [ref mut x] = &mut [0]; + | ++++ + +error: aborting due to 12 previous errors + +For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.classic.fixed b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.classic.fixed deleted file mode 100644 index 4f4941975d8..00000000000 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.classic.fixed +++ /dev/null @@ -1,33 +0,0 @@ -//@ edition: 2024 -//@ run-rustfix -//@ revisions: classic structural -//! Tests for `&` patterns matched against `&mut` reference types where the inner pattern attempts -//! to bind by mutable reference. -#![allow(incomplete_features)] -#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))] -#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))] - -pub fn main() { - if let Some(&mut Some(ref mut x)) = &mut Some(Some(0)) { - //~^ ERROR: cannot borrow as mutable inside an `&` pattern - let _: &mut u8 = x; - } - - if let &mut Some(Some(ref mut x)) = &mut Some(Some(0)) { - //~^ ERROR: cannot borrow as mutable inside an `&` pattern - let _: &mut u8 = x; - } - - macro_rules! pat { - ($var:ident) => { ref mut $var }; - } - let &mut pat!(x) = &mut 0; - //~^ ERROR: cannot borrow as mutable inside an `&` pattern - let _: &mut u8 = x; - - let &mut (ref mut a, ref mut b) = &mut (true, false); - //~^ ERROR: cannot borrow as mutable inside an `&` pattern - //~| ERROR: cannot borrow as mutable inside an `&` pattern - let _: &mut bool = a; - let _: &mut bool = b; -} diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.classic2024.fixed b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.classic2024.fixed new file mode 100644 index 00000000000..c01784d5076 --- /dev/null +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.classic2024.fixed @@ -0,0 +1,45 @@ +//@ revisions: stable2021 classic2024 structural2024 +//@[stable2021] edition: 2021 +//@[classic2024] edition: 2024 +//@[structural2024] edition: 2024 +//@[classic2024] run-rustfix +//@[structural2024] run-rustfix +//! Tests for `&` patterns matched against `&mut` reference types where the inner pattern attempts +//! to bind by mutable reference. +#![allow(incomplete_features)] +#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))] +#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))] + +pub fn main() { + if let Some(&mut Some(ref mut x)) = &mut Some(Some(0)) { + //[stable2021]~^ ERROR: mismatched types + //[classic2024,structural2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern + let _: &mut u8 = x; + } + + if let &mut Some(Some(ref mut x)) = &mut Some(Some(0)) { + //[stable2021]~^ ERROR: mismatched types + //[classic2024,structural2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern + let _: &mut u8 = x; + } + + macro_rules! pat { + ($var:ident) => { ref mut $var }; + } + let &mut pat!(x) = &mut 0; + //[stable2021]~^ ERROR: mismatched types + //[classic2024,structural2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern + let _: &mut u8 = x; + + let &mut (ref mut a, ref mut b) = &mut (true, false); + //[stable2021]~^ ERROR: mismatched types + //[classic2024,structural2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern + //[classic2024,structural2024]~| ERROR: cannot borrow as mutable inside an `&` pattern + let _: &mut bool = a; + let _: &mut bool = b; + + let &mut [x] = &mut &mut [0]; + //[stable2021]~^ ERROR: mismatched types + //[classic2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern + let _: &u32 = x; +} diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.classic.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.classic2024.stderr index 6c384a51fac..5e98b77be40 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.classic.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.classic2024.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow as mutable inside an `&` pattern - --> $DIR/ref-mut-inside-shared-ref-pat.rs:11:31 + --> $DIR/ref-mut-inside-shared-ref-pat.rs:14:31 | LL | if let Some(&Some(ref mut x)) = &mut Some(Some(0)) { | - ^ @@ -7,7 +7,7 @@ LL | if let Some(&Some(ref mut x)) = &mut Some(Some(0)) { | help: replace this `&` with `&mut`: `&mut` error[E0596]: cannot borrow as mutable inside an `&` pattern - --> $DIR/ref-mut-inside-shared-ref-pat.rs:16:31 + --> $DIR/ref-mut-inside-shared-ref-pat.rs:20:31 | LL | if let &Some(Some(ref mut x)) = &mut Some(Some(0)) { | - ^ @@ -15,7 +15,7 @@ LL | if let &Some(Some(ref mut x)) = &mut Some(Some(0)) { | help: replace this `&` with `&mut`: `&mut` error[E0596]: cannot borrow as mutable inside an `&` pattern - --> $DIR/ref-mut-inside-shared-ref-pat.rs:24:15 + --> $DIR/ref-mut-inside-shared-ref-pat.rs:29:15 | LL | let &pat!(x) = &mut 0; | - ^ @@ -23,7 +23,7 @@ LL | let &pat!(x) = &mut 0; | help: replace this `&` with `&mut`: `&mut` error[E0596]: cannot borrow as mutable inside an `&` pattern - --> $DIR/ref-mut-inside-shared-ref-pat.rs:28:19 + --> $DIR/ref-mut-inside-shared-ref-pat.rs:34:19 | LL | let &(ref mut a, ref mut b) = &mut (true, false); | - ^ @@ -31,13 +31,21 @@ LL | let &(ref mut a, ref mut b) = &mut (true, false); | help: replace this `&` with `&mut`: `&mut` error[E0596]: cannot borrow as mutable inside an `&` pattern - --> $DIR/ref-mut-inside-shared-ref-pat.rs:28:30 + --> $DIR/ref-mut-inside-shared-ref-pat.rs:34:30 | LL | let &(ref mut a, ref mut b) = &mut (true, false); | - ^ | | | help: replace this `&` with `&mut`: `&mut` -error: aborting due to 5 previous errors +error[E0596]: cannot borrow as mutable inside an `&` pattern + --> $DIR/ref-mut-inside-shared-ref-pat.rs:41:11 + | +LL | let &[x] = &mut &mut [0]; + | - ^ + | | + | help: replace this `&` with `&mut`: `&mut` + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0596`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.rs index b29bff7603f..fe40dabb553 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.rs @@ -1,20 +1,25 @@ -//@ edition: 2024 -//@ run-rustfix -//@ revisions: classic structural +//@ revisions: stable2021 classic2024 structural2024 +//@[stable2021] edition: 2021 +//@[classic2024] edition: 2024 +//@[structural2024] edition: 2024 +//@[classic2024] run-rustfix +//@[structural2024] run-rustfix //! Tests for `&` patterns matched against `&mut` reference types where the inner pattern attempts //! to bind by mutable reference. #![allow(incomplete_features)] -#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))] -#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))] +#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))] +#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))] pub fn main() { if let Some(&Some(ref mut x)) = &mut Some(Some(0)) { - //~^ ERROR: cannot borrow as mutable inside an `&` pattern + //[stable2021]~^ ERROR: mismatched types + //[classic2024,structural2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern let _: &mut u8 = x; } if let &Some(Some(ref mut x)) = &mut Some(Some(0)) { - //~^ ERROR: cannot borrow as mutable inside an `&` pattern + //[stable2021]~^ ERROR: mismatched types + //[classic2024,structural2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern let _: &mut u8 = x; } @@ -22,12 +27,19 @@ pub fn main() { ($var:ident) => { ref mut $var }; } let &pat!(x) = &mut 0; - //~^ ERROR: cannot borrow as mutable inside an `&` pattern + //[stable2021]~^ ERROR: mismatched types + //[classic2024,structural2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern let _: &mut u8 = x; let &(ref mut a, ref mut b) = &mut (true, false); - //~^ ERROR: cannot borrow as mutable inside an `&` pattern - //~| ERROR: cannot borrow as mutable inside an `&` pattern + //[stable2021]~^ ERROR: mismatched types + //[classic2024,structural2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern + //[classic2024,structural2024]~| ERROR: cannot borrow as mutable inside an `&` pattern let _: &mut bool = a; let _: &mut bool = b; + + let &[x] = &mut &mut [0]; + //[stable2021]~^ ERROR: mismatched types + //[classic2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern + let _: &u32 = x; } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.stable2021.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.stable2021.stderr new file mode 100644 index 00000000000..72c6c05e184 --- /dev/null +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.stable2021.stderr @@ -0,0 +1,58 @@ +error[E0308]: mismatched types + --> $DIR/ref-mut-inside-shared-ref-pat.rs:14:17 + | +LL | if let Some(&Some(ref mut x)) = &mut Some(Some(0)) { + | ^^^^^^^^^^^^^^^^ ------------------ this expression has type `&mut Option<Option<{integer}>>` + | | + | expected `Option<{integer}>`, found `&_` + | + = note: expected enum `Option<{integer}>` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/ref-mut-inside-shared-ref-pat.rs:20:12 + | +LL | if let &Some(Some(ref mut x)) = &mut Some(Some(0)) { + | ^^^^^^^^^^^^^^^^^^^^^^ ------------------ this expression has type `&mut Option<Option<{integer}>>` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut Option<Option<{integer}>>` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/ref-mut-inside-shared-ref-pat.rs:29:9 + | +LL | let &pat!(x) = &mut 0; + | ^^^^^^^^ ------ this expression has type `&mut {integer}` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut {integer}` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/ref-mut-inside-shared-ref-pat.rs:34:9 + | +LL | let &(ref mut a, ref mut b) = &mut (true, false); + | ^^^^^^^^^^^^^^^^^^^^^^^ ------------------ this expression has type `&mut (bool, bool)` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut (bool, bool)` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/ref-mut-inside-shared-ref-pat.rs:41:9 + | +LL | let &[x] = &mut &mut [0]; + | ^^^^ ------------- this expression has type `&mut &mut [{integer}; 1]` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut &mut [{integer}; 1]` + found reference `&_` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.structural.fixed b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.structural.fixed deleted file mode 100644 index 4f4941975d8..00000000000 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.structural.fixed +++ /dev/null @@ -1,33 +0,0 @@ -//@ edition: 2024 -//@ run-rustfix -//@ revisions: classic structural -//! Tests for `&` patterns matched against `&mut` reference types where the inner pattern attempts -//! to bind by mutable reference. -#![allow(incomplete_features)] -#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))] -#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))] - -pub fn main() { - if let Some(&mut Some(ref mut x)) = &mut Some(Some(0)) { - //~^ ERROR: cannot borrow as mutable inside an `&` pattern - let _: &mut u8 = x; - } - - if let &mut Some(Some(ref mut x)) = &mut Some(Some(0)) { - //~^ ERROR: cannot borrow as mutable inside an `&` pattern - let _: &mut u8 = x; - } - - macro_rules! pat { - ($var:ident) => { ref mut $var }; - } - let &mut pat!(x) = &mut 0; - //~^ ERROR: cannot borrow as mutable inside an `&` pattern - let _: &mut u8 = x; - - let &mut (ref mut a, ref mut b) = &mut (true, false); - //~^ ERROR: cannot borrow as mutable inside an `&` pattern - //~| ERROR: cannot borrow as mutable inside an `&` pattern - let _: &mut bool = a; - let _: &mut bool = b; -} diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.structural2024.fixed b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.structural2024.fixed new file mode 100644 index 00000000000..4ee849b38c5 --- /dev/null +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.structural2024.fixed @@ -0,0 +1,45 @@ +//@ revisions: stable2021 classic2024 structural2024 +//@[stable2021] edition: 2021 +//@[classic2024] edition: 2024 +//@[structural2024] edition: 2024 +//@[classic2024] run-rustfix +//@[structural2024] run-rustfix +//! Tests for `&` patterns matched against `&mut` reference types where the inner pattern attempts +//! to bind by mutable reference. +#![allow(incomplete_features)] +#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))] +#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))] + +pub fn main() { + if let Some(&mut Some(ref mut x)) = &mut Some(Some(0)) { + //[stable2021]~^ ERROR: mismatched types + //[classic2024,structural2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern + let _: &mut u8 = x; + } + + if let &mut Some(Some(ref mut x)) = &mut Some(Some(0)) { + //[stable2021]~^ ERROR: mismatched types + //[classic2024,structural2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern + let _: &mut u8 = x; + } + + macro_rules! pat { + ($var:ident) => { ref mut $var }; + } + let &mut pat!(x) = &mut 0; + //[stable2021]~^ ERROR: mismatched types + //[classic2024,structural2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern + let _: &mut u8 = x; + + let &mut (ref mut a, ref mut b) = &mut (true, false); + //[stable2021]~^ ERROR: mismatched types + //[classic2024,structural2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern + //[classic2024,structural2024]~| ERROR: cannot borrow as mutable inside an `&` pattern + let _: &mut bool = a; + let _: &mut bool = b; + + let &[x] = &mut &mut [0]; + //[stable2021]~^ ERROR: mismatched types + //[classic2024]~^^ ERROR: cannot borrow as mutable inside an `&` pattern + let _: &u32 = x; +} diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.structural.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.structural2024.stderr index 6c384a51fac..69cb6c438b6 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.structural.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-mut-inside-shared-ref-pat.structural2024.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow as mutable inside an `&` pattern - --> $DIR/ref-mut-inside-shared-ref-pat.rs:11:31 + --> $DIR/ref-mut-inside-shared-ref-pat.rs:14:31 | LL | if let Some(&Some(ref mut x)) = &mut Some(Some(0)) { | - ^ @@ -7,7 +7,7 @@ LL | if let Some(&Some(ref mut x)) = &mut Some(Some(0)) { | help: replace this `&` with `&mut`: `&mut` error[E0596]: cannot borrow as mutable inside an `&` pattern - --> $DIR/ref-mut-inside-shared-ref-pat.rs:16:31 + --> $DIR/ref-mut-inside-shared-ref-pat.rs:20:31 | LL | if let &Some(Some(ref mut x)) = &mut Some(Some(0)) { | - ^ @@ -15,7 +15,7 @@ LL | if let &Some(Some(ref mut x)) = &mut Some(Some(0)) { | help: replace this `&` with `&mut`: `&mut` error[E0596]: cannot borrow as mutable inside an `&` pattern - --> $DIR/ref-mut-inside-shared-ref-pat.rs:24:15 + --> $DIR/ref-mut-inside-shared-ref-pat.rs:29:15 | LL | let &pat!(x) = &mut 0; | - ^ @@ -23,7 +23,7 @@ LL | let &pat!(x) = &mut 0; | help: replace this `&` with `&mut`: `&mut` error[E0596]: cannot borrow as mutable inside an `&` pattern - --> $DIR/ref-mut-inside-shared-ref-pat.rs:28:19 + --> $DIR/ref-mut-inside-shared-ref-pat.rs:34:19 | LL | let &(ref mut a, ref mut b) = &mut (true, false); | - ^ @@ -31,7 +31,7 @@ LL | let &(ref mut a, ref mut b) = &mut (true, false); | help: replace this `&` with `&mut`: `&mut` error[E0596]: cannot borrow as mutable inside an `&` pattern - --> $DIR/ref-mut-inside-shared-ref-pat.rs:28:30 + --> $DIR/ref-mut-inside-shared-ref-pat.rs:34:30 | LL | let &(ref mut a, ref mut b) = &mut (true, false); | - ^ diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref_pat_eat_one_layer_2021.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref_pat_eat_one_layer_2021.rs index 9372049a2b2..ab3264704ac 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref_pat_eat_one_layer_2021.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref_pat_eat_one_layer_2021.rs @@ -6,9 +6,11 @@ #![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))] pub fn main() { + #[cfg(structural)] if let &Some(Some(x)) = &Some(&mut Some(0)) { let _: &u32 = x; } + if let Some(&x) = Some(&mut 0) { let _: u32 = x; } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref_pat_eat_one_layer_2021_fail.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref_pat_eat_one_layer_2021_fail.stderr index 1a921234ea0..0158ed0f423 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref_pat_eat_one_layer_2021_fail.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref_pat_eat_one_layer_2021_fail.stderr @@ -10,8 +10,9 @@ LL | if let Some(Some(&x)) = &Some(&Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(Some(x)) = &Some(&Some(0)) { - | ~ +LL - if let Some(Some(&x)) = &Some(&Some(0)) { +LL + if let Some(Some(x)) = &Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/ref_pat_eat_one_layer_2021_fail.rs:10:23 @@ -70,8 +71,9 @@ LL | if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { | ^^^^^^ help: consider removing `&mut` from the pattern | -LL | if let Some(Some(x)) = &mut Some(&mut Some(0)) { - | ~ +LL - if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { +LL + if let Some(Some(x)) = &mut Some(&mut Some(0)) { + | error[E0308]: mismatched types --> $DIR/ref_pat_eat_one_layer_2021_fail.rs:25:22 @@ -85,8 +87,9 @@ LL | if let Some(Some(&x)) = &Some(&Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(Some(x)) = &Some(&Some(0)) { - | ~ +LL - if let Some(Some(&x)) = &Some(&Some(0)) { +LL + if let Some(Some(x)) = &Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/ref_pat_eat_one_layer_2021_fail.rs:29:27 @@ -100,8 +103,9 @@ LL | if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(&mut Some(x)) = &Some(&mut Some(0)) { - | ~ +LL - if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { +LL + if let Some(&mut Some(x)) = &Some(&mut Some(0)) { + | error[E0308]: mismatched types --> $DIR/ref_pat_eat_one_layer_2021_fail.rs:33:23 @@ -120,8 +124,9 @@ LL | if let Some(&Some(&mut x)) = &mut Some(&Some(0)) { | ^^^^^^ help: consider removing `&mut` from the pattern | -LL | if let Some(&Some(x)) = &mut Some(&Some(0)) { - | ~ +LL - if let Some(&Some(&mut x)) = &mut Some(&Some(0)) { +LL + if let Some(&Some(x)) = &mut Some(&Some(0)) { + | error: aborting due to 8 previous errors diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs index 077b52d8f27..3114b9d3bf8 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs @@ -1,59 +1,127 @@ -//@ edition: 2024 -//@ revisions: classic structural -//@ run-pass +//@ revisions: stable2021 classic2024 structural2024 +//@[stable2021] edition: 2021 +//@[classic2024] edition: 2024 +//@[structural2024] edition: 2024 +//@[classic2024] run-pass +//@[structural2024] run-pass //! Test cases for well-typed patterns in edition 2024. These are in their own file to ensure we //! pass both HIR typeck and MIR borrowck, as we may skip the latter if grouped with failing tests. -#![allow(incomplete_features)] -#![cfg_attr(classic, feature(ref_pat_eat_one_layer_2024))] -#![cfg_attr(structural, feature(ref_pat_eat_one_layer_2024_structural))] +#![allow(incomplete_features, unused_mut)] +#![cfg_attr(classic2024, feature(ref_pat_eat_one_layer_2024))] +#![cfg_attr(structural2024, feature(ref_pat_eat_one_layer_2024_structural))] pub fn main() { - if let Some(Some(&x)) = &Some(&Some(0)) { - let _: u32 = x; - } - if let Some(Some(&x)) = &Some(Some(&0)) { + // Tests not using match ergonomics. These should always succeed with the same bindings. + if let Some(&Some(&mut ref x)) = Some(&Some(&mut 0)) { let _: &u32 = x; } - if let Some(Some(&&x)) = &Some(Some(&0)) { - let _: u32 = x; + + // Tests for differences in how many layers of reference are eaten by reference patterns + if let Some(Some(&x)) = &Some(Some(&0)) { + #[cfg(stable2021)] let _: u32 = x; + #[cfg(any(classic2024, structural2024))] let _: &u32 = x; } - if let Some(&Some(x)) = &Some(Some(0)) { - let _: u32 = x; + if let Some(&Some(x)) = &mut Some(&Some(0)) { + // This additionally tests that `&` patterns can eat inherited `&mut` refs. + // This is possible on stable when the real reference being eaten is of a `&` type. + #[cfg(stable2021)] let _: u32 = x; + #[cfg(any(classic2024, structural2024))] let _: &u32 = x; } - if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { + if let Some(Some(&&x)) = &Some(Some(&0)) { + //[stable2021]~^ mismatched types + //[stable2021]~| expected integer, found `&_` let _: u32 = x; } + + // Tests for eating a lone inherited reference if let Some(Some(&x)) = &Some(&Some(0)) { + //[stable2021]~^ mismatched types + //[stable2021]~| expected integer, found `&_` let _: u32 = x; } - if let Some(&Some(&x)) = &mut Some(&Some(0)) { + if let Some(&Some(x)) = &Some(Some(0)) { + //[stable2021]~^ mismatched types + //[stable2021]~| expected `Option<{integer}>`, found `&_` let _: u32 = x; } - if let Some(&Some(x)) = &mut Some(&Some(0)) { - let _: &u32 = x; - } - if let Some(&Some(&mut ref x)) = Some(&Some(&mut 0)) { - let _: &u32 = x; - } - if let &Some(Some(x)) = &Some(&mut Some(0)) { - let _: &u32 = x; + if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { + //[stable2021]~^ mismatched types + //[stable2021]~| expected integer, found `&mut _` + let _: u32 = x; } - if let Some(&Some(&x)) = &Some(&mut Some(0)) { + + // Tests for `&` patterns matching real `&mut` reference types + if let Some(&Some(&x)) = Some(&Some(&mut 0)) { + //[stable2021]~^ mismatched types + //[stable2021]~| types differ in mutability let _: u32 = x; } + + // Tests for eating only one layer and also eating a lone inherited reference if let Some(&Some(&x)) = &Some(&Some(0)) { + //[stable2021]~^ mismatched types + //[stable2021]~| expected integer, found `&_` let _: u32 = x; } - if let Some(&Some(&x)) = &Some(&mut Some(0)) { + + // Tests for `&` matching a lone inherited possibly-`&mut` reference + if let Some(&Some(Some(&x))) = &Some(Some(&mut Some(0))) { + //[stable2021]~^ mismatched types + //[stable2021]~| expected `Option<&mut Option<{integer}>>`, found `&_` let _: u32 = x; } - if let Some(&Some(Some(&x))) = &Some(Some(&mut Some(0))) { + if let Some(&Some(x)) = &mut Some(Some(0)) { + //[stable2021]~^ mismatched types + //[stable2021]~| expected `Option<{integer}>`, found `&_` let _: u32 = x; } - if let Some(&Some(&x)) = Some(&Some(&mut 0)) { + + // Tests eating one layer, eating a lone inherited ref, and `&` eating `&mut` (realness varies) + if let Some(&Some(&x)) = &Some(&mut Some(0)) { + //[stable2021]~^ mismatched types + //[stable2021]~| types differ in mutability let _: u32 = x; } - if let Some(&Some(x)) = &mut Some(Some(0)) { + if let Some(&Some(&x)) = &mut Some(&Some(0)) { + //[stable2021]~^ mismatched types + //[stable2021]~| expected integer, found `&_` let _: u32 = x; } + + // Tests for eat-inner rulesets matching on the outer reference if matching on the inner + // reference causes a mutability mismatch, i.e. `Deref(EatInner, FallbackToOuter)`: + let [&mut x] = &mut [&0]; + //[stable2021]~^ mismatched types + //[stable2021]~| types differ in mutability + let _: &u32 = x; + + let [&mut ref x] = &mut [&0]; + //[stable2021]~^ mismatched types + //[stable2021]~| types differ in mutability + let _: &&u32 = x; + + let [&mut ref mut x] = &mut [&0]; + //[stable2021]~^ mismatched types + //[stable2021]~| types differ in mutability + let _: &mut &u32 = x; + + let [&mut mut x] = &mut [&0]; + //[stable2021]~^ mismatched types + //[stable2021]~| types differ in mutability + let _: &u32 = x; + + let [&mut &x] = &mut [&0]; + //[stable2021]~^ mismatched types + //[stable2021]~| types differ in mutability + let _: u32 = x; + + let [&mut &ref x] = &mut [&0]; + //[stable2021]~^ mismatched types + //[stable2021]~| types differ in mutability + let _: &u32 = x; + + let [&mut &(mut x)] = &mut [&0]; + //[stable2021]~^ mismatched types + //[stable2021]~| types differ in mutability + let _: u32 = x; } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.stable2021.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.stable2021.stderr new file mode 100644 index 00000000000..b1a8024397b --- /dev/null +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.stable2021.stderr @@ -0,0 +1,265 @@ +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:30:23 + | +LL | if let Some(Some(&&x)) = &Some(Some(&0)) { + | ^^ --------------- this expression has type `&Option<Option<&{integer}>>` + | | + | expected integer, found `&_` + | + = note: expected type `{integer}` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - if let Some(Some(&&x)) = &Some(Some(&0)) { +LL + if let Some(Some(&x)) = &Some(Some(&0)) { + | + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:37:22 + | +LL | if let Some(Some(&x)) = &Some(&Some(0)) { + | ^^ --------------- this expression has type `&Option<&Option<{integer}>>` + | | + | expected integer, found `&_` + | + = note: expected type `{integer}` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - if let Some(Some(&x)) = &Some(&Some(0)) { +LL + if let Some(Some(x)) = &Some(&Some(0)) { + | + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:42:17 + | +LL | if let Some(&Some(x)) = &Some(Some(0)) { + | ^^^^^^^^ -------------- this expression has type `&Option<Option<{integer}>>` + | | + | expected `Option<{integer}>`, found `&_` + | + = note: expected enum `Option<{integer}>` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:47:22 + | +LL | if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { + | ^^^^^^ ----------------------- this expression has type `&mut Option<&mut Option<{integer}>>` + | | + | expected integer, found `&mut _` + | + = note: expected type `{integer}` + found mutable reference `&mut _` +note: to declare a mutable binding use: `mut x` + --> $DIR/well-typed-edition-2024.rs:47:22 + | +LL | if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { + | ^^^^^^ +help: consider removing `&mut` from the pattern + | +LL - if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { +LL + if let Some(Some(x)) = &mut Some(&mut Some(0)) { + | + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:54:23 + | +LL | if let Some(&Some(&x)) = Some(&Some(&mut 0)) { + | ^^ ------------------- this expression has type `Option<&Option<&mut {integer}>>` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut {integer}` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - if let Some(&Some(&x)) = Some(&Some(&mut 0)) { +LL + if let Some(&Some(x)) = Some(&Some(&mut 0)) { + | + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:61:23 + | +LL | if let Some(&Some(&x)) = &Some(&Some(0)) { + | ^^ --------------- this expression has type `&Option<&Option<{integer}>>` + | | + | expected integer, found `&_` + | + = note: expected type `{integer}` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - if let Some(&Some(&x)) = &Some(&Some(0)) { +LL + if let Some(&Some(x)) = &Some(&Some(0)) { + | + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:68:17 + | +LL | if let Some(&Some(Some(&x))) = &Some(Some(&mut Some(0))) { + | ^^^^^^^^^^^^^^^ ------------------------- this expression has type `&Option<Option<&mut Option<{integer}>>>` + | | + | expected `Option<&mut Option<{integer}>>`, found `&_` + | + = note: expected enum `Option<&mut Option<{integer}>>` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:73:17 + | +LL | if let Some(&Some(x)) = &mut Some(Some(0)) { + | ^^^^^^^^ ------------------ this expression has type `&mut Option<Option<{integer}>>` + | | + | expected `Option<{integer}>`, found `&_` + | + = note: expected enum `Option<{integer}>` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:80:17 + | +LL | if let Some(&Some(&x)) = &Some(&mut Some(0)) { + | ^^^^^^^^^ ------------------- this expression has type `&Option<&mut Option<{integer}>>` + | | + | types differ in mutability + | + = note: expected mutable reference `&mut Option<{integer}>` + found reference `&_` + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:85:23 + | +LL | if let Some(&Some(&x)) = &mut Some(&Some(0)) { + | ^^ ------------------- this expression has type `&mut Option<&Option<{integer}>>` + | | + | expected integer, found `&_` + | + = note: expected type `{integer}` + found reference `&_` +help: consider removing `&` from the pattern + | +LL - if let Some(&Some(&x)) = &mut Some(&Some(0)) { +LL + if let Some(&Some(x)) = &mut Some(&Some(0)) { + | + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:93:10 + | +LL | let [&mut x] = &mut [&0]; + | ^^^^^^ --------- this expression has type `&mut [&{integer}; 1]` + | | + | types differ in mutability + | + = note: expected reference `&{integer}` + found mutable reference `&mut _` +note: to declare a mutable binding use: `mut x` + --> $DIR/well-typed-edition-2024.rs:93:10 + | +LL | let [&mut x] = &mut [&0]; + | ^^^^^^ +help: consider removing `&mut` from the pattern + | +LL - let [&mut x] = &mut [&0]; +LL + let [x] = &mut [&0]; + | + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:98:10 + | +LL | let [&mut ref x] = &mut [&0]; + | ^^^^^^^^^^ --------- this expression has type `&mut [&{integer}; 1]` + | | + | types differ in mutability + | + = note: expected reference `&{integer}` + found mutable reference `&mut _` +note: to declare a mutable binding use: `mut x` + --> $DIR/well-typed-edition-2024.rs:98:10 + | +LL | let [&mut ref x] = &mut [&0]; + | ^^^^^^^^^^ +help: consider removing `&mut` from the pattern + | +LL - let [&mut ref x] = &mut [&0]; +LL + let [ref x] = &mut [&0]; + | + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:103:10 + | +LL | let [&mut ref mut x] = &mut [&0]; + | ^^^^^^^^^^^^^^ --------- this expression has type `&mut [&{integer}; 1]` + | | + | types differ in mutability + | + = note: expected reference `&{integer}` + found mutable reference `&mut _` +note: to declare a mutable binding use: `mut x` + --> $DIR/well-typed-edition-2024.rs:103:10 + | +LL | let [&mut ref mut x] = &mut [&0]; + | ^^^^^^^^^^^^^^ +help: consider removing `&mut` from the pattern + | +LL - let [&mut ref mut x] = &mut [&0]; +LL + let [ref mut x] = &mut [&0]; + | + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:108:10 + | +LL | let [&mut mut x] = &mut [&0]; + | ^^^^^^^^^^ --------- this expression has type `&mut [&{integer}; 1]` + | | + | types differ in mutability + | + = note: expected reference `&{integer}` + found mutable reference `&mut _` +note: to declare a mutable binding use: `mut x` + --> $DIR/well-typed-edition-2024.rs:108:10 + | +LL | let [&mut mut x] = &mut [&0]; + | ^^^^^^^^^^ +help: consider removing `&mut` from the pattern + | +LL - let [&mut mut x] = &mut [&0]; +LL + let [mut x] = &mut [&0]; + | + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:113:10 + | +LL | let [&mut &x] = &mut [&0]; + | ^^^^^^^ --------- this expression has type `&mut [&{integer}; 1]` + | | + | types differ in mutability + | + = note: expected reference `&{integer}` + found mutable reference `&mut _` + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:118:10 + | +LL | let [&mut &ref x] = &mut [&0]; + | ^^^^^^^^^^^ --------- this expression has type `&mut [&{integer}; 1]` + | | + | types differ in mutability + | + = note: expected reference `&{integer}` + found mutable reference `&mut _` + +error[E0308]: mismatched types + --> $DIR/well-typed-edition-2024.rs:123:10 + | +LL | let [&mut &(mut x)] = &mut [&0]; + | ^^^^^^^^^^^^^ --------- this expression has type `&mut [&{integer}; 1]` + | | + | types differ in mutability + | + = note: expected reference `&{integer}` + found mutable reference `&mut _` + +error: aborting due to 17 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.fixed b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.fixed index e2b2c987610..e35896f32ad 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.fixed +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.fixed @@ -23,22 +23,22 @@ fn main() { assert_type_eq(x, &mut 0u8); let &Foo(mut x) = &Foo(0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let &mut Foo(mut x) = &mut Foo(0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); - let &Foo(ref x) = &Foo(0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + let Foo(x) = &Foo(0); + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, &0u8); let &mut Foo(ref x) = &mut Foo(0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, &0u8); @@ -55,22 +55,22 @@ fn main() { assert_type_eq(x, &0u8); let &Foo(&x) = &Foo(&0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let &Foo(&mut x) = &Foo(&mut 0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let &mut Foo(&x) = &mut Foo(&0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let &mut Foo(&mut x) = &mut Foo(&mut 0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); @@ -79,25 +79,25 @@ fn main() { } if let &&&&&Some(&x) = &&&&&Some(&0u8) { - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); } if let &&&&&Some(&mut x) = &&&&&Some(&mut 0u8) { - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); } if let &&&&&mut Some(&x) = &&&&&mut Some(&0u8) { - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); } if let &mut Some(&mut Some(&mut Some(ref mut x))) = &mut Some(&mut Some(&mut Some(0u8))) { - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, &mut 0u8); } @@ -109,20 +109,20 @@ fn main() { } let &Struct { ref a, mut b, ref c } = &Struct { a: 0, b: 0, c: 0 }; - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(a, &0u32); assert_type_eq(b, 0u32); let &Struct { a: &a, ref b, ref c } = &Struct { a: &0, b: &0, c: &0 }; - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: binding modifiers and reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(a, 0u32); assert_type_eq(b, &&0u32); assert_type_eq(c, &&0u32); if let &Struct { a: &Some(a), b: &Some(&b), c: &Some(ref c) } = - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 &(Struct { a: &Some(&0), b: &Some(&0), c: &Some(&0) }) { @@ -135,10 +135,113 @@ fn main() { // The two patterns are the same syntactically, but because they're defined in different // editions they don't mean the same thing. &(Some(mut x), migration_lint_macros::mixed_edition_pat!(y)) => { - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` assert_type_eq(x, 0u32); assert_type_eq(y, 0u32); } _ => {} } + + let &mut [&mut &[ref a]] = &mut [&mut &[0]]; + //~^ ERROR: binding modifiers and reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + + let &[&(_)] = &[&0]; + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + + // NB: Most of the following tests are for possible future improvements to migration suggestions + + // Test removing multiple binding modifiers. + let Struct { a, b, c } = &Struct { a: 0, b: 0, c: 0 }; + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + assert_type_eq(c, &0u32); + + // Test that we don't change bindings' modes when removing binding modifiers. + let &mut Struct { ref a, ref mut b, ref mut c } = &mut Struct { a: 0, b: 0, c: 0 }; + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + assert_type_eq(b, &mut 0u32); + assert_type_eq(c, &mut 0u32); + + // Test removing multiple reference patterns of various mutabilities, plus a binding modifier. + let &mut &Struct { a: &[ref a], b: &mut [&[ref b]], ref c } = &mut &Struct { a: &[0], b: &mut [&[0]], c: 0 }; + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + assert_type_eq(b, &0u32); + assert_type_eq(c, &0u32); + + // Test that we don't change bindings' types when removing reference patterns. + let &Foo(&ref a) = &Foo(&0); + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + + // Test that we don't change bindings' modes when adding reference paterns (caught early). + let &(&a, ref b, &[ref c], &mut [&mut (ref d, &[ref e])]) = &(&0, 0, &[0], &mut [&mut (0, &[0])]); + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, 0u32); + assert_type_eq(b, &0u32); + assert_type_eq(c, &0u32); + assert_type_eq(d, &0u32); + assert_type_eq(e, &0u32); + + // Test that we don't change bindings' modes when adding reference patterns (caught late). + let &(ref a, &mut [ref b], &[mut c]) = &(0, &mut [0], &[0]); + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + assert_type_eq(b, &0u32); + assert_type_eq(c, 0u32); + + // Test featuring both additions and removals. + let &(&a, &mut (ref b, &[ref c])) = &(&0, &mut (0, &[0])); + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, 0u32); + assert_type_eq(b, &0u32); + assert_type_eq(c, &0u32); + + // Test that bindings' subpatterns' modes are updated properly. + let &[mut a @ ref b] = &[0]; + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, 0u32); + assert_type_eq(b, &0u32); + + // Test that bindings' subpatterns' modes are checked properly. + let &[ref a @ mut b] = &[0]; + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + assert_type_eq(b, 0u32); + + // Test that we respect bindings' subpatterns' types when rewriting `&ref x` to `x`. + let [&Foo(&ref a @ ref b), &Foo(&ref c @ d)] = [&Foo(&0); 2]; + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + assert_type_eq(b, &0u32); + assert_type_eq(c, &0u32); + assert_type_eq(d, 0u32); + + // Test that we respect bindings' subpatterns' modes when rewriting `&ref x` to `x`. + let [&Foo(&ref a @ [ref b]), &Foo(&ref c @ [d])] = [&Foo(&[0]); 2]; + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &[0u32]); + assert_type_eq(b, &0u32); + assert_type_eq(c, &[0u32]); + assert_type_eq(d, 0u32); + + // Test that we use the correct message and suggestion style when pointing inside expansions. + let &[migration_lint_macros::bind_ref!(a)] = &[0]; + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` + assert_type_eq(a, &0u32); } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.rs index 098540adfa2..10a23e6f2fa 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.rs @@ -23,22 +23,22 @@ fn main() { assert_type_eq(x, &mut 0u8); let Foo(mut x) = &Foo(0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let Foo(mut x) = &mut Foo(0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let Foo(ref x) = &Foo(0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, &0u8); let Foo(ref x) = &mut Foo(0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, &0u8); @@ -55,22 +55,22 @@ fn main() { assert_type_eq(x, &0u8); let Foo(&x) = &Foo(&0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let Foo(&mut x) = &Foo(&mut 0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let Foo(&x) = &mut Foo(&0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let Foo(&mut x) = &mut Foo(&mut 0); - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); @@ -79,25 +79,25 @@ fn main() { } if let Some(&x) = &&&&&Some(&0u8) { - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); } if let Some(&mut x) = &&&&&Some(&mut 0u8) { - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); } if let Some(&x) = &&&&&mut Some(&0u8) { - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); } if let Some(&mut Some(Some(x))) = &mut Some(&mut Some(&mut Some(0u8))) { - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, &mut 0u8); } @@ -109,20 +109,20 @@ fn main() { } let Struct { a, mut b, c } = &Struct { a: 0, b: 0, c: 0 }; - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(a, &0u32); assert_type_eq(b, 0u32); let Struct { a: &a, b, ref c } = &Struct { a: &0, b: &0, c: &0 }; - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: binding modifiers and reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(a, 0u32); assert_type_eq(b, &&0u32); assert_type_eq(c, &&0u32); if let Struct { a: &Some(a), b: Some(&b), c: Some(c) } = - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 //~| WARN: this changes meaning in Rust 2024 &(Struct { a: &Some(&0), b: &Some(&0), c: &Some(&0) }) { @@ -135,10 +135,113 @@ fn main() { // The two patterns are the same syntactically, but because they're defined in different // editions they don't mean the same thing. (Some(mut x), migration_lint_macros::mixed_edition_pat!(y)) => { - //~^ ERROR: this pattern relies on behavior which may change in edition 2024 + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` assert_type_eq(x, 0u32); assert_type_eq(y, 0u32); } _ => {} } + + let [&mut [ref a]] = &mut [&mut &[0]]; + //~^ ERROR: binding modifiers and reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + + let [&(_)] = &[&0]; + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + + // NB: Most of the following tests are for possible future improvements to migration suggestions + + // Test removing multiple binding modifiers. + let Struct { ref a, ref b, c } = &Struct { a: 0, b: 0, c: 0 }; + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + assert_type_eq(c, &0u32); + + // Test that we don't change bindings' modes when removing binding modifiers. + let Struct { ref a, ref mut b, c } = &mut Struct { a: 0, b: 0, c: 0 }; + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + assert_type_eq(b, &mut 0u32); + assert_type_eq(c, &mut 0u32); + + // Test removing multiple reference patterns of various mutabilities, plus a binding modifier. + let Struct { a: &[ref a], b: &mut [[b]], c } = &mut &Struct { a: &[0], b: &mut [&[0]], c: 0 }; + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + assert_type_eq(b, &0u32); + assert_type_eq(c, &0u32); + + // Test that we don't change bindings' types when removing reference patterns. + let Foo(&ref a) = &Foo(&0); + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + + // Test that we don't change bindings' modes when adding reference paterns (caught early). + let (&a, b, [c], [(d, [e])]) = &(&0, 0, &[0], &mut [&mut (0, &[0])]); + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, 0u32); + assert_type_eq(b, &0u32); + assert_type_eq(c, &0u32); + assert_type_eq(d, &0u32); + assert_type_eq(e, &0u32); + + // Test that we don't change bindings' modes when adding reference patterns (caught late). + let (a, [b], [mut c]) = &(0, &mut [0], &[0]); + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + assert_type_eq(b, &0u32); + assert_type_eq(c, 0u32); + + // Test featuring both additions and removals. + let (&a, (b, &[ref c])) = &(&0, &mut (0, &[0])); + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, 0u32); + assert_type_eq(b, &0u32); + assert_type_eq(c, &0u32); + + // Test that bindings' subpatterns' modes are updated properly. + let [mut a @ b] = &[0]; + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, 0u32); + assert_type_eq(b, &0u32); + + // Test that bindings' subpatterns' modes are checked properly. + let [a @ mut b] = &[0]; + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + assert_type_eq(b, 0u32); + + // Test that we respect bindings' subpatterns' types when rewriting `&ref x` to `x`. + let [Foo(&ref a @ ref b), Foo(&ref c @ d)] = [&Foo(&0); 2]; + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &0u32); + assert_type_eq(b, &0u32); + assert_type_eq(c, &0u32); + assert_type_eq(d, 0u32); + + // Test that we respect bindings' subpatterns' modes when rewriting `&ref x` to `x`. + let [Foo(&ref a @ [ref b]), Foo(&ref c @ [d])] = [&Foo(&[0]); 2]; + //~^ ERROR: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + //~| WARN: this changes meaning in Rust 2024 + assert_type_eq(a, &[0u32]); + assert_type_eq(b, &0u32); + assert_type_eq(c, &[0u32]); + assert_type_eq(d, 0u32); + + // Test that we use the correct message and suggestion style when pointing inside expansions. + let [migration_lint_macros::bind_ref!(a)] = &[0]; + //~^ ERROR: binding modifiers may only be written when the default binding mode is `move` + assert_type_eq(a, &0u32); } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.stderr index 83346b9dd4a..3dd91c86a3b 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.stderr @@ -1,11 +1,16 @@ -error: this pattern relies on behavior which may change in edition 2024 +error: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:25:13 | LL | let Foo(mut x) = &Foo(0); - | ^^^ requires binding by-value, but the implicit default is by-reference + | ^^^ binding modifier not allowed under `ref` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:25:9 + | +LL | let Foo(mut x) = &Foo(0); + | ^^^^^^^^^^ this matches on type `&_` note: the lint level is defined here --> $DIR/migration_lint.rs:7:9 | @@ -16,206 +21,564 @@ help: make the implied reference pattern explicit LL | let &Foo(mut x) = &Foo(0); | + -error: this pattern relies on behavior which may change in edition 2024 +error: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:30:13 | LL | let Foo(mut x) = &mut Foo(0); - | ^^^ requires binding by-value, but the implicit default is by-reference + | ^^^ binding modifier not allowed under `ref mut` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:30:9 + | +LL | let Foo(mut x) = &mut Foo(0); + | ^^^^^^^^^^ this matches on type `&mut _` help: make the implied reference pattern explicit | LL | let &mut Foo(mut x) = &mut Foo(0); | ++++ -error: this pattern relies on behavior which may change in edition 2024 +error: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:35:13 | LL | let Foo(ref x) = &Foo(0); - | ^^^ cannot override to bind by-reference when that is the implicit default + | ^^^ binding modifier not allowed under `ref` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> -help: make the implied reference pattern explicit +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:35:9 + | +LL | let Foo(ref x) = &Foo(0); + | ^^^^^^^^^^ this matches on type `&_` +help: remove the unnecessary binding modifier + | +LL - let Foo(ref x) = &Foo(0); +LL + let Foo(x) = &Foo(0); | -LL | let &Foo(ref x) = &Foo(0); - | + -error: this pattern relies on behavior which may change in edition 2024 +error: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:40:13 | LL | let Foo(ref x) = &mut Foo(0); - | ^^^ cannot override to bind by-reference when that is the implicit default + | ^^^ binding modifier not allowed under `ref mut` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:40:9 + | +LL | let Foo(ref x) = &mut Foo(0); + | ^^^^^^^^^^ this matches on type `&mut _` help: make the implied reference pattern explicit | LL | let &mut Foo(ref x) = &mut Foo(0); | ++++ -error: this pattern relies on behavior which may change in edition 2024 +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:57:13 | LL | let Foo(&x) = &Foo(&0); - | ^ cannot implicitly match against multiple layers of reference + | ^ reference pattern not allowed under `ref` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:57:9 + | +LL | let Foo(&x) = &Foo(&0); + | ^^^^^^^ this matches on type `&_` help: make the implied reference pattern explicit | LL | let &Foo(&x) = &Foo(&0); | + -error: this pattern relies on behavior which may change in edition 2024 +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:62:13 | LL | let Foo(&mut x) = &Foo(&mut 0); - | ^^^^ cannot implicitly match against multiple layers of reference + | ^^^^ reference pattern not allowed under `ref` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:62:9 + | +LL | let Foo(&mut x) = &Foo(&mut 0); + | ^^^^^^^^^^^ this matches on type `&_` help: make the implied reference pattern explicit | LL | let &Foo(&mut x) = &Foo(&mut 0); | + -error: this pattern relies on behavior which may change in edition 2024 +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:67:13 | LL | let Foo(&x) = &mut Foo(&0); - | ^ cannot implicitly match against multiple layers of reference + | ^ reference pattern not allowed under `ref mut` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:67:9 + | +LL | let Foo(&x) = &mut Foo(&0); + | ^^^^^^^ this matches on type `&mut _` help: make the implied reference pattern explicit | LL | let &mut Foo(&x) = &mut Foo(&0); | ++++ -error: this pattern relies on behavior which may change in edition 2024 +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:72:13 | LL | let Foo(&mut x) = &mut Foo(&mut 0); - | ^^^^ cannot implicitly match against multiple layers of reference + | ^^^^ reference pattern not allowed under `ref mut` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:72:9 + | +LL | let Foo(&mut x) = &mut Foo(&mut 0); + | ^^^^^^^^^^^ this matches on type `&mut _` help: make the implied reference pattern explicit | LL | let &mut Foo(&mut x) = &mut Foo(&mut 0); | ++++ -error: this pattern relies on behavior which may change in edition 2024 +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:81:17 | LL | if let Some(&x) = &&&&&Some(&0u8) { - | ^ cannot implicitly match against multiple layers of reference + | ^ reference pattern not allowed under `ref` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:81:12 + | +LL | if let Some(&x) = &&&&&Some(&0u8) { + | ^^^^^^^^ this matches on type `&_` help: make the implied reference patterns explicit | LL | if let &&&&&Some(&x) = &&&&&Some(&0u8) { | +++++ -error: this pattern relies on behavior which may change in edition 2024 +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:87:17 | LL | if let Some(&mut x) = &&&&&Some(&mut 0u8) { - | ^^^^ cannot implicitly match against multiple layers of reference + | ^^^^ reference pattern not allowed under `ref` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:87:12 + | +LL | if let Some(&mut x) = &&&&&Some(&mut 0u8) { + | ^^^^^^^^^^^^ this matches on type `&_` help: make the implied reference patterns explicit | LL | if let &&&&&Some(&mut x) = &&&&&Some(&mut 0u8) { | +++++ -error: this pattern relies on behavior which may change in edition 2024 +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:93:17 | LL | if let Some(&x) = &&&&&mut Some(&0u8) { - | ^ cannot implicitly match against multiple layers of reference + | ^ reference pattern not allowed under `ref` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:93:12 + | +LL | if let Some(&x) = &&&&&mut Some(&0u8) { + | ^^^^^^^^ this matches on type `&_` help: make the implied reference patterns explicit | LL | if let &&&&&mut Some(&x) = &&&&&mut Some(&0u8) { | ++++++++ -error: this pattern relies on behavior which may change in edition 2024 +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:99:17 | LL | if let Some(&mut Some(Some(x))) = &mut Some(&mut Some(&mut Some(0u8))) { - | ^^^^ cannot implicitly match against multiple layers of reference + | ^^^^ reference pattern not allowed under `ref mut` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:99:12 + | +LL | if let Some(&mut Some(Some(x))) = &mut Some(&mut Some(&mut Some(0u8))) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&mut _` help: make the implied reference patterns and variable binding mode explicit | LL | if let &mut Some(&mut Some(&mut Some(ref mut x))) = &mut Some(&mut Some(&mut Some(0u8))) { | ++++ ++++ +++++++ -error: this pattern relies on behavior which may change in edition 2024 +error: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:111:21 | LL | let Struct { a, mut b, c } = &Struct { a: 0, b: 0, c: 0 }; - | ^^^ requires binding by-value, but the implicit default is by-reference + | ^^^ binding modifier not allowed under `ref` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:111:9 + | +LL | let Struct { a, mut b, c } = &Struct { a: 0, b: 0, c: 0 }; + | ^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` help: make the implied reference pattern and variable binding modes explicit | LL | let &Struct { ref a, mut b, ref c } = &Struct { a: 0, b: 0, c: 0 }; | + +++ +++ -error: this pattern relies on behavior which may change in edition 2024 +error: binding modifiers and reference patterns may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:117:21 | LL | let Struct { a: &a, b, ref c } = &Struct { a: &0, b: &0, c: &0 }; - | ^ ^^^ cannot override to bind by-reference when that is the implicit default + | ^ ^^^ binding modifier not allowed under `ref` default binding mode | | - | cannot implicitly match against multiple layers of reference + | reference pattern not allowed under `ref` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:117:9 + | +LL | let Struct { a: &a, b, ref c } = &Struct { a: &0, b: &0, c: &0 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` help: make the implied reference pattern and variable binding mode explicit | LL | let &Struct { a: &a, ref b, ref c } = &Struct { a: &0, b: &0, c: &0 }; | + +++ -error: this pattern relies on behavior which may change in edition 2024 +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 --> $DIR/migration_lint.rs:124:24 | LL | if let Struct { a: &Some(a), b: Some(&b), c: Some(c) } = - | ^ ^ cannot implicitly match against multiple layers of reference + | ^ ^ reference pattern not allowed under `ref` default binding mode | | - | cannot implicitly match against multiple layers of reference + | reference pattern not allowed under `ref` default binding mode | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:124:12 + | +LL | if let Struct { a: &Some(a), b: Some(&b), c: Some(c) } = + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` help: make the implied reference patterns and variable binding mode explicit | LL | if let &Struct { a: &Some(a), b: &Some(&b), c: &Some(ref c) } = | + + + +++ -error: this pattern relies on behavior which may change in edition 2024 +error: binding modifiers may only be written when the default binding mode is `move` --> $DIR/migration_lint.rs:137:15 | LL | (Some(mut x), migration_lint_macros::mixed_edition_pat!(y)) => { - | ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ default binding mode is reset within expansion + | ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ occurs within macro expansion | | - | requires binding by-value, but the implicit default is by-reference + | binding modifier not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:137:9 + | +LL | (Some(mut x), migration_lint_macros::mixed_edition_pat!(y)) => { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` = note: this error originates in the macro `migration_lint_macros::mixed_edition_pat` (in Nightly builds, run with -Z macro-backtrace for more info) help: make the implied reference pattern explicit | LL | &(Some(mut x), migration_lint_macros::mixed_edition_pat!(y)) => { | + -error: aborting due to 16 previous errors +error: binding modifiers and reference patterns may only be written when the default binding mode is `move` in Rust 2024 + --> $DIR/migration_lint.rs:145:10 + | +LL | let [&mut [ref a]] = &mut [&mut &[0]]; + | ^^^^ ^^^ binding modifier not allowed under `ref` default binding mode + | | + | reference pattern not allowed under `ref mut` default binding mode + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:145:15 + | +LL | let [&mut [ref a]] = &mut [&mut &[0]]; + | ^^^^^^^ this matches on type `&_` +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:145:9 + | +LL | let [&mut [ref a]] = &mut [&mut &[0]]; + | ^^^^^^^^^^^^^^ this matches on type `&mut _` +help: make the implied reference patterns explicit + | +LL | let &mut [&mut &[ref a]] = &mut [&mut &[0]]; + | ++++ + + +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + --> $DIR/migration_lint.rs:150:10 + | +LL | let [&(_)] = &[&0]; + | ^ reference pattern not allowed under `ref` default binding mode + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:150:9 + | +LL | let [&(_)] = &[&0]; + | ^^^^^^ this matches on type `&_` +help: make the implied reference pattern explicit + | +LL | let &[&(_)] = &[&0]; + | + + +error: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + --> $DIR/migration_lint.rs:157:18 + | +LL | let Struct { ref a, ref b, c } = &Struct { a: 0, b: 0, c: 0 }; + | ^^^ ^^^ binding modifier not allowed under `ref` default binding mode + | | + | binding modifier not allowed under `ref` default binding mode + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:157:9 + | +LL | let Struct { ref a, ref b, c } = &Struct { a: 0, b: 0, c: 0 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` +help: remove the unnecessary binding modifiers + | +LL - let Struct { ref a, ref b, c } = &Struct { a: 0, b: 0, c: 0 }; +LL + let Struct { a, b, c } = &Struct { a: 0, b: 0, c: 0 }; + | + +error: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + --> $DIR/migration_lint.rs:164:18 + | +LL | let Struct { ref a, ref mut b, c } = &mut Struct { a: 0, b: 0, c: 0 }; + | ^^^ ^^^^^^^ binding modifier not allowed under `ref mut` default binding mode + | | + | binding modifier not allowed under `ref mut` default binding mode + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:164:9 + | +LL | let Struct { ref a, ref mut b, c } = &mut Struct { a: 0, b: 0, c: 0 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&mut _` +help: make the implied reference pattern and variable binding mode explicit + | +LL | let &mut Struct { ref a, ref mut b, ref mut c } = &mut Struct { a: 0, b: 0, c: 0 }; + | ++++ +++++++ + +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + --> $DIR/migration_lint.rs:172:21 + | +LL | let Struct { a: &[ref a], b: &mut [[b]], c } = &mut &Struct { a: &[0], b: &mut [&[0]], c: 0 }; + | ^ ^^^^ reference pattern not allowed under `ref` default binding mode + | | + | reference pattern not allowed under `ref` default binding mode + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:172:9 + | +LL | let Struct { a: &[ref a], b: &mut [[b]], c } = &mut &Struct { a: &[0], b: &mut [&[0]], c: 0 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` +help: make the implied reference patterns and variable binding modes explicit + | +LL | let &mut &Struct { a: &[ref a], b: &mut [&[ref b]], ref c } = &mut &Struct { a: &[0], b: &mut [&[0]], c: 0 }; + | ++++++ + +++ +++ + +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + --> $DIR/migration_lint.rs:180:13 + | +LL | let Foo(&ref a) = &Foo(&0); + | ^ reference pattern not allowed under `ref` default binding mode + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:180:9 + | +LL | let Foo(&ref a) = &Foo(&0); + | ^^^^^^^^^^^ this matches on type `&_` +help: make the implied reference pattern explicit + | +LL | let &Foo(&ref a) = &Foo(&0); + | + + +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + --> $DIR/migration_lint.rs:186:10 + | +LL | let (&a, b, [c], [(d, [e])]) = &(&0, 0, &[0], &mut [&mut (0, &[0])]); + | ^ reference pattern not allowed under `ref` default binding mode + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:186:9 + | +LL | let (&a, b, [c], [(d, [e])]) = &(&0, 0, &[0], &mut [&mut (0, &[0])]); + | ^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` +help: make the implied reference patterns and variable binding modes explicit + | +LL | let &(&a, ref b, &[ref c], &mut [&mut (ref d, &[ref e])]) = &(&0, 0, &[0], &mut [&mut (0, &[0])]); + | + +++ + +++ ++++ ++++ +++ + +++ + +error: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + --> $DIR/migration_lint.rs:196:19 + | +LL | let (a, [b], [mut c]) = &(0, &mut [0], &[0]); + | ^^^ binding modifier not allowed under `ref` default binding mode + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:196:9 + | +LL | let (a, [b], [mut c]) = &(0, &mut [0], &[0]); + | ^^^^^^^^^^^^^^^^^ this matches on type `&_` +help: make the implied reference patterns and variable binding modes explicit + | +LL | let &(ref a, &mut [ref b], &[mut c]) = &(0, &mut [0], &[0]); + | + +++ ++++ +++ + + +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + --> $DIR/migration_lint.rs:204:10 + | +LL | let (&a, (b, &[ref c])) = &(&0, &mut (0, &[0])); + | ^ ^ reference pattern not allowed under `ref` default binding mode + | | + | reference pattern not allowed under `ref` default binding mode + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:204:9 + | +LL | let (&a, (b, &[ref c])) = &(&0, &mut (0, &[0])); + | ^^^^^^^^^^^^^^^^^^^ this matches on type `&_` +help: make the implied reference patterns and variable binding mode explicit + | +LL | let &(&a, &mut (ref b, &[ref c])) = &(&0, &mut (0, &[0])); + | + ++++ +++ + +error: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + --> $DIR/migration_lint.rs:212:10 + | +LL | let [mut a @ b] = &[0]; + | ^^^ binding modifier not allowed under `ref` default binding mode + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:212:9 + | +LL | let [mut a @ b] = &[0]; + | ^^^^^^^^^^^ this matches on type `&_` +help: make the implied reference pattern and variable binding mode explicit + | +LL | let &[mut a @ ref b] = &[0]; + | + +++ + +error: binding modifiers may only be written when the default binding mode is `move` in Rust 2024 + --> $DIR/migration_lint.rs:219:14 + | +LL | let [a @ mut b] = &[0]; + | ^^^ binding modifier not allowed under `ref` default binding mode + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:219:9 + | +LL | let [a @ mut b] = &[0]; + | ^^^^^^^^^^^ this matches on type `&_` +help: make the implied reference pattern and variable binding mode explicit + | +LL | let &[ref a @ mut b] = &[0]; + | + +++ + +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + --> $DIR/migration_lint.rs:226:14 + | +LL | let [Foo(&ref a @ ref b), Foo(&ref c @ d)] = [&Foo(&0); 2]; + | ^ ^ reference pattern not allowed under `ref` default binding mode + | | + | reference pattern not allowed under `ref` default binding mode + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:226:31 + | +LL | let [Foo(&ref a @ ref b), Foo(&ref c @ d)] = [&Foo(&0); 2]; + | ^^^^^^^^^^^^^^^ this matches on type `&_` +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:226:10 + | +LL | let [Foo(&ref a @ ref b), Foo(&ref c @ d)] = [&Foo(&0); 2]; + | ^^^^^^^^^^^^^^^^^^^ this matches on type `&_` +help: make the implied reference patterns explicit + | +LL | let [&Foo(&ref a @ ref b), &Foo(&ref c @ d)] = [&Foo(&0); 2]; + | + + + +error: reference patterns may only be written when the default binding mode is `move` in Rust 2024 + --> $DIR/migration_lint.rs:235:14 + | +LL | let [Foo(&ref a @ [ref b]), Foo(&ref c @ [d])] = [&Foo(&[0]); 2]; + | ^ ^ reference pattern not allowed under `ref` default binding mode + | | + | reference pattern not allowed under `ref` default binding mode + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:235:33 + | +LL | let [Foo(&ref a @ [ref b]), Foo(&ref c @ [d])] = [&Foo(&[0]); 2]; + | ^^^^^^^^^^^^^^^^^ this matches on type `&_` +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:235:10 + | +LL | let [Foo(&ref a @ [ref b]), Foo(&ref c @ [d])] = [&Foo(&[0]); 2]; + | ^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` +help: make the implied reference patterns explicit + | +LL | let [&Foo(&ref a @ [ref b]), &Foo(&ref c @ [d])] = [&Foo(&[0]); 2]; + | + + + +error: binding modifiers may only be written when the default binding mode is `move` + --> $DIR/migration_lint.rs:244:10 + | +LL | let [migration_lint_macros::bind_ref!(a)] = &[0]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ occurs within macro expansion + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/migration_lint.rs:244:9 + | +LL | let [migration_lint_macros::bind_ref!(a)] = &[0]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_` + = note: this error originates in the macro `migration_lint_macros::bind_ref` (in Nightly builds, run with -Z macro-backtrace for more info) +help: make the implied reference pattern explicit + | +LL | let &[migration_lint_macros::bind_ref!(a)] = &[0]; + | + + +error: aborting due to 30 previous errors diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/min_match_ergonomics_fail.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/min_match_ergonomics_fail.rs index 5ba554fc6e5..4dc04d90aaf 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/min_match_ergonomics_fail.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/min_match_ergonomics_fail.rs @@ -21,17 +21,17 @@ macro_rules! test_pat_on_type { } test_pat_on_type![(&x,): &(T,)]; //~ ERROR mismatched types -test_pat_on_type![(&x,): &(&T,)]; //~ ERROR this pattern relies on behavior which may change in edition 2024 +test_pat_on_type![(&x,): &(&T,)]; //~ ERROR reference patterns may only be written when the default binding mode is `move` test_pat_on_type![(&x,): &(&mut T,)]; //~ ERROR mismatched types test_pat_on_type![(&mut x,): &(&T,)]; //~ ERROR mismatched types -test_pat_on_type![(&mut x,): &(&mut T,)]; //~ ERROR this pattern relies on behavior which may change in edition 2024 +test_pat_on_type![(&mut x,): &(&mut T,)]; //~ ERROR reference patterns may only be written when the default binding mode is `move` test_pat_on_type![(&x,): &&mut &(T,)]; //~ ERROR mismatched types test_pat_on_type![Foo { f: (&x,) }: Foo]; //~ ERROR mismatched types test_pat_on_type![Foo { f: (&x,) }: &mut Foo]; //~ ERROR mismatched types -test_pat_on_type![Foo { f: &(x,) }: &Foo]; //~ ERROR this pattern relies on behavior which may change in edition 2024 -test_pat_on_type![(mut x,): &(T,)]; //~ ERROR this pattern relies on behavior which may change in edition 2024 -test_pat_on_type![(ref x,): &(T,)]; //~ ERROR this pattern relies on behavior which may change in edition 2024 -test_pat_on_type![(ref mut x,): &mut (T,)]; //~ ERROR this pattern relies on behavior which may change in edition 2024 +test_pat_on_type![Foo { f: &(x,) }: &Foo]; //~ ERROR reference patterns may only be written when the default binding mode is `move` +test_pat_on_type![(mut x,): &(T,)]; //~ ERROR binding modifiers may only be written when the default binding mode is `move` +test_pat_on_type![(ref x,): &(T,)]; //~ ERROR binding modifiers may only be written when the default binding mode is `move` +test_pat_on_type![(ref mut x,): &mut (T,)]; //~ ERROR binding modifiers may only be written when the default binding mode is `move` fn get<X>() -> X { unimplemented!() @@ -40,6 +40,6 @@ fn get<X>() -> X { // Make sure this works even when the underlying type is inferred. This test passes on rust stable. fn infer<X: Copy>() -> X { match &get() { - (&x,) => x, //~ ERROR this pattern relies on behavior which may change in edition 2024 + (&x,) => x, //~ ERROR reference patterns may only be written when the default binding mode is `move` } } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/min_match_ergonomics_fail.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/min_match_ergonomics_fail.stderr index affdca1d449..0c6b2ff3a2f 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/min_match_ergonomics_fail.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/min_match_ergonomics_fail.stderr @@ -99,85 +99,122 @@ LL - test_pat_on_type![Foo { f: (&x,) }: &mut Foo]; LL + test_pat_on_type![Foo { f: (x,) }: &mut Foo]; | -error: this pattern relies on behavior which may change in edition 2024 +error: reference patterns may only be written when the default binding mode is `move` --> $DIR/min_match_ergonomics_fail.rs:24:20 | LL | test_pat_on_type![(&x,): &(&T,)]; - | ^ cannot implicitly match against multiple layers of reference + | ^ reference pattern not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/min_match_ergonomics_fail.rs:24:19 + | +LL | test_pat_on_type![(&x,): &(&T,)]; + | ^^^^^ this matches on type `&_` help: make the implied reference pattern explicit | LL | test_pat_on_type![&(&x,): &(&T,)]; | + -error: this pattern relies on behavior which may change in edition 2024 +error: reference patterns may only be written when the default binding mode is `move` --> $DIR/min_match_ergonomics_fail.rs:27:20 | LL | test_pat_on_type![(&mut x,): &(&mut T,)]; - | ^^^^ cannot implicitly match against multiple layers of reference + | ^^^^ reference pattern not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/min_match_ergonomics_fail.rs:27:19 + | +LL | test_pat_on_type![(&mut x,): &(&mut T,)]; + | ^^^^^^^^^ this matches on type `&_` help: make the implied reference pattern explicit | LL | test_pat_on_type![&(&mut x,): &(&mut T,)]; | + -error: this pattern relies on behavior which may change in edition 2024 +error: reference patterns may only be written when the default binding mode is `move` --> $DIR/min_match_ergonomics_fail.rs:31:28 | LL | test_pat_on_type![Foo { f: &(x,) }: &Foo]; - | ^ cannot implicitly match against multiple layers of reference + | ^ reference pattern not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/min_match_ergonomics_fail.rs:31:19 + | +LL | test_pat_on_type![Foo { f: &(x,) }: &Foo]; + | ^^^^^^^^^^^^^^^^ this matches on type `&_` help: make the implied reference pattern explicit | LL | test_pat_on_type![&Foo { f: &(x,) }: &Foo]; | + -error: this pattern relies on behavior which may change in edition 2024 +error: binding modifiers may only be written when the default binding mode is `move` --> $DIR/min_match_ergonomics_fail.rs:32:20 | LL | test_pat_on_type![(mut x,): &(T,)]; - | ^^^ requires binding by-value, but the implicit default is by-reference + | ^^^ binding modifier not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/min_match_ergonomics_fail.rs:32:19 + | +LL | test_pat_on_type![(mut x,): &(T,)]; + | ^^^^^^^^ this matches on type `&_` help: make the implied reference pattern explicit | LL | test_pat_on_type![&(mut x,): &(T,)]; | + -error: this pattern relies on behavior which may change in edition 2024 +error: binding modifiers may only be written when the default binding mode is `move` --> $DIR/min_match_ergonomics_fail.rs:33:20 | LL | test_pat_on_type![(ref x,): &(T,)]; - | ^^^ cannot override to bind by-reference when that is the implicit default + | ^^^ binding modifier not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> -help: make the implied reference pattern explicit +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/min_match_ergonomics_fail.rs:33:19 + | +LL | test_pat_on_type![(ref x,): &(T,)]; + | ^^^^^^^^ this matches on type `&_` +help: remove the unnecessary binding modifier + | +LL - test_pat_on_type![(ref x,): &(T,)]; +LL + test_pat_on_type![(x,): &(T,)]; | -LL | test_pat_on_type![&(ref x,): &(T,)]; - | + -error: this pattern relies on behavior which may change in edition 2024 +error: binding modifiers may only be written when the default binding mode is `move` --> $DIR/min_match_ergonomics_fail.rs:34:20 | LL | test_pat_on_type![(ref mut x,): &mut (T,)]; - | ^^^^^^^ cannot override to bind by-reference when that is the implicit default + | ^^^^^^^ binding modifier not allowed under `ref mut` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> -help: make the implied reference pattern explicit +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/min_match_ergonomics_fail.rs:34:19 + | +LL | test_pat_on_type![(ref mut x,): &mut (T,)]; + | ^^^^^^^^^^^^ this matches on type `&mut _` +help: remove the unnecessary binding modifier + | +LL - test_pat_on_type![(ref mut x,): &mut (T,)]; +LL + test_pat_on_type![(x,): &mut (T,)]; | -LL | test_pat_on_type![&mut (ref mut x,): &mut (T,)]; - | ++++ -error: this pattern relies on behavior which may change in edition 2024 +error: reference patterns may only be written when the default binding mode is `move` --> $DIR/min_match_ergonomics_fail.rs:43:10 | LL | (&x,) => x, - | ^ cannot implicitly match against multiple layers of reference + | ^ reference pattern not allowed under `ref` default binding mode | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> +note: matching on a reference type with a non-reference pattern changes the default binding mode + --> $DIR/min_match_ergonomics_fail.rs:43:9 + | +LL | (&x,) => x, + | ^^^^^ this matches on type `&_` help: make the implied reference pattern explicit | LL | &(&x,) => x, diff --git a/tests/ui/pattern/slice-pattern-refutable.stderr b/tests/ui/pattern/slice-pattern-refutable.stderr index 3d9f769d134..ece5e0283e2 100644 --- a/tests/ui/pattern/slice-pattern-refutable.stderr +++ b/tests/ui/pattern/slice-pattern-refutable.stderr @@ -8,8 +8,9 @@ LL | let [a, b, c] = Zeroes.into() else { | help: try using a fully qualified path to specify the expected types | -LL | let [a, b, c] = <Zeroes as Into<T>>::into(Zeroes) else { - | ++++++++++++++++++++++++++ ~ +LL - let [a, b, c] = Zeroes.into() else { +LL + let [a, b, c] = <Zeroes as Into<T>>::into(Zeroes) else { + | error[E0282]: type annotations needed --> $DIR/slice-pattern-refutable.rs:21:31 @@ -21,8 +22,9 @@ LL | if let [a, b, c] = Zeroes.into() { | help: try using a fully qualified path to specify the expected types | -LL | if let [a, b, c] = <Zeroes as Into<T>>::into(Zeroes) { - | ++++++++++++++++++++++++++ ~ +LL - if let [a, b, c] = Zeroes.into() { +LL + if let [a, b, c] = <Zeroes as Into<T>>::into(Zeroes) { + | error[E0282]: type annotations needed --> $DIR/slice-pattern-refutable.rs:28:31 @@ -34,8 +36,9 @@ LL | if let [a, b, c] = Zeroes.into() { | help: try using a fully qualified path to specify the expected types | -LL | if let [a, b, c] = <Zeroes as Into<T>>::into(Zeroes) { - | ++++++++++++++++++++++++++ ~ +LL - if let [a, b, c] = Zeroes.into() { +LL + if let [a, b, c] = <Zeroes as Into<T>>::into(Zeroes) { + | error: aborting due to 3 previous errors diff --git a/tests/ui/pattern/slice-patterns-ambiguity.stderr b/tests/ui/pattern/slice-patterns-ambiguity.stderr index 690776196ce..539afed0bc0 100644 --- a/tests/ui/pattern/slice-patterns-ambiguity.stderr +++ b/tests/ui/pattern/slice-patterns-ambiguity.stderr @@ -8,8 +8,9 @@ LL | let &[a, b] = Zeroes.into() else { | help: try using a fully qualified path to specify the expected types | -LL | let &[a, b] = <Zeroes as Into<&_>>::into(Zeroes) else { - | +++++++++++++++++++++++++++ ~ +LL - let &[a, b] = Zeroes.into() else { +LL + let &[a, b] = <Zeroes as Into<&_>>::into(Zeroes) else { + | error[E0282]: type annotations needed --> $DIR/slice-patterns-ambiguity.rs:32:29 @@ -21,8 +22,9 @@ LL | if let &[a, b] = Zeroes.into() { | help: try using a fully qualified path to specify the expected types | -LL | if let &[a, b] = <Zeroes as Into<&_>>::into(Zeroes) { - | +++++++++++++++++++++++++++ ~ +LL - if let &[a, b] = Zeroes.into() { +LL + if let &[a, b] = <Zeroes as Into<&_>>::into(Zeroes) { + | error[E0282]: type annotations needed --> $DIR/slice-patterns-ambiguity.rs:39:29 @@ -34,8 +36,9 @@ LL | if let &[a, b] = Zeroes.into() { | help: try using a fully qualified path to specify the expected types | -LL | if let &[a, b] = <Zeroes as Into<&_>>::into(Zeroes) { - | +++++++++++++++++++++++++++ ~ +LL - if let &[a, b] = Zeroes.into() { +LL + if let &[a, b] = <Zeroes as Into<&_>>::into(Zeroes) { + | error: aborting due to 3 previous errors diff --git a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr index 158eac9a1bd..d7e1b54e749 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr @@ -18,15 +18,15 @@ LL | let HiddenStruct { one } = HiddenStruct::default(); help: include the missing field in the pattern and ignore the inaccessible fields | LL | let HiddenStruct { one, two, .. } = HiddenStruct::default(); - | ~~~~~~~~~~~ + | +++++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); - | ~~~~~~~~~~~~~~ + | ++++++++++++ help: or always ignore missing fields here | LL | let HiddenStruct { one, .. } = HiddenStruct::default(); - | ~~~~~~ + | ++++ error[E0027]: pattern does not mention field `two` --> $DIR/doc-hidden-fields.rs:21:9 @@ -37,15 +37,15 @@ LL | let HiddenStruct { one, hide } = HiddenStruct::default(); help: include the missing field in the pattern | LL | let HiddenStruct { one, hide, two } = HiddenStruct::default(); - | ~~~~~~~ + | +++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); - | ~~~~~~~~~~ + | ++++++++ help: or always ignore missing fields here | LL | let HiddenStruct { one, hide, .. } = HiddenStruct::default(); - | ~~~~~~ + | ++++ error[E0027]: pattern does not mention field `im_hidden` --> $DIR/doc-hidden-fields.rs:24:9 @@ -56,15 +56,15 @@ LL | let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; help: include the missing field in the pattern | LL | let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: 0 }; - | ~~~~~~~~~~~~~ + | +++++++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; - | ~~~~~~~~~~~~~~~~ + | ++++++++++++++ help: or always ignore missing fields here | LL | let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; - | ~~~~~~ + | ++++ error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs b/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs index 783512d5cca..44d1586ce4f 100644 --- a/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs +++ b/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs @@ -1,5 +1,5 @@ #![feature(rustc_attrs)] -#![pattern_complexity = "61"] +#![pattern_complexity_limit = "61"] //@ check-pass struct BaseCommand { diff --git a/tests/ui/pattern/usefulness/stable-gated-fields.stderr b/tests/ui/pattern/usefulness/stable-gated-fields.stderr index d6e9bac7c13..7c30b530d6d 100644 --- a/tests/ui/pattern/usefulness/stable-gated-fields.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-fields.stderr @@ -7,15 +7,15 @@ LL | let UnstableStruct { stable } = UnstableStruct::default(); help: include the missing field in the pattern and ignore the inaccessible fields | LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); - | ~~~~~~~~~~~~~~~ + | +++++++++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); - | ~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++ help: or always ignore missing fields here | LL | let UnstableStruct { stable, .. } = UnstableStruct::default(); - | ~~~~~~ + | ++++ error: pattern requires `..` due to inaccessible fields --> $DIR/stable-gated-fields.rs:11:9 diff --git a/tests/ui/pattern/usefulness/unstable-gated-fields.stderr b/tests/ui/pattern/usefulness/unstable-gated-fields.stderr index bb10e439ee2..4487f273534 100644 --- a/tests/ui/pattern/usefulness/unstable-gated-fields.stderr +++ b/tests/ui/pattern/usefulness/unstable-gated-fields.stderr @@ -6,16 +6,19 @@ LL | let UnstableStruct { stable, stable2, } = UnstableStruct::default(); | help: include the missing field in the pattern | -LL | let UnstableStruct { stable, stable2, unstable } = UnstableStruct::default(); - | ~~~~~~~~~~~~ +LL - let UnstableStruct { stable, stable2, } = UnstableStruct::default(); +LL + let UnstableStruct { stable, stable2, unstable } = UnstableStruct::default(); + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | let UnstableStruct { stable, stable2, unstable: _ } = UnstableStruct::default(); - | ~~~~~~~~~~~~~~~ +LL - let UnstableStruct { stable, stable2, } = UnstableStruct::default(); +LL + let UnstableStruct { stable, stable2, unstable: _ } = UnstableStruct::default(); + | help: or always ignore missing fields here | -LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); - | ~~~~~~ +LL - let UnstableStruct { stable, stable2, } = UnstableStruct::default(); +LL + let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); + | error[E0027]: pattern does not mention field `stable2` --> $DIR/unstable-gated-fields.rs:13:9 @@ -25,16 +28,19 @@ LL | let UnstableStruct { stable, unstable, } = UnstableStruct::default(); | help: include the missing field in the pattern | -LL | let UnstableStruct { stable, unstable, stable2 } = UnstableStruct::default(); - | ~~~~~~~~~~~ +LL - let UnstableStruct { stable, unstable, } = UnstableStruct::default(); +LL + let UnstableStruct { stable, unstable, stable2 } = UnstableStruct::default(); + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | let UnstableStruct { stable, unstable, stable2: _ } = UnstableStruct::default(); - | ~~~~~~~~~~~~~~ +LL - let UnstableStruct { stable, unstable, } = UnstableStruct::default(); +LL + let UnstableStruct { stable, unstable, stable2: _ } = UnstableStruct::default(); + | help: or always ignore missing fields here | -LL | let UnstableStruct { stable, unstable, .. } = UnstableStruct::default(); - | ~~~~~~ +LL - let UnstableStruct { stable, unstable, } = UnstableStruct::default(); +LL + let UnstableStruct { stable, unstable, .. } = UnstableStruct::default(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/pptypedef.stderr b/tests/ui/pptypedef.stderr index 08b90b365e3..96327cfcc65 100644 --- a/tests/ui/pptypedef.stderr +++ b/tests/ui/pptypedef.stderr @@ -8,8 +8,9 @@ LL | let_in(3u32, |i| { assert!(i == 3i32); }); | help: change the type of the numeric literal from `i32` to `u32` | -LL | let_in(3u32, |i| { assert!(i == 3u32); }); - | ~~~ +LL - let_in(3u32, |i| { assert!(i == 3i32); }); +LL + let_in(3u32, |i| { assert!(i == 3u32); }); + | error[E0308]: mismatched types --> $DIR/pptypedef.rs:8:37 @@ -21,8 +22,9 @@ LL | let_in(3i32, |i| { assert!(i == 3u32); }); | help: change the type of the numeric literal from `u32` to `i32` | -LL | let_in(3i32, |i| { assert!(i == 3i32); }); - | ~~~ +LL - let_in(3i32, |i| { assert!(i == 3u32); }); +LL + let_in(3i32, |i| { assert!(i == 3i32); }); + | error: aborting due to 2 previous errors diff --git a/tests/ui/privacy/issue-75907.stderr b/tests/ui/privacy/issue-75907.stderr index 3121cc04478..8a6484979c0 100644 --- a/tests/ui/privacy/issue-75907.stderr +++ b/tests/ui/privacy/issue-75907.stderr @@ -13,8 +13,9 @@ LL | let Bar(x, y, Foo(z)) = make_bar(); | private field help: consider making the fields publicly accessible | -LL | pub(crate) struct Bar(pub u8, pub u8, pub Foo); - | ~~~ +++ +LL - pub(crate) struct Bar(pub u8, pub(in crate::foo) u8, Foo); +LL + pub(crate) struct Bar(pub u8, pub u8, pub Foo); + | error[E0532]: cannot match against a tuple struct which contains private fields --> $DIR/issue-75907.rs:15:19 diff --git a/tests/ui/privacy/privacy-in-paths.stderr b/tests/ui/privacy/privacy-in-paths.stderr index 9c3d5e97c62..e6ece35865d 100644 --- a/tests/ui/privacy/privacy-in-paths.stderr +++ b/tests/ui/privacy/privacy-in-paths.stderr @@ -25,8 +25,9 @@ LL | mod bar { | ^^^^^^^ help: consider importing this struct through its public re-export instead | -LL | foo::S::f(); - | ~~~~~~ +LL - ::foo::bar::S::f(); +LL + foo::S::f(); + | error[E0603]: trait `T` is private --> $DIR/privacy-in-paths.rs:26:23 diff --git a/tests/ui/privacy/privacy-ns1.stderr b/tests/ui/privacy/privacy-ns1.stderr index 9710cc48637..3396330c993 100644 --- a/tests/ui/privacy/privacy-ns1.stderr +++ b/tests/ui/privacy/privacy-ns1.stderr @@ -9,8 +9,9 @@ LL | Bar(); | help: a unit struct with a similar name exists | -LL | Baz(); - | ~~~ +LL - Bar(); +LL + Baz(); + | help: consider importing this function instead | LL + use foo2::Bar; @@ -27,8 +28,9 @@ LL | Bar(); | help: a unit struct with a similar name exists | -LL | Baz(); - | ~~~ +LL - Bar(); +LL + Baz(); + | help: consider importing this function | LL + use foo2::Bar; @@ -45,8 +47,9 @@ LL | let _x: Box<Bar>; | help: a struct with a similar name exists | -LL | let _x: Box<Baz>; - | ~~~ +LL - let _x: Box<Bar>; +LL + let _x: Box<Baz>; + | help: consider importing this trait | LL + use foo1::Bar; diff --git a/tests/ui/privacy/privacy-ns2.stderr b/tests/ui/privacy/privacy-ns2.stderr index 75e735e1e6a..ac98682b2b3 100644 --- a/tests/ui/privacy/privacy-ns2.stderr +++ b/tests/ui/privacy/privacy-ns2.stderr @@ -20,8 +20,9 @@ LL | Bar(); | help: a unit struct with a similar name exists | -LL | Baz(); - | ~~~ +LL - Bar(); +LL + Baz(); + | help: consider importing this function instead | LL + use foo2::Bar; @@ -35,8 +36,9 @@ LL | let _x : Bar(); | help: use `=` if you meant to assign | -LL | let _x = Bar(); - | ~ +LL - let _x : Bar(); +LL + let _x = Bar(); + | help: consider importing this trait instead | LL + use foo1::Bar; diff --git a/tests/ui/privacy/privacy1.stderr b/tests/ui/privacy/privacy1.stderr index a3552e146a6..cb7b858e54d 100644 --- a/tests/ui/privacy/privacy1.stderr +++ b/tests/ui/privacy/privacy1.stderr @@ -142,8 +142,9 @@ LL | mod baz { | ^^^^^^^ help: consider importing this function through its public re-export instead | -LL | bar::foo(); - | ~~~~~~~~ +LL - ::bar::baz::foo(); +LL + bar::foo(); + | error[E0603]: module `baz` is private --> $DIR/privacy1.rs:128:16 @@ -158,8 +159,9 @@ LL | mod baz { | ^^^^^^^ help: consider importing this function through its public re-export instead | -LL | bar::bar(); - | ~~~~~~~~ +LL - ::bar::baz::bar(); +LL + bar::bar(); + | error[E0603]: trait `B` is private --> $DIR/privacy1.rs:157:17 diff --git a/tests/ui/privacy/privacy2.rs b/tests/ui/privacy/privacy2.rs index ab6d805544e..c82cd442559 100644 --- a/tests/ui/privacy/privacy2.rs +++ b/tests/ui/privacy/privacy2.rs @@ -14,16 +14,20 @@ mod bar { } pub fn foo() {} +//~^ ERROR requires `sized` lang_item fn test1() { + //~^ ERROR requires `sized` lang_item use bar::foo; //~^ ERROR unresolved import `bar::foo` [E0432] //~| no `foo` in `bar` } fn test2() { + //~^ ERROR requires `sized` lang_item use bar::glob::foo; //~^ ERROR `foo` is private } fn main() {} +//~^ ERROR requires `sized` lang_item diff --git a/tests/ui/privacy/privacy2.stderr b/tests/ui/privacy/privacy2.stderr index 46bb9823dbf..39bab67a660 100644 --- a/tests/ui/privacy/privacy2.stderr +++ b/tests/ui/privacy/privacy2.stderr @@ -1,11 +1,11 @@ error[E0432]: unresolved import `bar::foo` - --> $DIR/privacy2.rs:19:9 + --> $DIR/privacy2.rs:21:9 | LL | use bar::foo; | ^^^^^^^^ no `foo` in `bar` error[E0603]: function import `foo` is private - --> $DIR/privacy2.rs:25:20 + --> $DIR/privacy2.rs:28:20 | LL | use bar::glob::foo; | ^^^ private function import @@ -22,8 +22,40 @@ LL | pub fn foo() {} | ^^^^^^^^^^^^ you could import this directly error: requires `sized` lang_item + --> $DIR/privacy2.rs:16:14 + | +LL | pub fn foo() {} + | ^^ + +error: requires `sized` lang_item + --> $DIR/privacy2.rs:19:12 + | +LL | fn test1() { + | ____________^ +LL | | +LL | | use bar::foo; +... | +LL | | } + | |_^ + +error: requires `sized` lang_item + --> $DIR/privacy2.rs:26:12 + | +LL | fn test2() { + | ____________^ +LL | | +LL | | use bar::glob::foo; +LL | | +LL | | } + | |_^ + +error: requires `sized` lang_item + --> $DIR/privacy2.rs:32:11 + | +LL | fn main() {} + | ^^ -error: aborting due to 3 previous errors +error: aborting due to 6 previous errors Some errors have detailed explanations: E0432, E0603. For more information about an error, try `rustc --explain E0432`. diff --git a/tests/ui/privacy/privacy3.rs b/tests/ui/privacy/privacy3.rs index 6298a6bc8cf..2bb3c1b3c61 100644 --- a/tests/ui/privacy/privacy3.rs +++ b/tests/ui/privacy/privacy3.rs @@ -11,12 +11,15 @@ mod bar { mod glob { fn gpriv() {} + //~^ ERROR requires `sized` lang_item } } pub fn foo() {} +//~^ ERROR requires `sized` lang_item fn test1() { + //~^ ERROR requires `sized` lang_item use bar::gpriv; //~^ ERROR unresolved import `bar::gpriv` [E0432] //~| no `gpriv` in `bar` @@ -27,3 +30,4 @@ fn test1() { } fn main() {} +//~^ ERROR requires `sized` lang_item diff --git a/tests/ui/privacy/privacy3.stderr b/tests/ui/privacy/privacy3.stderr index df66c84751b..06a287d35ea 100644 --- a/tests/ui/privacy/privacy3.stderr +++ b/tests/ui/privacy/privacy3.stderr @@ -1,11 +1,39 @@ error[E0432]: unresolved import `bar::gpriv` - --> $DIR/privacy3.rs:20:9 + --> $DIR/privacy3.rs:23:9 | LL | use bar::gpriv; | ^^^^^^^^^^ no `gpriv` in `bar` error: requires `sized` lang_item + --> $DIR/privacy3.rs:18:14 + | +LL | pub fn foo() {} + | ^^ + +error: requires `sized` lang_item + --> $DIR/privacy3.rs:21:12 + | +LL | fn test1() { + | ____________^ +LL | | +LL | | use bar::gpriv; +... | +LL | | gpriv(); +LL | | } + | |_^ + +error: requires `sized` lang_item + --> $DIR/privacy3.rs:32:11 + | +LL | fn main() {} + | ^^ + +error: requires `sized` lang_item + --> $DIR/privacy3.rs:13:20 + | +LL | fn gpriv() {} + | ^^ -error: aborting due to 2 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0432`. diff --git a/tests/ui/privacy/sealed-traits/re-exported-trait.stderr b/tests/ui/privacy/sealed-traits/re-exported-trait.stderr index 6e2f36e3f38..368389af0b9 100644 --- a/tests/ui/privacy/sealed-traits/re-exported-trait.stderr +++ b/tests/ui/privacy/sealed-traits/re-exported-trait.stderr @@ -11,8 +11,9 @@ LL | mod b { | ^^^^^ help: consider importing this trait through its public re-export instead | -LL | impl a::Trait for S {} - | ~~~~~~~~ +LL - impl a::b::Trait for S {} +LL + impl a::Trait for S {} + | error: aborting due to 1 previous error diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr index 1e28b9fbd86..b651348de29 100644 --- a/tests/ui/privacy/suggest-box-new.stderr +++ b/tests/ui/privacy/suggest-box-new.stderr @@ -10,17 +10,20 @@ LL | let _ = std::collections::HashMap(); help: you might have meant to use an associated function to build this type | LL | let _ = std::collections::HashMap::new(); - | ~~~~~~~ -LL | let _ = std::collections::HashMap::with_capacity(_); - | ~~~~~~~~~~~~~~~~~~ -LL | let _ = std::collections::HashMap::with_hasher(_); - | ~~~~~~~~~~~~~~~~ -LL | let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++ +LL - let _ = std::collections::HashMap(); +LL + let _ = std::collections::HashMap::with_capacity(_); + | +LL - let _ = std::collections::HashMap(); +LL + let _ = std::collections::HashMap::with_hasher(_); + | +LL - let _ = std::collections::HashMap(); +LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); + | help: consider using the `Default` trait | LL | let _ = <std::collections::HashMap as std::default::Default>::default(); - | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | + ++++++++++++++++++++++++++++++++++ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/suggest-box-new.rs:8:19 @@ -36,19 +39,36 @@ note: constructor is not visible here due to private fields = note: private field help: you might have meant to use an associated function to build this type | -LL | wtf: Some(Box::new(_)), - | ~~~~~~~~ -LL | wtf: Some(Box::new_uninit()), - | ~~~~~~~~~~~~~~ -LL | wtf: Some(Box::new_zeroed()), - | ~~~~~~~~~~~~~~ -LL | wtf: Some(Box::new_in(_, _)), - | ~~~~~~~~~~~~~~ +LL - wtf: Some(Box(U { +LL - wtf: None, +LL - x: (), +LL - })), +LL + wtf: Some(Box::new(_)), + | +LL - wtf: Some(Box(U { +LL - wtf: None, +LL - x: (), +LL - })), +LL + wtf: Some(Box::new_uninit()), + | +LL - wtf: Some(Box(U { +LL - wtf: None, +LL - x: (), +LL - })), +LL + wtf: Some(Box::new_zeroed()), + | +LL - wtf: Some(Box(U { +LL - wtf: None, +LL - x: (), +LL - })), +LL + wtf: Some(Box::new_in(_, _)), + | and 12 other candidates help: consider using the `Default` trait | -LL | wtf: Some(<Box as std::default::Default>::default()), - | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - wtf: Some(Box(U { +LL + wtf: Some(<Box as std::default::Default>::default()), + | error: cannot construct `HashMap<_, _, _>` with struct literal syntax due to private fields --> $DIR/suggest-box-new.rs:16:13 @@ -59,18 +79,23 @@ LL | let _ = std::collections::HashMap {}; = note: private field `base` that was not provided help: you might have meant to use an associated function to build this type | -LL | let _ = std::collections::HashMap::new(); - | ~~~~~~~ -LL | let _ = std::collections::HashMap::with_capacity(_); - | ~~~~~~~~~~~~~~~~~~ -LL | let _ = std::collections::HashMap::with_hasher(_); - | ~~~~~~~~~~~~~~~~ -LL | let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = std::collections::HashMap {}; +LL + let _ = std::collections::HashMap::new(); + | +LL - let _ = std::collections::HashMap {}; +LL + let _ = std::collections::HashMap::with_capacity(_); + | +LL - let _ = std::collections::HashMap {}; +LL + let _ = std::collections::HashMap::with_hasher(_); + | +LL - let _ = std::collections::HashMap {}; +LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); + | help: consider using the `Default` trait | -LL | let _ = <std::collections::HashMap as std::default::Default>::default(); - | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = std::collections::HashMap {}; +LL + let _ = <std::collections::HashMap as std::default::Default>::default(); + | error: cannot construct `Box<_, _>` with struct literal syntax due to private fields --> $DIR/suggest-box-new.rs:18:13 @@ -81,19 +106,24 @@ LL | let _ = Box {}; = note: private fields `0` and `1` that were not provided help: you might have meant to use an associated function to build this type | -LL | let _ = Box::new(_); - | ~~~~~~~~ -LL | let _ = Box::new_uninit(); - | ~~~~~~~~~~~~~~ -LL | let _ = Box::new_zeroed(); - | ~~~~~~~~~~~~~~ -LL | let _ = Box::new_in(_, _); - | ~~~~~~~~~~~~~~ +LL - let _ = Box {}; +LL + let _ = Box::new(_); + | +LL - let _ = Box {}; +LL + let _ = Box::new_uninit(); + | +LL - let _ = Box {}; +LL + let _ = Box::new_zeroed(); + | +LL - let _ = Box {}; +LL + let _ = Box::new_in(_, _); + | and 12 other candidates help: consider using the `Default` trait | -LL | let _ = <Box as std::default::Default>::default(); - | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = Box {}; +LL + let _ = <Box as std::default::Default>::default(); + | error: aborting due to 4 previous errors diff --git a/tests/ui/privacy/suggest-making-field-public.stderr b/tests/ui/privacy/suggest-making-field-public.stderr index e92e9aae310..3e52232dd59 100644 --- a/tests/ui/privacy/suggest-making-field-public.stderr +++ b/tests/ui/privacy/suggest-making-field-public.stderr @@ -14,8 +14,9 @@ LL | pub struct A(pub(self)String); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the field publicly accessible | -LL | pub struct A(pub String); - | ~~~ +LL - pub struct A(pub(self)String); +LL + pub struct A(pub String); + | error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/suggest-making-field-public.rs:9:9 @@ -30,8 +31,9 @@ LL | pub struct A(pub(self)String); | ^^^^^^^^^^^^^^^ private field help: consider making the field publicly accessible | -LL | pub struct A(pub String); - | ~~~ +LL - pub struct A(pub(self)String); +LL + pub struct A(pub String); + | error: aborting due to 2 previous errors diff --git a/tests/ui/privacy/sysroot-private.default.stderr b/tests/ui/privacy/sysroot-private.default.stderr index 845d4558d13..692b1bbd4db 100644 --- a/tests/ui/privacy/sysroot-private.default.stderr +++ b/tests/ui/privacy/sysroot-private.default.stderr @@ -1,11 +1,11 @@ error[E0405]: cannot find trait `Equivalent` in this scope - --> $DIR/sysroot-private.rs:26:18 + --> $DIR/sysroot-private.rs:27:18 | LL | trait Trait2<K>: Equivalent<K> {} | ^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `K` in this scope - --> $DIR/sysroot-private.rs:31:35 + --> $DIR/sysroot-private.rs:32:35 | LL | fn trait_member<T>(val: &T, key: &K) -> bool { | - ^ @@ -14,21 +14,22 @@ LL | fn trait_member<T>(val: &T, key: &K) -> bool { | help: a type parameter with a similar name exists | -LL | fn trait_member<T>(val: &T, key: &T) -> bool { - | ~ +LL - fn trait_member<T>(val: &T, key: &K) -> bool { +LL + fn trait_member<T>(val: &T, key: &T) -> bool { + | help: you might be missing a type parameter | LL | fn trait_member<T, K>(val: &T, key: &K) -> bool { | +++ error[E0220]: associated type `ExpressionStack` not found for `Trait` - --> $DIR/sysroot-private.rs:21:31 + --> $DIR/sysroot-private.rs:22:31 | LL | type AssociatedTy = dyn Trait<ExpressionStack = i32, Bar = i32>; | ^^^^^^^^^^^^^^^ help: `Trait` has the following associated type: `Bar` error[E0425]: cannot find function `memchr2` in this scope - --> $DIR/sysroot-private.rs:39:5 + --> $DIR/sysroot-private.rs:40:5 | LL | memchr2(b'a', b'b', buf) | ^^^^^^^ not found in this scope diff --git a/tests/ui/privacy/sysroot-private.rs b/tests/ui/privacy/sysroot-private.rs index 67ab67c7f5c..86818574592 100644 --- a/tests/ui/privacy/sysroot-private.rs +++ b/tests/ui/privacy/sysroot-private.rs @@ -7,6 +7,7 @@ //! of `std`'s dependencies, but may not be robust against dependency upgrades/changes. //@ only-unix Windows sysroots seem to not expose this dependency +//@ ignore-emscripten neither does Emscripten //@ revisions: default rustc_private_enabled // Enabling `rustc_private` should `std`'s dependencies accessible, so they should show up diff --git a/tests/ui/privacy/sysroot-private.rustc_private_enabled.stderr b/tests/ui/privacy/sysroot-private.rustc_private_enabled.stderr index 98e6922428a..dc2d890a082 100644 --- a/tests/ui/privacy/sysroot-private.rustc_private_enabled.stderr +++ b/tests/ui/privacy/sysroot-private.rustc_private_enabled.stderr @@ -1,11 +1,11 @@ error[E0405]: cannot find trait `Equivalent` in this scope - --> $DIR/sysroot-private.rs:26:18 + --> $DIR/sysroot-private.rs:27:18 | LL | trait Trait2<K>: Equivalent<K> {} | ^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `K` in this scope - --> $DIR/sysroot-private.rs:31:35 + --> $DIR/sysroot-private.rs:32:35 | LL | fn trait_member<T>(val: &T, key: &K) -> bool { | - ^ @@ -14,21 +14,22 @@ LL | fn trait_member<T>(val: &T, key: &K) -> bool { | help: a type parameter with a similar name exists | -LL | fn trait_member<T>(val: &T, key: &T) -> bool { - | ~ +LL - fn trait_member<T>(val: &T, key: &K) -> bool { +LL + fn trait_member<T>(val: &T, key: &T) -> bool { + | help: you might be missing a type parameter | LL | fn trait_member<T, K>(val: &T, key: &K) -> bool { | +++ error[E0220]: associated type `ExpressionStack` not found for `Trait` - --> $DIR/sysroot-private.rs:21:31 + --> $DIR/sysroot-private.rs:22:31 | LL | type AssociatedTy = dyn Trait<ExpressionStack = i32, Bar = i32>; | ^^^^^^^^^^^^^^^ there is an associated type `ExpressionStack` in the trait `gimli::read::op::EvaluationStorage` error[E0425]: cannot find function `memchr2` in this scope - --> $DIR/sysroot-private.rs:39:5 + --> $DIR/sysroot-private.rs:40:5 | LL | memchr2(b'a', b'b', buf) | ^^^^^^^ not found in this scope diff --git a/tests/ui/proc-macro/disappearing-resolution.stderr b/tests/ui/proc-macro/disappearing-resolution.stderr index e66f721444f..734e0cd2ab6 100644 --- a/tests/ui/proc-macro/disappearing-resolution.stderr +++ b/tests/ui/proc-macro/disappearing-resolution.stderr @@ -22,8 +22,9 @@ LL | pub fn empty_derive(_: TokenStream) -> TokenStream { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ you could import this directly help: import `Empty` directly | -LL | use test_macros::Empty; - | ~~~~~~~~~~~~~~~~~~ +LL - use m::Empty; +LL + use test_macros::Empty; + | error: aborting due to 2 previous errors diff --git a/tests/ui/proc-macro/inner-attrs.stderr b/tests/ui/proc-macro/inner-attrs.stderr index 3ab180be821..8b5fec1b4c3 100644 --- a/tests/ui/proc-macro/inner-attrs.stderr +++ b/tests/ui/proc-macro/inner-attrs.stderr @@ -26,7 +26,7 @@ warning: extern declarations without an explicit ABI are deprecated --> $DIR/inner-attrs.rs:82:1 | LL | extern { - | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` + | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | = note: `#[warn(missing_abi)]` on by default diff --git a/tests/ui/proc-macro/issue-59191-replace-root-with-fn.stderr b/tests/ui/proc-macro/issue-59191-replace-root-with-fn.stderr index 08e679a7c55..2d0c92ff297 100644 --- a/tests/ui/proc-macro/issue-59191-replace-root-with-fn.stderr +++ b/tests/ui/proc-macro/issue-59191-replace-root-with-fn.stderr @@ -1,4 +1,10 @@ error: requires `sized` lang_item + --> $DIR/issue-59191-replace-root-with-fn.rs:9:1 + | +LL | #![issue_59191::no_main] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the attribute macro `issue_59191::no_main` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/proc-macro/issue-66286.stderr b/tests/ui/proc-macro/issue-66286.stderr index c92bed1b563..fe6bec22164 100644 --- a/tests/ui/proc-macro/issue-66286.stderr +++ b/tests/ui/proc-macro/issue-66286.stderr @@ -6,8 +6,9 @@ LL | pub extern "C" fn foo(_: Vec(u32)) -> u32 { | help: use angle brackets instead | -LL | pub extern "C" fn foo(_: Vec<u32>) -> u32 { - | ~ ~ +LL - pub extern "C" fn foo(_: Vec(u32)) -> u32 { +LL + pub extern "C" fn foo(_: Vec<u32>) -> u32 { + | error: aborting due to 1 previous error diff --git a/tests/ui/proc-macro/issue-86781-bad-inner-doc.stderr b/tests/ui/proc-macro/issue-86781-bad-inner-doc.stderr index aeb824303e7..835648ab435 100644 --- a/tests/ui/proc-macro/issue-86781-bad-inner-doc.stderr +++ b/tests/ui/proc-macro/issue-86781-bad-inner-doc.stderr @@ -9,8 +9,9 @@ LL | pub struct Foo; | help: to annotate the struct, change the doc comment from inner to outer style | -LL | /// Inner doc comment - | ~ +LL - //! Inner doc comment +LL + /// Inner doc comment + | error: aborting due to 1 previous error diff --git a/tests/ui/process/process-sigpipe.rs b/tests/ui/process/process-sigpipe.rs index 453e53379fc..3ecf271599d 100644 --- a/tests/ui/process/process-sigpipe.rs +++ b/tests/ui/process/process-sigpipe.rs @@ -9,9 +9,9 @@ // Make sure that these behaviors don't get inherited to children // spawned via std::process, since they're needed for traditional UNIX // filter behavior. -// This test checks that `while echo y ; do : ; done | head` terminates -// (instead of running forever), and that it does not print an error -// message about a broken pipe. +// This test checks that `yes` or `while echo y ; do : ; done | head` +// terminates (instead of running forever), and that it does not print an +// error message about a broken pipe. //@ ignore-vxworks no 'sh' //@ ignore-fuchsia no 'sh' @@ -22,14 +22,21 @@ use std::process; use std::thread; fn main() { - // Just in case `yes` doesn't check for EPIPE... + // Just in case `yes` or `while-echo` doesn't check for EPIPE... thread::spawn(|| { thread::sleep_ms(5000); process::exit(1); }); + // QNX Neutrino does not have `yes`. Therefore, use `while-echo` for `nto` + // and `yes` for other platforms. + let command = if cfg!(target_os = "nto") { + "while echo y ; do : ; done | head" + } else { + "yes | head" + }; let output = process::Command::new("sh") .arg("-c") - .arg("while echo y ; do : ; done | head") + .arg(command) .output() .unwrap(); assert!(output.status.success()); diff --git a/tests/ui/process/win-creation-flags.rs b/tests/ui/process/win-creation-flags.rs new file mode 100644 index 00000000000..0c7c6883d68 --- /dev/null +++ b/tests/ui/process/win-creation-flags.rs @@ -0,0 +1,51 @@ +// Test that windows `creation_flags` extension to `Command` works. + +//@ run-pass +//@ only-windows +//@ needs-subprocess + +use std::env; +use std::os::windows::process::CommandExt; +use std::process::{Command, exit}; + +fn main() { + if env::args().skip(1).any(|s| s == "--child") { + child(); + } else { + parent(); + } +} + +fn parent() { + let exe = env::current_exe().unwrap(); + + // Use the DETACH_PROCESS to create a subprocess that isn't attached to the console. + // The subprocess's exit status will be 0 if it's detached. + let status = Command::new(&exe) + .arg("--child") + .creation_flags(DETACH_PROCESS) + .spawn() + .unwrap() + .wait() + .unwrap(); + assert_eq!(status.code(), Some(0)); + + // Try without DETACH_PROCESS to ensure this test works. + let status = Command::new(&exe).arg("--child").spawn().unwrap().wait().unwrap(); + assert_eq!(status.code(), Some(1)); +} + +// exits with 1 if the console is attached or 0 otherwise +fn child() { + // Get the attached console's code page. + // This will fail (return 0) if no console is attached. + let has_console = GetConsoleCP() != 0; + exit(has_console as i32); +} + +// Windows API definitions. +const DETACH_PROCESS: u32 = 0x00000008; +#[link(name = "kernel32")] +unsafe extern "system" { + safe fn GetConsoleCP() -> u32; +} diff --git a/tests/ui/process/win-proc-thread-attributes.rs b/tests/ui/process/win-proc-thread-attributes.rs new file mode 100644 index 00000000000..91bb0b17e95 --- /dev/null +++ b/tests/ui/process/win-proc-thread-attributes.rs @@ -0,0 +1,118 @@ +// Tests proc thread attributes by spawning a process with a custom parent process, +// then comparing the parent process ID with the expected parent process ID. + +//@ run-pass +//@ only-windows +//@ needs-subprocess +//@ edition: 2021 + +#![feature(windows_process_extensions_raw_attribute)] + +use std::os::windows::io::AsRawHandle; +use std::os::windows::process::{CommandExt, ProcThreadAttributeList}; +use std::process::{Child, Command}; +use std::{env, mem, ptr, thread, time}; + +// Make a best effort to ensure child processes always exit. +struct ProcessDropGuard(Child); +impl Drop for ProcessDropGuard { + fn drop(&mut self) { + let _ = self.0.kill(); + } +} + +fn main() { + if env::args().skip(1).any(|s| s == "--child") { + child(); + } else { + parent(); + } +} + +fn parent() { + let exe = env::current_exe().unwrap(); + + let (fake_parent_id, child_parent_id) = { + // Create a process to be our fake parent process. + let fake_parent = Command::new(&exe).arg("--child").spawn().unwrap(); + let fake_parent = ProcessDropGuard(fake_parent); + let parent_handle = fake_parent.0.as_raw_handle(); + + // Create another process with the parent process set to the fake. + let mut attribute_list = ProcThreadAttributeList::build() + .attribute(PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, &parent_handle) + .finish() + .unwrap(); + let child = + Command::new(&exe).arg("--child").spawn_with_attributes(&mut attribute_list).unwrap(); + let child = ProcessDropGuard(child); + + // Return the fake's process id and the child's parent's id. + (process_info(&fake_parent.0).process_id(), process_info(&child.0).parent_id()) + }; + + assert_eq!(fake_parent_id, child_parent_id); +} + +// A process that stays running until killed. +fn child() { + // Don't wait forever if something goes wrong. + thread::sleep(time::Duration::from_secs(60)); +} + +fn process_info(child: &Child) -> PROCESS_BASIC_INFORMATION { + unsafe { + let mut info: PROCESS_BASIC_INFORMATION = mem::zeroed(); + let result = NtQueryInformationProcess( + child.as_raw_handle(), + ProcessBasicInformation, + ptr::from_mut(&mut info).cast(), + mem::size_of_val(&info).try_into().unwrap(), + ptr::null_mut(), + ); + assert_eq!(result, 0); + info + } +} + +// Windows API +mod winapi { + #![allow(nonstandard_style)] + use std::ffi::c_void; + + pub type HANDLE = *mut c_void; + type NTSTATUS = i32; + type PROCESSINFOCLASS = i32; + + pub const ProcessBasicInformation: i32 = 0; + pub const PROC_THREAD_ATTRIBUTE_PARENT_PROCESS: usize = 0x00020000; + #[repr(C)] + pub struct PROCESS_BASIC_INFORMATION { + pub ExitStatus: NTSTATUS, + pub PebBaseAddress: *mut (), + pub AffinityMask: usize, + pub BasePriority: i32, + pub UniqueProcessId: usize, + pub InheritedFromUniqueProcessId: usize, + } + impl PROCESS_BASIC_INFORMATION { + pub fn parent_id(&self) -> usize { + self.InheritedFromUniqueProcessId + } + pub fn process_id(&self) -> usize { + self.UniqueProcessId + } + } + + #[link(name = "ntdll")] + extern "system" { + pub fn NtQueryInformationProcess( + ProcessHandle: HANDLE, + ProcessInformationClass: PROCESSINFOCLASS, + ProcessInformation: *mut c_void, + ProcessInformationLength: u32, + ReturnLength: *mut u32, + ) -> NTSTATUS; + } +} +use winapi::*; diff --git a/tests/ui/pub/pub-ident-fn-or-struct.stderr b/tests/ui/pub/pub-ident-fn-or-struct.stderr index ceadc510c63..99c8e5754ef 100644 --- a/tests/ui/pub/pub-ident-fn-or-struct.stderr +++ b/tests/ui/pub/pub-ident-fn-or-struct.stderr @@ -7,7 +7,7 @@ LL | pub S (foo) bar help: if you meant to call a macro, try | LL | pub S! (foo) bar - | ~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/pub/pub-restricted.stderr b/tests/ui/pub/pub-restricted.stderr index fc177aa2033..6c913938bb8 100644 --- a/tests/ui/pub/pub-restricted.stderr +++ b/tests/ui/pub/pub-restricted.stderr @@ -11,7 +11,7 @@ LL | pub (a) fn afn() {} help: make this visible only to module `a` with `in` | LL | pub (in a) fn afn() {} - | ~~~~ + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:4:6 @@ -26,7 +26,7 @@ LL | pub (b) fn bfn() {} help: make this visible only to module `b` with `in` | LL | pub (in b) fn bfn() {} - | ~~~~ + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:5:6 @@ -41,7 +41,7 @@ LL | pub (crate::a) fn cfn() {} help: make this visible only to module `crate::a` with `in` | LL | pub (in crate::a) fn cfn() {} - | ~~~~~~~~~~~ + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:22:14 @@ -56,7 +56,7 @@ LL | pub (a) invalid: usize, help: make this visible only to module `a` with `in` | LL | pub (in a) invalid: usize, - | ~~~~ + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:31:6 @@ -71,7 +71,7 @@ LL | pub (xyz) fn xyz() {} help: make this visible only to module `xyz` with `in` | LL | pub (in xyz) fn xyz() {} - | ~~~~~~ + | ++ error[E0742]: visibilities can only be restricted to ancestor modules --> $DIR/pub-restricted.rs:23:17 diff --git a/tests/ui/qualified/qualified-path-params-2.stderr b/tests/ui/qualified/qualified-path-params-2.stderr index 56644bdd46a..6641e81013f 100644 --- a/tests/ui/qualified/qualified-path-params-2.stderr +++ b/tests/ui/qualified/qualified-path-params-2.stderr @@ -6,8 +6,9 @@ LL | type A = <S as Tr>::A::f<u8>; | help: if there were a trait named `Example` with associated type `f` implemented for `<S as Tr>::A`, you could use the fully-qualified path | -LL | type A = <<S as Tr>::A as Example>::f; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - type A = <S as Tr>::A::f<u8>; +LL + type A = <<S as Tr>::A as Example>::f; + | error: aborting due to 1 previous error diff --git a/tests/ui/range/issue-54505-no-literals.stderr b/tests/ui/range/issue-54505-no-literals.stderr index 5894bb6ba55..c6d4384bcd3 100644 --- a/tests/ui/range/issue-54505-no-literals.stderr +++ b/tests/ui/range/issue-54505-no-literals.stderr @@ -47,7 +47,7 @@ LL | take_range(std::ops::RangeFrom { start: 1 }); | arguments to this function are incorrect | = note: expected reference `&_` - found struct `RangeFrom<{integer}>` + found struct `std::ops::RangeFrom<{integer}>` note: function defined here --> $DIR/issue-54505-no-literals.rs:12:4 | @@ -67,7 +67,7 @@ LL | take_range(::std::ops::RangeFrom { start: 1 }); | arguments to this function are incorrect | = note: expected reference `&_` - found struct `RangeFrom<{integer}>` + found struct `std::ops::RangeFrom<{integer}>` note: function defined here --> $DIR/issue-54505-no-literals.rs:12:4 | @@ -127,7 +127,7 @@ LL | take_range(std::ops::RangeInclusive::new(0, 1)); | arguments to this function are incorrect | = note: expected reference `&_` - found struct `RangeInclusive<{integer}>` + found struct `std::ops::RangeInclusive<{integer}>` note: function defined here --> $DIR/issue-54505-no-literals.rs:12:4 | @@ -147,7 +147,7 @@ LL | take_range(::std::ops::RangeInclusive::new(0, 1)); | arguments to this function are incorrect | = note: expected reference `&_` - found struct `RangeInclusive<{integer}>` + found struct `std::ops::RangeInclusive<{integer}>` note: function defined here --> $DIR/issue-54505-no-literals.rs:12:4 | diff --git a/tests/ui/range/issue-54505.stderr b/tests/ui/range/issue-54505.stderr index 291e097e865..8b669b2910f 100644 --- a/tests/ui/range/issue-54505.stderr +++ b/tests/ui/range/issue-54505.stderr @@ -27,7 +27,7 @@ LL | take_range(1..); | arguments to this function are incorrect | = note: expected reference `&_` - found struct `RangeFrom<{integer}>` + found struct `std::ops::RangeFrom<{integer}>` note: function defined here --> $DIR/issue-54505.rs:10:4 | @@ -72,7 +72,7 @@ LL | take_range(0..=1); | arguments to this function are incorrect | = note: expected reference `&_` - found struct `RangeInclusive<{integer}>` + found struct `std::ops::RangeInclusive<{integer}>` note: function defined here --> $DIR/issue-54505.rs:10:4 | diff --git a/tests/ui/range/range-1.stderr b/tests/ui/range/range-1.stderr index f77601bc43c..37669dd3f47 100644 --- a/tests/ui/range/range-1.stderr +++ b/tests/ui/range/range-1.stderr @@ -30,7 +30,7 @@ LL | let range = *arr..; | ^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[{integer}]` -note: required by an implicit `Sized` bound in `RangeFrom` +note: required by an implicit `Sized` bound in `std::ops::RangeFrom` --> $SRC_DIR/core/src/ops/range.rs:LL:COL error: aborting due to 3 previous errors diff --git a/tests/ui/recursion/recursion.rs b/tests/ui/recursion/recursion.rs index f3c633983b1..ce56fe974b7 100644 --- a/tests/ui/recursion/recursion.rs +++ b/tests/ui/recursion/recursion.rs @@ -1,6 +1,7 @@ //@ build-fail //@ compile-flags:-C overflow-checks=off -//@ normalize-stderr: ".nll/" -> "/" +// The regex below normalizes the long type file name to make it suitable for compare-modes. +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" enum Nil {NilValue} struct Cons<T> {head:isize, tail:T} diff --git a/tests/ui/recursion/recursion.stderr b/tests/ui/recursion/recursion.stderr index 7a9f04d4bd6..cb9f67ba741 100644 --- a/tests/ui/recursion/recursion.stderr +++ b/tests/ui/recursion/recursion.stderr @@ -1,15 +1,15 @@ error: reached the recursion limit while instantiating `test::<Cons<Cons<Cons<Cons<Cons<...>>>>>>` - --> $DIR/recursion.rs:18:11 + --> $DIR/recursion.rs:19:11 | LL | _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `test` defined here - --> $DIR/recursion.rs:16:1 + --> $DIR/recursion.rs:17:1 | LL | fn test<T:Dot> (n:isize, i:isize, first:T, second:T) ->isize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: the full type name has been written to '$TEST_BUILD_DIR/recursion/recursion/recursion.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' error: aborting due to 1 previous error diff --git a/tests/ui/regions/region-object-lifetime-in-coercion.stderr b/tests/ui/regions/region-object-lifetime-in-coercion.stderr index b5bb08c73c8..3880ae82283 100644 --- a/tests/ui/regions/region-object-lifetime-in-coercion.stderr +++ b/tests/ui/regions/region-object-lifetime-in-coercion.stderr @@ -8,12 +8,14 @@ LL | let x: Box<dyn Foo + 'static> = Box::new(v); | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` | -LL | fn a(v: &[u8]) -> Box<dyn Foo + '_> { - | ~~ +LL - fn a(v: &[u8]) -> Box<dyn Foo + 'static> { +LL + fn a(v: &[u8]) -> Box<dyn Foo + '_> { + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn a(v: &'static [u8]) -> Box<dyn Foo + 'static> { - | ~~~~~~~~~~~~~ +LL - fn a(v: &[u8]) -> Box<dyn Foo + 'static> { +LL + fn a(v: &'static [u8]) -> Box<dyn Foo + 'static> { + | error: lifetime may not live long enough --> $DIR/region-object-lifetime-in-coercion.rs:14:5 @@ -25,12 +27,14 @@ LL | Box::new(v) | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` | -LL | fn b(v: &[u8]) -> Box<dyn Foo + '_> { - | ~~ +LL - fn b(v: &[u8]) -> Box<dyn Foo + 'static> { +LL + fn b(v: &[u8]) -> Box<dyn Foo + '_> { + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn b(v: &'static [u8]) -> Box<dyn Foo + 'static> { - | ~~~~~~~~~~~~~ +LL - fn b(v: &[u8]) -> Box<dyn Foo + 'static> { +LL + fn b(v: &'static [u8]) -> Box<dyn Foo + 'static> { + | error: lifetime may not live long enough --> $DIR/region-object-lifetime-in-coercion.rs:21:5 diff --git a/tests/ui/regions/regions-close-object-into-object-2.stderr b/tests/ui/regions/regions-close-object-into-object-2.stderr index aacb5ea4e87..54364ef0821 100644 --- a/tests/ui/regions/regions-close-object-into-object-2.stderr +++ b/tests/ui/regions/regions-close-object-into-object-2.stderr @@ -8,12 +8,14 @@ LL | Box::new(B(&*v)) as Box<dyn X> | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` | -LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'a> { - | ~~ +LL - fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> { +LL + fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'a> { + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn g<'a, T: 'static>(v: Box<(dyn A<T> + 'static)>) -> Box<dyn X + 'static> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'static> { +LL + fn g<'a, T: 'static>(v: Box<(dyn A<T> + 'static)>) -> Box<dyn X + 'static> { + | error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-2.rs:9:5 diff --git a/tests/ui/regions/regions-close-object-into-object-4.stderr b/tests/ui/regions/regions-close-object-into-object-4.stderr index f6a79be0947..d119ec57e98 100644 --- a/tests/ui/regions/regions-close-object-into-object-4.stderr +++ b/tests/ui/regions/regions-close-object-into-object-4.stderr @@ -50,12 +50,14 @@ LL | Box::new(B(&*v)) as Box<dyn X> | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` | -LL | fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'a> { - | ~~ +LL - fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> { +LL + fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'a> { + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn i<'a, T, U>(v: Box<(dyn A<U> + 'static)>) -> Box<dyn X + 'static> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> { +LL + fn i<'a, T, U>(v: Box<(dyn A<U> + 'static)>) -> Box<dyn X + 'static> { + | error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-4.rs:9:5 diff --git a/tests/ui/regions/regions-normalize-in-where-clause-list.stderr b/tests/ui/regions/regions-normalize-in-where-clause-list.stderr index 2e76333e26f..ca9ceeeeff3 100644 --- a/tests/ui/regions/regions-normalize-in-where-clause-list.stderr +++ b/tests/ui/regions/regions-normalize-in-where-clause-list.stderr @@ -1,4 +1,4 @@ -error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements --> $DIR/regions-normalize-in-where-clause-list.rs:24:4 | LL | fn bar<'a, 'b>() @@ -24,4 +24,4 @@ LL | fn bar<'a, 'b>() error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0495`. +For more information about this error, try `rustc --explain E0803`. diff --git a/tests/ui/regions/regions-proc-bound-capture.stderr b/tests/ui/regions/regions-proc-bound-capture.stderr index 3fe497bf2e9..3149cd8c9a1 100644 --- a/tests/ui/regions/regions-proc-bound-capture.stderr +++ b/tests/ui/regions/regions-proc-bound-capture.stderr @@ -9,12 +9,14 @@ LL | Box::new(move || { *x }) | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `x` | -LL | fn static_proc(x: &isize) -> Box<dyn FnMut() -> (isize) + '_> { - | ~~ +LL - fn static_proc(x: &isize) -> Box<dyn FnMut() -> (isize) + 'static> { +LL + fn static_proc(x: &isize) -> Box<dyn FnMut() -> (isize) + '_> { + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn static_proc(x: &'static isize) -> Box<dyn FnMut() -> (isize) + 'static> { - | ~~~~~~~~~~~~~~ +LL - fn static_proc(x: &isize) -> Box<dyn FnMut() -> (isize) + 'static> { +LL + fn static_proc(x: &'static isize) -> Box<dyn FnMut() -> (isize) + 'static> { + | error: aborting due to 1 previous error diff --git a/tests/ui/regions/resolve-re-error-ice.stderr b/tests/ui/regions/resolve-re-error-ice.stderr index 41c5f0fa92e..f463a97c5bc 100644 --- a/tests/ui/regions/resolve-re-error-ice.stderr +++ b/tests/ui/regions/resolve-re-error-ice.stderr @@ -1,4 +1,4 @@ -error[E0495]: cannot infer an appropriate lifetime for lifetime parameter '_ in generic type due to conflicting requirements +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter '_ in generic type due to conflicting requirements --> $DIR/resolve-re-error-ice.rs:12:5 | LL | fn key_set(&self) -> Subject<'a, Keys<K, V>, (), R> { @@ -34,4 +34,4 @@ LL | struct Subject<'a, T, V, R>(PhantomData<(&'a T, V, R)>); error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0495`. +For more information about this error, try `rustc --explain E0803`. diff --git a/tests/ui/repeat-expr/repeat_count.stderr b/tests/ui/repeat-expr/repeat_count.stderr index c4aebfb0e20..34e29e83666 100644 --- a/tests/ui/repeat-expr/repeat_count.stderr +++ b/tests/ui/repeat-expr/repeat_count.stderr @@ -6,8 +6,9 @@ LL | let a = [0; n]; | help: consider using `const` instead of `let` | -LL | const n: /* Type */ = 1; - | ~~~~~ ++++++++++++ +LL - let n = 1; +LL + const n: /* Type */ = 1; + | error[E0308]: mismatched types --> $DIR/repeat_count.rs:7:17 @@ -63,8 +64,9 @@ LL | let f = [0; 4u8]; | help: change the type of the numeric literal from `u8` to `usize` | -LL | let f = [0; 4usize]; - | ~~~~~ +LL - let f = [0; 4u8]; +LL + let f = [0; 4usize]; + | error: aborting due to 9 previous errors diff --git a/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr b/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr index 95eddbde9e6..ce2022374f7 100644 --- a/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr +++ b/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr @@ -6,8 +6,9 @@ LL | let a = ["a", 10]; | help: replace the comma with a semicolon to create an array | -LL | let a = ["a"; 10]; - | ~ +LL - let a = ["a", 10]; +LL + let a = ["a"; 10]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:20:20 @@ -17,8 +18,9 @@ LL | let b = [Type, size_b]; | help: replace the comma with a semicolon to create an array | -LL | let b = [Type; size_b]; - | ~ +LL - let b = [Type, size_b]; +LL + let b = [Type; size_b]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:25:20 @@ -48,8 +50,9 @@ LL | let f = ["f", get_size()]; | help: replace the comma with a semicolon to create an array | -LL | let f = ["f"; get_size()]; - | ~ +LL - let f = ["f", get_size()]; +LL + let f = ["f"; get_size()]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:40:19 @@ -65,8 +68,9 @@ LL | let g = vec![String::new(), 10]; | help: replace the comma with a semicolon to create a vector | -LL | let g = vec![String::new(); 10]; - | ~ +LL - let g = vec![String::new(), 10]; +LL + let g = vec![String::new(); 10]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:49:24 @@ -76,8 +80,9 @@ LL | let h = vec![Type, dyn_size]; | help: replace the comma with a semicolon to create a vector | -LL | let h = vec![Type; dyn_size]; - | ~ +LL - let h = vec![Type, dyn_size]; +LL + let h = vec![Type; dyn_size]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:53:24 @@ -87,8 +92,9 @@ LL | let i = vec![Type, get_dyn_size()]; | help: replace the comma with a semicolon to create a vector | -LL | let i = vec![Type; get_dyn_size()]; - | ~ +LL - let i = vec![Type, get_dyn_size()]; +LL + let i = vec![Type; get_dyn_size()]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:57:23 @@ -98,8 +104,9 @@ LL | let k = vec!['c', 10]; | help: replace the comma with a semicolon to create a vector | -LL | let k = vec!['c'; 10]; - | ~ +LL - let k = vec!['c', 10]; +LL + let k = vec!['c'; 10]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:61:24 diff --git a/tests/ui/repr/attr-usage-repr.rs b/tests/ui/repr/attr-usage-repr.rs index dc0d4f5be2e..d8515a12e05 100644 --- a/tests/ui/repr/attr-usage-repr.rs +++ b/tests/ui/repr/attr-usage-repr.rs @@ -16,18 +16,39 @@ struct SSimd([f64; 2]); struct SInt(f64, f64); #[repr(C)] -enum EExtern { A, B } +enum EExtern { + A, + B, +} #[repr(align(8))] -enum EAlign { A, B } +enum EAlign { + A, + B, +} #[repr(packed)] //~ ERROR: attribute should be applied to a struct -enum EPacked { A, B } +enum EPacked { + A, + B, +} #[repr(simd)] //~ ERROR: attribute should be applied to a struct -enum ESimd { A, B } +enum ESimd { + A, + B, +} #[repr(i8)] -enum EInt { A, B } +enum EInt { + A, + B, +} + +#[repr()] //~ attribute should be applied to a struct, enum, function, associated function, or union [E0517] +type SirThisIsAType = i32; + +#[repr()] +struct EmptyReprArgumentList(i32); fn main() {} diff --git a/tests/ui/repr/attr-usage-repr.stderr b/tests/ui/repr/attr-usage-repr.stderr index 42f65625a46..a25e68c483f 100644 --- a/tests/ui/repr/attr-usage-repr.stderr +++ b/tests/ui/repr/attr-usage-repr.stderr @@ -15,21 +15,35 @@ LL | struct SInt(f64, f64); | ---------------------- not an enum error[E0517]: attribute should be applied to a struct or union - --> $DIR/attr-usage-repr.rs:24:8 + --> $DIR/attr-usage-repr.rs:30:8 | -LL | #[repr(packed)] - | ^^^^^^ -LL | enum EPacked { A, B } - | --------------------- not a struct or union +LL | #[repr(packed)] + | ^^^^^^ +LL | / enum EPacked { +LL | | A, +LL | | B, +LL | | } + | |_- not a struct or union error[E0517]: attribute should be applied to a struct - --> $DIR/attr-usage-repr.rs:27:8 + --> $DIR/attr-usage-repr.rs:36:8 | -LL | #[repr(simd)] - | ^^^^ -LL | enum ESimd { A, B } - | ------------------- not a struct +LL | #[repr(simd)] + | ^^^^ +LL | / enum ESimd { +LL | | A, +LL | | B, +LL | | } + | |_- not a struct -error: aborting due to 4 previous errors +error[E0517]: attribute should be applied to a struct, enum, function, associated function, or union + --> $DIR/attr-usage-repr.rs:48:1 + | +LL | #[repr()] + | ^^^^^^^^^ +LL | type SirThisIsAType = i32; + | -------------------------- not a struct, enum, function, associated function, or union + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0517`. diff --git a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr index a0cdac3fa25..ef641eb5681 100644 --- a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr +++ b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr @@ -28,8 +28,9 @@ LL | _ => {} | help: you might have meant to pattern match against the value of similarly named constant `god` instead of introducing a new catch-all binding | -LL | god => {} - | ~~~ +LL - GOD => {} +LL + god => {} + | error: unreachable pattern --> $DIR/const-with-typo-in-pattern-binding.rs:30:9 @@ -42,8 +43,9 @@ LL | _ => {} | help: you might have meant to pattern match against the value of similarly named constant `GOOD` instead of introducing a new catch-all binding | -LL | GOOD => {} - | ~~~~ +LL - GOOOD => {} +LL + GOOD => {} + | error: unreachable pattern --> $DIR/const-with-typo-in-pattern-binding.rs:36:9 @@ -72,7 +74,7 @@ LL | _ => {} help: you might have meant to pattern match against the value of constant `ARCH` instead of introducing a new catch-all binding | LL | std::env::consts::ARCH => {} - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/resolve/issue-100365.stderr b/tests/ui/resolve/issue-100365.stderr index 2d9bab4304d..7a880c6f31a 100644 --- a/tests/ui/resolve/issue-100365.stderr +++ b/tests/ui/resolve/issue-100365.stderr @@ -6,8 +6,9 @@ LL | let addr = Into::<std::net::IpAddr>.into([127, 0, 0, 1]); | help: use the path separator to refer to an item | -LL | let addr = Into::<std::net::IpAddr>::into([127, 0, 0, 1]); - | ~~ +LL - let addr = Into::<std::net::IpAddr>.into([127, 0, 0, 1]); +LL + let addr = Into::<std::net::IpAddr>::into([127, 0, 0, 1]); + | error[E0423]: expected value, found trait `Into` --> $DIR/issue-100365.rs:6:13 @@ -17,8 +18,9 @@ LL | let _ = Into.into(()); | help: use the path separator to refer to an item | -LL | let _ = Into::into(()); - | ~~ +LL - let _ = Into.into(()); +LL + let _ = Into::into(()); + | error[E0423]: expected value, found trait `Into` --> $DIR/issue-100365.rs:10:13 @@ -28,8 +30,9 @@ LL | let _ = Into::<()>.into; | help: use the path separator to refer to an item | -LL | let _ = Into::<()>::into; - | ~~ +LL - let _ = Into::<()>.into; +LL + let _ = Into::<()>::into; + | error[E0423]: expected value, found trait `std::iter::Iterator` --> $DIR/issue-100365.rs:17:9 @@ -65,8 +68,9 @@ LL | let _ = create!(); = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | Into::<String>::into("") - | ~~ +LL - Into::<String>.into("") +LL + Into::<String>::into("") + | error: aborting due to 6 previous errors diff --git a/tests/ui/resolve/issue-101749.stderr b/tests/ui/resolve/issue-101749.stderr index fedbf182ee8..09e800ec7c3 100644 --- a/tests/ui/resolve/issue-101749.stderr +++ b/tests/ui/resolve/issue-101749.stderr @@ -7,8 +7,9 @@ LL | let _ = rect::area(); = help: you might be missing a crate named `rect` help: you may have meant to call an instance method | -LL | let _ = rect.area(); - | ~ +LL - let _ = rect::area(); +LL + let _ = rect.area(); + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-103202.stderr b/tests/ui/resolve/issue-103202.stderr index 87fa940ac3b..cf32efab981 100644 --- a/tests/ui/resolve/issue-103202.stderr +++ b/tests/ui/resolve/issue-103202.stderr @@ -6,8 +6,9 @@ LL | fn f(self: &S::x) {} | help: if there were a trait named `Example` with associated type `x` implemented for `S`, you could use the fully-qualified path | -LL | fn f(self: &<S as Example>::x) {} - | ~~~~~~~~~~~~~~~~~ +LL - fn f(self: &S::x) {} +LL + fn f(self: &<S as Example>::x) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-103474.stderr b/tests/ui/resolve/issue-103474.stderr index e48fb31eccc..717892921f1 100644 --- a/tests/ui/resolve/issue-103474.stderr +++ b/tests/ui/resolve/issue-103474.stderr @@ -6,8 +6,9 @@ LL | this.i | help: you might have meant to use `self` here instead | -LL | self.i - | ~~~~ +LL - this.i +LL + self.i + | help: if you meant to use `self`, you are also missing a `self` receiver argument | LL | fn needs_self(&self) { diff --git a/tests/ui/resolve/issue-112472-multi-generics-suggestion.stderr b/tests/ui/resolve/issue-112472-multi-generics-suggestion.stderr index f463e2dad2c..1ed6e68c333 100644 --- a/tests/ui/resolve/issue-112472-multi-generics-suggestion.stderr +++ b/tests/ui/resolve/issue-112472-multi-generics-suggestion.stderr @@ -6,8 +6,9 @@ LL | <DecodeLine as convert::TryFrom<String>>::Error: ParseError, | help: constrain the associated type to `ParseError` | -LL | DecodeLine: convert::TryFrom<String, Error = ParseError>, - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - <DecodeLine as convert::TryFrom<String>>::Error: ParseError, +LL + DecodeLine: convert::TryFrom<String, Error = ParseError>, + | error[E0404]: expected trait, found enum `ParseError` --> $DIR/issue-112472-multi-generics-suggestion.rs:25:45 @@ -17,8 +18,9 @@ LL | <DecodeLine as TryFrom<String>>::Error: ParseError, | help: constrain the associated type to `ParseError` | -LL | DecodeLine: TryFrom<String, Error = ParseError>, - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - <DecodeLine as TryFrom<String>>::Error: ParseError, +LL + DecodeLine: TryFrom<String, Error = ParseError>, + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/issue-18252.stderr b/tests/ui/resolve/issue-18252.stderr index 6cb9c1f1dd2..b22ad3f5225 100644 --- a/tests/ui/resolve/issue-18252.stderr +++ b/tests/ui/resolve/issue-18252.stderr @@ -6,8 +6,9 @@ LL | let f = Foo::Variant(42); | help: you might have meant to create a new value of the struct | -LL | let f = Foo::Variant { x: /* value */ }; - | ~~~~~~~~~~~~~~~~~~ +LL - let f = Foo::Variant(42); +LL + let f = Foo::Variant { x: /* value */ }; + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-22692.stderr b/tests/ui/resolve/issue-22692.stderr index be0634ebffc..546f12b35c1 100644 --- a/tests/ui/resolve/issue-22692.stderr +++ b/tests/ui/resolve/issue-22692.stderr @@ -6,8 +6,9 @@ LL | let _ = String.new(); | help: use the path separator to refer to an item | -LL | let _ = String::new(); - | ~~ +LL - let _ = String.new(); +LL + let _ = String::new(); + | error[E0423]: expected value, found struct `String` --> $DIR/issue-22692.rs:6:13 @@ -17,8 +18,9 @@ LL | let _ = String.default; | help: use the path separator to refer to an item | -LL | let _ = String::default; - | ~~ +LL - let _ = String.default; +LL + let _ = String::default; + | error[E0423]: expected value, found struct `Vec` --> $DIR/issue-22692.rs:10:13 @@ -28,8 +30,9 @@ LL | let _ = Vec::<()>.with_capacity(1); | help: use the path separator to refer to an item | -LL | let _ = Vec::<()>::with_capacity(1); - | ~~ +LL - let _ = Vec::<()>.with_capacity(1); +LL + let _ = Vec::<()>::with_capacity(1); + | error[E0423]: expected value, found struct `std::cell::Cell` --> $DIR/issue-22692.rs:17:9 @@ -43,8 +46,9 @@ LL | Type!().get(); = note: this error originates in the macro `Type` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | <Type!()>::get(); - | ~~~~~~~~~~~ +LL - Type!().get(); +LL + <Type!()>::get(); + | error[E0423]: expected value, found struct `std::cell::Cell` --> $DIR/issue-22692.rs:17:9 @@ -58,8 +62,9 @@ LL | Type! {}.get; = note: this error originates in the macro `Type` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | <Type! {}>::get; - | ~~~~~~~~~~~~ +LL - Type! {}.get; +LL + <Type! {}>::get; + | error[E0423]: expected value, found struct `Vec` --> $DIR/issue-22692.rs:26:9 @@ -73,8 +78,9 @@ LL | let _ = create!(type method); = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | Vec::new() - | ~~ +LL - Vec.new() +LL + Vec::new() + | error[E0423]: expected value, found struct `Vec` --> $DIR/issue-22692.rs:31:9 @@ -88,8 +94,9 @@ LL | let _ = create!(type field); = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | Vec::new - | ~~ +LL - Vec.new +LL + Vec::new + | error[E0423]: expected value, found struct `std::cell::Cell` --> $DIR/issue-22692.rs:17:9 @@ -103,8 +110,9 @@ LL | let _ = create!(macro method); = note: this error originates in the macro `Type` which comes from the expansion of the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | <Type!()>::new(0) - | ~~~~~~~~~~~ +LL - Type!().new(0) +LL + <Type!()>::new(0) + | error: aborting due to 8 previous errors diff --git a/tests/ui/resolve/issue-35675.stderr b/tests/ui/resolve/issue-35675.stderr index 44af65b0768..83d92ea7bf1 100644 --- a/tests/ui/resolve/issue-35675.stderr +++ b/tests/ui/resolve/issue-35675.stderr @@ -6,8 +6,9 @@ LL | fn should_return_fruit() -> Apple { | help: there is an enum variant `Fruit::Apple`; try using the variant's enum | -LL | fn should_return_fruit() -> Fruit { - | ~~~~~ +LL - fn should_return_fruit() -> Apple { +LL + fn should_return_fruit() -> Fruit { + | error[E0425]: cannot find function, tuple struct or tuple variant `Apple` in this scope --> $DIR/issue-35675.rs:9:5 @@ -57,8 +58,9 @@ LL | fn bar() -> Variant3 { | help: there is an enum variant `x::Enum::Variant3`; try using the variant's enum | -LL | fn bar() -> x::Enum { - | ~~~~~~~ +LL - fn bar() -> Variant3 { +LL + fn bar() -> x::Enum { + | error[E0573]: expected type, found variant `Some` --> $DIR/issue-35675.rs:28:13 diff --git a/tests/ui/resolve/issue-3907-2.stderr b/tests/ui/resolve/issue-3907-2.stderr index 4ab72a42eb8..40cdfb7a302 100644 --- a/tests/ui/resolve/issue-3907-2.stderr +++ b/tests/ui/resolve/issue-3907-2.stderr @@ -5,7 +5,7 @@ LL | fn bar(_x: Foo) {} | ^^^ `issue_3907::Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/auxiliary/issue-3907.rs:2:8 | LL | fn bar(); diff --git a/tests/ui/resolve/issue-3907.stderr b/tests/ui/resolve/issue-3907.stderr index e9dc344496e..0dc85829160 100644 --- a/tests/ui/resolve/issue-3907.stderr +++ b/tests/ui/resolve/issue-3907.stderr @@ -6,7 +6,8 @@ LL | impl Foo for S { | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait Foo = dyn issue_3907::Foo; +LL - type Foo = dyn issue_3907::Foo; +LL + trait Foo = dyn issue_3907::Foo; | help: consider importing this trait instead | diff --git a/tests/ui/resolve/issue-39226.stderr b/tests/ui/resolve/issue-39226.stderr index 857f6a73517..1cd2a5fb221 100644 --- a/tests/ui/resolve/issue-39226.stderr +++ b/tests/ui/resolve/issue-39226.stderr @@ -10,11 +10,12 @@ LL | handle: Handle help: use struct literal syntax instead | LL | handle: Handle {} - | ~~~~~~~~~ + | ++ help: a local variable with a similar name exists | -LL | handle: handle - | ~~~~~~ +LL - handle: Handle +LL + handle: handle + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-42944.stderr b/tests/ui/resolve/issue-42944.stderr index 4ffa9402c66..53c155d8f13 100644 --- a/tests/ui/resolve/issue-42944.stderr +++ b/tests/ui/resolve/issue-42944.stderr @@ -23,8 +23,9 @@ LL | pub struct Bx(pub(in crate::foo) ()); | ^^^^^^^^^^^^^^^^^^^^^ private field help: consider making the field publicly accessible | -LL | pub struct Bx(pub ()); - | ~~~ +LL - pub struct Bx(pub(in crate::foo) ()); +LL + pub struct Bx(pub ()); + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/issue-5035.stderr b/tests/ui/resolve/issue-5035.stderr index 32b972b21ff..b249aaa4b28 100644 --- a/tests/ui/resolve/issue-5035.stderr +++ b/tests/ui/resolve/issue-5035.stderr @@ -15,12 +15,14 @@ LL | impl K for isize {} | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait K = dyn I; +LL - type K = dyn I; +LL + trait K = dyn I; | help: a trait with a similar name exists | -LL | impl I for isize {} - | ~ +LL - impl K for isize {} +LL + impl I for isize {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/issue-5099.stderr b/tests/ui/resolve/issue-5099.stderr index e9b2a9c4d48..991c39db335 100644 --- a/tests/ui/resolve/issue-5099.stderr +++ b/tests/ui/resolve/issue-5099.stderr @@ -6,8 +6,9 @@ LL | this.a | help: you might have meant to use `self` here instead | -LL | self.a - | ~~~~ +LL - this.a +LL + self.a + | help: if you meant to use `self`, you are also missing a `self` receiver argument | LL | fn a(&self) -> A { @@ -21,8 +22,9 @@ LL | this.b(x); | help: you might have meant to use `self` here instead | -LL | self.b(x); - | ~~~~ +LL - this.b(x); +LL + self.b(x); + | help: if you meant to use `self`, you are also missing a `self` receiver argument | LL | fn b(&self, x: i32) { @@ -36,8 +38,9 @@ LL | let _ = || this.a; | help: you might have meant to use `self` here instead | -LL | let _ = || self.a; - | ~~~~ +LL - let _ = || this.a; +LL + let _ = || self.a; + | help: if you meant to use `self`, you are also missing a `self` receiver argument | LL | fn c(&self) { diff --git a/tests/ui/resolve/issue-55673.stderr b/tests/ui/resolve/issue-55673.stderr index 7d420126199..2695868b771 100644 --- a/tests/ui/resolve/issue-55673.stderr +++ b/tests/ui/resolve/issue-55673.stderr @@ -6,8 +6,9 @@ LL | T::Baa: std::fmt::Debug, | help: change the associated type name to use `Bar` from `Foo` | -LL | T::Bar: std::fmt::Debug, - | ~~~ +LL - T::Baa: std::fmt::Debug, +LL + T::Bar: std::fmt::Debug, + | error[E0220]: associated type `Baa` not found for `T` --> $DIR/issue-55673.rs:16:8 @@ -18,11 +19,12 @@ LL | T::Baa: std::fmt::Debug, help: consider further restricting type parameter `T` with trait `Foo` | LL | T::Baa: std::fmt::Debug, T: Foo - | ~~~~~~~~ + | ++++++ help: ...and changing the associated type name | -LL | T::Bar: std::fmt::Debug, - | ~~~ +LL - T::Baa: std::fmt::Debug, +LL + T::Bar: std::fmt::Debug, + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/issue-73427.stderr b/tests/ui/resolve/issue-73427.stderr index 0a9a504f79c..fccbfe547cb 100644 --- a/tests/ui/resolve/issue-73427.stderr +++ b/tests/ui/resolve/issue-73427.stderr @@ -17,14 +17,16 @@ LL | | } | |_^ help: you might have meant to use one of the following enum variants | -LL | (A::Tuple()).foo(); - | ~~~~~~~~~~~~ +LL - A.foo(); +LL + (A::Tuple()).foo(); + | LL | A::Unit.foo(); - | ~~~~~~~ + | ++++++ help: alternatively, the following enum variant is available | -LL | (A::TupleWithFields(/* fields */)).foo(); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - A.foo(); +LL + (A::TupleWithFields(/* fields */)).foo(); + | error[E0423]: expected value, found enum `B` --> $DIR/issue-73427.rs:35:5 @@ -59,11 +61,12 @@ LL | | } help: you might have meant to use the following enum variant | LL | C::Unit.foo(); - | ~~~~~~~ + | ++++++ help: alternatively, the following enum variant is available | -LL | (C::TupleWithFields(/* fields */)).foo(); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - C.foo(); +LL + (C::TupleWithFields(/* fields */)).foo(); + | error[E0423]: expected value, found enum `D` --> $DIR/issue-73427.rs:39:5 @@ -82,11 +85,12 @@ LL | | } help: you might have meant to use the following enum variant | LL | D::Unit.foo(); - | ~~~~~~~ + | ++++++ help: alternatively, the following enum variant is available | -LL | (D::TupleWithFields(/* fields */)).foo(); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - D.foo(); +LL + (D::TupleWithFields(/* fields */)).foo(); + | error[E0423]: expected value, found enum `E` --> $DIR/issue-73427.rs:41:5 @@ -103,8 +107,9 @@ LL | | } | |_^ help: the following enum variant is available | -LL | (E::TupleWithFields(/* fields */)).foo(); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - E.foo(); +LL + (E::TupleWithFields(/* fields */)).foo(); + | help: consider importing one of these constants instead | LL + use std::f128::consts::E; @@ -137,9 +142,9 @@ LL | | } help: try to match against one of the enum's variants | LL | if let A::Tuple(3) = x { } - | ~~~~~~~~ + | +++++++ LL | if let A::TupleWithFields(3) = x { } - | ~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++ error[E0423]: expected function, tuple struct or tuple variant, found enum `A` --> $DIR/issue-73427.rs:46:13 @@ -162,9 +167,9 @@ LL | | } help: try to construct one of the enum's variants | LL | let x = A::Tuple(3); - | ~~~~~~~~ + | +++++++ LL | let x = A::TupleWithFields(3); - | ~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++ error: aborting due to 7 previous errors diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr index 12a6580048e..f349b9391d1 100644 --- a/tests/ui/resolve/privacy-enum-ctor.stderr +++ b/tests/ui/resolve/privacy-enum-ctor.stderr @@ -17,12 +17,14 @@ LL | | } | |_________^ help: you might have meant to use the following enum variant | -LL | m::Z::Unit; - | ~~~~~~~~~~ +LL - n::Z; +LL + m::Z::Unit; + | help: alternatively, the following enum variant is available | -LL | (m::Z::Fn(/* fields */)); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - n::Z; +LL + (m::Z::Fn(/* fields */)); + | error[E0423]: expected value, found enum `Z` --> $DIR/privacy-enum-ctor.rs:25:9 @@ -43,12 +45,14 @@ LL | | } | |_________^ help: you might have meant to use the following enum variant | -LL | m::Z::Unit; - | ~~~~~~~~~~ +LL - Z; +LL + m::Z::Unit; + | help: alternatively, the following enum variant is available | -LL | (m::Z::Fn(/* fields */)); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - Z; +LL + (m::Z::Fn(/* fields */)); + | error[E0423]: expected value, found enum `m::E` --> $DIR/privacy-enum-ctor.rs:41:16 @@ -72,16 +76,19 @@ LL | | } | |_____^ help: you might have meant to use the following enum variant | -LL | let _: E = E::Unit; - | ~~~~~~~ +LL - let _: E = m::E; +LL + let _: E = E::Unit; + | help: alternatively, the following enum variant is available | -LL | let _: E = (E::Fn(/* fields */)); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - let _: E = m::E; +LL + let _: E = (E::Fn(/* fields */)); + | help: a function with a similar name exists | -LL | let _: E = m::f; - | ~ +LL - let _: E = m::E; +LL + let _: E = m::f; + | help: consider importing one of these constants instead | LL + use std::f128::consts::E; @@ -118,11 +125,12 @@ LL | | } help: you might have meant to use the following enum variant | LL | let _: E = E::Unit; - | ~~~~~~~ + | ++++++ help: alternatively, the following enum variant is available | -LL | let _: E = (E::Fn(/* fields */)); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - let _: E = E; +LL + let _: E = (E::Fn(/* fields */)); + | help: consider importing one of these constants instead | LL + use std::f128::consts::E; @@ -168,12 +176,14 @@ LL | | } | |_________^ help: you might have meant to use the following enum variant | -LL | let _: Z = m::Z::Unit; - | ~~~~~~~~~~ +LL - let _: Z = m::n::Z; +LL + let _: Z = m::Z::Unit; + | help: alternatively, the following enum variant is available | -LL | let _: Z = (m::Z::Fn(/* fields */)); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _: Z = m::n::Z; +LL + let _: Z = (m::Z::Fn(/* fields */)); + | error[E0412]: cannot find type `Z` in this scope --> $DIR/privacy-enum-ctor.rs:61:12 diff --git a/tests/ui/resolve/privacy-struct-ctor.stderr b/tests/ui/resolve/privacy-struct-ctor.stderr index c1fcaaf0573..1d8c741c964 100644 --- a/tests/ui/resolve/privacy-struct-ctor.stderr +++ b/tests/ui/resolve/privacy-struct-ctor.stderr @@ -55,8 +55,9 @@ LL | pub(in m) struct Z(pub(in m::n) u8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the field publicly accessible | -LL | pub(in m) struct Z(pub u8); - | ~~~ +LL - pub(in m) struct Z(pub(in m::n) u8); +LL + pub(in m) struct Z(pub u8); + | error[E0603]: tuple struct constructor `S` is private --> $DIR/privacy-struct-ctor.rs:29:8 @@ -112,8 +113,9 @@ LL | pub(in m) struct Z(pub(in m::n) u8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the field publicly accessible | -LL | pub(in m) struct Z(pub u8); - | ~~~ +LL - pub(in m) struct Z(pub(in m::n) u8); +LL + pub(in m) struct Z(pub u8); + | error[E0603]: tuple struct constructor `S` is private --> $DIR/privacy-struct-ctor.rs:41:16 diff --git a/tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr b/tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr index 999e9a47d6c..f1db2d71b6a 100644 --- a/tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr +++ b/tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr @@ -3,7 +3,8 @@ error[E0259]: the name `std` is defined multiple times = note: `std` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate std as other_std; +LL - extern crate std; +LL + extern crate std as other_std; | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr b/tests/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr index a8d0efedb6c..40c76821bb8 100644 --- a/tests/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr +++ b/tests/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr @@ -7,8 +7,9 @@ LL | use std::slice as std; = note: `std` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use std::slice as other_std; - | ~~~~~~~~~~~~ +LL - use std::slice as std; +LL + use std::slice as other_std; + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr index d6240fb8f87..5fac622eef2 100644 --- a/tests/ui/resolve/resolve-inconsistent-names.stderr +++ b/tests/ui/resolve/resolve-inconsistent-names.stderr @@ -35,7 +35,7 @@ LL | (A, B) | (ref B, c) | (c, A) => () help: if you meant to match on unit variant `E::A`, use the full path in the pattern | LL | (E::A, B) | (ref B, c) | (c, A) => () - | ~~~~ + | +++ error[E0408]: variable `B` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:19:31 @@ -65,7 +65,7 @@ LL | (CONST1, _) | (_, Const2) => () help: if you meant to match on constant `m::Const2`, use the full path in the pattern | LL | (CONST1, _) | (_, m::Const2) => () - | ~~~~~~~~~ + | +++ error[E0408]: variable `CONST1` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:31:23 diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr index b41fa1818e2..366bc1bf03c 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr @@ -12,7 +12,7 @@ LL | const DEFAULT: u32 = 0; help: introduce a variable instead | LL | let DEFAULT_var: u32 = 0; - | ~~~~~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr index 908f5bdd897..1392eb48f8c 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr @@ -22,7 +22,7 @@ LL | const DEFAULT: u32 = 0; help: introduce a variable instead | LL | let DEFAULT_var: u32 = 0; - | ~~~~~~~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/resolve-variant-assoc-item.stderr b/tests/ui/resolve/resolve-variant-assoc-item.stderr index 9a5a605ac05..4b15114f022 100644 --- a/tests/ui/resolve/resolve-variant-assoc-item.stderr +++ b/tests/ui/resolve/resolve-variant-assoc-item.stderr @@ -6,8 +6,9 @@ LL | E::V::associated_item; | help: there is an enum variant `E::V`; try using the variant's enum | -LL | E::associated_item; - | ~ +LL - E::V::associated_item; +LL + E::associated_item; + | error[E0433]: failed to resolve: `V` is a variant, not a module --> $DIR/resolve-variant-assoc-item.rs:6:5 @@ -17,8 +18,9 @@ LL | V::associated_item; | help: there is an enum variant `E::V`; try using the variant's enum | -LL | E::associated_item; - | ~ +LL - V::associated_item; +LL + E::associated_item; + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/suggest-path-for-tuple-struct.stderr b/tests/ui/resolve/suggest-path-for-tuple-struct.stderr index 12c631f5a83..68a5b550978 100644 --- a/tests/ui/resolve/suggest-path-for-tuple-struct.stderr +++ b/tests/ui/resolve/suggest-path-for-tuple-struct.stderr @@ -6,8 +6,9 @@ LL | let _ = SomeTupleStruct.new(); | help: use the path separator to refer to an item | -LL | let _ = SomeTupleStruct::new(); - | ~~ +LL - let _ = SomeTupleStruct.new(); +LL + let _ = SomeTupleStruct::new(); + | error[E0423]: expected value, found struct `SomeRegularStruct` --> $DIR/suggest-path-for-tuple-struct.rs:24:13 @@ -17,8 +18,9 @@ LL | let _ = SomeRegularStruct.new(); | help: use the path separator to refer to an item | -LL | let _ = SomeRegularStruct::new(); - | ~~ +LL - let _ = SomeRegularStruct.new(); +LL + let _ = SomeRegularStruct::new(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr b/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr index 9c12fd2644c..5db943cd10d 100644 --- a/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr +++ b/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr @@ -6,8 +6,9 @@ LL | a.I | help: use the path separator to refer to an item | -LL | a::I - | ~~ +LL - a.I +LL + a::I + | error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:23:5 @@ -17,8 +18,9 @@ LL | a.g() | help: use the path separator to refer to an item | -LL | a::g() - | ~~ +LL - a.g() +LL + a::g() + | error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:29:5 @@ -28,8 +30,9 @@ LL | a.b.J | help: use the path separator to refer to an item | -LL | a::b.J - | ~~ +LL - a.b.J +LL + a::b.J + | error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:35:5 @@ -42,12 +45,14 @@ LL | a::b.J | help: use the path separator to refer to an item | -LL | a::b::J - | ~~ +LL - a::b.J +LL + a::b::J + | help: a constant with a similar name exists | -LL | a::I.J - | ~ +LL - a::b.J +LL + a::I.J + | error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:42:5 @@ -57,8 +62,9 @@ LL | a.b.f(); | help: use the path separator to refer to an item | -LL | a::b.f(); - | ~~ +LL - a.b.f(); +LL + a::b.f(); + | error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:46:12 @@ -82,12 +88,14 @@ LL | a::b.f() | help: use the path separator to refer to an item | -LL | a::b::f() - | ~~ +LL - a::b.f() +LL + a::b::f() + | help: a constant with a similar name exists | -LL | a::I.f() - | ~ +LL - a::b.f() +LL + a::I.f() + | error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:59:5 @@ -145,8 +153,9 @@ LL | let _ = create!(method); = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | a::f() - | ~~ +LL - a.f() +LL + a::f() + | error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:85:9 @@ -160,8 +169,9 @@ LL | let _ = create!(field); = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | a::f - | ~~ +LL - a.f +LL + a::f + | error: aborting due to 13 previous errors diff --git a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr index 5662021a2d5..5832cb69a3d 100644 --- a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr +++ b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr @@ -28,8 +28,9 @@ LL | println!("{self.config}"); | +++++ help: a local variable with a similar name exists | -LL | println!("{cofig}"); - | ~~~~~ +LL - println!("{config}"); +LL + println!("{cofig}"); + | error[E0425]: cannot find value `bah` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:33:9 @@ -46,8 +47,9 @@ LL | Self::bah; | ++++++ help: a function with a similar name exists | -LL | ba; - | ~~ +LL - bah; +LL + ba; + | error[E0425]: cannot find value `BAR` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:35:9 @@ -65,7 +67,7 @@ LL | Self::BAR; help: a constant with a similar name exists | LL | BARR; - | ~~~~ + | + error[E0412]: cannot find type `Baz` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:37:18 @@ -82,8 +84,9 @@ LL | let foo: Self::Baz = "".to_string(); | ++++++ help: a type alias with a similar name exists | -LL | let foo: Bar = "".to_string(); - | ~~~ +LL - let foo: Baz = "".to_string(); +LL + let foo: Bar = "".to_string(); + | error[E0425]: cannot find function `baz` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:31:9 @@ -100,8 +103,9 @@ LL | self.baz(); | +++++ help: a function with a similar name exists | -LL | ba(); - | ~~ +LL - baz(); +LL + ba(); + | error: aborting due to 7 previous errors diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr index 3ae134e43bc..2d0d0d0f386 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -18,8 +18,9 @@ LL | Struct::fob(); | help: there is an associated function `foo` with a similar name | -LL | Struct::foo(); - | ~~~ +LL - Struct::fob(); +LL + Struct::foo(); + | error[E0433]: failed to resolve: use of undeclared type `Struc` --> $DIR/typo-suggestion-mistyped-in-path.rs:27:5 @@ -39,7 +40,7 @@ LL | modul::foo(); help: there is a crate or module with a similar name | LL | module::foo(); - | ~~~~~~ + | + error[E0433]: failed to resolve: use of undeclared type `Trai` --> $DIR/typo-suggestion-mistyped-in-path.rs:39:5 diff --git a/tests/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr b/tests/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr index 8addc0303fb..f885705a17b 100644 --- a/tests/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr +++ b/tests/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr @@ -12,7 +12,8 @@ LL | fn g<F:Typedef(isize) -> isize>(x: F) {} | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait Typedef = isize; +LL - type Typedef = isize; +LL + trait Typedef = isize; | error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/always-read-in-closure-capture.rs b/tests/ui/rfcs/rfc-0000-never_patterns/always-read-in-closure-capture.rs new file mode 100644 index 00000000000..3c4cd57ec24 --- /dev/null +++ b/tests/ui/rfcs/rfc-0000-never_patterns/always-read-in-closure-capture.rs @@ -0,0 +1,16 @@ +//@ check-pass + +// Make sure that the closure captures `s` so it can perform a read of `s`. + +#![feature(never_patterns)] +#![allow(incomplete_features)] + +enum Void {} + +fn by_value(s: Void) { + move || { + let ! = s; + }; +} + +fn main() {} diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr index 39b1ef1e078..88411f29b16 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr @@ -59,7 +59,7 @@ LL | let NormalStruct { first_field, second_field } = ns; help: add `..` at the end of the field list to ignore all other fields | LL | let NormalStruct { first_field, second_field , .. } = ns; - | ~~~~~~ + | ++++ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/struct.rs:20:14 @@ -76,7 +76,7 @@ LL | let TupleStruct { 0: first_field, 1: second_field } = ts; help: add `..` at the end of the field list to ignore all other fields | LL | let TupleStruct { 0: first_field, 1: second_field , .. } = ts; - | ~~~~~~ + | ++++ error[E0638]: `..` required with struct marked as non-exhaustive --> $DIR/struct.rs:35:9 @@ -87,7 +87,7 @@ LL | let UnitStruct { } = us; help: add `..` at the end of the field list to ignore all other fields | LL | let UnitStruct { .. } = us; - | ~~~~ + | ++ error: aborting due to 9 previous errors diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr index 4083f57a9cd..dcecd53d38a 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr @@ -83,7 +83,7 @@ LL | NonExhaustiveVariants::Struct { field } => "" help: add `..` at the end of the field list to ignore all other fields | LL | NonExhaustiveVariants::Struct { field , .. } => "" - | ~~~~~~ + | ++++ error[E0638]: `..` required with variant marked as non-exhaustive --> $DIR/variant.rs:30:12 @@ -94,7 +94,7 @@ LL | if let NonExhaustiveVariants::Struct { field } = variant_struct { help: add `..` at the end of the field list to ignore all other fields | LL | if let NonExhaustiveVariants::Struct { field , .. } = variant_struct { - | ~~~~~~ + | ++++ error: aborting due to 8 previous errors diff --git a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr index d0c084f7bd5..38360e06cbe 100644 --- a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr +++ b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr @@ -7,7 +7,7 @@ LL | use alloc; help: consider importing this module instead | LL | use std::alloc; - | ~~~~~~~~~~ + | +++++ error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/check-pass.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/check-pass.rs index 674cf930c0a..9279e7a955e 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/check-pass.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/check-pass.rs @@ -9,8 +9,6 @@ //@ check-pass //@ only-x86_64 -#![feature(target_feature_11)] - #[target_feature(enable = "sse2")] const fn sse2() {} diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/closures-inherit-target_feature.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/closures-inherit-target_feature.rs index 122ef542e7d..aecea6314d4 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/closures-inherit-target_feature.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/closures-inherit-target_feature.rs @@ -3,8 +3,6 @@ //@ check-pass //@ only-x86_64 -#![feature(target_feature_11)] - #[target_feature(enable = "avx")] fn also_use_avx() { println!("Hello from AVX") diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/feature-gate-target_feature_11.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/feature-gate-target_feature_11.rs deleted file mode 100644 index 2add6b2e186..00000000000 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/feature-gate-target_feature_11.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ only-x86_64 - -#[target_feature(enable = "sse2")] //~ ERROR can only be applied to `unsafe` functions -fn foo() {} - -fn main() {} diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/feature-gate-target_feature_11.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/feature-gate-target_feature_11.stderr deleted file mode 100644 index 4f1994d56fd..00000000000 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/feature-gate-target_feature_11.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions - --> $DIR/feature-gate-target_feature_11.rs:3:1 - | -LL | #[target_feature(enable = "sse2")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | fn foo() {} - | -------- not an `unsafe` function - | - = note: see issue #69098 <https://github.com/rust-lang/rust/issues/69098> for more information - = help: add `#![feature(target_feature_11)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.rs index d7c17299d06..43a5a2f16aa 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.rs @@ -1,7 +1,5 @@ //@ only-x86_64 -#![feature(target_feature_11)] - #[target_feature(enable = "avx")] fn foo_avx() {} diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.stderr index 1228404120a..5bfbc236bc4 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/fn-ptr.rs:14:21 + --> $DIR/fn-ptr.rs:12:21 | LL | #[target_feature(enable = "avx")] | --------------------------------- `#[target_feature]` added here @@ -14,7 +14,7 @@ LL | let foo: fn() = foo_avx; = note: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers error[E0308]: mismatched types - --> $DIR/fn-ptr.rs:23:21 + --> $DIR/fn-ptr.rs:21:21 | LL | #[target_feature(enable = "sse2")] | ---------------------------------- `#[target_feature]` added here diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs index c880ef0fe8a..82053a12b13 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs @@ -1,7 +1,5 @@ //@ only-x86_64 -#![feature(target_feature_11)] - #[target_feature(enable = "avx")] fn foo() {} diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr index efc061eca5f..1c6e3905abb 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr @@ -1,5 +1,5 @@ error[E0277]: expected a `Fn()` closure, found `#[target_features] fn() {foo}` - --> $DIR/fn-traits.rs:31:10 + --> $DIR/fn-traits.rs:29:10 | LL | call(foo); | ---- ^^^ expected an `Fn()` closure, found `#[target_features] fn() {foo}` @@ -11,13 +11,13 @@ LL | call(foo); = note: `#[target_feature]` functions do not implement the `Fn` traits = note: try casting the function to a `fn` pointer or wrapping it in a closure note: required by a bound in `call` - --> $DIR/fn-traits.rs:14:17 + --> $DIR/fn-traits.rs:12:17 | LL | fn call(f: impl Fn()) { | ^^^^ required by this bound in `call` error[E0277]: expected a `FnMut()` closure, found `#[target_features] fn() {foo}` - --> $DIR/fn-traits.rs:32:14 + --> $DIR/fn-traits.rs:30:14 | LL | call_mut(foo); | -------- ^^^ expected an `FnMut()` closure, found `#[target_features] fn() {foo}` @@ -29,13 +29,13 @@ LL | call_mut(foo); = note: `#[target_feature]` functions do not implement the `Fn` traits = note: try casting the function to a `fn` pointer or wrapping it in a closure note: required by a bound in `call_mut` - --> $DIR/fn-traits.rs:18:25 + --> $DIR/fn-traits.rs:16:25 | LL | fn call_mut(mut f: impl FnMut()) { | ^^^^^^^ required by this bound in `call_mut` error[E0277]: expected a `FnOnce()` closure, found `#[target_features] fn() {foo}` - --> $DIR/fn-traits.rs:33:15 + --> $DIR/fn-traits.rs:31:15 | LL | call_once(foo); | --------- ^^^ expected an `FnOnce()` closure, found `#[target_features] fn() {foo}` @@ -47,13 +47,13 @@ LL | call_once(foo); = note: `#[target_feature]` functions do not implement the `Fn` traits = note: try casting the function to a `fn` pointer or wrapping it in a closure note: required by a bound in `call_once` - --> $DIR/fn-traits.rs:22:22 + --> $DIR/fn-traits.rs:20:22 | LL | fn call_once(f: impl FnOnce()) { | ^^^^^^^^ required by this bound in `call_once` error[E0277]: expected a `FnOnce(i32)` closure, found `#[target_features] fn(i32) {bar}` - --> $DIR/fn-traits.rs:34:19 + --> $DIR/fn-traits.rs:32:19 | LL | call_once_i32(bar); | ------------- ^^^ expected an `FnOnce(i32)` closure, found `#[target_features] fn(i32) {bar}` @@ -64,13 +64,13 @@ LL | call_once_i32(bar); = note: `#[target_feature]` functions do not implement the `Fn` traits = note: try casting the function to a `fn` pointer or wrapping it in a closure note: required by a bound in `call_once_i32` - --> $DIR/fn-traits.rs:26:26 + --> $DIR/fn-traits.rs:24:26 | LL | fn call_once_i32(f: impl FnOnce(i32)) { | ^^^^^^^^^^^ required by this bound in `call_once_i32` error[E0277]: expected a `Fn()` closure, found `unsafe fn() {foo_unsafe}` - --> $DIR/fn-traits.rs:36:10 + --> $DIR/fn-traits.rs:34:10 | LL | call(foo_unsafe); | ---- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }` @@ -83,13 +83,13 @@ LL | call(foo_unsafe); = note: `#[target_feature]` functions do not implement the `Fn` traits = note: try casting the function to a `fn` pointer or wrapping it in a closure note: required by a bound in `call` - --> $DIR/fn-traits.rs:14:17 + --> $DIR/fn-traits.rs:12:17 | LL | fn call(f: impl Fn()) { | ^^^^ required by this bound in `call` error[E0277]: expected a `FnMut()` closure, found `unsafe fn() {foo_unsafe}` - --> $DIR/fn-traits.rs:38:14 + --> $DIR/fn-traits.rs:36:14 | LL | call_mut(foo_unsafe); | -------- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }` @@ -102,13 +102,13 @@ LL | call_mut(foo_unsafe); = note: `#[target_feature]` functions do not implement the `Fn` traits = note: try casting the function to a `fn` pointer or wrapping it in a closure note: required by a bound in `call_mut` - --> $DIR/fn-traits.rs:18:25 + --> $DIR/fn-traits.rs:16:25 | LL | fn call_mut(mut f: impl FnMut()) { | ^^^^^^^ required by this bound in `call_mut` error[E0277]: expected a `FnOnce()` closure, found `unsafe fn() {foo_unsafe}` - --> $DIR/fn-traits.rs:40:15 + --> $DIR/fn-traits.rs:38:15 | LL | call_once(foo_unsafe); | --------- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }` @@ -121,7 +121,7 @@ LL | call_once(foo_unsafe); = note: `#[target_feature]` functions do not implement the `Fn` traits = note: try casting the function to a `fn` pointer or wrapping it in a closure note: required by a bound in `call_once` - --> $DIR/fn-traits.rs:22:22 + --> $DIR/fn-traits.rs:20:22 | LL | fn call_once(f: impl FnOnce()) { | ^^^^^^^^ required by this bound in `call_once` diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.rs index a1c11847867..6df89ee97dd 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.rs @@ -1,7 +1,5 @@ //@ only-x86_64 -#![feature(target_feature_11)] - #[target_feature(enable = "avx2")] fn main() {} //~^ ERROR `main` function is not allowed to have `#[target_feature]` diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr index 57ad1cc8d08..15f99512f17 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-main.stderr @@ -1,5 +1,5 @@ error: `main` function is not allowed to have `#[target_feature]` - --> $DIR/issue-108645-target-feature-on-main.rs:6:1 + --> $DIR/issue-108645-target-feature-on-main.rs:4:1 | LL | fn main() {} | ^^^^^^^^^ `main` function is not allowed to have `#[target_feature]` diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108655-inline-always-closure.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108655-inline-always-closure.rs index 6bd810b0956..bf6dba6702c 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108655-inline-always-closure.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108655-inline-always-closure.rs @@ -3,8 +3,6 @@ //@ check-pass //@ only-x86_64 -#![feature(target_feature_11)] - #[target_feature(enable = "avx")] pub unsafe fn test() { ({ diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-99876.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-99876.rs index 57dac2e4adb..141d07876d4 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-99876.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-99876.rs @@ -1,7 +1,5 @@ //@ check-pass -#![feature(target_feature_11)] - struct S<T>(T) where [T; (|| {}, 1).1]: Copy; diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/return-fn-ptr.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/return-fn-ptr.rs index b49493d6609..5b306438fb0 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/return-fn-ptr.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/return-fn-ptr.rs @@ -1,8 +1,6 @@ //@ only-x86_64 //@ run-pass -#![feature(target_feature_11)] - #[target_feature(enable = "sse2")] fn foo() -> bool { true diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs index fec4e75290f..35bf6c11011 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs @@ -2,8 +2,6 @@ // Set the base cpu explicitly, in case the default has been changed. //@ compile-flags: -C target-cpu=x86-64 -#![feature(target_feature_11)] - #[target_feature(enable = "sse2")] const fn sse2() {} diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr index 901bf640845..ea462609234 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr @@ -1,5 +1,5 @@ error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:27:5 + --> $DIR/safe-calls.rs:25:5 | LL | sse2(); | ^^^^^^ call to function with `#[target_feature]` @@ -8,7 +8,7 @@ LL | sse2(); = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:29:5 + --> $DIR/safe-calls.rs:27:5 | LL | avx_bmi2(); | ^^^^^^^^^^ call to function with `#[target_feature]` @@ -16,7 +16,7 @@ LL | avx_bmi2(); = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:31:5 + --> $DIR/safe-calls.rs:29:5 | LL | Quux.avx_bmi2(); | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` @@ -24,7 +24,7 @@ LL | Quux.avx_bmi2(); = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:38:5 + --> $DIR/safe-calls.rs:36:5 | LL | avx_bmi2(); | ^^^^^^^^^^ call to function with `#[target_feature]` @@ -32,7 +32,7 @@ LL | avx_bmi2(); = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:40:5 + --> $DIR/safe-calls.rs:38:5 | LL | Quux.avx_bmi2(); | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` @@ -40,7 +40,7 @@ LL | Quux.avx_bmi2(); = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:47:5 + --> $DIR/safe-calls.rs:45:5 | LL | avx_bmi2(); | ^^^^^^^^^^ call to function with `#[target_feature]` @@ -48,7 +48,7 @@ LL | avx_bmi2(); = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:49:5 + --> $DIR/safe-calls.rs:47:5 | LL | Quux.avx_bmi2(); | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` @@ -56,7 +56,7 @@ LL | Quux.avx_bmi2(); = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:61:15 + --> $DIR/safe-calls.rs:59:15 | LL | const _: () = sse2(); | ^^^^^^ call to function with `#[target_feature]` @@ -65,7 +65,7 @@ LL | const _: () = sse2(); = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` error[E0133]: call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:64:15 + --> $DIR/safe-calls.rs:62:15 | LL | const _: () = sse2_and_fxsr(); | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` @@ -74,7 +74,7 @@ LL | const _: () = sse2_and_fxsr(); = note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]` error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe block - --> $DIR/safe-calls.rs:69:5 + --> $DIR/safe-calls.rs:67:5 | LL | sse2(); | ^^^^^^ call to function with `#[target_feature]` @@ -83,12 +83,12 @@ LL | sse2(); = help: in order for the call to be safe, the context requires the following additional target feature: sse2 = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/safe-calls.rs:68:1 + --> $DIR/safe-calls.rs:66:1 | LL | unsafe fn needs_unsafe_block() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/safe-calls.rs:67:8 + --> $DIR/safe-calls.rs:65:8 | LL | #[deny(unsafe_op_in_unsafe_fn)] | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.rs index a2ac6ff45fc..bb1dd3b5030 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.rs +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.rs @@ -1,7 +1,5 @@ //@ only-x86_64 -#![feature(target_feature_11)] - trait Foo { fn foo(&self); unsafe fn unsf_foo(&self); diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr index 1ab1fad64cc..f2ef2b2f3b8 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/trait-impl.stderr @@ -1,5 +1,5 @@ error: `#[target_feature(..)]` cannot be applied to safe trait method - --> $DIR/trait-impl.rs:13:5 + --> $DIR/trait-impl.rs:11:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method @@ -8,13 +8,13 @@ LL | fn foo(&self) {} | ------------- not an `unsafe` function error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/trait-impl.rs:15:5 + --> $DIR/trait-impl.rs:13:5 | LL | fn foo(&self) {} | ^^^^^^^^^^^^^ expected safe fn, found unsafe fn | note: type in trait - --> $DIR/trait-impl.rs:6:5 + --> $DIR/trait-impl.rs:4:5 | LL | fn foo(&self); | ^^^^^^^^^^^^^^ @@ -22,7 +22,7 @@ LL | fn foo(&self); found signature `#[target_features] fn(&Bar)` error: `#[target_feature(..)]` cannot be applied to safe trait method - --> $DIR/trait-impl.rs:23:5 + --> $DIR/trait-impl.rs:21:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method diff --git a/tests/ui/rmeta/rmeta_meta_main.stderr b/tests/ui/rmeta/rmeta_meta_main.stderr index af11c88d928..7ee44ce29b2 100644 --- a/tests/ui/rmeta/rmeta_meta_main.stderr +++ b/tests/ui/rmeta/rmeta_meta_main.stderr @@ -6,8 +6,9 @@ LL | let _ = Foo { field2: 42 }; | help: a field with a similar name exists | -LL | let _ = Foo { field: 42 }; - | ~~~~~ +LL - let _ = Foo { field2: 42 }; +LL + let _ = Foo { field: 42 }; + | error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/remove-extern-crate.stderr b/tests/ui/rust-2018/remove-extern-crate.stderr index 020db9975c0..cb090c621e9 100644 --- a/tests/ui/rust-2018/remove-extern-crate.stderr +++ b/tests/ui/rust-2018/remove-extern-crate.stderr @@ -19,8 +19,9 @@ LL | extern crate core; | help: convert it to a `use` | -LL | use core; - | ~~~ +LL - extern crate core; +LL + use core; + | warning: `extern crate` is not idiomatic in the new edition --> $DIR/remove-extern-crate.rs:45:5 @@ -30,8 +31,9 @@ LL | pub extern crate core; | help: convert it to a `use` | -LL | pub use core; - | ~~~ +LL - pub extern crate core; +LL + pub use core; + | warning: 3 warnings emitted diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 85262888579..488044ee852 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -14,8 +14,9 @@ LL + use crate::foo::foobar::Foobar; | help: there is a method `bar` with a similar name | -LL | x.bar(); - | ~~~ +LL - x.foobar(); +LL + x.bar(); + | error[E0599]: no method named `bar` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:28:7 @@ -34,7 +35,7 @@ LL + use crate::foo::Bar; help: there is a method `foobar` with a similar name | LL | x.foobar(); - | ~~~~~~ + | +++ error[E0599]: no method named `baz` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:29:7 @@ -44,8 +45,9 @@ LL | x.baz(); | help: there is a method `bar` with a similar name | -LL | x.bar(); - | ~~~ +LL - x.baz(); +LL + x.bar(); + | error[E0599]: no function or associated item named `from_str` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:30:18 @@ -60,8 +62,9 @@ LL + use std::str::FromStr; | help: there is an associated function `from` with a similar name | -LL | let y = u32::from("33"); - | ~~~~ +LL - let y = u32::from_str("33"); +LL + let y = u32::from("33"); + | error: aborting due to 4 previous errors diff --git a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr index d9c0fa47eca..966613e12b5 100644 --- a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr @@ -14,8 +14,9 @@ LL + use std::convert::TryInto; | help: there is a method `into` with a similar name | -LL | let _: u32 = 3u8.into().unwrap(); - | ~~~~ +LL - let _: u32 = 3u8.try_into().unwrap(); +LL + let _: u32 = 3u8.into().unwrap(); + | error: aborting due to 1 previous error diff --git a/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr b/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr index b8a9a5c8129..ac19f91881d 100644 --- a/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr +++ b/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr @@ -7,8 +7,9 @@ LL | fn concrete(b: B) -> B; = note: `B` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `B` | -LL | fn concrete<T: B>(b: T) -> B; - | ++++++ ~ +LL - fn concrete(b: B) -> B; +LL + fn concrete<T: B>(b: T) -> B; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn concrete(b: impl B) -> B; @@ -34,8 +35,9 @@ LL | fn f(a: A) -> A; = note: `A` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `A` | -LL | fn f<T: A>(a: T) -> A; - | ++++++ ~ +LL - fn f(a: A) -> A; +LL + fn f<T: A>(a: T) -> A; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn f(a: impl A) -> A; diff --git a/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr b/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr index c0969570e92..463c6892ca2 100644 --- a/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr +++ b/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr @@ -7,8 +7,9 @@ LL | fn g(new: B) -> B; = note: `B` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `B` | -LL | fn g<T: B>(new: T) -> B; - | ++++++ ~ +LL - fn g(new: B) -> B; +LL + fn g<T: B>(new: T) -> B; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn g(new: impl B) -> B; diff --git a/tests/ui/rust-2021/ice-unsized-fn-params-2.stderr b/tests/ui/rust-2021/ice-unsized-fn-params-2.stderr index d35c8ab3e42..7f837bbe50f 100644 --- a/tests/ui/rust-2021/ice-unsized-fn-params-2.stderr +++ b/tests/ui/rust-2021/ice-unsized-fn-params-2.stderr @@ -7,8 +7,9 @@ LL | fn guard(_s: Copy) -> bool { = note: `Copy` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `Copy` | -LL | fn guard<T: Copy>(_s: T) -> bool { - | +++++++++ ~ +LL - fn guard(_s: Copy) -> bool { +LL + fn guard<T: Copy>(_s: T) -> bool { + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn guard(_s: impl Copy) -> bool { diff --git a/tests/ui/rust-2021/ice-unsized-fn-params.stderr b/tests/ui/rust-2021/ice-unsized-fn-params.stderr index d56e9981a28..c31500ba800 100644 --- a/tests/ui/rust-2021/ice-unsized-fn-params.stderr +++ b/tests/ui/rust-2021/ice-unsized-fn-params.stderr @@ -7,8 +7,9 @@ LL | fn g(b: B) -> B; = note: `B` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `B` | -LL | fn g<T: B>(b: T) -> B; - | ++++++ ~ +LL - fn g(b: B) -> B; +LL + fn g<T: B>(b: T) -> B; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn g(b: impl B) -> B; @@ -34,8 +35,9 @@ LL | fn f(a: A) -> A; = note: `A` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `A` | -LL | fn f<T: A>(a: T) -> A; - | ++++++ ~ +LL - fn f(a: A) -> A; +LL + fn f<T: A>(a: T) -> A; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn f(a: impl A) -> A; diff --git a/tests/ui/sanitizer/cfi/supertraits.rs b/tests/ui/sanitizer/cfi/supertraits.rs index 4bb6177577f..f80b3169188 100644 --- a/tests/ui/sanitizer/cfi/supertraits.rs +++ b/tests/ui/sanitizer/cfi/supertraits.rs @@ -1,4 +1,3 @@ -#![feature(trait_upcasting)] // Check that super-traits are callable. //@ revisions: cfi kcfi diff --git a/tests/ui/self/arbitrary-self-types-dyn-incompatible.curr.stderr b/tests/ui/self/arbitrary-self-types-dyn-incompatible.curr.stderr index 3e018995ba5..8382b4867e2 100644 --- a/tests/ui/self/arbitrary-self-types-dyn-incompatible.curr.stderr +++ b/tests/ui/self/arbitrary-self-types-dyn-incompatible.curr.stderr @@ -8,7 +8,7 @@ LL | let x = Rc::new(5usize) as Rc<dyn Foo>; | ^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/arbitrary-self-types-dyn-incompatible.rs:8:18 | LL | trait Foo { @@ -27,7 +27,7 @@ LL | let x = Rc::new(5usize) as Rc<dyn Foo>; | ^^^^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/arbitrary-self-types-dyn-incompatible.rs:8:18 | LL | trait Foo { diff --git a/tests/ui/self/arbitrary-self-types-dyn-incompatible.dyn_compatible_for_dispatch.stderr b/tests/ui/self/arbitrary-self-types-dyn-incompatible.dyn_compatible_for_dispatch.stderr index 12c93d58537..d324f4641cf 100644 --- a/tests/ui/self/arbitrary-self-types-dyn-incompatible.dyn_compatible_for_dispatch.stderr +++ b/tests/ui/self/arbitrary-self-types-dyn-incompatible.dyn_compatible_for_dispatch.stderr @@ -8,7 +8,7 @@ LL | let x = Rc::new(5usize) as Rc<dyn Foo>; | ^^^^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/arbitrary-self-types-dyn-incompatible.rs:8:18 | LL | trait Foo { diff --git a/tests/ui/self/arbitrary_self_type_infinite_recursion.rs b/tests/ui/self/arbitrary_self_type_infinite_recursion.rs new file mode 100644 index 00000000000..6fbf35c0b86 --- /dev/null +++ b/tests/ui/self/arbitrary_self_type_infinite_recursion.rs @@ -0,0 +1,24 @@ +#![feature(arbitrary_self_types)] + +struct MySmartPtr<T>(T); + +impl<T> core::ops::Receiver for MySmartPtr<T> { + type Target = MySmartPtr<T>; +} + +struct Content; + +impl Content { + fn method(self: MySmartPtr<Self>) { // note self type + //~^ reached the recursion limit + //~| reached the recursion limit + //~| invalid `self` parameter type + } +} + +fn main() { + let p = MySmartPtr(Content); + p.method(); + //~^ reached the recursion limit + //~| no method named `method` +} diff --git a/tests/ui/self/arbitrary_self_type_infinite_recursion.stderr b/tests/ui/self/arbitrary_self_type_infinite_recursion.stderr new file mode 100644 index 00000000000..5e652efb364 --- /dev/null +++ b/tests/ui/self/arbitrary_self_type_infinite_recursion.stderr @@ -0,0 +1,47 @@ +error[E0055]: reached the recursion limit while auto-dereferencing `MySmartPtr<Content>` + --> $DIR/arbitrary_self_type_infinite_recursion.rs:12:19 + | +LL | fn method(self: MySmartPtr<Self>) { // note self type + | ^^^^^^^^^^^^^^^^ deref recursion limit reached + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`arbitrary_self_type_infinite_recursion`) + +error[E0055]: reached the recursion limit while auto-dereferencing `MySmartPtr<Content>` + --> $DIR/arbitrary_self_type_infinite_recursion.rs:12:19 + | +LL | fn method(self: MySmartPtr<Self>) { // note self type + | ^^^^^^^^^^^^^^^^ deref recursion limit reached + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`arbitrary_self_type_infinite_recursion`) + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0307]: invalid `self` parameter type: `MySmartPtr<Content>` + --> $DIR/arbitrary_self_type_infinite_recursion.rs:12:19 + | +LL | fn method(self: MySmartPtr<Self>) { // note self type + | ^^^^^^^^^^^^^^^^ + | + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` + +error[E0055]: reached the recursion limit while auto-dereferencing `MySmartPtr<Content>` + --> $DIR/arbitrary_self_type_infinite_recursion.rs:21:5 + | +LL | p.method(); + | ^^^^^^ deref recursion limit reached + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`arbitrary_self_type_infinite_recursion`) + +error[E0599]: no method named `method` found for struct `MySmartPtr` in the current scope + --> $DIR/arbitrary_self_type_infinite_recursion.rs:21:5 + | +LL | struct MySmartPtr<T>(T); + | -------------------- method `method` not found for this struct +... +LL | p.method(); + | ^^^^^^ method not found in `MySmartPtr<Content>` + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0055, E0307, E0599. +For more information about an error, try `rustc --explain E0055`. diff --git a/tests/ui/self/arbitrary_self_type_mut_difference.stderr b/tests/ui/self/arbitrary_self_type_mut_difference.stderr index ffc61ee0d78..31c1c9b7382 100644 --- a/tests/ui/self/arbitrary_self_type_mut_difference.stderr +++ b/tests/ui/self/arbitrary_self_type_mut_difference.stderr @@ -11,8 +11,9 @@ LL | fn x(self: Pin<&mut Self>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: there is a method `y` with a similar name | -LL | Pin::new(&S).y(); - | ~ +LL - Pin::new(&S).x(); +LL + Pin::new(&S).y(); + | error[E0599]: no method named `y` found for struct `Pin<&mut S>` in the current scope --> $DIR/arbitrary_self_type_mut_difference.rs:12:22 @@ -27,8 +28,9 @@ LL | fn y(self: Pin<&Self>) {} | ^^^^^^^^^^^^^^^^^^^^^^ help: there is a method `x` with a similar name | -LL | Pin::new(&mut S).x(); - | ~ +LL - Pin::new(&mut S).y(); +LL + Pin::new(&mut S).x(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/self/arbitrary_self_types_dispatch_to_vtable.rs b/tests/ui/self/arbitrary_self_types_dispatch_to_vtable.rs new file mode 100644 index 00000000000..f9e346ea11e --- /dev/null +++ b/tests/ui/self/arbitrary_self_types_dispatch_to_vtable.rs @@ -0,0 +1,33 @@ +//@ check-pass + +#![feature(derive_coerce_pointee)] +#![feature(arbitrary_self_types)] + +use std::marker::CoercePointee; +use std::ops::Receiver; + +// `CoercePointee` isn't needed here, it's just a simpler +// (and more conceptual) way of deriving `DispatchFromDyn`. +// You could think of `MyDispatcher` as a smart pointer +// that just doesn't deref to its target type. +#[derive(CoercePointee)] +#[repr(transparent)] +struct MyDispatcher<T: ?Sized>(*const T); + +impl<T: ?Sized> Receiver for MyDispatcher<T> { + type Target = T; +} +struct Test; + +trait Trait { + fn test(self: MyDispatcher<Self>); +} + +impl Trait for Test { + fn test(self: MyDispatcher<Self>) { + todo!() + } +} +fn main() { + MyDispatcher::<dyn Trait>(core::ptr::null_mut::<Test>()).test(); +} diff --git a/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr b/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr index 4c0ab88493e..8843efc6ff8 100644 --- a/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr +++ b/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr @@ -13,8 +13,9 @@ LL | foo_cpp_ref.0.frobnicate_ref(); | ++ help: there is a method `frobnicate_cpp_ref` with a similar name | -LL | foo_cpp_ref.frobnicate_cpp_ref(); - | ~~~~~~~~~~~~~~~~~~ +LL - foo_cpp_ref.frobnicate_ref(); +LL + foo_cpp_ref.frobnicate_cpp_ref(); + | error[E0599]: no method named `frobnicate_self` found for struct `CppRef` in the current scope --> $DIR/arbitrary_self_types_not_allow_call_with_no_deref.rs:32:17 @@ -31,8 +32,9 @@ LL | foo_cpp_ref.0.frobnicate_self(); // would desugar to `Foo::frobnicate_s | ++ help: there is a method `frobnicate_cpp_ref` with a similar name | -LL | foo_cpp_ref.frobnicate_cpp_ref(); // would desugar to `Foo::frobnicate_self(*foo_cpp_ref)` - | ~~~~~~~~~~~~~~~~~~ +LL - foo_cpp_ref.frobnicate_self(); // would desugar to `Foo::frobnicate_self(*foo_cpp_ref)` +LL + foo_cpp_ref.frobnicate_cpp_ref(); // would desugar to `Foo::frobnicate_self(*foo_cpp_ref)` + | error: aborting due to 2 previous errors diff --git a/tests/ui/self/dispatch-from-dyn-layout-2.rs b/tests/ui/self/dispatch-from-dyn-layout-2.rs new file mode 100644 index 00000000000..cd52f060dc8 --- /dev/null +++ b/tests/ui/self/dispatch-from-dyn-layout-2.rs @@ -0,0 +1,16 @@ +//@ check-pass +// Regression test for #90110. + +// Make sure that object safety checking doesn't freak out when +// we have impossible-to-satisfy `Sized` predicates. + +trait Parser +where + for<'a> (dyn Parser + 'a): Sized, +{ + fn parse_line(&self); +} + +fn foo(_: &dyn Parser) {} + +fn main() {} diff --git a/tests/ui/self/dispatch-from-dyn-layout-3.rs b/tests/ui/self/dispatch-from-dyn-layout-3.rs new file mode 100644 index 00000000000..6878a4f4ac2 --- /dev/null +++ b/tests/ui/self/dispatch-from-dyn-layout-3.rs @@ -0,0 +1,19 @@ +//@ check-pass + +// Make sure that object safety checking doesn't freak out when +// we have impossible-to-satisfy `DispatchFromDyn` predicates. + +#![feature(dispatch_from_dyn)] +#![feature(arbitrary_self_types)] + +use std::ops::Deref; +use std::ops::DispatchFromDyn; + +trait Trait<T: Deref<Target = Self>> +where + for<'a> &'a T: DispatchFromDyn<&'a T>, +{ + fn foo(self: &T) -> Box<dyn Trait<T>>; +} + +fn main() {} diff --git a/tests/crashes/57276.rs b/tests/ui/self/dispatch-from-dyn-layout.rs index f70be4fba6d..468dc89a73e 100644 --- a/tests/crashes/57276.rs +++ b/tests/ui/self/dispatch-from-dyn-layout.rs @@ -1,4 +1,8 @@ -//@ known-bug: #57276 +//@ check-pass +// Regression test for #57276. + +// Make sure that object safety checking doesn't freak out when +// we have impossible-to-satisfy `DispatchFromDyn` predicates. #![feature(arbitrary_self_types, dispatch_from_dyn)] diff --git a/tests/ui/self/invalid-self-dyn-receiver.rs b/tests/ui/self/invalid-self-dyn-receiver.rs new file mode 100644 index 00000000000..a989b331b5e --- /dev/null +++ b/tests/ui/self/invalid-self-dyn-receiver.rs @@ -0,0 +1,20 @@ +// Makes sure we don't ICE when encountering a receiver that is *ostensibly* dyn safe, +// because it satisfies `&dyn Bar: DispatchFromDyn<&dyn Bar>`, but is not a valid receiver +// in wfcheck. + +#![feature(arbitrary_self_types)] + +use std::ops::Deref; + +trait Foo: Deref<Target = dyn Bar> { + fn method(self: &dyn Bar) {} + //~^ ERROR invalid `self` parameter type: `&dyn Bar` +} + +trait Bar {} + +fn test(x: &dyn Foo) { + x.method(); +} + +fn main() {} diff --git a/tests/ui/self/invalid-self-dyn-receiver.stderr b/tests/ui/self/invalid-self-dyn-receiver.stderr new file mode 100644 index 00000000000..f77f5686ad2 --- /dev/null +++ b/tests/ui/self/invalid-self-dyn-receiver.stderr @@ -0,0 +1,12 @@ +error[E0307]: invalid `self` parameter type: `&dyn Bar` + --> $DIR/invalid-self-dyn-receiver.rs:10:22 + | +LL | fn method(self: &dyn Bar) {} + | ^^^^^^^^ + | + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0307`. diff --git a/tests/ui/self/self-infer.stderr b/tests/ui/self/self-infer.stderr index 4f9e3f21dca..c6bdff22b69 100644 --- a/tests/ui/self/self-infer.stderr +++ b/tests/ui/self/self-infer.stderr @@ -6,8 +6,9 @@ LL | fn f(self: _) {} | help: use type parameters instead | -LL | fn f<T>(self: T) {} - | +++ ~ +LL - fn f(self: _) {} +LL + fn f<T>(self: T) {} + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/self-infer.rs:5:17 @@ -17,8 +18,9 @@ LL | fn g(self: &_) {} | help: use type parameters instead | -LL | fn g<T>(self: &T) {} - | +++ ~ +LL - fn g(self: &_) {} +LL + fn g<T>(self: &T) {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/simd-abi-checks-empty-list.rs b/tests/ui/simd-abi-checks-empty-list.rs index c1785051e5a..ca0889364fc 100644 --- a/tests/ui/simd-abi-checks-empty-list.rs +++ b/tests/ui/simd-abi-checks-empty-list.rs @@ -1,19 +1,18 @@ +//@ add-core-stubs //@ needs-llvm-components: sparc //@ compile-flags: --target=sparc-unknown-none-elf --crate-type=rlib //@ build-pass //@ ignore-pass (test emits codegen-time warnings) #![no_core] -#![feature(no_core, lang_items, repr_simd)] +#![feature(no_core, repr_simd)] #![allow(improper_ctypes_definitions)] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct SimdVec([i32; 4]); pub extern "C" fn pass_by_vec(_: SimdVec) {} -//~^ this function definition uses a SIMD vector type that is not currently supported with the chosen ABI +//~^ this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI //~| WARNING this was previously accepted by the compiler diff --git a/tests/ui/simd-abi-checks-empty-list.stderr b/tests/ui/simd-abi-checks-empty-list.stderr index c49fe1a01de..111dda42f33 100644 --- a/tests/ui/simd-abi-checks-empty-list.stderr +++ b/tests/ui/simd-abi-checks-empty-list.stderr @@ -1,5 +1,5 @@ -warning: this function definition uses a SIMD vector type that is not currently supported with the chosen ABI - --> $DIR/simd-abi-checks-empty-list.rs:17:1 +warning: this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI + --> $DIR/simd-abi-checks-empty-list.rs:16:1 | LL | pub extern "C" fn pass_by_vec(_: SimdVec) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -11,8 +11,8 @@ LL | pub extern "C" fn pass_by_vec(_: SimdVec) {} warning: 1 warning emitted Future incompatibility report: Future breakage diagnostic: -warning: this function definition uses a SIMD vector type that is not currently supported with the chosen ABI - --> $DIR/simd-abi-checks-empty-list.rs:17:1 +warning: this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI + --> $DIR/simd-abi-checks-empty-list.rs:16:1 | LL | pub extern "C" fn pass_by_vec(_: SimdVec) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here diff --git a/tests/ui/simd-abi-checks-s390x.rs b/tests/ui/simd-abi-checks-s390x.rs index 15df66a2ced..424ac00edcf 100644 --- a/tests/ui/simd-abi-checks-s390x.rs +++ b/tests/ui/simd-abi-checks-s390x.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: z10 z13_no_vector z13_soft_float //@ build-fail //@[z10] compile-flags: --target s390x-unknown-linux-gnu @@ -8,20 +9,14 @@ //@[z13_soft_float] compile-flags: --target s390x-unknown-linux-gnu -C target-cpu=z13 -C target-feature=-vector,+soft-float //@[z13_soft_float] needs-llvm-components: systemz -#![feature(no_core, lang_items, repr_simd, s390x_target_feature)] +#![feature(no_core, repr_simd, s390x_target_feature)] #![no_core] #![crate_type = "lib"] #![allow(non_camel_case_types, improper_ctypes_definitions)] #![deny(abi_unsupported_vector_types)] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -#[lang = "freeze"] -pub trait Freeze {} - -impl<T: Copy, const N: usize> Copy for [T; N] {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct i8x8([i8; 8]); @@ -34,8 +29,6 @@ pub struct Wrapper<T>(T); #[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 {} @@ -44,13 +37,13 @@ impl<T: Copy> Copy for TransparentWrapper<T> {} #[no_mangle] extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted *x } #[no_mangle] extern "C" fn vector_ret(x: &i8x16) -> i8x16 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted *x } @@ -99,7 +92,7 @@ extern "C" fn vector_wrapper_ret_large(x: &Wrapper<i8x32>) -> Wrapper<i8x32> { extern "C" fn vector_transparent_wrapper_ret_small( x: &TransparentWrapper<i8x8>, ) -> TransparentWrapper<i8x8> { - //~^^^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^^^ ERROR requires the `vector` target feature, which is not enabled //~^^^^ WARN this was previously accepted *x } @@ -107,7 +100,7 @@ extern "C" fn vector_transparent_wrapper_ret_small( extern "C" fn vector_transparent_wrapper_ret( x: &TransparentWrapper<i8x16>, ) -> TransparentWrapper<i8x16> { - //~^^^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^^^ ERROR requires the `vector` target feature, which is not enabled //~^^^^ WARN this was previously accepted *x } @@ -121,13 +114,13 @@ extern "C" fn vector_transparent_wrapper_ret_large( #[no_mangle] extern "C" fn vector_arg_small(x: i8x8) -> i64 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted unsafe { *(&x as *const i8x8 as *const i64) } } #[no_mangle] extern "C" fn vector_arg(x: i8x16) -> i64 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted unsafe { *(&x as *const i8x16 as *const i64) } } @@ -139,13 +132,13 @@ extern "C" fn vector_arg_large(x: i8x32) -> i64 { #[no_mangle] extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted unsafe { *(&x as *const Wrapper<i8x8> as *const i64) } } #[no_mangle] extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted unsafe { *(&x as *const Wrapper<i8x16> as *const i64) } } @@ -157,13 +150,13 @@ extern "C" fn vector_wrapper_arg_large(x: Wrapper<i8x32>) -> i64 { #[no_mangle] extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted unsafe { *(&x as *const TransparentWrapper<i8x8> as *const i64) } } #[no_mangle] extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { - //~^ ERROR this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled + //~^ ERROR requires the `vector` target feature, which is not enabled //~^^ WARN this was previously accepted unsafe { *(&x as *const TransparentWrapper<i8x16> as *const i64) } } diff --git a/tests/ui/simd-abi-checks-s390x.z10.stderr b/tests/ui/simd-abi-checks-s390x.z10.stderr index cf135afb428..d2f7abb7c32 100644 --- a/tests/ui/simd-abi-checks-s390x.z10.stderr +++ b/tests/ui/simd-abi-checks-s390x.z10.stderr @@ -1,5 +1,5 @@ -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:46:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:39:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -8,13 +8,13 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:52:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:45:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -23,8 +23,8 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:99:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:92:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper<i8x8>, @@ -35,8 +35,8 @@ LL | | ) -> TransparentWrapper<i8x8> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:107:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:100:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper<i8x16>, @@ -47,8 +47,8 @@ LL | | ) -> TransparentWrapper<i8x16> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:123:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:116:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -57,8 +57,8 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:129:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:122:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -67,8 +67,8 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:141:1 +error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:134:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -77,8 +77,8 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:147:1 +error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:140:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -87,8 +87,8 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:159:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:152:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -97,8 +97,8 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8 = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:165:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:158:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -110,8 +110,8 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) error: aborting due to 10 previous errors Future incompatibility report: Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:46:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:39:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -120,14 +120,14 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:52:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:45:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -136,14 +136,14 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:99:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:92:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper<i8x8>, @@ -154,14 +154,14 @@ LL | | ) -> TransparentWrapper<i8x8> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:107:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:100:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper<i8x16>, @@ -172,14 +172,14 @@ LL | | ) -> TransparentWrapper<i8x16> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:123:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:116:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -188,14 +188,14 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:129:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:122:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -204,14 +204,14 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:141:1 +error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:134:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -220,14 +220,14 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:147:1 +error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:140:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -236,14 +236,14 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:159:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:152:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -252,14 +252,14 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8 = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:165:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:158:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -268,7 +268,7 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd-abi-checks-s390x.z13_no_vector.stderr b/tests/ui/simd-abi-checks-s390x.z13_no_vector.stderr index cf135afb428..d2f7abb7c32 100644 --- a/tests/ui/simd-abi-checks-s390x.z13_no_vector.stderr +++ b/tests/ui/simd-abi-checks-s390x.z13_no_vector.stderr @@ -1,5 +1,5 @@ -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:46:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:39:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -8,13 +8,13 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:52:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:45:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -23,8 +23,8 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:99:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:92:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper<i8x8>, @@ -35,8 +35,8 @@ LL | | ) -> TransparentWrapper<i8x8> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:107:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:100:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper<i8x16>, @@ -47,8 +47,8 @@ LL | | ) -> TransparentWrapper<i8x16> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:123:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:116:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -57,8 +57,8 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:129:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:122:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -67,8 +67,8 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:141:1 +error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:134:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -77,8 +77,8 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:147:1 +error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:140:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -87,8 +87,8 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:159:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:152:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -97,8 +97,8 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8 = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:165:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:158:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -110,8 +110,8 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) error: aborting due to 10 previous errors Future incompatibility report: Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:46:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:39:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -120,14 +120,14 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:52:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:45:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -136,14 +136,14 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:99:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:92:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper<i8x8>, @@ -154,14 +154,14 @@ LL | | ) -> TransparentWrapper<i8x8> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:107:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:100:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper<i8x16>, @@ -172,14 +172,14 @@ LL | | ) -> TransparentWrapper<i8x16> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:123:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:116:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -188,14 +188,14 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:129:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:122:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -204,14 +204,14 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:141:1 +error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:134:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -220,14 +220,14 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:147:1 +error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:140:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -236,14 +236,14 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:159:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:152:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -252,14 +252,14 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8 = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:165:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:158:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -268,7 +268,7 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd-abi-checks-s390x.z13_soft_float.stderr b/tests/ui/simd-abi-checks-s390x.z13_soft_float.stderr index cf135afb428..d2f7abb7c32 100644 --- a/tests/ui/simd-abi-checks-s390x.z13_soft_float.stderr +++ b/tests/ui/simd-abi-checks-s390x.z13_soft_float.stderr @@ -1,5 +1,5 @@ -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:46:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:39:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -8,13 +8,13 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:52:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:45:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -23,8 +23,8 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:99:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:92:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper<i8x8>, @@ -35,8 +35,8 @@ LL | | ) -> TransparentWrapper<i8x8> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:107:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:100:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper<i8x16>, @@ -47,8 +47,8 @@ LL | | ) -> TransparentWrapper<i8x16> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:123:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:116:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -57,8 +57,8 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:129:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:122:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -67,8 +67,8 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:141:1 +error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:134:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -77,8 +77,8 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:147:1 +error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:140:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -87,8 +87,8 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:159:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:152:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -97,8 +97,8 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8 = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:165:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:158:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -110,8 +110,8 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) error: aborting due to 10 previous errors Future incompatibility report: Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:46:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:39:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -120,14 +120,14 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:52:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:45:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -136,14 +136,14 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:99:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:92:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper<i8x8>, @@ -154,14 +154,14 @@ LL | | ) -> TransparentWrapper<i8x8> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:107:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:100:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper<i8x16>, @@ -172,14 +172,14 @@ LL | | ) -> TransparentWrapper<i8x16> { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:123:1 +error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:116:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -188,14 +188,14 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:129:1 +error: this function definition uses SIMD vector type `i8x16` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:122:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -204,14 +204,14 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:141:1 +error: this function definition uses SIMD vector type `Wrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:134:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -220,14 +220,14 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper<i8x8>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:147:1 +error: this function definition uses SIMD vector type `Wrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:140:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -236,14 +236,14 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper<i8x16>) -> i64 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:159:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x8>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:152:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8x8>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -252,14 +252,14 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper<i8 = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -error: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:165:1 +error: this function definition uses SIMD vector type `TransparentWrapper<i8x16>` which (with the chosen ABI) requires the `vector` target feature, which is not enabled + --> $DIR/simd-abi-checks-s390x.rs:158:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -268,7 +268,7 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>) = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) note: the lint level is defined here - --> $DIR/simd-abi-checks-s390x.rs:15:9 + --> $DIR/simd-abi-checks-s390x.rs:16:9 | LL | #![deny(abi_unsupported_vector_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd-abi-checks.rs b/tests/ui/simd-abi-checks.rs index c97767b2794..acab74300b8 100644 --- a/tests/ui/simd-abi-checks.rs +++ b/tests/ui/simd-abi-checks.rs @@ -4,7 +4,7 @@ #![feature(avx512_target_feature)] #![feature(portable_simd)] -#![feature(target_feature_11, simd_ffi)] +#![feature(simd_ffi)] #![allow(improper_ctypes_definitions)] use std::arch::x86_64::*; @@ -13,19 +13,19 @@ use std::arch::x86_64::*; struct Wrapper(__m256); unsafe extern "C" fn w(_: Wrapper) { - //~^ this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled + //~^ requires the `avx` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler todo!() } unsafe extern "C" fn f(_: __m256) { - //~^ this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled + //~^ requires the `avx` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler todo!() } unsafe extern "C" fn g() -> __m256 { - //~^ this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled + //~^ requires the `avx` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler todo!() } @@ -55,23 +55,23 @@ unsafe fn test() { unsafe fn in_closure() -> impl FnOnce() -> __m256 { #[inline(always)] // this disables target-feature inheritance || g() - //~^ WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller + //~^ WARNING requires the `avx` target feature, which is not enabled in the caller //~| WARNING this was previously accepted by the compiler } fn main() { unsafe { f(g()); - //~^ WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller - //~| WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller + //~^ WARNING requires the `avx` target feature, which is not enabled in the caller + //~| WARNING requires the `avx` target feature, which is not enabled in the caller //~| WARNING this was previously accepted by the compiler //~| WARNING this was previously accepted by the compiler } unsafe { gavx(favx()); - //~^ WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller - //~| WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller + //~^ WARNING requires the `avx` target feature, which is not enabled in the caller + //~| WARNING requires the `avx` target feature, which is not enabled in the caller //~| WARNING this was previously accepted by the compiler //~| WARNING this was previously accepted by the compiler } @@ -82,8 +82,8 @@ fn main() { unsafe { w(Wrapper(g())); - //~^ WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller - //~| WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller + //~^ WARNING requires the `avx` target feature, which is not enabled in the caller + //~| WARNING requires the `avx` target feature, which is not enabled in the caller //~| WARNING this was previously accepted by the compiler //~| WARNING this was previously accepted by the compiler } @@ -98,7 +98,7 @@ fn main() { fn some_extern() -> __m256; } some_extern(); - //~^ WARNING this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller + //~^ WARNING requires the `avx` target feature, which is not enabled in the caller //~| WARNING this was previously accepted by the compiler } } diff --git a/tests/ui/simd-abi-checks.stderr b/tests/ui/simd-abi-checks.stderr index eb7d9e81029..a849993a166 100644 --- a/tests/ui/simd-abi-checks.stderr +++ b/tests/ui/simd-abi-checks.stderr @@ -1,4 +1,4 @@ -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:64:11 | LL | f(g()); @@ -9,7 +9,7 @@ LL | f(g()); = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) = note: `#[warn(abi_unsupported_vector_types)]` on by default -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:64:9 | LL | f(g()); @@ -19,7 +19,7 @@ LL | f(g()); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:72:14 | LL | gavx(favx()); @@ -29,7 +29,7 @@ LL | gavx(favx()); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:72:9 | LL | gavx(favx()); @@ -39,7 +39,7 @@ LL | gavx(favx()); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:84:19 | LL | w(Wrapper(g())); @@ -49,7 +49,7 @@ LL | w(Wrapper(g())); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:84:9 | LL | w(Wrapper(g())); @@ -59,7 +59,7 @@ LL | w(Wrapper(g())); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:100:9 | LL | some_extern(); @@ -69,7 +69,7 @@ LL | some_extern(); = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled +warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:27:1 | LL | unsafe extern "C" fn g() -> __m256 { @@ -79,7 +79,7 @@ LL | unsafe extern "C" fn g() -> __m256 { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled +warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:21:1 | LL | unsafe extern "C" fn f(_: __m256) { @@ -89,7 +89,7 @@ LL | unsafe extern "C" fn f(_: __m256) { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled +warning: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:15:1 | LL | unsafe extern "C" fn w(_: Wrapper) { @@ -99,7 +99,7 @@ LL | unsafe extern "C" fn w(_: Wrapper) { = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:57:8 | LL | || g() @@ -112,7 +112,7 @@ LL | || g() warning: 11 warnings emitted Future incompatibility report: Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:64:11 | LL | f(g()); @@ -124,7 +124,7 @@ LL | f(g()); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:64:9 | LL | f(g()); @@ -136,7 +136,7 @@ LL | f(g()); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:72:14 | LL | gavx(favx()); @@ -148,7 +148,7 @@ LL | gavx(favx()); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:72:9 | LL | gavx(favx()); @@ -160,7 +160,7 @@ LL | gavx(favx()); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:84:19 | LL | w(Wrapper(g())); @@ -172,7 +172,7 @@ LL | w(Wrapper(g())); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:84:9 | LL | w(Wrapper(g())); @@ -184,7 +184,7 @@ LL | w(Wrapper(g())); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:100:9 | LL | some_extern(); @@ -196,7 +196,7 @@ LL | some_extern(); = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled +warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:27:1 | LL | unsafe extern "C" fn g() -> __m256 { @@ -208,7 +208,7 @@ LL | unsafe extern "C" fn g() -> __m256 { = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled +warning: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:21:1 | LL | unsafe extern "C" fn f(_: __m256) { @@ -220,7 +220,7 @@ LL | unsafe extern "C" fn f(_: __m256) { = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled +warning: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled --> $DIR/simd-abi-checks.rs:15:1 | LL | unsafe extern "C" fn w(_: Wrapper) { @@ -232,7 +232,7 @@ LL | unsafe extern "C" fn w(_: Wrapper) { = note: `#[warn(abi_unsupported_vector_types)]` on by default Future breakage diagnostic: -warning: this function call uses a SIMD vector type that (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller +warning: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller --> $DIR/simd-abi-checks.rs:57:8 | LL | || g() diff --git a/tests/ui/simd/array-trait.rs b/tests/ui/simd/array-trait.rs index 67583bf8208..32cbf01428c 100644 --- a/tests/ui/simd/array-trait.rs +++ b/tests/ui/simd/array-trait.rs @@ -24,10 +24,12 @@ pub struct T<S: Simd>([S::Lane; S::SIZE]); //~| ERROR SIMD vector element type should be a primitive scalar //~| ERROR unconstrained generic constant -extern "rust-intrinsic" { - fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T; - fn simd_extract<T, E>(x: T, idx: u32) -> E; -} +#[rustc_intrinsic] +unsafe fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T; + +#[rustc_intrinsic] +unsafe fn simd_extract<T, E>(x: T, idx: u32) -> E; + pub fn main() { let mut t = T::<i32x4>([0; 4]); diff --git a/tests/ui/simd/array-type.rs b/tests/ui/simd/array-type.rs index 8ca53b1a453..d1de7004416 100644 --- a/tests/ui/simd/array-type.rs +++ b/tests/ui/simd/array-type.rs @@ -12,10 +12,12 @@ struct S([i32; 4]); #[derive(Copy, Clone)] struct T<const N: usize>([i32; N]); -extern "rust-intrinsic" { - fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T; - fn simd_extract<T, E>(x: T, idx: u32) -> E; -} +#[rustc_intrinsic] +unsafe fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T; + +#[rustc_intrinsic] +unsafe fn simd_extract<T, E>(x: T, idx: u32) -> E; + pub fn main() { let mut s = S([0; 4]); diff --git a/tests/ui/simd/generics.rs b/tests/ui/simd/generics.rs index f96a7cd75e9..453ed86c14a 100644 --- a/tests/ui/simd/generics.rs +++ b/tests/ui/simd/generics.rs @@ -21,9 +21,8 @@ struct B<T>([T; 4]); struct C<T, const N: usize>([T; N]); -extern "rust-intrinsic" { - fn simd_add<T>(x: T, y: T) -> T; -} +#[rustc_intrinsic] +unsafe fn simd_add<T>(x: T, y: T) -> T; fn add<T: ops::Add<Output=T>>(lhs: T, rhs: T) -> T { lhs + rhs diff --git a/tests/ui/simd/intrinsic/float-math-pass.rs b/tests/ui/simd/intrinsic/float-math-pass.rs index 24b9941133e..74cb51a0606 100644 --- a/tests/ui/simd/intrinsic/float-math-pass.rs +++ b/tests/ui/simd/intrinsic/float-math-pass.rs @@ -15,27 +15,59 @@ #[derive(Copy, Clone, PartialEq, Debug)] struct f32x4(pub [f32; 4]); -extern "rust-intrinsic" { - fn simd_fsqrt<T>(x: T) -> T; - fn simd_fabs<T>(x: T) -> T; - fn simd_fsin<T>(x: T) -> T; - fn simd_fcos<T>(x: T) -> T; - fn simd_fexp<T>(x: T) -> T; - fn simd_fexp2<T>(x: T) -> T; - fn simd_fma<T>(x: T, y: T, z: T) -> T; - fn simd_relaxed_fma<T>(x: T, y: T, z: T) -> T; - fn simd_flog<T>(x: T) -> T; - fn simd_flog10<T>(x: T) -> T; - fn simd_flog2<T>(x: T) -> T; - fn simd_fpow<T>(x: T, y: T) -> T; - fn simd_fpowi<T>(x: T, y: i32) -> T; - - // rounding functions - fn simd_ceil<T>(x: T) -> T; - fn simd_floor<T>(x: T) -> T; - fn simd_round<T>(x: T) -> T; - fn simd_trunc<T>(x: T) -> T; -} +#[rustc_intrinsic] +unsafe fn simd_fsqrt<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_fabs<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_fsin<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_fcos<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_fexp<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_fexp2<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_fma<T>(x: T, y: T, z: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_relaxed_fma<T>(x: T, y: T, z: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_flog<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_flog10<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_flog2<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_fpow<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_fpowi<T>(x: T, y: i32) -> T; + + +// rounding functions +#[rustc_intrinsic] +unsafe fn simd_ceil<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_floor<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_round<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_trunc<T>(x: T) -> T; + macro_rules! assert_approx_eq_f32 { ($a:expr, $b:expr) => ({ diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-2.rs b/tests/ui/simd/intrinsic/generic-arithmetic-2.rs index 663bcdf1981..0fcff8584c8 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-2.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-2.rs @@ -14,25 +14,54 @@ pub struct u32x4(pub [u32; 4]); #[derive(Copy, Clone)] pub struct f32x4(pub [f32; 4]); -extern "rust-intrinsic" { - fn simd_add<T>(x: T, y: T) -> T; - fn simd_sub<T>(x: T, y: T) -> T; - fn simd_mul<T>(x: T, y: T) -> T; - fn simd_div<T>(x: T, y: T) -> T; - fn simd_rem<T>(x: T, y: T) -> T; - fn simd_shl<T>(x: T, y: T) -> T; - fn simd_shr<T>(x: T, y: T) -> T; - fn simd_and<T>(x: T, y: T) -> T; - fn simd_or<T>(x: T, y: T) -> T; - fn simd_xor<T>(x: T, y: T) -> T; - - fn simd_neg<T>(x: T) -> T; - fn simd_bswap<T>(x: T) -> T; - fn simd_bitreverse<T>(x: T) -> T; - fn simd_ctlz<T>(x: T) -> T; - fn simd_ctpop<T>(x: T) -> T; - fn simd_cttz<T>(x: T) -> T; -} +#[rustc_intrinsic] +unsafe fn simd_add<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_sub<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_mul<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_div<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_rem<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_shl<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_shr<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_and<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_or<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_xor<T>(x: T, y: T) -> T; + + +#[rustc_intrinsic] +unsafe fn simd_neg<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_bswap<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_bitreverse<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_ctlz<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_ctpop<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_cttz<T>(x: T) -> T; fn main() { let x = i32x4([0, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr b/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr index 6f5f86d7d37..e67de2fe903 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr +++ b/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr @@ -1,143 +1,143 @@ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:81:9 + --> $DIR/generic-arithmetic-2.rs:110:9 | LL | simd_add(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_sub` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:83:9 + --> $DIR/generic-arithmetic-2.rs:112:9 | LL | simd_sub(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_mul` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:85:9 + --> $DIR/generic-arithmetic-2.rs:114:9 | LL | simd_mul(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_div` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:87:9 + --> $DIR/generic-arithmetic-2.rs:116:9 | LL | simd_div(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shl` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:89:9 + --> $DIR/generic-arithmetic-2.rs:118:9 | LL | simd_shl(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shr` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:91:9 + --> $DIR/generic-arithmetic-2.rs:120:9 | LL | simd_shr(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_and` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:93:9 + --> $DIR/generic-arithmetic-2.rs:122:9 | LL | simd_and(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_or` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:95:9 + --> $DIR/generic-arithmetic-2.rs:124:9 | LL | simd_or(0, 0); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_xor` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:97:9 + --> $DIR/generic-arithmetic-2.rs:126:9 | LL | simd_xor(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_neg` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:100:9 + --> $DIR/generic-arithmetic-2.rs:129:9 | LL | simd_neg(0); | ^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bswap` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:102:9 + --> $DIR/generic-arithmetic-2.rs:131:9 | LL | simd_bswap(0); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitreverse` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:104:9 + --> $DIR/generic-arithmetic-2.rs:133:9 | LL | simd_bitreverse(0); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ctlz` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:106:9 + --> $DIR/generic-arithmetic-2.rs:135:9 | LL | simd_ctlz(0); | ^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cttz` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:108:9 + --> $DIR/generic-arithmetic-2.rs:137:9 | LL | simd_cttz(0); | ^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shl` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:111:9 + --> $DIR/generic-arithmetic-2.rs:140:9 | LL | simd_shl(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shr` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:113:9 + --> $DIR/generic-arithmetic-2.rs:142:9 | LL | simd_shr(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_and` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:115:9 + --> $DIR/generic-arithmetic-2.rs:144:9 | LL | simd_and(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_or` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:117:9 + --> $DIR/generic-arithmetic-2.rs:146:9 | LL | simd_or(z, z); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_xor` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:119:9 + --> $DIR/generic-arithmetic-2.rs:148:9 | LL | simd_xor(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bswap` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:121:9 + --> $DIR/generic-arithmetic-2.rs:150:9 | LL | simd_bswap(z); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitreverse` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:123:9 + --> $DIR/generic-arithmetic-2.rs:152:9 | LL | simd_bitreverse(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ctlz` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:125:9 + --> $DIR/generic-arithmetic-2.rs:154:9 | LL | simd_ctlz(z); | ^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ctpop` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:127:9 + --> $DIR/generic-arithmetic-2.rs:156:9 | LL | simd_ctpop(z); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cttz` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:129:9 + --> $DIR/generic-arithmetic-2.rs:158:9 | LL | simd_cttz(z); | ^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs index e4eb2a9da27..4a18c0164e4 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs @@ -23,25 +23,54 @@ macro_rules! all_eq { }}; } -extern "rust-intrinsic" { - fn simd_add<T>(x: T, y: T) -> T; - fn simd_sub<T>(x: T, y: T) -> T; - fn simd_mul<T>(x: T, y: T) -> T; - fn simd_div<T>(x: T, y: T) -> T; - fn simd_rem<T>(x: T, y: T) -> T; - fn simd_shl<T>(x: T, y: T) -> T; - fn simd_shr<T>(x: T, y: T) -> T; - fn simd_and<T>(x: T, y: T) -> T; - fn simd_or<T>(x: T, y: T) -> T; - fn simd_xor<T>(x: T, y: T) -> T; - - fn simd_neg<T>(x: T) -> T; - fn simd_bswap<T>(x: T) -> T; - fn simd_bitreverse<T>(x: T) -> T; - fn simd_ctlz<T>(x: T) -> T; - fn simd_ctpop<T>(x: T) -> T; - fn simd_cttz<T>(x: T) -> T; -} +#[rustc_intrinsic] +unsafe fn simd_add<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_sub<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_mul<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_div<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_rem<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_shl<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_shr<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_and<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_or<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_xor<T>(x: T, y: T) -> T; + + +#[rustc_intrinsic] +unsafe fn simd_neg<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_bswap<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_bitreverse<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_ctlz<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_ctpop<T>(x: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_cttz<T>(x: T) -> T; fn main() { let x1 = i32x4([1, 2, 3, 4]); diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.rs b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.rs index ec6ac78df1a..85464402d6a 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.rs @@ -14,10 +14,12 @@ pub struct x4<T>(pub [T; 4]); #[derive(Copy, Clone)] pub struct f32x4(pub [f32; 4]); -extern "rust-intrinsic" { - fn simd_saturating_add<T>(x: T, y: T) -> T; - fn simd_saturating_sub<T>(x: T, y: T) -> T; -} +#[rustc_intrinsic] +unsafe fn simd_saturating_add<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_saturating_sub<T>(x: T, y: T) -> T; + fn main() { let x = i32x4([0, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.stderr b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.stderr index f349cb56560..cf275db7e43 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.stderr +++ b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.stderr @@ -1,11 +1,11 @@ error[E0511]: invalid monomorphization of `simd_saturating_add` intrinsic: expected element type `f32` of vector type `f32x4` to be a signed or unsigned integer type - --> $DIR/generic-arithmetic-saturating-2.rs:33:9 + --> $DIR/generic-arithmetic-saturating-2.rs:35:9 | LL | simd_saturating_add(z, z); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_saturating_sub` intrinsic: expected element type `f32` of vector type `f32x4` to be a signed or unsigned integer type - --> $DIR/generic-arithmetic-saturating-2.rs:35:9 + --> $DIR/generic-arithmetic-saturating-2.rs:37:9 | LL | simd_saturating_sub(z, z); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs index 57bda5c2d62..5fe65257d15 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs @@ -12,10 +12,12 @@ struct u32x4(pub [u32; 4]); #[derive(Copy, Clone)] struct I32<const N: usize>([i32; N]); -extern "rust-intrinsic" { - fn simd_saturating_add<T>(x: T, y: T) -> T; - fn simd_saturating_sub<T>(x: T, y: T) -> T; -} +#[rustc_intrinsic] +unsafe fn simd_saturating_add<T>(x: T, y: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_saturating_sub<T>(x: T, y: T) -> T; + fn main() { // unsigned diff --git a/tests/ui/simd/intrinsic/generic-as.rs b/tests/ui/simd/intrinsic/generic-as.rs index e97bf12c144..124ca56bc88 100644 --- a/tests/ui/simd/intrinsic/generic-as.rs +++ b/tests/ui/simd/intrinsic/generic-as.rs @@ -2,9 +2,9 @@ #![feature(repr_simd, intrinsics)] -extern "rust-intrinsic" { - fn simd_as<T, U>(x: T) -> U; -} + +#[rustc_intrinsic] +unsafe fn simd_as<T, U>(x: T) -> U; #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/simd/intrinsic/generic-bitmask-pass.rs b/tests/ui/simd/intrinsic/generic-bitmask-pass.rs index db10020bd46..08526991fbe 100644 --- a/tests/ui/simd/intrinsic/generic-bitmask-pass.rs +++ b/tests/ui/simd/intrinsic/generic-bitmask-pass.rs @@ -21,9 +21,8 @@ struct u8x4(pub [u8; 4]); #[derive(Copy, Clone, PartialEq, Debug)] struct Tx4<T>(pub [T; 4]); -extern "rust-intrinsic" { - fn simd_bitmask<T, U>(x: T) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_bitmask<T, U>(x: T) -> U; fn main() { let z = u32x4([0, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-bitmask.rs b/tests/ui/simd/intrinsic/generic-bitmask.rs index 29b9279c370..49589d22bbf 100644 --- a/tests/ui/simd/intrinsic/generic-bitmask.rs +++ b/tests/ui/simd/intrinsic/generic-bitmask.rs @@ -30,9 +30,8 @@ struct u8x32([u8; 32]); #[derive(Copy, Clone)] struct u8x64([u8; 64]); -extern "rust-intrinsic" { - fn simd_bitmask<T, U>(x: T) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_bitmask<T, U>(x: T) -> U; fn main() { let m2 = u32x2([0; 2]); diff --git a/tests/ui/simd/intrinsic/generic-bitmask.stderr b/tests/ui/simd/intrinsic/generic-bitmask.stderr index 0de3f8eead8..c217bb2d8f1 100644 --- a/tests/ui/simd/intrinsic/generic-bitmask.stderr +++ b/tests/ui/simd/intrinsic/generic-bitmask.stderr @@ -1,29 +1,29 @@ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u16`, expected `u8` or `[u8; 1]` - --> $DIR/generic-bitmask.rs:53:22 + --> $DIR/generic-bitmask.rs:52:22 | LL | let _: u16 = simd_bitmask(m2); | ^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u16`, expected `u8` or `[u8; 1]` - --> $DIR/generic-bitmask.rs:56:22 + --> $DIR/generic-bitmask.rs:55:22 | LL | let _: u16 = simd_bitmask(m8); | ^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u32`, expected `u16` or `[u8; 2]` - --> $DIR/generic-bitmask.rs:59:22 + --> $DIR/generic-bitmask.rs:58:22 | LL | let _: u32 = simd_bitmask(m16); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u64`, expected `u32` or `[u8; 4]` - --> $DIR/generic-bitmask.rs:62:22 + --> $DIR/generic-bitmask.rs:61:22 | LL | let _: u64 = simd_bitmask(m32); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u128`, expected `u64` or `[u8; 8]` - --> $DIR/generic-bitmask.rs:65:23 + --> $DIR/generic-bitmask.rs:64:23 | LL | let _: u128 = simd_bitmask(m64); | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-bswap-byte.rs b/tests/ui/simd/intrinsic/generic-bswap-byte.rs index f1702538165..4521573636c 100644 --- a/tests/ui/simd/intrinsic/generic-bswap-byte.rs +++ b/tests/ui/simd/intrinsic/generic-bswap-byte.rs @@ -10,9 +10,8 @@ struct i8x4([i8; 4]); #[derive(Copy, Clone)] struct u8x4([u8; 4]); -extern "rust-intrinsic" { - fn simd_bswap<T>(x: T) -> T; -} +#[rustc_intrinsic] +unsafe fn simd_bswap<T>(x: T) -> T; fn main() { unsafe { diff --git a/tests/ui/simd/intrinsic/generic-cast-pass.rs b/tests/ui/simd/intrinsic/generic-cast-pass.rs index e0319a6461a..2155d845864 100644 --- a/tests/ui/simd/intrinsic/generic-cast-pass.rs +++ b/tests/ui/simd/intrinsic/generic-cast-pass.rs @@ -3,9 +3,9 @@ #![feature(repr_simd, intrinsics)] -extern "rust-intrinsic" { - fn simd_cast<T, U>(x: T) -> U; -} + +#[rustc_intrinsic] +unsafe fn simd_cast<T, U>(x: T) -> U; use std::cmp::{max, min}; diff --git a/tests/ui/simd/intrinsic/generic-cast-pointer-width.rs b/tests/ui/simd/intrinsic/generic-cast-pointer-width.rs index 1c09a9fbf3b..9f28898654f 100644 --- a/tests/ui/simd/intrinsic/generic-cast-pointer-width.rs +++ b/tests/ui/simd/intrinsic/generic-cast-pointer-width.rs @@ -1,9 +1,8 @@ //@ run-pass #![feature(repr_simd, intrinsics)] -extern "rust-intrinsic" { - fn simd_cast<T, U>(x: T) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_cast<T, U>(x: T) -> U; #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/simd/intrinsic/generic-cast.rs b/tests/ui/simd/intrinsic/generic-cast.rs index 33978a2f739..7f398804eb4 100644 --- a/tests/ui/simd/intrinsic/generic-cast.rs +++ b/tests/ui/simd/intrinsic/generic-cast.rs @@ -21,9 +21,8 @@ struct f32x4([f32; 4]); struct f32x8([f32; 8]); -extern "rust-intrinsic" { - fn simd_cast<T, U>(x: T) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_cast<T, U>(x: T) -> U; fn main() { let x = i32x4([0, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-cast.stderr b/tests/ui/simd/intrinsic/generic-cast.stderr index 2f9d44037af..1b6ac03f8c9 100644 --- a/tests/ui/simd/intrinsic/generic-cast.stderr +++ b/tests/ui/simd/intrinsic/generic-cast.stderr @@ -1,23 +1,23 @@ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-cast.rs:32:9 + --> $DIR/generic-cast.rs:31:9 | LL | simd_cast::<i32, i32>(0); | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-cast.rs:34:9 + --> $DIR/generic-cast.rs:33:9 | LL | simd_cast::<i32, i32x4>(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-cast.rs:36:9 + --> $DIR/generic-cast.rs:35:9 | LL | simd_cast::<i32x4, i32>(x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i32x8` with length 8 - --> $DIR/generic-cast.rs:38:9 + --> $DIR/generic-cast.rs:37:9 | LL | simd_cast::<_, i32x8>(x); | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-comparison-pass.rs b/tests/ui/simd/intrinsic/generic-comparison-pass.rs index a4d84a4c534..68f98372e1d 100644 --- a/tests/ui/simd/intrinsic/generic-comparison-pass.rs +++ b/tests/ui/simd/intrinsic/generic-comparison-pass.rs @@ -14,14 +14,24 @@ struct u32x4(pub [u32; 4]); #[derive(Copy, Clone)] struct f32x4(pub [f32; 4]); -extern "rust-intrinsic" { - fn simd_eq<T, U>(x: T, y: T) -> U; - fn simd_ne<T, U>(x: T, y: T) -> U; - fn simd_lt<T, U>(x: T, y: T) -> U; - fn simd_le<T, U>(x: T, y: T) -> U; - fn simd_gt<T, U>(x: T, y: T) -> U; - fn simd_ge<T, U>(x: T, y: T) -> U; -} + +#[rustc_intrinsic] +unsafe fn simd_eq<T, U>(x: T, y: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_ne<T, U>(x: T, y: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_lt<T, U>(x: T, y: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_le<T, U>(x: T, y: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_gt<T, U>(x: T, y: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_ge<T, U>(x: T, y: T) -> U; macro_rules! cmp { ($method: ident($lhs: expr, $rhs: expr)) => {{ diff --git a/tests/ui/simd/intrinsic/generic-comparison.rs b/tests/ui/simd/intrinsic/generic-comparison.rs index f7f0655f3d2..e5adb49f6a3 100644 --- a/tests/ui/simd/intrinsic/generic-comparison.rs +++ b/tests/ui/simd/intrinsic/generic-comparison.rs @@ -11,14 +11,24 @@ struct i32x4([i32; 4]); #[allow(non_camel_case_types)] struct i16x8([i16; 8]); -extern "rust-intrinsic" { - fn simd_eq<T, U>(x: T, y: T) -> U; - fn simd_ne<T, U>(x: T, y: T) -> U; - fn simd_lt<T, U>(x: T, y: T) -> U; - fn simd_le<T, U>(x: T, y: T) -> U; - fn simd_gt<T, U>(x: T, y: T) -> U; - fn simd_ge<T, U>(x: T, y: T) -> U; -} + +#[rustc_intrinsic] +unsafe fn simd_eq<T, U>(x: T, y: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_ne<T, U>(x: T, y: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_lt<T, U>(x: T, y: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_le<T, U>(x: T, y: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_gt<T, U>(x: T, y: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_ge<T, U>(x: T, y: T) -> U; fn main() { let x = i32x4([0, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-comparison.stderr b/tests/ui/simd/intrinsic/generic-comparison.stderr index ac4d4918827..cc66d2ce40a 100644 --- a/tests/ui/simd/intrinsic/generic-comparison.stderr +++ b/tests/ui/simd/intrinsic/generic-comparison.stderr @@ -1,107 +1,107 @@ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:27:9 + --> $DIR/generic-comparison.rs:37:9 | LL | simd_eq::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:29:9 + --> $DIR/generic-comparison.rs:39:9 | LL | simd_ne::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:31:9 + --> $DIR/generic-comparison.rs:41:9 | LL | simd_lt::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:33:9 + --> $DIR/generic-comparison.rs:43:9 | LL | simd_le::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:35:9 + --> $DIR/generic-comparison.rs:45:9 | LL | simd_gt::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:37:9 + --> $DIR/generic-comparison.rs:47:9 | LL | simd_ge::<i32, i32>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:40:9 + --> $DIR/generic-comparison.rs:50:9 | LL | simd_eq::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:42:9 + --> $DIR/generic-comparison.rs:52:9 | LL | simd_ne::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:44:9 + --> $DIR/generic-comparison.rs:54:9 | LL | simd_lt::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:46:9 + --> $DIR/generic-comparison.rs:56:9 | LL | simd_le::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:48:9 + --> $DIR/generic-comparison.rs:58:9 | LL | simd_gt::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:50:9 + --> $DIR/generic-comparison.rs:60:9 | LL | simd_ge::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:53:9 + --> $DIR/generic-comparison.rs:63:9 | LL | simd_eq::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:55:9 + --> $DIR/generic-comparison.rs:65:9 | LL | simd_ne::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:57:9 + --> $DIR/generic-comparison.rs:67:9 | LL | simd_lt::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:59:9 + --> $DIR/generic-comparison.rs:69:9 | LL | simd_le::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:61:9 + --> $DIR/generic-comparison.rs:71:9 | LL | simd_gt::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:63:9 + --> $DIR/generic-comparison.rs:73:9 | LL | simd_ge::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-elements-pass.rs b/tests/ui/simd/intrinsic/generic-elements-pass.rs index 7b1bda4fbcd..8cb600bc9e4 100644 --- a/tests/ui/simd/intrinsic/generic-elements-pass.rs +++ b/tests/ui/simd/intrinsic/generic-elements-pass.rs @@ -16,12 +16,15 @@ struct i32x4([i32; 4]); #[allow(non_camel_case_types)] struct i32x8([i32; 8]); -extern "rust-intrinsic" { - fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T; - fn simd_extract<T, E>(x: T, idx: u32) -> E; +#[rustc_intrinsic] +unsafe fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T; - fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_extract<T, E>(x: T, idx: u32) -> E; + + +#[rustc_intrinsic] +unsafe fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; #[repr(simd)] struct SimdShuffleIdx<const LEN: usize>([u32; LEN]); diff --git a/tests/ui/simd/intrinsic/generic-elements.rs b/tests/ui/simd/intrinsic/generic-elements.rs index 5d784a25eab..4be6645f029 100644 --- a/tests/ui/simd/intrinsic/generic-elements.rs +++ b/tests/ui/simd/intrinsic/generic-elements.rs @@ -29,13 +29,20 @@ struct f32x4([f32; 4]); #[allow(non_camel_case_types)] struct f32x8([f32; 8]); -extern "rust-intrinsic" { - fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T; - fn simd_extract<T, E>(x: T, idx: u32) -> E; - fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; - fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T; + +#[rustc_intrinsic] +unsafe fn simd_extract<T, E>(x: T, idx: u32) -> E; + + +#[rustc_intrinsic] +unsafe fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; + +#[rustc_intrinsic] +unsafe fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U; + #[repr(simd)] struct SimdShuffleIdx<const LEN: usize>([u32; LEN]); diff --git a/tests/ui/simd/intrinsic/generic-elements.stderr b/tests/ui/simd/intrinsic/generic-elements.stderr index fd726d75326..8104c3ba5a2 100644 --- a/tests/ui/simd/intrinsic/generic-elements.stderr +++ b/tests/ui/simd/intrinsic/generic-elements.stderr @@ -1,125 +1,125 @@ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:47:9 + --> $DIR/generic-elements.rs:54:9 | LL | simd_insert(0, 0, 0); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected inserted type `i32` (element of input `i32x4`), found `f64` - --> $DIR/generic-elements.rs:49:9 + --> $DIR/generic-elements.rs:56:9 | LL | simd_insert(x, 0, 1.0); | ^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_extract` intrinsic: expected return type `i32` (element of input `i32x4`), found `f32` - --> $DIR/generic-elements.rs:51:9 + --> $DIR/generic-elements.rs:58:9 | LL | simd_extract::<_, f32>(x, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:55:9 + --> $DIR/generic-elements.rs:62:9 | LL | simd_shuffle::<i32, _, i32>(0, 0, IDX2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:58:9 + --> $DIR/generic-elements.rs:65:9 | LL | simd_shuffle::<i32, _, i32>(0, 0, IDX4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:61:9 + --> $DIR/generic-elements.rs:68:9 | LL | simd_shuffle::<i32, _, i32>(0, 0, IDX8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32` - --> $DIR/generic-elements.rs:64:9 + --> $DIR/generic-elements.rs:71:9 | LL | simd_shuffle::<_, _, f32x2>(x, x, IDX2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32` - --> $DIR/generic-elements.rs:66:9 + --> $DIR/generic-elements.rs:73:9 | LL | simd_shuffle::<_, _, f32x4>(x, x, IDX4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32` - --> $DIR/generic-elements.rs:68:9 + --> $DIR/generic-elements.rs:75:9 | LL | simd_shuffle::<_, _, f32x8>(x, x, IDX8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 2, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:71:9 + --> $DIR/generic-elements.rs:78:9 | LL | simd_shuffle::<_, _, i32x8>(x, x, IDX2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 4, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:73:9 + --> $DIR/generic-elements.rs:80:9 | LL | simd_shuffle::<_, _, i32x8>(x, x, IDX4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 8, found `i32x2` with length 2 - --> $DIR/generic-elements.rs:75:9 + --> $DIR/generic-elements.rs:82:9 | LL | simd_shuffle::<_, _, i32x2>(x, x, IDX8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:79:9 + --> $DIR/generic-elements.rs:86:9 | LL | simd_shuffle_generic::<i32, i32, I2>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:82:9 + --> $DIR/generic-elements.rs:89:9 | LL | simd_shuffle_generic::<i32, i32, I4>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:85:9 + --> $DIR/generic-elements.rs:92:9 | LL | simd_shuffle_generic::<i32, i32, I8>(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32` - --> $DIR/generic-elements.rs:88:9 + --> $DIR/generic-elements.rs:95:9 | LL | simd_shuffle_generic::<_, f32x2, I2>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32` - --> $DIR/generic-elements.rs:90:9 + --> $DIR/generic-elements.rs:97:9 | LL | simd_shuffle_generic::<_, f32x4, I4>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32` - --> $DIR/generic-elements.rs:92:9 + --> $DIR/generic-elements.rs:99:9 | LL | simd_shuffle_generic::<_, f32x8, I8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 2, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:95:9 + --> $DIR/generic-elements.rs:102:9 | LL | simd_shuffle_generic::<_, i32x8, I2>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 4, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:97:9 + --> $DIR/generic-elements.rs:104:9 | LL | simd_shuffle_generic::<_, i32x8, I4>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 8, found `i32x2` with length 2 - --> $DIR/generic-elements.rs:99:9 + --> $DIR/generic-elements.rs:106:9 | LL | simd_shuffle_generic::<_, i32x2, I8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-gather-pass.rs b/tests/ui/simd/intrinsic/generic-gather-pass.rs index 3315d1cdaa2..0b2cf47e989 100644 --- a/tests/ui/simd/intrinsic/generic-gather-pass.rs +++ b/tests/ui/simd/intrinsic/generic-gather-pass.rs @@ -10,10 +10,11 @@ #[derive(Copy, Clone, PartialEq, Debug)] struct x4<T>(pub [T; 4]); -extern "rust-intrinsic" { - fn simd_gather<T, U, V>(x: T, y: U, z: V) -> T; - fn simd_scatter<T, U, V>(x: T, y: U, z: V) -> (); -} +#[rustc_intrinsic] +unsafe fn simd_gather<T, U, V>(x: T, y: U, z: V) -> T; + +#[rustc_intrinsic] +unsafe fn simd_scatter<T, U, V>(x: T, y: U, z: V) -> (); fn main() { let mut x = [0_f32, 1., 2., 3., 4., 5., 6., 7.]; diff --git a/tests/ui/simd/intrinsic/generic-reduction-pass.rs b/tests/ui/simd/intrinsic/generic-reduction-pass.rs index 699fb396259..8408d0f203b 100644 --- a/tests/ui/simd/intrinsic/generic-reduction-pass.rs +++ b/tests/ui/simd/intrinsic/generic-reduction-pass.rs @@ -24,19 +24,38 @@ struct f32x4(pub [f32; 4]); #[derive(Copy, Clone)] struct b8x4(pub [i8; 4]); -extern "rust-intrinsic" { - fn simd_reduce_add_unordered<T, U>(x: T) -> U; - fn simd_reduce_mul_unordered<T, U>(x: T) -> U; - fn simd_reduce_add_ordered<T, U>(x: T, acc: U) -> U; - fn simd_reduce_mul_ordered<T, U>(x: T, acc: U) -> U; - fn simd_reduce_min<T, U>(x: T) -> U; - fn simd_reduce_max<T, U>(x: T) -> U; - fn simd_reduce_and<T, U>(x: T) -> U; - fn simd_reduce_or<T, U>(x: T) -> U; - fn simd_reduce_xor<T, U>(x: T) -> U; - fn simd_reduce_all<T>(x: T) -> bool; - fn simd_reduce_any<T>(x: T) -> bool; -} +#[rustc_intrinsic] +unsafe fn simd_reduce_add_unordered<T, U>(x: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_reduce_mul_unordered<T, U>(x: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_reduce_add_ordered<T, U>(x: T, acc: U) -> U; + +#[rustc_intrinsic] +unsafe fn simd_reduce_mul_ordered<T, U>(x: T, acc: U) -> U; + +#[rustc_intrinsic] +unsafe fn simd_reduce_min<T, U>(x: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_reduce_max<T, U>(x: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_reduce_and<T, U>(x: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_reduce_or<T, U>(x: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_reduce_xor<T, U>(x: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_reduce_all<T>(x: T) -> bool; + +#[rustc_intrinsic] +unsafe fn simd_reduce_any<T>(x: T) -> bool; fn main() { unsafe { diff --git a/tests/ui/simd/intrinsic/generic-reduction.rs b/tests/ui/simd/intrinsic/generic-reduction.rs index 1986deafb6a..ead13250643 100644 --- a/tests/ui/simd/intrinsic/generic-reduction.rs +++ b/tests/ui/simd/intrinsic/generic-reduction.rs @@ -15,16 +15,26 @@ pub struct f32x4(pub [f32; 4]); #[derive(Copy, Clone)] pub struct u32x4(pub [u32; 4]); +#[rustc_intrinsic] +unsafe fn simd_reduce_add_ordered<T, U>(x: T, y: U) -> U; -extern "rust-intrinsic" { - fn simd_reduce_add_ordered<T, U>(x: T, y: U) -> U; - fn simd_reduce_mul_ordered<T, U>(x: T, y: U) -> U; - fn simd_reduce_and<T, U>(x: T) -> U; - fn simd_reduce_or<T, U>(x: T) -> U; - fn simd_reduce_xor<T, U>(x: T) -> U; - fn simd_reduce_all<T>(x: T) -> bool; - fn simd_reduce_any<T>(x: T) -> bool; -} +#[rustc_intrinsic] +unsafe fn simd_reduce_mul_ordered<T, U>(x: T, y: U) -> U; + +#[rustc_intrinsic] +unsafe fn simd_reduce_and<T, U>(x: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_reduce_or<T, U>(x: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_reduce_xor<T, U>(x: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_reduce_all<T>(x: T) -> bool; + +#[rustc_intrinsic] +unsafe fn simd_reduce_any<T>(x: T) -> bool; fn main() { let x = u32x4([0, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-reduction.stderr b/tests/ui/simd/intrinsic/generic-reduction.stderr index 1028faf69a7..302b9ae1d77 100644 --- a/tests/ui/simd/intrinsic/generic-reduction.stderr +++ b/tests/ui/simd/intrinsic/generic-reduction.stderr @@ -1,59 +1,59 @@ error[E0511]: invalid monomorphization of `simd_reduce_add_ordered` intrinsic: expected return type `f32` (element of input `f32x4`), found `i32` - --> $DIR/generic-reduction.rs:34:9 + --> $DIR/generic-reduction.rs:44:9 | LL | simd_reduce_add_ordered(z, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_mul_ordered` intrinsic: expected return type `f32` (element of input `f32x4`), found `i32` - --> $DIR/generic-reduction.rs:36:9 + --> $DIR/generic-reduction.rs:46:9 | LL | simd_reduce_mul_ordered(z, 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_and` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/generic-reduction.rs:39:22 + --> $DIR/generic-reduction.rs:49:22 | LL | let _: f32 = simd_reduce_and(x); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_or` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/generic-reduction.rs:41:22 + --> $DIR/generic-reduction.rs:51:22 | LL | let _: f32 = simd_reduce_or(x); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_xor` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/generic-reduction.rs:43:22 + --> $DIR/generic-reduction.rs:53:22 | LL | let _: f32 = simd_reduce_xor(x); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_and` intrinsic: unsupported simd_reduce_and from `f32x4` with element `f32` to `f32` - --> $DIR/generic-reduction.rs:46:22 + --> $DIR/generic-reduction.rs:56:22 | LL | let _: f32 = simd_reduce_and(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_or` intrinsic: unsupported simd_reduce_or from `f32x4` with element `f32` to `f32` - --> $DIR/generic-reduction.rs:48:22 + --> $DIR/generic-reduction.rs:58:22 | LL | let _: f32 = simd_reduce_or(z); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_xor` intrinsic: unsupported simd_reduce_xor from `f32x4` with element `f32` to `f32` - --> $DIR/generic-reduction.rs:50:22 + --> $DIR/generic-reduction.rs:60:22 | LL | let _: f32 = simd_reduce_xor(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_all` intrinsic: unsupported simd_reduce_all from `f32x4` with element `f32` to `bool` - --> $DIR/generic-reduction.rs:53:23 + --> $DIR/generic-reduction.rs:63:23 | LL | let _: bool = simd_reduce_all(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_any` intrinsic: unsupported simd_reduce_any from `f32x4` with element `f32` to `bool` - --> $DIR/generic-reduction.rs:55:23 + --> $DIR/generic-reduction.rs:65:23 | LL | let _: bool = simd_reduce_any(z); | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-select-pass.rs b/tests/ui/simd/intrinsic/generic-select-pass.rs index 5690bad5048..6b1b6cb79db 100644 --- a/tests/ui/simd/intrinsic/generic-select-pass.rs +++ b/tests/ui/simd/intrinsic/generic-select-pass.rs @@ -29,10 +29,12 @@ struct f32x4(pub [f32; 4]); #[derive(Copy, Clone, PartialEq, Debug)] struct b8x4(pub [i8; 4]); -extern "rust-intrinsic" { - fn simd_select<T, U>(x: T, a: U, b: U) -> U; - fn simd_select_bitmask<T, U>(x: T, a: U, b: U) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_select<T, U>(x: T, a: U, b: U) -> U; + +#[rustc_intrinsic] +unsafe fn simd_select_bitmask<T, U>(x: T, a: U, b: U) -> U; + fn main() { let m0 = b8x4([!0, !0, !0, !0]); diff --git a/tests/ui/simd/intrinsic/generic-select.rs b/tests/ui/simd/intrinsic/generic-select.rs index 52e02649590..340fe3f3592 100644 --- a/tests/ui/simd/intrinsic/generic-select.rs +++ b/tests/ui/simd/intrinsic/generic-select.rs @@ -22,10 +22,13 @@ struct b8x4(pub [i8; 4]); #[derive(Copy, Clone, PartialEq)] struct b8x8(pub [i8; 8]); -extern "rust-intrinsic" { - fn simd_select<T, U>(x: T, a: U, b: U) -> U; - fn simd_select_bitmask<T, U>(x: T, a: U, b: U) -> U; -} + +#[rustc_intrinsic] +unsafe fn simd_select<T, U>(x: T, a: U, b: U) -> U; + +#[rustc_intrinsic] +unsafe fn simd_select_bitmask<T, U>(x: T, a: U, b: U) -> U; + fn main() { let m4 = b8x4([0, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-select.stderr b/tests/ui/simd/intrinsic/generic-select.stderr index d576f1bc774..a97fc91f951 100644 --- a/tests/ui/simd/intrinsic/generic-select.stderr +++ b/tests/ui/simd/intrinsic/generic-select.stderr @@ -1,47 +1,47 @@ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mismatched lengths: mask length `8` != other vector length `4` - --> $DIR/generic-select.rs:39:9 + --> $DIR/generic-select.rs:42:9 | LL | simd_select(m8, x, x); | ^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `u32`, expected `i_` - --> $DIR/generic-select.rs:42:9 + --> $DIR/generic-select.rs:45:9 | LL | simd_select(x, x, x); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `f32`, expected `i_` - --> $DIR/generic-select.rs:45:9 + --> $DIR/generic-select.rs:48:9 | LL | simd_select(z, z, z); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select` intrinsic: expected SIMD argument type, found non-SIMD `u32` - --> $DIR/generic-select.rs:48:9 + --> $DIR/generic-select.rs:51:9 | LL | simd_select(m4, 0u32, 1u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: invalid bitmask `u16`, expected `u8` or `[u8; 1]` - --> $DIR/generic-select.rs:51:9 + --> $DIR/generic-select.rs:54:9 | LL | simd_select_bitmask(0u16, x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: expected SIMD argument type, found non-SIMD `u32` - --> $DIR/generic-select.rs:54:9 + --> $DIR/generic-select.rs:57:9 | LL | simd_select_bitmask(0u8, 1u32, 2u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: invalid bitmask `f32`, expected `u8` or `[u8; 1]` - --> $DIR/generic-select.rs:57:9 + --> $DIR/generic-select.rs:60:9 | LL | simd_select_bitmask(0.0f32, x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: invalid bitmask `&str`, expected `u8` or `[u8; 1]` - --> $DIR/generic-select.rs:60:9 + --> $DIR/generic-select.rs:63:9 | LL | simd_select_bitmask("x", x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-shuffle.rs b/tests/ui/simd/intrinsic/generic-shuffle.rs index 2752718d99d..1223b8ebe19 100644 --- a/tests/ui/simd/intrinsic/generic-shuffle.rs +++ b/tests/ui/simd/intrinsic/generic-shuffle.rs @@ -9,9 +9,9 @@ #[derive(Copy, Clone)] pub struct Simd<T, const N: usize>([T; N]); -extern "rust-intrinsic" { - fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U; + fn main() { const I: Simd<u32, 2> = Simd([0; 2]); diff --git a/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs b/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs index d9239ef5801..b324ac40749 100644 --- a/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs +++ b/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs @@ -5,9 +5,8 @@ //@ compile-flags: -Zmir-opt-level=4 #![feature(intrinsics, repr_simd)] -extern "rust-intrinsic" { - fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; #[repr(simd)] #[derive(Debug, PartialEq)] diff --git a/tests/ui/simd/intrinsic/inlining-issue67557.rs b/tests/ui/simd/intrinsic/inlining-issue67557.rs index 23dd5075f96..319bb15c015 100644 --- a/tests/ui/simd/intrinsic/inlining-issue67557.rs +++ b/tests/ui/simd/intrinsic/inlining-issue67557.rs @@ -5,9 +5,8 @@ //@ compile-flags: -Zmir-opt-level=4 #![feature(intrinsics, repr_simd)] -extern "rust-intrinsic" { - fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U; #[repr(simd)] #[derive(Debug, PartialEq)] diff --git a/tests/ui/simd/intrinsic/issue-85855.rs b/tests/ui/simd/intrinsic/issue-85855.rs index dc04699f7f8..daeea793d1b 100644 --- a/tests/ui/simd/intrinsic/issue-85855.rs +++ b/tests/ui/simd/intrinsic/issue-85855.rs @@ -5,15 +5,18 @@ #![feature(intrinsics)] #![crate_type="lib"] -extern "rust-intrinsic" { - fn simd_saturating_add<'a, T: 'a>(x: T, y: T); - //~^ ERROR: intrinsic has wrong number of lifetime parameters - fn simd_add<'a, T>(x: T, y: T) -> T; +#[rustc_intrinsic] +unsafe fn simd_saturating_add<'a, T: 'a>(x: T, y: T); +//~^ ERROR: intrinsic has wrong number of lifetime parameters - fn simd_sub<T, U>(x: T, y: U); - //~^ ERROR: intrinsic has wrong number of type parameters +#[rustc_intrinsic] +unsafe fn simd_add<'a, T>(x: T, y: T) -> T; - fn simd_mul<T, const N: usize>(x: T, y: T); - //~^ ERROR: intrinsic has wrong number of const parameters -} +#[rustc_intrinsic] +unsafe fn simd_sub<T, U>(x: T, y: U); +//~^ ERROR: intrinsic has wrong number of type parameters + +#[rustc_intrinsic] +unsafe fn simd_mul<T, const N: usize>(x: T, y: T); +//~^ ERROR: intrinsic has wrong number of const parameters diff --git a/tests/ui/simd/intrinsic/issue-85855.stderr b/tests/ui/simd/intrinsic/issue-85855.stderr index fb2f1fbc5b1..b91a606ba68 100644 --- a/tests/ui/simd/intrinsic/issue-85855.stderr +++ b/tests/ui/simd/intrinsic/issue-85855.stderr @@ -1,20 +1,20 @@ error[E0094]: intrinsic has wrong number of lifetime parameters: found 1, expected 0 - --> $DIR/issue-85855.rs:9:27 + --> $DIR/issue-85855.rs:10:30 | -LL | fn simd_saturating_add<'a, T: 'a>(x: T, y: T); - | ^^^^^^^^^^^ expected 0 lifetime parameters +LL | unsafe fn simd_saturating_add<'a, T: 'a>(x: T, y: T); + | ^^^^^^^^^^^ expected 0 lifetime parameters error[E0094]: intrinsic has wrong number of type parameters: found 2, expected 1 - --> $DIR/issue-85855.rs:14:16 + --> $DIR/issue-85855.rs:17:19 | -LL | fn simd_sub<T, U>(x: T, y: U); - | ^^^^^^ expected 1 type parameter +LL | unsafe fn simd_sub<T, U>(x: T, y: U); + | ^^^^^^ expected 1 type parameter error[E0094]: intrinsic has wrong number of const parameters: found 1, expected 0 - --> $DIR/issue-85855.rs:17:16 + --> $DIR/issue-85855.rs:21:19 | -LL | fn simd_mul<T, const N: usize>(x: T, y: T); - | ^^^^^^^^^^^^^^^^^^^ expected 0 const parameters +LL | unsafe fn simd_mul<T, const N: usize>(x: T, y: T); + | ^^^^^^^^^^^^^^^^^^^ expected 0 const parameters error: aborting due to 3 previous errors diff --git a/tests/ui/simd/intrinsic/ptr-cast.rs b/tests/ui/simd/intrinsic/ptr-cast.rs index 0490734b48a..559b8ba1b5c 100644 --- a/tests/ui/simd/intrinsic/ptr-cast.rs +++ b/tests/ui/simd/intrinsic/ptr-cast.rs @@ -2,11 +2,15 @@ #![feature(repr_simd, intrinsics)] -extern "rust-intrinsic" { - fn simd_cast_ptr<T, U>(x: T) -> U; - fn simd_expose_provenance<T, U>(x: T) -> U; - fn simd_with_exposed_provenance<T, U>(x: T) -> U; -} + +#[rustc_intrinsic] +unsafe fn simd_cast_ptr<T, U>(x: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_expose_provenance<T, U>(x: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_with_exposed_provenance<T, U>(x: T) -> U; #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/simd/issue-105439.rs b/tests/ui/simd/issue-105439.rs index 3cb43fc8b1a..108bb282df2 100644 --- a/tests/ui/simd/issue-105439.rs +++ b/tests/ui/simd/issue-105439.rs @@ -9,9 +9,8 @@ #[repr(simd)] struct i32x4([i32; 4]); -extern "rust-intrinsic" { - pub(crate) fn simd_add<T>(x: T, y: T) -> T; -} +#[rustc_intrinsic] +pub(crate) unsafe fn simd_add<T>(x: T, y: T) -> T; #[inline(always)] fn to_array(a: i32x4) -> [i32; 4] { diff --git a/tests/ui/simd/issue-39720.rs b/tests/ui/simd/issue-39720.rs index 2b51c0224c6..8d7666faaf9 100644 --- a/tests/ui/simd/issue-39720.rs +++ b/tests/ui/simd/issue-39720.rs @@ -11,9 +11,8 @@ pub struct Char3(pub [i8; 3]); #[derive(Copy, Clone, Debug)] pub struct Short3(pub [i16; 3]); -extern "rust-intrinsic" { - fn simd_cast<T, U>(x: T) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_cast<T, U>(x: T) -> U; fn main() { let cast: Short3 = unsafe { simd_cast(Char3([10, -3, -9])) }; diff --git a/tests/ui/simd/issue-85915-simd-ptrs.rs b/tests/ui/simd/issue-85915-simd-ptrs.rs index edf60e0205c..2e7baf48ee3 100644 --- a/tests/ui/simd/issue-85915-simd-ptrs.rs +++ b/tests/ui/simd/issue-85915-simd-ptrs.rs @@ -22,10 +22,12 @@ struct f32x4([f32; 4]); #[derive(Copy, Clone, PartialEq, Debug)] struct i32x4([i32; 4]); -extern "rust-intrinsic" { - fn simd_gather<T, U, V>(x: T, y: U, z: V) -> T; - fn simd_scatter<T, U, V>(x: T, y: U, z: V) -> (); -} + +#[rustc_intrinsic] +unsafe fn simd_gather<T, U, V>(x: T, y: U, z: V) -> T; + +#[rustc_intrinsic] +unsafe fn simd_scatter<T, U, V>(x: T, y: U, z: V) -> (); fn main() { let mut x = [0_f32, 1., 2., 3., 4., 5., 6., 7.]; diff --git a/tests/ui/simd/issue-89193.rs b/tests/ui/simd/issue-89193.rs index 9530124a7cc..4b4fb9d9169 100644 --- a/tests/ui/simd/issue-89193.rs +++ b/tests/ui/simd/issue-89193.rs @@ -10,9 +10,8 @@ #[derive(Copy, Clone, PartialEq, Debug)] struct x4<T>(pub [T; 4]); -extern "rust-intrinsic" { - fn simd_gather<T, U, V>(x: T, y: U, z: V) -> T; -} +#[rustc_intrinsic] +unsafe fn simd_gather<T, U, V>(x: T, y: U, z: V) -> T; fn main() { let x: [usize; 4] = [10, 11, 12, 13]; diff --git a/tests/ui/simd/masked-load-store-build-fail.rs b/tests/ui/simd/masked-load-store-build-fail.rs index fbd657763c9..b8742184eb0 100644 --- a/tests/ui/simd/masked-load-store-build-fail.rs +++ b/tests/ui/simd/masked-load-store-build-fail.rs @@ -1,10 +1,12 @@ //@ build-fail #![feature(repr_simd, intrinsics)] -extern "rust-intrinsic" { - fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; - fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T) -> (); -} + +#[rustc_intrinsic] +unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T) -> (); #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/simd/masked-load-store-build-fail.stderr b/tests/ui/simd/masked-load-store-build-fail.stderr index 59af83fe0e8..8a8d8eb99e2 100644 --- a/tests/ui/simd/masked-load-store-build-fail.stderr +++ b/tests/ui/simd/masked-load-store-build-fail.stderr @@ -1,5 +1,5 @@ error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: expected third argument with length 8 (same as input type `Simd<i8, 8>`), found `Simd<u8, 4>` with length 4 - --> $DIR/masked-load-store-build-fail.rs:18:9 + --> $DIR/masked-load-store-build-fail.rs:20:9 | LL | / simd_masked_load( LL | | Simd::<i8, 8>([-1, 0, -1, -1, 0, 0, 0, 0]), @@ -9,7 +9,7 @@ LL | | ); | |_________^ error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: expected element type `u8` of second argument `*const i8` to be a pointer to the element type `u8` of the first argument `Simd<u8, 4>`, found `u8` != `*_ u8` - --> $DIR/masked-load-store-build-fail.rs:25:9 + --> $DIR/masked-load-store-build-fail.rs:27:9 | LL | / simd_masked_load( LL | | Simd::<i8, 4>([-1, 0, -1, -1]), @@ -19,7 +19,7 @@ LL | | ); | |_________^ error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd<u32, 4>`, found `u32` != `*_ u32` - --> $DIR/masked-load-store-build-fail.rs:32:9 + --> $DIR/masked-load-store-build-fail.rs:34:9 | LL | / simd_masked_load( LL | | Simd::<i8, 4>([-1, 0, -1, -1]), @@ -29,7 +29,7 @@ LL | | ); | |_________^ error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: expected element type `u8` of third argument `Simd<u8, 4>` to be a signed integer type - --> $DIR/masked-load-store-build-fail.rs:39:9 + --> $DIR/masked-load-store-build-fail.rs:41:9 | LL | / simd_masked_load( LL | | Simd::<u8, 4>([1, 0, 1, 1]), @@ -39,7 +39,7 @@ LL | | ); | |_________^ error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd<u32, 4>`, found `u32` != `*mut u32` - --> $DIR/masked-load-store-build-fail.rs:46:9 + --> $DIR/masked-load-store-build-fail.rs:48:9 | LL | / simd_masked_store( LL | | Simd([-1i8; 4]), @@ -49,7 +49,7 @@ LL | | ); | |_________^ error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: expected element type `u8` of second argument `*const u8` to be a pointer to the element type `u8` of the first argument `Simd<u8, 4>`, found `u8` != `*mut u8` - --> $DIR/masked-load-store-build-fail.rs:53:9 + --> $DIR/masked-load-store-build-fail.rs:55:9 | LL | / simd_masked_store( LL | | Simd([-1i8; 4]), @@ -59,7 +59,7 @@ LL | | ); | |_________^ error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: expected third argument with length 4 (same as input type `Simd<i8, 4>`), found `Simd<u8, 2>` with length 2 - --> $DIR/masked-load-store-build-fail.rs:60:9 + --> $DIR/masked-load-store-build-fail.rs:62:9 | LL | / simd_masked_store( LL | | Simd([-1i8; 4]), @@ -69,7 +69,7 @@ LL | | ); | |_________^ error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: expected element type `u8` of third argument `Simd<u32, 4>` to be a signed integer type - --> $DIR/masked-load-store-build-fail.rs:67:9 + --> $DIR/masked-load-store-build-fail.rs:69:9 | LL | / simd_masked_store( LL | | Simd([1u32; 4]), diff --git a/tests/ui/simd/masked-load-store-check-fail.rs b/tests/ui/simd/masked-load-store-check-fail.rs index 39c82c41385..0f36bf6443f 100644 --- a/tests/ui/simd/masked-load-store-check-fail.rs +++ b/tests/ui/simd/masked-load-store-check-fail.rs @@ -1,10 +1,11 @@ //@ check-fail #![feature(repr_simd, intrinsics)] -extern "rust-intrinsic" { - fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; - fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T) -> (); -} +#[rustc_intrinsic] +unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T) -> (); #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/simd/masked-load-store-check-fail.stderr b/tests/ui/simd/masked-load-store-check-fail.stderr index 5d205d607c9..fa65798fc94 100644 --- a/tests/ui/simd/masked-load-store-check-fail.stderr +++ b/tests/ui/simd/masked-load-store-check-fail.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/masked-load-store-check-fail.rs:21:13 + --> $DIR/masked-load-store-check-fail.rs:22:13 | LL | let _x: Simd<u8, 2> = simd_masked_load( | ---------------- arguments to this function are incorrect @@ -10,7 +10,7 @@ LL | Simd::<u8, 4>([9; 4]) = note: expected struct `Simd<_, 2>` found struct `Simd<_, 4>` help: the return type of this call is `Simd<u8, 4>` due to the type of the argument passed - --> $DIR/masked-load-store-check-fail.rs:18:31 + --> $DIR/masked-load-store-check-fail.rs:19:31 | LL | let _x: Simd<u8, 2> = simd_masked_load( | _______________________________^ @@ -21,13 +21,13 @@ LL | | Simd::<u8, 4>([9; 4]) LL | | ); | |_________^ note: function defined here - --> $DIR/masked-load-store-check-fail.rs:5:8 + --> $DIR/masked-load-store-check-fail.rs:5:11 | -LL | fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; - | ^^^^^^^^^^^^^^^^ +LL | unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; + | ^^^^^^^^^^^^^^^^ --------- error[E0308]: mismatched types - --> $DIR/masked-load-store-check-fail.rs:28:13 + --> $DIR/masked-load-store-check-fail.rs:29:13 | LL | let _x: Simd<u32, 4> = simd_masked_load( | ---------------- arguments to this function are incorrect @@ -38,7 +38,7 @@ LL | default = note: expected struct `Simd<u32, _>` found struct `Simd<u8, _>` help: the return type of this call is `Simd<u8, 4>` due to the type of the argument passed - --> $DIR/masked-load-store-check-fail.rs:25:32 + --> $DIR/masked-load-store-check-fail.rs:26:32 | LL | let _x: Simd<u32, 4> = simd_masked_load( | ________________________________^ @@ -49,10 +49,10 @@ LL | | default LL | | ); | |_________^ note: function defined here - --> $DIR/masked-load-store-check-fail.rs:5:8 + --> $DIR/masked-load-store-check-fail.rs:5:11 | -LL | fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; - | ^^^^^^^^^^^^^^^^ +LL | unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; + | ^^^^^^^^^^^^^^^^ --------- error: aborting due to 2 previous errors diff --git a/tests/ui/simd/masked-load-store.rs b/tests/ui/simd/masked-load-store.rs index 902143f9261..4b4195f51f1 100644 --- a/tests/ui/simd/masked-load-store.rs +++ b/tests/ui/simd/masked-load-store.rs @@ -1,10 +1,11 @@ //@ run-pass #![feature(repr_simd, intrinsics)] -extern "rust-intrinsic" { - fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; - fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T) -> (); -} +#[rustc_intrinsic] +unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; + +#[rustc_intrinsic] +unsafe fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T) -> (); #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/simd/monomorphize-shuffle-index.generic.stderr b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr index 2d1fa1f8da2..b0a8da59fac 100644 --- a/tests/ui/simd/monomorphize-shuffle-index.generic.stderr +++ b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr @@ -1,5 +1,5 @@ error: overly complex generic constant - --> $DIR/monomorphize-shuffle-index.rs:29:45 + --> $DIR/monomorphize-shuffle-index.rs:32:45 | LL | return simd_shuffle_generic::<_, _, { &Self::I.0 }>(a, b); | ^^----------^^ diff --git a/tests/ui/simd/monomorphize-shuffle-index.rs b/tests/ui/simd/monomorphize-shuffle-index.rs index 140cf6fbe96..01926408a2c 100644 --- a/tests/ui/simd/monomorphize-shuffle-index.rs +++ b/tests/ui/simd/monomorphize-shuffle-index.rs @@ -4,12 +4,15 @@ #![feature(repr_simd, intrinsics, adt_const_params, unsized_const_params, generic_const_exprs)] #![allow(incomplete_features)] -extern "rust-intrinsic" { - #[cfg(old)] - fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U; - #[cfg(any(generic, generic_with_fn))] - fn simd_shuffle_generic<T, U, const I: &'static [u32]>(a: T, b: T) -> U; -} + +#[rustc_intrinsic] +#[cfg(old)] +unsafe fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U; + +#[rustc_intrinsic] +#[cfg(any(generic, generic_with_fn))] +unsafe fn simd_shuffle_generic<T, U, const I: &'static [u32]>(a: T, b: T) -> U; + #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr index d38667f750d..71b4273fa06 100644 --- a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr +++ b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr @@ -15,8 +15,9 @@ LL | use std::simd::intrinsics; | help: consider importing this module instead | -LL | use std::intrinsics; - | ~~~~~~~~~~~~~~~ +LL - use std::simd::intrinsics; +LL + use std::intrinsics; + | error: aborting due to 2 previous errors diff --git a/tests/ui/simd/repr_packed.rs b/tests/ui/simd/repr_packed.rs index 1ba15bda98d..a666892226e 100644 --- a/tests/ui/simd/repr_packed.rs +++ b/tests/ui/simd/repr_packed.rs @@ -22,9 +22,8 @@ fn check_ty<T>() { check_size_align::<T, 15>(); } -extern "rust-intrinsic" { - fn simd_add<T>(a: T, b: T) -> T; -} +#[rustc_intrinsic] +unsafe fn simd_add<T>(a: T, b: T) -> T; fn main() { check_ty::<u8>(); diff --git a/tests/ui/simd/shuffle.rs b/tests/ui/simd/shuffle.rs index 96c0ed2118f..2cae5a1e7de 100644 --- a/tests/ui/simd/shuffle.rs +++ b/tests/ui/simd/shuffle.rs @@ -8,9 +8,8 @@ use std::marker::ConstParamTy; -extern "rust-intrinsic" { - fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U; #[derive(Copy, Clone, ConstParamTy, PartialEq, Eq)] #[repr(simd)] diff --git a/tests/ui/simd/simd-bitmask-notpow2.rs b/tests/ui/simd/simd-bitmask-notpow2.rs index 3499bf33ed5..d7572ef4a2a 100644 --- a/tests/ui/simd/simd-bitmask-notpow2.rs +++ b/tests/ui/simd/simd-bitmask-notpow2.rs @@ -4,10 +4,12 @@ //@ ignore-endian-big #![feature(repr_simd, intrinsics)] -extern "rust-intrinsic" { - fn simd_bitmask<T, U>(v: T) -> U; - fn simd_select_bitmask<T, U>(m: T, a: U, b: U) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_bitmask<T, U>(v: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_select_bitmask<T, U>(m: T, a: U, b: U) -> U; + fn main() { // Non-power-of-2 multi-byte mask. diff --git a/tests/ui/simd/simd-bitmask.rs b/tests/ui/simd/simd-bitmask.rs index 82f73fca951..4275ab0f40c 100644 --- a/tests/ui/simd/simd-bitmask.rs +++ b/tests/ui/simd/simd-bitmask.rs @@ -1,10 +1,12 @@ //@run-pass #![feature(repr_simd, intrinsics)] -extern "rust-intrinsic" { - fn simd_bitmask<T, U>(v: T) -> U; - fn simd_select_bitmask<T, U>(m: T, a: U, b: U) -> U; -} +#[rustc_intrinsic] +unsafe fn simd_bitmask<T, U>(v: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_select_bitmask<T, U>(m: T, a: U, b: U) -> U; + #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/span/issue-34264.stderr b/tests/ui/span/issue-34264.stderr index b581cdd0be2..c8046a1bddf 100644 --- a/tests/ui/span/issue-34264.stderr +++ b/tests/ui/span/issue-34264.stderr @@ -60,7 +60,7 @@ note: function defined here --> $DIR/issue-34264.rs:1:4 | LL | fn foo(Option<i32>, String) {} - | ^^^ ----------- ------ + | ^^^ help: remove the extra argument | LL - foo(Some(42), 2, ""); @@ -91,7 +91,7 @@ note: function defined here --> $DIR/issue-34264.rs:3:4 | LL | fn bar(x, y: usize) {} - | ^^^ - -------- + | ^^^ help: remove the extra argument | LL - bar(1, 2, 3); diff --git a/tests/ui/span/issue-35987.stderr b/tests/ui/span/issue-35987.stderr index 36c59137b31..634bb5ed68f 100644 --- a/tests/ui/span/issue-35987.stderr +++ b/tests/ui/span/issue-35987.stderr @@ -17,10 +17,12 @@ LL | fn add(self, rhs: Self) -> Self::Output { | help: use fully-qualified syntax | -LL | fn add(self, rhs: Self) -> <Foo<T> as BitOr>::Output { - | ~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | fn add(self, rhs: Self) -> <Foo<T> as IntoFuture>::Output { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn add(self, rhs: Self) -> Self::Output { +LL + fn add(self, rhs: Self) -> <Foo<T> as BitOr>::Output { + | +LL - fn add(self, rhs: Self) -> Self::Output { +LL + fn add(self, rhs: Self) -> <Foo<T> as IntoFuture>::Output { + | error: aborting due to 2 previous errors diff --git a/tests/ui/span/issue-37767.stderr b/tests/ui/span/issue-37767.stderr index 457870821a1..2bb64e3da86 100644 --- a/tests/ui/span/issue-37767.stderr +++ b/tests/ui/span/issue-37767.stderr @@ -16,12 +16,14 @@ LL | fn foo(&mut self) {} | ^^^^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | A::foo(&mut a) - | ~~~~~~~~~~~~~~ +LL - a.foo() +LL + A::foo(&mut a) + | help: disambiguate the method for candidate #2 | -LL | B::foo(&mut a) - | ~~~~~~~~~~~~~~ +LL - a.foo() +LL + B::foo(&mut a) + | error[E0034]: multiple applicable items in scope --> $DIR/issue-37767.rs:22:7 @@ -41,12 +43,14 @@ LL | fn foo(&self) {} | ^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | C::foo(&a) - | ~~~~~~~~~~ +LL - a.foo() +LL + C::foo(&a) + | help: disambiguate the method for candidate #2 | -LL | D::foo(&a) - | ~~~~~~~~~~ +LL - a.foo() +LL + D::foo(&a) + | error[E0034]: multiple applicable items in scope --> $DIR/issue-37767.rs:34:7 @@ -66,12 +70,14 @@ LL | fn foo(self) {} | ^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | E::foo(a) - | ~~~~~~~~~ +LL - a.foo() +LL + E::foo(a) + | help: disambiguate the method for candidate #2 | -LL | F::foo(a) - | ~~~~~~~~~ +LL - a.foo() +LL + F::foo(a) + | error: aborting due to 3 previous errors diff --git a/tests/ui/span/issue-81800.stderr b/tests/ui/span/issue-81800.stderr index 86c64573b14..c1583c3ef8f 100644 --- a/tests/ui/span/issue-81800.stderr +++ b/tests/ui/span/issue-81800.stderr @@ -6,8 +6,9 @@ LL | fn x˂- | help: Unicode character '˂' (Modifier Letter Left Arrowhead) looks like '<' (Less-Than Sign), but it is not | -LL | fn x<- - | ~ +LL - fn x˂- +LL + fn x<- + | error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `-` --> $DIR/issue-81800.rs:1:6 diff --git a/tests/ui/span/missing-unit-argument.stderr b/tests/ui/span/missing-unit-argument.stderr index 79980f48ab6..e77ec3c8447 100644 --- a/tests/ui/span/missing-unit-argument.stderr +++ b/tests/ui/span/missing-unit-argument.stderr @@ -8,8 +8,9 @@ note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL help: provide the argument | -LL | let _: Result<(), String> = Ok(()); - | ~~~~ +LL - let _: Result<(), String> = Ok(); +LL + let _: Result<(), String> = Ok(()); + | error[E0061]: this function takes 2 arguments but 0 arguments were supplied --> $DIR/missing-unit-argument.rs:12:5 @@ -24,8 +25,9 @@ LL | fn foo(():(), ():()) {} | ^^^ ----- ----- help: provide the arguments | -LL | foo((), ()); - | ~~~~~~~~ +LL - foo(); +LL + foo((), ()); + | error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/missing-unit-argument.rs:13:5 @@ -37,11 +39,12 @@ note: function defined here --> $DIR/missing-unit-argument.rs:1:4 | LL | fn foo(():(), ():()) {} - | ^^^ ----- ----- + | ^^^ ----- help: provide the argument | -LL | foo((), ()); - | ~~~~~~~~ +LL - foo(()); +LL + foo((), ()); + | error[E0061]: this function takes 1 argument but 0 arguments were supplied --> $DIR/missing-unit-argument.rs:14:5 @@ -56,8 +59,9 @@ LL | fn bar(():()) {} | ^^^ ----- help: provide the argument | -LL | bar(()); - | ~~~~ +LL - bar(); +LL + bar(()); + | error[E0061]: this method takes 1 argument but 0 arguments were supplied --> $DIR/missing-unit-argument.rs:15:7 @@ -72,8 +76,9 @@ LL | fn baz(self, (): ()) { } | ^^^ ------ help: provide the argument | -LL | S.baz(()); - | ~~~~ +LL - S.baz(); +LL + S.baz(()); + | error[E0061]: this method takes 1 argument but 0 arguments were supplied --> $DIR/missing-unit-argument.rs:16:7 @@ -88,8 +93,9 @@ LL | fn generic<T>(self, _: T) { } | ^^^^^^^ ---- help: provide the argument | -LL | S.generic::<()>(()); - | ~~~~ +LL - S.generic::<()>(); +LL + S.generic::<()>(()); + | error: aborting due to 6 previous errors diff --git a/tests/ui/specialization/fuzzed/fuzzing-ice-134905.rs b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.rs new file mode 100644 index 00000000000..559c2345527 --- /dev/null +++ b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.rs @@ -0,0 +1,22 @@ +// This test previously tried to use a tainted `EvalCtxt` when emitting +// an error during coherence. +#![feature(specialization)] +//~^ WARN the feature `specialization` is incomplete +trait Iterate<'a> { + type Ty: Valid; +} +impl<'a, T> Iterate<'a> for T +where + T: Check, +{ + default type Ty = (); + //~^ ERROR the trait bound `(): Valid` is not satisfied +} + +trait Check {} +impl<'a, T> Eq for T where <T as Iterate<'a>>::Ty: Valid {} +//~^ ERROR type parameter `T` must be used as the type parameter for some local type + +trait Valid {} + +fn main() {} diff --git a/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr new file mode 100644 index 00000000000..611fef1df66 --- /dev/null +++ b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr @@ -0,0 +1,40 @@ +warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/fuzzing-ice-134905.rs:3:12 + | +LL | #![feature(specialization)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information + = help: consider using `min_specialization` instead, which is more stable and complete + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: the trait bound `(): Valid` is not satisfied + --> $DIR/fuzzing-ice-134905.rs:12:23 + | +LL | default type Ty = (); + | ^^ the trait `Valid` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/fuzzing-ice-134905.rs:20:1 + | +LL | trait Valid {} + | ^^^^^^^^^^^ +note: required by a bound in `Iterate::Ty` + --> $DIR/fuzzing-ice-134905.rs:6:14 + | +LL | type Ty: Valid; + | ^^^^^ required by this bound in `Iterate::Ty` + +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`) + --> $DIR/fuzzing-ice-134905.rs:17:10 + | +LL | impl<'a, T> Eq for T where <T as Iterate<'a>>::Ty: Valid {} + | ^ type parameter `T` must be used as the type parameter for some local type + | + = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to 2 previous errors; 1 warning emitted + +Some errors have detailed explanations: E0210, E0277. +For more information about an error, try `rustc --explain E0210`. diff --git a/tests/ui/sse-abi-checks.rs b/tests/ui/sse-simd-abi-checks.rs index c453e91d11b..396e9bf1318 100644 --- a/tests/ui/sse-abi-checks.rs +++ b/tests/ui/sse-simd-abi-checks.rs @@ -1,6 +1,8 @@ //! Ensure we trigger abi_unsupported_vector_types for target features that are usually enabled -//! on a target, but disabled in this file via a `-C` flag. -//@ compile-flags: --crate-type=rlib --target=i686-unknown-linux-gnu -C target-feature=-sse,-sse2 +//! on a target via the base CPU, but disabled in this file via a `-C` flag. +//@ compile-flags: --crate-type=rlib --target=i586-unknown-linux-gnu +//@ compile-flags: -Ctarget-cpu=pentium4 -C target-feature=-sse,-sse2 +//@ add-core-stubs //@ build-pass //@ ignore-pass (test emits codegen-time warnings) //@ needs-llvm-components: x86 @@ -8,17 +10,14 @@ #![no_core] #![allow(improper_ctypes_definitions)] -#[lang = "sized"] -trait Sized {} - -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct SseVector([i64; 2]); #[no_mangle] pub unsafe extern "C" fn f(_: SseVector) { - //~^ this function definition uses a SIMD vector type that (with the chosen ABI) requires the `sse` target feature, which is not enabled + //~^ this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler } diff --git a/tests/ui/sse-abi-checks.stderr b/tests/ui/sse-simd-abi-checks.stderr index e08b2d4e191..95486f480d2 100644 --- a/tests/ui/sse-abi-checks.stderr +++ b/tests/ui/sse-simd-abi-checks.stderr @@ -1,5 +1,5 @@ -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `sse` target feature, which is not enabled - --> $DIR/sse-abi-checks.rs:21:1 +warning: this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled + --> $DIR/sse-simd-abi-checks.rs:20:1 | LL | pub unsafe extern "C" fn f(_: SseVector) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -12,8 +12,8 @@ LL | pub unsafe extern "C" fn f(_: SseVector) { warning: 1 warning emitted Future incompatibility report: Future breakage diagnostic: -warning: this function definition uses a SIMD vector type that (with the chosen ABI) requires the `sse` target feature, which is not enabled - --> $DIR/sse-abi-checks.rs:21:1 +warning: this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled + --> $DIR/sse-simd-abi-checks.rs:20:1 | LL | pub unsafe extern "C" fn f(_: SseVector) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here diff --git a/tests/ui/stability-attribute/allowed-through-unstable.rs b/tests/ui/stability-attribute/allowed-through-unstable.rs index e03417a4dae..5baa0fda940 100644 --- a/tests/ui/stability-attribute/allowed-through-unstable.rs +++ b/tests/ui/stability-attribute/allowed-through-unstable.rs @@ -5,6 +5,5 @@ extern crate allowed_through_unstable_core; -use allowed_through_unstable_core::unstable_module::OldStableTraitAllowedThoughUnstable; -use allowed_through_unstable_core::unstable_module::OldStableTraitAllowedThoughUnstableWithDeprecation; //~WARN use of deprecated module `allowed_through_unstable_core::unstable_module`: use the new path instead +use allowed_through_unstable_core::unstable_module::OldStableTraitAllowedThoughUnstable; //~WARN use of deprecated module `allowed_through_unstable_core::unstable_module`: use the new path instead use allowed_through_unstable_core::unstable_module::NewStableTraitNotAllowedThroughUnstable; //~ ERROR use of unstable library feature `unstable_test_feature` diff --git a/tests/ui/stability-attribute/allowed-through-unstable.stderr b/tests/ui/stability-attribute/allowed-through-unstable.stderr index 8d07b0cf9e8..bda68045002 100644 --- a/tests/ui/stability-attribute/allowed-through-unstable.stderr +++ b/tests/ui/stability-attribute/allowed-through-unstable.stderr @@ -1,13 +1,13 @@ warning: use of deprecated module `allowed_through_unstable_core::unstable_module`: use the new path instead - --> $DIR/allowed-through-unstable.rs:9:53 + --> $DIR/allowed-through-unstable.rs:8:53 | -LL | use allowed_through_unstable_core::unstable_module::OldStableTraitAllowedThoughUnstableWithDeprecation; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | use allowed_through_unstable_core::unstable_module::OldStableTraitAllowedThoughUnstable; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default error[E0658]: use of unstable library feature `unstable_test_feature` - --> $DIR/allowed-through-unstable.rs:10:5 + --> $DIR/allowed-through-unstable.rs:9:5 | LL | use allowed_through_unstable_core::unstable_module::NewStableTraitNotAllowedThroughUnstable; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/stability-attribute/auxiliary/allowed-through-unstable-core.rs b/tests/ui/stability-attribute/auxiliary/allowed-through-unstable-core.rs index 9dfbb451d04..23c722d6e8e 100644 --- a/tests/ui/stability-attribute/auxiliary/allowed-through-unstable-core.rs +++ b/tests/ui/stability-attribute/auxiliary/allowed-through-unstable-core.rs @@ -6,12 +6,8 @@ #[unstable(feature = "unstable_test_feature", issue = "1")] pub mod unstable_module { #[stable(feature = "stable_test_feature", since = "1.2.0")] - #[rustc_allowed_through_unstable_modules] - pub trait OldStableTraitAllowedThoughUnstable {} - - #[stable(feature = "stable_test_feature", since = "1.2.0")] #[rustc_allowed_through_unstable_modules = "use the new path instead"] - pub trait OldStableTraitAllowedThoughUnstableWithDeprecation {} + pub trait OldStableTraitAllowedThoughUnstable {} #[stable(feature = "stable_test_feature", since = "1.2.0")] pub trait NewStableTraitNotAllowedThroughUnstable {} diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr index 050834ab676..34bf1c6c10a 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr @@ -12,7 +12,7 @@ LL | #![deny(stable_features)] help: if you are using features which are still unstable, change to using `const_foobar` | LL | #![feature(const_foobar)] - | ~~~~~~~~~~~~ + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr index 50cc14c3b4f..095c37fd0b6 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr @@ -12,7 +12,7 @@ LL | #![deny(stable_features)] help: if you are using features which are still unstable, change to using `const_foobar` | LL | #![feature(const_foobar)] - | ~~~~~~~~~~~~ + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr index d783f1e8e40..86cb764a4b3 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr @@ -12,7 +12,7 @@ LL | #![deny(stable_features)] help: if you are using features which are still unstable, change to using `foobar` | LL | #![feature(foobar)] - | ~~~~~~ + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr index 4940650fd42..2537646eb98 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr @@ -12,7 +12,7 @@ LL | #![deny(stable_features)] help: if you are using features which are still unstable, change to using `foobar` | LL | #![feature(foobar)] - | ~~~~~~ + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/static/issue-24446.rs b/tests/ui/static/issue-24446.rs index 6cf8846506d..830e373c189 100644 --- a/tests/ui/static/issue-24446.rs +++ b/tests/ui/static/issue-24446.rs @@ -2,7 +2,6 @@ fn main() { static foo: dyn Fn() -> u32 = || -> u32 { //~^ ERROR the size for values of type //~| ERROR cannot be shared between threads safely - //~| ERROR the size for values of type //~| ERROR mismatched types 0 }; diff --git a/tests/ui/static/issue-24446.stderr b/tests/ui/static/issue-24446.stderr index 8cb034000be..033caf07d8e 100644 --- a/tests/ui/static/issue-24446.stderr +++ b/tests/ui/static/issue-24446.stderr @@ -15,33 +15,19 @@ LL | static foo: dyn Fn() -> u32 = || -> u32 { | = help: the trait `Sized` is not implemented for `(dyn Fn() -> u32 + 'static)` -error[E0277]: the size for values of type `(dyn Fn() -> u32 + 'static)` cannot be known at compilation time - --> $DIR/issue-24446.rs:2:35 - | -LL | static foo: dyn Fn() -> u32 = || -> u32 { - | ___________________________________^ -... | -LL | | 0 -LL | | }; - | |_____^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `(dyn Fn() -> u32 + 'static)` - = note: constant expressions must have a statically known size - error[E0308]: mismatched types --> $DIR/issue-24446.rs:2:35 | LL | static foo: dyn Fn() -> u32 = || -> u32 { | ___________________________________^ ... | -LL | | 0 LL | | }; | |_____^ expected `dyn Fn`, found closure | = note: expected trait object `(dyn Fn() -> u32 + 'static)` found closure `{closure@$DIR/issue-24446.rs:2:35: 2:44}` -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/static/static-lifetime.stderr b/tests/ui/static/static-lifetime.stderr index 7a956dbfeef..9b5869fd0dc 100644 --- a/tests/ui/static/static-lifetime.stderr +++ b/tests/ui/static/static-lifetime.stderr @@ -11,7 +11,7 @@ LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} | ^^ = note: but lifetime parameter must outlive the static lifetime -error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements --> $DIR/static-lifetime.rs:3:34 | LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} @@ -38,5 +38,5 @@ LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} error: aborting due to 2 previous errors -Some errors have detailed explanations: E0478, E0495. +Some errors have detailed explanations: E0478, E0803. For more information about an error, try `rustc --explain E0478`. diff --git a/tests/ui/static/static-reference-to-fn-1.stderr b/tests/ui/static/static-reference-to-fn-1.stderr index 6bf64974ef5..72036269b29 100644 --- a/tests/ui/static/static-reference-to-fn-1.stderr +++ b/tests/ui/static/static-reference-to-fn-1.stderr @@ -9,8 +9,9 @@ LL | func: &foo, = note: fn items are distinct from fn pointers help: consider casting to a fn pointer | -LL | func: &(foo as fn() -> Option<isize>), - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - func: &foo, +LL + func: &(foo as fn() -> Option<isize>), + | error: aborting due to 1 previous error diff --git a/tests/ui/statics/issue-15261.stderr b/tests/ui/statics/issue-15261.stderr index 4067d151de3..7e6aebcbb1f 100644 --- a/tests/ui/statics/issue-15261.stderr +++ b/tests/ui/statics/issue-15261.stderr @@ -10,7 +10,7 @@ LL | static n: &'static usize = unsafe { &n_mut }; help: use `&raw const` instead to create a raw pointer | LL | static n: &'static usize = unsafe { &raw const n_mut }; - | ~~~~~~~~~~ + | +++++++++ 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 aa7a760ded8..3d4b55909cd 100644 --- a/tests/ui/statics/static-mut-shared-parens.stderr +++ b/tests/ui/statics/static-mut-shared-parens.stderr @@ -10,7 +10,7 @@ LL | let _ = unsafe { (&TEST) as *const usize }; help: use `&raw const` instead to create a raw pointer | LL | let _ = unsafe { (&raw const TEST) as *const usize }; - | ~~~~~~~~~~ + | +++++++++ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-shared-parens.rs:11:22 @@ -22,8 +22,9 @@ LL | let _ = unsafe { ((&mut TEST)) as *const usize }; = 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 help: use `&raw mut` instead to create a raw pointer | -LL | let _ = unsafe { ((&raw mut TEST)) as *const usize }; - | ~~~~~~~~ +LL - let _ = unsafe { ((&mut TEST)) as *const usize }; +LL + let _ = unsafe { ((&raw mut TEST)) as *const usize }; + | warning: 2 warnings emitted diff --git a/tests/ui/statics/static-mut-xc.stderr b/tests/ui/statics/static-mut-xc.stderr index 176deb518fc..48cac28a6eb 100644 --- a/tests/ui/statics/static-mut-xc.stderr +++ b/tests/ui/statics/static-mut-xc.stderr @@ -55,7 +55,7 @@ LL | static_bound(&static_mut_xc::a); help: use `&raw const` instead to create a raw pointer | LL | static_bound(&raw const static_mut_xc::a); - | ~~~~~~~~~~ + | +++++++++ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-xc.rs:35:22 @@ -67,8 +67,9 @@ LL | static_bound_set(&mut static_mut_xc::a); = 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 help: use `&raw mut` instead to create a raw pointer | -LL | static_bound_set(&raw mut static_mut_xc::a); - | ~~~~~~~~ +LL - static_bound_set(&mut static_mut_xc::a); +LL + static_bound_set(&raw mut static_mut_xc::a); + | warning: 7 warnings emitted diff --git a/tests/ui/statics/static-recursive.stderr b/tests/ui/statics/static-recursive.stderr index f2dd5b8a6cf..039934dfc69 100644 --- a/tests/ui/statics/static-recursive.stderr +++ b/tests/ui/statics/static-recursive.stderr @@ -10,7 +10,7 @@ LL | static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; 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 }; - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-recursive.rs:19:20 diff --git a/tests/ui/statics/unsized_type2.stderr b/tests/ui/statics/unsized_type2.stderr index b18a99fab72..ffbbe218c87 100644 --- a/tests/ui/statics/unsized_type2.stderr +++ b/tests/ui/statics/unsized_type2.stderr @@ -11,6 +11,12 @@ note: required because it appears within the type `Foo` LL | pub struct Foo { | ^^^ +error[E0308]: mismatched types + --> $DIR/unsized_type2.rs:14:45 + | +LL | pub static WITH_ERROR: Foo = Foo { version: 0 }; + | ^ expected `str`, found integer + error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/unsized_type2.rs:14:30 | @@ -23,13 +29,7 @@ note: required because it appears within the type `Foo` | LL | pub struct Foo { | ^^^ - = note: constant expressions must have a statically known size - -error[E0308]: mismatched types - --> $DIR/unsized_type2.rs:14:45 - | -LL | pub static WITH_ERROR: Foo = Foo { version: 0 }; - | ^ expected `str`, found integer + = note: structs must have a statically known size to be initialized error: aborting due to 3 previous errors diff --git a/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr b/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr index 08c744979f5..28427161e87 100644 --- a/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr +++ b/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr @@ -5,7 +5,7 @@ LL | pub desc: &'static dyn Qux, | ^^^^^^^ `Qux` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/unsizing-wfcheck-issue-127299.rs:4:8 | LL | trait Qux { @@ -44,7 +44,7 @@ LL | static FOO: &Lint = &Lint { desc: "desc" }; | ^^^^^^ `Qux` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/unsizing-wfcheck-issue-127299.rs:4:8 | LL | trait Qux { @@ -68,7 +68,7 @@ LL | static FOO: &Lint = &Lint { desc: "desc" }; | ^^^^^^ `Qux` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/unsizing-wfcheck-issue-127299.rs:4:8 | LL | trait Qux { diff --git a/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr index 47b17f9fcd7..6a8a7b152c5 100644 --- a/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr +++ b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr @@ -9,8 +9,9 @@ note: if you're trying to build a new `AtomicU64`, consider using `AtomicU64::ne = note: this error originates in the macro `atomic_int` (in Nightly builds, run with -Z macro-backtrace for more info) help: there is an associated function `from` with a similar name | -LL | core::sync::atomic::AtomicU64::from(&mut 0u64); - | ~~~~ +LL - core::sync::atomic::AtomicU64::from_mut(&mut 0u64); +LL + core::sync::atomic::AtomicU64::from(&mut 0u64); + | error: aborting due to 1 previous error diff --git a/tests/ui/str/str-as-char.stderr b/tests/ui/str/str-as-char.stderr index 0638d371c17..b2c716fa4f5 100644 --- a/tests/ui/str/str-as-char.stderr +++ b/tests/ui/str/str-as-char.stderr @@ -6,8 +6,9 @@ LL | println!('●●'); | help: if you meant to write a string literal, use double quotes | -LL | println!("●●"); - | ~ ~ +LL - println!('●●'); +LL + println!("●●"); + | error: aborting due to 1 previous error diff --git a/tests/ui/structs-enums/class-impl-very-parameterized-trait.rs b/tests/ui/structs-enums/class-impl-very-parameterized-trait.rs index 0b37192fc3b..6caec1e2034 100644 --- a/tests/ui/structs-enums/class-impl-very-parameterized-trait.rs +++ b/tests/ui/structs-enums/class-impl-very-parameterized-trait.rs @@ -102,6 +102,6 @@ pub fn main() { let mut spotty: cat<cat_type> = cat::new(2, 57, cat_type::tuxedo); for _ in 0_usize..6 { spotty.speak(); } assert_eq!(spotty.len(), 8); - assert!((spotty.contains_key(&2))); + assert!(spotty.contains_key(&2)); assert_eq!(spotty.get(&3), &cat_type::tuxedo); } diff --git a/tests/ui/structs-enums/class-implement-trait-cross-crate.rs b/tests/ui/structs-enums/class-implement-trait-cross-crate.rs index 7a5969451cb..781ac6ad10d 100644 --- a/tests/ui/structs-enums/class-implement-trait-cross-crate.rs +++ b/tests/ui/structs-enums/class-implement-trait-cross-crate.rs @@ -53,7 +53,7 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { pub fn main() { let mut nyan = cat(0_usize, 2, "nyan".to_string()); nyan.eat(); - assert!((!nyan.eat())); + assert!(!nyan.eat()); for _ in 1_usize..10_usize { nyan.speak(); }; - assert!((nyan.eat())); + assert!(nyan.eat()); } diff --git a/tests/ui/structs-enums/class-implement-traits.rs b/tests/ui/structs-enums/class-implement-traits.rs index 04a7b706edb..3a514ff9d75 100644 --- a/tests/ui/structs-enums/class-implement-traits.rs +++ b/tests/ui/structs-enums/class-implement-traits.rs @@ -57,7 +57,7 @@ fn make_speak<C:noisy>(mut c: C) { pub fn main() { let mut nyan = cat(0_usize, 2, "nyan".to_string()); nyan.eat(); - assert!((!nyan.eat())); + assert!(!nyan.eat()); for _ in 1_usize..10_usize { make_speak(nyan.clone()); } diff --git a/tests/ui/structs-enums/classes-cross-crate.rs b/tests/ui/structs-enums/classes-cross-crate.rs index 0160d3fd85c..6fb5f2e3cc9 100644 --- a/tests/ui/structs-enums/classes-cross-crate.rs +++ b/tests/ui/structs-enums/classes-cross-crate.rs @@ -7,7 +7,7 @@ use cci_class_4::kitties::cat; pub fn main() { let mut nyan = cat(0_usize, 2, "nyan".to_string()); nyan.eat(); - assert!((!nyan.eat())); + assert!(!nyan.eat()); for _ in 1_usize..10_usize { nyan.speak(); }; - assert!((nyan.eat())); + assert!(nyan.eat()); } diff --git a/tests/ui/structs-enums/classes.rs b/tests/ui/structs-enums/classes.rs index d1c1922f4b5..05976f6a759 100644 --- a/tests/ui/structs-enums/classes.rs +++ b/tests/ui/structs-enums/classes.rs @@ -45,7 +45,7 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { pub fn main() { let mut nyan = cat(0_usize, 2, "nyan".to_string()); nyan.eat(); - assert!((!nyan.eat())); + assert!(!nyan.eat()); for _ in 1_usize..10_usize { nyan.speak(); }; - assert!((nyan.eat())); + assert!(nyan.eat()); } diff --git a/tests/ui/structs-enums/issue-103869.stderr b/tests/ui/structs-enums/issue-103869.stderr index 2334e5e9712..10e0f29f876 100644 --- a/tests/ui/structs-enums/issue-103869.stderr +++ b/tests/ui/structs-enums/issue-103869.stderr @@ -10,8 +10,9 @@ LL | vec: Vec<usize>, = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` help: perhaps you meant to use `struct` here | -LL | struct VecOrMap { - | ~~~~~~ +LL - enum VecOrMap { +LL + struct VecOrMap { + | error: aborting due to 1 previous error diff --git a/tests/ui/structs-enums/multiple-reprs.rs b/tests/ui/structs-enums/multiple-reprs.rs index 1528db126ae..ce50b62ce47 100644 --- a/tests/ui/structs-enums/multiple-reprs.rs +++ b/tests/ui/structs-enums/multiple-reprs.rs @@ -69,7 +69,7 @@ pub fn main() { assert_eq!(size_of::<E4>(), 8); assert_eq!(size_of::<E5>(), align_size(10, align_of::<u32>())); assert_eq!(size_of::<E6>(), align_size(14, align_of::<u64>())); - assert_eq!(size_of::<E7>(), align_size(6 + size_of::<c_int>(), align_of::<c_int>())); + assert_eq!(size_of::<E7>(), align_size(6 + c_enum_min_size(), align_of::<c_int>())); assert_eq!(size_of::<p0f_api_query>(), 21); } @@ -80,3 +80,13 @@ fn align_size(size: usize, align: usize) -> usize { size } } + +// this is `TargetOptions.c_enum_min_bits` which is not available as a `cfg` value so we retrieve +// the value at runtime. On most targets this is `sizeof(c_int)` but on `thumb*-none` is 1 byte +fn c_enum_min_size() -> usize { + #[repr(C)] + enum E { + A, + } + size_of::<E>() +} diff --git a/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr b/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr index 664a00e3303..231bada006c 100644 --- a/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr +++ b/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr @@ -6,8 +6,9 @@ LL | if let Some(Foo::Bar {_}) = foo {} | help: to omit remaining fields, use `..` | -LL | if let Some(Foo::Bar {..}) = foo {} - | ~~ +LL - if let Some(Foo::Bar {_}) = foo {} +LL + if let Some(Foo::Bar {..}) = foo {} + | error: aborting due to 1 previous error diff --git a/tests/ui/structs-enums/tag.rs b/tests/ui/structs-enums/tag.rs index 16e6b2341cf..542b517e66d 100644 --- a/tests/ui/structs-enums/tag.rs +++ b/tests/ui/structs-enums/tag.rs @@ -25,6 +25,6 @@ impl PartialEq for colour { fn ne(&self, other: &colour) -> bool { !(*self).eq(other) } } -fn f() { let x = colour::red(1, 2); let y = colour::green; assert!((x != y)); } +fn f() { let x = colour::red(1, 2); let y = colour::green; assert!(x != y); } pub fn main() { f(); } diff --git a/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.rs b/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.rs new file mode 100644 index 00000000000..71d90ddd935 --- /dev/null +++ b/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.rs @@ -0,0 +1,6 @@ +#![feature(default_field_values)] +struct A<'a> { //~ ERROR lifetime parameter `'a` is never used + x: Vec<A> = Vec::new(), //~ ERROR missing lifetime specifier +} + +fn main() {} diff --git a/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.stderr b/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.stderr new file mode 100644 index 00000000000..20b9afe80cd --- /dev/null +++ b/tests/ui/structs/default-field-values/do-not-ice-on-invalid-lifetime.stderr @@ -0,0 +1,23 @@ +error[E0106]: missing lifetime specifier + --> $DIR/do-not-ice-on-invalid-lifetime.rs:3:12 + | +LL | x: Vec<A> = Vec::new(), + | ^ expected named lifetime parameter + | +help: consider using the `'a` lifetime + | +LL | x: Vec<A<'a>> = Vec::new(), + | ++++ + +error[E0392]: lifetime parameter `'a` is never used + --> $DIR/do-not-ice-on-invalid-lifetime.rs:2:10 + | +LL | struct A<'a> { + | ^^ unused lifetime parameter + | + = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0106, E0392. +For more information about an error, try `rustc --explain E0106`. diff --git a/tests/ui/structs/default-field-values/non-exhaustive-ctor.disabled.stderr b/tests/ui/structs/default-field-values/non-exhaustive-ctor.disabled.stderr index 63793425657..c7689cfd323 100644 --- a/tests/ui/structs/default-field-values/non-exhaustive-ctor.disabled.stderr +++ b/tests/ui/structs/default-field-values/non-exhaustive-ctor.disabled.stderr @@ -66,8 +66,9 @@ LL | let _ = S { }; | help: all remaining fields have default values, if you added `#![feature(default_field_values)]` to your crate you could use those values with `..` | -LL | let _ = S { .. }; - | ~~~~~~ +LL - let _ = S { }; +LL + let _ = S { .. }; + | error[E0063]: missing fields `field1` and `field2` in initializer of `S` --> $DIR/non-exhaustive-ctor.rs:26:13 diff --git a/tests/ui/structs/default-field-values/non-exhaustive-ctor.enabled.stderr b/tests/ui/structs/default-field-values/non-exhaustive-ctor.enabled.stderr index 6d035ebdc47..d9b8e76aa0d 100644 --- a/tests/ui/structs/default-field-values/non-exhaustive-ctor.enabled.stderr +++ b/tests/ui/structs/default-field-values/non-exhaustive-ctor.enabled.stderr @@ -6,8 +6,9 @@ LL | let _ = S { }; | help: all remaining fields have default values, you can use those values with `..` | -LL | let _ = S { .. }; - | ~~~~~~ +LL - let _ = S { }; +LL + let _ = S { .. }; + | error[E0063]: missing fields `field1` and `field2` in initializer of `S` --> $DIR/non-exhaustive-ctor.rs:26:13 diff --git a/tests/ui/structs/struct-field-cfg.stderr b/tests/ui/structs/struct-field-cfg.stderr index f30d343d582..2bca6f302db 100644 --- a/tests/ui/structs/struct-field-cfg.stderr +++ b/tests/ui/structs/struct-field-cfg.stderr @@ -20,16 +20,19 @@ LL | let Foo { #[cfg(any())] present: () } = foo; | help: include the missing field in the pattern | -LL | let Foo { present } = foo; - | ~~~~~~~~~~~ +LL - let Foo { #[cfg(any())] present: () } = foo; +LL + let Foo { present } = foo; + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | let Foo { present: _ } = foo; - | ~~~~~~~~~~~~~~ +LL - let Foo { #[cfg(any())] present: () } = foo; +LL + let Foo { present: _ } = foo; + | help: or always ignore missing fields here | -LL | let Foo { .. } = foo; - | ~~~~~~ +LL - let Foo { #[cfg(any())] present: () } = foo; +LL + let Foo { .. } = foo; + | error[E0026]: struct `Foo` does not have a field named `absent` --> $DIR/struct-field-cfg.rs:16:42 diff --git a/tests/ui/structs/struct-fields-hints-no-dupe.stderr b/tests/ui/structs/struct-fields-hints-no-dupe.stderr index 2b88d802833..aeba7f00b9d 100644 --- a/tests/ui/structs/struct-fields-hints-no-dupe.stderr +++ b/tests/ui/structs/struct-fields-hints-no-dupe.stderr @@ -7,7 +7,7 @@ LL | bar : 42, help: a field with a similar name exists | LL | barr : 42, - | ~~~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-fields-hints.stderr b/tests/ui/structs/struct-fields-hints.stderr index 8217d7a6e81..6526e49600e 100644 --- a/tests/ui/structs/struct-fields-hints.stderr +++ b/tests/ui/structs/struct-fields-hints.stderr @@ -6,8 +6,9 @@ LL | bar : 42, | help: a field with a similar name exists | -LL | car : 42, - | ~~~ +LL - bar : 42, +LL + car : 42, + | error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-fields-typo.stderr b/tests/ui/structs/struct-fields-typo.stderr index d87bace7277..dacf2ecea17 100644 --- a/tests/ui/structs/struct-fields-typo.stderr +++ b/tests/ui/structs/struct-fields-typo.stderr @@ -6,8 +6,9 @@ LL | let x = foo.baa; | help: a field with a similar name exists | -LL | let x = foo.bar; - | ~~~ +LL - let x = foo.baa; +LL + let x = foo.bar; + | error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-pat-derived-error.stderr b/tests/ui/structs/struct-pat-derived-error.stderr index d1d68121cf1..7fceb95cc5d 100644 --- a/tests/ui/structs/struct-pat-derived-error.stderr +++ b/tests/ui/structs/struct-pat-derived-error.stderr @@ -6,8 +6,9 @@ LL | let A { x, y } = self.d; | help: a field with a similar name exists | -LL | let A { x, y } = self.b; - | ~ +LL - let A { x, y } = self.d; +LL + let A { x, y } = self.b; + | error[E0026]: struct `A` does not have fields named `x`, `y` --> $DIR/struct-pat-derived-error.rs:8:17 @@ -24,15 +25,15 @@ LL | let A { x, y } = self.d; help: include the missing fields in the pattern | LL | let A { x, y, b, c } = self.d; - | ~~~~~~~~ + | ++++++ help: if you don't care about these missing fields, you can explicitly ignore them | LL | let A { x, y, b: _, c: _ } = self.d; - | ~~~~~~~~~~~~~~ + | ++++++++++++ help: or always ignore missing fields here | LL | let A { x, y, .. } = self.d; - | ~~~~~~ + | ++++ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/struct-path-self-type-mismatch.stderr b/tests/ui/structs/struct-path-self-type-mismatch.stderr index bbe5bae29bb..6517d7f00dd 100644 --- a/tests/ui/structs/struct-path-self-type-mismatch.stderr +++ b/tests/ui/structs/struct-path-self-type-mismatch.stderr @@ -44,8 +44,9 @@ LL | | } = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters help: use the type name directly | -LL | Foo::<U> { - | ~~~~~~~~ +LL - Self { +LL + Foo::<U> { + | error: aborting due to 3 previous errors diff --git a/tests/ui/structs/struct-tuple-field-names.stderr b/tests/ui/structs/struct-tuple-field-names.stderr index 5f1ab2f9d68..953f01e1fb6 100644 --- a/tests/ui/structs/struct-tuple-field-names.stderr +++ b/tests/ui/structs/struct-tuple-field-names.stderr @@ -6,8 +6,9 @@ LL | E::S { 0, 1 } => {} | help: use the tuple variant pattern syntax instead | -LL | E::S(_, _) => {} - | ~~~~~~ +LL - E::S { 0, 1 } => {} +LL + E::S(_, _) => {} + | error[E0769]: tuple variant `S` written as struct variant --> $DIR/struct-tuple-field-names.rs:13:9 @@ -17,8 +18,9 @@ LL | S { } => {} | help: use the tuple variant pattern syntax instead | -LL | S(_, _) => {} - | ~~~~~~ +LL - S { } => {} +LL + S(_, _) => {} + | error[E0027]: pattern does not mention field `1` --> $DIR/struct-tuple-field-names.rs:16:12 @@ -29,15 +31,15 @@ LL | if let E::S { 0: a } = x { help: include the missing field in the pattern | LL | if let E::S { 0: a, 1: _ } = x { - | ~~~~~~~~ + | ++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | if let E::S { 0: a, 1: _ } = x { - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | if let E::S { 0: a, .. } = x { - | ~~~~~~ + | ++++ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/suggest-private-fields.stderr b/tests/ui/structs/suggest-private-fields.stderr index f67a4ed78e2..adf90f0e1fd 100644 --- a/tests/ui/structs/suggest-private-fields.stderr +++ b/tests/ui/structs/suggest-private-fields.stderr @@ -6,8 +6,9 @@ LL | aa: 20, | help: a field with a similar name exists | -LL | a: 20, - | ~ +LL - aa: 20, +LL + a: 20, + | error[E0560]: struct `B` has no field named `bb` --> $DIR/suggest-private-fields.rs:17:9 @@ -25,8 +26,9 @@ LL | aa: 20, | help: a field with a similar name exists | -LL | a: 20, - | ~ +LL - aa: 20, +LL + a: 20, + | error[E0560]: struct `A` has no field named `bb` --> $DIR/suggest-private-fields.rs:24:9 @@ -36,8 +38,9 @@ LL | bb: 20, | help: a field with a similar name exists | -LL | b: 20, - | ~ +LL - bb: 20, +LL + b: 20, + | error: aborting due to 4 previous errors diff --git a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr index af530e2b759..3a828e95577 100644 --- a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr +++ b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr @@ -16,15 +16,15 @@ LL | Foo::Bar { a, aa: 1, c } => (), help: include the missing field in the pattern | LL | Foo::Bar { a, aa: 1, c, b } => (), - | ~~~~~ + | +++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Foo::Bar { a, aa: 1, c, b: _ } => (), - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | Foo::Bar { a, aa: 1, c, .. } => (), - | ~~~~~~ + | ++++ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:13:20 @@ -44,15 +44,15 @@ LL | Foo::Baz { bb: 1.0 } => (), help: include the missing field in the pattern | LL | Foo::Baz { bb: 1.0, a } => (), - | ~~~~~ + | +++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Foo::Baz { bb: 1.0, a: _ } => (), - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | Foo::Baz { bb: 1.0, .. } => (), - | ~~~~~~ + | ++++ error[E0026]: variant `Foo::Bar` does not have a field named `aa` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:20:23 @@ -69,15 +69,15 @@ LL | Foo::Bar { a, aa: "", c } => (), help: include the missing field in the pattern | LL | Foo::Bar { a, aa: "", c, b } => (), - | ~~~~~ + | +++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Foo::Bar { a, aa: "", c, b: _ } => (), - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | Foo::Bar { a, aa: "", c, .. } => (), - | ~~~~~~ + | ++++ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:23:20 @@ -94,15 +94,15 @@ LL | Foo::Baz { bb: "" } => (), help: include the missing field in the pattern | LL | Foo::Baz { bb: "", a } => (), - | ~~~~~ + | +++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Foo::Baz { bb: "", a: _ } => (), - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | Foo::Baz { bb: "", .. } => (), - | ~~~~~~ + | ++++ error: aborting due to 8 previous errors diff --git a/tests/ui/suggestions/ambiguous-assoc-type-path-suggest-similar-item.stderr b/tests/ui/suggestions/ambiguous-assoc-type-path-suggest-similar-item.stderr index 5863aa28f41..76e3c21473d 100644 --- a/tests/ui/suggestions/ambiguous-assoc-type-path-suggest-similar-item.stderr +++ b/tests/ui/suggestions/ambiguous-assoc-type-path-suggest-similar-item.stderr @@ -6,8 +6,9 @@ LL | String::from::utf8; | help: there is an associated function with a similar name: `from_utf8` | -LL | String::from_utf8; - | ~~~~~~~~~ +LL - String::from::utf8; +LL + String::from_utf8; + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:16:5 @@ -17,8 +18,9 @@ LL | String::from::utf8(); | help: there is an associated function with a similar name: `from_utf8` | -LL | String::from_utf8(); - | ~~~~~~~~~ +LL - String::from::utf8(); +LL + String::from_utf8(); + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:19:5 @@ -28,8 +30,9 @@ LL | String::from::utf16(); | help: there is an associated function with a similar name: `from_utf16` | -LL | String::from_utf16(); - | ~~~~~~~~~~ +LL - String::from::utf16(); +LL + String::from_utf16(); + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:22:5 @@ -39,8 +42,9 @@ LL | String::from::method_that_doesnt_exist(); | help: if there were a trait named `Example` with associated type `from` implemented for `String`, you could use the fully-qualified path | -LL | <String as Example>::from::method_that_doesnt_exist(); - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - String::from::method_that_doesnt_exist(); +LL + <String as Example>::from::method_that_doesnt_exist(); + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:25:5 @@ -50,8 +54,9 @@ LL | str::into::string(); | help: there is an associated function with a similar name: `into_string` | -LL | str::into_string(); - | ~~~~~~~~~~~ +LL - str::into::string(); +LL + str::into_string(); + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:28:5 @@ -61,8 +66,9 @@ LL | str::char::indices(); | help: there is an associated function with a similar name: `char_indices` | -LL | str::char_indices(); - | ~~~~~~~~~~~~ +LL - str::char::indices(); +LL + str::char_indices(); + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:31:5 @@ -72,8 +78,9 @@ LL | Foo::bar::baz; | help: there is an associated function with a similar name: `bar_baz` | -LL | Foo::bar_baz; - | ~~~~~~~ +LL - Foo::bar::baz; +LL + Foo::bar_baz; + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:34:5 @@ -83,8 +90,9 @@ LL | Foo::bar::quux; | help: there is an associated function with a similar name: `bar_quux` | -LL | Foo::bar_quux; - | ~~~~~~~~ +LL - Foo::bar::quux; +LL + Foo::bar_quux; + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:37:5 @@ -94,8 +102,9 @@ LL | Foo::bar::fizz; | help: if there were a trait named `Example` with associated type `bar` implemented for `Foo`, you could use the fully-qualified path | -LL | <Foo as Example>::bar::fizz; - | ~~~~~~~~~~~~~~~~~~~~~ +LL - Foo::bar::fizz; +LL + <Foo as Example>::bar::fizz; + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:40:5 @@ -105,8 +114,9 @@ LL | i32::wrapping::add; | help: there is an associated function with a similar name: `wrapping_add` | -LL | i32::wrapping_add; - | ~~~~~~~~~~~~ +LL - i32::wrapping::add; +LL + i32::wrapping_add; + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:43:5 @@ -116,8 +126,9 @@ LL | i32::wrapping::method_that_doesnt_exist; | help: if there were a trait named `Example` with associated type `wrapping` implemented for `i32`, you could use the fully-qualified path | -LL | <i32 as Example>::wrapping::method_that_doesnt_exist; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - i32::wrapping::method_that_doesnt_exist; +LL + <i32 as Example>::wrapping::method_that_doesnt_exist; + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:48:5 @@ -127,8 +138,9 @@ LL | <dyn std::any::Any>::downcast::mut_unchecked; | help: if there were a trait named `Example` with associated type `downcast` implemented for `(dyn Any + 'static)`, you could use the fully-qualified path | -LL | <(dyn Any + 'static) as Example>::downcast::mut_unchecked; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - <dyn std::any::Any>::downcast::mut_unchecked; +LL + <(dyn Any + 'static) as Example>::downcast::mut_unchecked; + | error: aborting due to 12 previous errors diff --git a/tests/ui/suggestions/args-instead-of-tuple-errors.stderr b/tests/ui/suggestions/args-instead-of-tuple-errors.stderr index 1051a16b40d..8644f4a1dd4 100644 --- a/tests/ui/suggestions/args-instead-of-tuple-errors.stderr +++ b/tests/ui/suggestions/args-instead-of-tuple-errors.stderr @@ -60,8 +60,9 @@ note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: provide the argument | -LL | let _: Option<(i8,)> = Some(/* (i8,) */); - | ~~~~~~~~~~~~~ +LL - let _: Option<(i8,)> = Some(); +LL + let _: Option<(i8,)> = Some(/* (i8,) */); + | error[E0308]: mismatched types --> $DIR/args-instead-of-tuple-errors.rs:14:34 diff --git a/tests/ui/suggestions/args-instead-of-tuple.stderr b/tests/ui/suggestions/args-instead-of-tuple.stderr index 3ca560f93eb..4b0bab971ee 100644 --- a/tests/ui/suggestions/args-instead-of-tuple.stderr +++ b/tests/ui/suggestions/args-instead-of-tuple.stderr @@ -34,8 +34,9 @@ note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: provide the argument | -LL | let _: Option<()> = Some(()); - | ~~~~ +LL - let _: Option<()> = Some(); +LL + let _: Option<()> = Some(()); + | error[E0308]: mismatched types --> $DIR/args-instead-of-tuple.rs:14:34 diff --git a/tests/ui/suggestions/argument-list-from-path-sep-error-129273.fixed b/tests/ui/suggestions/argument-list-from-path-sep-error-129273.fixed new file mode 100644 index 00000000000..f5dbf0c8b6f --- /dev/null +++ b/tests/ui/suggestions/argument-list-from-path-sep-error-129273.fixed @@ -0,0 +1,15 @@ +//@ run-rustfix + +use std::fmt; + +struct Hello; + +impl fmt::Display for Hello { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { //~ ERROR path separator must be a double colon + write!(f, "hello") + } +} + +fn main() { + let _ = Hello; +} diff --git a/tests/ui/suggestions/argument-list-from-path-sep-error-129273.rs b/tests/ui/suggestions/argument-list-from-path-sep-error-129273.rs new file mode 100644 index 00000000000..c41880a26f6 --- /dev/null +++ b/tests/ui/suggestions/argument-list-from-path-sep-error-129273.rs @@ -0,0 +1,15 @@ +//@ run-rustfix + +use std::fmt; + +struct Hello; + +impl fmt::Display for Hello { + fn fmt(&self, f: &mut fmt:Formatter) -> fmt::Result { //~ ERROR path separator must be a double colon + write!(f, "hello") + } +} + +fn main() { + let _ = Hello; +} diff --git a/tests/ui/suggestions/argument-list-from-path-sep-error-129273.stderr b/tests/ui/suggestions/argument-list-from-path-sep-error-129273.stderr new file mode 100644 index 00000000000..92947e3b177 --- /dev/null +++ b/tests/ui/suggestions/argument-list-from-path-sep-error-129273.stderr @@ -0,0 +1,14 @@ +error: path separator must be a double colon + --> $DIR/argument-list-from-path-sep-error-129273.rs:8:30 + | +LL | fn fmt(&self, f: &mut fmt:Formatter) -> fmt::Result { + | ^ + | + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> +help: use a double colon instead + | +LL | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + | + + +error: aborting due to 1 previous error + diff --git a/tests/ui/suggestions/assoc-const-as-field.stderr b/tests/ui/suggestions/assoc-const-as-field.stderr index 6c095e52ac9..54b7ff39926 100644 --- a/tests/ui/suggestions/assoc-const-as-field.stderr +++ b/tests/ui/suggestions/assoc-const-as-field.stderr @@ -6,8 +6,9 @@ LL | foo(Mod::Foo.Bar); | help: use the path separator to refer to an item | -LL | foo(Mod::Foo::Bar); - | ~~ +LL - foo(Mod::Foo.Bar); +LL + foo(Mod::Foo::Bar); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr b/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr index 8f00a72f1e8..6d6fd983038 100644 --- a/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr +++ b/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr @@ -10,8 +10,9 @@ LL | let x: i32 = MyS::foo; found fn item `fn() -> MyS {MyS::foo}` help: try referring to the associated const `FOO` instead (notice the capitalization difference) | -LL | let x: i32 = MyS::FOO; - | ~~~ +LL - let x: i32 = MyS::foo; +LL + let x: i32 = MyS::FOO; + | error[E0308]: mismatched types --> $DIR/assoc-ct-for-assoc-method.rs:15:18 @@ -25,8 +26,9 @@ LL | let z: i32 = i32::max; found fn item `fn(i32, i32) -> i32 {<i32 as Ord>::max}` help: try referring to the associated const `MAX` instead | -LL | let z: i32 = i32::MAX; - | ~~~ +LL - let z: i32 = i32::max; +LL + let z: i32 = i32::MAX; + | error[E0369]: cannot subtract `{integer}` from `fn(i32, i32) -> i32 {<i32 as Ord>::max}` --> $DIR/assoc-ct-for-assoc-method.rs:22:27 diff --git a/tests/ui/suggestions/bad-hex-float-lit.stderr b/tests/ui/suggestions/bad-hex-float-lit.stderr index bc09abb1a56..94c0715a4e6 100644 --- a/tests/ui/suggestions/bad-hex-float-lit.stderr +++ b/tests/ui/suggestions/bad-hex-float-lit.stderr @@ -8,10 +8,12 @@ LL | let _f: f32 = 0xAAf32; | help: rewrite this as a decimal floating point literal, or use `as` to turn a hex literal into a float | -LL | let _f: f32 = 0xAA as f32; - | ~~~~~~~~~~~ -LL | let _f: f32 = 170_f32; - | ~~~~~~~ +LL - let _f: f32 = 0xAAf32; +LL + let _f: f32 = 0xAA as f32; + | +LL - let _f: f32 = 0xAAf32; +LL + let _f: f32 = 170_f32; + | error[E0308]: mismatched types --> $DIR/bad-hex-float-lit.rs:6:19 @@ -23,10 +25,12 @@ LL | let _f: f32 = 0xAB_f32; | help: rewrite this as a decimal floating point literal, or use `as` to turn a hex literal into a float | -LL | let _f: f32 = 0xAB as f32; - | ~~~~~~~~~~~ -LL | let _f: f32 = 171_f32; - | ~~~~~~~ +LL - let _f: f32 = 0xAB_f32; +LL + let _f: f32 = 0xAB as f32; + | +LL - let _f: f32 = 0xAB_f32; +LL + let _f: f32 = 171_f32; + | error[E0308]: mismatched types --> $DIR/bad-hex-float-lit.rs:10:19 @@ -38,10 +42,12 @@ LL | let _f: f64 = 0xFF_f64; | help: rewrite this as a decimal floating point literal, or use `as` to turn a hex literal into a float | -LL | let _f: f64 = 0xFF as f64; - | ~~~~~~~~~~~ -LL | let _f: f64 = 255_f64; - | ~~~~~~~ +LL - let _f: f64 = 0xFF_f64; +LL + let _f: f64 = 0xFF as f64; + | +LL - let _f: f64 = 0xFF_f64; +LL + let _f: f64 = 255_f64; + | error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/bad-infer-in-trait-impl.stderr b/tests/ui/suggestions/bad-infer-in-trait-impl.stderr index 50c398de2b0..68d8f5402e4 100644 --- a/tests/ui/suggestions/bad-infer-in-trait-impl.stderr +++ b/tests/ui/suggestions/bad-infer-in-trait-impl.stderr @@ -6,8 +6,9 @@ LL | fn bar(s: _) {} | help: use type parameters instead | -LL | fn bar<T>(s: T) {} - | +++ ~ +LL - fn bar(s: _) {} +LL + fn bar<T>(s: T) {} + | error[E0050]: method `bar` has 1 parameter but the declaration in trait `Foo::bar` has 0 --> $DIR/bad-infer-in-trait-impl.rs:6:15 diff --git a/tests/ui/suggestions/bool_typo_err_suggest.stderr b/tests/ui/suggestions/bool_typo_err_suggest.stderr index 8d59ed63e54..faf799d0fda 100644 --- a/tests/ui/suggestions/bool_typo_err_suggest.stderr +++ b/tests/ui/suggestions/bool_typo_err_suggest.stderr @@ -6,8 +6,9 @@ LL | let x = True; | help: you may want to use a bool value instead | -LL | let x = true; - | ~~~~ +LL - let x = True; +LL + let x = true; + | error[E0425]: cannot find value `False` in this scope --> $DIR/bool_typo_err_suggest.rs:9:13 @@ -17,8 +18,9 @@ LL | let y = False; | help: you may want to use a bool value instead (notice the capitalization difference) | -LL | let y = false; - | ~~~~~ +LL - let y = False; +LL + let y = false; + | error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/bound-suggestions.stderr b/tests/ui/suggestions/bound-suggestions.stderr index e30deb11398..f23e086afe4 100644 --- a/tests/ui/suggestions/bound-suggestions.stderr +++ b/tests/ui/suggestions/bound-suggestions.stderr @@ -44,7 +44,7 @@ LL | println!("{:?} {:?}", x, y); help: consider further restricting type parameter `Y` with trait `Debug` | LL | fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { - | ~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++ error[E0277]: `X` doesn't implement `Debug` --> $DIR/bound-suggestions.rs:33:22 diff --git a/tests/ui/suggestions/box-future-wrong-output.stderr b/tests/ui/suggestions/box-future-wrong-output.stderr index 6a232c3444d..bac26ae8fb5 100644 --- a/tests/ui/suggestions/box-future-wrong-output.stderr +++ b/tests/ui/suggestions/box-future-wrong-output.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/box-future-wrong-output.rs:20:39 | LL | let _: BoxFuture<'static, bool> = async {}.boxed(); - | ------------------------ ^^^^^^^^^^^^^^^^ expected `bool`, found `()` + | ------------------------ ^^^^^^^^^^^^^^^^ expected `Pin<Box<...>>`, found `Pin<Box<dyn Future<Output = ()> + Send>>` | | | expected due to this | diff --git a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr index 4f92d3aceef..0dc17f2c25c 100644 --- a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr +++ b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr @@ -13,7 +13,7 @@ LL | const A: i32 = 2; help: introduce a variable instead | LL | let A_var = 3; - | ~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/crate-or-module-typo.stderr b/tests/ui/suggestions/crate-or-module-typo.stderr index 75aa6e614b6..2ec4fc7ed6c 100644 --- a/tests/ui/suggestions/crate-or-module-typo.stderr +++ b/tests/ui/suggestions/crate-or-module-typo.stderr @@ -7,7 +7,7 @@ LL | use st::cell::Cell; help: there is a crate or module with a similar name | LL | use std::cell::Cell; - | ~~~ + | + error[E0432]: unresolved import `bas` --> $DIR/crate-or-module-typo.rs:11:5 @@ -17,8 +17,9 @@ LL | use bas::bar; | help: there is a crate or module with a similar name | -LL | use bar::bar; - | ~~~ +LL - use bas::bar; +LL + use bar::bar; + | error[E0433]: failed to resolve: use of unresolved module or unlinked crate `st` --> $DIR/crate-or-module-typo.rs:14:10 @@ -29,7 +30,7 @@ LL | bar: st::cell::Cell<bool> help: there is a crate or module with a similar name | LL | bar: std::cell::Cell<bool> - | ~~~ + | + help: consider importing this module | LL + use std::cell; diff --git a/tests/ui/suggestions/deref-path-method.stderr b/tests/ui/suggestions/deref-path-method.stderr index bfcc2307fd7..dc2f6f66437 100644 --- a/tests/ui/suggestions/deref-path-method.stderr +++ b/tests/ui/suggestions/deref-path-method.stderr @@ -13,8 +13,9 @@ note: if you're trying to build a new `Vec<_, _>` consider using one of the foll --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: the function `contains` is implemented on `[_]` | -LL | <[_]>::contains(&vec, &0); - | ~~~~~ +LL - Vec::contains(&vec, &0); +LL + <[_]>::contains(&vec, &0); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.rs b/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.rs index 47a590668dd..e03c43d15ee 100644 --- a/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.rs +++ b/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.rs @@ -7,6 +7,6 @@ fn bar<X>(x: Box<dyn FnOnce() -> X>) {} fn main() { foo(async move || {}); - //~^ ERROR expected `{async closure@dont-suggest-boxing-async-closure-body.rs:9:9}` to be a closure that returns `Box<_>` + //~^ ERROR expected `{async closure@dont-suggest-boxing-async-closure-body.rs:9:9}` to return `Box<_>` bar(async move || {}); //~ ERROR mismatched types } diff --git a/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr b/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr index db2a3b9a9c1..abf8e2d824b 100644 --- a/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr +++ b/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr @@ -1,4 +1,4 @@ -error[E0271]: expected `{async closure@dont-suggest-boxing-async-closure-body.rs:9:9}` to be a closure that returns `Box<_>`, but it returns `{async closure body@$DIR/dont-suggest-boxing-async-closure-body.rs:9:23: 9:25}` +error[E0271]: expected `{async closure@dont-suggest-boxing-async-closure-body.rs:9:9}` to return `Box<_>`, but it returns `{async closure body@$DIR/dont-suggest-boxing-async-closure-body.rs:9:23: 9:25}` --> $DIR/dont-suggest-boxing-async-closure-body.rs:9:9 | LL | foo(async move || {}); diff --git a/tests/ui/suggestions/dont-suggest-try_into-in-macros.stderr b/tests/ui/suggestions/dont-suggest-try_into-in-macros.stderr index 348f7e00d46..53fdb5880c0 100644 --- a/tests/ui/suggestions/dont-suggest-try_into-in-macros.stderr +++ b/tests/ui/suggestions/dont-suggest-try_into-in-macros.stderr @@ -6,8 +6,9 @@ LL | assert_eq!(10u64, 10usize); | help: change the type of the numeric literal from `usize` to `u64` | -LL | assert_eq!(10u64, 10u64); - | ~~~ +LL - assert_eq!(10u64, 10usize); +LL + assert_eq!(10u64, 10u64); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/dyn-incompatible-trait-references-self.stderr b/tests/ui/suggestions/dyn-incompatible-trait-references-self.stderr index cb0e7fce910..4576017abaf 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-references-self.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-references-self.stderr @@ -5,7 +5,7 @@ LL | fn bar(x: &dyn Trait) {} | ^^^^^^^^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-incompatible-trait-references-self.rs:2:22 | LL | trait Trait { @@ -25,7 +25,7 @@ LL | fn foo(x: &dyn Other) {} | ^^^^^^^^^ `Other` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-incompatible-trait-references-self.rs:11:14 | LL | trait Other: Sized {} @@ -34,6 +34,18 @@ LL | trait Other: Sized {} | this trait is not dyn compatible... error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/dyn-incompatible-trait-references-self.rs:4:22 + | +LL | fn bat(&self) -> Self {} + | ^^^^ doesn't have a size known at compile-time + | + = note: the return type of a function must have a statically known size +help: consider further restricting `Self` + | +LL | fn bat(&self) -> Self where Self: Sized {} + | +++++++++++++++++ + +error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/dyn-incompatible-trait-references-self.rs:2:22 | LL | fn baz(&self, _: Self) {} @@ -61,18 +73,6 @@ LL | fn bat(&self) -> Self {} = note: expected type parameter `Self` found unit type `()` -error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/dyn-incompatible-trait-references-self.rs:4:22 - | -LL | fn bat(&self) -> Self {} - | ^^^^ doesn't have a size known at compile-time - | - = note: the return type of a function must have a statically known size -help: consider further restricting `Self` - | -LL | fn bat(&self) -> Self where Self: Sized {} - | +++++++++++++++++ - error: aborting due to 5 previous errors Some errors have detailed explanations: E0038, E0277, E0308. diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr index 404df206e18..20aa227d10f 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr @@ -7,8 +7,9 @@ LL | fn f(a: A) -> A; = note: `A` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `A` | -LL | fn f<T: A>(a: T) -> A; - | ++++++ ~ +LL - fn f(a: A) -> A; +LL + fn f<T: A>(a: T) -> A; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn f(a: impl A) -> A; @@ -34,8 +35,9 @@ LL | fn f(b: B) -> B; = note: `B` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `B` | -LL | fn f<T: B>(b: T) -> B; - | ++++++ ~ +LL - fn f(b: B) -> B; +LL + fn f<T: B>(b: T) -> B; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn f(b: impl B) -> B; @@ -61,8 +63,9 @@ LL | fn f(&self, c: C) -> C; = note: `C` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `C` | -LL | fn f<T: C>(&self, c: T) -> C; - | ++++++ ~ +LL - fn f(&self, c: C) -> C; +LL + fn f<T: C>(&self, c: T) -> C; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn f(&self, c: impl C) -> C; @@ -89,8 +92,9 @@ LL | fn f(a: A) -> A; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(a: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(a: A) -> A; +LL + fn f(a: Self) -> Self; + | error: associated item referring to unboxed trait object for its own trait --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:10:13 @@ -102,8 +106,9 @@ LL | fn f(b: B) -> B; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(b: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(b: B) -> B; +LL + fn f(b: Self) -> Self; + | error: associated item referring to unboxed trait object for its own trait --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:16:20 @@ -115,8 +120,9 @@ LL | fn f(&self, c: C) -> C; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(&self, c: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(&self, c: C) -> C; +LL + fn f(&self, c: Self) -> Self; + | error: aborting due to 9 previous errors diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021.stderr index 2efcad1e7bd..2e3919db1b7 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021.stderr @@ -8,8 +8,9 @@ LL | fn f(a: dyn A) -> dyn A; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(a: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(a: dyn A) -> dyn A; +LL + fn f(a: Self) -> Self; + | error[E0038]: the trait `A` is not dyn compatible --> $DIR/dyn-incompatible-trait-should-use-self-2021.rs:4:13 @@ -18,7 +19,7 @@ LL | fn f(a: dyn A) -> dyn A; | ^^^^^ `A` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-incompatible-trait-should-use-self-2021.rs:3:10 | LL | trait A: Sized { @@ -36,8 +37,9 @@ LL | fn f(a: dyn B) -> dyn B; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(a: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(a: dyn B) -> dyn B; +LL + fn f(a: Self) -> Self; + | error[E0038]: the trait `B` is not dyn compatible --> $DIR/dyn-incompatible-trait-should-use-self-2021.rs:9:13 @@ -46,7 +48,7 @@ LL | fn f(a: dyn B) -> dyn B; | ^^^^^ `B` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-incompatible-trait-should-use-self-2021.rs:9:8 | LL | trait B { diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self.stderr index ecb3ee9185f..f4b669d7fcd 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self.stderr @@ -8,8 +8,9 @@ LL | fn f(a: A) -> A; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(a: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(a: A) -> A; +LL + fn f(a: Self) -> Self; + | error[E0038]: the trait `A` is not dyn compatible --> $DIR/dyn-incompatible-trait-should-use-self.rs:3:13 @@ -18,7 +19,7 @@ LL | fn f(a: A) -> A; | ^ `A` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-incompatible-trait-should-use-self.rs:2:10 | LL | trait A: Sized { @@ -36,8 +37,9 @@ LL | fn f(a: B) -> B; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(a: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(a: B) -> B; +LL + fn f(a: Self) -> Self; + | error[E0038]: the trait `B` is not dyn compatible --> $DIR/dyn-incompatible-trait-should-use-self.rs:8:13 @@ -46,7 +48,7 @@ LL | fn f(a: B) -> B; | ^ `B` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-incompatible-trait-should-use-self.rs:8:8 | LL | trait B { diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr index 696840d3ba4..c275cdccaa8 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr @@ -5,7 +5,7 @@ LL | fn bar(x: &dyn Trait) {} | ^^^^^^^^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/dyn-incompatible-trait-should-use-where-sized.rs:5:8 | LL | trait Trait { @@ -21,11 +21,12 @@ LL | fn foo(&self) where Self: Other, { } help: alternatively, consider constraining `foo` so it does not apply to trait objects | LL | fn foo() where Self: Other, Self: Sized { } - | ~~~~~~~~~~~~~ + | +++++++++++ help: consider changing method `bar`'s `self` parameter to be `&self` | -LL | fn bar(self: &Self) {} - | ~~~~~ +LL - fn bar(self: ()) {} +LL + fn bar(self: &Self) {} + | error[E0307]: invalid `self` parameter type: `()` --> $DIR/dyn-incompatible-trait-should-use-where-sized.rs:6:18 diff --git a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr index 42bc094859a..61a1d30d31d 100644 --- a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr +++ b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -32,7 +32,7 @@ error[E0308]: mismatched types LL | fn baz<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> { | - found this type parameter LL | Pin::new(x) - | -------- ^ expected `Box<dyn Future<Output = ...> + Send>`, found type parameter `F` + | -------- ^ expected `Box<dyn Future<Output = i32> + Send>`, found type parameter `F` | | | arguments to this function are incorrect | help: use `Box::pin` to pin and box this expression: `Box::pin` diff --git a/tests/ui/suggestions/field-access.stderr b/tests/ui/suggestions/field-access.stderr index 007bc6ecf93..362dae172c7 100644 --- a/tests/ui/suggestions/field-access.stderr +++ b/tests/ui/suggestions/field-access.stderr @@ -12,7 +12,7 @@ LL | if let B::Fst = a {}; help: you might have meant to use field `b` whose type is `B` | LL | if let B::Fst = a.b {}; - | ~~~ + | ++ error[E0308]: mismatched types --> $DIR/field-access.rs:25:9 @@ -29,7 +29,7 @@ LL | B::Fst => (), help: you might have meant to use field `b` whose type is `B` | LL | match a.b { - | ~~~ + | ++ error[E0308]: mismatched types --> $DIR/field-access.rs:26:9 @@ -46,7 +46,7 @@ LL | B::Snd => (), help: you might have meant to use field `b` whose type is `B` | LL | match a.b { - | ~~~ + | ++ error[E0308]: mismatched types --> $DIR/field-access.rs:32:9 @@ -59,8 +59,9 @@ LL | 1u32 => (), | help: you might have meant to use field `bar` whose type is `u32` | -LL | match unsafe { foo.bar } { - | ~~~~~~~~~~~~~~~~~~ +LL - match foo { +LL + match unsafe { foo.bar } { + | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/fn-to-method.normal.stderr b/tests/ui/suggestions/fn-to-method.normal.stderr index 502be79481a..9bd9497ab4d 100644 --- a/tests/ui/suggestions/fn-to-method.normal.stderr +++ b/tests/ui/suggestions/fn-to-method.normal.stderr @@ -6,8 +6,9 @@ LL | let x = cmp(&1, &2); | help: use the `.` operator to call the method `Ord::cmp` on `&{integer}` | -LL | let x = (&1).cmp(&2); - | ~ ~~~~~~~~~ +LL - let x = cmp(&1, &2); +LL + let x = (&1).cmp(&2); + | error[E0425]: cannot find function `len` in this scope --> $DIR/fn-to-method.rs:16:13 diff --git a/tests/ui/issues/issue-40782.fixed b/tests/ui/suggestions/for-loop-missing-in.fixed index ff376b5a52c..ff376b5a52c 100644 --- a/tests/ui/issues/issue-40782.fixed +++ b/tests/ui/suggestions/for-loop-missing-in.fixed diff --git a/tests/ui/issues/issue-40782.rs b/tests/ui/suggestions/for-loop-missing-in.rs index 28c12aec665..28c12aec665 100644 --- a/tests/ui/issues/issue-40782.rs +++ b/tests/ui/suggestions/for-loop-missing-in.rs diff --git a/tests/ui/issues/issue-40782.stderr b/tests/ui/suggestions/for-loop-missing-in.stderr index 61498020238..4e0cb229d50 100644 --- a/tests/ui/issues/issue-40782.stderr +++ b/tests/ui/suggestions/for-loop-missing-in.stderr @@ -1,5 +1,5 @@ error: missing `in` in `for` loop - --> $DIR/issue-40782.rs:4:11 + --> $DIR/for-loop-missing-in.rs:4:11 | LL | for _i 0..2 { | ^ @@ -10,15 +10,16 @@ LL | for _i in 0..2 { | ++ error: missing `in` in `for` loop - --> $DIR/issue-40782.rs:6:12 + --> $DIR/for-loop-missing-in.rs:6:12 | LL | for _i of 0..2 { | ^^ | help: try using `in` here instead | -LL | for _i in 0..2 { - | ~~ +LL - for _i of 0..2 { +LL + for _i in 0..2 { + | error: aborting due to 2 previous errors 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 d610a3b7cad..f943688e657 100644 --- a/tests/ui/suggestions/ice-unwrap-probe-many-result-125876.stderr +++ b/tests/ui/suggestions/ice-unwrap-probe-many-result-125876.stderr @@ -31,8 +31,9 @@ LL | std::ptr::from_ref(num).cast_mut().as_deref(); | help: there is a method `as_ref` with a similar name | -LL | std::ptr::from_ref(num).cast_mut().as_ref(); - | ~~~~~~ +LL - std::ptr::from_ref(num).cast_mut().as_deref(); +LL + std::ptr::from_ref(num).cast_mut().as_ref(); + | error: aborting due to 2 previous errors; 2 warnings emitted diff --git a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr index 79fa468dc49..4b770d572c5 100644 --- a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr +++ b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr @@ -15,7 +15,7 @@ LL | fn foo<X: Trait>(_: X) {} help: consider changing this borrow's mutability | LL | foo(&mut s); - | ~~~~ + | +++ error[E0277]: the trait bound `S: Trait` is not satisfied --> $DIR/imm-ref-trait-object-literal.rs:13:7 diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr index 30f4509d49d..204209179ad 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr @@ -12,7 +12,7 @@ LL | fn g(mut x: impl Iterator<Item = &()>) -> Option<&'static ()> { x.next( help: consider introducing a named lifetime parameter | LL | fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ + | ++++ ++ ++ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() } @@ -33,7 +33,7 @@ LL | async fn i(mut x: impl Iterator<Item = &()>) -> Option<&'static ()> { x help: consider introducing a named lifetime parameter | LL | async fn i<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ + | ++++ ++ ++ help: alternatively, you might want to return an owned value | LL - async fn i(mut x: impl Iterator<Item = &()>) -> Option<&()> { x.next() } @@ -49,12 +49,14 @@ LL | fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'static ()> { x.next() } - | ~~~~~~~ +LL - fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } +LL + fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'static ()> { x.next() } + | help: consider introducing a named lifetime parameter | -LL | fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ +LL - fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } +LL + fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } + | help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } @@ -70,12 +72,14 @@ LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.n = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'static ()> { x.next() } - | ~~~~~~~ +LL - async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } +LL + async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'static ()> { x.next() } + | help: consider introducing a named lifetime parameter | -LL | async fn i<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ +LL - async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } +LL + async fn i<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } + | help: alternatively, you might want to return an owned value | LL - async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } @@ -96,7 +100,7 @@ LL | fn g(mut x: impl Foo) -> Option<&'static ()> { x.next() } help: consider introducing a named lifetime parameter | LL | fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() } - | ++++ ~~~ + | ++++ ++ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() } @@ -117,7 +121,7 @@ LL | fn g(mut x: impl Foo<()>) -> Option<&'static ()> { x.next() } help: consider introducing a named lifetime parameter | LL | fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() } - | ++++ ~~~ + | ++++ ++ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } @@ -176,8 +180,9 @@ LL | fn f(_: impl Iterator<Item = &'_ ()>) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date help: consider introducing a named lifetime parameter | -LL | fn f<'a>(_: impl Iterator<Item = &'a ()>) {} - | ++++ ~~ +LL - fn f(_: impl Iterator<Item = &'_ ()>) {} +LL + fn f<'a>(_: impl Iterator<Item = &'a ()>) {} + | error[E0658]: anonymous lifetimes in `impl Trait` are unstable --> $DIR/impl-trait-missing-lifetime-gated.rs:28:39 @@ -189,8 +194,9 @@ LL | fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date help: consider introducing a named lifetime parameter | -LL | fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'_ ()> { x.next() } - | ++++ ~~ +LL - fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } +LL + fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'_ ()> { x.next() } + | error: lifetime may not live long enough --> $DIR/impl-trait-missing-lifetime-gated.rs:38:73 diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime.stderr index 70998b67c04..dfbc883680b 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime.stderr @@ -7,12 +7,14 @@ LL | fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'static ()> { x.next() } - | ~~~~~~~ +LL - fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } +LL + fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'static ()> { x.next() } + | help: consider introducing a named lifetime parameter | -LL | fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ +LL - fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } +LL + fn g<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } + | help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } @@ -28,12 +30,14 @@ LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next( = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'static ()> { x.next() } - | ~~~~~~~ +LL - async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } +LL + async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'static ()> { x.next() } + | help: consider introducing a named lifetime parameter | -LL | async fn i<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ +LL - async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } +LL + async fn i<'a>(mut x: impl Iterator<Item = &'a ()>) -> Option<&'a ()> { x.next() } + | help: alternatively, you might want to return an owned value | LL - async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() } diff --git a/tests/ui/suggestions/impl-trait-with-missing-bounds.stderr b/tests/ui/suggestions/impl-trait-with-missing-bounds.stderr index a763eb6f2f8..d0ce7c9ed4e 100644 --- a/tests/ui/suggestions/impl-trait-with-missing-bounds.stderr +++ b/tests/ui/suggestions/impl-trait-with-missing-bounds.stderr @@ -14,8 +14,9 @@ LL | fn qux(_: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | fn foo<I: Iterator>(constraints: I) where <I as Iterator>::Item: Debug { - | +++++++++++++ ~ ++++++++++++++++++++++++++++++++++ +LL - fn foo(constraints: impl Iterator) { +LL + fn foo<I: Iterator>(constraints: I) where <I as Iterator>::Item: Debug { + | error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` --> $DIR/impl-trait-with-missing-bounds.rs:14:13 @@ -33,8 +34,9 @@ LL | fn qux(_: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | fn bar<T, I: Iterator>(t: T, constraints: I) where T: std::fmt::Debug, <I as Iterator>::Item: Debug { - | +++++++++++++ ~ ++++++++++++++++++++++++++++++ +LL - fn bar<T>(t: T, constraints: impl Iterator) where T: std::fmt::Debug { +LL + fn bar<T, I: Iterator>(t: T, constraints: I) where T: std::fmt::Debug, <I as Iterator>::Item: Debug { + | error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` --> $DIR/impl-trait-with-missing-bounds.rs:22:13 @@ -52,8 +54,9 @@ LL | fn qux(_: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | fn baz<I: Iterator>(t: impl std::fmt::Debug, constraints: I) where <I as Iterator>::Item: Debug { - | +++++++++++++ ~ ++++++++++++++++++++++++++++++++++ +LL - fn baz(t: impl std::fmt::Debug, constraints: impl Iterator) { +LL + fn baz<I: Iterator>(t: impl std::fmt::Debug, constraints: I) where <I as Iterator>::Item: Debug { + | error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` --> $DIR/impl-trait-with-missing-bounds.rs:30:13 @@ -71,8 +74,9 @@ LL | fn qux(_: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | fn bat<I, T: std::fmt::Debug, U: Iterator>(t: T, constraints: U, _: I) where <U as Iterator>::Item: Debug { - | +++++++++++++ ~ ++++++++++++++++++++++++++++++++++ +LL - fn bat<I, T: std::fmt::Debug>(t: T, constraints: impl Iterator, _: I) { +LL + fn bat<I, T: std::fmt::Debug, U: Iterator>(t: T, constraints: U, _: I) where <U as Iterator>::Item: Debug { + | error[E0277]: `<impl Iterator + std::fmt::Debug as Iterator>::Item` doesn't implement `Debug` --> $DIR/impl-trait-with-missing-bounds.rs:37:13 @@ -90,8 +94,9 @@ LL | fn qux(_: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | fn bak<I: Iterator + std::fmt::Debug>(constraints: I) where <I as Iterator>::Item: Debug { - | +++++++++++++++++++++++++++++++ ~ ++++++++++++++++++++++++++++++++++ +LL - fn bak(constraints: impl Iterator + std::fmt::Debug) { +LL + fn bak<I: Iterator + std::fmt::Debug>(constraints: I) where <I as Iterator>::Item: Debug { + | error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` --> $DIR/impl-trait-with-missing-bounds.rs:45:13 @@ -109,8 +114,9 @@ LL | fn qux(_: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | fn baw<I: Iterator>(constraints: I) where <I as Iterator>::Item: Debug { - | ~~~~~~~~~~~~~ ~ ++++++++++++++++++++++++++++++++++ +LL - fn baw<>(constraints: impl Iterator) { +LL + fn baw<I: Iterator>(constraints: I) where <I as Iterator>::Item: Debug { + | error: aborting due to 6 previous errors diff --git a/tests/ui/suggestions/incorrect-variant-literal.svg b/tests/ui/suggestions/incorrect-variant-literal.svg index 980a7b29a00..0f2ade633c5 100644 --- a/tests/ui/suggestions/incorrect-variant-literal.svg +++ b/tests/ui/suggestions/incorrect-variant-literal.svg @@ -1,4 +1,4 @@ -<svg width="886px" height="9038px" xmlns="http://www.w3.org/2000/svg"> +<svg width="886px" height="9542px" xmlns="http://www.w3.org/2000/svg"> <style> .fg { fill: #AAAAAA } .bg { background: #000000 } @@ -103,567 +103,567 @@ </tspan> <tspan x="10px" y="748px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="766px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-010">(/* i32 */)</tspan><tspan>;</tspan> + <tspan x="10px" y="766px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-009">()</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="784px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~</tspan> + <tspan x="10px" y="784px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-010">(/* i32 */)</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="802px"> + <tspan x="10px" y="802px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="820px"><tspan class="fg-ansi256-009 bold">error[E0533]</tspan><tspan class="bold">: expected value, found struct variant `Enum::Struct`</tspan> + <tspan x="10px" y="820px"> </tspan> - <tspan x="10px" y="838px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:16:5</tspan> + <tspan x="10px" y="838px"><tspan class="fg-ansi256-009 bold">error[E0533]</tspan><tspan class="bold">: expected value, found struct variant `Enum::Struct`</tspan> </tspan> - <tspan x="10px" y="856px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="856px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:16:5</tspan> </tspan> - <tspan x="10px" y="874px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct();</tspan> + <tspan x="10px" y="874px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="892px"><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">not a value</tspan> + <tspan x="10px" y="892px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct();</tspan> </tspan> - <tspan x="10px" y="910px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="910px"><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">not a value</tspan> </tspan> - <tspan x="10px" y="928px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: you might have meant to create a new value of the struct</tspan> + <tspan x="10px" y="928px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="946px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="946px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: you might have meant to create a new value of the struct</tspan> </tspan> - <tspan x="10px" y="964px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Struct</tspan><tspan class="fg-ansi256-010"> { x: /* value */ }</tspan><tspan>;</tspan> + <tspan x="10px" y="964px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="982px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="982px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::Struct</tspan><tspan class="fg-ansi256-009">()</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="1000px"> + <tspan x="10px" y="1000px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::Struct</tspan><tspan class="fg-ansi256-010"> { x: /* value */ }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="1018px"><tspan class="fg-ansi256-009 bold">error[E0063]</tspan><tspan class="bold">: missing field `0` in initializer of `Enum`</tspan> + <tspan x="10px" y="1018px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="1036px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:18:5</tspan> + <tspan x="10px" y="1036px"> </tspan> - <tspan x="10px" y="1054px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="1054px"><tspan class="fg-ansi256-009 bold">error[E0063]</tspan><tspan class="bold">: missing field `0` in initializer of `Enum`</tspan> </tspan> - <tspan x="10px" y="1072px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple {};</tspan> + <tspan x="10px" y="1072px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:18:5</tspan> </tspan> - <tspan x="10px" y="1090px"><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">missing `0`</tspan> + <tspan x="10px" y="1090px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="1108px"> + <tspan x="10px" y="1108px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple {};</tspan> </tspan> - <tspan x="10px" y="1126px"><tspan class="fg-ansi256-009 bold">error[E0063]</tspan><tspan class="bold">: missing field `x` in initializer of `Enum`</tspan> + <tspan x="10px" y="1126px"><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">missing `0`</tspan> </tspan> - <tspan x="10px" y="1144px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:19:5</tspan> + <tspan x="10px" y="1144px"> </tspan> - <tspan x="10px" y="1162px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="1162px"><tspan class="fg-ansi256-009 bold">error[E0063]</tspan><tspan class="bold">: missing field `x` in initializer of `Enum`</tspan> </tspan> - <tspan x="10px" y="1180px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct {};</tspan> + <tspan x="10px" y="1180px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:19:5</tspan> </tspan> - <tspan x="10px" y="1198px"><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">missing `x`</tspan> + <tspan x="10px" y="1198px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="1216px"> + <tspan x="10px" y="1216px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct {};</tspan> </tspan> - <tspan x="10px" y="1234px"><tspan class="fg-ansi256-009 bold">error[E0618]</tspan><tspan class="bold">: expected function, found `Enum`</tspan> + <tspan x="10px" y="1234px"><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">missing `x`</tspan> </tspan> - <tspan x="10px" y="1252px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:20:5</tspan> + <tspan x="10px" y="1252px"> </tspan> - <tspan x="10px" y="1270px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="1270px"><tspan class="fg-ansi256-009 bold">error[E0618]</tspan><tspan class="bold">: expected function, found `Enum`</tspan> </tspan> - <tspan x="10px" y="1288px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Unit,</tspan> + <tspan x="10px" y="1288px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:20:5</tspan> </tspan> - <tspan x="10px" y="1306px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Unit` defined here</tspan> + <tspan x="10px" y="1306px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="1324px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="1324px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Unit,</tspan> </tspan> - <tspan x="10px" y="1342px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit(0);</tspan> + <tspan x="10px" y="1342px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Unit` defined here</tspan> </tspan> - <tspan x="10px" y="1360px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^</tspan><tspan class="fg-ansi256-012 bold">---</tspan> + <tspan x="10px" y="1360px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="1378px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="1378px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit(0);</tspan> </tspan> - <tspan x="10px" y="1396px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">call expression requires function</tspan> + <tspan x="10px" y="1396px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^</tspan><tspan class="fg-ansi256-012 bold">---</tspan> </tspan> - <tspan x="10px" y="1414px"> + <tspan x="10px" y="1414px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="1432px"><tspan class="fg-ansi256-009 bold">error[E0533]</tspan><tspan class="bold">: expected value, found struct variant `Enum::Struct`</tspan> + <tspan x="10px" y="1432px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">call expression requires function</tspan> </tspan> - <tspan x="10px" y="1450px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:22:5</tspan> + <tspan x="10px" y="1450px"> </tspan> - <tspan x="10px" y="1468px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="1468px"><tspan class="fg-ansi256-009 bold">error[E0533]</tspan><tspan class="bold">: expected value, found struct variant `Enum::Struct`</tspan> </tspan> - <tspan x="10px" y="1486px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct(0);</tspan> + <tspan x="10px" y="1486px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:22:5</tspan> </tspan> - <tspan x="10px" y="1504px"><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">not a value</tspan> + <tspan x="10px" y="1504px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="1522px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="1522px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct(0);</tspan> </tspan> - <tspan x="10px" y="1540px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: you might have meant to create a new value of the struct</tspan> + <tspan x="10px" y="1540px"><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">not a value</tspan> </tspan> <tspan x="10px" y="1558px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="1576px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Struct</tspan><tspan class="fg-ansi256-010"> { x: /* value */ }</tspan><tspan>;</tspan> + <tspan x="10px" y="1576px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: you might have meant to create a new value of the struct</tspan> </tspan> - <tspan x="10px" y="1594px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="1594px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="1612px"> + <tspan x="10px" y="1612px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::Struct</tspan><tspan class="fg-ansi256-009">(0)</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="1630px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Unit` has no field named `x`</tspan> + <tspan x="10px" y="1630px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::Struct</tspan><tspan class="fg-ansi256-010"> { x: /* value */ }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="1648px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:23:18</tspan> + <tspan x="10px" y="1648px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="1666px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="1666px"> </tspan> - <tspan x="10px" y="1684px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit { x: 0 };</tspan> + <tspan x="10px" y="1684px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Unit` has no field named `x`</tspan> </tspan> - <tspan x="10px" y="1702px"><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">`Enum::Unit` does not have this field</tspan> + <tspan x="10px" y="1702px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:23:18</tspan> </tspan> <tspan x="10px" y="1720px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="1738px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">note</tspan><tspan>: all struct fields are already assigned</tspan> + <tspan x="10px" y="1738px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit { x: 0 };</tspan> </tspan> - <tspan x="10px" y="1756px"> + <tspan x="10px" y="1756px"><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">`Enum::Unit` does not have this field</tspan> </tspan> - <tspan x="10px" y="1774px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Tuple` has no field named `x`</tspan> + <tspan x="10px" y="1774px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="1792px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:24:19</tspan> + <tspan x="10px" y="1792px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">note</tspan><tspan>: all struct fields are already assigned</tspan> </tspan> - <tspan x="10px" y="1810px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="1810px"> </tspan> - <tspan x="10px" y="1828px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Tuple(i32),</tspan> + <tspan x="10px" y="1828px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Tuple` has no field named `x`</tspan> </tspan> - <tspan x="10px" y="1846px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">-----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Tuple` defined here</tspan> + <tspan x="10px" y="1846px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:24:19</tspan> </tspan> - <tspan x="10px" y="1864px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="1864px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="1882px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple { x: 0 };</tspan> + <tspan x="10px" y="1882px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Tuple(i32),</tspan> </tspan> - <tspan x="10px" y="1900px"><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">field does not exist</tspan> + <tspan x="10px" y="1900px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">-----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Tuple` defined here</tspan> </tspan> - <tspan x="10px" y="1918px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="1918px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="1936px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: `Enum::Tuple` is a tuple variant, use the appropriate syntax</tspan> + <tspan x="10px" y="1936px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple { x: 0 };</tspan> </tspan> - <tspan x="10px" y="1954px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="1954px"><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">field does not exist</tspan> </tspan> - <tspan x="10px" y="1972px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-010">(/* i32 */)</tspan><tspan>;</tspan> + <tspan x="10px" y="1972px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="1990px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~</tspan> + <tspan x="10px" y="1990px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: `Enum::Tuple` is a tuple variant, use the appropriate syntax</tspan> </tspan> - <tspan x="10px" y="2008px"> + <tspan x="10px" y="2008px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2026px"><tspan class="fg-ansi256-009 bold">error[E0618]</tspan><tspan class="bold">: expected function, found `Enum`</tspan> + <tspan x="10px" y="2026px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-009"> { x: 0 }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="2044px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:26:5</tspan> + <tspan x="10px" y="2044px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-010">(/* i32 */)</tspan><tspan>;</tspan> </tspan> <tspan x="10px" y="2062px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2080px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Unit,</tspan> + <tspan x="10px" y="2080px"> </tspan> - <tspan x="10px" y="2098px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Unit` defined here</tspan> + <tspan x="10px" y="2098px"><tspan class="fg-ansi256-009 bold">error[E0618]</tspan><tspan class="bold">: expected function, found `Enum`</tspan> </tspan> - <tspan x="10px" y="2116px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="2116px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:26:5</tspan> </tspan> - <tspan x="10px" y="2134px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit(0, 0);</tspan> + <tspan x="10px" y="2134px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2152px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^</tspan><tspan class="fg-ansi256-012 bold">------</tspan> + <tspan x="10px" y="2152px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Unit,</tspan> </tspan> - <tspan x="10px" y="2170px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="2170px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Unit` defined here</tspan> </tspan> - <tspan x="10px" y="2188px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">call expression requires function</tspan> + <tspan x="10px" y="2188px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="2206px"> + <tspan x="10px" y="2206px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit(0, 0);</tspan> </tspan> - <tspan x="10px" y="2224px"><tspan class="fg-ansi256-009 bold">error[E0061]</tspan><tspan class="bold">: this enum variant takes 1 argument but 2 arguments were supplied</tspan> + <tspan x="10px" y="2224px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^</tspan><tspan class="fg-ansi256-012 bold">------</tspan> </tspan> - <tspan x="10px" y="2242px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:27:5</tspan> + <tspan x="10px" y="2242px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2260px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="2260px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">call expression requires function</tspan> </tspan> - <tspan x="10px" y="2278px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple(0, 0);</tspan> + <tspan x="10px" y="2278px"> </tspan> - <tspan x="10px" y="2296px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">-</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">unexpected argument #2 of type `{integer}`</tspan> + <tspan x="10px" y="2296px"><tspan class="fg-ansi256-009 bold">error[E0061]</tspan><tspan class="bold">: this enum variant takes 1 argument but 2 arguments were supplied</tspan> </tspan> - <tspan x="10px" y="2314px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="2314px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:27:5</tspan> </tspan> - <tspan x="10px" y="2332px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: tuple variant defined here</tspan> + <tspan x="10px" y="2332px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2350px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:6:5</tspan> + <tspan x="10px" y="2350px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple(0, 0);</tspan> </tspan> - <tspan x="10px" y="2368px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="2368px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">-</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">unexpected argument #2 of type `{integer}`</tspan> </tspan> - <tspan x="10px" y="2386px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Tuple(i32),</tspan> + <tspan x="10px" y="2386px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2404px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^^^^^</tspan> + <tspan x="10px" y="2404px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: tuple variant defined here</tspan> </tspan> - <tspan x="10px" y="2422px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: remove the extra argument</tspan> + <tspan x="10px" y="2422px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:6:5</tspan> </tspan> <tspan x="10px" y="2440px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2458px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::Tuple(0</tspan><tspan class="fg-ansi256-009">, 0</tspan><tspan>);</tspan> + <tspan x="10px" y="2458px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Tuple(i32),</tspan> </tspan> - <tspan x="10px" y="2476px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::Tuple(0);</tspan> + <tspan x="10px" y="2476px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^^^^^</tspan> </tspan> - <tspan x="10px" y="2494px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="2494px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: remove the extra argument</tspan> </tspan> - <tspan x="10px" y="2512px"> + <tspan x="10px" y="2512px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2530px"><tspan class="fg-ansi256-009 bold">error[E0533]</tspan><tspan class="bold">: expected value, found struct variant `Enum::Struct`</tspan> + <tspan x="10px" y="2530px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::Tuple(0</tspan><tspan class="fg-ansi256-009">, 0</tspan><tspan>);</tspan> </tspan> - <tspan x="10px" y="2548px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:28:5</tspan> + <tspan x="10px" y="2548px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::Tuple(0);</tspan> </tspan> <tspan x="10px" y="2566px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2584px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct(0, 0);</tspan> + <tspan x="10px" y="2584px"> </tspan> - <tspan x="10px" y="2602px"><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">not a value</tspan> + <tspan x="10px" y="2602px"><tspan class="fg-ansi256-009 bold">error[E0533]</tspan><tspan class="bold">: expected value, found struct variant `Enum::Struct`</tspan> </tspan> - <tspan x="10px" y="2620px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="2620px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:28:5</tspan> </tspan> - <tspan x="10px" y="2638px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: you might have meant to create a new value of the struct</tspan> + <tspan x="10px" y="2638px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2656px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="2656px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct(0, 0);</tspan> </tspan> - <tspan x="10px" y="2674px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Struct</tspan><tspan class="fg-ansi256-010"> { x: /* value */ }</tspan><tspan>;</tspan> + <tspan x="10px" y="2674px"><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">not a value</tspan> </tspan> - <tspan x="10px" y="2692px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="2692px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2710px"> + <tspan x="10px" y="2710px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: you might have meant to create a new value of the struct</tspan> </tspan> - <tspan x="10px" y="2728px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Unit` has no field named `x`</tspan> + <tspan x="10px" y="2728px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2746px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:29:18</tspan> + <tspan x="10px" y="2746px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::Struct</tspan><tspan class="fg-ansi256-009">(0, 0)</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="2764px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="2764px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::Struct</tspan><tspan class="fg-ansi256-010"> { x: /* value */ }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="2782px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit { x: 0, y: 0 };</tspan> + <tspan x="10px" y="2782px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2800px"><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">`Enum::Unit` does not have this field</tspan> + <tspan x="10px" y="2800px"> </tspan> - <tspan x="10px" y="2818px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="2818px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Unit` has no field named `x`</tspan> </tspan> - <tspan x="10px" y="2836px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">note</tspan><tspan>: all struct fields are already assigned</tspan> + <tspan x="10px" y="2836px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:29:18</tspan> </tspan> - <tspan x="10px" y="2854px"> + <tspan x="10px" y="2854px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2872px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Unit` has no field named `y`</tspan> + <tspan x="10px" y="2872px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit { x: 0, y: 0 };</tspan> </tspan> - <tspan x="10px" y="2890px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:29:24</tspan> + <tspan x="10px" y="2890px"><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">`Enum::Unit` does not have this field</tspan> </tspan> <tspan x="10px" y="2908px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="2926px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit { x: 0, y: 0 };</tspan> + <tspan x="10px" y="2926px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">note</tspan><tspan>: all struct fields are already assigned</tspan> </tspan> - <tspan x="10px" y="2944px"><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">`Enum::Unit` does not have this field</tspan> + <tspan x="10px" y="2944px"> </tspan> - <tspan x="10px" y="2962px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="2962px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Unit` has no field named `y`</tspan> </tspan> - <tspan x="10px" y="2980px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">note</tspan><tspan>: all struct fields are already assigned</tspan> + <tspan x="10px" y="2980px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:29:24</tspan> </tspan> - <tspan x="10px" y="2998px"> + <tspan x="10px" y="2998px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3016px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Tuple` has no field named `x`</tspan> + <tspan x="10px" y="3016px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Unit { x: 0, y: 0 };</tspan> </tspan> - <tspan x="10px" y="3034px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:31:19</tspan> + <tspan x="10px" y="3034px"><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">`Enum::Unit` does not have this field</tspan> </tspan> <tspan x="10px" y="3052px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3070px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Tuple(i32),</tspan> + <tspan x="10px" y="3070px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">note</tspan><tspan>: all struct fields are already assigned</tspan> </tspan> - <tspan x="10px" y="3088px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">-----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Tuple` defined here</tspan> + <tspan x="10px" y="3088px"> </tspan> - <tspan x="10px" y="3106px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="3106px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Tuple` has no field named `x`</tspan> </tspan> - <tspan x="10px" y="3124px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple { x: 0, y: 0 };</tspan> + <tspan x="10px" y="3124px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:31:19</tspan> </tspan> - <tspan x="10px" y="3142px"><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">field does not exist</tspan> + <tspan x="10px" y="3142px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3160px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="3160px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Tuple(i32),</tspan> </tspan> - <tspan x="10px" y="3178px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: `Enum::Tuple` is a tuple variant, use the appropriate syntax</tspan> + <tspan x="10px" y="3178px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">-----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Tuple` defined here</tspan> </tspan> - <tspan x="10px" y="3196px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="3196px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="3214px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-010">(/* i32 */)</tspan><tspan>;</tspan> + <tspan x="10px" y="3214px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple { x: 0, y: 0 };</tspan> </tspan> - <tspan x="10px" y="3232px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~</tspan> + <tspan x="10px" y="3232px"><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">field does not exist</tspan> </tspan> - <tspan x="10px" y="3250px"> + <tspan x="10px" y="3250px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3268px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Tuple` has no field named `y`</tspan> + <tspan x="10px" y="3268px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: `Enum::Tuple` is a tuple variant, use the appropriate syntax</tspan> </tspan> - <tspan x="10px" y="3286px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:31:25</tspan> + <tspan x="10px" y="3286px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3304px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="3304px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-009"> { x: 0, y: 0 }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="3322px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Tuple(i32),</tspan> + <tspan x="10px" y="3322px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-010">(/* i32 */)</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="3340px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">-----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Tuple` defined here</tspan> + <tspan x="10px" y="3340px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3358px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="3358px"> </tspan> - <tspan x="10px" y="3376px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple { x: 0, y: 0 };</tspan> + <tspan x="10px" y="3376px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Tuple` has no field named `y`</tspan> </tspan> - <tspan x="10px" y="3394px"><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">field does not exist</tspan> + <tspan x="10px" y="3394px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:31:25</tspan> </tspan> <tspan x="10px" y="3412px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3430px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: `Enum::Tuple` is a tuple variant, use the appropriate syntax</tspan> + <tspan x="10px" y="3430px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Tuple(i32),</tspan> </tspan> - <tspan x="10px" y="3448px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="3448px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">-----</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">`Enum::Tuple` defined here</tspan> </tspan> - <tspan x="10px" y="3466px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-010">(/* i32 */)</tspan><tspan>;</tspan> + <tspan x="10px" y="3466px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="3484px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~</tspan> + <tspan x="10px" y="3484px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Tuple { x: 0, y: 0 };</tspan> </tspan> - <tspan x="10px" y="3502px"> + <tspan x="10px" y="3502px"><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">field does not exist</tspan> </tspan> - <tspan x="10px" y="3520px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Struct` has no field named `y`</tspan> + <tspan x="10px" y="3520px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3538px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:33:26</tspan> + <tspan x="10px" y="3538px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: `Enum::Tuple` is a tuple variant, use the appropriate syntax</tspan> </tspan> <tspan x="10px" y="3556px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3574px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct { x: 0, y: 0 };</tspan> + <tspan x="10px" y="3574px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-009"> { x: 0, y: 0 }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="3592px"><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">`Enum::Struct` does not have this field</tspan> + <tspan x="10px" y="3592px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::Tuple</tspan><tspan class="fg-ansi256-010">(/* i32 */)</tspan><tspan>;</tspan> </tspan> <tspan x="10px" y="3610px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3628px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">note</tspan><tspan>: all struct fields are already assigned</tspan> + <tspan x="10px" y="3628px"> </tspan> - <tspan x="10px" y="3646px"> + <tspan x="10px" y="3646px"><tspan class="fg-ansi256-009 bold">error[E0559]</tspan><tspan class="bold">: variant `Enum::Struct` has no field named `y`</tspan> </tspan> - <tspan x="10px" y="3664px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `unit` found for enum `Enum` in the current scope</tspan> + <tspan x="10px" y="3664px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:33:26</tspan> </tspan> - <tspan x="10px" y="3682px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:34:11</tspan> + <tspan x="10px" y="3682px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3700px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="3700px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::Struct { x: 0, y: 0 };</tspan> </tspan> - <tspan x="10px" y="3718px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="3718px"><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">`Enum::Struct` does not have this field</tspan> </tspan> - <tspan x="10px" y="3736px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `unit` not found for this enum</tspan> + <tspan x="10px" y="3736px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3754px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="3754px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">note</tspan><tspan>: all struct fields are already assigned</tspan> </tspan> - <tspan x="10px" y="3772px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit;</tspan> + <tspan x="10px" y="3772px"> </tspan> - <tspan x="10px" y="3790px"><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">variant or associated item not found in `Enum`</tspan> + <tspan x="10px" y="3790px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `unit` found for enum `Enum` in the current scope</tspan> </tspan> - <tspan x="10px" y="3808px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="3808px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:34:11</tspan> </tspan> - <tspan x="10px" y="3826px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name (notice the capitalization difference)</tspan> + <tspan x="10px" y="3826px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3844px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="3844px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="3862px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> + <tspan x="10px" y="3862px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `unit` not found for this enum</tspan> </tspan> - <tspan x="10px" y="3880px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan> + <tspan x="10px" y="3880px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="3898px"> + <tspan x="10px" y="3898px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit;</tspan> </tspan> - <tspan x="10px" y="3916px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `tuple` found for enum `Enum` in the current scope</tspan> + <tspan x="10px" y="3916px"><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">variant or associated item not found in `Enum`</tspan> </tspan> - <tspan x="10px" y="3934px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:35:11</tspan> + <tspan x="10px" y="3934px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3952px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="3952px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name (notice the capitalization difference)</tspan> </tspan> - <tspan x="10px" y="3970px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="3970px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="3988px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `tuple` not found for this enum</tspan> + <tspan x="10px" y="3988px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">unit</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="4006px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="4006px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="4024px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple;</tspan> + <tspan x="10px" y="4024px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4042px"><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">variant or associated item not found in `Enum`</tspan> + <tspan x="10px" y="4042px"> </tspan> - <tspan x="10px" y="4060px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="4060px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `tuple` found for enum `Enum` in the current scope</tspan> </tspan> - <tspan x="10px" y="4078px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="4078px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:35:11</tspan> </tspan> <tspan x="10px" y="4096px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4114px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan> + <tspan x="10px" y="4114px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="4132px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="4132px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `tuple` not found for this enum</tspan> </tspan> - <tspan x="10px" y="4150px"> + <tspan x="10px" y="4150px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="4168px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `r#struct` found for enum `Enum` in the current scope</tspan> + <tspan x="10px" y="4168px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple;</tspan> </tspan> - <tspan x="10px" y="4186px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:36:11</tspan> + <tspan x="10px" y="4186px"><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">variant or associated item not found in `Enum`</tspan> </tspan> <tspan x="10px" y="4204px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4222px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="4222px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="4240px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `r#struct` not found for this enum</tspan> + <tspan x="10px" y="4240px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4258px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="4258px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">tuple</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="4276px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct;</tspan> + <tspan x="10px" y="4276px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="4294px"><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">variant or associated item not found in `Enum`</tspan> + <tspan x="10px" y="4294px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4312px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="4312px"> </tspan> - <tspan x="10px" y="4330px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="4330px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `r#struct` found for enum `Enum` in the current scope</tspan> </tspan> - <tspan x="10px" y="4348px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="4348px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:36:11</tspan> </tspan> - <tspan x="10px" y="4366px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> + <tspan x="10px" y="4366px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4384px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="4384px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="4402px"> + <tspan x="10px" y="4402px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `r#struct` not found for this enum</tspan> </tspan> - <tspan x="10px" y="4420px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `unit` found for enum `Enum` in the current scope</tspan> + <tspan x="10px" y="4420px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="4438px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:37:11</tspan> + <tspan x="10px" y="4438px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct;</tspan> </tspan> - <tspan x="10px" y="4456px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="4456px"><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">variant or associated item not found in `Enum`</tspan> </tspan> - <tspan x="10px" y="4474px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="4474px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4492px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `unit` not found for this enum</tspan> + <tspan x="10px" y="4492px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="4510px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="4510px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4528px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit();</tspan> + <tspan x="10px" y="4528px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">r#struct</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="4546px"><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">variant or associated item not found in `Enum`</tspan> + <tspan x="10px" y="4546px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> </tspan> <tspan x="10px" y="4564px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4582px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="4582px"> </tspan> - <tspan x="10px" y="4600px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="4600px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `unit` found for enum `Enum` in the current scope</tspan> </tspan> - <tspan x="10px" y="4618px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> + <tspan x="10px" y="4618px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:37:11</tspan> </tspan> - <tspan x="10px" y="4636px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan> + <tspan x="10px" y="4636px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4654px"> + <tspan x="10px" y="4654px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="4672px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `tuple` found for enum `Enum` in the current scope</tspan> + <tspan x="10px" y="4672px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `unit` not found for this enum</tspan> </tspan> - <tspan x="10px" y="4690px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:38:11</tspan> + <tspan x="10px" y="4690px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="4708px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="4708px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit();</tspan> </tspan> - <tspan x="10px" y="4726px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="4726px"><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">variant or associated item not found in `Enum`</tspan> </tspan> - <tspan x="10px" y="4744px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `tuple` not found for this enum</tspan> + <tspan x="10px" y="4744px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4762px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="4762px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="4780px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple();</tspan> + <tspan x="10px" y="4780px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4798px"><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">variant or associated item not found in `Enum`</tspan> + <tspan x="10px" y="4798px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">unit()</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="4816px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="4816px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="4834px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="4834px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4852px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="4852px"> </tspan> - <tspan x="10px" y="4870px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan> + <tspan x="10px" y="4870px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `tuple` found for enum `Enum` in the current scope</tspan> </tspan> - <tspan x="10px" y="4888px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="4888px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:38:11</tspan> </tspan> - <tspan x="10px" y="4906px"> + <tspan x="10px" y="4906px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="4924px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `r#struct` found for enum `Enum` in the current scope</tspan> + <tspan x="10px" y="4924px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="4942px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:39:11</tspan> + <tspan x="10px" y="4942px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `tuple` not found for this enum</tspan> </tspan> - <tspan x="10px" y="4960px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="4960px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="4978px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="4978px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple();</tspan> </tspan> - <tspan x="10px" y="4996px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `r#struct` not found for this enum</tspan> + <tspan x="10px" y="4996px"><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">variant or associated item not found in `Enum`</tspan> </tspan> - <tspan x="10px" y="5014px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="5014px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="5032px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct();</tspan> + <tspan x="10px" y="5032px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="5050px"><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">variant or associated item not found in `Enum`</tspan> + <tspan x="10px" y="5050px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="5068px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="5068px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">tuple()</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="5086px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="5086px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan> </tspan> <tspan x="10px" y="5104px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="5122px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> + <tspan x="10px" y="5122px"> </tspan> - <tspan x="10px" y="5140px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="5140px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `r#struct` found for enum `Enum` in the current scope</tspan> </tspan> - <tspan x="10px" y="5158px"> + <tspan x="10px" y="5158px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:39:11</tspan> </tspan> - <tspan x="10px" y="5176px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `unit` found for enum `Enum`</tspan> + <tspan x="10px" y="5176px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="5194px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:40:11</tspan> + <tspan x="10px" y="5194px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="5212px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="5212px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `r#struct` not found for this enum</tspan> </tspan> - <tspan x="10px" y="5230px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="5230px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="5248px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `unit` not found here</tspan> + <tspan x="10px" y="5248px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct();</tspan> </tspan> - <tspan x="10px" y="5266px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="5266px"><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">variant or associated item not found in `Enum`</tspan> </tspan> - <tspan x="10px" y="5284px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit {};</tspan> + <tspan x="10px" y="5284px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="5302px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan> + <tspan x="10px" y="5302px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> <tspan x="10px" y="5320px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="5338px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="5338px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">r#struct()</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="5356px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="5356px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="5374px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> + <tspan x="10px" y="5374px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="5392px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan> + <tspan x="10px" y="5392px"> </tspan> - <tspan x="10px" y="5410px"> + <tspan x="10px" y="5410px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `unit` found for enum `Enum`</tspan> </tspan> - <tspan x="10px" y="5428px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `tuple` found for enum `Enum`</tspan> + <tspan x="10px" y="5428px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:40:11</tspan> </tspan> - <tspan x="10px" y="5446px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:41:11</tspan> + <tspan x="10px" y="5446px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="5464px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="5464px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="5482px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="5482px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `unit` not found here</tspan> </tspan> - <tspan x="10px" y="5500px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `tuple` not found here</tspan> + <tspan x="10px" y="5500px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="5518px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="5518px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit {};</tspan> </tspan> - <tspan x="10px" y="5536px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple {};</tspan> + <tspan x="10px" y="5536px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan> </tspan> - <tspan x="10px" y="5554px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^</tspan> + <tspan x="10px" y="5554px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="5572px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="5572px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="5590px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="5590px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="5608px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="5608px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">unit {}</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="5626px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan> + <tspan x="10px" y="5626px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="5644px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="5644px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> <tspan x="10px" y="5662px"> </tspan> - <tspan x="10px" y="5680px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `r#struct` found for enum `Enum`</tspan> + <tspan x="10px" y="5680px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `tuple` found for enum `Enum`</tspan> </tspan> - <tspan x="10px" y="5698px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:42:11</tspan> + <tspan x="10px" y="5698px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:41:11</tspan> </tspan> <tspan x="10px" y="5716px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> <tspan x="10px" y="5734px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="5752px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `r#struct` not found here</tspan> + <tspan x="10px" y="5752px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `tuple` not found here</tspan> </tspan> <tspan x="10px" y="5770px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="5788px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct {};</tspan> + <tspan x="10px" y="5788px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple {};</tspan> </tspan> - <tspan x="10px" y="5806px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^</tspan> + <tspan x="10px" y="5806px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^</tspan> </tspan> <tspan x="10px" y="5824px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> @@ -671,357 +671,413 @@ </tspan> <tspan x="10px" y="5860px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="5878px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> + <tspan x="10px" y="5878px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">tuple {}</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="5896px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="5896px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="5914px"> + <tspan x="10px" y="5914px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="5932px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `unit` found for enum `Enum` in the current scope</tspan> + <tspan x="10px" y="5932px"> </tspan> - <tspan x="10px" y="5950px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:43:11</tspan> + <tspan x="10px" y="5950px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `r#struct` found for enum `Enum`</tspan> </tspan> - <tspan x="10px" y="5968px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="5968px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:42:11</tspan> </tspan> - <tspan x="10px" y="5986px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="5986px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6004px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `unit` not found for this enum</tspan> + <tspan x="10px" y="6004px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="6022px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="6022px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `r#struct` not found here</tspan> </tspan> - <tspan x="10px" y="6040px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit(0);</tspan> + <tspan x="10px" y="6040px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="6058px"><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">variant or associated item not found in `Enum`</tspan> + <tspan x="10px" y="6058px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct {};</tspan> </tspan> - <tspan x="10px" y="6076px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="6076px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^</tspan> </tspan> - <tspan x="10px" y="6094px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="6094px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6112px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="6112px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="6130px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> + <tspan x="10px" y="6130px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6148px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan> + <tspan x="10px" y="6148px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">r#struct {}</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="6166px"> + <tspan x="10px" y="6166px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="6184px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `tuple` found for enum `Enum` in the current scope</tspan> + <tspan x="10px" y="6184px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6202px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:44:11</tspan> + <tspan x="10px" y="6202px"> </tspan> - <tspan x="10px" y="6220px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="6220px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `unit` found for enum `Enum` in the current scope</tspan> </tspan> - <tspan x="10px" y="6238px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="6238px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:43:11</tspan> </tspan> - <tspan x="10px" y="6256px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `tuple` not found for this enum</tspan> + <tspan x="10px" y="6256px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6274px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="6274px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="6292px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple(0);</tspan> + <tspan x="10px" y="6292px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `unit` not found for this enum</tspan> </tspan> - <tspan x="10px" y="6310px"><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">variant or associated item not found in `Enum`</tspan> + <tspan x="10px" y="6310px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="6328px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="6328px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit(0);</tspan> </tspan> - <tspan x="10px" y="6346px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="6346px"><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">variant or associated item not found in `Enum`</tspan> </tspan> <tspan x="10px" y="6364px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6382px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple</tspan><tspan>(0);</tspan> + <tspan x="10px" y="6382px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="6400px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~</tspan> + <tspan x="10px" y="6400px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6418px"> + <tspan x="10px" y="6418px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">unit(0)</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="6436px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `r#struct` found for enum `Enum` in the current scope</tspan> + <tspan x="10px" y="6436px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="6454px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:45:11</tspan> + <tspan x="10px" y="6454px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6472px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="6472px"> </tspan> - <tspan x="10px" y="6490px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="6490px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `tuple` found for enum `Enum` in the current scope</tspan> </tspan> - <tspan x="10px" y="6508px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `r#struct` not found for this enum</tspan> + <tspan x="10px" y="6508px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:44:11</tspan> </tspan> - <tspan x="10px" y="6526px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="6526px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6544px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct(0);</tspan> + <tspan x="10px" y="6544px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="6562px"><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">variant or associated item not found in `Enum`</tspan> + <tspan x="10px" y="6562px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `tuple` not found for this enum</tspan> </tspan> - <tspan x="10px" y="6580px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="6580px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="6598px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="6598px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple(0);</tspan> </tspan> - <tspan x="10px" y="6616px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="6616px"><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">variant or associated item not found in `Enum`</tspan> </tspan> - <tspan x="10px" y="6634px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> + <tspan x="10px" y="6634px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6652px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="6652px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="6670px"> + <tspan x="10px" y="6670px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6688px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `unit` found for enum `Enum`</tspan> + <tspan x="10px" y="6688px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">tuple</tspan><tspan>(0);</tspan> </tspan> - <tspan x="10px" y="6706px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:46:11</tspan> + <tspan x="10px" y="6706px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple</tspan><tspan>(0);</tspan> </tspan> <tspan x="10px" y="6724px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6742px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="6742px"> </tspan> - <tspan x="10px" y="6760px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `unit` not found here</tspan> + <tspan x="10px" y="6760px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `r#struct` found for enum `Enum` in the current scope</tspan> </tspan> - <tspan x="10px" y="6778px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="6778px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:45:11</tspan> </tspan> - <tspan x="10px" y="6796px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit { x: 0 };</tspan> + <tspan x="10px" y="6796px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6814px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan> + <tspan x="10px" y="6814px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="6832px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="6832px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `r#struct` not found for this enum</tspan> </tspan> - <tspan x="10px" y="6850px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="6850px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="6868px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="6868px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct(0);</tspan> </tspan> - <tspan x="10px" y="6886px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> + <tspan x="10px" y="6886px"><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">variant or associated item not found in `Enum`</tspan> </tspan> - <tspan x="10px" y="6904px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan> + <tspan x="10px" y="6904px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6922px"> + <tspan x="10px" y="6922px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="6940px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `tuple` found for enum `Enum`</tspan> + <tspan x="10px" y="6940px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="6958px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:47:11</tspan> + <tspan x="10px" y="6958px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">r#struct(0)</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="6976px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="6976px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="6994px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="6994px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7012px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `tuple` not found here</tspan> + <tspan x="10px" y="7012px"> </tspan> - <tspan x="10px" y="7030px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="7030px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `unit` found for enum `Enum`</tspan> </tspan> - <tspan x="10px" y="7048px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple { x: 0 };</tspan> + <tspan x="10px" y="7048px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:46:11</tspan> </tspan> - <tspan x="10px" y="7066px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^</tspan> + <tspan x="10px" y="7066px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7084px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="7084px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="7102px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="7102px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `unit` not found here</tspan> </tspan> - <tspan x="10px" y="7120px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="7120px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="7138px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan> + <tspan x="10px" y="7138px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit { x: 0 };</tspan> </tspan> - <tspan x="10px" y="7156px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="7156px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan> </tspan> - <tspan x="10px" y="7174px"> + <tspan x="10px" y="7174px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7192px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `r#struct` found for enum `Enum`</tspan> + <tspan x="10px" y="7192px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="7210px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:48:11</tspan> + <tspan x="10px" y="7210px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7228px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="7228px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">unit { x: 0 }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="7246px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="7246px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="7264px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `r#struct` not found here</tspan> + <tspan x="10px" y="7264px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7282px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="7282px"> </tspan> - <tspan x="10px" y="7300px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct { x: 0 };</tspan> + <tspan x="10px" y="7300px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `tuple` found for enum `Enum`</tspan> </tspan> - <tspan x="10px" y="7318px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^</tspan> + <tspan x="10px" y="7318px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:47:11</tspan> </tspan> <tspan x="10px" y="7336px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7354px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="7354px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="7372px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="7372px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `tuple` not found here</tspan> </tspan> - <tspan x="10px" y="7390px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> + <tspan x="10px" y="7390px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="7408px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="7408px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple { x: 0 };</tspan> </tspan> - <tspan x="10px" y="7426px"> + <tspan x="10px" y="7426px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^</tspan> </tspan> - <tspan x="10px" y="7444px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `unit` found for enum `Enum` in the current scope</tspan> + <tspan x="10px" y="7444px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7462px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:49:11</tspan> + <tspan x="10px" y="7462px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> <tspan x="10px" y="7480px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7498px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="7498px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">tuple { x: 0 }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="7516px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `unit` not found for this enum</tspan> + <tspan x="10px" y="7516px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="7534px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="7534px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7552px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit(0, 0);</tspan> + <tspan x="10px" y="7552px"> </tspan> - <tspan x="10px" y="7570px"><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">variant or associated item not found in `Enum`</tspan> + <tspan x="10px" y="7570px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `r#struct` found for enum `Enum`</tspan> </tspan> - <tspan x="10px" y="7588px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="7588px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:48:11</tspan> </tspan> - <tspan x="10px" y="7606px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="7606px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7624px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="7624px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="7642px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> + <tspan x="10px" y="7642px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `r#struct` not found here</tspan> </tspan> - <tspan x="10px" y="7660px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan> + <tspan x="10px" y="7660px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="7678px"> + <tspan x="10px" y="7678px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct { x: 0 };</tspan> </tspan> - <tspan x="10px" y="7696px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `tuple` found for enum `Enum` in the current scope</tspan> + <tspan x="10px" y="7696px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^</tspan> </tspan> - <tspan x="10px" y="7714px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:50:11</tspan> + <tspan x="10px" y="7714px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7732px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="7732px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="7750px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="7750px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7768px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `tuple` not found for this enum</tspan> + <tspan x="10px" y="7768px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">r#struct { x: 0 }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="7786px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="7786px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="7804px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple(0, 0);</tspan> + <tspan x="10px" y="7804px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7822px"><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">variant or associated item not found in `Enum`</tspan> + <tspan x="10px" y="7822px"> </tspan> - <tspan x="10px" y="7840px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="7840px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `unit` found for enum `Enum` in the current scope</tspan> </tspan> - <tspan x="10px" y="7858px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="7858px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:49:11</tspan> </tspan> <tspan x="10px" y="7876px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="7894px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple</tspan><tspan>(</tspan><tspan class="fg-ansi256-010">/* i32 */</tspan><tspan>);</tspan> + <tspan x="10px" y="7894px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="7912px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~</tspan> + <tspan x="10px" y="7912px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `unit` not found for this enum</tspan> </tspan> - <tspan x="10px" y="7930px"> + <tspan x="10px" y="7930px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="7948px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `r#struct` found for enum `Enum` in the current scope</tspan> + <tspan x="10px" y="7948px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit(0, 0);</tspan> </tspan> - <tspan x="10px" y="7966px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:51:11</tspan> + <tspan x="10px" y="7966px"><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">variant or associated item not found in `Enum`</tspan> </tspan> <tspan x="10px" y="7984px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8002px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="8002px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="8020px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `r#struct` not found for this enum</tspan> + <tspan x="10px" y="8020px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8038px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="8038px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">unit(0, 0)</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="8056px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct(0, 0);</tspan> + <tspan x="10px" y="8056px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="8074px"><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">variant or associated item not found in `Enum`</tspan> + <tspan x="10px" y="8074px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8092px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="8092px"> </tspan> - <tspan x="10px" y="8110px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="8110px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `tuple` found for enum `Enum` in the current scope</tspan> </tspan> - <tspan x="10px" y="8128px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="8128px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:50:11</tspan> </tspan> - <tspan x="10px" y="8146px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> + <tspan x="10px" y="8146px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8164px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="8164px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="8182px"> + <tspan x="10px" y="8182px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `tuple` not found for this enum</tspan> </tspan> - <tspan x="10px" y="8200px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `unit` found for enum `Enum`</tspan> + <tspan x="10px" y="8200px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="8218px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:52:11</tspan> + <tspan x="10px" y="8218px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple(0, 0);</tspan> </tspan> - <tspan x="10px" y="8236px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="8236px"><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">variant or associated item not found in `Enum`</tspan> </tspan> - <tspan x="10px" y="8254px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="8254px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8272px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `unit` not found here</tspan> + <tspan x="10px" y="8272px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="8290px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="8290px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8308px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit { x: 0, y: 0 };</tspan> + <tspan x="10px" y="8308px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">tuple</tspan><tspan>(</tspan><tspan class="fg-ansi256-009">0, 0</tspan><tspan>);</tspan> </tspan> - <tspan x="10px" y="8326px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan> + <tspan x="10px" y="8326px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple</tspan><tspan>(</tspan><tspan class="fg-ansi256-010">/* i32 */</tspan><tspan>);</tspan> </tspan> <tspan x="10px" y="8344px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8362px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="8362px"> </tspan> - <tspan x="10px" y="8380px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="8380px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant or associated item named `r#struct` found for enum `Enum` in the current scope</tspan> </tspan> - <tspan x="10px" y="8398px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> + <tspan x="10px" y="8398px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:51:11</tspan> </tspan> - <tspan x="10px" y="8416px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~</tspan> + <tspan x="10px" y="8416px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8434px"> + <tspan x="10px" y="8434px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="8452px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `tuple` found for enum `Enum`</tspan> + <tspan x="10px" y="8452px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant or associated item `r#struct` not found for this enum</tspan> </tspan> - <tspan x="10px" y="8470px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:53:11</tspan> + <tspan x="10px" y="8470px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="8488px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="8488px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct(0, 0);</tspan> </tspan> - <tspan x="10px" y="8506px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="8506px"><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">variant or associated item not found in `Enum`</tspan> </tspan> - <tspan x="10px" y="8524px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `tuple` not found here</tspan> + <tspan x="10px" y="8524px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8542px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="8542px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="8560px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple { x: 0, y: 0 };</tspan> + <tspan x="10px" y="8560px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8578px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^</tspan> + <tspan x="10px" y="8578px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">r#struct(0, 0)</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="8596px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="8596px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="8614px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="8614px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8632px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="8632px"> </tspan> - <tspan x="10px" y="8650px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan> + <tspan x="10px" y="8650px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `unit` found for enum `Enum`</tspan> </tspan> - <tspan x="10px" y="8668px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="8668px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:52:11</tspan> </tspan> - <tspan x="10px" y="8686px"> + <tspan x="10px" y="8686px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8704px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `r#struct` found for enum `Enum`</tspan> + <tspan x="10px" y="8704px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="8722px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:54:11</tspan> + <tspan x="10px" y="8722px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `unit` not found here</tspan> </tspan> - <tspan x="10px" y="8740px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="8740px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="8758px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> + <tspan x="10px" y="8758px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::unit { x: 0, y: 0 };</tspan> </tspan> - <tspan x="10px" y="8776px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `r#struct` not found here</tspan> + <tspan x="10px" y="8776px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^</tspan> </tspan> - <tspan x="10px" y="8794px"><tspan class="fg-ansi256-012 bold">...</tspan> + <tspan x="10px" y="8794px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8812px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct { x: 0, y: 0 };</tspan> + <tspan x="10px" y="8812px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> </tspan> - <tspan x="10px" y="8830px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^</tspan> + <tspan x="10px" y="8830px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8848px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> + <tspan x="10px" y="8848px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">unit { x: 0, y: 0 }</tspan><tspan>;</tspan> </tspan> - <tspan x="10px" y="8866px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> + <tspan x="10px" y="8866px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Unit</tspan><tspan>;</tspan> </tspan> <tspan x="10px" y="8884px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8902px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">| </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> + <tspan x="10px" y="8902px"> </tspan> - <tspan x="10px" y="8920px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010">~~~~~~~~~~~~~~~~~~~~~~~~~</tspan> + <tspan x="10px" y="8920px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `tuple` found for enum `Enum`</tspan> </tspan> - <tspan x="10px" y="8938px"> + <tspan x="10px" y="8938px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:53:11</tspan> </tspan> - <tspan x="10px" y="8956px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="bold">: aborting due to 39 previous errors</tspan> + <tspan x="10px" y="8956px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> </tspan> - <tspan x="10px" y="8974px"> + <tspan x="10px" y="8974px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> </tspan> - <tspan x="10px" y="8992px"><tspan class="bold">Some errors have detailed explanations: E0061, E0063, E0533, E0559, E0599, E0618.</tspan> + <tspan x="10px" y="8992px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `tuple` not found here</tspan> </tspan> - <tspan x="10px" y="9010px"><tspan class="bold">For more information about an error, try `rustc --explain E0061`.</tspan> + <tspan x="10px" y="9010px"><tspan class="fg-ansi256-012 bold">...</tspan> </tspan> - <tspan x="10px" y="9028px"> + <tspan x="10px" y="9028px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::tuple { x: 0, y: 0 };</tspan> +</tspan> + <tspan x="10px" y="9046px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^</tspan> +</tspan> + <tspan x="10px" y="9064px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> +</tspan> + <tspan x="10px" y="9082px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> +</tspan> + <tspan x="10px" y="9100px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> +</tspan> + <tspan x="10px" y="9118px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">tuple { x: 0, y: 0 }</tspan><tspan>;</tspan> +</tspan> + <tspan x="10px" y="9136px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Tuple(/* i32 */)</tspan><tspan>;</tspan> +</tspan> + <tspan x="10px" y="9154px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> +</tspan> + <tspan x="10px" y="9172px"> +</tspan> + <tspan x="10px" y="9190px"><tspan class="fg-ansi256-009 bold">error[E0599]</tspan><tspan class="bold">: no variant named `r#struct` found for enum `Enum`</tspan> +</tspan> + <tspan x="10px" y="9208px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/incorrect-variant-literal.rs:54:11</tspan> +</tspan> + <tspan x="10px" y="9226px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> +</tspan> + <tspan x="10px" y="9244px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> enum Enum {</tspan> +</tspan> + <tspan x="10px" y="9262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">---------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">variant `r#struct` not found here</tspan> +</tspan> + <tspan x="10px" y="9280px"><tspan class="fg-ansi256-012 bold">...</tspan> +</tspan> + <tspan x="10px" y="9298px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Enum::r#struct { x: 0, y: 0 };</tspan> +</tspan> + <tspan x="10px" y="9316px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^</tspan> +</tspan> + <tspan x="10px" y="9334px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> +</tspan> + <tspan x="10px" y="9352px"><tspan class="fg-ansi256-014 bold">help</tspan><tspan>: there is a variant with a similar name</tspan> +</tspan> + <tspan x="10px" y="9370px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> +</tspan> + <tspan x="10px" y="9388px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-009">- </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-009">r#struct { x: 0, y: 0 }</tspan><tspan>;</tspan> +</tspan> + <tspan x="10px" y="9406px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-010">+ </tspan><tspan> Enum::</tspan><tspan class="fg-ansi256-010">Struct { x: /* value */ }</tspan><tspan>;</tspan> +</tspan> + <tspan x="10px" y="9424px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> +</tspan> + <tspan x="10px" y="9442px"> +</tspan> + <tspan x="10px" y="9460px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="bold">: aborting due to 39 previous errors</tspan> +</tspan> + <tspan x="10px" y="9478px"> +</tspan> + <tspan x="10px" y="9496px"><tspan class="bold">Some errors have detailed explanations: E0061, E0063, E0533, E0559, E0599, E0618.</tspan> +</tspan> + <tspan x="10px" y="9514px"><tspan class="bold">For more information about an error, try `rustc --explain E0061`.</tspan> +</tspan> + <tspan x="10px" y="9532px"> </tspan> </text> diff --git a/tests/ui/suggestions/issue-101465.stderr b/tests/ui/suggestions/issue-101465.stderr index 0dad813b389..ff612a908cb 100644 --- a/tests/ui/suggestions/issue-101465.stderr +++ b/tests/ui/suggestions/issue-101465.stderr @@ -12,8 +12,9 @@ LL | | } | help: you could change the return type to be a boxed trait object | -LL | fn foo() -> Box<dyn Tr> { - | ~~~~~~~ + +LL - fn foo() -> impl Tr { +LL + fn foo() -> Box<dyn Tr> { + | help: if you change the return type to expect trait objects, box the returned expressions | LL ~ true => Box::new(B), diff --git a/tests/ui/suggestions/issue-102972.stderr b/tests/ui/suggestions/issue-102972.stderr index 4b0d3b96f85..438f28ad032 100644 --- a/tests/ui/suggestions/issue-102972.stderr +++ b/tests/ui/suggestions/issue-102972.stderr @@ -32,8 +32,9 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `iter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL help: if you want to call `next` on a iterator within the loop, consider using `while let` | -LL | while let Some(_i) = iter.next() { - | ~~~~~~~~~~~~~~~ ~~~ +++++++ +LL - for _i in iter { +LL + while let Some(_i) = iter.next() { + | error[E0499]: cannot borrow `i` as mutable more than once at a time --> $DIR/issue-102972.rs:22:9 @@ -69,8 +70,9 @@ note: `into_iter` takes ownership of the receiver `self`, which moves `iter` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL help: if you want to call `next` on a iterator within the loop, consider using `while let` | -LL | while let Some(()) = iter.next() { - | ~~~~~~~~~~~~~~~ ~~~ +++++++ +LL - for () in iter { +LL + while let Some(()) = iter.next() { + | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/issue-107860.stderr b/tests/ui/suggestions/issue-107860.stderr index 4be495da46b..2bfd2193981 100644 --- a/tests/ui/suggestions/issue-107860.stderr +++ b/tests/ui/suggestions/issue-107860.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-107860.rs:3:36 | LL | async fn str<T>(T: &str) -> &str { &str } - | ^^^^ expected `&str`, found `&fn(&str) -> ... {str::<...>}` + | ^^^^ expected `&str`, found `&fn(&str) -> ... {str::<_>}` | = note: expected reference `&str` found reference `&for<'a> fn(&'a str) -> impl Future<Output = &'a str> {str::<_>}` diff --git a/tests/ui/suggestions/issue-109291.stderr b/tests/ui/suggestions/issue-109291.stderr index d4a9351af3a..c2c36f10544 100644 --- a/tests/ui/suggestions/issue-109291.stderr +++ b/tests/ui/suggestions/issue-109291.stderr @@ -11,8 +11,9 @@ note: if you're trying to build a new `Backtrace` consider using one of the foll --> $SRC_DIR/std/src/backtrace.rs:LL:COL help: there is an associated function `force_capture` with a similar name | -LL | println!("Custom backtrace: {}", std::backtrace::Backtrace::force_capture()); - | ~~~~~~~~~~~~~ +LL - println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture()); +LL + println!("Custom backtrace: {}", std::backtrace::Backtrace::force_capture()); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-116434-2015.stderr b/tests/ui/suggestions/issue-116434-2015.stderr index 508c3ec5e4f..e7b8cd2f101 100644 --- a/tests/ui/suggestions/issue-116434-2015.stderr +++ b/tests/ui/suggestions/issue-116434-2015.stderr @@ -47,7 +47,7 @@ LL | fn foo() -> Clone; | = note: the trait is not dyn compatible because it requires `Self: Sized` = 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> help: there is an associated type with the same name | LL | fn foo() -> Self::Clone; @@ -74,7 +74,7 @@ LL | fn handle() -> DbHandle; | ^^^^^^^^ `DbHandle` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-116434-2015.rs:14:17 | LL | trait DbHandle: Sized {} diff --git a/tests/ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.stderr b/tests/ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.stderr index a3ab0b8efb0..75d78ed6a35 100644 --- a/tests/ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.stderr +++ b/tests/ui/suggestions/issue-79843-impl-trait-with-missing-bounds-on-async-fn.stderr @@ -14,8 +14,9 @@ LL | fn assert_is_send<T: Send>(_: &T) {} | ^^^^ required by this bound in `assert_is_send` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | async fn run<F: Foo>(_: &(), foo: F) -> std::io::Result<()> where <F as Foo>::Bar: Send { - | ++++++++ ~ +++++++++++++++++++++++++++ +LL - async fn run(_: &(), foo: impl Foo) -> std::io::Result<()> { +LL + async fn run<F: Foo>(_: &(), foo: F) -> std::io::Result<()> where <F as Foo>::Bar: Send { + | error[E0277]: `<impl Foo as Foo>::Bar` cannot be sent between threads safely --> $DIR/issue-79843-impl-trait-with-missing-bounds-on-async-fn.rs:24:20 @@ -33,8 +34,9 @@ LL | fn assert_is_send<T: Send>(_: &T) {} | ^^^^ required by this bound in `assert_is_send` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | async fn run2<F: Foo>(_: &(), foo: F) -> std::io::Result<()> where <F as Foo>::Bar: Send { - | ~~~~~~~~ ~ +++++++++++++++++++++++++++ +LL - async fn run2< >(_: &(), foo: impl Foo) -> std::io::Result<()> { +LL + async fn run2<F: Foo>(_: &(), foo: F) -> std::io::Result<()> where <F as Foo>::Bar: Send { + | error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/issue-84592.stderr b/tests/ui/suggestions/issue-84592.stderr index fe0a7b6731e..751bd5dc2dd 100644 --- a/tests/ui/suggestions/issue-84592.stderr +++ b/tests/ui/suggestions/issue-84592.stderr @@ -9,8 +9,9 @@ LL | fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> { = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b` help: consider introducing a named lifetime parameter | -LL | fn two_lifetimes_needed<'a>(a: &'a (), b: &'a ()) -> TwoLifetimes<'a, 'a> { - | ++++ ++ ++ ~~ ~~ +LL - fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> { +LL + fn two_lifetimes_needed<'a>(a: &'a (), b: &'a ()) -> TwoLifetimes<'a, 'a> { + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-84700.stderr b/tests/ui/suggestions/issue-84700.stderr index d0705582660..e68b6fb5447 100644 --- a/tests/ui/suggestions/issue-84700.stderr +++ b/tests/ui/suggestions/issue-84700.stderr @@ -15,8 +15,9 @@ LL | FarmAnimal::Chicken(_) => "cluck, cluck!".to_string(), | help: the struct variant's field is being ignored | -LL | FarmAnimal::Chicken { num_eggs: _ } => "cluck, cluck!".to_string(), - | ~~~~~~~~~~~~~~~ +LL - FarmAnimal::Chicken(_) => "cluck, cluck!".to_string(), +LL + FarmAnimal::Chicken { num_eggs: _ } => "cluck, cluck!".to_string(), + | error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/issue-89064.stderr b/tests/ui/suggestions/issue-89064.stderr index 837fef60d1e..457cd7982aa 100644 --- a/tests/ui/suggestions/issue-89064.stderr +++ b/tests/ui/suggestions/issue-89064.stderr @@ -64,8 +64,9 @@ LL | let _ = 42.into::<Option<_>>(); | help: consider moving this generic argument to the `Into` trait, which takes up to 1 argument | -LL | let _ = Into::<Option<_>>::into(42); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = 42.into::<Option<_>>(); +LL + let _ = Into::<Option<_>>::into(42); + | help: remove the unnecessary generics | LL - let _ = 42.into::<Option<_>>(); diff --git a/tests/ui/suggestions/issue-89640.stderr b/tests/ui/suggestions/issue-89640.stderr index 3252cd6bba4..e23b8eada9c 100644 --- a/tests/ui/suggestions/issue-89640.stderr +++ b/tests/ui/suggestions/issue-89640.stderr @@ -6,8 +6,9 @@ LL | le t x: i32 = 3; | help: consider removing the space to spell keyword `let` | -LL | let x: i32 = 3; - | ~~~ +LL - le t x: i32 = 3; +LL + let x: i32 = 3; + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-90974.stderr b/tests/ui/suggestions/issue-90974.stderr index 1a732ecaf94..114024789fb 100644 --- a/tests/ui/suggestions/issue-90974.stderr +++ b/tests/ui/suggestions/issue-90974.stderr @@ -6,8 +6,9 @@ LL | println!("{}", (3.).recip()); | help: you must specify a concrete type for this numeric value, like `f32` | -LL | println!("{}", (3_f32).recip()); - | ~~~~~ +LL - println!("{}", (3.).recip()); +LL + println!("{}", (3_f32).recip()); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-94171.stderr b/tests/ui/suggestions/issue-94171.stderr index 3d73ee1d27a..bcbd46cd8ec 100644 --- a/tests/ui/suggestions/issue-94171.stderr +++ b/tests/ui/suggestions/issue-94171.stderr @@ -6,8 +6,9 @@ LL | (; {` | help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not | -LL | (; {' - | ~ +LL - (; {` +LL + (; {' + | error: mismatched closing delimiter: `]` --> $DIR/issue-94171.rs:1:5 diff --git a/tests/ui/suggestions/issue-98500.stderr b/tests/ui/suggestions/issue-98500.stderr index 97b712acfcb..ec984c0d60e 100644 --- a/tests/ui/suggestions/issue-98500.stderr +++ b/tests/ui/suggestions/issue-98500.stderr @@ -5,7 +5,7 @@ LL | struct S(Box<dyn B>); | ^^^^^ `B` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/auxiliary/dyn-incompatible.rs:4:8 | LL | fn f(); diff --git a/tests/ui/suggestions/js-style-comparison-op.stderr b/tests/ui/suggestions/js-style-comparison-op.stderr index 58b1fddd3dd..f63ce8a8345 100644 --- a/tests/ui/suggestions/js-style-comparison-op.stderr +++ b/tests/ui/suggestions/js-style-comparison-op.stderr @@ -6,8 +6,9 @@ LL | if 1 === 1 { | help: `===` is not a valid comparison operator, use `==` | -LL | if 1 == 1 { - | ~~ +LL - if 1 === 1 { +LL + if 1 == 1 { + | error: invalid comparison operator `!==` --> $DIR/js-style-comparison-op.rs:5:17 @@ -17,8 +18,9 @@ LL | } else if 1 !== 1 { | help: `!==` is not a valid comparison operator, use `!=` | -LL | } else if 1 != 1 { - | ~~ +LL - } else if 1 !== 1 { +LL + } else if 1 != 1 { + | error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/let-binding-suggest-issue-133713.fixed b/tests/ui/suggestions/let-binding-suggest-issue-133713.fixed new file mode 100644 index 00000000000..9f9c1d1bc5a --- /dev/null +++ b/tests/ui/suggestions/let-binding-suggest-issue-133713.fixed @@ -0,0 +1,12 @@ +//@ run-rustfix +#![allow(dead_code)] + +fn demo1() { + let _last: u64 = 0; //~ ERROR expected value, found builtin type `u64` +} + +fn demo2() { + let _val: u64; //~ ERROR expected value, found builtin type `u64` +} + +fn main() {} diff --git a/tests/ui/suggestions/let-binding-suggest-issue-133713.rs b/tests/ui/suggestions/let-binding-suggest-issue-133713.rs new file mode 100644 index 00000000000..ae218237a8d --- /dev/null +++ b/tests/ui/suggestions/let-binding-suggest-issue-133713.rs @@ -0,0 +1,12 @@ +//@ run-rustfix +#![allow(dead_code)] + +fn demo1() { + let _last = u64 = 0; //~ ERROR expected value, found builtin type `u64` +} + +fn demo2() { + let _val = u64; //~ ERROR expected value, found builtin type `u64` +} + +fn main() {} diff --git a/tests/ui/suggestions/let-binding-suggest-issue-133713.stderr b/tests/ui/suggestions/let-binding-suggest-issue-133713.stderr new file mode 100644 index 00000000000..185ad9c928b --- /dev/null +++ b/tests/ui/suggestions/let-binding-suggest-issue-133713.stderr @@ -0,0 +1,27 @@ +error[E0423]: expected value, found builtin type `u64` + --> $DIR/let-binding-suggest-issue-133713.rs:5:17 + | +LL | let _last = u64 = 0; + | ^^^ + | +help: you might have meant to use `:` for type annotation + | +LL - let _last = u64 = 0; +LL + let _last: u64 = 0; + | + +error[E0423]: expected value, found builtin type `u64` + --> $DIR/let-binding-suggest-issue-133713.rs:9:16 + | +LL | let _val = u64; + | ^^^ + | +help: you might have meant to use `:` for type annotation + | +LL - let _val = u64; +LL + let _val: u64; + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0423`. diff --git a/tests/ui/suggestions/lifetimes/issue-105544.stderr b/tests/ui/suggestions/lifetimes/issue-105544.stderr index 553643c0c3f..526f7e36163 100644 --- a/tests/ui/suggestions/lifetimes/issue-105544.stderr +++ b/tests/ui/suggestions/lifetimes/issue-105544.stderr @@ -9,8 +9,9 @@ LL | (d, p) | help: consider adding an explicit lifetime bound | -LL | fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + 'a { - | ++++ ++++ ++ ~~ +LL - fn foo(d: impl Sized, p: &mut ()) -> impl Sized + '_ { +LL + fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + 'a { + | error[E0309]: the parameter type `impl Sized` may not live long enough --> $DIR/issue-105544.rs:15:5 @@ -37,8 +38,9 @@ LL | (d, p) | help: consider adding an explicit lifetime bound | -LL | fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + 'b { - | +++ ++++ ++ ~~ +LL - fn foo2<'a>(d: impl Sized + 'a, p: &mut ()) -> impl Sized + '_ { +LL + fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + 'b { + | error[E0311]: the parameter type `T` may not live long enough --> $DIR/issue-105544.rs:28:5 @@ -51,8 +53,9 @@ LL | (d, p) | help: consider adding an explicit lifetime bound | -LL | fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + 'a { - | +++ ++++ ++ ~~ +LL - fn bar<T : Sized>(d: T, p: & mut ()) -> impl Sized + '_ { +LL + fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + 'a { + | error[E0309]: the parameter type `T` may not live long enough --> $DIR/issue-105544.rs:36:5 @@ -79,8 +82,9 @@ LL | (d, p) | help: consider adding an explicit lifetime bound | -LL | fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + 'b { - | +++ ++++ ++ ~~ +LL - fn bar2<'a, T : Sized + 'a>(d: T, p: &mut ()) -> impl Sized + '_ { +LL + fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + 'b { + | error: aborting due to 6 previous errors diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index ea01dcd5020..b92719e8033 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -66,8 +66,9 @@ LL | | } | help: consider adding an explicit lifetime bound | -LL | fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + 'b - | +++ ++++ ++ ~~ +LL - fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ +LL + fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + 'b + | error[E0311]: the parameter type `G` may not live long enough --> $DIR/missing-lifetimes-in-signature.rs:61:9 @@ -82,8 +83,9 @@ LL | | } | help: consider adding an explicit lifetime bound | -LL | fn qux<'c, 'b, G: Get<T> + 'b + 'c, T>(g: G, dest: &'c mut T) -> impl FnOnce() + 'c { - | +++ ++++ ++ ~~ +LL - fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { +LL + fn qux<'c, 'b, G: Get<T> + 'b + 'c, T>(g: G, dest: &'c mut T) -> impl FnOnce() + 'c { + | error[E0311]: the parameter type `G` may not live long enough --> $DIR/missing-lifetimes-in-signature.rs:73:5 @@ -100,8 +102,9 @@ LL | | } | help: consider adding an explicit lifetime bound | -LL | fn bat<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + 'b + 'a - | +++ ++++ ++ ~~ +LL - fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a +LL + fn bat<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + 'b + 'a + | error[E0621]: explicit lifetime required in the type of `dest` --> $DIR/missing-lifetimes-in-signature.rs:73:5 diff --git a/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.stderr b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.stderr index 2f74a006b3b..c2d41f093f8 100644 --- a/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.stderr +++ b/tests/ui/suggestions/lifetimes/type-param-missing-lifetime.stderr @@ -44,8 +44,9 @@ LL | check_bound(arg, lt); | help: consider adding an explicit lifetime bound | -LL | async fn bar2<'c, 'b>(_dummy: &'a u8, arg: A, lt: Inv<'c>) where A: 'c { - | +++ ~~ +++++++++++ +LL - async fn bar2<'b>(_dummy: &'a u8, arg: A, lt: Inv<'_>) { +LL + async fn bar2<'c, 'b>(_dummy: &'a u8, arg: A, lt: Inv<'c>) where A: 'c { + | error[E0311]: the parameter type `A` may not live long enough --> $DIR/type-param-missing-lifetime.rs:47:9 @@ -58,8 +59,9 @@ LL | check_bound(self.0 .1, self.0 .0); | help: consider adding an explicit lifetime bound | -LL | impl<'a, A: 'a> MyTy<Elided<'a, A>> { - | +++ ++++ ~~ +LL - impl<A> MyTy<Elided<'_, A>> { +LL + impl<'a, A: 'a> MyTy<Elided<'a, A>> { + | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/missing-impl-trait-block-but-not-ascii.stderr b/tests/ui/suggestions/missing-impl-trait-block-but-not-ascii.stderr index 56cdc11b62e..96b57928ef6 100644 --- a/tests/ui/suggestions/missing-impl-trait-block-but-not-ascii.stderr +++ b/tests/ui/suggestions/missing-impl-trait-block-but-not-ascii.stderr @@ -6,8 +6,9 @@ LL | impl T for S; | help: Unicode character ';' (Fullwidth Semicolon) looks like ';' (Semicolon), but it is not | -LL | impl T for S; - | ~ +LL - impl T for S; +LL + impl T for S; + | error: expected `{}`, found `;` --> $DIR/missing-impl-trait-block-but-not-ascii.rs:8:13 diff --git a/tests/ui/suggestions/missing-lifetime-specifier.rs b/tests/ui/suggestions/missing-lifetime-specifier.rs index dd437fc0c0b..a957477897d 100644 --- a/tests/ui/suggestions/missing-lifetime-specifier.rs +++ b/tests/ui/suggestions/missing-lifetime-specifier.rs @@ -1,6 +1,5 @@ // The specific errors produced depend the thread-local implementation. // Run only on platforms with "fast" TLS. -//@ ignore-windows FIXME(#84933) //@ ignore-wasm globals are used instead of thread locals //@ ignore-emscripten globals are used instead of thread locals //@ ignore-android does not use #[thread_local] diff --git a/tests/ui/suggestions/missing-lifetime-specifier.stderr b/tests/ui/suggestions/missing-lifetime-specifier.stderr index e0b6bb872b5..1fdbf3b0c79 100644 --- a/tests/ui/suggestions/missing-lifetime-specifier.stderr +++ b/tests/ui/suggestions/missing-lifetime-specifier.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifiers - --> $DIR/missing-lifetime-specifier.rs:28:44 + --> $DIR/missing-lifetime-specifier.rs:27:44 | LL | static a: RefCell<HashMap<i32, Vec<Vec<Foo>>>> = RefCell::new(HashMap::new()); | ^^^ expected 2 lifetime parameters @@ -11,7 +11,7 @@ LL | static a: RefCell<HashMap<i32, Vec<Vec<Foo<'static, 'static>>>>> = RefC | ++++++++++++++++++ error[E0106]: missing lifetime specifiers - --> $DIR/missing-lifetime-specifier.rs:32:44 + --> $DIR/missing-lifetime-specifier.rs:31:44 | LL | static b: RefCell<HashMap<i32, Vec<Vec<&Bar>>>> = RefCell::new(HashMap::new()); | ^^^^ expected 2 lifetime parameters @@ -25,7 +25,7 @@ LL | static b: RefCell<HashMap<i32, Vec<Vec<&'static Bar<'static, 'static>>> | +++++++ ++++++++++++++++++ error[E0106]: missing lifetime specifiers - --> $DIR/missing-lifetime-specifier.rs:36:47 + --> $DIR/missing-lifetime-specifier.rs:35:47 | LL | static c: RefCell<HashMap<i32, Vec<Vec<Qux<i32>>>>> = RefCell::new(HashMap::new()); | ^ expected 2 lifetime parameters @@ -37,7 +37,7 @@ LL | static c: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = | +++++++++++++++++ error[E0106]: missing lifetime specifiers - --> $DIR/missing-lifetime-specifier.rs:40:44 + --> $DIR/missing-lifetime-specifier.rs:39:44 | LL | static d: RefCell<HashMap<i32, Vec<Vec<&Tar<i32>>>>> = RefCell::new(HashMap::new()); | ^ ^ expected 2 lifetime parameters @@ -51,7 +51,7 @@ LL | static d: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, 'static, i | +++++++ +++++++++++++++++ error[E0106]: missing lifetime specifier - --> $DIR/missing-lifetime-specifier.rs:49:44 + --> $DIR/missing-lifetime-specifier.rs:48:44 | LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); | ^ expected named lifetime parameter @@ -63,7 +63,7 @@ LL | static f: RefCell<HashMap<i32, Vec<Vec<&'static Tar<'static, i32>>>>> = | +++++++ error[E0107]: union takes 2 lifetime arguments but 1 lifetime argument was supplied - --> $DIR/missing-lifetime-specifier.rs:45:44 + --> $DIR/missing-lifetime-specifier.rs:44:44 | LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell::new(HashMap::new()); | ^^^ ------- supplied 1 lifetime argument @@ -71,7 +71,7 @@ LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, i32>>>>> = RefCell: | expected 2 lifetime arguments | note: union defined here, with 2 lifetime parameters: `'t`, `'k` - --> $DIR/missing-lifetime-specifier.rs:21:11 + --> $DIR/missing-lifetime-specifier.rs:20:11 | LL | pub union Qux<'t, 'k, I> { | ^^^ -- -- @@ -81,7 +81,7 @@ LL | static e: RefCell<HashMap<i32, Vec<Vec<Qux<'static, 'static, i32>>>>> = | +++++++++ error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied - --> $DIR/missing-lifetime-specifier.rs:49:45 + --> $DIR/missing-lifetime-specifier.rs:48:45 | LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell::new(HashMap::new()); | ^^^ ------- supplied 1 lifetime argument @@ -89,7 +89,7 @@ LL | static f: RefCell<HashMap<i32, Vec<Vec<&Tar<'static, i32>>>>> = RefCell | expected 2 lifetime arguments | note: trait defined here, with 2 lifetime parameters: `'t`, `'k` - --> $DIR/missing-lifetime-specifier.rs:25:7 + --> $DIR/missing-lifetime-specifier.rs:24:7 | LL | trait Tar<'t, 'k, I> {} | ^^^ -- -- diff --git a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr index cc735ef4c5e..0819fa86a45 100644 --- a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr +++ b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr @@ -11,8 +11,9 @@ LL | fn bar(&self, _: T); | ^^^ help: consider moving this generic argument to the `Foo` trait, which takes up to 1 argument | -LL | Foo::<i32>::bar(1, 0); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - 1.bar::<i32>(0); +LL + Foo::<i32>::bar(1, 0); + | help: remove the unnecessary generics | LL - 1.bar::<i32>(0); diff --git a/tests/ui/suggestions/multibyte-escapes.stderr b/tests/ui/suggestions/multibyte-escapes.stderr index 1e7c43e6538..7208d2f5be8 100644 --- a/tests/ui/suggestions/multibyte-escapes.stderr +++ b/tests/ui/suggestions/multibyte-escapes.stderr @@ -6,8 +6,9 @@ LL | b'µ'; | help: if you meant to use the unicode code point for 'µ', use a \xHH escape | -LL | b'\xB5'; - | ~~~~ +LL - b'µ'; +LL + b'\xB5'; + | error: non-ASCII character in byte literal --> $DIR/multibyte-escapes.rs:9:7 @@ -26,8 +27,9 @@ LL | b"字"; | help: if you meant to use the UTF-8 encoding of '字', use \xHH escapes | -LL | b"\xE5\xAD\x97"; - | ~~~~~~~~~~~~ +LL - b"字"; +LL + b"\xE5\xAD\x97"; + | error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/nested-non-tuple-tuple-struct.stderr b/tests/ui/suggestions/nested-non-tuple-tuple-struct.stderr index 4523333850c..fd518f987f5 100644 --- a/tests/ui/suggestions/nested-non-tuple-tuple-struct.stderr +++ b/tests/ui/suggestions/nested-non-tuple-tuple-struct.stderr @@ -9,8 +9,9 @@ LL | let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 }); | help: `S` is a tuple struct, use the appropriate syntax | -LL | let _x = (S(/* f32 */, /* f32 */), S { x: 3.0, y: 4.0 }); - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 }); +LL + let _x = (S(/* f32 */, /* f32 */), S { x: 3.0, y: 4.0 }); + | error[E0560]: struct `S` has no field named `y` --> $DIR/nested-non-tuple-tuple-struct.rs:8:27 @@ -23,8 +24,9 @@ LL | let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 }); | help: `S` is a tuple struct, use the appropriate syntax | -LL | let _x = (S(/* f32 */, /* f32 */), S { x: 3.0, y: 4.0 }); - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 }); +LL + let _x = (S(/* f32 */, /* f32 */), S { x: 3.0, y: 4.0 }); + | error[E0560]: struct `S` has no field named `x` --> $DIR/nested-non-tuple-tuple-struct.rs:8:41 @@ -37,8 +39,9 @@ LL | let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 }); | help: `S` is a tuple struct, use the appropriate syntax | -LL | let _x = (S { x: 1.0, y: 2.0 }, S(/* f32 */, /* f32 */)); - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 }); +LL + let _x = (S { x: 1.0, y: 2.0 }, S(/* f32 */, /* f32 */)); + | error[E0560]: struct `S` has no field named `y` --> $DIR/nested-non-tuple-tuple-struct.rs:8:49 @@ -51,8 +54,9 @@ LL | let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 }); | help: `S` is a tuple struct, use the appropriate syntax | -LL | let _x = (S { x: 1.0, y: 2.0 }, S(/* f32 */, /* f32 */)); - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _x = (S { x: 1.0, y: 2.0 }, S { x: 3.0, y: 4.0 }); +LL + let _x = (S { x: 1.0, y: 2.0 }, S(/* f32 */, /* f32 */)); + | error[E0559]: variant `E::V` has no field named `x` --> $DIR/nested-non-tuple-tuple-struct.rs:13:22 @@ -65,8 +69,9 @@ LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 }); | help: `E::V` is a tuple variant, use the appropriate syntax | -LL | let _y = (E::V(/* f32 */, /* f32 */), E::V { x: 3.0, y: 4.0 }); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 }); +LL + let _y = (E::V(/* f32 */, /* f32 */), E::V { x: 3.0, y: 4.0 }); + | error[E0559]: variant `E::V` has no field named `y` --> $DIR/nested-non-tuple-tuple-struct.rs:13:30 @@ -79,8 +84,9 @@ LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 }); | help: `E::V` is a tuple variant, use the appropriate syntax | -LL | let _y = (E::V(/* f32 */, /* f32 */), E::V { x: 3.0, y: 4.0 }); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 }); +LL + let _y = (E::V(/* f32 */, /* f32 */), E::V { x: 3.0, y: 4.0 }); + | error[E0559]: variant `E::V` has no field named `x` --> $DIR/nested-non-tuple-tuple-struct.rs:13:47 @@ -93,8 +99,9 @@ LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 }); | help: `E::V` is a tuple variant, use the appropriate syntax | -LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V(/* f32 */, /* f32 */)); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 }); +LL + let _y = (E::V { x: 1.0, y: 2.0 }, E::V(/* f32 */, /* f32 */)); + | error[E0559]: variant `E::V` has no field named `y` --> $DIR/nested-non-tuple-tuple-struct.rs:13:55 @@ -107,8 +114,9 @@ LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 }); | help: `E::V` is a tuple variant, use the appropriate syntax | -LL | let _y = (E::V { x: 1.0, y: 2.0 }, E::V(/* f32 */, /* f32 */)); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - let _y = (E::V { x: 1.0, y: 2.0 }, E::V { x: 3.0, y: 4.0 }); +LL + let _y = (E::V { x: 1.0, y: 2.0 }, E::V(/* f32 */, /* f32 */)); + | error: aborting due to 8 previous errors diff --git a/tests/ui/suggestions/parenthesized-deref-suggestion.stderr b/tests/ui/suggestions/parenthesized-deref-suggestion.stderr index 29e973b3a17..71ee56dfc81 100644 --- a/tests/ui/suggestions/parenthesized-deref-suggestion.stderr +++ b/tests/ui/suggestions/parenthesized-deref-suggestion.stderr @@ -17,8 +17,9 @@ LL | (x as [u32; 1]).0; | help: instead of using tuple indexing, use array indexing | -LL | (x as [u32; 1])[0]; - | ~ + +LL - (x as [u32; 1]).0; +LL + (x as [u32; 1])[0]; + | error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/partialeq_suggest_swap.stderr b/tests/ui/suggestions/partialeq_suggest_swap.stderr index 2cadc5a16d5..dc1748b7ad5 100644 --- a/tests/ui/suggestions/partialeq_suggest_swap.stderr +++ b/tests/ui/suggestions/partialeq_suggest_swap.stderr @@ -9,8 +9,9 @@ LL | 4i32 == T(4); = note: `T` implements `PartialEq<i32>` help: consider swapping the equality | -LL | T(4) == 4i32; - | ~~~~ ~~~~ +LL - 4i32 == T(4); +LL + T(4) == 4i32; + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/range-index-instead-of-colon.stderr b/tests/ui/suggestions/range-index-instead-of-colon.stderr index df29356cc16..a3264fc2359 100644 --- a/tests/ui/suggestions/range-index-instead-of-colon.stderr +++ b/tests/ui/suggestions/range-index-instead-of-colon.stderr @@ -6,8 +6,9 @@ LL | &[1, 2, 3][1:2]; | help: you might have meant a range expression | -LL | &[1, 2, 3][1..2]; - | ~~ +LL - &[1, 2, 3][1:2]; +LL + &[1, 2, 3][1..2]; + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/raw-byte-string-prefix.stderr b/tests/ui/suggestions/raw-byte-string-prefix.stderr index 4f5106849d5..20f255c2b39 100644 --- a/tests/ui/suggestions/raw-byte-string-prefix.stderr +++ b/tests/ui/suggestions/raw-byte-string-prefix.stderr @@ -7,8 +7,9 @@ LL | rb"abc"; = note: prefixed identifiers and literals are reserved since Rust 2021 help: use `br` for a raw byte string | -LL | br"abc"; - | ~~ +LL - rb"abc"; +LL + br"abc"; + | error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"abc"` --> $DIR/raw-byte-string-prefix.rs:6:7 diff --git a/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr b/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr index dde6060c433..d43d1f9bb7e 100644 --- a/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr +++ b/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr @@ -17,8 +17,9 @@ LL | let _ = vec![1, 2, 3].into_iter().collect::Vec<_>>>>(); | help: surround the type parameters with angle brackets | -LL | let _ = vec![1, 2, 3].into_iter().collect::<Vec<_>>(); - | + ~ +LL - let _ = vec![1, 2, 3].into_iter().collect::Vec<_>>>>(); +LL + let _ = vec![1, 2, 3].into_iter().collect::<Vec<_>>(); + | error: generic parameters without surrounding angle brackets --> $DIR/recover-missing-turbofish-surrounding-angle-braket.rs:6:48 @@ -28,8 +29,9 @@ LL | let _ = vec![1, 2, 3].into_iter().collect::Vec<_>>>(); | help: surround the type parameters with angle brackets | -LL | let _ = vec![1, 2, 3].into_iter().collect::<Vec<_>>(); - | + ~ +LL - let _ = vec![1, 2, 3].into_iter().collect::Vec<_>>>(); +LL + let _ = vec![1, 2, 3].into_iter().collect::<Vec<_>>(); + | error: generic parameters without surrounding angle brackets --> $DIR/recover-missing-turbofish-surrounding-angle-braket.rs:8:48 diff --git a/tests/ui/suggestions/shadowed-lplace-method-2.stderr b/tests/ui/suggestions/shadowed-lplace-method-2.stderr index 088da83f589..09815306d22 100644 --- a/tests/ui/suggestions/shadowed-lplace-method-2.stderr +++ b/tests/ui/suggestions/shadowed-lplace-method-2.stderr @@ -13,8 +13,9 @@ LL | *x.foo(0) = (); | ^^^ refers to `X::foo` help: you might have meant to call the other method; you can use the fully-qualified path to call it explicitly | -LL | *<_ as A>::foo(&mut x, 0) = (); - | ++++++++++++++++++ ~ +LL - *x.foo(0) = (); +LL + *<_ as A>::foo(&mut x, 0) = (); + | help: try wrapping the expression in `X` | LL | *x.foo(0) = X { x: () }; diff --git a/tests/ui/suggestions/shadowed-lplace-method.stderr b/tests/ui/suggestions/shadowed-lplace-method.stderr index 3e49716b031..aab9e442007 100644 --- a/tests/ui/suggestions/shadowed-lplace-method.stderr +++ b/tests/ui/suggestions/shadowed-lplace-method.stderr @@ -18,8 +18,9 @@ LL | *rc.borrow_mut() = false; | ^^^^^^^^^^ refers to `std::borrow::BorrowMut::borrow_mut` help: you might have meant to call the other method; you can use the fully-qualified path to call it explicitly | -LL | *std::cell::RefCell::<_>::borrow_mut(&rc) = false; - | +++++++++++++++++++++++++++++++++++++ ~ +LL - *rc.borrow_mut() = false; +LL + *std::cell::RefCell::<_>::borrow_mut(&rc) = false; + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/silenced-binding-typo.stderr b/tests/ui/suggestions/silenced-binding-typo.stderr index a1e8b9e30d4..f1321b6d597 100644 --- a/tests/ui/suggestions/silenced-binding-typo.stderr +++ b/tests/ui/suggestions/silenced-binding-typo.stderr @@ -8,8 +8,9 @@ LL | let _y = x; | help: the leading underscore in `_x` marks it as unused, consider renaming it to `x` | -LL | let x = 42; - | ~ +LL - let _x = 42; +LL + let x = 42; + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/struct-field-type-including-single-colon.rs b/tests/ui/suggestions/struct-field-type-including-single-colon.rs index b7ad6d996f1..a3111028895 100644 --- a/tests/ui/suggestions/struct-field-type-including-single-colon.rs +++ b/tests/ui/suggestions/struct-field-type-including-single-colon.rs @@ -7,14 +7,14 @@ mod foo { struct Foo { a: foo:A, - //~^ ERROR found single colon in a struct field type path - //~| expected `,`, or `}`, found `:` + //~^ ERROR path separator must be a double colon + //~| ERROR struct `A` is private } struct Bar { b: foo::bar:B, - //~^ ERROR found single colon in a struct field type path - //~| expected `,`, or `}`, found `:` + //~^ ERROR path separator must be a double colon + //~| ERROR module `bar` is private } fn main() {} diff --git a/tests/ui/suggestions/struct-field-type-including-single-colon.stderr b/tests/ui/suggestions/struct-field-type-including-single-colon.stderr index 4dd514480da..ce16aca1e14 100644 --- a/tests/ui/suggestions/struct-field-type-including-single-colon.stderr +++ b/tests/ui/suggestions/struct-field-type-including-single-colon.stderr @@ -1,40 +1,53 @@ -error: found single colon in a struct field type path +error: path separator must be a double colon --> $DIR/struct-field-type-including-single-colon.rs:9:11 | LL | a: foo:A, | ^ | -help: write a path separator here + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> +help: use a double colon instead | LL | a: foo::A, - | ~~ + | + -error: expected `,`, or `}`, found `:` - --> $DIR/struct-field-type-including-single-colon.rs:9:11 - | -LL | struct Foo { - | --- while parsing this struct -LL | a: foo:A, - | ^ - -error: found single colon in a struct field type path +error: path separator must be a double colon --> $DIR/struct-field-type-including-single-colon.rs:15:16 | LL | b: foo::bar:B, | ^ | -help: write a path separator here + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> +help: use a double colon instead | LL | b: foo::bar::B, - | ~~ + | + -error: expected `,`, or `}`, found `:` - --> $DIR/struct-field-type-including-single-colon.rs:15:16 +error[E0603]: struct `A` is private + --> $DIR/struct-field-type-including-single-colon.rs:9:12 + | +LL | a: foo:A, + | ^ private struct + | +note: the struct `A` is defined here + --> $DIR/struct-field-type-including-single-colon.rs:2:5 + | +LL | struct A; + | ^^^^^^^^^ + +error[E0603]: module `bar` is private + --> $DIR/struct-field-type-including-single-colon.rs:15:13 | -LL | struct Bar { - | --- while parsing this struct LL | b: foo::bar:B, - | ^ + | ^^^ - struct `B` is not publicly re-exported + | | + | private module + | +note: the module `bar` is defined here + --> $DIR/struct-field-type-including-single-colon.rs:3:5 + | +LL | mod bar { + | ^^^^^^^ error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0603`. diff --git a/tests/ui/suggestions/suggest-blanket-impl-local-trait.stderr b/tests/ui/suggestions/suggest-blanket-impl-local-trait.stderr index 102438e1ec5..4fda1e49911 100644 --- a/tests/ui/suggestions/suggest-blanket-impl-local-trait.stderr +++ b/tests/ui/suggestions/suggest-blanket-impl-local-trait.stderr @@ -10,8 +10,9 @@ LL | impl LocalTraitOne for dyn fmt::Display {} | +++ help: alternatively use a blanket implementation to implement `LocalTraitOne` for all types that also implement `fmt::Display` | -LL | impl<T: fmt::Display> LocalTraitOne for T {} - | +++++++++++++++++ ~ +LL - impl LocalTraitOne for fmt::Display {} +LL + impl<T: fmt::Display> LocalTraitOne for T {} + | error[E0782]: expected a type, found a trait --> $DIR/suggest-blanket-impl-local-trait.rs:40:24 @@ -25,8 +26,9 @@ LL | impl LocalTraitOne for dyn fmt::Display + Send {} | +++ help: alternatively use a blanket implementation to implement `LocalTraitOne` for all types that also implement `fmt::Display + Send` | -LL | impl<T: fmt::Display + Send> LocalTraitOne for T {} - | ++++++++++++++++++++++++ ~ +LL - impl LocalTraitOne for fmt::Display + Send {} +LL + impl<T: fmt::Display + Send> LocalTraitOne for T {} + | error[E0782]: expected a type, found a trait --> $DIR/suggest-blanket-impl-local-trait.rs:13:24 @@ -40,8 +42,9 @@ LL | impl LocalTraitTwo for dyn LocalTraitOne {} | +++ help: alternatively use a blanket implementation to implement `LocalTraitTwo` for all types that also implement `LocalTraitOne` | -LL | impl<T: LocalTraitOne> LocalTraitTwo for T {} - | ++++++++++++++++++ ~ +LL - impl LocalTraitTwo for LocalTraitOne {} +LL + impl<T: LocalTraitOne> LocalTraitTwo for T {} + | error[E0782]: expected a type, found a trait --> $DIR/suggest-blanket-impl-local-trait.rs:46:29 @@ -55,8 +58,9 @@ LL | impl<E> GenericTrait<E> for dyn LocalTraitOne {} | +++ help: alternatively use a blanket implementation to implement `GenericTrait<E>` for all types that also implement `LocalTraitOne` | -LL | impl<E, T: LocalTraitOne> GenericTrait<E> for T {} - | ++++++++++++++++++ ~ +LL - impl<E> GenericTrait<E> for LocalTraitOne {} +LL + impl<E, T: LocalTraitOne> GenericTrait<E> for T {} + | error[E0782]: expected a type, found a trait --> $DIR/suggest-blanket-impl-local-trait.rs:18:23 @@ -92,8 +96,9 @@ LL | impl<T, E> GenericTraitTwo<E> for dyn GenericTrait<T> {} | +++ help: alternatively use a blanket implementation to implement `GenericTraitTwo<E>` for all types that also implement `GenericTrait<T>` | -LL | impl<T, E, U: GenericTrait<T>> GenericTraitTwo<E> for U {} - | ++++++++++++++++++++ ~ +LL - impl<T, E> GenericTraitTwo<E> for GenericTrait<T> {} +LL + impl<T, E, U: GenericTrait<T>> GenericTraitTwo<E> for U {} + | error: aborting due to 7 previous errors diff --git a/tests/ui/suggestions/suggest-change-mut.stderr b/tests/ui/suggestions/suggest-change-mut.stderr index 216d1e810fd..c47ae433ab8 100644 --- a/tests/ui/suggestions/suggest-change-mut.stderr +++ b/tests/ui/suggestions/suggest-change-mut.stderr @@ -20,7 +20,7 @@ LL | fn issue_81421<T: Read + Write>(mut stream: T) where &T: std::io::Read { help: consider changing this borrow's mutability | LL | let mut stream_reader = BufReader::new(&mut stream); - | ~~~~ + | +++ error[E0599]: the method `read_until` exists for struct `BufReader<&T>`, but its trait bounds were not satisfied --> $DIR/suggest-change-mut.rs:16:23 diff --git a/tests/ui/suggestions/suggest-closure-return-type-1.stderr b/tests/ui/suggestions/suggest-closure-return-type-1.stderr index be473d3cfa2..146bf69a8bd 100644 --- a/tests/ui/suggestions/suggest-closure-return-type-1.stderr +++ b/tests/ui/suggestions/suggest-closure-return-type-1.stderr @@ -6,8 +6,9 @@ LL | unbound_drop(|| -> _ { [] }); | help: try giving this closure an explicit return type | -LL | unbound_drop(|| -> [_; 0] { [] }); - | ~~~~~~ +LL - unbound_drop(|| -> _ { [] }); +LL + unbound_drop(|| -> [_; 0] { [] }); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr index 9338ef19089..2061b3f122a 100644 --- a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr +++ b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr @@ -12,7 +12,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:9:9 @@ -28,7 +28,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:16:9 @@ -43,8 +43,9 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL | match &*x { - | ~~~ +LL - match &x { +LL + match &*x { + | error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:18:9 @@ -59,8 +60,9 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL | match &*x { - | ~~~ +LL - match &x { +LL + match &*x { + | error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:26:9 @@ -76,7 +78,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match *y { - | ~~ + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:28:9 @@ -92,7 +94,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match *y { - | ~~ + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:36:9 @@ -107,8 +109,9 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL | match *(z as Arc<Option<i32>>) { - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - match z as Arc<Option<i32>> { +LL + match *(z as Arc<Option<i32>>) { + | error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:38:9 @@ -123,8 +126,9 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL | match *(z as Arc<Option<i32>>) { - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - match z as Arc<Option<i32>> { +LL + match *(z as Arc<Option<i32>>) { + | error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:46:9 @@ -140,7 +144,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_const { - | ~~~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:48:9 @@ -156,7 +160,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_const { - | ~~~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:57:9 @@ -172,7 +176,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_mut { - | ~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:59:9 @@ -188,7 +192,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_mut { - | ~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:68:9 @@ -204,7 +208,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**y_mut { - | ~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:70:9 @@ -220,7 +224,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**y_mut { - | ~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:79:9 @@ -235,8 +239,9 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL | match &*difficult { - | ~~~~~~~~~~~ +LL - match (& (&difficult) ) { +LL + match &*difficult { + | error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:81:9 @@ -251,8 +256,9 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL | match &*difficult { - | ~~~~~~~~~~~ +LL - match (& (&difficult) ) { +LL + match &*difficult { + | error: aborting due to 16 previous errors diff --git a/tests/ui/suggestions/suggest-field-through-deref.stderr b/tests/ui/suggestions/suggest-field-through-deref.stderr index cc9fe2044c9..e3889781884 100644 --- a/tests/ui/suggestions/suggest-field-through-deref.stderr +++ b/tests/ui/suggestions/suggest-field-through-deref.stderr @@ -6,8 +6,9 @@ LL | let _ = x.longname; | help: a field with a similar name exists | -LL | let _ = x.long_name; - | ~~~~~~~~~ +LL - let _ = x.longname; +LL + let _ = x.long_name; + | error[E0609]: no field `longname` on type `S` --> $DIR/suggest-field-through-deref.rs:12:15 @@ -17,8 +18,9 @@ LL | let _ = y.longname; | help: a field with a similar name exists | -LL | let _ = y.long_name; - | ~~~~~~~~~ +LL - let _ = y.longname; +LL + let _ = y.long_name; + | error[E0609]: no field `longname` on type `Option<Arc<S>>` --> $DIR/suggest-field-through-deref.rs:14:15 @@ -28,8 +30,9 @@ LL | let _ = a.longname; | help: a field with a similar name exists | -LL | let _ = a.unwrap().long_name; - | ~~~~~~~~~~~~~~~~~~ +LL - let _ = a.longname; +LL + let _ = a.unwrap().long_name; + | error[E0609]: no field `long_name` on type `Option<S>` --> $DIR/suggest-field-through-deref.rs:16:15 @@ -50,8 +53,9 @@ LL | let _ = c.longname; | help: a field with a similar name exists | -LL | let _ = c.unwrap().long_name; - | ~~~~~~~~~~~~~~~~~~ +LL - let _ = c.longname; +LL + let _ = c.unwrap().long_name; + | error[E0609]: no field `long_name` on type `Result<S, ()>` --> $DIR/suggest-field-through-deref.rs:20:15 diff --git a/tests/ui/suggestions/suggest-let-and-typo-issue-132483.stderr b/tests/ui/suggestions/suggest-let-and-typo-issue-132483.stderr index c84f9363f03..57983a07bf5 100644 --- a/tests/ui/suggestions/suggest-let-and-typo-issue-132483.stderr +++ b/tests/ui/suggestions/suggest-let-and-typo-issue-132483.stderr @@ -6,8 +6,9 @@ LL | x2 = 1; | help: a local variable with a similar name exists | -LL | x1 = 1; - | ~~ +LL - x2 = 1; +LL + x1 = 1; + | help: you might have meant to introduce a new binding | LL | let x2 = 1; diff --git a/tests/ui/suggestions/suggest-let-for-assignment.stderr b/tests/ui/suggestions/suggest-let-for-assignment.stderr index 8d97dbeb14a..9dc859dbe0e 100644 --- a/tests/ui/suggestions/suggest-let-for-assignment.stderr +++ b/tests/ui/suggestions/suggest-let-for-assignment.stderr @@ -40,8 +40,9 @@ LL | let_some_variable = 6; | help: you might have meant to introduce a new binding | -LL | let some_variable = 6; - | ~~~~~~~~~~~~~~~~~ +LL - let_some_variable = 6; +LL + let some_variable = 6; + | error[E0425]: cannot find value `some_variable` in this scope --> $DIR/suggest-let-for-assignment.rs:11:35 @@ -57,8 +58,9 @@ LL | letother_variable = 6; | help: you might have meant to introduce a new binding | -LL | let other_variable = 6; - | ~~~~~~~~~~~~~~~~~~ +LL - letother_variable = 6; +LL + let other_variable = 6; + | error[E0425]: cannot find value `other_variable` in this scope --> $DIR/suggest-let-for-assignment.rs:14:36 diff --git a/tests/ui/suggestions/suggest-methods.stderr b/tests/ui/suggestions/suggest-methods.stderr index 5bacad8c6e8..b6925a4c626 100644 --- a/tests/ui/suggestions/suggest-methods.stderr +++ b/tests/ui/suggestions/suggest-methods.stderr @@ -21,8 +21,9 @@ LL | let _ = s.is_emtpy(); | help: there is a method `is_empty` with a similar name | -LL | let _ = s.is_empty(); - | ~~~~~~~~ +LL - let _ = s.is_emtpy(); +LL + let _ = s.is_empty(); + | error[E0599]: no method named `count_eos` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:27:19 @@ -32,8 +33,9 @@ LL | let _ = 63u32.count_eos(); | help: there is a method `count_zeros` with a similar name | -LL | let _ = 63u32.count_zeros(); - | ~~~~~~~~~~~ +LL - let _ = 63u32.count_eos(); +LL + let _ = 63u32.count_zeros(); + | error[E0599]: no method named `count_o` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:30:19 @@ -44,7 +46,7 @@ LL | let _ = 63u32.count_o(); help: there is a method `count_ones` with a similar name | LL | let _ = 63u32.count_ones(); - | ~~~~~~~~~~ + | +++ error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-move-types.stderr b/tests/ui/suggestions/suggest-move-types.stderr index b222e8142ba..397e8ad29c6 100644 --- a/tests/ui/suggestions/suggest-move-types.stderr +++ b/tests/ui/suggestions/suggest-move-types.stderr @@ -8,8 +8,9 @@ LL | struct A<T, M: One<A=(), T>> { | help: move the constraint after the generic argument | -LL | struct A<T, M: One<T, A = ()>> { - | ~~~~~~~~~~~ +LL - struct A<T, M: One<A=(), T>> { +LL + struct A<T, M: One<T, A = ()>> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:33:43 @@ -21,8 +22,9 @@ LL | struct Al<'a, T, M: OneWithLifetime<A=(), T, 'a>> { | help: move the constraint after the generic arguments | -LL | struct Al<'a, T, M: OneWithLifetime<'a, T, A = ()>> { - | ~~~~~~~~~~~~~~~ +LL - struct Al<'a, T, M: OneWithLifetime<A=(), T, 'a>> { +LL + struct Al<'a, T, M: OneWithLifetime<'a, T, A = ()>> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:40:46 @@ -34,8 +36,9 @@ LL | struct B<T, U, V, M: Three<A=(), B=(), C=(), T, U, V>> { | help: move the constraints after the generic arguments | -LL | struct B<T, U, V, M: Three<T, U, V, A = (), B = (), C = ()>> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct B<T, U, V, M: Three<A=(), B=(), C=(), T, U, V>> { +LL + struct B<T, U, V, M: Three<T, U, V, A = (), B = (), C = ()>> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:48:71 @@ -47,8 +50,9 @@ LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<A=(), B=(), C=(), T, U, | help: move the constraints after the generic arguments | -LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A = (), B = (), C = ()>> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<A=(), B=(), C=(), T, U, V, 'a, 'b, 'c>> { +LL + struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A = (), B = (), C = ()>> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:57:28 @@ -60,8 +64,9 @@ LL | struct C<T, U, V, M: Three<T, A=(), B=(), C=(), U, V>> { | help: move the constraints after the generic arguments | -LL | struct C<T, U, V, M: Three<T, U, V, A = (), B = (), C = ()>> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct C<T, U, V, M: Three<T, A=(), B=(), C=(), U, V>> { +LL + struct C<T, U, V, M: Three<T, U, V, A = (), B = (), C = ()>> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:65:53 @@ -73,8 +78,9 @@ LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), C=() | help: move the constraints after the generic arguments | -LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A = (), B = (), C = ()>> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), C=(), U, 'b, V, 'c>> { +LL + struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A = (), B = (), C = ()>> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:74:28 @@ -86,8 +92,9 @@ LL | struct D<T, U, V, M: Three<T, A=(), B=(), U, C=(), V>> { | help: move the constraints after the generic arguments | -LL | struct D<T, U, V, M: Three<T, U, V, A = (), B = (), C = ()>> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct D<T, U, V, M: Three<T, A=(), B=(), U, C=(), V>> { +LL + struct D<T, U, V, M: Three<T, U, V, A = (), B = (), C = ()>> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:82:53 @@ -99,8 +106,9 @@ LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), U, ' | help: move the constraints after the generic arguments | -LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A = (), B = (), C = ()>> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), U, 'b, C=(), V, 'c>> { +LL + struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A = (), B = (), C = ()>> { + | error[E0747]: type provided when a lifetime was expected --> $DIR/suggest-move-types.rs:33:43 diff --git a/tests/ui/suggestions/suggest-null-ptr.stderr b/tests/ui/suggestions/suggest-null-ptr.stderr index 66a79d0749e..5be33d47237 100644 --- a/tests/ui/suggestions/suggest-null-ptr.stderr +++ b/tests/ui/suggestions/suggest-null-ptr.stderr @@ -12,11 +12,12 @@ note: function defined here --> $DIR/suggest-null-ptr.rs:7:8 | LL | fn foo(ptr: *const u8); - | ^^^ + | ^^^ --- help: if you meant to create a null pointer, use `std::ptr::null()` | -LL | foo(std::ptr::null()); - | ~~~~~~~~~~~~~~~~ +LL - foo(0); +LL + foo(std::ptr::null()); + | error[E0308]: mismatched types --> $DIR/suggest-null-ptr.rs:21:17 @@ -32,11 +33,12 @@ note: function defined here --> $DIR/suggest-null-ptr.rs:9:8 | LL | fn foo_mut(ptr: *mut u8); - | ^^^^^^^ + | ^^^^^^^ --- help: if you meant to create a null pointer, use `std::ptr::null_mut()` | -LL | foo_mut(std::ptr::null_mut()); - | ~~~~~~~~~~~~~~~~~~~~ +LL - foo_mut(0); +LL + foo_mut(std::ptr::null_mut()); + | error[E0308]: mismatched types --> $DIR/suggest-null-ptr.rs:24:15 @@ -52,11 +54,12 @@ note: function defined here --> $DIR/suggest-null-ptr.rs:11:8 | LL | fn usize(ptr: *const usize); - | ^^^^^ + | ^^^^^ --- help: if you meant to create a null pointer, use `std::ptr::null()` | -LL | usize(std::ptr::null()); - | ~~~~~~~~~~~~~~~~ +LL - usize(0); +LL + usize(std::ptr::null()); + | error[E0308]: mismatched types --> $DIR/suggest-null-ptr.rs:27:19 @@ -72,11 +75,12 @@ note: function defined here --> $DIR/suggest-null-ptr.rs:13:8 | LL | fn usize_mut(ptr: *mut usize); - | ^^^^^^^^^ + | ^^^^^^^^^ --- help: if you meant to create a null pointer, use `std::ptr::null_mut()` | -LL | usize_mut(std::ptr::null_mut()); - | ~~~~~~~~~~~~~~~~~~~~ +LL - usize_mut(0); +LL + usize_mut(std::ptr::null_mut()); + | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-slice-swap.stderr b/tests/ui/suggestions/suggest-slice-swap.stderr index 2840fc0a761..95b547aad5d 100644 --- a/tests/ui/suggestions/suggest-slice-swap.stderr +++ b/tests/ui/suggestions/suggest-slice-swap.stderr @@ -9,8 +9,9 @@ LL | std::mem::swap(&mut arr[0], &mut arr[1]); | help: use `.swap()` to swap elements at the specified indices instead | -LL | arr.swap(1, 0); - | ~~~~~~~~~~~~~~ +LL - std::mem::swap(&mut arr[0], &mut arr[1]); +LL + arr.swap(1, 0); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-std-when-using-type.fixed b/tests/ui/suggestions/suggest-std-when-using-type.fixed index ebbb854175b..0547940f94d 100644 --- a/tests/ui/suggestions/suggest-std-when-using-type.fixed +++ b/tests/ui/suggestions/suggest-std-when-using-type.fixed @@ -1,8 +1,5 @@ //@ run-rustfix fn main() { let pi = std::f32::consts::PI; //~ ERROR ambiguous associated type - let bytes = "hello world".as_bytes(); - let string = std::str::from_utf8(bytes).unwrap(); - //~^ ERROR no function or associated item named `from_utf8` found - println!("{pi} {bytes:?} {string}"); + println!("{pi}"); } diff --git a/tests/ui/suggestions/suggest-std-when-using-type.rs b/tests/ui/suggestions/suggest-std-when-using-type.rs index 06aab63d688..cd55c5d13bd 100644 --- a/tests/ui/suggestions/suggest-std-when-using-type.rs +++ b/tests/ui/suggestions/suggest-std-when-using-type.rs @@ -1,8 +1,5 @@ //@ run-rustfix fn main() { let pi = f32::consts::PI; //~ ERROR ambiguous associated type - let bytes = "hello world".as_bytes(); - let string = str::from_utf8(bytes).unwrap(); - //~^ ERROR no function or associated item named `from_utf8` found - println!("{pi} {bytes:?} {string}"); + println!("{pi}"); } diff --git a/tests/ui/suggestions/suggest-std-when-using-type.stderr b/tests/ui/suggestions/suggest-std-when-using-type.stderr index 6f890b87b24..7f8545f461d 100644 --- a/tests/ui/suggestions/suggest-std-when-using-type.stderr +++ b/tests/ui/suggestions/suggest-std-when-using-type.stderr @@ -9,18 +9,6 @@ help: you are looking for the module in `std`, not the primitive type LL | let pi = std::f32::consts::PI; | +++++ -error[E0599]: no function or associated item named `from_utf8` found for type `str` in the current scope - --> $DIR/suggest-std-when-using-type.rs:5:23 - | -LL | let string = str::from_utf8(bytes).unwrap(); - | ^^^^^^^^^ function or associated item not found in `str` - | -help: you are looking for the module in `std`, not the primitive type - | -LL | let string = std::str::from_utf8(bytes).unwrap(); - | +++++ - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0223, E0599. -For more information about an error, try `rustc --explain E0223`. +For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr index 0bd601e2170..e73aba51847 100644 --- a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr +++ b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr @@ -6,8 +6,9 @@ LL | impl<'a, T> Struct<T> for Trait<'a, T> {} | help: `impl` items mention the trait being implemented first and the type it is being implemented for second | -LL | impl<'a, T> Trait<'a, T> for Struct<T> {} - | ~~~~~~~~~~~~ ~~~~~~~~~ +LL - impl<'a, T> Struct<T> for Trait<'a, T> {} +LL + impl<'a, T> Trait<'a, T> for Struct<T> {} + | error[E0404]: expected trait, found enum `Enum` --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:19:13 @@ -17,8 +18,9 @@ LL | impl<'a, T> Enum<T> for Trait<'a, T> {} | help: `impl` items mention the trait being implemented first and the type it is being implemented for second | -LL | impl<'a, T> Trait<'a, T> for Enum<T> {} - | ~~~~~~~~~~~~ ~~~~~~~ +LL - impl<'a, T> Enum<T> for Trait<'a, T> {} +LL + impl<'a, T> Trait<'a, T> for Enum<T> {} + | error[E0404]: expected trait, found union `Union` --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:23:13 @@ -28,8 +30,9 @@ LL | impl<'a, T> Union<T> for Trait<'a, T> {} | help: `impl` items mention the trait being implemented first and the type it is being implemented for second | -LL | impl<'a, T> Trait<'a, T> for Union<T> {} - | ~~~~~~~~~~~~ ~~~~~~~~ +LL - impl<'a, T> Union<T> for Trait<'a, T> {} +LL + impl<'a, T> Trait<'a, T> for Union<T> {} + | error[E0392]: type parameter `T` is never used --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:5:19 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 d1da9a89c19..929f893e34f 100644 --- a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr +++ b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr @@ -6,8 +6,9 @@ LL | impl<'a, T> Struct<T> for Trait<'a, T> {} | help: `impl` items mention the trait being implemented first and the type it is being implemented for second | -LL | impl<'a, T> Trait<'a, T> for Struct<T> {} - | ~~~~~~~~~~~~ ~~~~~~~~~ +LL - impl<'a, T> Struct<T> for Trait<'a, T> {} +LL + impl<'a, T> Trait<'a, T> for Struct<T> {} + | error[E0404]: expected trait, found enum `Enum` --> $DIR/suggest-swapping-self-ty-and-trait.rs:18:13 @@ -17,8 +18,9 @@ LL | impl<'a, T> Enum<T> for Trait<'a, T> {} | help: `impl` items mention the trait being implemented first and the type it is being implemented for second | -LL | impl<'a, T> Trait<'a, T> for Enum<T> {} - | ~~~~~~~~~~~~ ~~~~~~~ +LL - impl<'a, T> Enum<T> for Trait<'a, T> {} +LL + impl<'a, T> Trait<'a, T> for Enum<T> {} + | error[E0404]: expected trait, found union `Union` --> $DIR/suggest-swapping-self-ty-and-trait.rs:23:13 @@ -28,8 +30,9 @@ LL | impl<'a, T> Union<T> for Trait<'a, T> {} | help: `impl` items mention the trait being implemented first and the type it is being implemented for second | -LL | impl<'a, T> Trait<'a, T> for Union<T> {} - | ~~~~~~~~~~~~ ~~~~~~~~ +LL - impl<'a, T> Union<T> for Trait<'a, T> {} +LL + impl<'a, T> Trait<'a, T> for Union<T> {} + | error[E0392]: type parameter `T` is never used --> $DIR/suggest-swapping-self-ty-and-trait.rs:3:19 diff --git a/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr index cabaa76a886..fac93da9829 100644 --- a/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr +++ b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr @@ -6,10 +6,12 @@ LL | impl<S> Foo for Bar<S> where for<'a> <&'a S>::Item: Foo {} | help: use fully-qualified syntax | -LL | impl<S> Foo for Bar<S> where for<'a> <&'a S as IntoAsyncIterator>::Item: Foo {} - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | impl<S> Foo for Bar<S> where for<'a> <&'a S as IntoIterator>::Item: Foo {} - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - impl<S> Foo for Bar<S> where for<'a> <&'a S>::Item: Foo {} +LL + impl<S> Foo for Bar<S> where for<'a> <&'a S as IntoAsyncIterator>::Item: Foo {} + | +LL - impl<S> Foo for Bar<S> where for<'a> <&'a S>::Item: Foo {} +LL + impl<S> Foo for Bar<S> where for<'a> <&'a S as IntoIterator>::Item: Foo {} + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr index 5be55f75cd1..0008b4fb5ed 100644 --- a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr +++ b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr @@ -31,8 +31,9 @@ LL | let _v: Vec<_> = FromIterator::from_iter(&[1]); = note: 'std::iter::FromIterator' is included in the prelude starting in Edition 2021 help: a trait with a similar name exists | -LL | let _v: Vec<_> = IntoIterator::from_iter(&[1]); - | ~~~~~~~~~~~~ +LL - let _v: Vec<_> = FromIterator::from_iter(&[1]); +LL + let _v: Vec<_> = IntoIterator::from_iter(&[1]); + | help: consider importing this trait | LL + use std::iter::FromIterator; @@ -55,8 +56,9 @@ LL + use std::convert::TryInto; | help: there is a method `into` with a similar name | -LL | let _i: i16 = 0_i32.into().unwrap(); - | ~~~~ +LL - let _i: i16 = 0_i32.try_into().unwrap(); +LL + let _i: i16 = 0_i32.into().unwrap(); + | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-using-chars.stderr b/tests/ui/suggestions/suggest-using-chars.stderr index ba80ec6a201..a197223beb0 100644 --- a/tests/ui/suggestions/suggest-using-chars.stderr +++ b/tests/ui/suggestions/suggest-using-chars.stderr @@ -6,8 +6,9 @@ LL | let _ = "foo".iter(); | help: because of the in-memory representation of `&str`, to obtain an `Iterator` over each of its codepoint use method `chars` | -LL | let _ = "foo".chars(); - | ~~~~~ +LL - let _ = "foo".iter(); +LL + let _ = "foo".chars(); + | error[E0599]: no method named `foo` found for reference `&'static str` in the current scope --> $DIR/suggest-using-chars.rs:3:19 @@ -23,8 +24,9 @@ LL | let _ = String::from("bar").iter(); | help: because of the in-memory representation of `&str`, to obtain an `Iterator` over each of its codepoint use method `chars` | -LL | let _ = String::from("bar").chars(); - | ~~~~~ +LL - let _ = String::from("bar").iter(); +LL + let _ = String::from("bar").chars(); + | error[E0599]: no method named `iter` found for reference `&String` in the current scope --> $DIR/suggest-using-chars.rs:5:36 @@ -34,8 +36,9 @@ LL | let _ = (&String::from("bar")).iter(); | help: because of the in-memory representation of `&str`, to obtain an `Iterator` over each of its codepoint use method `chars` | -LL | let _ = (&String::from("bar")).chars(); - | ~~~~~ +LL - let _ = (&String::from("bar")).iter(); +LL + let _ = (&String::from("bar")).chars(); + | error[E0599]: no method named `iter` found for type `{integer}` in the current scope --> $DIR/suggest-using-chars.rs:6:15 diff --git a/tests/ui/suggestions/suggest-variants.stderr b/tests/ui/suggestions/suggest-variants.stderr index d93bf2d8cd7..50286a96875 100644 --- a/tests/ui/suggestions/suggest-variants.stderr +++ b/tests/ui/suggestions/suggest-variants.stderr @@ -9,8 +9,9 @@ LL | println!("My shape is {:?}", Shape::Squareee { size: 5}); | help: there is a variant with a similar name | -LL | println!("My shape is {:?}", Shape::Square { size: 5}); - | ~~~~~~ +LL - println!("My shape is {:?}", Shape::Squareee { size: 5}); +LL + println!("My shape is {:?}", Shape::Square { size: 5}); + | error[E0599]: no variant named `Circl` found for enum `Shape` --> $DIR/suggest-variants.rs:13:41 @@ -24,7 +25,7 @@ LL | println!("My shape is {:?}", Shape::Circl { size: 5}); help: there is a variant with a similar name | LL | println!("My shape is {:?}", Shape::Circle { size: 5}); - | ~~~~~~ + | + error[E0599]: no variant named `Rombus` found for enum `Shape` --> $DIR/suggest-variants.rs:14:41 @@ -46,8 +47,9 @@ LL | Shape::Squareee; | help: there is a variant with a similar name | -LL | Shape::Square { size: /* value */ }; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - Shape::Squareee; +LL + Shape::Square { size: /* value */ }; + | error[E0599]: no variant or associated item named `Circl` found for enum `Shape` in the current scope --> $DIR/suggest-variants.rs:16:12 @@ -61,7 +63,7 @@ LL | Shape::Circl; help: there is a variant with a similar name | LL | Shape::Circle { radius: /* value */ }; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ error[E0599]: no variant or associated item named `Rombus` found for enum `Shape` in the current scope --> $DIR/suggest-variants.rs:17:12 diff --git a/tests/ui/suggestions/suggest_print_over_printf.stderr b/tests/ui/suggestions/suggest_print_over_printf.stderr index 8a79745133c..48a50de0f7a 100644 --- a/tests/ui/suggestions/suggest_print_over_printf.stderr +++ b/tests/ui/suggestions/suggest_print_over_printf.stderr @@ -6,8 +6,9 @@ LL | printf("%d", x); | help: you may have meant to use the `print` macro | -LL | print!("%d", x); - | ~~~~~~ +LL - printf("%d", x); +LL + print!("%d", x); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr b/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr index 980c2455c8e..df59a28c4b9 100644 --- a/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr +++ b/tests/ui/suggestions/trait-with-missing-associated-type-restriction.stderr @@ -94,7 +94,7 @@ note: method defined here --> $DIR/trait-with-missing-associated-type-restriction.rs:9:8 | LL | fn funk(&self, _: Self::A); - | ^^^^ + | ^^^^ - help: consider constraining the associated type `<T as Trait<i32>>::A` to `{integer}` | LL | fn bar2<T: Trait<i32, A = {integer}>>(x: T) { diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr index ba0682cda32..0b37bf9a57b 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr @@ -8,7 +8,7 @@ LL | let _ = vec![Ok(2)].into_iter().collect:<Result<Vec<_>,_>>()?; help: maybe write a path separator here | LL | let _ = vec![Ok(2)].into_iter().collect::<Result<Vec<_>,_>>()?; - | ~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr index 56b6a69a283..a424bc7e724 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr @@ -7,7 +7,7 @@ LL | let _: Vec<A:B> = A::B; help: you might have meant to write a path instead of an associated type bound | LL | let _: Vec<A::B> = A::B; - | ~~ + | + error[E0107]: struct takes at least 1 generic argument but 0 generic arguments were supplied --> $DIR/type-ascription-instead-of-path-in-type.rs:6:12 diff --git a/tests/ui/suggestions/type-mismatch-byte-literal.stderr b/tests/ui/suggestions/type-mismatch-byte-literal.stderr index 3d27149f0dc..7211d77fdcb 100644 --- a/tests/ui/suggestions/type-mismatch-byte-literal.stderr +++ b/tests/ui/suggestions/type-mismatch-byte-literal.stderr @@ -9,7 +9,7 @@ LL | let _x: u8 = 'X'; help: if you meant to write a byte literal, prefix with `b` | LL | let _x: u8 = b'X'; - | ~~~~ + | + error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:11:9 @@ -27,7 +27,7 @@ LL | fn foo(_t: u8) {} help: if you meant to write a byte literal, prefix with `b` | LL | foo(b'#'); - | ~~~~ + | + error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:15:18 @@ -40,7 +40,7 @@ LL | let _a: u8 = '\x20'; help: if you meant to write a byte literal, prefix with `b` | LL | let _a: u8 = b'\x20'; - | ~~~~~~~ + | + error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:20:9 diff --git a/tests/ui/suggestions/type-mismatch-struct-field-shorthand-2.stderr b/tests/ui/suggestions/type-mismatch-struct-field-shorthand-2.stderr index fb3573ee2a4..e60de526945 100644 --- a/tests/ui/suggestions/type-mismatch-struct-field-shorthand-2.stderr +++ b/tests/ui/suggestions/type-mismatch-struct-field-shorthand-2.stderr @@ -28,8 +28,9 @@ LL | let _ = RGB { r, g, c }; | help: a field with a similar name exists | -LL | let _ = RGB { r, g, b }; - | ~ +LL - let _ = RGB { r, g, c }; +LL + let _ = RGB { r, g, b }; + | error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/unnamable-types.stderr b/tests/ui/suggestions/unnamable-types.stderr index dc236af91f8..bcd1a905194 100644 --- a/tests/ui/suggestions/unnamable-types.stderr +++ b/tests/ui/suggestions/unnamable-types.stderr @@ -12,8 +12,9 @@ LL | static B: _ = "abc"; | help: replace this with a fully-specified type | -LL | static B: &str = "abc"; - | ~~~~ +LL - static B: _ = "abc"; +LL + static B: &str = "abc"; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/unnamable-types.rs:17:10 diff --git a/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr b/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr index 8b48ee9f124..ade3f3099a3 100644 --- a/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr +++ b/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr @@ -10,8 +10,9 @@ LL | let _: f64 = 0..10; found struct `std::ops::Range<{integer}>` help: remove the unnecessary `.` operator for a floating point literal | -LL | let _: f64 = 0.10; - | ~ +LL - let _: f64 = 0..10; +LL + let _: f64 = 0.10; + | error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:3:18 @@ -22,11 +23,12 @@ LL | let _: f64 = 1..; | expected due to this | = note: expected type `f64` - found struct `RangeFrom<{integer}>` + found struct `std::ops::RangeFrom<{integer}>` help: remove the unnecessary `.` operator for a floating point literal | -LL | let _: f64 = 1.; - | ~ +LL - let _: f64 = 1..; +LL + let _: f64 = 1.; + | error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:4:18 @@ -40,8 +42,9 @@ LL | let _: f64 = ..10; found struct `RangeTo<{integer}>` help: remove the unnecessary `.` operator and add an integer part for a floating point literal | -LL | let _: f64 = 0.10; - | ~~ +LL - let _: f64 = ..10; +LL + let _: f64 = 0.10; + | error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:5:18 diff --git a/tests/ui/symbol-names/basic.legacy.stderr b/tests/ui/symbol-names/basic.legacy.stderr index 2f26c0cf0d3..167262dcf06 100644 --- a/tests/ui/symbol-names/basic.legacy.stderr +++ b/tests/ui/symbol-names/basic.legacy.stderr @@ -1,10 +1,10 @@ -error: symbol-name(_ZN5basic4main17h144191e1523a280eE) +error: symbol-name(_ZN5basic4main17hc88b9d80a69d119aE) --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(basic::main::h144191e1523a280e) +error: demangling(basic::main::hc88b9d80a69d119a) --> $DIR/basic.rs:8:1 | LL | #[rustc_symbol_name] diff --git a/tests/ui/symbol-names/issue-60925.legacy.stderr b/tests/ui/symbol-names/issue-60925.legacy.stderr index cc79cc8b516..4e17bdc4577 100644 --- a/tests/ui/symbol-names/issue-60925.legacy.stderr +++ b/tests/ui/symbol-names/issue-60925.legacy.stderr @@ -1,10 +1,10 @@ -error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h71f988fda3b6b180E) +error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17hbddb77d6f71afb32E) --> $DIR/issue-60925.rs:21:9 | LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ -error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::h71f988fda3b6b180) +error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::hbddb77d6f71afb32) --> $DIR/issue-60925.rs:21:9 | LL | #[rustc_symbol_name] diff --git a/tests/ui/tail-cps.rs b/tests/ui/tail-cps.rs index 6305e9ecdbc..fe99dadf795 100644 --- a/tests/ui/tail-cps.rs +++ b/tests/ui/tail-cps.rs @@ -1,6 +1,6 @@ //@ run-pass -fn checktrue(rs: bool) -> bool { assert!((rs)); return true; } +fn checktrue(rs: bool) -> bool { assert!(rs); return true; } pub fn main() { let k = checktrue; evenk(42, k); oddk(45, k); } diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.rs index dab01179c0b..215e64979f7 100644 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.rs +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.rs @@ -1,3 +1,4 @@ +//! Ensure ABI-incompatible features cannot be enabled via `#[target_feature]`. //@ compile-flags: --target=riscv32e-unknown-none-elf --crate-type=lib //@ needs-llvm-components: riscv #![feature(no_core, lang_items, riscv_target_feature)] diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.stderr index 9df56d86729..bfe767e5ffb 100644 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.stderr +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-attribute.stderr @@ -1,5 +1,5 @@ error: target feature `d` cannot be enabled with `#[target_feature]`: this feature is incompatible with the target ABI - --> $DIR/forbidden-hardfloat-target-feature-attribute.rs:9:18 + --> $DIR/forbidden-hardfloat-target-feature-attribute.rs:10:18 | LL | #[target_feature(enable = "d")] | ^^^^^^^^^^^^ diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-cfg.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-cfg.rs deleted file mode 100644 index 8755791c1c0..00000000000 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-cfg.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib -//@ needs-llvm-components: x86 -//@ check-pass -#![feature(no_core, lang_items)] -#![no_core] -#![allow(unexpected_cfgs)] - -#[lang = "sized"] -pub trait Sized {} - -// The compile_error macro does not exist, so if the `cfg` evaluates to `true` this -// complains about the missing macro rather than showing the error... but that's good enough. -#[cfg(not(target_feature = "x87"))] -compile_error!("the x87 feature *should* be exposed in `cfg`"); diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-implied.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-implied.rs index 3d09217327a..81f138b175f 100644 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-implied.rs +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-implied.rs @@ -1,8 +1,11 @@ +//! Ensure that if disabling a target feature implies disabling an ABI-required target feature, +//! we complain. //@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib //@ needs-llvm-components: x86 //@ compile-flags: -Ctarget-feature=-sse // For now this is just a warning. //@ build-pass +//@error-pattern: must be enabled to ensure that the ABI #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-neon.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-neon.rs index 95c366bb3f5..7242bcc85bf 100644 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-neon.rs +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable-neon.rs @@ -3,6 +3,7 @@ //@ compile-flags: -Ctarget-feature=-neon // For now this is just a warning. //@ build-pass +//@error-pattern: must be enabled to ensure that the ABI #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs index fd8023664da..7eebcf05dc0 100644 --- a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag-disable.rs @@ -1,8 +1,10 @@ +//! Ensure ABI-required features cannot be disabled via `-Ctarget-feature`. //@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib //@ needs-llvm-components: x86 //@ compile-flags: -Ctarget-feature=-x87 // For now this is just a warning. //@ build-pass +//@error-pattern: must be enabled to ensure that the ABI #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.rs b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.rs new file mode 100644 index 00000000000..f277a309cd6 --- /dev/null +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.rs @@ -0,0 +1,12 @@ +//! Ensure ABI-incompatible features cannot be enabled via `-Ctarget-feature`. +//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib +//@ needs-llvm-components: x86 +//@ compile-flags: -Ctarget-feature=+soft-float +// For now this is just a warning. +//@ build-pass +//@error-pattern: must be disabled to ensure that the ABI +#![feature(no_core, lang_items, riscv_target_feature)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} diff --git a/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.stderr b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.stderr new file mode 100644 index 00000000000..e49672f33b9 --- /dev/null +++ b/tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.stderr @@ -0,0 +1,11 @@ +warning: target feature `soft-float` must be disabled to ensure that the ABI of the current target can be implemented correctly + | + = note: 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 #116344 <https://github.com/rust-lang/rust/issues/116344> + +warning: unstable feature specified for `-Ctarget-feature`: `soft-float` + | + = note: this feature is not stably supported; its behavior can change in the future + +warning: 2 warnings emitted + diff --git a/tests/ui/target-feature/forbidden-target-feature-attribute.rs b/tests/ui/target-feature/forbidden-target-feature-attribute.rs index 2ba5f2215c7..6bb6f8aaffb 100644 --- a/tests/ui/target-feature/forbidden-target-feature-attribute.rs +++ b/tests/ui/target-feature/forbidden-target-feature-attribute.rs @@ -1,11 +1,12 @@ -//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib -//@ needs-llvm-components: x86 +//! Ensure "forbidden" target features cannot be enabled via `#[target_feature]`. +//@ compile-flags: --target=riscv32e-unknown-none-elf --crate-type=lib +//@ needs-llvm-components: riscv #![feature(no_core, lang_items)] #![no_core] #[lang = "sized"] pub trait Sized {} -#[target_feature(enable = "soft-float")] +#[target_feature(enable = "forced-atomics")] //~^ERROR: cannot be enabled with pub unsafe fn my_fun() {} diff --git a/tests/ui/target-feature/forbidden-target-feature-attribute.stderr b/tests/ui/target-feature/forbidden-target-feature-attribute.stderr index f3d54cc19d3..f8ea0c0e793 100644 --- a/tests/ui/target-feature/forbidden-target-feature-attribute.stderr +++ b/tests/ui/target-feature/forbidden-target-feature-attribute.stderr @@ -1,8 +1,8 @@ -error: target feature `soft-float` cannot be enabled with `#[target_feature]`: unsound because it changes float ABI - --> $DIR/forbidden-target-feature-attribute.rs:9:18 +error: target feature `forced-atomics` cannot be enabled with `#[target_feature]`: unsound because it changes the ABI of atomic operations + --> $DIR/forbidden-target-feature-attribute.rs:10:18 | -LL | #[target_feature(enable = "soft-float")] - | ^^^^^^^^^^^^^^^^^^^^^ +LL | #[target_feature(enable = "forced-atomics")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/target-feature/forbidden-target-feature-cfg.rs b/tests/ui/target-feature/forbidden-target-feature-cfg.rs index 1f001e9f8ff..e848ffde018 100644 --- a/tests/ui/target-feature/forbidden-target-feature-cfg.rs +++ b/tests/ui/target-feature/forbidden-target-feature-cfg.rs @@ -1,5 +1,6 @@ -//@ compile-flags: --target=x86_64-unknown-none --crate-type=lib -//@ needs-llvm-components: x86 +//! Ensure "forbidden" target features are not exposed via `cfg`. +//@ compile-flags: --target=riscv32e-unknown-none-elf --crate-type=lib +//@ needs-llvm-components: riscv //@ check-pass #![feature(no_core, lang_items)] #![no_core] @@ -10,5 +11,5 @@ pub trait Sized {} // The compile_error macro does not exist, so if the `cfg` evaluates to `true` this // complains about the missing macro rather than showing the error... but that's good enough. -#[cfg(target_feature = "soft-float")] -compile_error!("the soft-float feature should not be exposed in `cfg`"); +#[cfg(target_feature = "forced-atomics")] +compile_error!("the forced-atomics feature should not be exposed in `cfg`"); diff --git a/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs b/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs index b09c53bd46a..cf85c521228 100644 --- a/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs +++ b/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs @@ -1,8 +1,10 @@ -//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib -//@ needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-soft-float +//! Ensure "forbidden" target features cannot be disabled via `-Ctarget-feature`. +//@ compile-flags: --target=riscv32e-unknown-none-elf --crate-type=lib +//@ needs-llvm-components: riscv +//@ compile-flags: -Ctarget-feature=-forced-atomics // For now this is just a warning. //@ build-pass +//@error-pattern: unsound because it changes the ABI #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/ui/target-feature/forbidden-target-feature-flag-disable.stderr b/tests/ui/target-feature/forbidden-target-feature-flag-disable.stderr index 797cd4be5c2..171ed0de6aa 100644 --- a/tests/ui/target-feature/forbidden-target-feature-flag-disable.stderr +++ b/tests/ui/target-feature/forbidden-target-feature-flag-disable.stderr @@ -1,4 +1,4 @@ -warning: target feature `soft-float` cannot be disabled with `-Ctarget-feature`: unsound because it changes float ABI +warning: target feature `forced-atomics` cannot be disabled with `-Ctarget-feature`: unsound because it changes the ABI of atomic operations | = note: 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 #116344 <https://github.com/rust-lang/rust/issues/116344> diff --git a/tests/ui/target-feature/forbidden-target-feature-flag.rs b/tests/ui/target-feature/forbidden-target-feature-flag.rs index 0f688fde7f4..245841eb039 100644 --- a/tests/ui/target-feature/forbidden-target-feature-flag.rs +++ b/tests/ui/target-feature/forbidden-target-feature-flag.rs @@ -1,8 +1,10 @@ -//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib -//@ needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=+soft-float +//! Ensure "forbidden" target features cannot be enabled via `-Ctarget-feature`. +//@ compile-flags: --target=riscv32e-unknown-none-elf --crate-type=lib +//@ needs-llvm-components: riscv +//@ compile-flags: -Ctarget-feature=+forced-atomics // For now this is just a warning. //@ build-pass +//@error-pattern: unsound because it changes the ABI #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/ui/target-feature/forbidden-target-feature-flag.stderr b/tests/ui/target-feature/forbidden-target-feature-flag.stderr index 075666fbf66..f8490f066d1 100644 --- a/tests/ui/target-feature/forbidden-target-feature-flag.stderr +++ b/tests/ui/target-feature/forbidden-target-feature-flag.stderr @@ -1,4 +1,4 @@ -warning: target feature `soft-float` cannot be enabled with `-Ctarget-feature`: unsound because it changes float ABI +warning: target feature `forced-atomics` cannot be enabled with `-Ctarget-feature`: unsound because it changes the ABI of atomic operations | = note: 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 #116344 <https://github.com/rust-lang/rust/issues/116344> diff --git a/tests/ui/target-feature/implied-features.rs b/tests/ui/target-feature/implied-features.rs index 4fdd843e6c2..d0b5dd3c3fb 100644 --- a/tests/ui/target-feature/implied-features.rs +++ b/tests/ui/target-feature/implied-features.rs @@ -1,6 +1,5 @@ //@ only-x86_64 //@ build-pass -#![feature(target_feature_11)] #![allow(dead_code)] #[target_feature(enable = "ssse3")] diff --git a/tests/ui/target-feature/invalid-attribute.rs b/tests/ui/target-feature/invalid-attribute.rs index c0f5b6b2fb2..9ef7a686d25 100644 --- a/tests/ui/target-feature/invalid-attribute.rs +++ b/tests/ui/target-feature/invalid-attribute.rs @@ -29,13 +29,6 @@ extern "Rust" {} unsafe fn foo() {} #[target_feature(enable = "sse2")] -//~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions -//~| NOTE see issue #69098 -//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -fn bar() {} -//~^ NOTE not an `unsafe` function - -#[target_feature(enable = "sse2")] //~^ ERROR attribute should be applied to a function mod another {} //~^ NOTE not a function @@ -58,7 +51,7 @@ enum Bar {} #[target_feature(enable = "sse2")] //~^ ERROR attribute should be applied to a function union Qux { -//~^ NOTE not a function + //~^ NOTE not a function f1: u16, f2: u16, } @@ -102,9 +95,8 @@ trait Quux { impl Quux for Foo { #[target_feature(enable = "sse2")] - //~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions - //~| NOTE see issue #69098 - //~| 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 + //~| NOTE cannot be applied to safe trait method fn foo() {} //~^ NOTE not an `unsafe` function //~| ERROR: incompatible type for trait @@ -117,9 +109,8 @@ fn main() { //~^ ERROR attribute should be applied to a function unsafe { foo(); - bar(); } - //~^^^^ NOTE not a function + //~^^^ NOTE not a function #[target_feature(enable = "sse2")] //~^ ERROR attribute should be applied to a function diff --git a/tests/ui/target-feature/invalid-attribute.stderr b/tests/ui/target-feature/invalid-attribute.stderr index 10fcf65bb9a..dc8a5304164 100644 --- a/tests/ui/target-feature/invalid-attribute.stderr +++ b/tests/ui/target-feature/invalid-attribute.stderr @@ -32,7 +32,7 @@ LL | extern "Rust" {} | ---------------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:38:1 + --> $DIR/invalid-attribute.rs:31:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -41,7 +41,7 @@ LL | mod another {} | -------------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:43:1 + --> $DIR/invalid-attribute.rs:36:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -50,7 +50,7 @@ LL | const FOO: usize = 7; | --------------------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:48:1 + --> $DIR/invalid-attribute.rs:41:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | struct Foo; | ----------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:53:1 + --> $DIR/invalid-attribute.rs:46:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -68,7 +68,7 @@ LL | enum Bar {} | ----------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:58:1 + --> $DIR/invalid-attribute.rs:51:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -81,7 +81,7 @@ LL | | } | |_- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:66:1 + --> $DIR/invalid-attribute.rs:59:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -90,7 +90,7 @@ LL | type Uwu = (); | -------------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:71:1 + --> $DIR/invalid-attribute.rs:64:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -99,7 +99,7 @@ LL | trait Baz {} | ------------ not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:81:1 + --> $DIR/invalid-attribute.rs:74:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -108,7 +108,7 @@ LL | static A: () = (); | ------------------ not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:86:1 + --> $DIR/invalid-attribute.rs:79:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -117,7 +117,7 @@ LL | impl Quux for u8 {} | ------------------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:93:1 + --> $DIR/invalid-attribute.rs:86:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -126,19 +126,18 @@ LL | impl Foo {} | ----------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:116:5 + --> $DIR/invalid-attribute.rs:108:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | / unsafe { LL | | foo(); -LL | | bar(); LL | | } | |_____- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:124:5 + --> $DIR/invalid-attribute.rs:115:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -164,27 +163,14 @@ error: malformed `target_feature` attribute input LL | #[target_feature(disable = "baz")] | ^^^^^^^^^^^^^^^ help: must be of the form: `enable = ".."` -error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions - --> $DIR/invalid-attribute.rs:31:1 - | -LL | #[target_feature(enable = "sse2")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | fn bar() {} - | -------- not an `unsafe` function - | - = note: see issue #69098 <https://github.com/rust-lang/rust/issues/69098> for more information - = help: add `#![feature(target_feature_11)]` 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: cannot use `#[inline(always)]` with `#[target_feature]` - --> $DIR/invalid-attribute.rs:76:1 + --> $DIR/invalid-attribute.rs:69:1 | LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ error[E0046]: not all trait items implemented, missing: `foo` - --> $DIR/invalid-attribute.rs:88:1 + --> $DIR/invalid-attribute.rs:81:1 | LL | impl Quux for u8 {} | ^^^^^^^^^^^^^^^^ missing `foo` in implementation @@ -192,34 +178,30 @@ LL | impl Quux for u8 {} LL | fn foo(); | --------- `foo` from trait -error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions - --> $DIR/invalid-attribute.rs:104:5 +error: `#[target_feature(..)]` cannot be applied to safe trait method + --> $DIR/invalid-attribute.rs:97:5 | LL | #[target_feature(enable = "sse2")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method ... LL | fn foo() {} | -------- not an `unsafe` function - | - = note: see issue #69098 <https://github.com/rust-lang/rust/issues/69098> for more information - = help: add `#![feature(target_feature_11)]` 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[E0053]: method `foo` has an incompatible type for trait - --> $DIR/invalid-attribute.rs:108:5 + --> $DIR/invalid-attribute.rs:100:5 | LL | fn foo() {} | ^^^^^^^^ expected safe fn, found unsafe fn | note: type in trait - --> $DIR/invalid-attribute.rs:99:5 + --> $DIR/invalid-attribute.rs:92:5 | LL | fn foo(); | ^^^^^^^^^ = note: expected signature `fn()` found signature `#[target_features] fn()` -error: aborting due to 24 previous errors +error: aborting due to 23 previous errors -Some errors have detailed explanations: E0046, E0053, E0658. +Some errors have detailed explanations: E0046, E0053. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs b/tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs new file mode 100644 index 00000000000..28d026c1a9a --- /dev/null +++ b/tests/ui/target-feature/target-cpu-lacks-required-target-feature.rs @@ -0,0 +1,12 @@ +//@ compile-flags: --target=i686-unknown-linux-gnu --crate-type=lib +//@ needs-llvm-components: x86 +//@ compile-flags: -Ctarget-cpu=pentium +// For now this is just a warning. +//@ build-pass +//@error-pattern: must be enabled + +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} diff --git a/tests/ui/target-feature/target-cpu-lacks-required-target-feature.stderr b/tests/ui/target-feature/target-cpu-lacks-required-target-feature.stderr new file mode 100644 index 00000000000..7ec8b04cfce --- /dev/null +++ b/tests/ui/target-feature/target-cpu-lacks-required-target-feature.stderr @@ -0,0 +1,7 @@ +warning: target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly + | + = note: 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 #116344 <https://github.com/rust-lang/rust/issues/116344> + +warning: 1 warning emitted + diff --git a/tests/ui/target_modifiers/auxiliary/default_reg_struct_return.rs b/tests/ui/target_modifiers/auxiliary/default_reg_struct_return.rs new file mode 100644 index 00000000000..355e7c56e94 --- /dev/null +++ b/tests/ui/target_modifiers/auxiliary/default_reg_struct_return.rs @@ -0,0 +1,20 @@ +//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort +// Auxiliary build problems with aarch64-apple: +// Shared library linking cc seems to convert "-m32" flag into -arch armv4t +// Auxiliary build problems with i686-mingw: linker `cc` not found +//@ only-x86 +//@ ignore-windows +//@ ignore-apple +//@ needs-llvm-components: x86 +#![crate_type = "rlib"] +#![no_core] +#![feature(no_core, lang_items, repr_simd)] + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +pub fn somefun() {} + +pub struct S; diff --git a/tests/ui/target_modifiers/auxiliary/wrong_regparm.rs b/tests/ui/target_modifiers/auxiliary/wrong_regparm.rs new file mode 100644 index 00000000000..2e16f1ee747 --- /dev/null +++ b/tests/ui/target_modifiers/auxiliary/wrong_regparm.rs @@ -0,0 +1,20 @@ +//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 -Cpanic=abort +// Auxiliary build problems with aarch64-apple: +// Shared library linking cc seems to convert "-m32" flag into -arch armv4t +// Auxiliary build problems with i686-mingw: linker `cc` not found +//@ only-x86 +//@ ignore-windows +//@ ignore-apple +//@ needs-llvm-components: x86 +#![crate_type = "rlib"] +#![no_core] +#![feature(no_core, lang_items, repr_simd)] + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +pub fn somefun() {} + +pub struct S; diff --git a/tests/ui/target_modifiers/auxiliary/wrong_regparm_and_ret.rs b/tests/ui/target_modifiers/auxiliary/wrong_regparm_and_ret.rs new file mode 100644 index 00000000000..39c6be9d589 --- /dev/null +++ b/tests/ui/target_modifiers/auxiliary/wrong_regparm_and_ret.rs @@ -0,0 +1,20 @@ +//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 -Zreg-struct-return=true -Cpanic=abort +// Auxiliary build problems with aarch64-apple: +// Shared library linking cc seems to convert "-m32" flag into -arch armv4t +// Auxiliary build problems with i686-mingw: linker `cc` not found +//@ only-x86 +//@ ignore-windows +//@ ignore-apple +//@ needs-llvm-components: x86 +#![crate_type = "rlib"] +#![no_core] +#![feature(no_core, lang_items, repr_simd)] + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +pub fn somefun() {} + +pub struct S; diff --git a/tests/ui/target_modifiers/defaults_check.error.stderr b/tests/ui/target_modifiers/defaults_check.error.stderr new file mode 100644 index 00000000000..c545dd71069 --- /dev/null +++ b/tests/ui/target_modifiers/defaults_check.error.stderr @@ -0,0 +1,13 @@ +error: mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `defaults_check` + --> $DIR/defaults_check.rs:20:1 + | +LL | #![crate_type = "rlib"] + | ^ + | + = help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: `-Zreg-struct-return=true` in this crate is incompatible with `-Zreg-struct-return=` in dependency `default_reg_struct_return` + = help: set `-Zreg-struct-return=` in this crate or `-Zreg-struct-return=true` in `default_reg_struct_return` + = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=reg-struct-return` to silence this error + +error: aborting due to 1 previous error + diff --git a/tests/ui/target_modifiers/defaults_check.rs b/tests/ui/target_modifiers/defaults_check.rs new file mode 100644 index 00000000000..b8f4848d3a4 --- /dev/null +++ b/tests/ui/target_modifiers/defaults_check.rs @@ -0,0 +1,27 @@ +// Tests that default unspecified target modifier value in dependency crate is ok linked +// with the same value, explicitly specified +//@ aux-crate:default_reg_struct_return=default_reg_struct_return.rs +//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort +//@ revisions:error ok ok_explicit +//@[ok] compile-flags: +//@[ok_explicit] compile-flags: -Zreg-struct-return=false +//@[error] compile-flags: -Zreg-struct-return=true + +// Auxiliary build problems with aarch64-apple: +// Shared library linking cc seems to convert "-m32" flag into -arch armv4t +// Auxiliary build problems with i686-mingw: linker `cc` not found +//@ only-x86 +//@ ignore-windows +//@ ignore-apple +//@ needs-llvm-components: x86 +//@[ok] build-pass +//@[ok_explicit] build-pass + +#![crate_type = "rlib"] +//[error]~^ ERROR mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `defaults_check` +#![no_core] +#![feature(no_core, lang_items, repr_simd)] + +fn foo() { + default_reg_struct_return::somefun(); +} diff --git a/tests/ui/target_modifiers/incompatible_regparm.allow_no_value.stderr b/tests/ui/target_modifiers/incompatible_regparm.allow_no_value.stderr new file mode 100644 index 00000000000..8597332825b --- /dev/null +++ b/tests/ui/target_modifiers/incompatible_regparm.allow_no_value.stderr @@ -0,0 +1,2 @@ +error: codegen option `unsafe-allow-abi-mismatch` requires a comma-separated list of strings (C unsafe-allow-abi-mismatch=<value>) + diff --git a/tests/ui/target_modifiers/incompatible_regparm.error_generated.stderr b/tests/ui/target_modifiers/incompatible_regparm.error_generated.stderr new file mode 100644 index 00000000000..692fc7a4e3f --- /dev/null +++ b/tests/ui/target_modifiers/incompatible_regparm.error_generated.stderr @@ -0,0 +1,13 @@ +error: mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm` + --> $DIR/incompatible_regparm.rs:16:1 + | +LL | #![crate_type = "rlib"] + | ^ + | + = help: the `-Zregparm` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: `-Zregparm=1` in this crate is incompatible with `-Zregparm=2` in dependency `wrong_regparm` + = help: set `-Zregparm=2` in this crate or `-Zregparm=1` in `wrong_regparm` + = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=regparm` to silence this error + +error: aborting due to 1 previous error + diff --git a/tests/ui/target_modifiers/incompatible_regparm.rs b/tests/ui/target_modifiers/incompatible_regparm.rs new file mode 100644 index 00000000000..e866c5aa891 --- /dev/null +++ b/tests/ui/target_modifiers/incompatible_regparm.rs @@ -0,0 +1,23 @@ +//@ aux-crate:wrong_regparm=wrong_regparm.rs +//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=1 -Cpanic=abort +// Auxiliary build problems with aarch64-apple: +// Shared library linking cc seems to convert "-m32" flag into -arch armv4t +// Auxiliary build problems with i686-mingw: linker `cc` not found +//@ only-x86 +//@ ignore-windows +//@ ignore-apple +//@ needs-llvm-components: x86 +//@ revisions:error_generated allow_regparm_mismatch allow_no_value + +//@[allow_regparm_mismatch] compile-flags: -Cunsafe-allow-abi-mismatch=regparm +//@[allow_regparm_mismatch] build-pass +//@[allow_no_value] compile-flags: -Cunsafe-allow-abi-mismatch + +#![crate_type = "rlib"] +//[error_generated]~^ ERROR mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm` +#![no_core] +#![feature(no_core, lang_items, repr_simd)] + +fn foo() { + wrong_regparm::somefun(); +} diff --git a/tests/ui/target_modifiers/two_flags.rs b/tests/ui/target_modifiers/two_flags.rs new file mode 100644 index 00000000000..ca17117a267 --- /dev/null +++ b/tests/ui/target_modifiers/two_flags.rs @@ -0,0 +1,23 @@ +//@ aux-crate:wrong_regparm_and_ret=wrong_regparm_and_ret.rs +//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort +// Auxiliary build problems with aarch64-apple: +// Shared library linking cc seems to convert "-m32" flag into -arch armv4t +// Auxiliary build problems with i686-mingw: linker `cc` not found +//@ only-x86 +//@ ignore-windows +//@ ignore-apple +//@ needs-llvm-components: x86 +//@ revisions:two_allowed unknown_allowed + +//@[two_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=regparm,reg-struct-return +//@[two_allowed] build-pass +//@[unknown_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=unknown_flag -Zregparm=2 -Zreg-struct-return=true + +#![crate_type = "rlib"] +//[unknown_allowed]~^ ERROR unknown target modifier `unknown_flag`, requested by `-Cunsafe-allow-abi-mismatch=unknown_flag` +#![no_core] +#![feature(no_core, lang_items, repr_simd)] + +fn foo() { + wrong_regparm_and_ret::somefun(); +} diff --git a/tests/ui/target_modifiers/two_flags.unknown_allowed.stderr b/tests/ui/target_modifiers/two_flags.unknown_allowed.stderr new file mode 100644 index 00000000000..c8040c6e389 --- /dev/null +++ b/tests/ui/target_modifiers/two_flags.unknown_allowed.stderr @@ -0,0 +1,8 @@ +error: unknown target modifier `unknown_flag`, requested by `-Cunsafe-allow-abi-mismatch=unknown_flag` + --> $DIR/two_flags.rs:16:1 + | +LL | #![crate_type = "rlib"] + | ^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/test-attrs/inaccessible-test-modules.stderr b/tests/ui/test-attrs/inaccessible-test-modules.stderr index 7635f579d66..dfb6985730a 100644 --- a/tests/ui/test-attrs/inaccessible-test-modules.stderr +++ b/tests/ui/test-attrs/inaccessible-test-modules.stderr @@ -13,7 +13,7 @@ LL | use test as y; help: consider importing this module instead | LL | use test::test as y; - | ~~~~~~~~~~~~~~~ + | ++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/test-attrs/issue-109816.stderr b/tests/ui/test-attrs/issue-109816.stderr index 6f5e3ae6b63..433421fff1b 100644 --- a/tests/ui/test-attrs/issue-109816.stderr +++ b/tests/ui/test-attrs/issue-109816.stderr @@ -9,7 +9,8 @@ LL | struct A5(u32, u8); | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] +LL - #[test] +LL + #[cfg(test)] | error: aborting due to 1 previous error diff --git a/tests/ui/test-attrs/test-attr-non-associated-functions.stderr b/tests/ui/test-attrs/test-attr-non-associated-functions.stderr index 3e3a951aff3..0ede0cbb97f 100644 --- a/tests/ui/test-attrs/test-attr-non-associated-functions.stderr +++ b/tests/ui/test-attrs/test-attr-non-associated-functions.stderr @@ -6,7 +6,8 @@ LL | #[test] | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] +LL - #[test] +LL + #[cfg(test)] | error: the `#[test]` attribute may only be used on a non-associated function @@ -17,7 +18,8 @@ LL | #[test] | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] +LL - #[test] +LL + #[cfg(test)] | error: aborting due to 2 previous errors diff --git a/tests/ui/test-attrs/test-on-not-fn.stderr b/tests/ui/test-attrs/test-on-not-fn.stderr index 7a9913fbcfa..a282db01254 100644 --- a/tests/ui/test-attrs/test-on-not-fn.stderr +++ b/tests/ui/test-attrs/test-on-not-fn.stderr @@ -8,8 +8,9 @@ LL | mod test {} | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:6:1 @@ -27,8 +28,9 @@ LL | | } | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:20:1 @@ -40,8 +42,9 @@ LL | extern "C" {} | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:23:1 @@ -53,8 +56,9 @@ LL | trait Foo {} | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:26:1 @@ -66,8 +70,9 @@ LL | impl Foo for i32 {} | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:29:1 @@ -79,8 +84,9 @@ LL | const FOO: i32 = -1_i32; | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:32:1 @@ -92,8 +98,9 @@ LL | static BAR: u64 = 10_000_u64; | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:35:1 @@ -107,8 +114,9 @@ LL | | } | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:40:1 @@ -120,8 +128,9 @@ LL | struct NewI32(i32); | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:43:1 @@ -136,8 +145,9 @@ LL | | } | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:50:1 @@ -153,8 +163,9 @@ LL | | } | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | warning: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:61:1 @@ -166,8 +177,9 @@ LL | foo!(); | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: aborting due to 11 previous errors; 1 warning emitted diff --git a/tests/ui/test-attrs/test-panic-abort-disabled.rs b/tests/ui/test-attrs/test-panic-abort-disabled.rs index 05dd9395c2b..e83be65f925 100644 --- a/tests/ui/test-attrs/test-panic-abort-disabled.rs +++ b/tests/ui/test-attrs/test-panic-abort-disabled.rs @@ -4,8 +4,6 @@ //@ run-flags: --test-threads=1 //@ needs-unwind -//@ ignore-wasm no panic support -//@ ignore-emscripten no panic support //@ needs-subprocess #![cfg(test)] diff --git a/tests/ui/test-attrs/test-panic-abort-nocapture.rs b/tests/ui/test-attrs/test-panic-abort-nocapture.rs index f7e15dbdbc3..6a1025ea087 100644 --- a/tests/ui/test-attrs/test-panic-abort-nocapture.rs +++ b/tests/ui/test-attrs/test-panic-abort-nocapture.rs @@ -7,8 +7,6 @@ //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ ignore-android #120567 -//@ ignore-wasm no panic support -//@ ignore-emscripten no panic support //@ needs-subprocess #![cfg(test)] diff --git a/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr b/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr index 25681171170..b9f267838b1 100644 --- a/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr +++ b/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr @@ -1,11 +1,11 @@ -thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:34:5: +thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:32:5: assertion `left == right` failed left: 2 right: 4 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:28:5: +thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:26:5: assertion `left == right` failed left: 2 right: 4 diff --git a/tests/ui/test-attrs/test-panic-abort.rs b/tests/ui/test-attrs/test-panic-abort.rs index 951cf54346b..6c9b641fb6f 100644 --- a/tests/ui/test-attrs/test-panic-abort.rs +++ b/tests/ui/test-attrs/test-panic-abort.rs @@ -7,8 +7,6 @@ //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ ignore-android #120567 -//@ ignore-wasm no panic support -//@ ignore-emscripten no panic support //@ needs-subprocess #![cfg(test)] diff --git a/tests/ui/test-attrs/test-panic-abort.run.stdout b/tests/ui/test-attrs/test-panic-abort.run.stdout index 844808e8637..0faa7f0dfce 100644 --- a/tests/ui/test-attrs/test-panic-abort.run.stdout +++ b/tests/ui/test-attrs/test-panic-abort.run.stdout @@ -18,7 +18,7 @@ testing123 ---- it_fails stderr ---- testing321 -thread 'main' panicked at $DIR/test-panic-abort.rs:39:5: +thread 'main' panicked at $DIR/test-panic-abort.rs:37:5: assertion `left == right` failed left: 2 right: 5 diff --git a/tests/ui/threads-sendsync/spawning-with-debug.rs b/tests/ui/threads-sendsync/spawning-with-debug.rs index 90a81c1e53b..3b7107e2dbf 100644 --- a/tests/ui/threads-sendsync/spawning-with-debug.rs +++ b/tests/ui/threads-sendsync/spawning-with-debug.rs @@ -1,7 +1,6 @@ //@ run-pass #![allow(unused_must_use)] #![allow(unused_mut)] -//@ ignore-windows //@ exec-env:RUST_LOG=debug //@ needs-threads diff --git a/tests/ui/threads-sendsync/thread-local-extern-static.rs b/tests/ui/threads-sendsync/thread-local-extern-static.rs index ca66f8ad1d3..ce2a221ec2e 100644 --- a/tests/ui/threads-sendsync/thread-local-extern-static.rs +++ b/tests/ui/threads-sendsync/thread-local-extern-static.rs @@ -1,5 +1,5 @@ //@ run-pass -//@ ignore-windows +//@ ignore-windows FIXME(134939): thread_local + no_mangle doesn't work on Windows //@ aux-build:thread-local-extern-static.rs #![feature(cfg_target_thread_local, thread_local)] diff --git a/tests/ui/trait-bounds/argument-with-unnecessary-method-call.stderr b/tests/ui/trait-bounds/argument-with-unnecessary-method-call.stderr index 49230c98a12..7d795581ea9 100644 --- a/tests/ui/trait-bounds/argument-with-unnecessary-method-call.stderr +++ b/tests/ui/trait-bounds/argument-with-unnecessary-method-call.stderr @@ -14,8 +14,9 @@ LL | fn qux(_: impl From<Bar>) {} | ^^^^^^^^^ required by this bound in `qux` help: try using a fully qualified path to specify the expected types | -LL | qux(<Bar as Into<T>>::into(Bar)); - | +++++++++++++++++++++++ ~ +LL - qux(Bar.into()); +LL + qux(<Bar as Into<T>>::into(Bar)); + | help: consider removing this method call, as the receiver has type `Bar` and `Bar: From<Bar>` trivially holds | LL - qux(Bar.into()); diff --git a/tests/ui/issues/issue-40827.rs b/tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.rs index 6e42c506169..6e42c506169 100644 --- a/tests/ui/issues/issue-40827.rs +++ b/tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.rs diff --git a/tests/ui/issues/issue-40827.stderr b/tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.stderr index 7f5c578ae4f..7b59fe72f43 100644 --- a/tests/ui/issues/issue-40827.stderr +++ b/tests/ui/trait-bounds/deep-level-Send-bound-check-issue-40827.stderr @@ -1,5 +1,5 @@ error[E0277]: `Rc<Foo>` cannot be shared between threads safely - --> $DIR/issue-40827.rs:14:7 + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:14:7 | LL | f(Foo(Arc::new(Bar::B(None)))); | - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Rc<Foo>` cannot be shared between threads safely @@ -8,24 +8,24 @@ LL | f(Foo(Arc::new(Bar::B(None)))); | = help: within `Bar`, the trait `Sync` is not implemented for `Rc<Foo>` note: required because it appears within the type `Bar` - --> $DIR/issue-40827.rs:6:6 + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:6:6 | LL | enum Bar { | ^^^ = note: required for `Arc<Bar>` to implement `Send` note: required because it appears within the type `Foo` - --> $DIR/issue-40827.rs:4:8 + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:4:8 | LL | struct Foo(Arc<Bar>); | ^^^ note: required by a bound in `f` - --> $DIR/issue-40827.rs:11:9 + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:11:9 | LL | fn f<T: Send>(_: T) {} | ^^^^ required by this bound in `f` error[E0277]: `Rc<Foo>` cannot be sent between threads safely - --> $DIR/issue-40827.rs:14:7 + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:14:7 | LL | f(Foo(Arc::new(Bar::B(None)))); | - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Rc<Foo>` cannot be sent between threads safely @@ -34,18 +34,18 @@ LL | f(Foo(Arc::new(Bar::B(None)))); | = help: within `Bar`, the trait `Send` is not implemented for `Rc<Foo>` note: required because it appears within the type `Bar` - --> $DIR/issue-40827.rs:6:6 + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:6:6 | LL | enum Bar { | ^^^ = note: required for `Arc<Bar>` to implement `Send` note: required because it appears within the type `Foo` - --> $DIR/issue-40827.rs:4:8 + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:4:8 | LL | struct Foo(Arc<Bar>); | ^^^ note: required by a bound in `f` - --> $DIR/issue-40827.rs:11:9 + --> $DIR/deep-level-Send-bound-check-issue-40827.rs:11:9 | LL | fn f<T: Send>(_: T) {} | ^^^^ required by this bound in `f` diff --git a/tests/ui/trait-bounds/ice-unsized-tuple-const-issue-121443.rs b/tests/ui/trait-bounds/ice-unsized-tuple-const-issue-121443.rs index c3a2ab82adc..5277de29464 100644 --- a/tests/ui/trait-bounds/ice-unsized-tuple-const-issue-121443.rs +++ b/tests/ui/trait-bounds/ice-unsized-tuple-const-issue-121443.rs @@ -8,7 +8,6 @@ type Fn = dyn FnOnce() -> u8; const TEST: Fn = some_fn; //~^ ERROR cannot find value `some_fn` in this scope //~| ERROR the size for values of type `(dyn FnOnce() -> u8 + 'static)` cannot be known at compilation time -//~| ERROR the size for values of type `(dyn FnOnce() -> u8 + 'static)` cannot be known at compilation time const TEST2: (Fn, u8) = (TEST, 0); //~^ ERROR the size for values of type `(dyn FnOnce() -> u8 + 'static)` cannot be known at compilation time //~| ERROR the size for values of type `(dyn FnOnce() -> u8 + 'static)` cannot be known at compilation time diff --git a/tests/ui/trait-bounds/ice-unsized-tuple-const-issue-121443.stderr b/tests/ui/trait-bounds/ice-unsized-tuple-const-issue-121443.stderr index 0e92979ccd5..76e015a7238 100644 --- a/tests/ui/trait-bounds/ice-unsized-tuple-const-issue-121443.stderr +++ b/tests/ui/trait-bounds/ice-unsized-tuple-const-issue-121443.stderr @@ -13,16 +13,7 @@ LL | const TEST: Fn = some_fn; = help: the trait `Sized` is not implemented for `(dyn FnOnce() -> u8 + 'static)` error[E0277]: the size for values of type `(dyn FnOnce() -> u8 + 'static)` cannot be known at compilation time - --> $DIR/ice-unsized-tuple-const-issue-121443.rs:8:18 - | -LL | const TEST: Fn = some_fn; - | ^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `(dyn FnOnce() -> u8 + 'static)` - = note: constant expressions must have a statically known size - -error[E0277]: the size for values of type `(dyn FnOnce() -> u8 + 'static)` cannot be known at compilation time - --> $DIR/ice-unsized-tuple-const-issue-121443.rs:12:14 + --> $DIR/ice-unsized-tuple-const-issue-121443.rs:11:14 | LL | const TEST2: (Fn, u8) = (TEST, 0); | ^^^^^^^^ doesn't have a size known at compile-time @@ -31,7 +22,7 @@ LL | const TEST2: (Fn, u8) = (TEST, 0); = note: only the last element of a tuple may have a dynamically sized type error[E0277]: the size for values of type `(dyn FnOnce() -> u8 + 'static)` cannot be known at compilation time - --> $DIR/ice-unsized-tuple-const-issue-121443.rs:12:25 + --> $DIR/ice-unsized-tuple-const-issue-121443.rs:11:25 | LL | const TEST2: (Fn, u8) = (TEST, 0); | ^^^^^^^^^ doesn't have a size known at compile-time @@ -39,7 +30,7 @@ LL | const TEST2: (Fn, u8) = (TEST, 0); = help: the trait `Sized` is not implemented for `(dyn FnOnce() -> u8 + 'static)` = note: only the last element of a tuple may have a dynamically sized type -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0277, E0425. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/trait-bounds/maybe-bound-has-path-args.rs b/tests/ui/trait-bounds/maybe-bound-has-path-args.rs index fd0e9691700..e5abcae5d21 100644 --- a/tests/ui/trait-bounds/maybe-bound-has-path-args.rs +++ b/tests/ui/trait-bounds/maybe-bound-has-path-args.rs @@ -2,6 +2,6 @@ trait Trait {} fn test<T: ?self::<i32>::Trait>() {} //~^ ERROR type arguments are not allowed on module `maybe_bound_has_path_args` -//~| WARN relaxing a default bound only does something for `?Sized` +//~| ERROR relaxing a default bound only does something for `?Sized` fn main() {} diff --git a/tests/ui/trait-bounds/maybe-bound-has-path-args.stderr b/tests/ui/trait-bounds/maybe-bound-has-path-args.stderr index 0c167fff940..dc55b26c918 100644 --- a/tests/ui/trait-bounds/maybe-bound-has-path-args.stderr +++ b/tests/ui/trait-bounds/maybe-bound-has-path-args.stderr @@ -1,4 +1,4 @@ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-bound-has-path-args.rs:3:12 | LL | fn test<T: ?self::<i32>::Trait>() {} @@ -12,6 +12,6 @@ LL | fn test<T: ?self::<i32>::Trait>() {} | | | not allowed on module `maybe_bound_has_path_args` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0109`. diff --git a/tests/ui/trait-bounds/maybe-bound-with-assoc.rs b/tests/ui/trait-bounds/maybe-bound-with-assoc.rs index b6b2551e463..9127c2de16d 100644 --- a/tests/ui/trait-bounds/maybe-bound-with-assoc.rs +++ b/tests/ui/trait-bounds/maybe-bound-with-assoc.rs @@ -2,11 +2,11 @@ trait HasAssoc { type Assoc; } fn hasassoc<T: ?HasAssoc<Assoc = ()>>() {} -//~^ WARN relaxing a default bound +//~^ ERROR relaxing a default bound trait NoAssoc {} fn noassoc<T: ?NoAssoc<Missing = ()>>() {} -//~^ WARN relaxing a default bound +//~^ ERROR relaxing a default bound //~| ERROR associated type `Missing` not found for `NoAssoc` fn main() {} diff --git a/tests/ui/trait-bounds/maybe-bound-with-assoc.stderr b/tests/ui/trait-bounds/maybe-bound-with-assoc.stderr index 91d78e59cd5..36a1e0ade20 100644 --- a/tests/ui/trait-bounds/maybe-bound-with-assoc.stderr +++ b/tests/ui/trait-bounds/maybe-bound-with-assoc.stderr @@ -1,10 +1,10 @@ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-bound-with-assoc.rs:4:16 | LL | fn hasassoc<T: ?HasAssoc<Assoc = ()>>() {} | ^^^^^^^^^^^^^^^^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-bound-with-assoc.rs:8:15 | LL | fn noassoc<T: ?NoAssoc<Missing = ()>>() {} @@ -16,6 +16,6 @@ error[E0220]: associated type `Missing` not found for `NoAssoc` LL | fn noassoc<T: ?NoAssoc<Missing = ()>>() {} | ^^^^^^^ associated type `Missing` not found -error: aborting due to 1 previous error; 2 warnings emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0220`. diff --git a/tests/ui/traits/alias/ambiguous.stderr b/tests/ui/traits/alias/ambiguous.stderr index 034e8a3fb7b..542ee190129 100644 --- a/tests/ui/traits/alias/ambiguous.stderr +++ b/tests/ui/traits/alias/ambiguous.stderr @@ -16,12 +16,14 @@ LL | fn foo(&self) {} | ^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | A::foo(&t); - | ~~~~~~~~~~ +LL - t.foo(); +LL + A::foo(&t); + | help: disambiguate the method for candidate #2 | -LL | B::foo(&t); - | ~~~~~~~~~~ +LL - t.foo(); +LL + B::foo(&t); + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/alias/dont-elaborate-non-self.stderr b/tests/ui/traits/alias/dont-elaborate-non-self.stderr index 952f78dd3da..1d96a6a6994 100644 --- a/tests/ui/traits/alias/dont-elaborate-non-self.stderr +++ b/tests/ui/traits/alias/dont-elaborate-non-self.stderr @@ -8,8 +8,9 @@ LL | fn f<Fut>(a: dyn F<Fut>) {} = help: unsized fn params are gated as an unstable feature help: you can use `impl Trait` as the argument type | -LL | fn f<Fut>(a: impl F<Fut>) {} - | ~~~~ +LL - fn f<Fut>(a: dyn F<Fut>) {} +LL + fn f<Fut>(a: impl F<Fut>) {} + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | fn f<Fut>(a: &dyn F<Fut>) {} diff --git a/tests/ui/traits/alias/expand-higher-ranked-alias.rs b/tests/ui/traits/alias/expand-higher-ranked-alias.rs new file mode 100644 index 00000000000..8a301d39f4c --- /dev/null +++ b/tests/ui/traits/alias/expand-higher-ranked-alias.rs @@ -0,0 +1,18 @@ +// Make sure we are using the right binder vars when expanding +// `for<'a> Foo<'a>` to `for<'a> Bar<'a>`. + +//@ check-pass + +#![feature(trait_alias)] + +trait Bar<'a> {} + +trait Foo<'a> = Bar<'a>; + +fn test2(_: &(impl for<'a> Foo<'a> + ?Sized)) {} + +fn test(x: &dyn for<'a> Foo<'a>) { + test2(x); +} + +fn main() {} diff --git a/tests/ui/traits/alias/generic-default-in-dyn.stderr b/tests/ui/traits/alias/generic-default-in-dyn.stderr index 1ab9e6d5c5c..c6f8ab4137b 100644 --- a/tests/ui/traits/alias/generic-default-in-dyn.stderr +++ b/tests/ui/traits/alias/generic-default-in-dyn.stderr @@ -15,7 +15,7 @@ LL | struct Foo<T>(dyn SendEqAlias<T>); | ^^^^^^^^^^^^^^ `SendEqAlias` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/generic-default-in-dyn.rs:1:24 | LL | trait SendEqAlias<T> = PartialEq; @@ -30,7 +30,7 @@ LL | struct Bar<T>(dyn SendEqAlias<T>, T); | ^^^^^^^^^^^^^^ `SendEqAlias` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/generic-default-in-dyn.rs:1:24 | LL | trait SendEqAlias<T> = PartialEq; diff --git a/tests/ui/traits/alias/object-fail.stderr b/tests/ui/traits/alias/object-fail.stderr index 52ce79a4597..d60d8843407 100644 --- a/tests/ui/traits/alias/object-fail.stderr +++ b/tests/ui/traits/alias/object-fail.stderr @@ -5,7 +5,7 @@ LL | let _: &dyn EqAlias = &123; | ^^^^^^^ `EqAlias` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: ...because it uses `Self` as a type parameter diff --git a/tests/ui/traits/alias/self-in-const-generics.stderr b/tests/ui/traits/alias/self-in-const-generics.stderr index 3c799492591..ea201a2dd97 100644 --- a/tests/ui/traits/alias/self-in-const-generics.stderr +++ b/tests/ui/traits/alias/self-in-const-generics.stderr @@ -5,7 +5,7 @@ LL | fn foo(x: &dyn BB) {} | ^^ `BB` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/self-in-const-generics.rs:7:12 | LL | trait BB = Bar<{ 2 + 1 }>; @@ -14,8 +14,9 @@ LL | trait BB = Bar<{ 2 + 1 }>; | this trait is not dyn compatible... help: consider using an opaque type instead | -LL | fn foo(x: &impl BB) {} - | ~~~~ +LL - fn foo(x: &dyn BB) {} +LL + fn foo(x: &impl BB) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/alias/self-in-generics.stderr b/tests/ui/traits/alias/self-in-generics.stderr index 5639b2b44a1..abeb11907ad 100644 --- a/tests/ui/traits/alias/self-in-generics.stderr +++ b/tests/ui/traits/alias/self-in-generics.stderr @@ -5,7 +5,7 @@ LL | pub fn f(_f: &dyn SelfInput) {} | ^^^^^^^^^ `SelfInput` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/self-in-generics.rs:6:23 | LL | pub trait SelfInput = Fn(&mut Self); @@ -16,8 +16,9 @@ LL | pub trait SelfInput = Fn(&mut Self); | this trait is not dyn compatible... help: consider using an opaque type instead | -LL | pub fn f(_f: &impl SelfInput) {} - | ~~~~ +LL - pub fn f(_f: &dyn SelfInput) {} +LL + pub fn f(_f: &impl SelfInput) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/alias/suggest-trait-alias-instead-of-type.stderr b/tests/ui/traits/alias/suggest-trait-alias-instead-of-type.stderr index afe34a125b2..af4e4214be2 100644 --- a/tests/ui/traits/alias/suggest-trait-alias-instead-of-type.stderr +++ b/tests/ui/traits/alias/suggest-trait-alias-instead-of-type.stderr @@ -6,7 +6,8 @@ LL | struct Struct<S: Strings>(S); | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait Strings = Iterator<Item=String>; +LL - type Strings = Iterator<Item=String>; +LL + trait Strings = Iterator<Item=String>; | error: aborting due to 1 previous error diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 0020f9e416d..2288bd1129c 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -9,12 +9,13 @@ LL | struct Foo<T> where T: Bar, <T as Bar>::Baz: String { | help: constrain the associated type to `String` | -LL | struct Foo<T> where T: Bar, T: Bar<Baz = String> { - | ~~~~~~~~~~~~~~~~~~~~ +LL - struct Foo<T> where T: Bar, <T as Bar>::Baz: String { +LL + struct Foo<T> where T: Bar, T: Bar<Baz = String> { + | help: a trait with a similar name exists | LL | struct Foo<T> where T: Bar, <T as Bar>::Baz: ToString { - | ~~~~~~~~ + | ++ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:9:54 @@ -27,12 +28,13 @@ LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { | help: constrain the associated type to `String` | -LL | struct Qux<'a, T> where T: Bar, &'a T: Bar<Baz = String> { - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { +LL + struct Qux<'a, T> where T: Bar, &'a T: Bar<Baz = String> { + | help: a trait with a similar name exists | LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString { - | ~~~~~~~~ + | ++ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:13:45 @@ -45,12 +47,13 @@ LL | fn foo<T: Bar>(_: T) where <T as Bar>::Baz: String { | help: constrain the associated type to `String` | -LL | fn foo<T: Bar>(_: T) where T: Bar<Baz = String> { - | ~~~~~~~~~~~~~~~~~~~~ +LL - fn foo<T: Bar>(_: T) where <T as Bar>::Baz: String { +LL + fn foo<T: Bar>(_: T) where T: Bar<Baz = String> { + | help: a trait with a similar name exists | LL | fn foo<T: Bar>(_: T) where <T as Bar>::Baz: ToString { - | ~~~~~~~~ + | ++ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:16:57 @@ -63,12 +66,13 @@ LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { | help: constrain the associated type to `String` | -LL | fn qux<'a, T: Bar>(_: &'a T) where &'a T: Bar<Baz = String> { - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { +LL + fn qux<'a, T: Bar>(_: &'a T) where &'a T: Bar<Baz = String> { + | help: a trait with a similar name exists | LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { - | ~~~~~~~~ + | ++ error[E0405]: cannot find trait `Unresolved` in this scope --> $DIR/assoc_type_bound_with_struct.rs:19:31 diff --git a/tests/ui/traits/bound/not-on-bare-trait-2021.stderr b/tests/ui/traits/bound/not-on-bare-trait-2021.stderr index e50186aff7e..b81aa54b88d 100644 --- a/tests/ui/traits/bound/not-on-bare-trait-2021.stderr +++ b/tests/ui/traits/bound/not-on-bare-trait-2021.stderr @@ -6,8 +6,9 @@ LL | fn foo(_x: Foo + Send) { | help: use a new generic type parameter, constrained by `Foo + Send` | -LL | fn foo<T: Foo + Send>(_x: T) { - | +++++++++++++++ ~ +LL - fn foo(_x: Foo + Send) { +LL + fn foo<T: Foo + Send>(_x: T) { + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn foo(_x: impl Foo + Send) { @@ -25,8 +26,9 @@ LL | fn bar(x: Foo) -> Foo { | help: use a new generic type parameter, constrained by `Foo` | -LL | fn bar<T: Foo>(x: T) -> Foo { - | ++++++++ ~ +LL - fn bar(x: Foo) -> Foo { +LL + fn bar<T: Foo>(x: T) -> Foo { + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bar(x: impl Foo) -> Foo { diff --git a/tests/ui/traits/bound/not-on-bare-trait.stderr b/tests/ui/traits/bound/not-on-bare-trait.stderr index c2cb303b018..9028e66fa02 100644 --- a/tests/ui/traits/bound/not-on-bare-trait.stderr +++ b/tests/ui/traits/bound/not-on-bare-trait.stderr @@ -39,8 +39,9 @@ LL | fn bar(_x: (dyn Foo + Send)) { = help: unsized fn params are gated as an unstable feature help: you can use `impl Trait` as the argument type | -LL | fn bar(_x: (impl Foo + Send)) { - | ~~~~ +LL - fn bar(_x: (dyn Foo + Send)) { +LL + fn bar(_x: (impl Foo + Send)) { + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | fn bar(_x: (&(dyn Foo + Send))) { diff --git a/tests/ui/traits/bound/not-on-struct.stderr b/tests/ui/traits/bound/not-on-struct.stderr index 2de35dc7fc3..1fb5b1c2067 100644 --- a/tests/ui/traits/bound/not-on-struct.stderr +++ b/tests/ui/traits/bound/not-on-struct.stderr @@ -166,8 +166,9 @@ LL + fn g() -> Traitor { | help: a trait with a similar name exists | -LL | fn g() -> Trait + 'static { - | ~~~~~ +LL - fn g() -> Traitor + 'static { +LL + fn g() -> Trait + 'static { + | error: aborting due to 11 previous errors diff --git a/tests/ui/traits/const-traits/enforce-deref-on-adjust.rs b/tests/ui/traits/const-traits/enforce-deref-on-adjust.rs new file mode 100644 index 00000000000..d5240b7e18d --- /dev/null +++ b/tests/ui/traits/const-traits/enforce-deref-on-adjust.rs @@ -0,0 +1,28 @@ +//@ check-pass + +#![feature(const_deref)] +#![feature(const_trait_impl)] + +use std::ops::Deref; + +struct Wrap<T>(T); +struct Foo; + +impl Foo { + const fn call(&self) {} +} + +impl<T> const Deref for Wrap<T> { + type Target = T; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +const fn foo() { + let x = Wrap(Foo); + x.call(); +} + +fn main() {} diff --git a/tests/ui/traits/const-traits/eval-bad-signature.stderr b/tests/ui/traits/const-traits/eval-bad-signature.stderr index a64cf631743..52de5283f7f 100644 --- a/tests/ui/traits/const-traits/eval-bad-signature.stderr +++ b/tests/ui/traits/const-traits/eval-bad-signature.stderr @@ -13,8 +13,9 @@ LL | fn value() -> u32; found signature `fn() -> i64` help: change the output type to match the trait | -LL | fn value() -> u32 { - | ~~~ +LL - fn value() -> i64 { +LL + fn value() -> u32 { + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr index 5af263de28c..c6e0c699520 100644 --- a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr +++ b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr @@ -24,8 +24,9 @@ LL | fn from_residual(t: T) -> _ { | help: try replacing `_` with the type in the corresponding trait method signature | -LL | fn from_residual(t: T) -> T { - | ~ +LL - fn from_residual(t: T) -> _ { +LL + fn from_residual(t: T) -> T { + | error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/predicate-entailment-passes.rs b/tests/ui/traits/const-traits/predicate-entailment-passes.rs index 9c8d5a5e3f6..28ae21891f3 100644 --- a/tests/ui/traits/const-traits/predicate-entailment-passes.rs +++ b/tests/ui/traits/const-traits/predicate-entailment-passes.rs @@ -6,32 +6,21 @@ #[const_trait] trait Bar {} impl const Bar for () {} - #[const_trait] trait TildeConst { - type Bar<T> where T: ~const Bar; - fn foo<T>() where T: ~const Bar; } impl TildeConst for () { - type Bar<T> = () where T: Bar; - fn foo<T>() where T: Bar {} } #[const_trait] trait AlwaysConst { - type Bar<T> where T: const Bar; - fn foo<T>() where T: const Bar; } impl AlwaysConst for i32 { - type Bar<T> = () where T: Bar; - fn foo<T>() where T: Bar {} } impl const AlwaysConst for u32 { - type Bar<T> = () where T: ~const Bar; - fn foo<T>() where T: ~const Bar {} } diff --git a/tests/ui/traits/const-traits/span-bug-issue-121418.stderr b/tests/ui/traits/const-traits/span-bug-issue-121418.stderr index f41c19b4573..92cfecd0540 100644 --- a/tests/ui/traits/const-traits/span-bug-issue-121418.stderr +++ b/tests/ui/traits/const-traits/span-bug-issue-121418.stderr @@ -8,17 +8,6 @@ LL | impl const dyn T { | = note: only trait implementations may be annotated with `const` -error[E0308]: mismatched types - --> $DIR/span-bug-issue-121418.rs:8:27 - | -LL | pub const fn new() -> std::sync::Mutex<dyn T> {} - | --- ^^^^^^^^^^^^^^^^^^^^^^^ expected `Mutex<dyn T>`, found `()` - | | - | implicitly returns `()` as its body has no tail or `return` expression - | - = note: expected struct `Mutex<(dyn T + 'static)>` - found unit type `()` - error[E0277]: the size for values of type `(dyn T + 'static)` cannot be known at compilation time --> $DIR/span-bug-issue-121418.rs:8:27 | @@ -30,6 +19,17 @@ note: required because it appears within the type `Mutex<(dyn T + 'static)>` --> $SRC_DIR/std/src/sync/poison/mutex.rs:LL:COL = note: the return type of a function must have a statically known size +error[E0308]: mismatched types + --> $DIR/span-bug-issue-121418.rs:8:27 + | +LL | pub const fn new() -> std::sync::Mutex<dyn T> {} + | --- ^^^^^^^^^^^^^^^^^^^^^^^ expected `Mutex<dyn T>`, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression + | + = note: expected struct `Mutex<(dyn T + 'static)>` + found unit type `()` + error: aborting due to 3 previous errors Some errors have detailed explanations: E0277, E0308. diff --git a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr index 460595dd961..139488d79f1 100644 --- a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr +++ b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr @@ -14,8 +14,9 @@ LL | impl<X> Method<u32> for Thing<X> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing<bool> as Method<T>>::method(thing, 42); - | +++++++++++++++++++++++++++++++++++ ~ +LL - thing.method(42); +LL + <Thing<bool> as Method<T>>::method(thing, 42); + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/ice-with-dyn-pointee-errors.stderr b/tests/ui/traits/ice-with-dyn-pointee-errors.stderr index 8bfda71bac1..5299236026d 100644 --- a/tests/ui/traits/ice-with-dyn-pointee-errors.stderr +++ b/tests/ui/traits/ice-with-dyn-pointee-errors.stderr @@ -2,7 +2,7 @@ error[E0271]: type mismatch resolving `<dyn Pointee<Metadata = ()> as Pointee>:: --> $DIR/ice-with-dyn-pointee-errors.rs:9:33 | LL | unknown_sized_object_ptr_in(x) - | --------------------------- ^ expected `()`, found `DynMetadata<dyn Pointee<Metadata = ...>>` + | --------------------------- ^ expected `()`, found `DynMetadata<dyn Pointee<Metadata = ()>>` | | | required by a bound introduced by this call | diff --git a/tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr b/tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr index 8bf8536c74e..4e324209fe9 100644 --- a/tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr +++ b/tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr @@ -1,4 +1,4 @@ -error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements +error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements --> $DIR/impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:28 | LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { @@ -24,4 +24,4 @@ LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0495`. +For more information about this error, try `rustc --explain E0803`. diff --git a/tests/ui/traits/issue-20692.stderr b/tests/ui/traits/issue-20692.stderr index 50ea7cde961..32e29de49a1 100644 --- a/tests/ui/traits/issue-20692.stderr +++ b/tests/ui/traits/issue-20692.stderr @@ -5,7 +5,7 @@ LL | &dyn Array; | ^^^^^^^^^^ `Array` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-20692.rs:1:14 | LL | trait Array: Sized + Copy {} @@ -21,7 +21,7 @@ LL | let _ = x | ^ `Array` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-20692.rs:1:14 | LL | trait Array: Sized + Copy {} diff --git a/tests/ui/traits/issue-28576.stderr b/tests/ui/traits/issue-28576.stderr index ba113d573d6..50d7f8c56b2 100644 --- a/tests/ui/traits/issue-28576.stderr +++ b/tests/ui/traits/issue-28576.stderr @@ -27,7 +27,7 @@ LL | | <Assoc=()> | |________________________^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-28576.rs:5:16 | LL | pub trait Bar: Foo<Assoc=()> { @@ -38,8 +38,9 @@ LL | pub trait Bar: Foo<Assoc=()> { | this trait is not dyn compatible... help: consider using an opaque type instead | -LL | impl Bar - | ~~~~ +LL - dyn Bar +LL + impl Bar + | error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/issue-28576.rs:5:16 diff --git a/tests/ui/traits/issue-35869.stderr b/tests/ui/traits/issue-35869.stderr index 503f9cee246..73cf9617854 100644 --- a/tests/ui/traits/issue-35869.stderr +++ b/tests/ui/traits/issue-35869.stderr @@ -13,8 +13,9 @@ LL | fn foo(_: fn(u8) -> ()); found signature `fn(fn(u16))` help: change the parameter type to match the trait | -LL | fn foo(_: fn(u8)) {} - | ~~~~~~ +LL - fn foo(_: fn(u16) -> ()) {} +LL + fn foo(_: fn(u8)) {} + | error[E0053]: method `bar` has an incompatible type for trait --> $DIR/issue-35869.rs:13:15 @@ -31,8 +32,9 @@ LL | fn bar(_: Option<u8>); found signature `fn(Option<u16>)` help: change the parameter type to match the trait | -LL | fn bar(_: Option<u8>) {} - | ~~~~~~~~~~ +LL - fn bar(_: Option<u16>) {} +LL + fn bar(_: Option<u8>) {} + | error[E0053]: method `baz` has an incompatible type for trait --> $DIR/issue-35869.rs:15:15 @@ -49,8 +51,9 @@ LL | fn baz(_: (u8, u16)); found signature `fn((u16, _))` help: change the parameter type to match the trait | -LL | fn baz(_: (u8, u16)) {} - | ~~~~~~~~~ +LL - fn baz(_: (u16, u16)) {} +LL + fn baz(_: (u8, u16)) {} + | error[E0053]: method `qux` has an incompatible type for trait --> $DIR/issue-35869.rs:17:17 @@ -67,8 +70,9 @@ LL | fn qux() -> u8; found signature `fn() -> u16` help: change the output type to match the trait | -LL | fn qux() -> u8 { 5u16 } - | ~~ +LL - fn qux() -> u16 { 5u16 } +LL + fn qux() -> u8 { 5u16 } + | error: aborting due to 4 previous errors diff --git a/tests/ui/traits/issue-38404.stderr b/tests/ui/traits/issue-38404.stderr index f9e592255dd..63269d3379e 100644 --- a/tests/ui/traits/issue-38404.stderr +++ b/tests/ui/traits/issue-38404.stderr @@ -5,7 +5,7 @@ LL | trait C<T>: A<dyn B<T, Output = usize>> {} | ^^^^^^^^^^^^^^^^^^^^ `B` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-38404.rs:1:13 | LL | trait A<T>: std::ops::Add<Self> + Sized {} @@ -20,7 +20,7 @@ LL | trait C<T>: A<dyn B<T, Output = usize>> {} | ^^^^^^^^^^^^^^^^^^^^ `B` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-38404.rs:1:13 | LL | trait A<T>: std::ops::Add<Self> + Sized {} @@ -36,7 +36,7 @@ LL | trait C<T>: A<dyn B<T, Output = usize>> {} | ^^^^^^^^^^^^^^^^^^^^ `B` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-38404.rs:1:13 | LL | trait A<T>: std::ops::Add<Self> + Sized {} diff --git a/tests/ui/traits/issue-38604.stderr b/tests/ui/traits/issue-38604.stderr index 94f9c1540ad..e6a6b44e730 100644 --- a/tests/ui/traits/issue-38604.stderr +++ b/tests/ui/traits/issue-38604.stderr @@ -5,7 +5,7 @@ LL | let _f: Box<dyn Foo> = | ^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-38604.rs:2:22 | LL | trait Foo where u32: Q<Self> { @@ -21,7 +21,7 @@ LL | Box::new(()); | ^^^^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-38604.rs:2:22 | LL | trait Foo where u32: Q<Self> { diff --git a/tests/ui/traits/issue-50480.stderr b/tests/ui/traits/issue-50480.stderr index 330b23b5755..d3c11238ede 100644 --- a/tests/ui/traits/issue-50480.stderr +++ b/tests/ui/traits/issue-50480.stderr @@ -47,8 +47,9 @@ LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); | help: a type parameter with a similar name exists | -LL | struct Bar<T>(T, T, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); - | ~ +LL - struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); +LL + struct Bar<T>(T, T, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | help: you might be missing a type parameter | LL | struct Bar<T, N>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); diff --git a/tests/ui/traits/issue-52893.stderr b/tests/ui/traits/issue-52893.stderr index c37dde90e33..3c5df82fcdc 100644 --- a/tests/ui/traits/issue-52893.stderr +++ b/tests/ui/traits/issue-52893.stderr @@ -22,7 +22,7 @@ note: method defined here --> $DIR/issue-52893.rs:11:8 | LL | fn push(self, other: T) -> Self::PushRes; - | ^^^^ + | ^^^^ ----- error: aborting due to 1 previous error diff --git a/tests/ui/traits/issue-72410.stderr b/tests/ui/traits/issue-72410.stderr index 002345bff84..c9e133437dd 100644 --- a/tests/ui/traits/issue-72410.stderr +++ b/tests/ui/traits/issue-72410.stderr @@ -5,7 +5,7 @@ LL | where for<'a> &'a mut [dyn Bar]: ; | ^^^^^^^^^^^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-72410.rs:13:8 | LL | pub trait Bar { diff --git a/tests/ui/traits/issue-77982.rs b/tests/ui/traits/issue-77982.rs index dce25e62e46..b2a488e18e8 100644 --- a/tests/ui/traits/issue-77982.rs +++ b/tests/ui/traits/issue-77982.rs @@ -1,5 +1,6 @@ -//@ ignore-windows different list of satisfying impls -//@ ignore-arm different list of satisfying impls +//@ ignore-windows FIXME: We get an extra E0283 on Windows +//@ ignore-arm extra satisfying impls + use std::collections::HashMap; fn what() { diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr index 2b26a1b7ab1..edc7f56ea46 100644 --- a/tests/ui/traits/issue-77982.stderr +++ b/tests/ui/traits/issue-77982.stderr @@ -1,5 +1,5 @@ error[E0283]: type annotations needed - --> $DIR/issue-77982.rs:10:10 + --> $DIR/issue-77982.rs:11:10 | LL | opts.get(opt.as_ref()); | ^^^ ------------ type must be known at this point @@ -18,7 +18,7 @@ LL | opts.get::<Q>(opt.as_ref()); | +++++ error[E0283]: type annotations needed - --> $DIR/issue-77982.rs:10:10 + --> $DIR/issue-77982.rs:11:10 | LL | opts.get(opt.as_ref()); | ^^^ ------ type must be known at this point @@ -36,7 +36,7 @@ LL | opts.get::<Q>(opt.as_ref()); | +++++ error[E0283]: type annotations needed - --> $DIR/issue-77982.rs:15:59 + --> $DIR/issue-77982.rs:16:59 | LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(); | --- ^^^^ @@ -52,17 +52,18 @@ LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect( - impl From<u8> for u32; help: try using a fully qualified path to specify the expected types | -LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(<u32 as Into<T>>::into(0u32))).collect(); - | +++++++++++++++++++++++ ~ +LL - let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(); +LL + let ips: Vec<_> = (0..100_000).map(|_| u32::from(<u32 as Into<T>>::into(0u32))).collect(); + | error[E0283]: type annotations needed for `Box<_>` - --> $DIR/issue-77982.rs:38:9 + --> $DIR/issue-77982.rs:39:9 | LL | let _ = ().foo(); | ^ --- type must be known at this point | note: multiple `impl`s satisfying `(): Foo<'_, _>` found - --> $DIR/issue-77982.rs:31:1 + --> $DIR/issue-77982.rs:32:1 | LL | impl Foo<'static, u32> for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -74,13 +75,13 @@ LL | let _: Box<T> = ().foo(); | ++++++++ error[E0283]: type annotations needed for `Box<_>` - --> $DIR/issue-77982.rs:42:9 + --> $DIR/issue-77982.rs:43:9 | LL | let _ = (&()).bar(); | ^ --- type must be known at this point | note: multiple `impl`s satisfying `&(): Bar<'_, _>` found - --> $DIR/issue-77982.rs:34:1 + --> $DIR/issue-77982.rs:35:1 | LL | impl<'a> Bar<'static, u32> for &'a () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/traits/issue-78372.stderr b/tests/ui/traits/issue-78372.stderr index 86234d15a5d..d4dfba4f039 100644 --- a/tests/ui/traits/issue-78372.stderr +++ b/tests/ui/traits/issue-78372.stderr @@ -19,8 +19,9 @@ LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {} | help: a type parameter with a similar name exists | -LL | impl<T> DispatchFromDyn<Smaht<T, MISC>> for T {} - | ~ +LL - impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {} +LL + impl<T> DispatchFromDyn<Smaht<T, MISC>> for T {} + | help: you might be missing a type parameter | LL | impl<T, U> DispatchFromDyn<Smaht<U, MISC>> for T {} diff --git a/tests/ui/traits/item-privacy.rs b/tests/ui/traits/item-privacy.rs index f5c741ccaa5..cdfd667a6f1 100644 --- a/tests/ui/traits/item-privacy.rs +++ b/tests/ui/traits/item-privacy.rs @@ -98,9 +98,12 @@ fn check_assoc_const() { S::B; //~ ERROR no associated item named `B` found S::C; // OK // A, B, C are resolved as inherent items, their traits don't need to be in scope - <dyn C>::A; //~ ERROR associated constant `A` is private - //~^ ERROR the trait `assoc_const::C` is not dyn compatible - <dyn C>::B; // ERROR the trait `assoc_const::C` is not dyn compatible + <dyn C>::A; + //~^ ERROR associated constant `A` is private + //~| ERROR the trait `assoc_const::C` is not dyn compatible + //~| ERROR the trait `assoc_const::C` is not dyn compatible + <dyn C>::B; + //~^ ERROR the trait `assoc_const::C` is not dyn compatible C::C; // OK } diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr index c97158a5b76..4fd9ef91192 100644 --- a/tests/ui/traits/item-privacy.stderr +++ b/tests/ui/traits/item-privacy.stderr @@ -11,8 +11,9 @@ LL | S.a(); = help: trait `method::A` which provides `a` is implemented but not reachable help: there is a method `b` with a similar name | -LL | S.b(); - | ~ +LL - S.a(); +LL + S.b(); + | error[E0599]: no method named `b` found for struct `S` in the current scope --> $DIR/item-privacy.rs:68:7 @@ -33,8 +34,9 @@ LL + use method::B; | help: there is a method `c` with a similar name | -LL | S.c(); - | ~ +LL - S.b(); +LL + S.c(); + | error[E0624]: method `a` is private --> $DIR/item-privacy.rs:72:7 @@ -104,8 +106,9 @@ LL | S::A; = help: trait `assoc_const::A` which provides `A` is implemented but not reachable help: there is an associated constant `B` with a similar name | -LL | S::B; - | ~ +LL - S::A; +LL + S::B; + | error[E0599]: no associated item named `B` found for struct `S` in the current scope --> $DIR/item-privacy.rs:98:8 @@ -127,6 +130,31 @@ help: trait `B` which provides `B` is implemented but not in scope; perhaps you LL + use assoc_const::B; | +error[E0038]: the trait `assoc_const::C` is not dyn compatible + --> $DIR/item-privacy.rs:101:6 + | +LL | <dyn C>::A; + | ^^^^^ `assoc_const::C` 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/item-privacy.rs:25:15 + | +LL | const A: u8 = 0; + | ^ ...because it contains this associated `const` +... +LL | const B: u8 = 0; + | ^ ...because it contains this associated `const` +... +LL | pub trait C: A + B { + | - this trait is not dyn compatible... +LL | const C: u8 = 0; + | ^ ...because it contains this associated `const` + = help: consider moving `C` to another trait + = help: consider moving `A` to another trait + = help: consider moving `B` to another trait + = help: only type `S` implements `assoc_const::C`; consider using it directly instead. + error[E0624]: associated constant `A` is private --> $DIR/item-privacy.rs:101:14 | @@ -137,13 +165,38 @@ LL | <dyn C>::A; | ^ private associated constant error[E0038]: the trait `assoc_const::C` is not dyn compatible - --> $DIR/item-privacy.rs:101:6 + --> $DIR/item-privacy.rs:101:5 | LL | <dyn C>::A; - | ^^^^^ `assoc_const::C` is not dyn compatible + | ^^^^^^^^^^ `assoc_const::C` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> + --> $DIR/item-privacy.rs:25:15 + | +LL | const A: u8 = 0; + | ^ ...because it contains this associated `const` +... +LL | const B: u8 = 0; + | ^ ...because it contains this associated `const` +... +LL | pub trait C: A + B { + | - this trait is not dyn compatible... +LL | const C: u8 = 0; + | ^ ...because it contains this associated `const` + = help: consider moving `C` to another trait + = help: consider moving `A` to another trait + = help: consider moving `B` to another trait + = help: only type `S` implements `assoc_const::C`; consider using it directly instead. + +error[E0038]: the trait `assoc_const::C` is not dyn compatible + --> $DIR/item-privacy.rs:105:5 + | +LL | <dyn C>::B; + | ^^^^^^^^^^ `assoc_const::C` 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/item-privacy.rs:25:15 | LL | const A: u8 = 0; @@ -162,30 +215,31 @@ LL | const C: u8 = 0; = help: only type `S` implements `assoc_const::C`; consider using it directly instead. error[E0223]: ambiguous associated type - --> $DIR/item-privacy.rs:115:12 + --> $DIR/item-privacy.rs:118:12 | LL | let _: S::A; | ^^^^ | help: if there were a trait named `Example` with associated type `A` implemented for `S`, you could use the fully-qualified path | -LL | let _: <S as Example>::A; - | ~~~~~~~~~~~~~~~~~ +LL - let _: S::A; +LL + let _: <S as Example>::A; + | error[E0223]: ambiguous associated type - --> $DIR/item-privacy.rs:116:12 + --> $DIR/item-privacy.rs:119:12 | LL | let _: S::B; | ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::B>::B` error[E0223]: ambiguous associated type - --> $DIR/item-privacy.rs:117:12 + --> $DIR/item-privacy.rs:120:12 | LL | let _: S::C; | ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::C>::C` error[E0624]: associated type `A` is private - --> $DIR/item-privacy.rs:119:12 + --> $DIR/item-privacy.rs:122:12 | LL | type A = u8; | ------ the associated type is defined here @@ -194,7 +248,7 @@ LL | let _: T::A; | ^^^^ private associated type error[E0624]: associated type `A` is private - --> $DIR/item-privacy.rs:128:9 + --> $DIR/item-privacy.rs:131:9 | LL | type A = u8; | ------ the associated type is defined here @@ -202,7 +256,7 @@ LL | type A = u8; LL | A = u8, | ^^^^^^ private associated type -error: aborting due to 15 previous errors +error: aborting due to 17 previous errors Some errors have detailed explanations: E0038, E0223, E0599, E0624. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/traits/maybe-polarity-pass.rs b/tests/ui/traits/maybe-polarity-pass.rs index 075a0d8dcac..1ccd52bc169 100644 --- a/tests/ui/traits/maybe-polarity-pass.rs +++ b/tests/ui/traits/maybe-polarity-pass.rs @@ -1,5 +1,3 @@ -//@ check-pass - #![feature(auto_traits)] #![feature(more_maybe_bounds)] #![feature(negative_impls)] @@ -12,9 +10,9 @@ trait Trait4 where Self: Trait1 {} fn foo(_: Box<(dyn Trait3 + ?Trait2)>) {} fn bar<T: ?Sized + ?Trait2 + ?Trait1 + ?Trait4>(_: &T) {} -//~^ WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~^ ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default struct S; impl !Trait2 for S {} diff --git a/tests/ui/traits/maybe-polarity-pass.stderr b/tests/ui/traits/maybe-polarity-pass.stderr index 09ed52f5b0d..1f378dd665a 100644 --- a/tests/ui/traits/maybe-polarity-pass.stderr +++ b/tests/ui/traits/maybe-polarity-pass.stderr @@ -1,20 +1,20 @@ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default - --> $DIR/maybe-polarity-pass.rs:14:20 +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/maybe-polarity-pass.rs:12:20 | LL | fn bar<T: ?Sized + ?Trait2 + ?Trait1 + ?Trait4>(_: &T) {} | ^^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default - --> $DIR/maybe-polarity-pass.rs:14:30 +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/maybe-polarity-pass.rs:12:30 | LL | fn bar<T: ?Sized + ?Trait2 + ?Trait1 + ?Trait4>(_: &T) {} | ^^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default - --> $DIR/maybe-polarity-pass.rs:14:40 +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/maybe-polarity-pass.rs:12:40 | LL | fn bar<T: ?Sized + ?Trait2 + ?Trait1 + ?Trait4>(_: &T) {} | ^^^^^^^ -warning: 3 warnings emitted +error: aborting due to 3 previous errors diff --git a/tests/ui/traits/maybe-polarity-repeated.rs b/tests/ui/traits/maybe-polarity-repeated.rs index 4b5ec83fffa..fd1ef567b3e 100644 --- a/tests/ui/traits/maybe-polarity-repeated.rs +++ b/tests/ui/traits/maybe-polarity-repeated.rs @@ -3,7 +3,7 @@ trait Trait {} fn foo<T: ?Trait + ?Trait>(_: T) {} //~^ ERROR type parameter has more than one relaxed default bound, only one is supported -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default -//~| WARN relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +//~| ERROR relaxing a default bound only does something for `?Sized`; all other traits are not bound by default fn main() {} diff --git a/tests/ui/traits/maybe-polarity-repeated.stderr b/tests/ui/traits/maybe-polarity-repeated.stderr index 610c484fbec..4fa1dc45bda 100644 --- a/tests/ui/traits/maybe-polarity-repeated.stderr +++ b/tests/ui/traits/maybe-polarity-repeated.stderr @@ -4,18 +4,18 @@ error[E0203]: type parameter has more than one relaxed default bound, only one i LL | fn foo<T: ?Trait + ?Trait>(_: T) {} | ^^^^^^ ^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-polarity-repeated.rs:4:11 | LL | fn foo<T: ?Trait + ?Trait>(_: T) {} | ^^^^^^ -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-polarity-repeated.rs:4:20 | LL | fn foo<T: ?Trait + ?Trait>(_: T) {} | ^^^^^^ -error: aborting due to 1 previous error; 2 warnings emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0203`. diff --git a/tests/ui/traits/method-argument-mismatch-variance-ice-119867.stderr b/tests/ui/traits/method-argument-mismatch-variance-ice-119867.stderr index e63cc522dd1..d535c39639f 100644 --- a/tests/ui/traits/method-argument-mismatch-variance-ice-119867.stderr +++ b/tests/ui/traits/method-argument-mismatch-variance-ice-119867.stderr @@ -6,8 +6,9 @@ LL | fn deserialize(s: _) {} | help: try replacing `_` with the type in the corresponding trait method signature | -LL | fn deserialize(s: &ArchivedVec<T>) {} - | ~~~~~~~~~~~~~~~ +LL - fn deserialize(s: _) {} +LL + fn deserialize(s: &ArchivedVec<T>) {} + | error[E0186]: method `deserialize` has a `&self` declaration in the trait, but not in the impl --> $DIR/method-argument-mismatch-variance-ice-119867.rs:8:5 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 682d18842b8..c8a1329e3d0 100644 --- a/tests/ui/traits/missing-for-type-in-impl.e2015.stderr +++ b/tests/ui/traits/missing-for-type-in-impl.e2015.stderr @@ -41,7 +41,7 @@ LL | impl Foo<i64> { | ^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/missing-for-type-in-impl.rs:4:8 | LL | trait Foo<T> { diff --git a/tests/ui/traits/multidispatch-bad.stderr b/tests/ui/traits/multidispatch-bad.stderr index 0bb095fb0e1..f605459ca8c 100644 --- a/tests/ui/traits/multidispatch-bad.stderr +++ b/tests/ui/traits/multidispatch-bad.stderr @@ -13,8 +13,9 @@ LL | fn test<T,U>(_: T, _: U) | ^^^^ ---- help: change the type of the numeric literal from `i32` to `u32` | -LL | test(22i32, 44u32); - | ~~~ +LL - test(22i32, 44i32); +LL + test(22i32, 44u32); + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs index cbd591eec96..ea6df938704 100644 --- a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs +++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs @@ -13,8 +13,9 @@ fn main() { } fn weird0() -> impl Sized + !Sized {} -//~^ ERROR the trait bound `(): !Sized` is not satisfied +//~^ ERROR type mismatch resolving fn weird1() -> impl !Sized + Sized {} -//~^ ERROR the trait bound `(): !Sized` is not satisfied +//~^ ERROR type mismatch resolving fn weird2() -> impl !Sized {} -//~^ ERROR the trait bound `(): !Sized` is not satisfied +//~^ ERROR type mismatch resolving +//~| ERROR the size for values of type diff --git a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr index 3dad6d534fd..41d9e74f807 100644 --- a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr +++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr @@ -1,20 +1,29 @@ -error[E0277]: the trait bound `(): !Sized` is not satisfied +error[E0277]: the size for values of type `impl !Sized` cannot be known at compilation time + --> $DIR/opaque-type-unsatisfied-bound.rs:19:16 + | +LL | fn weird2() -> impl !Sized {} + | ^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `impl !Sized` + = note: the return type of a function must have a statically known size + +error[E0271]: type mismatch resolving `impl !Sized + Sized == ()` --> $DIR/opaque-type-unsatisfied-bound.rs:15:16 | LL | fn weird0() -> impl Sized + !Sized {} - | ^^^^^^^^^^^^^^^^^^^ the trait bound `(): !Sized` is not satisfied + | ^^^^^^^^^^^^^^^^^^^ types differ -error[E0277]: the trait bound `(): !Sized` is not satisfied +error[E0271]: type mismatch resolving `impl !Sized + Sized == ()` --> $DIR/opaque-type-unsatisfied-bound.rs:17:16 | LL | fn weird1() -> impl !Sized + Sized {} - | ^^^^^^^^^^^^^^^^^^^ the trait bound `(): !Sized` is not satisfied + | ^^^^^^^^^^^^^^^^^^^ types differ -error[E0277]: the trait bound `(): !Sized` is not satisfied +error[E0271]: type mismatch resolving `impl !Sized == ()` --> $DIR/opaque-type-unsatisfied-bound.rs:19:16 | LL | fn weird2() -> impl !Sized {} - | ^^^^^^^^^^^ the trait bound `(): !Sized` is not satisfied + | ^^^^^^^^^^^ types differ error[E0277]: the trait bound `impl !Trait: Trait` is not satisfied --> $DIR/opaque-type-unsatisfied-bound.rs:12:13 @@ -30,6 +39,7 @@ note: required by a bound in `consume` LL | fn consume(_: impl Trait) {} | ^^^^^ required by this bound in `consume` -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0271, E0277. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs index 39422914afc..ce42bce0ad4 100644 --- a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs +++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs @@ -3,6 +3,6 @@ #![feature(negative_bounds, unboxed_closures)] fn produce() -> impl !Fn<(u32,)> {} -//~^ ERROR the trait bound `(): !Fn(u32)` is not satisfied +//~^ ERROR type mismatch resolving fn main() {} diff --git a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr index 760e5aa62f2..e1b84e0df7a 100644 --- a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr +++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr @@ -1,9 +1,9 @@ -error[E0277]: the trait bound `(): !Fn(u32)` is not satisfied +error[E0271]: type mismatch resolving `impl !Fn<(u32,)> == ()` --> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:17 | LL | fn produce() -> impl !Fn<(u32,)> {} - | ^^^^^^^^^^^^^^^^ the trait bound `(): !Fn(u32)` is not satisfied + | ^^^^^^^^^^^^^^^^ types differ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/next-solver/canonical/const-region-infer-to-static-in-binder.stderr b/tests/ui/traits/next-solver/canonical/const-region-infer-to-static-in-binder.stderr index 377dfc8b529..425f2d59222 100644 --- a/tests/ui/traits/next-solver/canonical/const-region-infer-to-static-in-binder.stderr +++ b/tests/ui/traits/next-solver/canonical/const-region-infer-to-static-in-binder.stderr @@ -1,8 +1,8 @@ -error[E0284]: type annotations needed: cannot normalize `X::{constant#0}` +error[E0284]: type annotations needed: cannot satisfy `the constant `{ || {} }` can be evaluated` --> $DIR/const-region-infer-to-static-in-binder.rs:4:10 | LL | struct X<const FN: fn() = { || {} }>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `X::{constant#0}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `the constant `{ || {} }` can be evaluated` error: using function pointers as const generic parameters is forbidden --> $DIR/const-region-infer-to-static-in-binder.rs:4:20 diff --git a/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr index 1d42dbdfe00..294fa0d7613 100644 --- a/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr +++ b/tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr @@ -1,18 +1,8 @@ -error[E0275]: overflow evaluating the requirement `<T as Overflow>::Assoc: Sized` +error[E0275]: overflow evaluating the requirement `<T as Overflow>::Assoc == _` --> $DIR/trait_ref_is_knowable-norm-overflow.rs:10:18 | LL | type Assoc = <T as Overflow>::Assoc; | ^^^^^^^^^^^^^^^^^^^^^^ - | -note: required by a bound in `Overflow::Assoc` - --> $DIR/trait_ref_is_knowable-norm-overflow.rs:7:5 - | -LL | type Assoc; - | ^^^^^^^^^^^ required by this bound in `Overflow::Assoc` -help: consider relaxing the implicit `Sized` restriction - | -LL | type Assoc: ?Sized; - | ++++++++ error[E0119]: conflicting implementations of trait `Trait` --> $DIR/trait_ref_is_knowable-norm-overflow.rs:18:1 diff --git a/tests/ui/traits/next-solver/diagnostics/coerce-in-may-coerce.stderr b/tests/ui/traits/next-solver/diagnostics/coerce-in-may-coerce.stderr index 1938b3375a5..e4775e41ba1 100644 --- a/tests/ui/traits/next-solver/diagnostics/coerce-in-may-coerce.stderr +++ b/tests/ui/traits/next-solver/diagnostics/coerce-in-may-coerce.stderr @@ -10,11 +10,12 @@ note: function defined here --> $DIR/coerce-in-may-coerce.rs:12:4 | LL | fn arg_error(x: <fn() as Mirror>::Assoc, y: ()) { todo!() } - | ^^^^^^^^^ -------------------------- ----- + | ^^^^^^^^^ help: swap these arguments | -LL | arg_error(|| (), ()); - | ~~~~~~~~~~~ +LL - arg_error((), || ()); +LL + arg_error(|| (), ()); + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/next-solver/gat-wf.rs b/tests/ui/traits/next-solver/gat-wf.rs new file mode 100644 index 00000000000..ff6e2665ef3 --- /dev/null +++ b/tests/ui/traits/next-solver/gat-wf.rs @@ -0,0 +1,16 @@ +//@ compile-flags: -Znext-solver + +// Make sure that, like the old trait solver, we end up requiring that the WC of +// impl GAT matches that of the trait. This is not a restriction that we *need*, +// but is a side-effect of registering the where clauses when normalizing the GAT +// when proving it satisfies its item bounds. + +trait Foo { + type T<'a>: Sized where Self: 'a; +} + +impl Foo for &() { + type T<'a> = (); //~ the type `&()` does not fulfill the required lifetime +} + +fn main() {} diff --git a/tests/ui/traits/next-solver/gat-wf.stderr b/tests/ui/traits/next-solver/gat-wf.stderr new file mode 100644 index 00000000000..620bca77e4b --- /dev/null +++ b/tests/ui/traits/next-solver/gat-wf.stderr @@ -0,0 +1,15 @@ +error[E0477]: the type `&()` does not fulfill the required lifetime + --> $DIR/gat-wf.rs:13:18 + | +LL | type T<'a> = (); + | ^^ + | +note: type must outlive the lifetime `'a` as defined here + --> $DIR/gat-wf.rs:13:12 + | +LL | type T<'a> = (); + | ^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0477`. diff --git a/tests/ui/traits/next-solver/method/path_lookup_wf_constraints.rs b/tests/ui/traits/next-solver/method/path_lookup_wf_constraints.rs new file mode 100644 index 00000000000..fbe170b1990 --- /dev/null +++ b/tests/ui/traits/next-solver/method/path_lookup_wf_constraints.rs @@ -0,0 +1,39 @@ +//@ compile-flags: -Znext-solver +//@ check-pass + +// A regression test for trait-system-refactor-initiative#161 + +trait Constrain<T> { + type Assoc; +} +impl<T> Constrain<T> for () { + type Assoc = (); +} +struct Foo<T, U = <() as Constrain<T>>::Assoc>(T, U); + +impl<T: Copy> Foo<T> { + fn foo() {} +} +struct B; +impl Foo<B> { + fn foo() {} +} + +type Alias<T> = Foo<T>; +fn via_guidance<T: Copy>() +where + (): Constrain<T>, +{ + // Method selection on `Foo<?t, <() as Constrain<?t>>::Assoc>` is ambiguous. + // only by unnecessarily constraining `?t` to `T` when proving `(): Constrain<?t>` + // are we able to select the first impl. + // + // This happens in the old solver when normalizing `Alias<?t>`. The new solver doesn't try + // to eagerly normalize `<() as Constrain<?t>>::Assoc` so we instead always prove that the + // self type is well-formed before method lookup. + Alias::foo(); +} + +fn main() { + via_guidance::<()>(); +} diff --git a/tests/ui/traits/next-solver/normalize/normalize-unsize-rhs.rs b/tests/ui/traits/next-solver/normalize/normalize-unsize-rhs.rs index dc5912b123a..bbf9bafde9f 100644 --- a/tests/ui/traits/next-solver/normalize/normalize-unsize-rhs.rs +++ b/tests/ui/traits/next-solver/normalize/normalize-unsize-rhs.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver //@ check-pass -#![feature(trait_upcasting)] trait A {} trait B: A {} diff --git a/tests/ui/traits/next-solver/specialization-transmute.rs b/tests/ui/traits/next-solver/specialization-transmute.rs index 9e31fed9b18..376fa22ae19 100644 --- a/tests/ui/traits/next-solver/specialization-transmute.rs +++ b/tests/ui/traits/next-solver/specialization-transmute.rs @@ -1,5 +1,4 @@ //@ compile-flags: -Znext-solver -//~^ ERROR cannot normalize `<T as Default>::Id: '_` #![feature(specialization)] //~^ WARN the feature `specialization` is incomplete @@ -14,6 +13,7 @@ impl<T> Default for T { // This will be fixed by #111994 fn intu(&self) -> &Self::Id { //~^ ERROR type annotations needed + //~| ERROR cannot normalize `<T as Default>::Id: '_` self //~ ERROR cannot satisfy } } diff --git a/tests/ui/traits/next-solver/specialization-transmute.stderr b/tests/ui/traits/next-solver/specialization-transmute.stderr index b96bfab927d..eeb101911c4 100644 --- a/tests/ui/traits/next-solver/specialization-transmute.stderr +++ b/tests/ui/traits/next-solver/specialization-transmute.stderr @@ -1,5 +1,5 @@ warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/specialization-transmute.rs:3:12 + --> $DIR/specialization-transmute.rs:2:12 | LL | #![feature(specialization)] | ^^^^^^^^^^^^^^ @@ -9,12 +9,16 @@ LL | #![feature(specialization)] = note: `#[warn(incomplete_features)]` on by default error: cannot normalize `<T as Default>::Id: '_` + --> $DIR/specialization-transmute.rs:14:5 + | +LL | fn intu(&self) -> &Self::Id { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0284]: type annotations needed: cannot normalize `<T as Default>::Id` - --> $DIR/specialization-transmute.rs:15:23 +error[E0282]: type annotations needed + --> $DIR/specialization-transmute.rs:14:23 | LL | fn intu(&self) -> &Self::Id { - | ^^^^^^^^^ cannot normalize `<T as Default>::Id` + | ^^^^^^^^^ cannot infer type for reference `&<T as Default>::Id` error[E0284]: type annotations needed: cannot satisfy `<T as Default>::Id normalizes-to T` --> $DIR/specialization-transmute.rs:17:9 @@ -36,4 +40,5 @@ LL | fn transmute<T: Default<Id = U>, U: Copy>(t: T) -> U { error: aborting due to 4 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0284`. +Some errors have detailed explanations: E0282, E0284. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/next-solver/trait-upcast-lhs-needs-normalization.rs b/tests/ui/traits/next-solver/trait-upcast-lhs-needs-normalization.rs index ee6a7a0986d..c6094b45775 100644 --- a/tests/ui/traits/next-solver/trait-upcast-lhs-needs-normalization.rs +++ b/tests/ui/traits/next-solver/trait-upcast-lhs-needs-normalization.rs @@ -1,6 +1,5 @@ //@ check-pass //@ compile-flags: -Znext-solver -#![feature(trait_upcasting)] pub trait A {} pub trait B: A {} diff --git a/tests/ui/traits/next-solver/unsound-region-obligation.rs b/tests/ui/traits/next-solver/unsound-region-obligation.rs index 733be204354..e7fa60a2e3f 100644 --- a/tests/ui/traits/next-solver/unsound-region-obligation.rs +++ b/tests/ui/traits/next-solver/unsound-region-obligation.rs @@ -1,4 +1,3 @@ -//~ ERROR the type `&'a ()` does not fulfill the required lifetime //@ compile-flags: -Znext-solver // Regression test for rust-lang/trait-system-refactor-initiative#59 @@ -8,6 +7,7 @@ trait StaticTy { impl StaticTy for () { type Item<'a> = &'a (); + //~^ ERROR the type `&'a ()` does not fulfill the required lifetime } fn main() {} diff --git a/tests/ui/traits/next-solver/unsound-region-obligation.stderr b/tests/ui/traits/next-solver/unsound-region-obligation.stderr index fe96a184f43..dea3b62334c 100644 --- a/tests/ui/traits/next-solver/unsound-region-obligation.stderr +++ b/tests/ui/traits/next-solver/unsound-region-obligation.stderr @@ -1,4 +1,8 @@ error[E0477]: the type `&'a ()` does not fulfill the required lifetime + --> $DIR/unsound-region-obligation.rs:9:21 + | +LL | type Item<'a> = &'a (); + | ^^^^^^ | = note: type must satisfy the static lifetime diff --git a/tests/ui/traits/next-solver/upcast-right-substs.rs b/tests/ui/traits/next-solver/upcast-right-substs.rs index bbb8a039aa7..7a566b59b83 100644 --- a/tests/ui/traits/next-solver/upcast-right-substs.rs +++ b/tests/ui/traits/next-solver/upcast-right-substs.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver //@ check-pass -#![feature(trait_upcasting)] trait Foo: Bar<i32> + Bar<u32> {} diff --git a/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr index eecf8e88fb6..02295307cb2 100644 --- a/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr +++ b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr @@ -15,8 +15,9 @@ LL | for<B> B::Item: Send, | help: if there were a trait named `Example` with associated type `Item` implemented for `B`, you could use the fully-qualified path | -LL | for<B> <B as Example>::Item: Send, - | ~~~~~~~~~~~~~~~~~~~~ +LL - for<B> B::Item: Send, +LL + for<B> <B as Example>::Item: Send, + | error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.stderr b/tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.stderr index 8448890c084..43b69d0b50e 100644 --- a/tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.stderr +++ b/tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.stderr @@ -14,7 +14,7 @@ LL | let x: &dyn Foo = &(); | ^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/supertrait-dyn-compatibility.rs:4:12 | LL | trait Foo: for<T> Bar<T> {} @@ -31,7 +31,7 @@ LL | let x: &dyn Foo = &(); | ^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/supertrait-dyn-compatibility.rs:4:12 | LL | trait Foo: for<T> Bar<T> {} @@ -47,7 +47,7 @@ LL | needs_bar(x); | ^^^^^^^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/supertrait-dyn-compatibility.rs:4:12 | LL | trait Foo: for<T> Bar<T> {} diff --git a/tests/ui/type-alias-impl-trait/non-lifetime-binder-in-constraint.rs b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder-in-constraint.rs index 2a301788525..2a301788525 100644 --- a/tests/ui/type-alias-impl-trait/non-lifetime-binder-in-constraint.rs +++ b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder-in-constraint.rs diff --git a/tests/ui/type-alias-impl-trait/non-lifetime-binder-in-constraint.stderr b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder-in-constraint.stderr index 38dcdbd0af2..38dcdbd0af2 100644 --- a/tests/ui/type-alias-impl-trait/non-lifetime-binder-in-constraint.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder-in-constraint.stderr diff --git a/tests/ui/type-alias-impl-trait/non-lifetime-binder.rs b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder.rs index 23f3666618b..23f3666618b 100644 --- a/tests/ui/type-alias-impl-trait/non-lifetime-binder.rs +++ b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder.rs diff --git a/tests/ui/type-alias-impl-trait/non-lifetime-binder.stderr b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder.stderr index 3c352c9889c..3c352c9889c 100644 --- a/tests/ui/type-alias-impl-trait/non-lifetime-binder.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder.stderr diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr index 40e16dde6e4..9d54675c260 100644 --- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr @@ -26,7 +26,7 @@ LL | for<F> F: 'a, help: consider adding an explicit lifetime bound | LL | for<F> F: 'a, !1_"F": 'a - | ~~~~~~~~~~~~ + | ++++++++++ error[E0309]: the placeholder type `!1_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -40,7 +40,7 @@ LL | {} help: consider adding an explicit lifetime bound | LL | for<F> F: 'a, !1_"F": 'a - | ~~~~~~~~~~~~ + | ++++++++++ error[E0309]: the placeholder type `!2_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -54,7 +54,7 @@ LL | {} help: consider adding an explicit lifetime bound | LL | for<F> F: 'a, !2_"F": 'a - | ~~~~~~~~~~~~ + | ++++++++++ error: aborting due to 3 previous errors; 1 warning emitted diff --git a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr index 1d5489845ef..7a2db203ac3 100644 --- a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr +++ b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr @@ -21,8 +21,9 @@ LL | T: I<U>, | ---- unsatisfied trait bound introduced here help: try using a fully qualified path to specify the expected types | -LL | <A<B> as V<U>>::method(a); - | +++++++++++++++++++++++ ~ +LL - a.method(); +LL + <A<B> as V<U>>::method(a); + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.stderr b/tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.stderr index ae3762704c6..b4bbd65b2f4 100644 --- a/tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.stderr +++ b/tests/ui/traits/object/canonicalize-fresh-infer-vars-issue-103626.stderr @@ -20,7 +20,7 @@ LL | let b: &dyn FromResidual = &(); | ^^^ `FromResidual` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/canonicalize-fresh-infer-vars-issue-103626.rs:2:8 | LL | trait FromResidual<R = <Self as Try>::Residual> { @@ -44,7 +44,7 @@ LL | let b: &dyn FromResidual = &(); | ^^^^^^^^^^^^^^^^^ `FromResidual` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/canonicalize-fresh-infer-vars-issue-103626.rs:2:8 | LL | trait FromResidual<R = <Self as Try>::Residual> { diff --git a/tests/ui/traits/object/macro-matcher.stderr b/tests/ui/traits/object/macro-matcher.stderr index ab0fc213c9f..3c668ce99c7 100644 --- a/tests/ui/traits/object/macro-matcher.stderr +++ b/tests/ui/traits/object/macro-matcher.stderr @@ -12,7 +12,7 @@ LL | m!(dyn Copy + Send + 'static); | = note: the trait is not dyn compatible because it requires `Self: Sized` = 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> error: aborting due to 2 previous errors diff --git a/tests/ui/traits/object/pretty.stderr b/tests/ui/traits/object/pretty.stderr index af941e69c5f..2f9fdf151f0 100644 --- a/tests/ui/traits/object/pretty.stderr +++ b/tests/ui/traits/object/pretty.stderr @@ -110,7 +110,7 @@ error[E0308]: mismatched types --> $DIR/pretty.rs:36:79 | LL | fn dyn_fixed_generic_multi(x: &dyn for<'a> FixedGeneric1<'a, Assoc2 = &u8>) { x } - | - ^ expected `()`, found `&dyn FixedGeneric1<'a, Assoc2 = ...>` + | - ^ expected `()`, found `&dyn FixedGeneric1<'a, Assoc2 = &u8>` | | | help: try adding a return type: `-> &dyn for<'a> FixedGeneric1<'a, Assoc2 = &u8>` | @@ -132,7 +132,7 @@ error[E0308]: mismatched types --> $DIR/pretty.rs:38:73 | LL | fn dyn_any_different_binders(x: &dyn AnyDifferentBinders<Assoc = u8>) { x } - | - ^ expected `()`, found `&dyn AnyDifferentBinders<Assoc = ...>` + | - ^ expected `()`, found `&dyn AnyDifferentBinders<Assoc = u8>` | | | help: try adding a return type: `-> &dyn AnyDifferentBinders<Assoc = u8>` | diff --git a/tests/ui/traits/object/print_vtable_sizes.rs b/tests/ui/traits/object/print_vtable_sizes.rs deleted file mode 100644 index 2b1745da5f3..00000000000 --- a/tests/ui/traits/object/print_vtable_sizes.rs +++ /dev/null @@ -1,62 +0,0 @@ -//@ check-pass -//@ compile-flags: -Z print-vtable-sizes -#![crate_type = "lib"] - -trait A<T: help::V>: AsRef<[T::V]> + AsMut<[T::V]> {} - -trait B<T>: AsRef<T> + AsRef<T> + AsRef<T> + AsRef<T> {} - -trait C { - fn x() {} // not dyn-compatible, shouldn't be reported -} - -// This does not have any upcasting cost, -// because both `Send` and `Sync` are traits -// with no methods -trait D: Send + Sync + help::MarkerWithSuper {} - -// This can't have no cost without reordering, -// because `Super::f`. -trait E: help::MarkerWithSuper + Send + Sync {} - -trait F { - fn a(&self); - fn b(&self); - fn c(&self); - - fn d() -> Self - where - Self: Sized; -} - -trait G: AsRef<u8> + AsRef<u16> + help::MarkerWithSuper { - fn a(&self); - fn b(&self); - fn c(&self); - fn d(&self); - fn e(&self); - - fn f() -> Self - where - Self: Sized; -} - -// Traits with the same name -const _: () = { - trait S {} -}; -const _: () = { - trait S {} -}; - -mod help { - pub trait V { - type V; - } - - pub trait MarkerWithSuper: Super {} - - pub trait Super { - fn f(&self); - } -} diff --git a/tests/ui/traits/object/print_vtable_sizes.stdout b/tests/ui/traits/object/print_vtable_sizes.stdout deleted file mode 100644 index 4daf4769576..00000000000 --- a/tests/ui/traits/object/print_vtable_sizes.stdout +++ /dev/null @@ -1,11 +0,0 @@ -print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "A", "entries": "6", "entries_ignoring_upcasting": "5", "entries_for_upcasting": "1", "upcasting_cost_percent": "20" } -print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "G", "entries": "13", "entries_ignoring_upcasting": "11", "entries_for_upcasting": "2", "upcasting_cost_percent": "18.181818181818183" } -print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "B", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" } -print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "D", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" } -print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "E", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" } -print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "F", "entries": "6", "entries_ignoring_upcasting": "6", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" } -print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" } -print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "_::S", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" } -print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "help::MarkerWithSuper", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" } -print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "help::Super", "entries": "4", "entries_ignoring_upcasting": "4", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" } -print-vtable-sizes { "crate_name": "print_vtable_sizes", "trait_name": "help::V", "entries": "3", "entries_ignoring_upcasting": "3", "entries_for_upcasting": "0", "upcasting_cost_percent": "0" } diff --git a/tests/ui/traits/object/safety.stderr b/tests/ui/traits/object/safety.stderr index eab59f39c28..593e42619f4 100644 --- a/tests/ui/traits/object/safety.stderr +++ b/tests/ui/traits/object/safety.stderr @@ -5,7 +5,7 @@ LL | let _: &dyn Tr = &St; | ^^^ `Tr` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/safety.rs:4:8 | LL | trait Tr { @@ -30,7 +30,7 @@ LL | let _: &dyn Tr = &St; | ^^^^^^^ `Tr` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/safety.rs:4:8 | LL | trait Tr { diff --git a/tests/ui/traits/on_unimplemented_long_types.rs b/tests/ui/traits/on_unimplemented_long_types.rs index 98749b8db7a..c652b71e51a 100644 --- a/tests/ui/traits/on_unimplemented_long_types.rs +++ b/tests/ui/traits/on_unimplemented_long_types.rs @@ -1,5 +1,6 @@ //@ compile-flags: --diagnostic-width=60 -Z write-long-types-to-disk=yes -//@ normalize-stderr: "long-type-\d+" -> "long-type-hash" +// The regex below normalizes the long type file name to make it suitable for compare-modes. +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type-\d+.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type-hash.txt'" pub fn foo() -> impl std::fmt::Display { //~^ ERROR doesn't implement `std::fmt::Display` diff --git a/tests/ui/traits/on_unimplemented_long_types.stderr b/tests/ui/traits/on_unimplemented_long_types.stderr index bddc5695696..2705d7c501e 100644 --- a/tests/ui/traits/on_unimplemented_long_types.stderr +++ b/tests/ui/traits/on_unimplemented_long_types.stderr @@ -1,5 +1,5 @@ error[E0277]: `Option<Option<Option<...>>>` doesn't implement `std::fmt::Display` - --> $DIR/on_unimplemented_long_types.rs:4:17 + --> $DIR/on_unimplemented_long_types.rs:5:17 | LL | pub fn foo() -> impl std::fmt::Display { | ^^^^^^^^^^^^^^^^^^^^^^ `Option<Option<Option<...>>>` cannot be formatted with the default formatter @@ -13,11 +13,9 @@ LL | | ))))))))))), LL | | ))))))))))) | |_______________- return type was inferred to be `Option<Option<Option<...>>>` here | - = note: the full name for the type has been written to '$TEST_BUILD_DIR/traits/on_unimplemented_long_types/on_unimplemented_long_types.long-type-hash.txt' - = note: consider using `--verbose` to print the full type name to the console = help: the trait `std::fmt::Display` is not implemented for `Option<Option<Option<...>>>` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead - = note: the full name for the type has been written to '$TEST_BUILD_DIR/traits/on_unimplemented_long_types/on_unimplemented_long_types.long-type-hash.txt' + = note: the full name for the type has been written to '$TEST_BUILD_DIR/$FILE.long-type-hash.txt' = note: consider using `--verbose` to print the full type name to the console error: aborting due to 1 previous error diff --git a/tests/ui/traits/sized-coniductive.rs b/tests/ui/traits/sized-coniductive.rs deleted file mode 100644 index 5f63b166f98..00000000000 --- a/tests/ui/traits/sized-coniductive.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ check-pass -// https://github.com/rust-lang/rust/issues/129541 - -#[derive(Clone)] -struct Test { - field: std::borrow::Cow<'static, [Self]>, -} - -#[derive(Clone)] -struct Hello { - a: <[Hello] as std::borrow::ToOwned>::Owned, -} - -fn main(){} diff --git a/tests/ui/traits/solver-cycles/129541-recursive-struct-and-array-impl.rs b/tests/ui/traits/solver-cycles/129541-recursive-struct-and-array-impl.rs deleted file mode 100644 index defb39aae06..00000000000 --- a/tests/ui/traits/solver-cycles/129541-recursive-struct-and-array-impl.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Regression test for #129541 - -//@ check-pass - -trait Bound {} -trait Normalize { - type Assoc; -} - -impl<T: Bound> Normalize for T { - type Assoc = T; -} - -impl<T: Bound> Normalize for [T] { - type Assoc = T; -} - -impl Bound for Hello {} -struct Hello { - a: <[Hello] as Normalize>::Assoc, -} - -fn main() {} diff --git a/tests/ui/traits/solver-cycles/129541-recursive-struct.rs b/tests/ui/traits/solver-cycles/129541-recursive-struct.rs index d4339dd54d6..4fbcbefec91 100644 --- a/tests/ui/traits/solver-cycles/129541-recursive-struct.rs +++ b/tests/ui/traits/solver-cycles/129541-recursive-struct.rs @@ -1,5 +1,6 @@ // Regression test for #129541 +//@ revisions: unique multiple //@ check-pass trait Bound {} @@ -7,6 +8,10 @@ trait Normalize { type Assoc; } +#[cfg(multiple)] +impl<T: Bound> Normalize for T { + type Assoc = T; +} impl<T: Bound> Normalize for [T] { type Assoc = T; } diff --git a/tests/ui/traits/suggest-fully-qualified-closure.stderr b/tests/ui/traits/suggest-fully-qualified-closure.stderr index a2c1115e673..8975d04d5b3 100644 --- a/tests/ui/traits/suggest-fully-qualified-closure.stderr +++ b/tests/ui/traits/suggest-fully-qualified-closure.stderr @@ -14,8 +14,9 @@ LL | impl MyTrait<u64> for Qqq{ | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Qqq as MyTrait<T>>::lol::<_>(&q, ||()); - | +++++++++++++++++++++++++++++++ ~ +LL - q.lol(||()); +LL + <Qqq as MyTrait<T>>::lol::<_>(&q, ||()); + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr index 841acb5ffd3..0996227e697 100644 --- a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr +++ b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr @@ -14,8 +14,9 @@ LL | impl Method<u32> for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing as Method<T>>::method(&thing); - | ++++++++++++++++++++++++++++++ ~ +LL - thing.method(); +LL + <Thing as Method<T>>::method(&thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:46:11 @@ -33,8 +34,9 @@ LL | impl Method<u32> for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing as Method<T>>::mut_method(&mut thing); - | +++++++++++++++++++++++++++++++++++++ ~ +LL - thing.mut_method(); +LL + <Thing as Method<T>>::mut_method(&mut thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:47:11 @@ -52,8 +54,9 @@ LL | impl MethodRef<u32> for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef<T>>::by_self(&thing); - | +++++++++++++++++++++++++++++++++++ ~ +LL - thing.by_self(); +LL + <&Thing as MethodRef<T>>::by_self(&thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:50:14 @@ -71,8 +74,9 @@ LL | impl Method<u32> for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing as Method<T>>::method(&deref_to); - | ++++++++++++++++++++++++++++++ ~ +LL - deref_to.method(); +LL + <Thing as Method<T>>::method(&deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:51:14 @@ -90,8 +94,9 @@ LL | impl Method<u32> for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing as Method<T>>::mut_method(&mut deref_to); - | +++++++++++++++++++++++++++++++++++++ ~ +LL - deref_to.mut_method(); +LL + <Thing as Method<T>>::mut_method(&mut deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:52:14 @@ -109,8 +114,9 @@ LL | impl MethodRef<u32> for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef<T>>::by_self(&deref_to); - | +++++++++++++++++++++++++++++++++++ ~ +LL - deref_to.by_self(); +LL + <&Thing as MethodRef<T>>::by_self(&deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:55:20 @@ -128,8 +134,9 @@ LL | impl Method<u32> for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing as Method<T>>::method(&deref_deref_to); - | ++++++++++++++++++++++++++++++ ~ +LL - deref_deref_to.method(); +LL + <Thing as Method<T>>::method(&deref_deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:56:20 @@ -147,8 +154,9 @@ LL | impl Method<u32> for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing as Method<T>>::mut_method(&mut deref_deref_to); - | +++++++++++++++++++++++++++++++++++++ ~ +LL - deref_deref_to.mut_method(); +LL + <Thing as Method<T>>::mut_method(&mut deref_deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:57:20 @@ -166,8 +174,9 @@ LL | impl MethodRef<u32> for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef<T>>::by_self(&deref_deref_to); - | +++++++++++++++++++++++++++++++++++ ~ +LL - deref_deref_to.by_self(); +LL + <&Thing as MethodRef<T>>::by_self(&deref_deref_to); + | error: aborting due to 9 previous errors diff --git a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr index 1865d81bad1..629904815f3 100644 --- a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr +++ b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr @@ -14,8 +14,9 @@ LL | impl Method<u32> for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing as Method<T>>::method(ref_thing); - | +++++++++++++++++++++++++++++ ~ +LL - ref_thing.method(); +LL + <Thing as Method<T>>::method(ref_thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:46:15 @@ -33,8 +34,9 @@ LL | impl MethodRef<u32> for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef<T>>::by_self(ref_thing); - | ++++++++++++++++++++++++++++++++++ ~ +LL - ref_thing.by_self(); +LL + <&Thing as MethodRef<T>>::by_self(ref_thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:49:15 @@ -52,8 +54,9 @@ LL | impl Method<u32> for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing as Method<T>>::method(mut_thing); - | +++++++++++++++++++++++++++++ ~ +LL - mut_thing.method(); +LL + <Thing as Method<T>>::method(mut_thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:50:15 @@ -71,8 +74,9 @@ LL | impl Method<u32> for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing as Method<T>>::mut_method(mut_thing); - | +++++++++++++++++++++++++++++++++ ~ +LL - mut_thing.mut_method(); +LL + <Thing as Method<T>>::mut_method(mut_thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:51:15 @@ -90,8 +94,9 @@ LL | impl MethodRef<u32> for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef<T>>::by_self(mut_thing); - | ++++++++++++++++++++++++++++++++++ ~ +LL - mut_thing.by_self(); +LL + <&Thing as MethodRef<T>>::by_self(mut_thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:54:14 @@ -109,8 +114,9 @@ LL | impl Method<u32> for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing as Method<T>>::method(deref_to); - | +++++++++++++++++++++++++++++ ~ +LL - deref_to.method(); +LL + <Thing as Method<T>>::method(deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:55:14 @@ -128,8 +134,9 @@ LL | impl Method<u32> for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing as Method<T>>::mut_method(deref_to); - | +++++++++++++++++++++++++++++++++ ~ +LL - deref_to.mut_method(); +LL + <Thing as Method<T>>::mut_method(deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:56:14 @@ -147,8 +154,9 @@ LL | impl MethodRef<u32> for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef<T>>::by_self(deref_to); - | ++++++++++++++++++++++++++++++++++ ~ +LL - deref_to.by_self(); +LL + <&Thing as MethodRef<T>>::by_self(deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:59:20 @@ -166,8 +174,9 @@ LL | impl Method<u32> for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing as Method<T>>::method(deref_deref_to); - | +++++++++++++++++++++++++++++ ~ +LL - deref_deref_to.method(); +LL + <Thing as Method<T>>::method(deref_deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:60:20 @@ -185,8 +194,9 @@ LL | impl Method<u32> for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <Thing as Method<T>>::mut_method(deref_deref_to); - | +++++++++++++++++++++++++++++++++ ~ +LL - deref_deref_to.mut_method(); +LL + <Thing as Method<T>>::mut_method(deref_deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:61:20 @@ -204,8 +214,9 @@ LL | impl MethodRef<u32> for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef<T>>::by_self(deref_deref_to); - | ++++++++++++++++++++++++++++++++++ ~ +LL - deref_deref_to.by_self(); +LL + <&Thing as MethodRef<T>>::by_self(deref_deref_to); + | error: aborting due to 11 previous errors diff --git a/tests/ui/traits/test-2.stderr b/tests/ui/traits/test-2.stderr index 8915e490b4d..6a6cb503aa4 100644 --- a/tests/ui/traits/test-2.stderr +++ b/tests/ui/traits/test-2.stderr @@ -33,7 +33,7 @@ LL | (Box::new(10) as Box<dyn bar>).dup(); | ^^^^^^^^^^^^ `bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/test-2.rs:4:30 | LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); } @@ -56,7 +56,7 @@ LL | (Box::new(10) as Box<dyn bar>).dup(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/test-2.rs:4:30 | LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); } @@ -79,7 +79,7 @@ LL | (Box::new(10) as Box<dyn bar>).dup(); | ^^^^^^^^^^^^ `bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/test-2.rs:4:30 | LL | trait bar { fn dup(&self) -> Self; fn blah<X>(&self); } diff --git a/tests/ui/traits/trait-upcasting/add-supertrait-auto-traits.rs b/tests/ui/traits/trait-upcasting/add-supertrait-auto-traits.rs index ffc21a4a9ea..5b22fce6311 100644 --- a/tests/ui/traits/trait-upcasting/add-supertrait-auto-traits.rs +++ b/tests/ui/traits/trait-upcasting/add-supertrait-auto-traits.rs @@ -3,8 +3,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(trait_upcasting)] - trait Target {} trait Source: Send + Target {} diff --git a/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.rs b/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.rs index 4a5e445d1ef..927a9d6b94f 100644 --- a/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.rs +++ b/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.rs @@ -1,4 +1,3 @@ -#![feature(trait_upcasting)] #![feature(trait_alias)] // Although we *elaborate* `T: Alias` to `i32: B`, we should diff --git a/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.stderr b/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.stderr index 99c82b88d9c..1a410519a4e 100644 --- a/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.stderr +++ b/tests/ui/traits/trait-upcasting/alias-where-clause-isnt-supertrait.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/alias-where-clause-isnt-supertrait.rs:27:5 + --> $DIR/alias-where-clause-isnt-supertrait.rs:26:5 | LL | fn test(x: &dyn C) -> &dyn B { | ------ expected `&dyn B` because of return type diff --git a/tests/ui/traits/trait-upcasting/basic.rs b/tests/ui/traits/trait-upcasting/basic.rs index 9b9669565ba..0a8d16a42dd 100644 --- a/tests/ui/traits/trait-upcasting/basic.rs +++ b/tests/ui/traits/trait-upcasting/basic.rs @@ -1,7 +1,5 @@ //@ run-pass -#![feature(trait_upcasting)] - trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync { fn a(&self) -> i32 { 10 diff --git a/tests/ui/traits/trait-upcasting/correct-supertrait-substitution.rs b/tests/ui/traits/trait-upcasting/correct-supertrait-substitution.rs index 7f4343dbd2f..0a02784f29c 100644 --- a/tests/ui/traits/trait-upcasting/correct-supertrait-substitution.rs +++ b/tests/ui/traits/trait-upcasting/correct-supertrait-substitution.rs @@ -1,5 +1,4 @@ //@ run-pass -#![feature(trait_upcasting)] trait Foo<T: Default + ToString>: Bar<i32> + Bar<T> {} trait Bar<T: Default + ToString> { diff --git a/tests/ui/traits/trait-upcasting/deref-upcast-behavioral-change.rs b/tests/ui/traits/trait-upcasting/deref-upcast-behavioral-change.rs deleted file mode 100644 index e4784fa4101..00000000000 --- a/tests/ui/traits/trait-upcasting/deref-upcast-behavioral-change.rs +++ /dev/null @@ -1,35 +0,0 @@ -#![deny(deref_into_dyn_supertrait)] -use std::ops::Deref; - -trait Bar<T> {} -impl<T, U> Bar<U> for T {} - -trait Foo: Bar<i32> { - fn as_dyn_bar_u32<'a>(&self) -> &(dyn Bar<u32> + 'a); -} - -impl Foo for () { - fn as_dyn_bar_u32<'a>(&self) -> &(dyn Bar<u32> + 'a) { - self - } -} - -impl<'a> Deref for dyn Foo + 'a { - //~^ ERROR this `Deref` implementation is covered by an implicit supertrait coercion - //~| WARN this will change its meaning in a future release! - type Target = dyn Bar<u32> + 'a; - - fn deref(&self) -> &Self::Target { - self.as_dyn_bar_u32() - } -} - -fn take_dyn<T>(x: &dyn Bar<T>) -> T { - todo!() -} - -fn main() { - let x: &dyn Foo = &(); - let y = take_dyn(x); - let z: u32 = y; -} diff --git a/tests/ui/traits/trait-upcasting/deref-upcast-behavioral-change.stderr b/tests/ui/traits/trait-upcasting/deref-upcast-behavioral-change.stderr deleted file mode 100644 index fa93e28c73b..00000000000 --- a/tests/ui/traits/trait-upcasting/deref-upcast-behavioral-change.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error: this `Deref` implementation is covered by an implicit supertrait coercion - --> $DIR/deref-upcast-behavioral-change.rs:17:1 - | -LL | impl<'a> Deref for dyn Foo + 'a { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Foo` implements `Deref<Target = dyn Bar<u32>>` which conflicts with supertrait `Bar<i32>` -... -LL | type Target = dyn Bar<u32> + 'a; - | -------------------------------- target type is a supertrait of `dyn Foo` - | - = warning: this will change its meaning in a future release! - = note: for more information, see issue #89460 <https://github.com/rust-lang/rust/issues/89460> -note: the lint level is defined here - --> $DIR/deref-upcast-behavioral-change.rs:1:9 - | -LL | #![deny(deref_into_dyn_supertrait)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/traits/trait-upcasting/deref-upcast-shadowing-lint.rs b/tests/ui/traits/trait-upcasting/deref-upcast-shadowing-lint.rs new file mode 100644 index 00000000000..ab84527edcf --- /dev/null +++ b/tests/ui/traits/trait-upcasting/deref-upcast-shadowing-lint.rs @@ -0,0 +1,17 @@ +//@ check-pass +#![warn(deref_into_dyn_supertrait)] +use std::ops::Deref; + +trait Bar<T> {} +trait Foo: Bar<i32> {} + +impl<'a> Deref for dyn Foo + 'a { + //~^ warn: this `Deref` implementation is covered by an implicit supertrait coercion + type Target = dyn Bar<u32> + 'a; + + fn deref(&self) -> &Self::Target { + todo!() + } +} + +fn main() {} diff --git a/tests/ui/traits/trait-upcasting/deref-upcast-shadowing-lint.stderr b/tests/ui/traits/trait-upcasting/deref-upcast-shadowing-lint.stderr new file mode 100644 index 00000000000..0d7f957a50e --- /dev/null +++ b/tests/ui/traits/trait-upcasting/deref-upcast-shadowing-lint.stderr @@ -0,0 +1,17 @@ +warning: this `Deref` implementation is covered by an implicit supertrait coercion + --> $DIR/deref-upcast-shadowing-lint.rs:8:1 + | +LL | impl<'a> Deref for dyn Foo + 'a { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Foo` implements `Deref<Target = dyn Bar<u32>>` which conflicts with supertrait `Bar<i32>` +LL | +LL | type Target = dyn Bar<u32> + 'a; + | -------------------------------- target type is a supertrait of `dyn Foo` + | +note: the lint level is defined here + --> $DIR/deref-upcast-shadowing-lint.rs:2:9 + | +LL | #![warn(deref_into_dyn_supertrait)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 1 warning emitted + diff --git a/tests/ui/traits/trait-upcasting/diamond.rs b/tests/ui/traits/trait-upcasting/diamond.rs index 303c99b67bd..c3f15a6d582 100644 --- a/tests/ui/traits/trait-upcasting/diamond.rs +++ b/tests/ui/traits/trait-upcasting/diamond.rs @@ -1,7 +1,5 @@ //@ run-pass -#![feature(trait_upcasting)] - trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync { fn a(&self) -> i32 { 10 diff --git a/tests/ui/traits/trait-upcasting/fewer-associated.rs b/tests/ui/traits/trait-upcasting/fewer-associated.rs index 45e8673b859..c2ea2a09d3a 100644 --- a/tests/ui/traits/trait-upcasting/fewer-associated.rs +++ b/tests/ui/traits/trait-upcasting/fewer-associated.rs @@ -4,8 +4,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(trait_upcasting)] - trait A: B { type Assoc; } diff --git a/tests/ui/traits/trait-upcasting/higher-ranked-upcasting-ok.rs b/tests/ui/traits/trait-upcasting/higher-ranked-upcasting-ok.rs index c4c070e49fd..9f9bf21b5a9 100644 --- a/tests/ui/traits/trait-upcasting/higher-ranked-upcasting-ok.rs +++ b/tests/ui/traits/trait-upcasting/higher-ranked-upcasting-ok.rs @@ -6,8 +6,6 @@ // Check that we are able to instantiate a binder during trait upcasting, // and that it doesn't cause any issues with codegen either. -#![feature(trait_upcasting)] - trait Supertrait<'a, 'b> {} trait Subtrait<'a, 'b>: Supertrait<'a, 'b> {} diff --git a/tests/ui/traits/trait-upcasting/higher-ranked-upcasting-ub.rs b/tests/ui/traits/trait-upcasting/higher-ranked-upcasting-ub.rs index 2cf6fc75e77..af2594b95f3 100644 --- a/tests/ui/traits/trait-upcasting/higher-ranked-upcasting-ub.rs +++ b/tests/ui/traits/trait-upcasting/higher-ranked-upcasting-ub.rs @@ -5,7 +5,7 @@ // We previously wrongly instantiated binders during trait upcasting, // allowing the super trait to be more generic than the sub trait. // This was unsound. -#![feature(trait_upcasting)] + trait Supertrait<'a, 'b> { fn cast(&self, x: &'a str) -> &'b str; } diff --git a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.current.stderr b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.current.stderr index 28be189ff1e..596380b0dbb 100644 --- a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.current.stderr +++ b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.current.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/illegal-upcast-from-impl.rs:17:66 + --> $DIR/illegal-upcast-from-impl.rs:15:66 | LL | fn illegal(x: &dyn Sub<Assoc = ()>) -> &dyn Super<Assoc = i32> { x } | ----------------------- ^ expected trait `Super`, found trait `Sub` diff --git a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.next.stderr b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.next.stderr index 28be189ff1e..596380b0dbb 100644 --- a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.next.stderr +++ b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.next.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/illegal-upcast-from-impl.rs:17:66 + --> $DIR/illegal-upcast-from-impl.rs:15:66 | LL | fn illegal(x: &dyn Sub<Assoc = ()>) -> &dyn Super<Assoc = i32> { x } | ----------------------- ^ expected trait `Super`, found trait `Sub` diff --git a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs index 0c771db4121..43ec4ece429 100644 --- a/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs +++ b/tests/ui/traits/trait-upcasting/illegal-upcast-from-impl.rs @@ -2,8 +2,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(trait_upcasting)] - trait Super { type Assoc; } diff --git a/tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs b/tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs index d0418e75fab..2760c1696b5 100644 --- a/tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs +++ b/tests/ui/traits/trait-upcasting/illegal-upcast-to-impl-opaque.rs @@ -9,8 +9,6 @@ //@[next] rustc-env:RUST_BACKTRACE=0 //@ check-pass -#![feature(trait_upcasting)] - trait Super { type Assoc; } diff --git a/tests/ui/traits/trait-upcasting/inference-behavior-change-deref.rs b/tests/ui/traits/trait-upcasting/inference-behavior-change-deref.rs index 79fb643eacd..0103aaa2ac9 100644 --- a/tests/ui/traits/trait-upcasting/inference-behavior-change-deref.rs +++ b/tests/ui/traits/trait-upcasting/inference-behavior-change-deref.rs @@ -1,6 +1,3 @@ -#![deny(deref_into_dyn_supertrait)] -#![feature(trait_upcasting)] // remove this and the test compiles - use std::ops::Deref; trait Bar<T> {} @@ -32,5 +29,5 @@ fn main() { let x: &dyn Foo = &(); let y = take_dyn(x); let z: u32 = y; - //~^ ERROR mismatched types + //~^ error: mismatched types } diff --git a/tests/ui/traits/trait-upcasting/inference-behavior-change-deref.stderr b/tests/ui/traits/trait-upcasting/inference-behavior-change-deref.stderr index 6b6a26d1593..45eabbc723a 100644 --- a/tests/ui/traits/trait-upcasting/inference-behavior-change-deref.stderr +++ b/tests/ui/traits/trait-upcasting/inference-behavior-change-deref.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/inference-behavior-change-deref.rs:34:18 + --> $DIR/inference-behavior-change-deref.rs:31:18 | LL | let z: u32 = y; | --- ^ expected `u32`, found `i32` diff --git a/tests/ui/traits/trait-upcasting/invalid-upcast.rs b/tests/ui/traits/trait-upcasting/invalid-upcast.rs index e634bbd5ac6..9269a5e3e9f 100644 --- a/tests/ui/traits/trait-upcasting/invalid-upcast.rs +++ b/tests/ui/traits/trait-upcasting/invalid-upcast.rs @@ -1,5 +1,3 @@ -#![feature(trait_upcasting)] - trait Foo { fn a(&self) -> i32 { 10 diff --git a/tests/ui/traits/trait-upcasting/invalid-upcast.stderr b/tests/ui/traits/trait-upcasting/invalid-upcast.stderr index 3aa21ee3ddd..e70b99d28c7 100644 --- a/tests/ui/traits/trait-upcasting/invalid-upcast.stderr +++ b/tests/ui/traits/trait-upcasting/invalid-upcast.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:53:35 + --> $DIR/invalid-upcast.rs:51:35 | LL | let _: &dyn std::fmt::Debug = baz; | -------------------- ^^^ expected trait `Debug`, found trait `Baz` @@ -10,7 +10,7 @@ LL | let _: &dyn std::fmt::Debug = baz; found reference `&dyn Baz` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:55:24 + --> $DIR/invalid-upcast.rs:53:24 | LL | let _: &dyn Send = baz; | --------- ^^^ expected trait `Send`, found trait `Baz` @@ -21,7 +21,7 @@ LL | let _: &dyn Send = baz; found reference `&dyn Baz` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:57:24 + --> $DIR/invalid-upcast.rs:55:24 | LL | let _: &dyn Sync = baz; | --------- ^^^ expected trait `Sync`, found trait `Baz` @@ -32,7 +32,7 @@ LL | let _: &dyn Sync = baz; found reference `&dyn Baz` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:60:25 + --> $DIR/invalid-upcast.rs:58:25 | LL | let bar: &dyn Bar = baz; | -------- ^^^ expected trait `Bar`, found trait `Baz` @@ -43,7 +43,7 @@ LL | let bar: &dyn Bar = baz; found reference `&dyn Baz` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:62:35 + --> $DIR/invalid-upcast.rs:60:35 | LL | let _: &dyn std::fmt::Debug = bar; | -------------------- ^^^ expected trait `Debug`, found trait `Bar` @@ -54,7 +54,7 @@ LL | let _: &dyn std::fmt::Debug = bar; found reference `&dyn Bar` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:64:24 + --> $DIR/invalid-upcast.rs:62:24 | LL | let _: &dyn Send = bar; | --------- ^^^ expected trait `Send`, found trait `Bar` @@ -65,7 +65,7 @@ LL | let _: &dyn Send = bar; found reference `&dyn Bar` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:66:24 + --> $DIR/invalid-upcast.rs:64:24 | LL | let _: &dyn Sync = bar; | --------- ^^^ expected trait `Sync`, found trait `Bar` @@ -76,7 +76,7 @@ LL | let _: &dyn Sync = bar; found reference `&dyn Bar` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:69:25 + --> $DIR/invalid-upcast.rs:67:25 | LL | let foo: &dyn Foo = baz; | -------- ^^^ expected trait `Foo`, found trait `Baz` @@ -87,7 +87,7 @@ LL | let foo: &dyn Foo = baz; found reference `&dyn Baz` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:71:35 + --> $DIR/invalid-upcast.rs:69:35 | LL | let _: &dyn std::fmt::Debug = foo; | -------------------- ^^^ expected trait `Debug`, found trait `Foo` @@ -98,7 +98,7 @@ LL | let _: &dyn std::fmt::Debug = foo; found reference `&dyn Foo` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:73:24 + --> $DIR/invalid-upcast.rs:71:24 | LL | let _: &dyn Send = foo; | --------- ^^^ expected trait `Send`, found trait `Foo` @@ -109,7 +109,7 @@ LL | let _: &dyn Send = foo; found reference `&dyn Foo` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:75:24 + --> $DIR/invalid-upcast.rs:73:24 | LL | let _: &dyn Sync = foo; | --------- ^^^ expected trait `Sync`, found trait `Foo` @@ -120,7 +120,7 @@ LL | let _: &dyn Sync = foo; found reference `&dyn Foo` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:78:25 + --> $DIR/invalid-upcast.rs:76:25 | LL | let foo: &dyn Foo = bar; | -------- ^^^ expected trait `Foo`, found trait `Bar` @@ -131,7 +131,7 @@ LL | let foo: &dyn Foo = bar; found reference `&dyn Bar` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:80:35 + --> $DIR/invalid-upcast.rs:78:35 | LL | let _: &dyn std::fmt::Debug = foo; | -------------------- ^^^ expected trait `Debug`, found trait `Foo` @@ -142,7 +142,7 @@ LL | let _: &dyn std::fmt::Debug = foo; found reference `&dyn Foo` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:82:24 + --> $DIR/invalid-upcast.rs:80:24 | LL | let _: &dyn Send = foo; | --------- ^^^ expected trait `Send`, found trait `Foo` @@ -153,7 +153,7 @@ LL | let _: &dyn Send = foo; found reference `&dyn Foo` error[E0308]: mismatched types - --> $DIR/invalid-upcast.rs:84:24 + --> $DIR/invalid-upcast.rs:82:24 | LL | let _: &dyn Sync = foo; | --------- ^^^ expected trait `Sync`, found trait `Foo` diff --git a/tests/ui/traits/trait-upcasting/issue-11515-upcast-fn_mut-fn.rs b/tests/ui/traits/trait-upcasting/issue-11515-upcast-fn_mut-fn.rs index ef3d366c381..8bf32efbe2e 100644 --- a/tests/ui/traits/trait-upcasting/issue-11515-upcast-fn_mut-fn.rs +++ b/tests/ui/traits/trait-upcasting/issue-11515-upcast-fn_mut-fn.rs @@ -1,5 +1,4 @@ //@ run-pass -#![feature(trait_upcasting)] struct Test { func: Box<dyn FnMut() + 'static>, diff --git a/tests/ui/traits/trait-upcasting/issue-11515.current.stderr b/tests/ui/traits/trait-upcasting/issue-11515.current.stderr deleted file mode 100644 index 8ce7d46012f..00000000000 --- a/tests/ui/traits/trait-upcasting/issue-11515.current.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0658]: cannot cast `dyn Fn()` to `dyn FnMut()`, trait upcasting coercion is experimental - --> $DIR/issue-11515.rs:11:38 - | -LL | let test = Box::new(Test { func: closure }); - | ^^^^^^^ - | - = note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information - = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = note: required when coercing `Box<(dyn Fn() + 'static)>` into `Box<(dyn FnMut() + 'static)>` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/traits/trait-upcasting/issue-11515.next.stderr b/tests/ui/traits/trait-upcasting/issue-11515.next.stderr deleted file mode 100644 index 8ce7d46012f..00000000000 --- a/tests/ui/traits/trait-upcasting/issue-11515.next.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0658]: cannot cast `dyn Fn()` to `dyn FnMut()`, trait upcasting coercion is experimental - --> $DIR/issue-11515.rs:11:38 - | -LL | let test = Box::new(Test { func: closure }); - | ^^^^^^^ - | - = note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information - = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = note: required when coercing `Box<(dyn Fn() + 'static)>` into `Box<(dyn FnMut() + 'static)>` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/traits/trait-upcasting/issue-11515.rs b/tests/ui/traits/trait-upcasting/issue-11515.rs index d251e804c3e..3b1f0a19cb9 100644 --- a/tests/ui/traits/trait-upcasting/issue-11515.rs +++ b/tests/ui/traits/trait-upcasting/issue-11515.rs @@ -1,3 +1,4 @@ +//@ check-pass //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver @@ -8,5 +9,5 @@ struct Test { fn main() { let closure: Box<dyn Fn() + 'static> = Box::new(|| ()); - let test = Box::new(Test { func: closure }); //~ ERROR trait upcasting coercion is experimental [E0658] + let test = Box::new(Test { func: closure }); } diff --git a/tests/ui/traits/trait-upcasting/lifetime.rs b/tests/ui/traits/trait-upcasting/lifetime.rs index ab006f8bedc..a3cbfd777a0 100644 --- a/tests/ui/traits/trait-upcasting/lifetime.rs +++ b/tests/ui/traits/trait-upcasting/lifetime.rs @@ -1,7 +1,5 @@ //@ run-pass -#![feature(trait_upcasting)] - trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync { fn a(&self) -> i32 { 10 diff --git a/tests/ui/traits/trait-upcasting/lifetime.stderr b/tests/ui/traits/trait-upcasting/lifetime.stderr index ca8f9cf63f3..589e9816d5a 100644 --- a/tests/ui/traits/trait-upcasting/lifetime.stderr +++ b/tests/ui/traits/trait-upcasting/lifetime.stderr @@ -1,5 +1,5 @@ warning: methods `z` and `y` are never used - --> $DIR/lifetime.rs:10:8 + --> $DIR/lifetime.rs:8:8 | LL | trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync { | --- methods in this trait @@ -13,7 +13,7 @@ LL | fn y(&self) -> i32 { = note: `#[warn(dead_code)]` on by default warning: method `w` is never used - --> $DIR/lifetime.rs:24:8 + --> $DIR/lifetime.rs:22:8 | LL | trait Bar: Foo { | --- method in this trait diff --git a/tests/ui/traits/trait-upcasting/migrate-lint-deny-regions.rs b/tests/ui/traits/trait-upcasting/migrate-lint-deny-regions.rs index da1a9cc2775..d33d3bfd5dc 100644 --- a/tests/ui/traits/trait-upcasting/migrate-lint-deny-regions.rs +++ b/tests/ui/traits/trait-upcasting/migrate-lint-deny-regions.rs @@ -1,4 +1,5 @@ -#![deny(deref_into_dyn_supertrait)] +//@ check-pass +#![warn(deref_into_dyn_supertrait)] use std::ops::Deref; @@ -6,8 +7,7 @@ trait Bar<'a> {} trait Foo<'a>: Bar<'a> {} impl<'a> Deref for dyn Foo<'a> { - //~^ ERROR this `Deref` implementation is covered by an implicit supertrait coercion - //~| WARN this will change its meaning in a future release! + //~^ warn: this `Deref` implementation is covered by an implicit supertrait coercion type Target = dyn Bar<'a>; fn deref(&self) -> &Self::Target { diff --git a/tests/ui/traits/trait-upcasting/migrate-lint-deny-regions.stderr b/tests/ui/traits/trait-upcasting/migrate-lint-deny-regions.stderr index a5f3660d4bc..806c57e44a2 100644 --- a/tests/ui/traits/trait-upcasting/migrate-lint-deny-regions.stderr +++ b/tests/ui/traits/trait-upcasting/migrate-lint-deny-regions.stderr @@ -1,19 +1,17 @@ -error: this `Deref` implementation is covered by an implicit supertrait coercion - --> $DIR/migrate-lint-deny-regions.rs:8:1 +warning: this `Deref` implementation is covered by an implicit supertrait coercion + --> $DIR/migrate-lint-deny-regions.rs:9:1 | LL | impl<'a> Deref for dyn Foo<'a> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Foo<'_>` implements `Deref<Target = dyn Bar<'_>>` which conflicts with supertrait `Bar<'_>` -... +LL | LL | type Target = dyn Bar<'a>; | -------------------------- target type is a supertrait of `dyn Foo<'_>` | - = warning: this will change its meaning in a future release! - = note: for more information, see issue #89460 <https://github.com/rust-lang/rust/issues/89460> note: the lint level is defined here - --> $DIR/migrate-lint-deny-regions.rs:1:9 + --> $DIR/migrate-lint-deny-regions.rs:2:9 | -LL | #![deny(deref_into_dyn_supertrait)] +LL | #![warn(deref_into_dyn_supertrait)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +warning: 1 warning emitted diff --git a/tests/ui/traits/trait-upcasting/migrate-lint-deny.rs b/tests/ui/traits/trait-upcasting/migrate-lint-deny.rs deleted file mode 100644 index 926b3649e01..00000000000 --- a/tests/ui/traits/trait-upcasting/migrate-lint-deny.rs +++ /dev/null @@ -1,25 +0,0 @@ -#![deny(deref_into_dyn_supertrait)] - -use std::ops::Deref; - -// issue 89190 -trait A {} -trait B: A {} - -impl<'a> Deref for dyn 'a + B { - //~^ ERROR this `Deref` implementation is covered by an implicit supertrait coercion - //~| WARN this will change its meaning in a future release! - - type Target = dyn A; - fn deref(&self) -> &Self::Target { - todo!() - } -} - -fn take_a(_: &dyn A) {} - -fn whoops(b: &dyn B) { - take_a(b) -} - -fn main() {} diff --git a/tests/ui/traits/trait-upcasting/migrate-lint-deny.stderr b/tests/ui/traits/trait-upcasting/migrate-lint-deny.stderr deleted file mode 100644 index 29997a9b3d9..00000000000 --- a/tests/ui/traits/trait-upcasting/migrate-lint-deny.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error: this `Deref` implementation is covered by an implicit supertrait coercion - --> $DIR/migrate-lint-deny.rs:9:1 - | -LL | impl<'a> Deref for dyn 'a + B { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn B` implements `Deref<Target = dyn A>` which conflicts with supertrait `A` -... -LL | type Target = dyn A; - | -------------------- target type is a supertrait of `dyn B` - | - = warning: this will change its meaning in a future release! - = note: for more information, see issue #89460 <https://github.com/rust-lang/rust/issues/89460> -note: the lint level is defined here - --> $DIR/migrate-lint-deny.rs:1:9 - | -LL | #![deny(deref_into_dyn_supertrait)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/traits/trait-upcasting/migrate-lint-different-substs.rs b/tests/ui/traits/trait-upcasting/migrate-lint-different-substs.rs index 8e62c4b95b0..20806f22886 100644 --- a/tests/ui/traits/trait-upcasting/migrate-lint-different-substs.rs +++ b/tests/ui/traits/trait-upcasting/migrate-lint-different-substs.rs @@ -1,4 +1,5 @@ //@ check-pass +#![warn(deref_into_dyn_supertrait)] use std::ops::Deref; @@ -9,8 +10,7 @@ trait Foo: Bar<i32> { } impl<'a> Deref for dyn Foo + 'a { - //~^ WARN this `Deref` implementation is covered by an implicit supertrait coercion - //~| WARN this will change its meaning in a future release! + //~^ warn: this `Deref` implementation is covered by an implicit supertrait coercion type Target = dyn Bar<u32> + 'a; fn deref(&self) -> &Self::Target { diff --git a/tests/ui/traits/trait-upcasting/migrate-lint-different-substs.stderr b/tests/ui/traits/trait-upcasting/migrate-lint-different-substs.stderr index 6245da5a176..86cff5233ff 100644 --- a/tests/ui/traits/trait-upcasting/migrate-lint-different-substs.stderr +++ b/tests/ui/traits/trait-upcasting/migrate-lint-different-substs.stderr @@ -1,15 +1,17 @@ warning: this `Deref` implementation is covered by an implicit supertrait coercion - --> $DIR/migrate-lint-different-substs.rs:11:1 + --> $DIR/migrate-lint-different-substs.rs:12:1 | LL | impl<'a> Deref for dyn Foo + 'a { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Foo` implements `Deref<Target = dyn Bar<u32>>` which conflicts with supertrait `Bar<i32>` -... +LL | LL | type Target = dyn Bar<u32> + 'a; | -------------------------------- target type is a supertrait of `dyn Foo` | - = warning: this will change its meaning in a future release! - = note: for more information, see issue #89460 <https://github.com/rust-lang/rust/issues/89460> - = note: `#[warn(deref_into_dyn_supertrait)]` on by default +note: the lint level is defined here + --> $DIR/migrate-lint-different-substs.rs:2:9 + | +LL | #![warn(deref_into_dyn_supertrait)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: 1 warning emitted diff --git a/tests/ui/traits/trait-upcasting/mono-impossible.rs b/tests/ui/traits/trait-upcasting/mono-impossible.rs new file mode 100644 index 00000000000..f19f0538efa --- /dev/null +++ b/tests/ui/traits/trait-upcasting/mono-impossible.rs @@ -0,0 +1,24 @@ +//@ build-pass + +trait Supertrait<T> { + fn method(&self) {} +} +impl<T> Supertrait<T> for () {} + +trait WithAssoc { + type Assoc; +} +trait Trait<P: WithAssoc>: Supertrait<P::Assoc> + Supertrait<()> {} + +fn upcast<P>(x: &dyn Trait<P>) -> &dyn Supertrait<()> { + x +} + +fn call<P>(x: &dyn Trait<P>) { + x.method(); +} + +fn main() { + println!("{:p}", upcast::<()> as *const ()); + println!("{:p}", call::<()> as *const ()); +} diff --git a/tests/ui/traits/trait-upcasting/multiple-occurrence-ambiguousity.rs b/tests/ui/traits/trait-upcasting/multiple-occurrence-ambiguousity.rs index 754437a3bec..0bf0d14c259 100644 --- a/tests/ui/traits/trait-upcasting/multiple-occurrence-ambiguousity.rs +++ b/tests/ui/traits/trait-upcasting/multiple-occurrence-ambiguousity.rs @@ -1,5 +1,4 @@ //@ check-fail -#![feature(trait_upcasting)] trait Bar<T> { fn bar(&self, _: T) {} diff --git a/tests/ui/traits/trait-upcasting/multiple-occurrence-ambiguousity.stderr b/tests/ui/traits/trait-upcasting/multiple-occurrence-ambiguousity.stderr index 70ba1fcaf38..c888ccc1ebb 100644 --- a/tests/ui/traits/trait-upcasting/multiple-occurrence-ambiguousity.stderr +++ b/tests/ui/traits/trait-upcasting/multiple-occurrence-ambiguousity.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/multiple-occurrence-ambiguousity.rs:20:26 + --> $DIR/multiple-occurrence-ambiguousity.rs:19:26 | LL | let t: &dyn Bar<_> = s; | ----------- ^ expected trait `Bar`, found trait `Foo` diff --git a/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-binder-vtable.rs b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-binder-vtable.rs new file mode 100644 index 00000000000..796ddec46ac --- /dev/null +++ b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-binder-vtable.rs @@ -0,0 +1,27 @@ +#![feature(rustc_attrs)] + +// Test for <https://github.com/rust-lang/rust/issues/135316>. + +trait Supertrait<T> { + fn _print_numbers(&self, mem: &[usize; 100]) { + } +} +impl<T> Supertrait<T> for () {} + +trait Trait<T, U>: Supertrait<T> + Supertrait<U> { + fn say_hello(&self, _: &usize) { + } +} +impl<T, U> Trait<T, U> for () {} + +// We should observe compatibility between these two vtables. + +#[rustc_dump_vtable] +type First = dyn for<'a> Trait<&'static (), &'a ()>; +//~^ ERROR vtable entries + +#[rustc_dump_vtable] +type Second = dyn Trait<&'static (), &'static ()>; +//~^ ERROR vtable entries + +fn main() {} diff --git a/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-binder-vtable.stderr b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-binder-vtable.stderr new file mode 100644 index 00000000000..24fa1650ca1 --- /dev/null +++ b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-binder-vtable.stderr @@ -0,0 +1,26 @@ +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(<dyn for<'a> Trait<&(), &'a ()> as Supertrait<&()>>::_print_numbers - shim(reify)), + Method(<dyn for<'a> Trait<&(), &'a ()> as Trait<&(), &()>>::say_hello - shim(reify)), + ] + --> $DIR/multiple-supertraits-modulo-binder-vtable.rs:20:1 + | +LL | type First = dyn for<'a> Trait<&'static (), &'a ()>; + | ^^^^^^^^^^ + +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(<dyn Trait<&(), &()> as Supertrait<&()>>::_print_numbers - shim(reify)), + Method(<dyn Trait<&(), &()> as Trait<&(), &()>>::say_hello - shim(reify)), + ] + --> $DIR/multiple-supertraits-modulo-binder-vtable.rs:24:1 + | +LL | type Second = dyn Trait<&'static (), &'static ()>; + | ^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-binder.rs b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-binder.rs new file mode 100644 index 00000000000..a0bb1c57adb --- /dev/null +++ b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-binder.rs @@ -0,0 +1,24 @@ +// Test for <https://github.com/rust-lang/rust/issues/135316>. +// +//@ run-pass +//@ check-run-results + +trait Supertrait<T> { + fn _print_numbers(&self, mem: &[usize; 100]) { + println!("{mem:?}"); + } +} +impl<T> Supertrait<T> for () {} + +trait Trait<T, U>: Supertrait<T> + Supertrait<U> { + fn say_hello(&self, _: &usize) { + println!("Hello!"); + } +} +impl<T, U> Trait<T, U> for () {} + +fn main() { + (&() as &'static dyn for<'a> Trait<&'static (), &'a ()> + as &'static dyn Trait<&'static (), &'static ()>) + .say_hello(&0); +} diff --git a/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-binder.run.stdout b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-binder.run.stdout new file mode 100644 index 00000000000..10ddd6d257e --- /dev/null +++ b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-binder.run.stdout @@ -0,0 +1 @@ +Hello! diff --git a/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-normalization-vtable.rs b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-normalization-vtable.rs new file mode 100644 index 00000000000..6b9ddf9bedc --- /dev/null +++ b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-normalization-vtable.rs @@ -0,0 +1,36 @@ +#![feature(rustc_attrs)] + +// Test for <https://github.com/rust-lang/rust/issues/135315>. + +trait Supertrait<T> { + fn _print_numbers(&self, mem: &[usize; 100]) { + println!("{mem:?}"); + } +} +impl<T> Supertrait<T> for () {} + +trait Identity { + type Selff; +} +impl<Selff> Identity for Selff { + type Selff = Selff; +} + +trait Middle<T>: Supertrait<()> + Supertrait<T> { + fn say_hello(&self, _: &usize) { + println!("Hello!"); + } +} +impl<T> Middle<T> for () {} + +trait Trait: Middle<<() as Identity>::Selff> {} + +#[rustc_dump_vtable] +impl Trait for () {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] +type Virtual = dyn Middle<()>; +//~^ ERROR vtable entries + +fn main() {} diff --git a/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-normalization-vtable.stderr b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-normalization-vtable.stderr new file mode 100644 index 00000000000..04b1afae7be --- /dev/null +++ b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-normalization-vtable.stderr @@ -0,0 +1,26 @@ +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(<() as Supertrait<()>>::_print_numbers), + Method(<() as Middle<()>>::say_hello), + ] + --> $DIR/multiple-supertraits-modulo-normalization-vtable.rs:29:1 + | +LL | impl Trait for () {} + | ^^^^^^^^^^^^^^^^^ + +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(<dyn Middle<()> as Supertrait<()>>::_print_numbers - shim(reify)), + Method(<dyn Middle<()> as Middle<()>>::say_hello - shim(reify)), + ] + --> $DIR/multiple-supertraits-modulo-normalization-vtable.rs:33:1 + | +LL | type Virtual = dyn Middle<()>; + | ^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-normalization.rs b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-normalization.rs new file mode 100644 index 00000000000..08ec49971ac --- /dev/null +++ b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-normalization.rs @@ -0,0 +1,32 @@ +// Test for <https://github.com/rust-lang/rust/issues/135315>. +// +//@ run-pass +//@ check-run-results + +trait Supertrait<T> { + fn _print_numbers(&self, mem: &[usize; 100]) { + println!("{mem:?}"); + } +} +impl<T> Supertrait<T> for () {} + +trait Identity { + type Selff; +} +impl<Selff> Identity for Selff { + type Selff = Selff; +} + +trait Middle<T>: Supertrait<()> + Supertrait<T> { + fn say_hello(&self, _: &usize) { + println!("Hello!"); + } +} +impl<T> Middle<T> for () {} + +trait Trait: Middle<<() as Identity>::Selff> {} +impl Trait for () {} + +fn main() { + (&() as &dyn Trait as &dyn Middle<()>).say_hello(&0); +} diff --git a/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-normalization.run.stdout b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-normalization.run.stdout new file mode 100644 index 00000000000..10ddd6d257e --- /dev/null +++ b/tests/ui/traits/trait-upcasting/multiple-supertraits-modulo-normalization.run.stdout @@ -0,0 +1 @@ +Hello! diff --git a/tests/ui/traits/trait-upcasting/normalization.rs b/tests/ui/traits/trait-upcasting/normalization.rs index ae5a6a5243c..b714479961f 100644 --- a/tests/ui/traits/trait-upcasting/normalization.rs +++ b/tests/ui/traits/trait-upcasting/normalization.rs @@ -4,8 +4,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(trait_upcasting)] - trait Mirror { type Assoc; } diff --git a/tests/ui/traits/trait-upcasting/prefer-lower-candidates.rs b/tests/ui/traits/trait-upcasting/prefer-lower-candidates.rs index 4bc59b09fb5..09557ba0260 100644 --- a/tests/ui/traits/trait-upcasting/prefer-lower-candidates.rs +++ b/tests/ui/traits/trait-upcasting/prefer-lower-candidates.rs @@ -6,8 +6,6 @@ // Ensure we don't have ambiguity when upcasting to two supertraits // that are identical modulo normalization. -#![feature(trait_upcasting)] - trait Supertrait<T> { fn method(&self) {} } diff --git a/tests/ui/traits/trait-upcasting/replace-vptr.rs b/tests/ui/traits/trait-upcasting/replace-vptr.rs index 4829e3c5c12..6ca5864669b 100644 --- a/tests/ui/traits/trait-upcasting/replace-vptr.rs +++ b/tests/ui/traits/trait-upcasting/replace-vptr.rs @@ -1,7 +1,5 @@ //@ run-pass -#![feature(trait_upcasting)] - trait A { fn foo_a(&self); //~ WARN method `foo_a` is never used } diff --git a/tests/ui/traits/trait-upcasting/replace-vptr.stderr b/tests/ui/traits/trait-upcasting/replace-vptr.stderr index 823094761b3..1a8bfd1bfa6 100644 --- a/tests/ui/traits/trait-upcasting/replace-vptr.stderr +++ b/tests/ui/traits/trait-upcasting/replace-vptr.stderr @@ -1,5 +1,5 @@ warning: method `foo_a` is never used - --> $DIR/replace-vptr.rs:6:8 + --> $DIR/replace-vptr.rs:4:8 | LL | trait A { | - method in this trait @@ -9,7 +9,7 @@ LL | fn foo_a(&self); = note: `#[warn(dead_code)]` on by default warning: method `foo_c` is never used - --> $DIR/replace-vptr.rs:14:8 + --> $DIR/replace-vptr.rs:12:8 | LL | trait C: A + B { | - method in this trait diff --git a/tests/ui/traits/trait-upcasting/struct.rs b/tests/ui/traits/trait-upcasting/struct.rs index 39da20259a0..51e6f006fbf 100644 --- a/tests/ui/traits/trait-upcasting/struct.rs +++ b/tests/ui/traits/trait-upcasting/struct.rs @@ -1,7 +1,5 @@ //@ run-pass -#![feature(trait_upcasting)] - use std::rc::Rc; use std::sync::Arc; diff --git a/tests/ui/traits/trait-upcasting/subtrait-method.rs b/tests/ui/traits/trait-upcasting/subtrait-method.rs index 136d15af0e8..20277280440 100644 --- a/tests/ui/traits/trait-upcasting/subtrait-method.rs +++ b/tests/ui/traits/trait-upcasting/subtrait-method.rs @@ -1,5 +1,3 @@ -#![feature(trait_upcasting)] - trait Foo: PartialEq<i32> + std::fmt::Debug + Send + Sync { fn a(&self) -> i32 { 10 diff --git a/tests/ui/traits/trait-upcasting/subtrait-method.stderr b/tests/ui/traits/trait-upcasting/subtrait-method.stderr index 0408be6986b..a16daa11d6f 100644 --- a/tests/ui/traits/trait-upcasting/subtrait-method.stderr +++ b/tests/ui/traits/trait-upcasting/subtrait-method.stderr @@ -1,87 +1,92 @@ error[E0599]: no method named `c` found for reference `&dyn Bar` in the current scope - --> $DIR/subtrait-method.rs:55:9 + --> $DIR/subtrait-method.rs:53:9 | LL | bar.c(); | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Baz` defines an item `c`, perhaps you need to implement it - --> $DIR/subtrait-method.rs:27:1 + --> $DIR/subtrait-method.rs:25:1 | LL | trait Baz: Bar { | ^^^^^^^^^^^^^^ help: there is a method `a` with a similar name | -LL | bar.a(); - | ~ +LL - bar.c(); +LL + bar.a(); + | error[E0599]: no method named `b` found for reference `&dyn Foo` in the current scope - --> $DIR/subtrait-method.rs:59:9 + --> $DIR/subtrait-method.rs:57:9 | LL | foo.b(); | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Bar` defines an item `b`, perhaps you need to implement it - --> $DIR/subtrait-method.rs:17:1 + --> $DIR/subtrait-method.rs:15:1 | LL | trait Bar: Foo { | ^^^^^^^^^^^^^^ help: there is a method `a` with a similar name | -LL | foo.a(); - | ~ +LL - foo.b(); +LL + foo.a(); + | error[E0599]: no method named `c` found for reference `&dyn Foo` in the current scope - --> $DIR/subtrait-method.rs:61:9 + --> $DIR/subtrait-method.rs:59:9 | LL | foo.c(); | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Baz` defines an item `c`, perhaps you need to implement it - --> $DIR/subtrait-method.rs:27:1 + --> $DIR/subtrait-method.rs:25:1 | LL | trait Baz: Bar { | ^^^^^^^^^^^^^^ help: there is a method `a` with a similar name | -LL | foo.a(); - | ~ +LL - foo.c(); +LL + foo.a(); + | error[E0599]: no method named `b` found for reference `&dyn Foo` in the current scope - --> $DIR/subtrait-method.rs:65:9 + --> $DIR/subtrait-method.rs:63:9 | LL | foo.b(); | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Bar` defines an item `b`, perhaps you need to implement it - --> $DIR/subtrait-method.rs:17:1 + --> $DIR/subtrait-method.rs:15:1 | LL | trait Bar: Foo { | ^^^^^^^^^^^^^^ help: there is a method `a` with a similar name | -LL | foo.a(); - | ~ +LL - foo.b(); +LL + foo.a(); + | error[E0599]: no method named `c` found for reference `&dyn Foo` in the current scope - --> $DIR/subtrait-method.rs:67:9 + --> $DIR/subtrait-method.rs:65:9 | LL | foo.c(); | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Baz` defines an item `c`, perhaps you need to implement it - --> $DIR/subtrait-method.rs:27:1 + --> $DIR/subtrait-method.rs:25:1 | LL | trait Baz: Bar { | ^^^^^^^^^^^^^^ help: there is a method `a` with a similar name | -LL | foo.a(); - | ~ +LL - foo.c(); +LL + foo.a(); + | error: aborting due to 5 previous errors diff --git a/tests/ui/traits/trait-upcasting/supertraits-modulo-inner-binder.rs b/tests/ui/traits/trait-upcasting/supertraits-modulo-inner-binder.rs new file mode 100644 index 00000000000..e65cb60d993 --- /dev/null +++ b/tests/ui/traits/trait-upcasting/supertraits-modulo-inner-binder.rs @@ -0,0 +1,28 @@ +//@ run-pass + +trait Super<U> { + fn call(&self) + where + U: HigherRanked, + { + } +} + +impl<T> Super<T> for () {} + +trait HigherRanked {} +impl HigherRanked for for<'a> fn(&'a ()) {} + +trait Unimplemented {} +impl<T: Unimplemented> HigherRanked for T {} + +trait Sub: Super<fn(&'static ())> + Super<for<'a> fn(&'a ())> {} +impl Sub for () {} + +fn main() { + let a: &dyn Sub = &(); + // `Super<fn(&'static ())>` and `Super<for<'a> fn(&'a ())>` have different + // vtables and we need to upcast to the latter! + let b: &dyn Super<for<'a> fn(&'a ())> = a; + b.call(); +} diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-1.current.stderr b/tests/ui/traits/trait-upcasting/type-checking-test-1.current.stderr index 9a9ad9bbf77..2f27d1522a6 100644 --- a/tests/ui/traits/trait-upcasting/type-checking-test-1.current.stderr +++ b/tests/ui/traits/trait-upcasting/type-checking-test-1.current.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `&dyn Foo` as `&dyn Bar<_>` - --> $DIR/type-checking-test-1.rs:20:13 + --> $DIR/type-checking-test-1.rs:18:13 | LL | let _ = x as &dyn Bar<_>; // Ambiguous | ^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-1.next.stderr b/tests/ui/traits/trait-upcasting/type-checking-test-1.next.stderr index 9a9ad9bbf77..2f27d1522a6 100644 --- a/tests/ui/traits/trait-upcasting/type-checking-test-1.next.stderr +++ b/tests/ui/traits/trait-upcasting/type-checking-test-1.next.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `&dyn Foo` as `&dyn Bar<_>` - --> $DIR/type-checking-test-1.rs:20:13 + --> $DIR/type-checking-test-1.rs:18:13 | LL | let _ = x as &dyn Bar<_>; // Ambiguous | ^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-1.rs b/tests/ui/traits/trait-upcasting/type-checking-test-1.rs index fd902fd87e0..b06f5e04528 100644 --- a/tests/ui/traits/trait-upcasting/type-checking-test-1.rs +++ b/tests/ui/traits/trait-upcasting/type-checking-test-1.rs @@ -2,8 +2,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(trait_upcasting)] - trait Foo: Bar<i32> + Bar<u32> {} trait Bar<T> { fn bar(&self) -> Option<T> { diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-2.rs b/tests/ui/traits/trait-upcasting/type-checking-test-2.rs index b024b27750b..b4df0f5a902 100644 --- a/tests/ui/traits/trait-upcasting/type-checking-test-2.rs +++ b/tests/ui/traits/trait-upcasting/type-checking-test-2.rs @@ -1,5 +1,3 @@ -#![feature(trait_upcasting)] - trait Foo<T>: Bar<i32> + Bar<T> {} trait Bar<T> { fn bar(&self) -> Option<T> { diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-2.stderr b/tests/ui/traits/trait-upcasting/type-checking-test-2.stderr index 3e59b9d3363..f84ea93dc67 100644 --- a/tests/ui/traits/trait-upcasting/type-checking-test-2.stderr +++ b/tests/ui/traits/trait-upcasting/type-checking-test-2.stderr @@ -1,11 +1,11 @@ error[E0605]: non-primitive cast: `&dyn Foo<i32>` as `&dyn Bar<u32>` - --> $DIR/type-checking-test-2.rs:19:13 + --> $DIR/type-checking-test-2.rs:17:13 | LL | let _ = x as &dyn Bar<u32>; // Error | ^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object error[E0605]: non-primitive cast: `&dyn Foo<u32>` as `&dyn Bar<_>` - --> $DIR/type-checking-test-2.rs:24:13 + --> $DIR/type-checking-test-2.rs:22:13 | LL | let a = x as &dyn Bar<_>; // Ambiguous | ^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-3.rs b/tests/ui/traits/trait-upcasting/type-checking-test-3.rs index b2db3a12797..3685569d98d 100644 --- a/tests/ui/traits/trait-upcasting/type-checking-test-3.rs +++ b/tests/ui/traits/trait-upcasting/type-checking-test-3.rs @@ -1,5 +1,3 @@ -#![feature(trait_upcasting)] - trait Foo<'a>: Bar<'a> {} trait Bar<'a> {} diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-3.stderr b/tests/ui/traits/trait-upcasting/type-checking-test-3.stderr index 01b8da645f3..d80649638ae 100644 --- a/tests/ui/traits/trait-upcasting/type-checking-test-3.stderr +++ b/tests/ui/traits/trait-upcasting/type-checking-test-3.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/type-checking-test-3.rs:11:13 + --> $DIR/type-checking-test-3.rs:9:13 | LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) { | -- lifetime `'a` defined here @@ -7,7 +7,7 @@ LL | let _ = x as &dyn Bar<'a>; // Error | ^^^^^^^^^^^^^^^^^ cast requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/type-checking-test-3.rs:16:18 + --> $DIR/type-checking-test-3.rs:14:18 | LL | fn test_wrong2<'a>(x: &dyn Foo<'a>) { | -- lifetime `'a` defined here diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-4.rs b/tests/ui/traits/trait-upcasting/type-checking-test-4.rs index 01759ec7a93..20de722ee9b 100644 --- a/tests/ui/traits/trait-upcasting/type-checking-test-4.rs +++ b/tests/ui/traits/trait-upcasting/type-checking-test-4.rs @@ -1,5 +1,3 @@ -#![feature(trait_upcasting)] - trait Foo<'a>: Bar<'a, 'a> {} trait Bar<'a, 'b> { fn get_b(&self) -> Option<&'a u32> { diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-4.stderr b/tests/ui/traits/trait-upcasting/type-checking-test-4.stderr index e91ea193a01..55a5e4cd497 100644 --- a/tests/ui/traits/trait-upcasting/type-checking-test-4.stderr +++ b/tests/ui/traits/trait-upcasting/type-checking-test-4.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/type-checking-test-4.rs:19:13 + --> $DIR/type-checking-test-4.rs:17:13 | LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) { | -- lifetime `'a` defined here @@ -7,7 +7,7 @@ LL | let _ = x as &dyn Bar<'static, 'a>; // Error | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cast requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/type-checking-test-4.rs:24:18 + --> $DIR/type-checking-test-4.rs:22:18 | LL | fn test_wrong2<'a>(x: &dyn Foo<'static>, y: &'a u32) { | -- lifetime `'a` defined here @@ -15,7 +15,7 @@ LL | let _ = x as &dyn Bar<'a, 'static>; // Error | ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/type-checking-test-4.rs:30:5 + --> $DIR/type-checking-test-4.rs:28:5 | LL | fn test_wrong3<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | y.get_b() // ERROR | ^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/type-checking-test-4.rs:35:5 + --> $DIR/type-checking-test-4.rs:33:5 | LL | fn test_wrong4<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> { | -- lifetime `'a` defined here @@ -32,7 +32,7 @@ LL | <_ as Bar>::get_b(x) // ERROR | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/type-checking-test-4.rs:40:5 + --> $DIR/type-checking-test-4.rs:38:5 | LL | fn test_wrong5<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> { | -- lifetime `'a` defined here @@ -40,7 +40,7 @@ LL | <_ as Bar<'_, '_>>::get_b(x) // ERROR | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough - --> $DIR/type-checking-test-4.rs:48:5 + --> $DIR/type-checking-test-4.rs:46:5 | LL | fn test_wrong6<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> { | -- lifetime `'a` defined here diff --git a/tests/ui/traits/trait-upcasting/type-checking-test-opaques.rs b/tests/ui/traits/trait-upcasting/type-checking-test-opaques.rs index a3a1ce29465..ab3817da28b 100644 --- a/tests/ui/traits/trait-upcasting/type-checking-test-opaques.rs +++ b/tests/ui/traits/trait-upcasting/type-checking-test-opaques.rs @@ -1,4 +1,4 @@ -#![feature(trait_upcasting, type_alias_impl_trait)] +#![feature(type_alias_impl_trait)] //@ check-pass diff --git a/tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs b/tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs index 07f1549e177..0548eda0468 100644 --- a/tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs +++ b/tests/ui/traits/trait-upcasting/upcast-defining-opaque.rs @@ -3,7 +3,7 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@check-pass -#![feature(trait_upcasting, type_alias_impl_trait)] +#![feature(type_alias_impl_trait)] trait Super { type Assoc; diff --git a/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.current.stderr b/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.current.stderr deleted file mode 100644 index 239f8279194..00000000000 --- a/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.current.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0658]: cannot cast `dyn A` to `dyn B`, trait upcasting coercion is experimental - --> $DIR/upcast-through-struct-tail.rs:11:5 - | -LL | x - | ^ - | - = note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information - = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = note: required when coercing `Box<Wrapper<(dyn A + 'a)>>` into `Box<Wrapper<(dyn B + 'a)>>` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.next.stderr b/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.next.stderr deleted file mode 100644 index 239f8279194..00000000000 --- a/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.next.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0658]: cannot cast `dyn A` to `dyn B`, trait upcasting coercion is experimental - --> $DIR/upcast-through-struct-tail.rs:11:5 - | -LL | x - | ^ - | - = note: see issue #65991 <https://github.com/rust-lang/rust/issues/65991> for more information - = help: add `#![feature(trait_upcasting)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = note: required when coercing `Box<Wrapper<(dyn A + 'a)>>` into `Box<Wrapper<(dyn B + 'a)>>` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.rs b/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.rs index e40cca4e0a8..dd4d91f8d4f 100644 --- a/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.rs +++ b/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.rs @@ -1,3 +1,4 @@ +//@ check-pass //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver @@ -9,7 +10,6 @@ trait B {} fn test<'a>(x: Box<Wrapper<dyn A + 'a>>) -> Box<Wrapper<dyn B + 'a>> { x - //~^ ERROR cannot cast `dyn A` to `dyn B`, trait upcasting coercion is experimental } fn main() {} diff --git a/tests/ui/traits/unsize-goal-escaping-bounds.current.stderr b/tests/ui/traits/unsize-goal-escaping-bounds.current.stderr new file mode 100644 index 00000000000..e63a0bf50b7 --- /dev/null +++ b/tests/ui/traits/unsize-goal-escaping-bounds.current.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `for<'a> (): Unsize<(dyn Trait + 'a)>` is not satisfied + --> $DIR/unsize-goal-escaping-bounds.rs:20:5 + | +LL | foo(); + | ^^^^^ the trait `for<'a> Unsize<(dyn Trait + 'a)>` is not implemented for `()` + | + = note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information +note: required by a bound in `foo` + --> $DIR/unsize-goal-escaping-bounds.rs:15:17 + | +LL | fn foo() + | --- required by a bound in this function +LL | where +LL | for<'a> (): Unsize<dyn Trait + 'a>, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/unsize-goal-escaping-bounds.rs b/tests/ui/traits/unsize-goal-escaping-bounds.rs new file mode 100644 index 00000000000..fb25f7a4239 --- /dev/null +++ b/tests/ui/traits/unsize-goal-escaping-bounds.rs @@ -0,0 +1,22 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@[next] check-pass +//@ ignore-compare-mode-next-solver (explicit revisions) + +#![feature(unsize)] + +use std::marker::Unsize; + +trait Trait {} +impl Trait for () {} + +fn foo() +where + for<'a> (): Unsize<dyn Trait + 'a>, +{ +} + +fn main() { + foo(); + //[current]~^ ERROR the trait bound `for<'a> (): Unsize<(dyn Trait + 'a)>` is not satisfied +} diff --git a/tests/ui/traits/upcast_reorder.rs b/tests/ui/traits/upcast_reorder.rs index 55e6ad4c368..43fc1517a3b 100644 --- a/tests/ui/traits/upcast_reorder.rs +++ b/tests/ui/traits/upcast_reorder.rs @@ -2,8 +2,6 @@ // // issue: <https://github.com/rust-lang/rust/issues/131813> -#![feature(trait_upcasting)] - trait Pollable { #[allow(unused)] fn poll(&self) {} diff --git a/tests/ui/traits/upcast_soundness_bug.rs b/tests/ui/traits/upcast_soundness_bug.rs index 0ddae1d1417..4c89fa135e7 100644 --- a/tests/ui/traits/upcast_soundness_bug.rs +++ b/tests/ui/traits/upcast_soundness_bug.rs @@ -1,4 +1,3 @@ -#![feature(trait_upcasting)] //@ check-fail // // issue: <https://github.com/rust-lang/rust/pull/120222> diff --git a/tests/ui/traits/upcast_soundness_bug.stderr b/tests/ui/traits/upcast_soundness_bug.stderr index 19d1a5e5926..f5fa6bdc999 100644 --- a/tests/ui/traits/upcast_soundness_bug.stderr +++ b/tests/ui/traits/upcast_soundness_bug.stderr @@ -1,5 +1,5 @@ error[E0606]: casting `*const dyn Trait<u8, u8>` as `*const dyn Trait<u8, u16>` is invalid - --> $DIR/upcast_soundness_bug.rs:59:13 + --> $DIR/upcast_soundness_bug.rs:58:13 | LL | let p = p as *const dyn Trait<u8, u16>; // <- this is bad! | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/traits/vtable/multiple-markers.rs b/tests/ui/traits/vtable/multiple-markers.rs index 8a9e7a006cf..8eba5135582 100644 --- a/tests/ui/traits/vtable/multiple-markers.rs +++ b/tests/ui/traits/vtable/multiple-markers.rs @@ -2,8 +2,7 @@ // // This test makes sure that multiple marker (method-less) traits can reuse the // same pointer for upcasting. -// -//@ build-fail + #![crate_type = "lib"] #![feature(rustc_attrs)] @@ -17,17 +16,13 @@ trait T { fn method(&self) {} } -#[rustc_dump_vtable] -trait A: M0 + M1 + M2 + T {} //~ error: vtable entries for `<S as A>`: +trait A: M0 + M1 + M2 + T {} -#[rustc_dump_vtable] -trait B: M0 + M1 + T + M2 {} //~ error: vtable entries for `<S as B>`: +trait B: M0 + M1 + T + M2 {} -#[rustc_dump_vtable] -trait C: M0 + T + M1 + M2 {} //~ error: vtable entries for `<S as C>`: +trait C: M0 + T + M1 + M2 {} -#[rustc_dump_vtable] -trait D: T + M0 + M1 + M2 {} //~ error: vtable entries for `<S as D>`: +trait D: T + M0 + M1 + M2 {} struct S; @@ -35,13 +30,21 @@ impl M0 for S {} impl M1 for S {} impl M2 for S {} impl T for S {} + +#[rustc_dump_vtable] impl A for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl B for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl C for S {} -impl D for S {} +//~^ ERROR vtable entries -pub fn require_vtables() { - fn require_vtables(_: &dyn A, _: &dyn B, _: &dyn C, _: &dyn D) {} +#[rustc_dump_vtable] +impl D for S {} +//~^ ERROR vtable entries - require_vtables(&S, &S, &S, &S) -} +fn main() {} diff --git a/tests/ui/traits/vtable/multiple-markers.stderr b/tests/ui/traits/vtable/multiple-markers.stderr index 36ac8b24eb5..35dd3c2516d 100644 --- a/tests/ui/traits/vtable/multiple-markers.stderr +++ b/tests/ui/traits/vtable/multiple-markers.stderr @@ -1,46 +1,46 @@ -error: vtable entries for `<S as A>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, Method(<S as T>::method), ] - --> $DIR/multiple-markers.rs:21:1 + --> $DIR/multiple-markers.rs:35:1 | -LL | trait A: M0 + M1 + M2 + T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl A for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as B>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, Method(<S as T>::method), ] - --> $DIR/multiple-markers.rs:24:1 + --> $DIR/multiple-markers.rs:39:1 | -LL | trait B: M0 + M1 + T + M2 {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl B for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as C>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, Method(<S as T>::method), ] - --> $DIR/multiple-markers.rs:27:1 + --> $DIR/multiple-markers.rs:43:1 | -LL | trait C: M0 + T + M1 + M2 {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl C for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as D>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, Method(<S as T>::method), ] - --> $DIR/multiple-markers.rs:30:1 + --> $DIR/multiple-markers.rs:47:1 | -LL | trait D: T + M0 + M1 + M2 {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl D for S {} + | ^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/tests/ui/traits/vtable/vtable-diamond.rs b/tests/ui/traits/vtable/vtable-diamond.rs index 2cfa86c526d..56053f6d026 100644 --- a/tests/ui/traits/vtable/vtable-diamond.rs +++ b/tests/ui/traits/vtable/vtable-diamond.rs @@ -1,44 +1,37 @@ -//@ build-fail #![feature(rustc_attrs)] -#[rustc_dump_vtable] trait A { fn foo_a(&self) {} } -#[rustc_dump_vtable] trait B: A { fn foo_b(&self) {} } -#[rustc_dump_vtable] trait C: A { - //~^ error vtable fn foo_c(&self) {} } -#[rustc_dump_vtable] trait D: B + C { - //~^ error vtable fn foo_d(&self) {} } struct S; +#[rustc_dump_vtable] impl A for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl B for S {} -impl C for S {} -impl D for S {} +//~^ ERROR vtable entries -fn foo(d: &dyn D) { - d.foo_d(); -} +#[rustc_dump_vtable] +impl C for S {} +//~^ ERROR vtable entries -fn bar(d: &dyn C) { - d.foo_c(); -} +#[rustc_dump_vtable] +impl D for S {} +//~^ ERROR vtable entries -fn main() { - foo(&S); - bar(&S); -} +fn main() {} diff --git a/tests/ui/traits/vtable/vtable-diamond.stderr b/tests/ui/traits/vtable/vtable-diamond.stderr index f3718c5d852..4644bf339b1 100644 --- a/tests/ui/traits/vtable/vtable-diamond.stderr +++ b/tests/ui/traits/vtable/vtable-diamond.stderr @@ -1,29 +1,52 @@ -error: vtable entries for `<S as D>`: [ +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(<S as A>::foo_a), + ] + --> $DIR/vtable-diamond.rs:22:1 + | +LL | impl A for S {} + | ^^^^^^^^^^^^ + +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, Method(<S as A>::foo_a), Method(<S as B>::foo_b), + ] + --> $DIR/vtable-diamond.rs:26:1 + | +LL | impl B for S {} + | ^^^^^^^^^^^^ + +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(<S as A>::foo_a), Method(<S as C>::foo_c), - TraitVPtr(<S as C>), - Method(<S as D>::foo_d), ] - --> $DIR/vtable-diamond.rs:21:1 + --> $DIR/vtable-diamond.rs:30:1 | -LL | trait D: B + C { - | ^^^^^^^^^^^^^^ +LL | impl C for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as C>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, Method(<S as A>::foo_a), + Method(<S as B>::foo_b), Method(<S as C>::foo_c), + TraitVPtr(<S as C>), + Method(<S as D>::foo_d), ] - --> $DIR/vtable-diamond.rs:15:1 + --> $DIR/vtable-diamond.rs:34:1 | -LL | trait C: A { - | ^^^^^^^^^^ +LL | impl D for S {} + | ^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors diff --git a/tests/ui/traits/vtable/vtable-dyn-incompatible.rs b/tests/ui/traits/vtable/vtable-dyn-incompatible.rs index 64a8138bdcf..fb19dec4ace 100644 --- a/tests/ui/traits/vtable/vtable-dyn-incompatible.rs +++ b/tests/ui/traits/vtable/vtable-dyn-incompatible.rs @@ -1,15 +1,16 @@ -//@ build-fail #![feature(rustc_attrs)] // Ensure that dyn-incompatible methods in Iterator does not generate // vtable entries. -#[rustc_dump_vtable] trait A: Iterator {} -//~^ error vtable impl<T> A for T where T: Iterator {} +#[rustc_dump_vtable] +type Test = dyn A<Item=u8>; +//~^ error vtable + fn foo(_a: &mut dyn A<Item=u8>) { } diff --git a/tests/ui/traits/vtable/vtable-dyn-incompatible.stderr b/tests/ui/traits/vtable/vtable-dyn-incompatible.stderr index e442c3eac00..c80a763998b 100644 --- a/tests/ui/traits/vtable/vtable-dyn-incompatible.stderr +++ b/tests/ui/traits/vtable/vtable-dyn-incompatible.stderr @@ -1,16 +1,16 @@ -error: vtable entries for `<std::vec::IntoIter<u8> as A>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, - Method(<std::vec::IntoIter<u8> as Iterator>::next), - Method(<std::vec::IntoIter<u8> as Iterator>::size_hint), - Method(<std::vec::IntoIter<u8> as Iterator>::advance_by), - Method(<std::vec::IntoIter<u8> as Iterator>::nth), + Method(<dyn A<Item = u8> as Iterator>::next - shim(reify)), + Method(<dyn A<Item = u8> as Iterator>::size_hint - shim(reify)), + Method(<dyn A<Item = u8> as Iterator>::advance_by - shim(reify)), + Method(<dyn A<Item = u8> as Iterator>::nth - shim(reify)), ] - --> $DIR/vtable-dyn-incompatible.rs:8:1 + --> $DIR/vtable-dyn-incompatible.rs:11:1 | -LL | trait A: Iterator {} - | ^^^^^^^^^^^^^^^^^ +LL | type Test = dyn A<Item=u8>; + | ^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/traits/vtable/vtable-multi-level.rs b/tests/ui/traits/vtable/vtable-multi-level.rs index bedbf84d303..67bac49f9f6 100644 --- a/tests/ui/traits/vtable/vtable-multi-level.rs +++ b/tests/ui/traits/vtable/vtable-multi-level.rs @@ -1,4 +1,3 @@ -//@ build-fail #![feature(rustc_attrs)] // O --> G --> C --> A @@ -10,134 +9,126 @@ // |-> M --> K // \-> L -#[rustc_dump_vtable] trait A { - //~^ error vtable fn foo_a(&self) {} } -#[rustc_dump_vtable] trait B { - //~^ error vtable fn foo_b(&self) {} } -#[rustc_dump_vtable] trait C: A + B { - //~^ error vtable fn foo_c(&self) {} } -#[rustc_dump_vtable] trait D { - //~^ error vtable fn foo_d(&self) {} } -#[rustc_dump_vtable] trait E { - //~^ error vtable fn foo_e(&self) {} } -#[rustc_dump_vtable] trait F: D + E { - //~^ error vtable fn foo_f(&self) {} } -#[rustc_dump_vtable] trait G: C + F { fn foo_g(&self) {} } -#[rustc_dump_vtable] trait H { - //~^ error vtable fn foo_h(&self) {} } -#[rustc_dump_vtable] trait I { - //~^ error vtable fn foo_i(&self) {} } -#[rustc_dump_vtable] trait J: H + I { - //~^ error vtable fn foo_j(&self) {} } -#[rustc_dump_vtable] trait K { - //~^ error vtable fn foo_k(&self) {} } -#[rustc_dump_vtable] trait L { - //~^ error vtable fn foo_l(&self) {} } -#[rustc_dump_vtable] trait M: K + L { - //~^ error vtable fn foo_m(&self) {} } -#[rustc_dump_vtable] trait N: J + M { - //~^ error vtable fn foo_n(&self) {} } -#[rustc_dump_vtable] trait O: G + N { - //~^ error vtable fn foo_o(&self) {} } struct S; +#[rustc_dump_vtable] impl A for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl B for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl C for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl D for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl E for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl F for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl G for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl H for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl I for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl J for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl K for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl L for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl M for S {} +//~^ ERROR vtable entries + +#[rustc_dump_vtable] impl N for S {} -impl O for S {} +//~^ ERROR vtable entries -macro_rules! monomorphize_vtable { - ($trait:ident) => {{ - fn foo(_ : &dyn $trait) {} - foo(&S); - }} -} +#[rustc_dump_vtable] +impl O for S {} +//~^ ERROR vtable entries -fn main() { - monomorphize_vtable!(O); - - monomorphize_vtable!(A); - monomorphize_vtable!(B); - monomorphize_vtable!(C); - monomorphize_vtable!(D); - monomorphize_vtable!(E); - monomorphize_vtable!(F); - monomorphize_vtable!(H); - monomorphize_vtable!(I); - monomorphize_vtable!(J); - monomorphize_vtable!(K); - monomorphize_vtable!(L); - monomorphize_vtable!(M); - monomorphize_vtable!(N); -} +fn main() {} diff --git a/tests/ui/traits/vtable/vtable-multi-level.stderr b/tests/ui/traits/vtable/vtable-multi-level.stderr index c4389e23fc1..961900aa3d2 100644 --- a/tests/ui/traits/vtable/vtable-multi-level.stderr +++ b/tests/ui/traits/vtable/vtable-multi-level.stderr @@ -1,134 +1,119 @@ -error: vtable entries for `<S as O>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, Method(<S as A>::foo_a), - Method(<S as B>::foo_b), - TraitVPtr(<S as B>), - Method(<S as C>::foo_c), - Method(<S as D>::foo_d), - TraitVPtr(<S as D>), - Method(<S as E>::foo_e), - TraitVPtr(<S as E>), - Method(<S as F>::foo_f), - TraitVPtr(<S as F>), - Method(<S as G>::foo_g), - Method(<S as H>::foo_h), - TraitVPtr(<S as H>), - Method(<S as I>::foo_i), - TraitVPtr(<S as I>), - Method(<S as J>::foo_j), - TraitVPtr(<S as J>), - Method(<S as K>::foo_k), - TraitVPtr(<S as K>), - Method(<S as L>::foo_l), - TraitVPtr(<S as L>), - Method(<S as M>::foo_m), - TraitVPtr(<S as M>), - Method(<S as N>::foo_n), - TraitVPtr(<S as N>), - Method(<S as O>::foo_o), ] - --> $DIR/vtable-multi-level.rs:97:1 + --> $DIR/vtable-multi-level.rs:75:1 | -LL | trait O: G + N { - | ^^^^^^^^^^^^^^ +LL | impl A for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as A>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, - Method(<S as A>::foo_a), + Method(<S as B>::foo_b), ] - --> $DIR/vtable-multi-level.rs:14:1 + --> $DIR/vtable-multi-level.rs:79:1 | -LL | trait A { - | ^^^^^^^ +LL | impl B for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as B>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, + Method(<S as A>::foo_a), Method(<S as B>::foo_b), + TraitVPtr(<S as B>), + Method(<S as C>::foo_c), ] - --> $DIR/vtable-multi-level.rs:20:1 + --> $DIR/vtable-multi-level.rs:83:1 | -LL | trait B { - | ^^^^^^^ +LL | impl C for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as C>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, - Method(<S as A>::foo_a), - Method(<S as B>::foo_b), - TraitVPtr(<S as B>), - Method(<S as C>::foo_c), + Method(<S as D>::foo_d), ] - --> $DIR/vtable-multi-level.rs:26:1 + --> $DIR/vtable-multi-level.rs:87:1 | -LL | trait C: A + B { - | ^^^^^^^^^^^^^^ +LL | impl D for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as D>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, - Method(<S as D>::foo_d), + Method(<S as E>::foo_e), ] - --> $DIR/vtable-multi-level.rs:32:1 + --> $DIR/vtable-multi-level.rs:91:1 | -LL | trait D { - | ^^^^^^^ +LL | impl E for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as E>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, + Method(<S as D>::foo_d), Method(<S as E>::foo_e), + TraitVPtr(<S as E>), + Method(<S as F>::foo_f), ] - --> $DIR/vtable-multi-level.rs:38:1 + --> $DIR/vtable-multi-level.rs:95:1 | -LL | trait E { - | ^^^^^^^ +LL | impl F for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as F>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, + Method(<S as A>::foo_a), + Method(<S as B>::foo_b), + TraitVPtr(<S as B>), + Method(<S as C>::foo_c), Method(<S as D>::foo_d), + TraitVPtr(<S as D>), Method(<S as E>::foo_e), TraitVPtr(<S as E>), Method(<S as F>::foo_f), + TraitVPtr(<S as F>), + Method(<S as G>::foo_g), ] - --> $DIR/vtable-multi-level.rs:44:1 + --> $DIR/vtable-multi-level.rs:99:1 | -LL | trait F: D + E { - | ^^^^^^^^^^^^^^ +LL | impl G for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as H>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, Method(<S as H>::foo_h), ] - --> $DIR/vtable-multi-level.rs:55:1 + --> $DIR/vtable-multi-level.rs:103:1 | -LL | trait H { - | ^^^^^^^ +LL | impl H for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as I>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, Method(<S as I>::foo_i), ] - --> $DIR/vtable-multi-level.rs:61:1 + --> $DIR/vtable-multi-level.rs:107:1 | -LL | trait I { - | ^^^^^^^ +LL | impl I for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as J>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, @@ -137,34 +122,34 @@ error: vtable entries for `<S as J>`: [ TraitVPtr(<S as I>), Method(<S as J>::foo_j), ] - --> $DIR/vtable-multi-level.rs:67:1 + --> $DIR/vtable-multi-level.rs:111:1 | -LL | trait J: H + I { - | ^^^^^^^^^^^^^^ +LL | impl J for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as K>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, Method(<S as K>::foo_k), ] - --> $DIR/vtable-multi-level.rs:73:1 + --> $DIR/vtable-multi-level.rs:115:1 | -LL | trait K { - | ^^^^^^^ +LL | impl K for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as L>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, Method(<S as L>::foo_l), ] - --> $DIR/vtable-multi-level.rs:79:1 + --> $DIR/vtable-multi-level.rs:119:1 | -LL | trait L { - | ^^^^^^^ +LL | impl L for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as M>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, @@ -173,12 +158,12 @@ error: vtable entries for `<S as M>`: [ TraitVPtr(<S as L>), Method(<S as M>::foo_m), ] - --> $DIR/vtable-multi-level.rs:85:1 + --> $DIR/vtable-multi-level.rs:123:1 | -LL | trait M: K + L { - | ^^^^^^^^^^^^^^ +LL | impl M for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as N>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, @@ -194,10 +179,46 @@ error: vtable entries for `<S as N>`: [ TraitVPtr(<S as M>), Method(<S as N>::foo_n), ] - --> $DIR/vtable-multi-level.rs:91:1 + --> $DIR/vtable-multi-level.rs:127:1 + | +LL | impl N for S {} + | ^^^^^^^^^^^^ + +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(<S as A>::foo_a), + Method(<S as B>::foo_b), + TraitVPtr(<S as B>), + Method(<S as C>::foo_c), + Method(<S as D>::foo_d), + TraitVPtr(<S as D>), + Method(<S as E>::foo_e), + TraitVPtr(<S as E>), + Method(<S as F>::foo_f), + TraitVPtr(<S as F>), + Method(<S as G>::foo_g), + Method(<S as H>::foo_h), + TraitVPtr(<S as H>), + Method(<S as I>::foo_i), + TraitVPtr(<S as I>), + Method(<S as J>::foo_j), + TraitVPtr(<S as J>), + Method(<S as K>::foo_k), + TraitVPtr(<S as K>), + Method(<S as L>::foo_l), + TraitVPtr(<S as L>), + Method(<S as M>::foo_m), + TraitVPtr(<S as M>), + Method(<S as N>::foo_n), + TraitVPtr(<S as N>), + Method(<S as O>::foo_o), + ] + --> $DIR/vtable-multi-level.rs:131:1 | -LL | trait N: J + M { - | ^^^^^^^^^^^^^^ +LL | impl O for S {} + | ^^^^^^^^^^^^ -error: aborting due to 14 previous errors +error: aborting due to 15 previous errors diff --git a/tests/ui/traits/vtable/vtable-multiple.rs b/tests/ui/traits/vtable/vtable-multiple.rs index beaaf4db6b1..51e20ee20c9 100644 --- a/tests/ui/traits/vtable/vtable-multiple.rs +++ b/tests/ui/traits/vtable/vtable-multiple.rs @@ -1,33 +1,29 @@ -//@ build-fail #![feature(rustc_attrs)] -#[rustc_dump_vtable] trait A { fn foo_a(&self) {} } -#[rustc_dump_vtable] trait B { - //~^ error vtable fn foo_b(&self) {} } -#[rustc_dump_vtable] trait C: A + B { - //~^ error vtable fn foo_c(&self) {} } struct S; +#[rustc_dump_vtable] impl A for S {} +//~^ error vtable + +#[rustc_dump_vtable] impl B for S {} -impl C for S {} +//~^ error vtable -fn foo(c: &dyn C) {} -fn bar(c: &dyn B) {} +#[rustc_dump_vtable] +impl C for S {} +//~^ error vtable -fn main() { - foo(&S); - bar(&S); -} +fn main() {} diff --git a/tests/ui/traits/vtable/vtable-multiple.stderr b/tests/ui/traits/vtable/vtable-multiple.stderr index 0dcd8443309..bae44148baa 100644 --- a/tests/ui/traits/vtable/vtable-multiple.stderr +++ b/tests/ui/traits/vtable/vtable-multiple.stderr @@ -1,27 +1,38 @@ -error: vtable entries for `<S as C>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, Method(<S as A>::foo_a), + ] + --> $DIR/vtable-multiple.rs:18:1 + | +LL | impl A for S {} + | ^^^^^^^^^^^^ + +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, Method(<S as B>::foo_b), - TraitVPtr(<S as B>), - Method(<S as C>::foo_c), ] - --> $DIR/vtable-multiple.rs:16:1 + --> $DIR/vtable-multiple.rs:22:1 | -LL | trait C: A + B { - | ^^^^^^^^^^^^^^ +LL | impl B for S {} + | ^^^^^^^^^^^^ -error: vtable entries for `<S as B>`: [ +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, + Method(<S as A>::foo_a), Method(<S as B>::foo_b), + TraitVPtr(<S as B>), + Method(<S as C>::foo_c), ] - --> $DIR/vtable-multiple.rs:10:1 + --> $DIR/vtable-multiple.rs:26:1 | -LL | trait B { - | ^^^^^^^ +LL | impl C for S {} + | ^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors diff --git a/tests/ui/traits/vtable/vtable-vacant.rs b/tests/ui/traits/vtable/vtable-vacant.rs index b3c76815703..b023565c56e 100644 --- a/tests/ui/traits/vtable/vtable-vacant.rs +++ b/tests/ui/traits/vtable/vtable-vacant.rs @@ -1,18 +1,14 @@ -//@ build-fail #![feature(rustc_attrs)] #![feature(negative_impls)] // B --> A -#[rustc_dump_vtable] trait A { fn foo_a1(&self) {} fn foo_a2(&self) where Self: Send {} } -#[rustc_dump_vtable] trait B: A { - //~^ error vtable fn foo_b1(&self) {} fn foo_b2(&self) where Self: Send {} } @@ -20,11 +16,12 @@ trait B: A { struct S; impl !Send for S {} +#[rustc_dump_vtable] impl A for S {} -impl B for S {} +//~^ error vtable -fn foo(_: &dyn B) {} +#[rustc_dump_vtable] +impl B for S {} +//~^ error vtable -fn main() { - foo(&S); -} +fn main() {} diff --git a/tests/ui/traits/vtable/vtable-vacant.stderr b/tests/ui/traits/vtable/vtable-vacant.stderr index f6961ca010e..ed8466f7f2e 100644 --- a/tests/ui/traits/vtable/vtable-vacant.stderr +++ b/tests/ui/traits/vtable/vtable-vacant.stderr @@ -1,4 +1,16 @@ -error: vtable entries for `<S as B>`: [ +error: vtable entries: [ + MetadataDropInPlace, + MetadataSize, + MetadataAlign, + Method(<S as A>::foo_a1), + Vacant, + ] + --> $DIR/vtable-vacant.rs:20:1 + | +LL | impl A for S {} + | ^^^^^^^^^^^^ + +error: vtable entries: [ MetadataDropInPlace, MetadataSize, MetadataAlign, @@ -7,10 +19,10 @@ error: vtable entries for `<S as B>`: [ Method(<S as B>::foo_b1), Vacant, ] - --> $DIR/vtable-vacant.rs:14:1 + --> $DIR/vtable-vacant.rs:24:1 | -LL | trait B: A { - | ^^^^^^^^^^ +LL | impl B for S {} + | ^^^^^^^^^^^^ -error: aborting due to 1 previous error +error: aborting due to 2 previous errors diff --git a/tests/ui/traits/wrong-mul-method-signature.stderr b/tests/ui/traits/wrong-mul-method-signature.stderr index e30b61622ae..c85775f4887 100644 --- a/tests/ui/traits/wrong-mul-method-signature.stderr +++ b/tests/ui/traits/wrong-mul-method-signature.stderr @@ -8,8 +8,9 @@ LL | fn mul(self, s: &f64) -> Vec1 { found signature `fn(Vec1, &_) -> Vec1` help: change the parameter type to match the trait | -LL | fn mul(self, s: f64) -> Vec1 { - | ~~~ +LL - fn mul(self, s: &f64) -> Vec1 { +LL + fn mul(self, s: f64) -> Vec1 { + | error[E0053]: method `mul` has an incompatible type for trait --> $DIR/wrong-mul-method-signature.rs:33:21 @@ -21,8 +22,9 @@ LL | fn mul(self, s: f64) -> Vec2 { found signature `fn(Vec2, f64) -> Vec2` help: change the parameter type to match the trait | -LL | fn mul(self, s: Vec2) -> Vec2 { - | ~~~~ +LL - fn mul(self, s: f64) -> Vec2 { +LL + fn mul(self, s: Vec2) -> Vec2 { + | error[E0053]: method `mul` has an incompatible type for trait --> $DIR/wrong-mul-method-signature.rs:52:29 @@ -34,8 +36,9 @@ LL | fn mul(self, s: f64) -> f64 { found signature `fn(Vec3, _) -> f64` help: change the output type to match the trait | -LL | fn mul(self, s: f64) -> i32 { - | ~~~ +LL - fn mul(self, s: f64) -> f64 { +LL + fn mul(self, s: f64) -> i32 { + | error[E0308]: mismatched types --> $DIR/wrong-mul-method-signature.rs:63:45 diff --git a/tests/ui/transmutability/assoc-bound.stderr b/tests/ui/transmutability/assoc-bound.stderr index b3c7680bf29..4dff24e2002 100644 --- a/tests/ui/transmutability/assoc-bound.stderr +++ b/tests/ui/transmutability/assoc-bound.stderr @@ -13,7 +13,7 @@ LL | type AssocB: std::mem::TransmuteFrom<()>; help: consider further restricting the associated type | LL | T: A, <T as A>::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }> - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0277]: `()` cannot be safely transmuted into `<&i32 as A>::AssocA` --> $DIR/assoc-bound.rs:24:19 diff --git a/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.rs b/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.rs new file mode 100644 index 00000000000..2340df25025 --- /dev/null +++ b/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.rs @@ -0,0 +1,20 @@ +//! Test that we don't ICE when passing the wrong ADT to ASSUME. + +#![feature(adt_const_params)] +#![feature(transmutability)] + +use std::marker::ConstParamTy; +use std::mem::TransmuteFrom; + +#[derive(ConstParamTy, PartialEq, Eq)] +struct NotAssume; + +fn foo<const ASSUME: NotAssume>() +where + u8: TransmuteFrom<u8, ASSUME>, //~ ERROR the constant `ASSUME` is not of type `Assume` +{ +} + +fn main() { + foo::<{ NotAssume }>(); +} diff --git a/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.stderr b/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.stderr new file mode 100644 index 00000000000..cae700ecfdc --- /dev/null +++ b/tests/ui/transmutability/malformed-program-gracefulness/wrong-adt-assume.stderr @@ -0,0 +1,11 @@ +error: the constant `ASSUME` is not of type `Assume` + --> $DIR/wrong-adt-assume.rs:14:9 + | +LL | u8: TransmuteFrom<u8, ASSUME>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Assume`, found `NotAssume` + | +note: required by a const generic parameter in `TransmuteFrom` + --> $SRC_DIR/core/src/mem/transmutability.rs:LL:COL + +error: aborting due to 1 previous error + diff --git a/tests/ui/tuple/tuple-index-not-tuple.stderr b/tests/ui/tuple/tuple-index-not-tuple.stderr index a267e41b1bc..faf9a313478 100644 --- a/tests/ui/tuple/tuple-index-not-tuple.stderr +++ b/tests/ui/tuple/tuple-index-not-tuple.stderr @@ -6,8 +6,9 @@ LL | origin.0; | help: a field with a similar name exists | -LL | origin.x; - | ~ +LL - origin.0; +LL + origin.x; + | error[E0609]: no field `0` on type `Empty` --> $DIR/tuple-index-not-tuple.rs:8:11 diff --git a/tests/ui/tuple/tuple-index-out-of-bounds.stderr b/tests/ui/tuple/tuple-index-out-of-bounds.stderr index 96090435d06..8b3c835c3e3 100644 --- a/tests/ui/tuple/tuple-index-out-of-bounds.stderr +++ b/tests/ui/tuple/tuple-index-out-of-bounds.stderr @@ -6,8 +6,9 @@ LL | origin.2; | help: a field with a similar name exists | -LL | origin.0; - | ~ +LL - origin.2; +LL + origin.0; + | error[E0609]: no field `2` on type `({integer}, {integer})` --> $DIR/tuple-index-out-of-bounds.rs:12:11 diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr index 482a314db60..5039ae8f288 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr +++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr @@ -43,8 +43,9 @@ LL | impl<T> Enum<T> { | --------------- `Self` is on type `Enum` in this `impl` help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters | -LL | Enum::<()>::TSVariant(()); - | ~~~~ +LL - Self::<()>::TSVariant(()); +LL + Enum::<()>::TSVariant(()); + | error[E0308]: mismatched types --> $DIR/enum-variant-generic-args.rs:17:31 @@ -83,8 +84,9 @@ LL | impl<T> Enum<T> { | --------------- `Self` is on type `Enum` in this `impl` help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters | -LL | Enum::<()>::TSVariant::<()>(()); - | ~~~~ +LL - Self::<()>::TSVariant::<()>(()); +LL + Enum::<()>::TSVariant::<()>(()); + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:20:33 @@ -151,8 +153,9 @@ LL | impl<T> Enum<T> { | --------------- `Self` is on type `Enum` in this `impl` help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters | -LL | Enum::<()>::SVariant { v: () }; - | ~~~~ +LL - Self::<()>::SVariant { v: () }; +LL + Enum::<()>::SVariant { v: () }; + | error[E0308]: mismatched types --> $DIR/enum-variant-generic-args.rs:31:35 @@ -184,8 +187,9 @@ LL | impl<T> Enum<T> { | --------------- `Self` is on type `Enum` in this `impl` help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters | -LL | Enum::<()>::SVariant::<()> { v: () }; - | ~~~~ +LL - Self::<()>::SVariant::<()> { v: () }; +LL + Enum::<()>::SVariant::<()> { v: () }; + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:34:32 @@ -240,8 +244,9 @@ LL | impl<T> Enum<T> { | --------------- `Self` is on type `Enum` in this `impl` help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters | -LL | Enum::<()>::UVariant; - | ~~~~ +LL - Self::<()>::UVariant; +LL + Enum::<()>::UVariant; + | error[E0109]: type arguments are not allowed on self type --> $DIR/enum-variant-generic-args.rs:45:16 @@ -261,8 +266,9 @@ LL | impl<T> Enum<T> { | --------------- `Self` is on type `Enum` in this `impl` help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters | -LL | Enum::<()>::UVariant::<()>; - | ~~~~ +LL - Self::<()>::UVariant::<()>; +LL + Enum::<()>::UVariant::<()>; + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:45:32 @@ -279,6 +285,13 @@ LL | Enum::<()>::TSVariant::<()>(()); | --------- ^^ type argument not allowed | | | not allowed on tuple variant `TSVariant` + | + = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other +help: remove the generics arguments from one of the path segments + | +LL - Enum::<()>::TSVariant::<()>(()); +LL + Enum::<()>::TSVariant(()); + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:57:24 @@ -348,7 +361,12 @@ LL | Enum::<()>::SVariant::<()> { v: () }; | | | not allowed on variant `SVariant` | - = note: enum variants can't have type parameters + = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other +help: remove the generics arguments from one of the path segments + | +LL - Enum::<()>::SVariant::<()> { v: () }; +LL + Enum::<()>::SVariant { v: () }; + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:75:23 @@ -445,6 +463,13 @@ LL | Enum::<()>::UVariant::<()>; | -------- ^^ type argument not allowed | | | not allowed on unit variant `UVariant` + | + = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other +help: remove the generics arguments from one of the path segments + | +LL - Enum::<()>::UVariant::<()>; +LL + Enum::<()>::UVariant; + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:93:23 diff --git a/tests/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr b/tests/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr index 371f5b10988..c4deafd4f6b 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr +++ b/tests/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr @@ -11,8 +11,9 @@ LL | V(u8) | ^ help: provide the argument | -LL | <E>::V(/* u8 */); - | ~~~~~~~~~~ +LL - <E>::V(); +LL + <E>::V(/* u8 */); + | error[E0308]: mismatched types --> $DIR/enum-variant-priority-higher-than-other-inherent.rs:22:17 diff --git a/tests/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr b/tests/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr index 714b4fd7d25..1ed78cbc0da 100644 --- a/tests/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr +++ b/tests/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr @@ -28,8 +28,9 @@ LL | let Alias::Braced(..) = panic!(); | help: use the struct variant pattern syntax | -LL | let Alias::Braced {} = panic!(); - | ~~ +LL - let Alias::Braced(..) = panic!(); +LL + let Alias::Braced {} = panic!(); + | error[E0618]: expected function, found enum variant `Alias::Unit` --> $DIR/incorrect-variant-form-through-alias-caught.rs:15:5 diff --git a/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr b/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr index 04288112fa8..ae00d3fc667 100644 --- a/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr +++ b/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr @@ -15,7 +15,7 @@ note: but lifetime parameter must outlive the lifetime `'b` as defined here LL | type Opaque<'a, 'b> = impl Sized + 'a + 'b; | ^^ -error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements +error[E0803]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/closure_wf_outlives.rs:34:9 | LL | || {} @@ -63,5 +63,5 @@ LL | type Opaque<T: 'static> = impl Sized; error: aborting due to 3 previous errors -Some errors have detailed explanations: E0310, E0478, E0495. +Some errors have detailed explanations: E0310, E0478, E0803. For more information about an error, try `rustc --explain E0310`. 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 d96c86a2e6f..580258bbb28 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 @@ -7,6 +7,15 @@ LL | let x = <Foo as Trait<Bar>>::Assoc::default(); = help: the trait `Trait<Bar>` is not implemented for `Foo` but trait `Trait<()>` is implemented for it -error: aborting due to 1 previous error +error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied + --> $DIR/constrain_in_projection.rs:24:13 + | +LL | let x = <Foo as Trait<Bar>>::Assoc::default(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<Bar>` is not implemented for `Foo` + | + = help: the trait `Trait<Bar>` is not implemented for `Foo` + but trait `Trait<()>` is implemented for it + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection.rs b/tests/ui/type-alias-impl-trait/constrain_in_projection.rs index 7d7d16361ae..355c0e1692b 100644 --- a/tests/ui/type-alias-impl-trait/constrain_in_projection.rs +++ b/tests/ui/type-alias-impl-trait/constrain_in_projection.rs @@ -23,6 +23,7 @@ impl Trait<()> for Foo { fn bop(_: Bar) { let x = <Foo as Trait<Bar>>::Assoc::default(); //[current]~^ `Foo: Trait<Bar>` is not satisfied + //[current]~| `Foo: Trait<Bar>` is not satisfied } fn main() {} 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 909f1f6d61c..777fe1e2788 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 @@ -8,6 +8,16 @@ LL | let x = <Foo as Trait<Bar>>::Assoc::default(); `Foo` implements `Trait<()>` `Foo` implements `Trait<u32>` -error: aborting due to 1 previous error +error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied + --> $DIR/constrain_in_projection2.rs:27:13 + | +LL | let x = <Foo as Trait<Bar>>::Assoc::default(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<Bar>` is not implemented for `Foo` + | + = help: the following other types implement trait `Trait<T>`: + `Foo` implements `Trait<()>` + `Foo` implements `Trait<u32>` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. 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 af222f6c153..16b1329b52f 100644 --- a/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs +++ b/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs @@ -27,6 +27,7 @@ fn bop(_: Bar) { let x = <Foo as Trait<Bar>>::Assoc::default(); //[next]~^ ERROR: cannot satisfy `Foo: Trait<Bar>` //[current]~^^ ERROR: `Foo: Trait<Bar>` is not satisfied + //[current]~| ERROR: `Foo: Trait<Bar>` is not satisfied } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs index 1aa64810d19..38dd6dd0af2 100644 --- a/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs +++ b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs @@ -1,5 +1,4 @@ //@ edition: 2021 -//@ build-fail #![feature(impl_trait_in_assoc_type)] diff --git a/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr index 6cbffaaed4d..304ed12e944 100644 --- a/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr +++ b/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr @@ -1,11 +1,11 @@ error[E0733]: recursion in an async block requires boxing - --> $DIR/indirect-recursion-issue-112047.rs:22:9 + --> $DIR/indirect-recursion-issue-112047.rs:21:9 | LL | async move { recur(self).await; } | ^^^^^^^^^^ ----------------- recursive call here | note: which leads to this async fn - --> $DIR/indirect-recursion-issue-112047.rs:14:1 + --> $DIR/indirect-recursion-issue-112047.rs:13:1 | LL | async fn recur(t: impl Recur) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/type-alias-impl-trait/issue-98604.rs b/tests/ui/type-alias-impl-trait/issue-98604.rs index 9231e82d9f4..35c25c7f726 100644 --- a/tests/ui/type-alias-impl-trait/issue-98604.rs +++ b/tests/ui/type-alias-impl-trait/issue-98604.rs @@ -7,5 +7,5 @@ async fn test() {} #[allow(unused_must_use)] fn main() { Box::new(test) as AsyncFnPtr; - //~^ ERROR expected `test` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()> + //~^ ERROR expected `test` to return `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()> } diff --git a/tests/ui/type-alias-impl-trait/issue-98604.stderr b/tests/ui/type-alias-impl-trait/issue-98604.stderr index 2390b725356..77c6ba3003f 100644 --- a/tests/ui/type-alias-impl-trait/issue-98604.stderr +++ b/tests/ui/type-alias-impl-trait/issue-98604.stderr @@ -1,4 +1,4 @@ -error[E0271]: expected `test` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` +error[E0271]: expected `test` to return `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>` --> $DIR/issue-98604.rs:9:5 | LL | Box::new(test) as AsyncFnPtr; diff --git a/tests/ui/type-alias-impl-trait/issue-98608.rs b/tests/ui/type-alias-impl-trait/issue-98608.rs index 5e026ea4096..5612ccd6cae 100644 --- a/tests/ui/type-alias-impl-trait/issue-98608.rs +++ b/tests/ui/type-alias-impl-trait/issue-98608.rs @@ -4,7 +4,7 @@ fn hi() -> impl Sized { fn main() { let b: Box<dyn Fn() -> Box<u8>> = Box::new(hi); - //~^ ERROR expected `hi` to be a fn item that returns `Box<u8>`, but it returns `impl Sized` + //~^ ERROR expected `hi` to return `Box<u8>`, but it returns `impl Sized` let boxed = b(); let null = *boxed; println!("{null:?}"); diff --git a/tests/ui/type-alias-impl-trait/issue-98608.stderr b/tests/ui/type-alias-impl-trait/issue-98608.stderr index d5c56636f66..872a6ed4350 100644 --- a/tests/ui/type-alias-impl-trait/issue-98608.stderr +++ b/tests/ui/type-alias-impl-trait/issue-98608.stderr @@ -1,4 +1,4 @@ -error[E0271]: expected `hi` to be a fn item that returns `Box<u8>`, but it returns `impl Sized` +error[E0271]: expected `hi` to return `Box<u8>`, but it returns `impl Sized` --> $DIR/issue-98608.rs:6:39 | LL | fn hi() -> impl Sized { diff --git a/tests/ui/type-alias-impl-trait/unnameable_type.stderr b/tests/ui/type-alias-impl-trait/unnameable_type.stderr index 5b331c5660d..25dc41df419 100644 --- a/tests/ui/type-alias-impl-trait/unnameable_type.stderr +++ b/tests/ui/type-alias-impl-trait/unnameable_type.stderr @@ -16,8 +16,9 @@ LL | fn dont_define_this(_private: Private) {} found signature `fn(MyPrivate)` help: change the parameter type to match the trait | -LL | fn dont_define_this(private: Private) { - | ~~~~~~~ +LL - fn dont_define_this(private: MyPrivate) { +LL + fn dont_define_this(private: Private) { + | error: aborting due to 1 previous error diff --git a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.eager.stderr b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.eager.stderr index e891ff10fda..b0b183d652b 100644 --- a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.eager.stderr +++ b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.eager.stderr @@ -17,8 +17,9 @@ LL | type AssokOf<T> = T::Assok; | help: consider fully qualifying and renaming the associated type | -LL | type AssokOf<T> = <T as Trait>::Assoc; - | + +++++++++ ~~~~~ +LL - type AssokOf<T> = T::Assok; +LL + type AssokOf<T> = <T as Trait>::Assoc; + | error[E0220]: associated type `Proj` not found for `T` --> $DIR/unresolved-assoc-ty-suggest-trait.rs:22:21 diff --git a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr index 885c6ec9d8e..79b9db1edf7 100644 --- a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr +++ b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr @@ -21,8 +21,9 @@ LL | type AssokOf<T: Trait> = T::Assok; | +++++++ help: ...and changing the associated type name | -LL | type AssokOf<T> = T::Assoc; - | ~~~~~ +LL - type AssokOf<T> = T::Assok; +LL + type AssokOf<T> = T::Assoc; + | error[E0220]: associated type `Proj` not found for `T` --> $DIR/unresolved-assoc-ty-suggest-trait.rs:22:21 diff --git a/tests/ui/type-inference/or_else-multiple-type-params.stderr b/tests/ui/type-inference/or_else-multiple-type-params.stderr index 3176a2d490e..9bcd07f8bf1 100644 --- a/tests/ui/type-inference/or_else-multiple-type-params.stderr +++ b/tests/ui/type-inference/or_else-multiple-type-params.stderr @@ -6,8 +6,8 @@ LL | .or_else(|err| { | help: try giving this closure an explicit return type | -LL | .or_else(|err| -> Result<Child, F> { - | +++++++++++++++++++ +LL | .or_else(|err| -> Result<_, F> { + | +++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/type/issue-100584.stderr b/tests/ui/type/issue-100584.stderr index e1db14d1f00..1523bdda761 100644 --- a/tests/ui/type/issue-100584.stderr +++ b/tests/ui/type/issue-100584.stderr @@ -20,7 +20,7 @@ LL | let _ = format!("{xyza}"); help: if this is intentional, prefix it with an underscore | LL | fn foo(_xyza: &str) { - | ~~~~~ + | + error: unused variable: `xyza` --> $DIR/issue-100584.rs:7:9 @@ -38,7 +38,7 @@ LL | let _ = format!("aaa{xyza}bbb"); help: if this is intentional, prefix it with an underscore | LL | fn foo3(_xyza: &str) { - | ~~~~~ + | + error: aborting due to 2 previous errors diff --git a/tests/ui/type/issue-103271.stderr b/tests/ui/type/issue-103271.stderr index f4dac51b2b4..1b84033291a 100644 --- a/tests/ui/type/issue-103271.stderr +++ b/tests/ui/type/issue-103271.stderr @@ -6,8 +6,9 @@ LL | let iter_fun = <&[u32]>::iter; | help: the function `iter` is implemented on `[u32]` | -LL | let iter_fun = <[u32]>::iter; - | ~~~~~ +LL - let iter_fun = <&[u32]>::iter; +LL + let iter_fun = <[u32]>::iter; + | error[E0599]: no function or associated item named `iter` found for reference `&[u32]` in the current scope --> $DIR/issue-103271.rs:10:33 @@ -17,8 +18,9 @@ LL | let iter_fun2 = <(&[u32])>::iter; | help: the function `iter` is implemented on `[u32]` | -LL | let iter_fun2 = <([u32])>::iter; - | ~~~~~ +LL - let iter_fun2 = <(&[u32])>::iter; +LL + let iter_fun2 = <([u32])>::iter; + | error: aborting due to 2 previous errors diff --git a/tests/ui/type/pattern_types/assoc_const.default.stderr b/tests/ui/type/pattern_types/assoc_const.default.stderr new file mode 100644 index 00000000000..8cff0cee7b9 --- /dev/null +++ b/tests/ui/type/pattern_types/assoc_const.default.stderr @@ -0,0 +1,38 @@ +error: generic parameters may not be used in const operations + --> $DIR/assoc_const.rs:17:41 + | +LL | fn foo<T: Foo>(_: pattern_type!(u32 is <T as Foo>::START..=<T as Foo>::END)) {} + | ^ cannot perform const operation using `T` + | + = note: type parameters may not be used in const expressions + = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: generic parameters may not be used in const operations + --> $DIR/assoc_const.rs:17:61 + | +LL | fn foo<T: Foo>(_: pattern_type!(u32 is <T as Foo>::START..=<T as Foo>::END)) {} + | ^ cannot perform const operation using `T` + | + = note: type parameters may not be used in const expressions + = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: generic parameters may not be used in const operations + --> $DIR/assoc_const.rs:20:40 + | +LL | fn bar<T: Foo>(_: pattern_type!(u32 is T::START..=T::END)) {} + | ^^^^^^^^ cannot perform const operation using `T` + | + = note: type parameters may not be used in const expressions + = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: generic parameters may not be used in const operations + --> $DIR/assoc_const.rs:20:51 + | +LL | fn bar<T: Foo>(_: pattern_type!(u32 is T::START..=T::END)) {} + | ^^^^^^ cannot perform const operation using `T` + | + = note: type parameters may not be used in const expressions + = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: aborting due to 4 previous errors + diff --git a/tests/ui/type/pattern_types/assoc_const.rs b/tests/ui/type/pattern_types/assoc_const.rs new file mode 100644 index 00000000000..90508801990 --- /dev/null +++ b/tests/ui/type/pattern_types/assoc_const.rs @@ -0,0 +1,24 @@ +#![feature(pattern_types)] +#![feature(pattern_type_macro)] +#![cfg_attr(const_arg, feature(generic_const_exprs, generic_pattern_types))] +#![expect(incomplete_features)] +// gate-test-generic_pattern_types line to the test file. +//@ revisions: default const_arg + +//@[const_arg] check-pass + +use std::pat::pattern_type; + +trait Foo { + const START: u32; + const END: u32; +} + +fn foo<T: Foo>(_: pattern_type!(u32 is <T as Foo>::START..=<T as Foo>::END)) {} +//[default]~^ ERROR: generic parameters may not be used in const operations +//[default]~| ERROR: generic parameters may not be used in const operations +fn bar<T: Foo>(_: pattern_type!(u32 is T::START..=T::END)) {} +//[default]~^ ERROR: generic parameters may not be used in const operations +//[default]~| ERROR: generic parameters may not be used in const operations + +fn main() {} diff --git a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs index c5f8b2764ec..c28fda6f91a 100644 --- a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs +++ b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs @@ -1,10 +1,14 @@ -#![feature(pattern_types, pattern_type_macro)] +//@known-bug: #127972 +//@ failure-status: 101 +//@ normalize-stderr: "note: .*\n\n" -> "" +//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> "" +//@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " +//@ rustc-env:RUST_BACKTRACE=0 + +#![feature(pattern_types, pattern_type_macro, generic_const_exprs)] #![allow(internal_features)] type Pat<const START: u32, const END: u32> = std::pat::pattern_type!(u32 is START::<(), i32, 2>..=END::<_, Assoc = ()>); -//~^ ERROR type and const arguments are not allowed on const parameter `START` -//~| ERROR generic arguments are not allowed on const parameter `END` -//~| ERROR associated item constraints are not allowed here fn main() {} diff --git a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.stderr b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.stderr index f31809bf397..ffc6068eb17 100644 --- a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.stderr +++ b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.stderr @@ -1,38 +1,21 @@ -error[E0109]: type and const arguments are not allowed on const parameter `START` - --> $DIR/bad_const_generics_args_on_const_param.rs:5:44 +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/bad_const_generics_args_on_const_param.rs:8:47 | -LL | std::pat::pattern_type!(u32 is START::<(), i32, 2>..=END::<_, Assoc = ()>); - | ----- ^^ ^^^ ^ type and const arguments not allowed - | | - | not allowed on const parameter `START` - | -note: const parameter `START` defined here - --> $DIR/bad_const_generics_args_on_const_param.rs:4:16 +LL | #![feature(pattern_types, pattern_type_macro, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ | -LL | type Pat<const START: u32, const END: u32> = - | ^^^^^ - -error[E0109]: generic arguments are not allowed on const parameter `END` - --> $DIR/bad_const_generics_args_on_const_param.rs:5:64 + = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information + = error: internal compiler error: compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs:LL:CC: try_lower_anon_const_lit: received const param which shouldn't be possible + --> $DIR/bad_const_generics_args_on_const_param.rs:12:36 | LL | std::pat::pattern_type!(u32 is START::<(), i32, 2>..=END::<_, Assoc = ()>); - | --- ^ generic argument not allowed - | | - | not allowed on const parameter `END` - | -note: const parameter `END` defined here - --> $DIR/bad_const_generics_args_on_const_param.rs:4:34 - | -LL | type Pat<const START: u32, const END: u32> = - | ^^^ + | ^^^^^^^^^^^^^^^^^^^ -error[E0229]: associated item constraints are not allowed here - --> $DIR/bad_const_generics_args_on_const_param.rs:5:67 - | -LL | std::pat::pattern_type!(u32 is START::<(), i32, 2>..=END::<_, Assoc = ()>); - | ^^^^^^^^^^ associated item constraint not allowed here -error: aborting due to 3 previous errors +Box<dyn Any> +query stack during panic: +#0 [type_of] expanding type alias `Pat` +#1 [check_well_formed] checking that `Pat` is well-formed +... and 2 other queries... use `env RUST_BACKTRACE=1` to see the full query stack +error: aborting due to 1 previous error; 1 warning emitted -Some errors have detailed explanations: E0109, E0229. -For more information about an error, try `rustc --explain E0109`. diff --git a/tests/ui/type/pattern_types/bad_pat.rs b/tests/ui/type/pattern_types/bad_pat.rs index 6cb2a0f1f8e..549b0d11dd1 100644 --- a/tests/ui/type/pattern_types/bad_pat.rs +++ b/tests/ui/type/pattern_types/bad_pat.rs @@ -8,6 +8,6 @@ type NonNullU32_2 = pattern_type!(u32 is 1..=); type Positive2 = pattern_type!(i32 is 0..=); //~^ ERROR: inclusive range with no end type Wild = pattern_type!(() is _); -//~^ ERROR: wildcard patterns are not permitted for pattern types +//~^ ERROR: pattern not supported in pattern types fn main() {} diff --git a/tests/ui/type/pattern_types/bad_pat.stderr b/tests/ui/type/pattern_types/bad_pat.stderr index c857cc3c3ad..d2a5a20bf89 100644 --- a/tests/ui/type/pattern_types/bad_pat.stderr +++ b/tests/ui/type/pattern_types/bad_pat.stderr @@ -24,7 +24,7 @@ LL - type Positive2 = pattern_type!(i32 is 0..=); LL + type Positive2 = pattern_type!(i32 is 0..); | -error: wildcard patterns are not permitted for pattern types +error: pattern not supported in pattern types --> $DIR/bad_pat.rs:10:33 | LL | type Wild = pattern_type!(() is _); diff --git a/tests/ui/type/pattern_types/chars.rs b/tests/ui/type/pattern_types/chars.rs new file mode 100644 index 00000000000..9073998b387 --- /dev/null +++ b/tests/ui/type/pattern_types/chars.rs @@ -0,0 +1,12 @@ +//! Check that chars can be used in ranges + +//@ check-pass + +#![feature(pattern_types)] +#![feature(pattern_type_macro)] + +use std::pat::pattern_type; + +const LOWERCASE: pattern_type!(char is 'a'..='z') = unsafe { std::mem::transmute('b') }; + +fn main() {} diff --git a/tests/ui/type/pattern_types/const_block.rs b/tests/ui/type/pattern_types/const_block.rs new file mode 100644 index 00000000000..ed19b10671a --- /dev/null +++ b/tests/ui/type/pattern_types/const_block.rs @@ -0,0 +1,10 @@ +#![feature(pattern_types)] +#![feature(pattern_type_macro)] +#![feature(inline_const_pat)] +//@ check-pass + +use std::pat::pattern_type; + +fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} + +fn main() {} diff --git a/tests/ui/type/pattern_types/const_generics.rs b/tests/ui/type/pattern_types/const_generics.rs index 5cef0dc0305..79d46c010d7 100644 --- a/tests/ui/type/pattern_types/const_generics.rs +++ b/tests/ui/type/pattern_types/const_generics.rs @@ -1,7 +1,7 @@ //@ check-pass -#![feature(pattern_types)] -#![feature(pattern_type_macro)] +#![feature(pattern_types, generic_pattern_types, pattern_type_macro)] +#![expect(incomplete_features)] use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types.rs b/tests/ui/type/pattern_types/feature-gate-pattern_types.rs index b90ba478402..b4f4bd656f5 100644 --- a/tests/ui/type/pattern_types/feature-gate-pattern_types.rs +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types.rs @@ -12,3 +12,4 @@ type Positive = pattern_type!(i32 is 0..); //~^ use of unstable library feature `pattern_type_macro` type Always = pattern_type!(Option<u32> is Some(_)); //~^ use of unstable library feature `pattern_type_macro` +//~| ERROR pattern not supported in pattern types diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr b/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr index 69239d68bdc..12508bcb54a 100644 --- a/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr @@ -48,6 +48,12 @@ LL | type Always = pattern_type!(Option<u32> is Some(_)); = help: add `#![feature(pattern_type_macro)]` 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 5 previous errors +error: pattern not supported in pattern types + --> $DIR/feature-gate-pattern_types.rs:13:44 + | +LL | type Always = pattern_type!(Option<u32> is Some(_)); + | ^^^^^^^ + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types2.rs b/tests/ui/type/pattern_types/feature-gate-pattern_types2.rs index 50c355c8de6..c6b4b325fa3 100644 --- a/tests/ui/type/pattern_types/feature-gate-pattern_types2.rs +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types2.rs @@ -1,5 +1,4 @@ //@ compile-flags: -Zno-analysis -//@ check-pass #![feature(pattern_type_macro)] @@ -10,3 +9,4 @@ type Percent = pattern_type!(u32 is 0..=100); type Negative = pattern_type!(i32 is ..=0); type Positive = pattern_type!(i32 is 0..); type Always = pattern_type!(Option<u32> is Some(_)); +//~^ ERROR: pattern not supported in pattern types diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types2.stderr b/tests/ui/type/pattern_types/feature-gate-pattern_types2.stderr new file mode 100644 index 00000000000..81bf9dea0e2 --- /dev/null +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types2.stderr @@ -0,0 +1,8 @@ +error: pattern not supported in pattern types + --> $DIR/feature-gate-pattern_types2.rs:11:44 + | +LL | type Always = pattern_type!(Option<u32> is Some(_)); + | ^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/type/pattern_types/free_const.rs b/tests/ui/type/pattern_types/free_const.rs new file mode 100644 index 00000000000..2e29fce2379 --- /dev/null +++ b/tests/ui/type/pattern_types/free_const.rs @@ -0,0 +1,13 @@ +//@ check-pass + +#![feature(pattern_types)] +#![feature(pattern_type_macro)] + +use std::pat::pattern_type; + +const START: u32 = 0; +const END: u32 = 10; + +fn foo(_: pattern_type!(u32 is START..=END)) {} + +fn main() {} diff --git a/tests/ui/type/pattern_types/nested.rs b/tests/ui/type/pattern_types/nested.rs new file mode 100644 index 00000000000..9ca9c7923de --- /dev/null +++ b/tests/ui/type/pattern_types/nested.rs @@ -0,0 +1,30 @@ +//! Check that pattern types can only have specific base types + +#![feature(pattern_types)] +#![feature(pattern_type_macro)] + +use std::pat::pattern_type; + +// Undoing an inner pattern type's restrictions should either be forbidden, +// or still validate correctly. +const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!(); +//~^ ERROR: not a valid base type for range patterns +//~| ERROR: mismatched types + +// We want to get the most narrowest version that a pattern could be +const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); +//~^ ERROR: not a valid base type for range patterns +//~| ERROR: mismatched types + +const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); +//~^ ERROR: not a valid base type for range patterns +//~| ERROR: mismatched types + +const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); +//~^ ERROR: not a valid base type for range patterns +//~| ERROR: mismatched types + +const BAD_NESTING5: pattern_type!(f32 is 1.0 .. 2.0) = todo!(); +//~^ ERROR: not a valid base type for range patterns + +fn main() {} diff --git a/tests/ui/type/pattern_types/nested.stderr b/tests/ui/type/pattern_types/nested.stderr new file mode 100644 index 00000000000..b753b0a9c9b --- /dev/null +++ b/tests/ui/type/pattern_types/nested.stderr @@ -0,0 +1,96 @@ +error: `(u32) is 1..=` is not a valid base type for range patterns + --> $DIR/nested.rs:10:34 + | +LL | const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: range patterns only support integers + --> $DIR/nested.rs:10:63 + | +LL | const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!(); + | ^^^ + +error: `(i32) is 1..=` is not a valid base type for range patterns + --> $DIR/nested.rs:15:35 + | +LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: range patterns only support integers + --> $DIR/nested.rs:15:64 + | +LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); + | ^^^^^ + +error: `(i32) is 1..=` is not a valid base type for range patterns + --> $DIR/nested.rs:19:35 + | +LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: range patterns only support integers + --> $DIR/nested.rs:19:64 + | +LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); + | ^^^ + +error: `()` is not a valid base type for range patterns + --> $DIR/nested.rs:23:35 + | +LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); + | ^^ + | +note: range patterns only support integers + --> $DIR/nested.rs:23:41 + | +LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); + | ^^^ + +error: `f32` is not a valid base type for range patterns + --> $DIR/nested.rs:27:35 + | +LL | const BAD_NESTING5: pattern_type!(f32 is 1.0 .. 2.0) = todo!(); + | ^^^ + | +note: range patterns only support integers + --> $DIR/nested.rs:27:42 + | +LL | const BAD_NESTING5: pattern_type!(f32 is 1.0 .. 2.0) = todo!(); + | ^^^^^^^^^^ + +error[E0308]: mismatched types + --> $DIR/nested.rs:10:63 + | +LL | const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!(); + | ^ expected `(u32) is 1..=`, found integer + | + = note: expected pattern type `(u32) is 1..=` + found type `{integer}` + +error[E0308]: mismatched types + --> $DIR/nested.rs:15:67 + | +LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); + | ^^ expected `(i32) is 1..=`, found integer + | + = note: expected pattern type `(i32) is 1..=` + found type `{integer}` + +error[E0308]: mismatched types + --> $DIR/nested.rs:19:66 + | +LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); + | ^ expected `(i32) is 1..=`, found integer + | + = note: expected pattern type `(i32) is 1..=` + found type `{integer}` + +error[E0308]: mismatched types + --> $DIR/nested.rs:23:43 + | +LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); + | ^ expected `()`, found integer + +error: aborting due to 9 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type/pattern_types/pattern_type_mismatch.rs b/tests/ui/type/pattern_types/pattern_type_mismatch.rs new file mode 100644 index 00000000000..0c88f27d836 --- /dev/null +++ b/tests/ui/type/pattern_types/pattern_type_mismatch.rs @@ -0,0 +1,16 @@ +//! Check that pattern types patterns must be of the type of the base type + +#![feature(pattern_types)] +#![feature(pattern_type_macro)] + +use std::pat::pattern_type; + +const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); +//~^ ERROR: mismatched types +//~| ERROR: mismatched types + +const BAD_NESTING5: pattern_type!(char is 1..=1) = todo!(); +//~^ ERROR: mismatched types +//~| ERROR: mismatched types + +fn main() {} diff --git a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr new file mode 100644 index 00000000000..4af92a89c44 --- /dev/null +++ b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr @@ -0,0 +1,37 @@ +error[E0308]: mismatched types + --> $DIR/pattern_type_mismatch.rs:8:41 + | +LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); + | ^^^ expected `u8`, found `char` + | +help: if you meant to write a byte literal, prefix with `b` + | +LL | const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); + | + + +error[E0308]: mismatched types + --> $DIR/pattern_type_mismatch.rs:8:47 + | +LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); + | ^^^ expected `u8`, found `char` + | +help: if you meant to write a byte literal, prefix with `b` + | +LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); + | + + +error[E0308]: mismatched types + --> $DIR/pattern_type_mismatch.rs:12:43 + | +LL | const BAD_NESTING5: pattern_type!(char is 1..=1) = todo!(); + | ^ expected `char`, found `u8` + +error[E0308]: mismatched types + --> $DIR/pattern_type_mismatch.rs:12:47 + | +LL | const BAD_NESTING5: pattern_type!(char is 1..=1) = todo!(); + | ^ expected `char`, found `u8` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type/pattern_types/reverse_range.rs b/tests/ui/type/pattern_types/reverse_range.rs new file mode 100644 index 00000000000..6a245615f1a --- /dev/null +++ b/tests/ui/type/pattern_types/reverse_range.rs @@ -0,0 +1,14 @@ +//! Check that the range start must be smaller than the range end +//@ known-bug: unknown +//@ failure-status: 101 +//@ normalize-stderr: "note: .*\n\n" -> "" +//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> "" +//@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " +//@ rustc-env:RUST_BACKTRACE=0 + +#![feature(pattern_types)] +#![feature(pattern_type_macro)] + +use std::pat::pattern_type; + +const NONE: pattern_type!(u8 is 1..0) = unsafe { std::mem::transmute(3_u8) }; diff --git a/tests/ui/type/pattern_types/reverse_range.stderr b/tests/ui/type/pattern_types/reverse_range.stderr new file mode 100644 index 00000000000..b714ca7d9ab --- /dev/null +++ b/tests/ui/type/pattern_types/reverse_range.stderr @@ -0,0 +1,17 @@ +error[E0601]: `main` function not found in crate `reverse_range` + --> $DIR/reverse_range.rs:14:78 + | +LL | const NONE: pattern_type!(u8 is 1..0) = unsafe { std::mem::transmute(3_u8) }; + | ^ consider adding a `main` function to `$DIR/reverse_range.rs` + + +assertion failed: end <= max_value +error: the compiler unexpectedly panicked. this is a bug. + +query stack during panic: +#0 [eval_to_allocation_raw] const-evaluating + checking `NONE` +#1 [eval_to_const_value_raw] simplifying constant for the type system `NONE` +... and 1 other queries... use `env RUST_BACKTRACE=1` to see the full query stack +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0601`. diff --git a/tests/ui/type/pattern_types/signed_ranges.rs b/tests/ui/type/pattern_types/signed_ranges.rs new file mode 100644 index 00000000000..3725fbda729 --- /dev/null +++ b/tests/ui/type/pattern_types/signed_ranges.rs @@ -0,0 +1,24 @@ +#![feature(pattern_types)] +#![feature(pattern_type_macro)] + +use std::pat::pattern_type; + +type Sign = pattern_type!(u32 is -10..); +//~^ ERROR: cannot apply unary operator `-` + +type SignedChar = pattern_type!(char is -'A'..); +//~^ ERROR: cannot apply unary operator `-` + +fn main() { + match 42_u8 { + -10..253 => {} + //~^ ERROR `u8: Neg` is not satisfied + _ => {} + } + + match 'A' { + -'\0'..'a' => {} + //~^ ERROR `char: Neg` is not satisfied + _ => {} + } +} diff --git a/tests/ui/type/pattern_types/signed_ranges.stderr b/tests/ui/type/pattern_types/signed_ranges.stderr new file mode 100644 index 00000000000..79bf8501b63 --- /dev/null +++ b/tests/ui/type/pattern_types/signed_ranges.stderr @@ -0,0 +1,41 @@ +error[E0277]: the trait bound `u8: Neg` is not satisfied + --> $DIR/signed_ranges.rs:14:9 + | +LL | -10..253 => {} + | ^^^ the trait `Neg` is not implemented for `u8` + | + = help: the following other types implement trait `Neg`: + &f128 + &f16 + &f32 + &f64 + &i128 + &i16 + &i32 + &i64 + and 12 others + +error[E0277]: the trait bound `char: Neg` is not satisfied + --> $DIR/signed_ranges.rs:20:9 + | +LL | -'\0'..'a' => {} + | ^^^^^ the trait `Neg` is not implemented for `char` + +error[E0600]: cannot apply unary operator `-` to type `u32` + --> $DIR/signed_ranges.rs:6:34 + | +LL | type Sign = pattern_type!(u32 is -10..); + | ^^^ cannot apply unary operator `-` + | + = note: unsigned values cannot be negated + +error[E0600]: cannot apply unary operator `-` to type `char` + --> $DIR/signed_ranges.rs:9:41 + | +LL | type SignedChar = pattern_type!(char is -'A'..); + | ^^^^ cannot apply unary operator `-` + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0277, E0600. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/type/pattern_types/transmute.rs b/tests/ui/type/pattern_types/transmute.rs new file mode 100644 index 00000000000..43dd62a19e7 --- /dev/null +++ b/tests/ui/type/pattern_types/transmute.rs @@ -0,0 +1,32 @@ +#![feature(pattern_types, pattern_type_macro, generic_pattern_types)] +#![expect(incomplete_features)] + +use std::pat::pattern_type; + +// ok +fn create<const S: u32, const E: u32>(x: u32) -> pattern_type!(u32 is S..=E) { + unsafe { std::mem::transmute(x) } +} + +// ok +fn unwrap<const S: u32, const E: u32>(x: pattern_type!(u32 is S..=E)) -> u32 { + unsafe { std::mem::transmute(x) } +} + +// bad, only when S != u32::MIN or E != u32::MAX will this ok +fn non_base_ty_transmute<const S: u32, const E: u32>( + x: Option<pattern_type!(u32 is S..=E)>, +) -> u32 { + unsafe { std::mem::transmute(x) } + //~^ ERROR types of different sizes +} + +// bad, only when S = u32::MIN and E = u32::MAX will this ok +fn wrapped_transmute<const S: u32, const E: u32>( + x: Option<pattern_type!(u32 is S..=E)>, +) -> Option<u32> { + unsafe { std::mem::transmute(x) } + //~^ ERROR types of different sizes +} + +fn main() {} diff --git a/tests/ui/type/pattern_types/transmute.stderr b/tests/ui/type/pattern_types/transmute.stderr new file mode 100644 index 00000000000..578549b515c --- /dev/null +++ b/tests/ui/type/pattern_types/transmute.stderr @@ -0,0 +1,21 @@ +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute.rs:20:14 + | +LL | unsafe { std::mem::transmute(x) } + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `Option<(u32) is S..=E>` (size can vary because of u32) + = note: target type: `u32` (32 bits) + +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute.rs:28:14 + | +LL | unsafe { std::mem::transmute(x) } + | ^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `Option<(u32) is S..=E>` (size can vary because of u32) + = note: target type: `Option<u32>` (64 bits) + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0512`. diff --git a/tests/ui/type/pattern_types/unimplemented_pat.rs b/tests/ui/type/pattern_types/unimplemented_pat.rs index b2398cec7c9..44851ec1a10 100644 --- a/tests/ui/type/pattern_types/unimplemented_pat.rs +++ b/tests/ui/type/pattern_types/unimplemented_pat.rs @@ -1,14 +1,14 @@ //! This test ensures we do not ICE for unimplemented -//! patterns unless the feature gate is enabled. +//! patterns even if the feature gate is enabled. -#![feature(pattern_type_macro)] +#![feature(pattern_type_macro, pattern_types)] use std::pat::pattern_type; type Always = pattern_type!(Option<u32> is Some(_)); -//~^ ERROR: pattern types are unstable +//~^ ERROR: pattern not supported type Binding = pattern_type!(Option<u32> is x); -//~^ ERROR: pattern types are unstable +//~^ ERROR: pattern not supported fn main() {} diff --git a/tests/ui/type/pattern_types/unimplemented_pat.stderr b/tests/ui/type/pattern_types/unimplemented_pat.stderr index 7b0f9cbaa6a..a1e55ed02c4 100644 --- a/tests/ui/type/pattern_types/unimplemented_pat.stderr +++ b/tests/ui/type/pattern_types/unimplemented_pat.stderr @@ -1,23 +1,14 @@ -error[E0658]: pattern types are unstable - --> $DIR/unimplemented_pat.rs:8:15 +error: pattern not supported in pattern types + --> $DIR/unimplemented_pat.rs:8:44 | LL | type Always = pattern_type!(Option<u32> is Some(_)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #123646 <https://github.com/rust-lang/rust/issues/123646> for more information - = help: add `#![feature(pattern_types)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + | ^^^^^^^ -error[E0658]: pattern types are unstable - --> $DIR/unimplemented_pat.rs:11:16 +error: pattern not supported in pattern types + --> $DIR/unimplemented_pat.rs:11:45 | LL | type Binding = pattern_type!(Option<u32> is x); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #123646 <https://github.com/rust-lang/rust/issues/123646> for more information - = help: add `#![feature(pattern_types)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + | ^ error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/type/pattern_types/validity.rs b/tests/ui/type/pattern_types/validity.rs new file mode 100644 index 00000000000..77a4e72f675 --- /dev/null +++ b/tests/ui/type/pattern_types/validity.rs @@ -0,0 +1,37 @@ +//! Check that pattern types have their validity checked + +#![feature(pattern_types)] +#![feature(pattern_type_macro)] + +use std::pat::pattern_type; + +const BAD: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) }; +//~^ ERROR: it is undefined behavior to use this value + +const BAD_UNINIT: pattern_type!(u32 is 1..) = + //~^ ERROR: evaluation of constant value failed + unsafe { std::mem::transmute(std::mem::MaybeUninit::<u32>::uninit()) }; + +const BAD_PTR: pattern_type!(usize is 1..) = unsafe { std::mem::transmute(&42) }; +//~^ ERROR: evaluation of constant value failed + +const BAD_AGGREGATE: (pattern_type!(u32 is 1..), u32) = (unsafe { std::mem::transmute(0) }, 0); +//~^ ERROR: it is undefined behavior to use this value + +struct Foo(Bar); +struct Bar(pattern_type!(u32 is 1..)); + +const BAD_FOO: Foo = Foo(Bar(unsafe { std::mem::transmute(0) })); +//~^ ERROR: it is undefined behavior to use this value + +const CHAR_UNINIT: pattern_type!(char is 'A'..'Z') = + //~^ ERROR: evaluation of constant value failed + unsafe { std::mem::transmute(std::mem::MaybeUninit::<u32>::uninit()) }; + +const CHAR_OOB_PAT: pattern_type!(char is 'A'..'Z') = unsafe { std::mem::transmute('a') }; +//~^ ERROR: it is undefined behavior to use this value + +const CHAR_OOB: pattern_type!(char is 'A'..'Z') = unsafe { std::mem::transmute(u32::MAX) }; +//~^ ERROR: it is undefined behavior to use this value + +fn main() {} diff --git a/tests/ui/type/pattern_types/validity.stderr b/tests/ui/type/pattern_types/validity.stderr new file mode 100644 index 00000000000..5bc18cfba3f --- /dev/null +++ b/tests/ui/type/pattern_types/validity.stderr @@ -0,0 +1,79 @@ +error[E0080]: it is undefined behavior to use this value + --> $DIR/validity.rs:8:1 + | +LL | const BAD: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1 + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 4, align: 4) { + 00 00 00 00 │ .... + } + +error[E0080]: evaluation of constant value failed + --> $DIR/validity.rs:11:1 + | +LL | const BAD_UNINIT: pattern_type!(u32 is 1..) = + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory + +error[E0080]: evaluation of constant value failed + --> $DIR/validity.rs:15:1 + | +LL | const BAD_PTR: pattern_type!(usize is 1..) = unsafe { std::mem::transmute(&42) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer + | + = help: this code performed an operation that depends on the underlying bytes representing a pointer + = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported + +error[E0080]: it is undefined behavior to use this value + --> $DIR/validity.rs:18:1 + | +LL | const BAD_AGGREGATE: (pattern_type!(u32 is 1..), u32) = (unsafe { std::mem::transmute(0) }, 0); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0, but expected something greater or equal to 1 + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 8, align: 4) { + 00 00 00 00 00 00 00 00 │ ........ + } + +error[E0080]: it is undefined behavior to use this value + --> $DIR/validity.rs:24:1 + | +LL | const BAD_FOO: Foo = Foo(Bar(unsafe { std::mem::transmute(0) })); + | ^^^^^^^^^^^^^^^^^^ constructing invalid value at .0.0: encountered 0, but expected something greater or equal to 1 + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 4, align: 4) { + 00 00 00 00 │ .... + } + +error[E0080]: evaluation of constant value failed + --> $DIR/validity.rs:27:1 + | +LL | const CHAR_UNINIT: pattern_type!(char is 'A'..'Z') = + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory + +error[E0080]: it is undefined behavior to use this value + --> $DIR/validity.rs:31:1 + | +LL | const CHAR_OOB_PAT: pattern_type!(char is 'A'..'Z') = unsafe { std::mem::transmute('a') }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 97, but expected something in the range 65..=89 + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 4, align: 4) { + 61 00 00 00 │ a... + } + +error[E0080]: it is undefined behavior to use this value + --> $DIR/validity.rs:34:1 + | +LL | const CHAR_OOB: pattern_type!(char is 'A'..'Z') = unsafe { std::mem::transmute(u32::MAX) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`) + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 4, align: 4) { + ff ff ff ff │ .... + } + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/type/type-ascription-instead-of-statement-end.stderr b/tests/ui/type/type-ascription-instead-of-statement-end.stderr index 34c88642323..34759b413d8 100644 --- a/tests/ui/type/type-ascription-instead-of-statement-end.stderr +++ b/tests/ui/type/type-ascription-instead-of-statement-end.stderr @@ -7,8 +7,9 @@ LL | println!("test"): = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> help: use a semicolon instead | -LL | println!("test"); - | ~ +LL - println!("test"): +LL + println!("test"); + | error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` --> $DIR/type-ascription-instead-of-statement-end.rs:7:21 diff --git a/tests/ui/type/type-ascription-with-fn-call.stderr b/tests/ui/type/type-ascription-with-fn-call.stderr index 2691f10cf3e..4222762373d 100644 --- a/tests/ui/type/type-ascription-with-fn-call.stderr +++ b/tests/ui/type/type-ascription-with-fn-call.stderr @@ -7,8 +7,9 @@ LL | f() : = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> help: use a semicolon instead | -LL | f() ; - | ~ +LL - f() : +LL + f() ; + | error: aborting due to 1 previous error diff --git a/tests/ui/type/type-check/issue-41314.stderr b/tests/ui/type/type-check/issue-41314.stderr index 2a089029b0a..6a1b22c542c 100644 --- a/tests/ui/type/type-check/issue-41314.stderr +++ b/tests/ui/type/type-check/issue-41314.stderr @@ -6,8 +6,9 @@ LL | X::Y { number } => {} | help: use the tuple variant pattern syntax instead | -LL | X::Y(number) => {} - | ~~~~~~~~ +LL - X::Y { number } => {} +LL + X::Y(number) => {} + | error: aborting due to 1 previous error diff --git a/tests/ui/type/type-check/point-at-inference-3.stderr b/tests/ui/type/type-check/point-at-inference-3.stderr index 663799e9f86..58460aefdf8 100644 --- a/tests/ui/type/type-check/point-at-inference-3.stderr +++ b/tests/ui/type/type-check/point-at-inference-3.stderr @@ -15,8 +15,9 @@ note: method defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: change the type of the numeric literal from `u32` to `i32` | -LL | v.push(1i32); - | ~~~ +LL - v.push(1u32); +LL + v.push(1i32); + | error: aborting due to 1 previous error diff --git a/tests/ui/type/type-check/point-at-inference-4.rs b/tests/ui/type/type-check/point-at-inference-4.rs index 5745b738532..258374f299e 100644 --- a/tests/ui/type/type-check/point-at-inference-4.rs +++ b/tests/ui/type/type-check/point-at-inference-4.rs @@ -4,7 +4,6 @@ impl<A, B> S<A, B> { fn infer(&self, a: A, b: B) {} //~^ NOTE method defined here //~| NOTE - //~| NOTE } fn main() { diff --git a/tests/ui/type/type-check/point-at-inference-4.stderr b/tests/ui/type/type-check/point-at-inference-4.stderr index a953ca70ea2..52d603c5980 100644 --- a/tests/ui/type/type-check/point-at-inference-4.stderr +++ b/tests/ui/type/type-check/point-at-inference-4.stderr @@ -1,5 +1,5 @@ error[E0061]: this method takes 2 arguments but 1 argument was supplied - --> $DIR/point-at-inference-4.rs:12:7 + --> $DIR/point-at-inference-4.rs:11:7 | LL | s.infer(0i32); | ^^^^^------ argument #2 is missing @@ -8,14 +8,15 @@ note: method defined here --> $DIR/point-at-inference-4.rs:4:8 | LL | fn infer(&self, a: A, b: B) {} - | ^^^^^ ---- ---- + | ^^^^^ ---- help: provide the argument | -LL | s.infer(0i32, /* b */); - | ~~~~~~~~~~~~~~~ +LL - s.infer(0i32); +LL + s.infer(0i32, /* b */); + | error[E0308]: mismatched types - --> $DIR/point-at-inference-4.rs:19:24 + --> $DIR/point-at-inference-4.rs:18:24 | LL | s.infer(0i32); | - ---- this argument has type `i32`... @@ -31,8 +32,9 @@ LL | let t: S<u32, _> = s; found struct `S<i32, _>` help: change the type of the numeric literal from `i32` to `u32` | -LL | s.infer(0u32); - | ~~~ +LL - s.infer(0i32); +LL + s.infer(0u32); + | error: aborting due to 2 previous errors diff --git a/tests/ui/type/type-dependent-def-issue-49241.stderr b/tests/ui/type/type-dependent-def-issue-49241.stderr index cf372dc5968..9b395af8c13 100644 --- a/tests/ui/type/type-dependent-def-issue-49241.stderr +++ b/tests/ui/type/type-dependent-def-issue-49241.stderr @@ -6,8 +6,9 @@ LL | const l: usize = v.count(); | help: consider using `let` instead of `const` | -LL | let l: usize = v.count(); - | ~~~ +LL - const l: usize = v.count(); +LL + let l: usize = v.count(); + | error: aborting due to 1 previous error diff --git a/tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr b/tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr index 71717c6945e..eea2e75a238 100644 --- a/tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr +++ b/tests/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr @@ -17,7 +17,7 @@ LL | let y = x as dyn MyAdd<i32>; | ^^^^^^^^^^^^^^ `MyAdd` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:6:55 | LL | trait MyAdd<Rhs=Self> { fn add(&self, other: &Rhs) -> Self; } diff --git a/tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr b/tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr index fbe6bfeebb1..53920bc9e02 100644 --- a/tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr +++ b/tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr @@ -13,8 +13,9 @@ LL | fn wrong_arg_type(x: u32) -> u32 { | ^^^^^^^^^^^^^^ ------ help: change the type of the numeric literal from `u16` to `u32` | -LL | let x = wrong_arg_type(0u32); - | ~~~ +LL - let x = wrong_arg_type(0u16); +LL + let x = wrong_arg_type(0u32); + | error[E0308]: mismatched types --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:19:30 @@ -52,8 +53,9 @@ LL | fn function<T>(x: T, y: bool) -> T { | ^^^^^^^^ ---- ------- help: change the type of the numeric literal from `u32` to `u16` | -LL | let x: u16 = function(0u16, 0u8); - | ~~~ +LL - let x: u16 = function(0u32, 0u8); +LL + let x: u16 = function(0u16, 0u8); + | error[E0308]: mismatched types --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:25:27 @@ -77,8 +79,9 @@ LL | fn function<T>(x: T, y: bool) -> T { | ^^^^^^^^ ---- help: change the type of the numeric literal from `u32` to `u16` | -LL | let x: u16 = function(0u16, true); - | ~~~ +LL - let x: u16 = function(0u32, true); +LL + let x: u16 = function(0u16, true); + | error[E0308]: mismatched types --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:26:32 @@ -102,8 +105,9 @@ LL | fn method<T>(&self, x: T) -> T { | ^^^^^^ ---- help: change the type of the numeric literal from `u32` to `u16` | -LL | let x: u16 = (S {}).method(0u16); - | ~~~ +LL - let x: u16 = (S {}).method(0u32); +LL + let x: u16 = (S {}).method(0u16); + | error[E0308]: arguments to this function are incorrect --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:27:5 diff --git a/tests/ui/type_length_limit.rs b/tests/ui/type_length_limit.rs index 87f5ffd76d7..b629455aced 100644 --- a/tests/ui/type_length_limit.rs +++ b/tests/ui/type_length_limit.rs @@ -2,6 +2,9 @@ //@ compile-flags: -Copt-level=0 -Zenforce-type-length-limit //~^^ ERROR reached the type-length limit +// The regex below normalizes the long type file name to make it suitable for compare-modes. +//@ normalize-stderr: "'\$TEST_BUILD_DIR/.*\.long-type.txt'" -> "'$$TEST_BUILD_DIR/$$FILE.long-type.txt'" + // Test that the type length limit can be changed. // The exact type depends on optimizations, so disable them. diff --git a/tests/ui/type_length_limit.stderr b/tests/ui/type_length_limit.stderr index 83353547d34..d913b661c6f 100644 --- a/tests/ui/type_length_limit.stderr +++ b/tests/ui/type_length_limit.stderr @@ -1,11 +1,11 @@ error: reached the type-length limit while instantiating `std::mem::drop::<Option<((((..., ..., ...), ..., ...), ..., ...), ..., ...)>>` - --> $DIR/type_length_limit.rs:32:5 + --> $DIR/type_length_limit.rs:35:5 | LL | drop::<Option<A>>(None); | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding a `#![type_length_limit="4010"]` attribute to your crate - = note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit/type_length_limit.long-type.txt' + = note: the full type name has been written to '$TEST_BUILD_DIR/$FILE.long-type.txt' error: reached the type-length limit while instantiating `<{closure@rt::lang_start<()>::{closure#0}} as FnMut<()>>::call_mut` | diff --git a/tests/ui/typeck/attempted-access-non-fatal.stderr b/tests/ui/typeck/attempted-access-non-fatal.stderr index bff669727a1..03334759baf 100644 --- a/tests/ui/typeck/attempted-access-non-fatal.stderr +++ b/tests/ui/typeck/attempted-access-non-fatal.stderr @@ -18,8 +18,9 @@ LL | let _ = 0.f; | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f32` suffix | -LL | let _ = 0.0f32; - | ~~~~ +LL - let _ = 0.f; +LL + let _ = 0.0f32; + | error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 @@ -29,8 +30,9 @@ LL | let _ = 2.l; | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | -LL | let _ = 2.0f64; - | ~~~~ +LL - let _ = 2.l; +LL + let _ = 2.0f64; + | error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:8:16 @@ -40,8 +42,9 @@ LL | let _ = 12.F; | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f32` suffix | -LL | let _ = 12.0f32; - | ~~~~ +LL - let _ = 12.F; +LL + let _ = 12.0f32; + | error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:9:16 @@ -51,8 +54,9 @@ LL | let _ = 34.L; | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | -LL | let _ = 34.0f64; - | ~~~~ +LL - let _ = 34.L; +LL + let _ = 34.0f64; + | error: aborting due to 6 previous errors diff --git a/tests/ui/typeck/check-args-on-fn-err-2.stderr b/tests/ui/typeck/check-args-on-fn-err-2.stderr index 301bb88dbac..ccc006a902d 100644 --- a/tests/ui/typeck/check-args-on-fn-err-2.stderr +++ b/tests/ui/typeck/check-args-on-fn-err-2.stderr @@ -8,8 +8,9 @@ LL | a((), 1i32 == 2u32); | help: change the type of the numeric literal from `u32` to `i32` | -LL | a((), 1i32 == 2i32); - | ~~~ +LL - a((), 1i32 == 2u32); +LL + a((), 1i32 == 2i32); + | error[E0425]: cannot find function `a` in this scope --> $DIR/check-args-on-fn-err-2.rs:2:5 diff --git a/tests/ui/issues/issue-40610.rs b/tests/ui/typeck/coercion-check-for-addition-issue-40610.rs index c01233605b5..c01233605b5 100644 --- a/tests/ui/issues/issue-40610.rs +++ b/tests/ui/typeck/coercion-check-for-addition-issue-40610.rs diff --git a/tests/ui/issues/issue-40610.stderr b/tests/ui/typeck/coercion-check-for-addition-issue-40610.stderr index 1bd1c4dd57d..5e424862d97 100644 --- a/tests/ui/issues/issue-40610.stderr +++ b/tests/ui/typeck/coercion-check-for-addition-issue-40610.stderr @@ -1,5 +1,5 @@ error[E0369]: cannot add `()` to `()` - --> $DIR/issue-40610.rs:4:8 + --> $DIR/coercion-check-for-addition-issue-40610.rs:4:8 | LL | () + f(&[1.0]); | -- ^ --------- () diff --git a/tests/ui/issues/issue-40861.rs b/tests/ui/typeck/coercion-check-for-indexing-expression-issue-40861.rs index d8a8384a544..d8a8384a544 100644 --- a/tests/ui/issues/issue-40861.rs +++ b/tests/ui/typeck/coercion-check-for-indexing-expression-issue-40861.rs diff --git a/tests/ui/issues/issue-40861.stderr b/tests/ui/typeck/coercion-check-for-indexing-expression-issue-40861.stderr index dec9af4b6d1..13bc0cd94f3 100644 --- a/tests/ui/issues/issue-40861.stderr +++ b/tests/ui/typeck/coercion-check-for-indexing-expression-issue-40861.stderr @@ -1,5 +1,5 @@ error[E0608]: cannot index into a value of type `()` - --> $DIR/issue-40861.rs:4:7 + --> $DIR/coercion-check-for-indexing-expression-issue-40861.rs:4:7 | LL | ()[f(&[1.0])]; | ^^^^^^^^^^^ diff --git a/tests/ui/typeck/cyclic_type_ice.stderr b/tests/ui/typeck/cyclic_type_ice.stderr index 36715b4ee5d..4dc02a53c02 100644 --- a/tests/ui/typeck/cyclic_type_ice.stderr +++ b/tests/ui/typeck/cyclic_type_ice.stderr @@ -22,8 +22,9 @@ LL | let f = |_, _| (); | ^^^^^^ help: provide the argument | -LL | f(/* */, /* */); - | ~~~~~~~~~~~~~~~~ +LL - f(f); +LL + f(/* */, /* */); + | error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/deref-multi.stderr b/tests/ui/typeck/deref-multi.stderr index 4346e273d0d..02513853c48 100644 --- a/tests/ui/typeck/deref-multi.stderr +++ b/tests/ui/typeck/deref-multi.stderr @@ -34,8 +34,9 @@ LL | &x | help: consider removing the `&` and dereferencing the borrow instead | -LL | *x - | ~ +LL - &x +LL + *x + | error[E0308]: mismatched types --> $DIR/deref-multi.rs:17:5 @@ -49,8 +50,9 @@ LL | &x found reference `&Box<i32>` help: consider removing the `&` and dereferencing the borrow instead | -LL | *x - | ~ +LL - &x +LL + *x + | error[E0308]: mismatched types --> $DIR/deref-multi.rs:22:5 diff --git a/tests/ui/typeck/ice-self-mismatch-const-generics.stderr b/tests/ui/typeck/ice-self-mismatch-const-generics.stderr index 068cf3ee903..8b820668129 100644 --- a/tests/ui/typeck/ice-self-mismatch-const-generics.stderr +++ b/tests/ui/typeck/ice-self-mismatch-const-generics.stderr @@ -12,8 +12,9 @@ LL | Self { thing } found struct `GenericStruct<0, _>` help: use the type name directly | -LL | GenericStruct::<1, T> { thing } - | ~~~~~~~~~~~~~~~~~~~~~ +LL - Self { thing } +LL + GenericStruct::<1, T> { thing } + | error[E0308]: mismatched types --> $DIR/ice-self-mismatch-const-generics.rs:20:9 @@ -29,8 +30,9 @@ LL | Self { 0: thing } found struct `GenericStruct2<0, _>` help: use the type name directly | -LL | GenericStruct2::<1, T> { 0: thing } - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - Self { 0: thing } +LL + GenericStruct2::<1, T> { 0: thing } + | error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/ice-unexpected-region-123863.stderr b/tests/ui/typeck/ice-unexpected-region-123863.stderr index 742096f3861..8a4d767c143 100644 --- a/tests/ui/typeck/ice-unexpected-region-123863.stderr +++ b/tests/ui/typeck/ice-unexpected-region-123863.stderr @@ -38,8 +38,9 @@ LL | Inner::concat_strs::<"a">::A | help: if there were a trait named `Example` with associated type `concat_strs` implemented for `Inner<_>`, you could use the fully-qualified path | -LL | <Inner<_> as Example>::concat_strs::A - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - Inner::concat_strs::<"a">::A +LL + <Inner<_> as Example>::concat_strs::A + | error: aborting due to 3 previous errors diff --git a/tests/ui/typeck/issue-103899.current.stderr b/tests/ui/typeck/issue-103899.current.stderr new file mode 100644 index 00000000000..a3a164907be --- /dev/null +++ b/tests/ui/typeck/issue-103899.current.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `(): BaseWithAssoc` is not satisfied + --> $DIR/issue-103899.rs:24:54 + | +LL | fn trigger<L: WrapperWithAssoc<BaseAssoc = ()>>() -> DoubleProject<L> { + | ^^^^^^^^^^^^^^^^ the trait `BaseWithAssoc` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/issue-103899.rs:4:1 + | +LL | trait BaseWithAssoc { + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/typeck/issue-103899.next.stderr b/tests/ui/typeck/issue-103899.next.stderr new file mode 100644 index 00000000000..a3a164907be --- /dev/null +++ b/tests/ui/typeck/issue-103899.next.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `(): BaseWithAssoc` is not satisfied + --> $DIR/issue-103899.rs:24:54 + | +LL | fn trigger<L: WrapperWithAssoc<BaseAssoc = ()>>() -> DoubleProject<L> { + | ^^^^^^^^^^^^^^^^ the trait `BaseWithAssoc` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/issue-103899.rs:4:1 + | +LL | trait BaseWithAssoc { + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/typeck/issue-103899.rs b/tests/ui/typeck/issue-103899.rs index 81ab92a8994..92356ecf288 100644 --- a/tests/ui/typeck/issue-103899.rs +++ b/tests/ui/typeck/issue-103899.rs @@ -1,9 +1,5 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) -//@ check-fail -//@ failure-status: 101 -//@ dont-check-compiler-stderr -//@ known-bug: #103899 trait BaseWithAssoc { type Assoc; @@ -26,6 +22,7 @@ struct DoubleProject<L: WrapperWithAssoc> { } fn trigger<L: WrapperWithAssoc<BaseAssoc = ()>>() -> DoubleProject<L> { + //~^ ERROR the trait bound `(): BaseWithAssoc` is not satisfied [E0277] loop {} } diff --git a/tests/ui/typeck/issue-104582.stderr b/tests/ui/typeck/issue-104582.stderr index 61b6b23642c..704579698b9 100644 --- a/tests/ui/typeck/issue-104582.stderr +++ b/tests/ui/typeck/issue-104582.stderr @@ -6,8 +6,9 @@ LL | let my_var: String(String?); | help: if you meant to express that the type might not contain a value, use the `Option` wrapper type | -LL | let my_var: String(Option<String>); - | +++++++ ~ +LL - let my_var: String(String?); +LL + let my_var: String(Option<String>); + | error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> $DIR/issue-104582.rs:2:17 @@ -17,8 +18,9 @@ LL | let my_var: String(String?); | help: use angle brackets instead | -LL | let my_var: String<String?>; - | ~ ~ +LL - let my_var: String(String?); +LL + let my_var: String<String?>; + | error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/issue-105946.rs b/tests/ui/typeck/issue-105946.rs index f53f31138f8..0ee70f9346c 100644 --- a/tests/ui/typeck/issue-105946.rs +++ b/tests/ui/typeck/issue-105946.rs @@ -1,4 +1,5 @@ fn digit() -> str { + //~^ ERROR the size for values of type return {}; //~^ ERROR: mismatched types [E0308] } diff --git a/tests/ui/typeck/issue-105946.stderr b/tests/ui/typeck/issue-105946.stderr index 33d4e0b141a..30fe2000a46 100644 --- a/tests/ui/typeck/issue-105946.stderr +++ b/tests/ui/typeck/issue-105946.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `_y` in this scope - --> $DIR/issue-105946.rs:6:10 + --> $DIR/issue-105946.rs:7:10 | LL | let [_y..] = [Box::new(1), Box::new(2)]; | ^^ not found in this scope @@ -10,7 +10,7 @@ LL | let [_y @ ..] = [Box::new(1), Box::new(2)]; | + error[E0658]: `X..` patterns in slices are experimental - --> $DIR/issue-105946.rs:6:10 + --> $DIR/issue-105946.rs:7:10 | LL | let [_y..] = [Box::new(1), Box::new(2)]; | ^^^^ @@ -19,19 +19,28 @@ LL | let [_y..] = [Box::new(1), Box::new(2)]; = help: add `#![feature(half_open_range_patterns_in_slices)]` 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[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/issue-105946.rs:1:15 + | +LL | fn digit() -> str { + | ^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` + = note: the return type of a function must have a statically known size + error[E0308]: mismatched types - --> $DIR/issue-105946.rs:2:12 + --> $DIR/issue-105946.rs:3:12 | LL | return {}; | ^^ expected `str`, found `()` error[E0527]: pattern requires 1 element but array has 2 - --> $DIR/issue-105946.rs:6:9 + --> $DIR/issue-105946.rs:7:9 | LL | let [_y..] = [Box::new(1), Box::new(2)]; | ^^^^^^ expected 2 elements -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0308, E0425, E0527, E0658. -For more information about an error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0277, E0308, E0425, E0527, E0658. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/typeck/issue-107775.stderr b/tests/ui/typeck/issue-107775.stderr index dad7e1581e7..1be26897469 100644 --- a/tests/ui/typeck/issue-107775.stderr +++ b/tests/ui/typeck/issue-107775.stderr @@ -6,7 +6,7 @@ LL | map.insert(1, Struct::do_something); | | | ... which causes `map` to have type `HashMap<{integer}, fn(u8) -> Pin<Box<dyn Future<Output = ()> + Send>> {<Struct as Trait>::do_something::<'_>}>` LL | Self { map } - | ^^^ expected `HashMap<u16, fn(u8) -> Pin<...>>`, found `HashMap<{integer}, ...>` + | ^^^ expected `HashMap<u16, fn(u8) -> Pin<Box<...>>>`, found `HashMap<{integer}, ...>` | = note: expected struct `HashMap<u16, fn(_) -> Pin<Box<(dyn Future<Output = ()> + Send + 'static)>>>` found struct `HashMap<{integer}, fn(_) -> Pin<Box<dyn Future<Output = ()> + Send>> {<Struct as Trait>::do_something::<'_>}>` diff --git a/tests/ui/typeck/issue-110052.stderr b/tests/ui/typeck/issue-110052.stderr index 5eb10d9a30e..649fc8429b9 100644 --- a/tests/ui/typeck/issue-110052.stderr +++ b/tests/ui/typeck/issue-110052.stderr @@ -6,10 +6,12 @@ LL | for<'iter> dyn Validator<<&'iter I>::Item>:, | help: use fully-qualified syntax | -LL | for<'iter> dyn Validator<<&'iter I as IntoAsyncIterator>::Item>:, - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | for<'iter> dyn Validator<<&'iter I as IntoIterator>::Item>:, - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - for<'iter> dyn Validator<<&'iter I>::Item>:, +LL + for<'iter> dyn Validator<<&'iter I as IntoAsyncIterator>::Item>:, + | +LL - for<'iter> dyn Validator<<&'iter I>::Item>:, +LL + for<'iter> dyn Validator<<&'iter I as IntoIterator>::Item>:, + | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr b/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr index f81736245f3..18a992b2f34 100644 --- a/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr +++ b/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr @@ -8,8 +8,9 @@ LL | let _a = _ptr1 + 5; | help: consider using `wrapping_add` or `add` for pointer + {integer} | -LL | let _a = _ptr1.wrapping_add(5); - | ~~~~~~~~~~~~~~ + +LL - let _a = _ptr1 + 5; +LL + let _a = _ptr1.wrapping_add(5); + | error[E0369]: cannot subtract `{integer}` from `*const u32` --> $DIR/issue-112252-ptr-arithmetics-help.rs:7:20 @@ -21,8 +22,9 @@ LL | let _b = _ptr1 - 5; | help: consider using `wrapping_sub` or `sub` for pointer - {integer} | -LL | let _b = _ptr1.wrapping_sub(5); - | ~~~~~~~~~~~~~~ + +LL - let _b = _ptr1 - 5; +LL + let _b = _ptr1.wrapping_sub(5); + | error[E0369]: cannot subtract `*const u32` from `*const u32` --> $DIR/issue-112252-ptr-arithmetics-help.rs:8:20 @@ -34,8 +36,9 @@ LL | let _c = _ptr2 - _ptr1; | help: consider using `offset_from` for pointer - pointer if the pointers point to the same allocation | -LL | let _c = unsafe { _ptr2.offset_from(_ptr1) }; - | ++++++++ ~~~~~~~~~~~~~ +++ +LL - let _c = _ptr2 - _ptr1; +LL + let _c = unsafe { _ptr2.offset_from(_ptr1) }; + | error[E0608]: cannot index into a value of type `*const u32` --> $DIR/issue-112252-ptr-arithmetics-help.rs:9:19 @@ -45,8 +48,9 @@ LL | let _d = _ptr1[5]; | help: consider using `wrapping_add` or `add` for indexing into raw pointer | -LL | let _d = _ptr1.wrapping_add(5); - | ~~~~~~~~~~~~~~ ~ +LL - let _d = _ptr1[5]; +LL + let _d = _ptr1.wrapping_add(5); + | error: aborting due to 4 previous errors diff --git a/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr b/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr index 731f234c162..de993df722c 100644 --- a/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr +++ b/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr @@ -8,8 +8,9 @@ LL | break 9; | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break 9; +LL + break; + | error[E0571]: `break` with value from a `while` loop --> $DIR/issue-114529-illegal-break-with-value.rs:16:13 @@ -21,8 +22,9 @@ LL | break v; | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break v; +LL + break; + | error[E0571]: `break` with value from a `while` loop --> $DIR/issue-114529-illegal-break-with-value.rs:22:9 @@ -36,8 +38,11 @@ LL | | }); | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break (|| { +LL - let local = 9; +LL - }); +LL + break; + | error: aborting due to 3 previous errors diff --git a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.next.stderr b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.next.stderr index 1bcc0dbaf67..92ad83c3300 100644 --- a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.next.stderr +++ b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.next.stderr @@ -9,6 +9,8 @@ error: the constant `N` is not of type `usize` | LL | fn func<const N: u32>() -> [(); N]; | ^^^^^^^ expected `usize`, found `u32` + | + = note: the length of array `[(); N]` must be type `usize` error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/issue-29181.stderr b/tests/ui/typeck/issue-29181.stderr index 53addf2fe4d..ca82405966e 100644 --- a/tests/ui/typeck/issue-29181.stderr +++ b/tests/ui/typeck/issue-29181.stderr @@ -13,7 +13,7 @@ LL | let _ = |x: f64| x * 2.0.exp(); help: you must specify a concrete type for this numeric value, like `f32` | LL | let _ = |x: f64| x * 2.0_f32.exp(); - | ~~~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/issue-43189.rs b/tests/ui/typeck/issue-43189.rs index 9c8cc70e63a..ee0fe15eeba 100644 --- a/tests/ui/typeck/issue-43189.rs +++ b/tests/ui/typeck/issue-43189.rs @@ -1,7 +1,6 @@ // Issue 46112: An extern crate pub re-exporting libcore was causing // paths rooted from `std` to be misrendered in the diagnostic output. -//@ ignore-windows //@ aux-build:xcrate-issue-43189-a.rs //@ aux-build:xcrate-issue-43189-b.rs diff --git a/tests/ui/typeck/issue-43189.stderr b/tests/ui/typeck/issue-43189.stderr index 8432cbeca2a..3cc1ba9ddfe 100644 --- a/tests/ui/typeck/issue-43189.stderr +++ b/tests/ui/typeck/issue-43189.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `a` found for unit type `()` in the current scope - --> $DIR/issue-43189.rs:10:8 + --> $DIR/issue-43189.rs:9:8 | LL | ().a(); | ^ method not found in `()` diff --git a/tests/ui/typeck/issue-46112.rs b/tests/ui/typeck/issue-46112.rs index 4671ddd06c8..cc8029771d6 100644 --- a/tests/ui/typeck/issue-46112.rs +++ b/tests/ui/typeck/issue-46112.rs @@ -1,7 +1,6 @@ // Issue 46112: An extern crate pub re-exporting libcore was causing // paths rooted from `std` to be misrendered in the diagnostic output. -//@ ignore-windows //@ aux-build:xcrate-issue-46112-rexport-core.rs extern crate xcrate_issue_46112_rexport_core; diff --git a/tests/ui/typeck/issue-46112.stderr b/tests/ui/typeck/issue-46112.stderr index 16beaea75db..9d439d10f1e 100644 --- a/tests/ui/typeck/issue-46112.stderr +++ b/tests/ui/typeck/issue-46112.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-46112.rs:9:21 + --> $DIR/issue-46112.rs:8:21 | LL | fn main() { test(Ok(())); } | -- ^^ expected `Option<()>`, found `()` @@ -9,7 +9,7 @@ LL | fn main() { test(Ok(())); } = note: expected enum `Option<()>` found unit type `()` help: the type constructed contains `()` due to the type of the argument passed - --> $DIR/issue-46112.rs:9:18 + --> $DIR/issue-46112.rs:8:18 | LL | fn main() { test(Ok(())); } | ^^^--^ diff --git a/tests/ui/typeck/issue-53712.stderr b/tests/ui/typeck/issue-53712.stderr index ffaf5cde1d7..16a7ce0ea62 100644 --- a/tests/ui/typeck/issue-53712.stderr +++ b/tests/ui/typeck/issue-53712.stderr @@ -6,8 +6,9 @@ LL | arr.0; | help: instead of using tuple indexing, use array indexing | -LL | arr[0]; - | ~ + +LL - arr.0; +LL + arr[0]; + | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr b/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr index b9bdf6f9a39..ed0e4eb9ece 100644 --- a/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr +++ b/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr @@ -6,16 +6,19 @@ LL | let foo::Foo {} = foo::Foo::default(); | help: include the missing field in the pattern and ignore the inaccessible fields | -LL | let foo::Foo { visible, .. } = foo::Foo::default(); - | ~~~~~~~~~~~~~~~ +LL - let foo::Foo {} = foo::Foo::default(); +LL + let foo::Foo { visible, .. } = foo::Foo::default(); + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | let foo::Foo { visible: _, .. } = foo::Foo::default(); - | ~~~~~~~~~~~~~~~~~~ +LL - let foo::Foo {} = foo::Foo::default(); +LL + let foo::Foo { visible: _, .. } = foo::Foo::default(); + | help: or always ignore missing fields here | -LL | let foo::Foo { .. } = foo::Foo::default(); - | ~~~~~~ +LL - let foo::Foo {} = foo::Foo::default(); +LL + let foo::Foo { .. } = foo::Foo::default(); + | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/method-chain-gats.stderr b/tests/ui/typeck/method-chain-gats.stderr index 63383792214..d3a54dbd0f9 100644 --- a/tests/ui/typeck/method-chain-gats.stderr +++ b/tests/ui/typeck/method-chain-gats.stderr @@ -20,7 +20,7 @@ LL | Self::Base<B>: Functor<B>; help: consider further restricting the associated type | LL | T::Base<B>: Functor<B, Base<C> = T::Base<C>>, <T as Base>::Base<C>: Functor<C> - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/typeck/mismatched-map-under-self.stderr b/tests/ui/typeck/mismatched-map-under-self.stderr index 59de00a58bb..541de25749e 100644 --- a/tests/ui/typeck/mismatched-map-under-self.stderr +++ b/tests/ui/typeck/mismatched-map-under-self.stderr @@ -14,7 +14,7 @@ LL | fn values(&self) -> Self::Values; help: change the self-receiver type to match the trait | LL | fn values(&self) -> Self::Values { - | ~~~~~ + | + error[E0631]: type mismatch in function arguments --> $DIR/mismatched-map-under-self.rs:12:18 diff --git a/tests/ui/typeck/path-to-method-sugg-unresolved-expr.rs b/tests/ui/typeck/path-to-method-sugg-unresolved-expr.rs index 7b4f62fea0c..e095850879c 100644 --- a/tests/ui/typeck/path-to-method-sugg-unresolved-expr.rs +++ b/tests/ui/typeck/path-to-method-sugg-unresolved-expr.rs @@ -5,6 +5,6 @@ fn main() { let page_size = page_size::get(); //~^ ERROR failed to resolve: use of unresolved module or unlinked crate `page_size` //~| NOTE use of unresolved module or unlinked crate `page_size` - //@[cargo-invoked]~^^^ HELP if you wanted to use a crate named `page_size`, use `cargo add - //@[only-rustc]~^^^^ HELP you might be missing a crate named `page_size` + //[cargo-invoked]~^^^ HELP if you wanted to use a crate named `page_size`, use `cargo add + //[only-rustc]~^^^^ HELP you might be missing a crate named `page_size` } diff --git a/tests/ui/typeck/ptr-null-mutability-suggestions.stderr b/tests/ui/typeck/ptr-null-mutability-suggestions.stderr index 2912977a461..aa1e79ac0d4 100644 --- a/tests/ui/typeck/ptr-null-mutability-suggestions.stderr +++ b/tests/ui/typeck/ptr-null-mutability-suggestions.stderr @@ -15,8 +15,9 @@ LL | fn expecting_null_mut(_: *mut u8) {} | ^^^^^^^^^^^^^^^^^^ ---------- help: consider using `core::ptr::null_mut` instead | -LL | expecting_null_mut(core::ptr::null_mut()); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - expecting_null_mut(ptr::null()); +LL + expecting_null_mut(core::ptr::null_mut()); + | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/remove-extra-argument.stderr b/tests/ui/typeck/remove-extra-argument.stderr index d4e0dcb50ae..17e1b613cd9 100644 --- a/tests/ui/typeck/remove-extra-argument.stderr +++ b/tests/ui/typeck/remove-extra-argument.stderr @@ -8,7 +8,7 @@ note: function defined here --> $DIR/remove-extra-argument.rs:3:4 | LL | fn l(_a: Vec<u8>) {} - | ^ ----------- + | ^ help: remove the extra argument | LL - l(vec![], vec![]) diff --git a/tests/ui/typeck/remove-semi-but-confused-char.stderr b/tests/ui/typeck/remove-semi-but-confused-char.stderr index 2d0b53a60ce..7f5c0758dd1 100644 --- a/tests/ui/typeck/remove-semi-but-confused-char.stderr +++ b/tests/ui/typeck/remove-semi-but-confused-char.stderr @@ -6,8 +6,9 @@ LL | num * num; | help: Unicode character ';' (Greek Question Mark) looks like ';' (Semicolon), but it is not | -LL | num * num; - | ~ +LL - num * num; +LL + num * num; + | error[E0308]: mismatched types --> $DIR/remove-semi-but-confused-char.rs:5:28 diff --git a/tests/ui/typeck/return_type_containing_closure.rs b/tests/ui/typeck/return_type_containing_closure.rs index b81cac0a58a..a9bb89bae2d 100644 --- a/tests/ui/typeck/return_type_containing_closure.rs +++ b/tests/ui/typeck/return_type_containing_closure.rs @@ -2,7 +2,7 @@ fn foo() { //~ HELP try adding a return type vec!['a'].iter().map(|c| c) //~^ ERROR mismatched types [E0308] - //~| NOTE expected `()`, found `Map<Iter<'_, char>, ...>` + //~| NOTE expected `()`, found `Map<Iter<'_, char>, {closure@...}>` //~| NOTE expected unit type `()` //~| HELP consider using a semicolon here } diff --git a/tests/ui/typeck/return_type_containing_closure.stderr b/tests/ui/typeck/return_type_containing_closure.stderr index 3f14650a82c..a60bf79a57b 100644 --- a/tests/ui/typeck/return_type_containing_closure.stderr +++ b/tests/ui/typeck/return_type_containing_closure.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/return_type_containing_closure.rs:3:5 | LL | vec!['a'].iter().map(|c| c) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Map<Iter<'_, char>, ...>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Map<Iter<'_, char>, {closure@...}>` | = note: expected unit type `()` found struct `Map<std::slice::Iter<'_, char>, {closure@$DIR/return_type_containing_closure.rs:3:26: 3:29}>` diff --git a/tests/ui/typeck/struct-enum-wrong-args.stderr b/tests/ui/typeck/struct-enum-wrong-args.stderr index e58d162901e..d1003fbb6b3 100644 --- a/tests/ui/typeck/struct-enum-wrong-args.stderr +++ b/tests/ui/typeck/struct-enum-wrong-args.stderr @@ -38,8 +38,9 @@ note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL help: provide the argument | -LL | let _ = Ok(/* value */); - | ~~~~~~~~~~~~~ +LL - let _ = Ok(); +LL + let _ = Ok(/* value */); + | error[E0061]: this struct takes 1 argument but 0 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:9:13 @@ -54,8 +55,9 @@ LL | struct Wrapper(i32); | ^^^^^^^ help: provide the argument | -LL | let _ = Wrapper(/* i32 */); - | ~~~~~~~~~~~ +LL - let _ = Wrapper(); +LL + let _ = Wrapper(/* i32 */); + | error[E0061]: this struct takes 1 argument but 2 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:10:13 @@ -87,8 +89,9 @@ LL | struct DoubleWrapper(i32, i32); | ^^^^^^^^^^^^^ help: provide the arguments | -LL | let _ = DoubleWrapper(/* i32 */, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = DoubleWrapper(); +LL + let _ = DoubleWrapper(/* i32 */, /* i32 */); + | error[E0061]: this struct takes 2 arguments but 1 argument was supplied --> $DIR/struct-enum-wrong-args.rs:12:13 @@ -103,8 +106,9 @@ LL | struct DoubleWrapper(i32, i32); | ^^^^^^^^^^^^^ help: provide the argument | -LL | let _ = DoubleWrapper(5, /* i32 */); - | ~~~~~~~~~~~~~~ +LL - let _ = DoubleWrapper(5); +LL + let _ = DoubleWrapper(5, /* i32 */); + | error[E0061]: this struct takes 2 arguments but 3 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:13:13 diff --git a/tests/ui/typeck/suggest-arg-comma-delete-ice.stderr b/tests/ui/typeck/suggest-arg-comma-delete-ice.stderr index 53608391f3c..0b899ad2712 100644 --- a/tests/ui/typeck/suggest-arg-comma-delete-ice.stderr +++ b/tests/ui/typeck/suggest-arg-comma-delete-ice.stderr @@ -6,8 +6,9 @@ LL | main(rahh); | help: Unicode character ')' (Fullwidth Right Parenthesis) looks like ')' (Right Parenthesis), but it is not | -LL | main(rahh); - | ~ +LL - main(rahh); +LL + main(rahh); + | error[E0425]: cannot find value `rahh` in this scope --> $DIR/suggest-arg-comma-delete-ice.rs:15:10 diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr index d2a850d7dbf..c5bf9a47e91 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr @@ -71,8 +71,9 @@ LL | static TEST3: _ = "test"; | help: replace this with a fully-specified type | -LL | static TEST3: &str = "test"; - | ~~~~ +LL - static TEST3: _ = "test"; +LL + static TEST3: &str = "test"; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:16:15 @@ -82,8 +83,9 @@ LL | static TEST4: _ = 145; | help: replace this with a fully-specified type | -LL | static TEST4: i32 = 145; - | ~~~ +LL - static TEST4: _ = 145; +LL + static TEST4: i32 = 145; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:19:16 @@ -95,8 +97,9 @@ LL | static TEST5: (_, _) = (1, 2); | help: replace this with a fully-specified type | -LL | static TEST5: (i32, i32) = (1, 2); - | ~~~~~~~~~~ +LL - static TEST5: (_, _) = (1, 2); +LL + static TEST5: (i32, i32) = (1, 2); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:22:13 @@ -106,8 +109,9 @@ LL | fn test6(_: _) { } | help: use type parameters instead | -LL | fn test6<T>(_: T) { } - | +++ ~ +LL - fn test6(_: _) { } +LL + fn test6<T>(_: T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:25:18 @@ -117,8 +121,9 @@ LL | fn test6_b<T>(_: _, _: T) { } | help: use type parameters instead | -LL | fn test6_b<T, U>(_: U, _: T) { } - | +++ ~ +LL - fn test6_b<T>(_: _, _: T) { } +LL + fn test6_b<T, U>(_: U, _: T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:28:30 @@ -128,8 +133,9 @@ LL | fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { } | help: use type parameters instead | -LL | fn test6_c<T, K, L, A, B, U>(_: U, _: (T, K, L, A, B)) { } - | +++ ~ +LL - fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { } +LL + fn test6_c<T, K, L, A, B, U>(_: U, _: (T, K, L, A, B)) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:31:13 @@ -139,8 +145,9 @@ LL | fn test7(x: _) { let _x: usize = x; } | help: use type parameters instead | -LL | fn test7<T>(x: T) { let _x: usize = x; } - | +++ ~ +LL - fn test7(x: _) { let _x: usize = x; } +LL + fn test7<T>(x: T) { let _x: usize = x; } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:34:22 @@ -159,8 +166,9 @@ LL | fn test8(_f: fn() -> _) { } | help: use type parameters instead | -LL | fn test8<T>(_f: fn() -> T) { } - | +++ ~ +LL - fn test8(_f: fn() -> _) { } +LL + fn test8<T>(_f: fn() -> T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:48:26 @@ -188,8 +196,9 @@ LL | fn clone(&self) -> _ { Test9 } | help: try replacing `_` with the type in the corresponding trait method signature | -LL | fn clone(&self) -> Test9 { Test9 } - | ~~~~~ +LL - fn clone(&self) -> _ { Test9 } +LL + fn clone(&self) -> Test9 { Test9 } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:62:37 @@ -199,8 +208,9 @@ LL | fn clone_from(&mut self, other: _) { *self = Test9; } | help: try replacing `_` with the type in the corresponding trait method signature | -LL | fn clone_from(&mut self, other: &Test9) { *self = Test9; } - | ~~~~~~ +LL - fn clone_from(&mut self, other: _) { *self = Test9; } +LL + fn clone_from(&mut self, other: &Test9) { *self = Test9; } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/typeck_type_placeholder_item.rs:67:8 @@ -235,8 +245,9 @@ LL | static B: _ = 42; | help: replace this with a fully-specified type | -LL | static B: i32 = 42; - | ~~~ +LL - static B: _ = 42; +LL + static B: i32 = 42; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:77:22 @@ -246,8 +257,9 @@ LL | static C: Option<_> = Some(42); | help: replace this with a fully-specified type | -LL | static C: Option<i32> = Some(42); - | ~~~~~~~~~~~ +LL - static C: Option<_> = Some(42); +LL + static C: Option<i32> = Some(42); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:79:21 @@ -276,8 +288,9 @@ LL | static FN_TEST3: _ = "test"; | help: replace this with a fully-specified type | -LL | static FN_TEST3: &str = "test"; - | ~~~~ +LL - static FN_TEST3: _ = "test"; +LL + static FN_TEST3: &str = "test"; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:88:22 @@ -287,8 +300,9 @@ LL | static FN_TEST4: _ = 145; | help: replace this with a fully-specified type | -LL | static FN_TEST4: i32 = 145; - | ~~~ +LL - static FN_TEST4: _ = 145; +LL + static FN_TEST4: i32 = 145; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:91:23 @@ -300,8 +314,9 @@ LL | static FN_TEST5: (_, _) = (1, 2); | help: replace this with a fully-specified type | -LL | static FN_TEST5: (i32, i32) = (1, 2); - | ~~~~~~~~~~ +LL - static FN_TEST5: (_, _) = (1, 2); +LL + static FN_TEST5: (i32, i32) = (1, 2); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:94:20 @@ -311,8 +326,9 @@ LL | fn fn_test6(_: _) { } | help: use type parameters instead | -LL | fn fn_test6<T>(_: T) { } - | +++ ~ +LL - fn fn_test6(_: _) { } +LL + fn fn_test6<T>(_: T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:97:20 @@ -322,8 +338,9 @@ LL | fn fn_test7(x: _) { let _x: usize = x; } | help: use type parameters instead | -LL | fn fn_test7<T>(x: T) { let _x: usize = x; } - | +++ ~ +LL - fn fn_test7(x: _) { let _x: usize = x; } +LL + fn fn_test7<T>(x: T) { let _x: usize = x; } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:100:29 @@ -342,8 +359,9 @@ LL | fn fn_test8(_f: fn() -> _) { } | help: use type parameters instead | -LL | fn fn_test8<T>(_f: fn() -> T) { } - | +++ ~ +LL - fn fn_test8(_f: fn() -> _) { } +LL + fn fn_test8<T>(_f: fn() -> T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:115:28 @@ -353,8 +371,9 @@ LL | fn clone(&self) -> _ { FnTest9 } | help: try replacing `_` with the type in the corresponding trait method signature | -LL | fn clone(&self) -> FnTest9 { FnTest9 } - | ~~~~~~~ +LL - fn clone(&self) -> _ { FnTest9 } +LL + fn clone(&self) -> FnTest9 { FnTest9 } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:118:41 @@ -364,8 +383,9 @@ LL | fn clone_from(&mut self, other: _) { *self = FnTest9; } | help: try replacing `_` with the type in the corresponding trait method signature | -LL | fn clone_from(&mut self, other: &FnTest9) { *self = FnTest9; } - | ~~~~~~~~ +LL - fn clone_from(&mut self, other: _) { *self = FnTest9; } +LL + fn clone_from(&mut self, other: &FnTest9) { *self = FnTest9; } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/typeck_type_placeholder_item.rs:123:12 @@ -427,8 +447,9 @@ LL | fn method_test1(&self, x: _); | help: use type parameters instead | -LL | fn method_test1<T>(&self, x: T); - | +++ ~ +LL - fn method_test1(&self, x: _); +LL + fn method_test1<T>(&self, x: T); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:142:31 @@ -440,8 +461,9 @@ LL | fn method_test2(&self, x: _) -> _; | help: use type parameters instead | -LL | fn method_test2<T>(&self, x: T) -> T; - | +++ ~ ~ +LL - fn method_test2(&self, x: _) -> _; +LL + fn method_test2<T>(&self, x: T) -> T; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:144:31 @@ -451,8 +473,9 @@ LL | fn method_test3(&self) -> _; | help: use type parameters instead | -LL | fn method_test3<T>(&self) -> T; - | +++ ~ +LL - fn method_test3(&self) -> _; +LL + fn method_test3<T>(&self) -> T; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:146:26 @@ -462,8 +485,9 @@ LL | fn assoc_fn_test1(x: _); | help: use type parameters instead | -LL | fn assoc_fn_test1<T>(x: T); - | +++ ~ +LL - fn assoc_fn_test1(x: _); +LL + fn assoc_fn_test1<T>(x: T); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:148:26 @@ -475,8 +499,9 @@ LL | fn assoc_fn_test2(x: _) -> _; | help: use type parameters instead | -LL | fn assoc_fn_test2<T>(x: T) -> T; - | +++ ~ ~ +LL - fn assoc_fn_test2(x: _) -> _; +LL + fn assoc_fn_test2<T>(x: T) -> T; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:150:28 @@ -486,8 +511,9 @@ LL | fn assoc_fn_test3() -> _; | help: use type parameters instead | -LL | fn assoc_fn_test3<T>() -> T; - | +++ ~ +LL - fn assoc_fn_test3() -> _; +LL + fn assoc_fn_test3<T>() -> T; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/typeck_type_placeholder_item.rs:154:21 @@ -497,8 +523,9 @@ LL | struct BadStruct<_>(_); | help: use type parameters instead | -LL | struct BadStruct<T>(T); - | ~ ~ +LL - struct BadStruct<_>(_); +LL + struct BadStruct<T>(T); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for implementations --> $DIR/typeck_type_placeholder_item.rs:159:15 @@ -522,8 +549,9 @@ LL | struct BadStruct1<_, _>(_); | help: use type parameters instead | -LL | struct BadStruct1<T, _>(T); - | ~ ~ +LL - struct BadStruct1<_, _>(_); +LL + struct BadStruct1<T, _>(T); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/typeck_type_placeholder_item.rs:172:25 @@ -533,8 +561,9 @@ LL | struct BadStruct2<_, T>(_, T); | help: use type parameters instead | -LL | struct BadStruct2<U, T>(U, T); - | ~ ~ +LL - struct BadStruct2<_, T>(_, T); +LL + struct BadStruct2<U, T>(U, T); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases --> $DIR/typeck_type_placeholder_item.rs:176:14 @@ -562,8 +591,9 @@ LL | const D: _ = 42; | help: replace this with a fully-specified type | -LL | const D: i32 = 42; - | ~~~ +LL - const D: _ = 42; +LL + const D: i32 = 42; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants --> $DIR/typeck_type_placeholder_item.rs:209:14 @@ -597,8 +627,9 @@ LL | const _: Option<_> = map(value); | help: replace this with a fully-specified type | -LL | const _: Option<u8> = map(value); - | ~~~~~~~~~~ +LL - const _: Option<_> = map(value); +LL + const _: Option<u8> = map(value); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:226:31 @@ -638,8 +669,9 @@ LL | fn test10(&self, _x : _) { } | help: use type parameters instead | -LL | fn test10<T>(&self, _x : T) { } - | +++ ~ +LL - fn test10(&self, _x : _) { } +LL + fn test10<T>(&self, _x : T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:107:31 @@ -658,8 +690,9 @@ LL | fn fn_test10(&self, _x : _) { } | help: use type parameters instead | -LL | fn fn_test10<T>(&self, _x : T) { } - | +++ ~ +LL - fn fn_test10(&self, _x : _) { } +LL + fn fn_test10<T>(&self, _x : T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types --> $DIR/typeck_type_placeholder_item.rs:202:14 diff --git a/tests/ui/typeck/typeck_type_placeholder_item_help.stderr b/tests/ui/typeck/typeck_type_placeholder_item_help.stderr index a05e27cebfc..afdd58e0a03 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item_help.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item_help.stderr @@ -15,8 +15,9 @@ LL | const TEST2: _ = 42u32; | help: replace this with a fully-specified type | -LL | const TEST2: u32 = 42u32; - | ~~~ +LL - const TEST2: _ = 42u32; +LL + const TEST2: u32 = 42u32; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/typeck_type_placeholder_item_help.rs:10:14 @@ -26,8 +27,9 @@ LL | const TEST3: _ = Some(42); | help: replace this with a fully-specified type | -LL | const TEST3: Option<i32> = Some(42); - | ~~~~~~~~~~~ +LL - const TEST3: _ = Some(42); +LL + const TEST3: Option<i32> = Some(42); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item_help.rs:13:22 @@ -49,8 +51,9 @@ LL | const TEST6: _ = 13; | help: replace this with a fully-specified type | -LL | const TEST6: i32 = 13; - | ~~~ +LL - const TEST6: _ = 13; +LL + const TEST6: i32 = 13; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants --> $DIR/typeck_type_placeholder_item_help.rs:18:18 @@ -60,8 +63,9 @@ LL | const TEST5: _ = 42; | help: replace this with a fully-specified type | -LL | const TEST5: i32 = 42; - | ~~~ +LL - const TEST5: _ = 42; +LL + const TEST5: i32 = 42; + | error[E0308]: mismatched types --> $DIR/typeck_type_placeholder_item_help.rs:30:28 diff --git a/tests/ui/issues/issue-41139.rs b/tests/ui/typeck/unsized-rvalue-issue-41139.rs index 94c53216f50..94c53216f50 100644 --- a/tests/ui/issues/issue-41139.rs +++ b/tests/ui/typeck/unsized-rvalue-issue-41139.rs diff --git a/tests/ui/issues/issue-41139.stderr b/tests/ui/typeck/unsized-rvalue-issue-41139.stderr index d7b35245d8f..aba0423eeb3 100644 --- a/tests/ui/issues/issue-41139.stderr +++ b/tests/ui/typeck/unsized-rvalue-issue-41139.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `&dyn Fn() -> (dyn Trait + 'static)` - --> $DIR/issue-41139.rs:10:26 + --> $DIR/unsized-rvalue-issue-41139.rs:10:26 | LL | fn get_function<'a>() -> &'a dyn Fn() -> dyn Trait { | -------------------------------------------------- `get_function` defined here returns `&dyn Fn() -> (dyn Trait + 'static)` diff --git a/tests/ui/typeof/issue-100183.stderr b/tests/ui/typeof/issue-100183.stderr index 57317d449cf..765a5c54428 100644 --- a/tests/ui/typeof/issue-100183.stderr +++ b/tests/ui/typeof/issue-100183.stderr @@ -6,8 +6,9 @@ LL | y: (typeof("hey"),), | help: consider replacing `typeof(...)` with an actual type | -LL | y: (&str,), - | ~~~~ +LL - y: (typeof("hey"),), +LL + y: (&str,), + | error: aborting due to 1 previous error diff --git a/tests/ui/typeof/issue-29184.stderr b/tests/ui/typeof/issue-29184.stderr index f07c850e556..d8d43504d72 100644 --- a/tests/ui/typeof/issue-29184.stderr +++ b/tests/ui/typeof/issue-29184.stderr @@ -6,8 +6,9 @@ LL | let x: typeof(92) = 92; | help: consider replacing `typeof(...)` with an actual type | -LL | let x: i32 = 92; - | ~~~ +LL - let x: typeof(92) = 92; +LL + let x: i32 = 92; + | error: aborting due to 1 previous error diff --git a/tests/ui/typeof/issue-42060.stderr b/tests/ui/typeof/issue-42060.stderr index 86ba9432384..733ad37693b 100644 --- a/tests/ui/typeof/issue-42060.stderr +++ b/tests/ui/typeof/issue-42060.stderr @@ -6,8 +6,9 @@ LL | let other: typeof(thing) = thing; | help: consider using `const` instead of `let` | -LL | const thing: /* Type */ = (); - | ~~~~~ ++++++++++++ +LL - let thing = (); +LL + const thing: /* Type */ = (); + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-42060.rs:9:13 @@ -17,8 +18,9 @@ LL | <typeof(q)>::N | help: consider using `const` instead of `let` | -LL | const q: /* Type */ = 1; - | ~~~~~ ++++++++++++ +LL - let q = 1; +LL + const q: /* Type */ = 1; + | error[E0516]: `typeof` is a reserved keyword but unimplemented --> $DIR/issue-42060.rs:3:16 diff --git a/tests/ui/typeof/type_mismatch.stderr b/tests/ui/typeof/type_mismatch.stderr index e75214cd31a..d5494922b16 100644 --- a/tests/ui/typeof/type_mismatch.stderr +++ b/tests/ui/typeof/type_mismatch.stderr @@ -6,8 +6,9 @@ LL | let b: typeof(a) = 1i8; | help: consider replacing `typeof(...)` with an actual type | -LL | let b: u8 = 1i8; - | ~~ +LL - let b: typeof(a) = 1i8; +LL + let b: u8 = 1i8; + | error[E0308]: mismatched types --> $DIR/type_mismatch.rs:5:24 @@ -19,8 +20,9 @@ LL | let b: typeof(a) = 1i8; | help: change the type of the numeric literal from `i8` to `u8` | -LL | let b: typeof(a) = 1u8; - | ~~ +LL - let b: typeof(a) = 1i8; +LL + let b: typeof(a) = 1u8; + | error: aborting due to 2 previous errors diff --git a/tests/ui/ufcs/bad-builder.stderr b/tests/ui/ufcs/bad-builder.stderr index e466f94d0d8..a3528cb1e7d 100644 --- a/tests/ui/ufcs/bad-builder.stderr +++ b/tests/ui/ufcs/bad-builder.stderr @@ -13,8 +13,9 @@ note: if you're trying to build a new `Vec<Q>` consider using one of the followi --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: there is an associated function `new` with a similar name | -LL | Vec::<Q>::new() - | ~~~ +LL - Vec::<Q>::mew() +LL + Vec::<Q>::new() + | error: aborting due to 1 previous error diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr index 2a8c4edbdb5..7b5f7cd9f70 100644 --- a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr +++ b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr @@ -13,8 +13,9 @@ LL | fn dummy2(&self); found signature `fn(&Bar<_>)` help: change the self-receiver type to match the trait | -LL | fn dummy2(&self) {} - | ~~~~~ +LL - fn dummy2(self: &Bar<T>) {} +LL + fn dummy2(&self) {} + | error[E0307]: invalid `self` parameter type: `isize` --> $DIR/ufcs-explicit-self-bad.rs:8:18 diff --git a/tests/ui/ufcs/ufcs-partially-resolved.stderr b/tests/ui/ufcs/ufcs-partially-resolved.stderr index eef55c8dc68..0a9c190cb35 100644 --- a/tests/ui/ufcs/ufcs-partially-resolved.stderr +++ b/tests/ui/ufcs/ufcs-partially-resolved.stderr @@ -24,7 +24,8 @@ LL | let _: <u8 as A>::N; | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait A = u32; +LL - type A = u32; +LL + trait A = u32; | error[E0576]: cannot find method or associated constant `N` in trait `Tr` @@ -53,7 +54,8 @@ LL | <u8 as A>::N; | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait A = u32; +LL - type A = u32; +LL + trait A = u32; | error[E0404]: expected trait, found enum `E` @@ -100,7 +102,8 @@ LL | let _: <u8 as A>::N::NN; | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait A = u32; +LL - type A = u32; +LL + trait A = u32; | error[E0576]: cannot find associated type `N` in trait `Tr` @@ -129,7 +132,8 @@ LL | <u8 as A>::N::NN; | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait A = u32; +LL - type A = u32; +LL + trait A = u32; | error[E0404]: expected trait, found enum `E` @@ -253,8 +257,9 @@ LL | let _: <u8 as Tr>::Y::NN; | help: if there were a trait named `Example` with associated type `NN` implemented for `<u8 as Tr>::Y`, you could use the fully-qualified path | -LL | let _: <<u8 as Tr>::Y as Example>::NN; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _: <u8 as Tr>::Y::NN; +LL + let _: <<u8 as Tr>::Y as Example>::NN; + | error[E0599]: no associated item named `NN` found for type `u16` in the current scope --> $DIR/ufcs-partially-resolved.rs:38:20 diff --git a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr index f8be11a24e3..05071834883 100644 --- a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -30,8 +30,9 @@ note: method defined here --> $SRC_DIR/core/src/ops/arith.rs:LL:COL help: change the type of the numeric literal from `u32` to `i32` | -LL | <i32 as Add<i32>>::add(1i32, 2); - | ~~~ +LL - <i32 as Add<i32>>::add(1u32, 2); +LL + <i32 as Add<i32>>::add(1i32, 2); + | error[E0308]: mismatched types --> $DIR/ufcs-qpath-self-mismatch.rs:9:31 @@ -52,8 +53,9 @@ note: method defined here --> $SRC_DIR/core/src/ops/arith.rs:LL:COL help: change the type of the numeric literal from `u32` to `i32` | -LL | <i32 as Add<i32>>::add(1, 2i32); - | ~~~ +LL - <i32 as Add<i32>>::add(1, 2u32); +LL + <i32 as Add<i32>>::add(1, 2i32); + | error[E0277]: cannot add `u32` to `i32` --> $DIR/ufcs-qpath-self-mismatch.rs:4:5 diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr index ce2c90f97da..1c6470eef8f 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr @@ -6,8 +6,9 @@ LL | let b = Bar::(isize, usize)::new(); // OK too (for the parser) | help: use angle brackets instead | -LL | let b = Bar::<isize, usize>::new(); // OK too (for the parser) - | ~ ~ +LL - let b = Bar::(isize, usize)::new(); // OK too (for the parser) +LL + let b = Bar::<isize, usize>::new(); // OK too (for the parser) + | error: aborting due to 1 previous error diff --git a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr index 327df50e645..d87588d1822 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr +++ b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr @@ -13,8 +13,9 @@ LL | let mut f = |x: isize, y: isize| -> isize { x + y }; | ^^^^^^^^ help: change the type of the numeric literal from `usize` to `isize` | -LL | let z = f(1_isize, 2); - | ~~~~~ +LL - let z = f(1_usize, 2); +LL + let z = f(1_isize, 2); + | error[E0308]: mismatched types --> $DIR/unboxed-closures-type-mismatch.rs:9:15 @@ -38,8 +39,9 @@ LL | let mut g = |x, y| { x + y }; | ^ help: change the type of the numeric literal from `usize` to `i32` | -LL | let z = g(1_i32, 2); - | ~~~ +LL - let z = g(1_usize, 2); +LL + let z = g(1_i32, 2); + | error[E0308]: mismatched types --> $DIR/unboxed-closures-type-mismatch.rs:17:18 @@ -63,8 +65,9 @@ LL | let identity = |x| x; | ^ help: change the type of the numeric literal from `u16` to `u8` | -LL | identity(1u8); - | ~~ +LL - identity(1u16); +LL + identity(1u8); + | error[E0308]: mismatched types --> $DIR/unboxed-closures-type-mismatch.rs:20:18 @@ -111,8 +114,9 @@ LL | let identity = |x| x; | ^ help: change the type of the numeric literal from `u16` to `u8` | -LL | identity(1u8); - | ~~ +LL - identity(1u16); +LL + identity(1u8); + | error[E0308]: mismatched types --> $DIR/unboxed-closures-type-mismatch.rs:33:18 diff --git a/tests/ui/underscore-lifetime/in-fn-return-illegal.stderr b/tests/ui/underscore-lifetime/in-fn-return-illegal.stderr index fb036c695b4..a53e8adbecf 100644 --- a/tests/ui/underscore-lifetime/in-fn-return-illegal.stderr +++ b/tests/ui/underscore-lifetime/in-fn-return-illegal.stderr @@ -7,8 +7,9 @@ LL | fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `x` or `y` help: consider introducing a named lifetime parameter | -LL | fn foo<'a>(x: &'a u32, y: &'a u32) -> &'a u32 { loop { } } - | ++++ ++ ++ ~~ +LL - fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } +LL + fn foo<'a>(x: &'a u32, y: &'a u32) -> &'a u32 { loop { } } + | error: aborting due to 1 previous error diff --git a/tests/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/tests/ui/underscore-lifetime/underscore-lifetime-binders.stderr index cd74d27dcb5..d940166e9e2 100644 --- a/tests/ui/underscore-lifetime/underscore-lifetime-binders.stderr +++ b/tests/ui/underscore-lifetime/underscore-lifetime-binders.stderr @@ -6,8 +6,9 @@ LL | struct Baz<'a>(&'_ &'a u8); | help: consider using the `'a` lifetime | -LL | struct Baz<'a>(&'a &'a u8); - | ~~ +LL - struct Baz<'a>(&'_ &'a u8); +LL + struct Baz<'a>(&'a &'a u8); + | error[E0637]: `'_` cannot be used here --> $DIR/underscore-lifetime-binders.rs:4:8 @@ -30,8 +31,9 @@ LL | fn meh() -> Box<dyn for<'_> Meh<'_>> = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | fn meh() -> Box<dyn for<'_> Meh<'static>> - | ~~~~~~~ +LL - fn meh() -> Box<dyn for<'_> Meh<'_>> +LL + fn meh() -> Box<dyn for<'_> Meh<'static>> + | error[E0106]: missing lifetime specifier --> $DIR/underscore-lifetime-binders.rs:16:35 @@ -42,8 +44,9 @@ LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or `y` help: consider introducing a named lifetime parameter | -LL | fn foo2<'a>(_: &'a u8, y: &'a u8) -> &'a u8 { y } - | ++++ ~~ ~~ ~~ +LL - fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } +LL + fn foo2<'a>(_: &'a u8, y: &'a u8) -> &'a u8 { y } + | error: aborting due to 5 previous errors diff --git a/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr b/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr index 8bd9b1112c5..4b530ca4ba6 100644 --- a/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr +++ b/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr @@ -12,8 +12,9 @@ LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance help: consider introducing a named lifetime parameter | -LL | fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } - | ++++ ~~ ~~ +LL - fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } +LL + fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } + | error: aborting due to 1 previous error diff --git a/tests/ui/union/union-derive-eq.next.stderr b/tests/ui/union/union-derive-eq.next.stderr index 3952b1f1284..151ceebe1ba 100644 --- a/tests/ui/union/union-derive-eq.next.stderr +++ b/tests/ui/union/union-derive-eq.next.stderr @@ -7,6 +7,8 @@ LL | union U2 { LL | a: PartialEqNotEq, | ^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `PartialEqNotEq` | +note: required by a bound in `AssertParamIsEq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]` | diff --git a/tests/ui/union/union-suggest-field.stderr b/tests/ui/union/union-suggest-field.stderr index 5c428cf6c89..fc6daca2a47 100644 --- a/tests/ui/union/union-suggest-field.stderr +++ b/tests/ui/union/union-suggest-field.stderr @@ -6,8 +6,9 @@ LL | let u = U { principle: 0 }; | help: a field with a similar name exists | -LL | let u = U { principal: 0 }; - | ~~~~~~~~~ +LL - let u = U { principle: 0 }; +LL + let u = U { principal: 0 }; + | error[E0609]: no field `principial` on type `U` --> $DIR/union-suggest-field.rs:14:15 @@ -17,8 +18,9 @@ LL | let w = u.principial; | help: a field with a similar name exists | -LL | let w = u.principal; - | ~~~~~~~~~ +LL - let w = u.principial; +LL + let w = u.principal; + | error[E0615]: attempted to take value of method `calculate` on type `U` --> $DIR/union-suggest-field.rs:18:15 diff --git a/tests/ui/unpretty/expanded-exhaustive.stdout b/tests/ui/unpretty/expanded-exhaustive.stdout index 11066c90edb..19ae66f7a07 100644 --- a/tests/ui/unpretty/expanded-exhaustive.stdout +++ b/tests/ui/unpretty/expanded-exhaustive.stdout @@ -678,7 +678,7 @@ mod types { /*! FIXME: todo */ } /// TyKind::Pat - fn ty_pat() { let _: u32 is 1..; } + fn ty_pat() { let _: u32 is const 1..; } } mod visibilities { /// VisibilityKind::Public diff --git a/tests/ui/unpretty/staged-api-invalid-path-108697.rs b/tests/ui/unpretty/staged-api-invalid-path-108697.rs index 71bad213576..8a806b10d9d 100644 --- a/tests/ui/unpretty/staged-api-invalid-path-108697.rs +++ b/tests/ui/unpretty/staged-api-invalid-path-108697.rs @@ -2,8 +2,8 @@ // ICE: tcx.resolutions(()) is not supported for local crate -Zunpretty=mir // on invalid module path with staged_api //@ compile-flags: -Zunpretty=mir -//@ normalize-stderr: "The system cannot find the file specified." -> "No such file or directory" +//@ normalize-stderr: "lol`: .*\(" -> "lol`: $$FILE_NOT_FOUND_MSG (" #![feature(staged_api)] #[path = "lol"] mod foo; -//~^ ERROR couldn't read +//~^ ERROR couldn't read `$DIR/lol` diff --git a/tests/ui/unpretty/staged-api-invalid-path-108697.stderr b/tests/ui/unpretty/staged-api-invalid-path-108697.stderr index e68e19c4dc9..188f4985ded 100644 --- a/tests/ui/unpretty/staged-api-invalid-path-108697.stderr +++ b/tests/ui/unpretty/staged-api-invalid-path-108697.stderr @@ -1,4 +1,4 @@ -error: couldn't read `$DIR/lol`: No such file or directory (os error 2) +error: couldn't read `$DIR/lol`: $FILE_NOT_FOUND_MSG (os error 2) --> $DIR/staged-api-invalid-path-108697.rs:8:1 | LL | mod foo; diff --git a/tests/ui/unresolved/unresolved-candidates.stderr b/tests/ui/unresolved/unresolved-candidates.stderr index 7ef2f6b1a29..7be1bcd38de 100644 --- a/tests/ui/unresolved/unresolved-candidates.stderr +++ b/tests/ui/unresolved/unresolved-candidates.stderr @@ -7,7 +7,7 @@ LL | use Trait; help: consider importing this trait instead | LL | use a::Trait; - | ~~~~~~~~ + | +++ error[E0405]: cannot find trait `Trait` in this scope --> $DIR/unresolved-candidates.rs:10:10 diff --git a/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr index b0352ab6754..f96cf69a2af 100644 --- a/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr +++ b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr @@ -6,8 +6,9 @@ LL | use module::SomeUsefulType; | help: consider importing this struct instead | -LL | use library::SomeUsefulType; - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - use module::SomeUsefulType; +LL + use library::SomeUsefulType; + | error[E0432]: unresolved import `module::SomeUsefulType` --> $DIR/unresolved-import-avoid-suggesting-global-path.rs:28:9 @@ -17,8 +18,9 @@ LL | use module::SomeUsefulType; | help: consider importing this struct instead | -LL | use library::SomeUsefulType; - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - use module::SomeUsefulType; +LL + use library::SomeUsefulType; + | error: aborting due to 2 previous errors diff --git a/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr index c6812dbb196..31b943defba 100644 --- a/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr +++ b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr @@ -6,8 +6,9 @@ LL | pub use module::SomeUsefulType; | help: consider importing this struct instead | -LL | pub use ::library::SomeUsefulType; - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - pub use module::SomeUsefulType; +LL + pub use ::library::SomeUsefulType; + | error: aborting due to 1 previous error diff --git a/tests/ui/unsafe-binders/expr.rs b/tests/ui/unsafe-binders/expr.rs index 0fe68751f0a..d437d8f8ac0 100644 --- a/tests/ui/unsafe-binders/expr.rs +++ b/tests/ui/unsafe-binders/expr.rs @@ -1,3 +1,5 @@ +//@ check-pass + #![feature(unsafe_binders)] //~^ WARN the feature `unsafe_binders` is incomplete @@ -7,8 +9,6 @@ fn main() { unsafe { let x = 1; let binder: unsafe<'a> &'a i32 = wrap_binder!(&x); - //~^ ERROR unsafe binder casts are not fully implemented let rx = *unwrap_binder!(binder); - //~^ ERROR unsafe binder casts are not fully implemented } } diff --git a/tests/ui/unsafe-binders/expr.stderr b/tests/ui/unsafe-binders/expr.stderr index 78a288e10a3..07026e18e12 100644 --- a/tests/ui/unsafe-binders/expr.stderr +++ b/tests/ui/unsafe-binders/expr.stderr @@ -1,5 +1,5 @@ warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/expr.rs:1:12 + --> $DIR/expr.rs:3:12 | LL | #![feature(unsafe_binders)] | ^^^^^^^^^^^^^^ @@ -7,17 +7,5 @@ LL | #![feature(unsafe_binders)] = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information = note: `#[warn(incomplete_features)]` on by default -error: unsafe binder casts are not fully implemented - --> $DIR/expr.rs:9:55 - | -LL | let binder: unsafe<'a> &'a i32 = wrap_binder!(&x); - | ^^ - -error: unsafe binder casts are not fully implemented - --> $DIR/expr.rs:11:34 - | -LL | let rx = *unwrap_binder!(binder); - | ^^^^^^ - -error: aborting due to 2 previous errors; 1 warning emitted +warning: 1 warning emitted diff --git a/tests/ui/unsafe-binders/mismatch.rs b/tests/ui/unsafe-binders/mismatch.rs index 731fe2d1ce9..840d938cbe9 100644 --- a/tests/ui/unsafe-binders/mismatch.rs +++ b/tests/ui/unsafe-binders/mismatch.rs @@ -5,38 +5,31 @@ use std::unsafe_binder::{wrap_binder, unwrap_binder}; fn a() { let _: unsafe<'a> &'a i32 = wrap_binder!(&()); - //~^ ERROR unsafe binder casts are not fully implemented - //~| ERROR mismatched types + //~^ ERROR mismatched types } fn b() { let _: i32 = wrap_binder!(&()); - //~^ ERROR unsafe binder casts are not fully implemented - //~| ERROR `wrap_binder!()` can only wrap into unsafe binder + //~^ ERROR `wrap_binder!()` can only wrap into unsafe binder } fn c() { let y = 1; unwrap_binder!(y); - //~^ ERROR unsafe binder casts are not fully implemented - //~| ERROR expected unsafe binder, found integer as input + //~^ ERROR expected unsafe binder, found integer as input } fn d() { let unknown = Default::default(); + //~^ ERROR type annotations needed unwrap_binder!(unknown); - //~^ ERROR unsafe binder casts are not fully implemented - // FIXME(unsafe_binders): This should report ambiguity once we've removed - // the error above which taints the infcx. } fn e() { let x = wrap_binder!(&42); - //~^ ERROR unsafe binder casts are not fully implemented + //~^ ERROR type annotations needed // Currently, type inference doesn't flow backwards for unsafe binders. // It could, perhaps, but that may cause even more surprising corners. - // FIXME(unsafe_binders): This should report ambiguity once we've removed - // the error above which taints the infcx. let _: unsafe<'a> &'a i32 = x; } diff --git a/tests/ui/unsafe-binders/mismatch.stderr b/tests/ui/unsafe-binders/mismatch.stderr index a720e5dbdc1..f64db92eb65 100644 --- a/tests/ui/unsafe-binders/mismatch.stderr +++ b/tests/ui/unsafe-binders/mismatch.stderr @@ -7,12 +7,6 @@ LL | #![feature(unsafe_binders)] = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information = note: `#[warn(incomplete_features)]` on by default -error: unsafe binder casts are not fully implemented - --> $DIR/mismatch.rs:7:46 - | -LL | let _: unsafe<'a> &'a i32 = wrap_binder!(&()); - | ^^^ - error[E0308]: mismatched types --> $DIR/mismatch.rs:7:46 | @@ -22,14 +16,8 @@ LL | let _: unsafe<'a> &'a i32 = wrap_binder!(&()); = note: expected reference `&i32` found reference `&()` -error: unsafe binder casts are not fully implemented - --> $DIR/mismatch.rs:13:31 - | -LL | let _: i32 = wrap_binder!(&()); - | ^^^ - error: `wrap_binder!()` can only wrap into unsafe binder, not `i32` - --> $DIR/mismatch.rs:13:18 + --> $DIR/mismatch.rs:12:18 | LL | let _: i32 = wrap_binder!(&()); | ^^^^^^^^^^^^^^^^^ @@ -37,32 +25,35 @@ LL | let _: i32 = wrap_binder!(&()); = note: unsafe binders are the only valid output of wrap = note: this error originates in the macro `wrap_binder` (in Nightly builds, run with -Z macro-backtrace for more info) -error: unsafe binder casts are not fully implemented - --> $DIR/mismatch.rs:20:20 - | -LL | unwrap_binder!(y); - | ^ - error: expected unsafe binder, found integer as input of `unwrap_binder!()` - --> $DIR/mismatch.rs:20:20 + --> $DIR/mismatch.rs:18:20 | LL | unwrap_binder!(y); | ^ | = note: only an unsafe binder type can be unwrapped -error: unsafe binder casts are not fully implemented - --> $DIR/mismatch.rs:27:20 +error[E0282]: type annotations needed + --> $DIR/mismatch.rs:23:9 | +LL | let unknown = Default::default(); + | ^^^^^^^ +LL | LL | unwrap_binder!(unknown); - | ^^^^^^^ + | ------- type must be known at this point + | +help: consider giving `unknown` an explicit type + | +LL | let unknown: /* Type */ = Default::default(); + | ++++++++++++ -error: unsafe binder casts are not fully implemented - --> $DIR/mismatch.rs:34:26 +error[E0282]: type annotations needed + --> $DIR/mismatch.rs:29:26 | LL | let x = wrap_binder!(&42); - | ^^^ + | ^^^ cannot infer type -error: aborting due to 8 previous errors; 1 warning emitted +error: aborting due to 5 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0282, E0308. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/unsafe-binders/moves.rs b/tests/ui/unsafe-binders/moves.rs new file mode 100644 index 00000000000..9397c2bc20f --- /dev/null +++ b/tests/ui/unsafe-binders/moves.rs @@ -0,0 +1,41 @@ +#![feature(unsafe_binders)] +//~^ WARN the feature `unsafe_binders` is incomplete + +use std::mem::{ManuallyDrop, drop}; +use std::unsafe_binder::{unwrap_binder, wrap_binder}; + +#[derive(Default)] +struct NotCopyInner; +type NotCopy = ManuallyDrop<NotCopyInner>; + +fn use_after_wrap() { + unsafe { + let base = NotCopy::default(); + let binder: unsafe<> NotCopy = wrap_binder!(base); + drop(base); + //~^ ERROR use of moved value: `base` + } +} + +fn move_out_of_wrap() { + unsafe { + let binder: unsafe<> NotCopy = wrap_binder!(NotCopy::default()); + drop(unwrap_binder!(binder)); + drop(unwrap_binder!(binder)); + //~^ ERROR use of moved value: `binder` + } +} + +fn not_conflicting() { + unsafe { + let binder: unsafe<> (NotCopy, NotCopy) = + wrap_binder!((NotCopy::default(), NotCopy::default())); + drop(unwrap_binder!(binder).0); + drop(unwrap_binder!(binder).1); + // ^ NOT a problem, since the moves are disjoint. + drop(unwrap_binder!(binder).0); + //~^ ERROR use of moved value: `binder.0` + } +} + +fn main() {} diff --git a/tests/ui/unsafe-binders/moves.stderr b/tests/ui/unsafe-binders/moves.stderr new file mode 100644 index 00000000000..0f976d9e845 --- /dev/null +++ b/tests/ui/unsafe-binders/moves.stderr @@ -0,0 +1,44 @@ +warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/moves.rs:1:12 + | +LL | #![feature(unsafe_binders)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #130516 <https://github.com/rust-lang/rust/issues/130516> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0382]: use of moved value: `base` + --> $DIR/moves.rs:15:14 + | +LL | let base = NotCopy::default(); + | ---- move occurs because `base` has type `ManuallyDrop<NotCopyInner>`, which does not implement the `Copy` trait +LL | let binder: unsafe<> NotCopy = wrap_binder!(base); + | ---- value moved here +LL | drop(base); + | ^^^^ value used here after move + +error[E0382]: use of moved value: `binder` + --> $DIR/moves.rs:24:14 + | +LL | drop(unwrap_binder!(binder)); + | ---------------------- value moved here +LL | drop(unwrap_binder!(binder)); + | ^^^^^^^^^^^^^^^^^^^^^^ value used here after move + | + = note: move occurs because `binder` has type `ManuallyDrop<NotCopyInner>`, which does not implement the `Copy` trait + = note: this error originates in the macro `unwrap_binder` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0382]: use of moved value: `binder.0` + --> $DIR/moves.rs:36:14 + | +LL | drop(unwrap_binder!(binder).0); + | ------------------------ value moved here +... +LL | drop(unwrap_binder!(binder).0); + | ^^^^^^^^^^^^^^^^^^^^^^^^ value used here after move + | + = note: move occurs because `binder.0` has type `ManuallyDrop<NotCopyInner>`, which does not implement the `Copy` trait + +error: aborting due to 3 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/unsigned-literal-negation.stderr b/tests/ui/unsigned-literal-negation.stderr index b0a730477a1..0bedbc1accd 100644 --- a/tests/ui/unsigned-literal-negation.stderr +++ b/tests/ui/unsigned-literal-negation.stderr @@ -7,8 +7,9 @@ LL | let x = -1 as usize; = note: unsigned values cannot be negated help: you may have meant the maximum value of `usize` | -LL | let x = usize::MAX; - | ~~~~~~~~~~ +LL - let x = -1 as usize; +LL + let x = usize::MAX; + | error[E0600]: cannot apply unary operator `-` to type `usize` --> $DIR/unsigned-literal-negation.rs:3:13 @@ -19,8 +20,9 @@ LL | let x = (-1) as usize; = note: unsigned values cannot be negated help: you may have meant the maximum value of `usize` | -LL | let x = usize::MAX; - | ~~~~~~~~~~ +LL - let x = (-1) as usize; +LL + let x = usize::MAX; + | error[E0600]: cannot apply unary operator `-` to type `u32` --> $DIR/unsigned-literal-negation.rs:4:18 @@ -31,8 +33,9 @@ LL | let x: u32 = -1; = note: unsigned values cannot be negated help: you may have meant the maximum value of `u32` | -LL | let x: u32 = u32::MAX; - | ~~~~~~~~ +LL - let x: u32 = -1; +LL + let x: u32 = u32::MAX; + | error: aborting due to 3 previous errors diff --git a/tests/ui/unsized/box-instead-of-dyn-fn.rs b/tests/ui/unsized/box-instead-of-dyn-fn.rs index 321c2ebf5a1..720176081d6 100644 --- a/tests/ui/unsized/box-instead-of-dyn-fn.rs +++ b/tests/ui/unsized/box-instead-of-dyn-fn.rs @@ -3,7 +3,7 @@ use std::fmt::Debug; // Test to suggest boxing the return type, and the closure branch of the `if` fn print_on_or_the_other<'a>(a: i32, b: &'a String) -> dyn Fn() + 'a { - //~^ ERROR return type cannot have an unboxed trait object + //~^ ERROR return type cannot be a trait object without pointer indirection if a % 2 == 0 { move || println!("{a}") } else { diff --git a/tests/ui/unsized/box-instead-of-dyn-fn.stderr b/tests/ui/unsized/box-instead-of-dyn-fn.stderr index 1f1845569ef..b666718262d 100644 --- a/tests/ui/unsized/box-instead-of-dyn-fn.stderr +++ b/tests/ui/unsized/box-instead-of-dyn-fn.stderr @@ -1,4 +1,4 @@ -error[E0746]: return type cannot have an unboxed trait object +error[E0746]: return type cannot be a trait object without pointer indirection --> $DIR/box-instead-of-dyn-fn.rs:5:56 | LL | fn print_on_or_the_other<'a>(a: i32, b: &'a String) -> dyn Fn() + 'a { @@ -6,8 +6,9 @@ LL | fn print_on_or_the_other<'a>(a: i32, b: &'a String) -> dyn Fn() + 'a { | help: consider returning an `impl Trait` instead of a `dyn Trait` | -LL | fn print_on_or_the_other<'a>(a: i32, b: &'a String) -> impl Fn() + 'a { - | ~~~~ +LL - fn print_on_or_the_other<'a>(a: i32, b: &'a String) -> dyn Fn() + 'a { +LL + fn print_on_or_the_other<'a>(a: i32, b: &'a String) -> impl Fn() + 'a { + | help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL ~ fn print_on_or_the_other<'a>(a: i32, b: &'a String) -> Box<dyn Fn() + 'a> { diff --git a/tests/ui/unsized/issue-91801.rs b/tests/ui/unsized/issue-91801.rs index 096b1a93574..d906a08a55a 100644 --- a/tests/ui/unsized/issue-91801.rs +++ b/tests/ui/unsized/issue-91801.rs @@ -6,7 +6,7 @@ pub static ALL_VALIDATORS: &[(&'static str, &'static Validator)] = &[("validate that credits and debits balance", &validate_something)]; fn or<'a>(first: &'static Validator<'a>, second: &'static Validator<'a>) -> Validator<'a> { - //~^ ERROR return type cannot have an unboxed trait object + //~^ ERROR return type cannot be a trait object without pointer indirection return Box::new(move |something: &'_ Something| -> Result<(), ()> { first(something).or_else(|_| second(something)) }); diff --git a/tests/ui/unsized/issue-91801.stderr b/tests/ui/unsized/issue-91801.stderr index e13cabbb81d..28e10f9caa4 100644 --- a/tests/ui/unsized/issue-91801.stderr +++ b/tests/ui/unsized/issue-91801.stderr @@ -1,4 +1,4 @@ -error[E0746]: return type cannot have an unboxed trait object +error[E0746]: return type cannot be a trait object without pointer indirection --> $DIR/issue-91801.rs:8:77 | LL | fn or<'a>(first: &'static Validator<'a>, second: &'static Validator<'a>) -> Validator<'a> { diff --git a/tests/ui/unsized/issue-91803.rs b/tests/ui/unsized/issue-91803.rs index c74897cc4bc..8d35c7582b8 100644 --- a/tests/ui/unsized/issue-91803.rs +++ b/tests/ui/unsized/issue-91803.rs @@ -1,7 +1,7 @@ trait Foo<'a> {} fn or<'a>(first: &'static dyn Foo<'a>) -> dyn Foo<'a> { - //~^ ERROR return type cannot have an unboxed trait object + //~^ ERROR return type cannot be a trait object without pointer indirection return Box::new(panic!()); } diff --git a/tests/ui/unsized/issue-91803.stderr b/tests/ui/unsized/issue-91803.stderr index 3b89066499d..037ec2ceaa5 100644 --- a/tests/ui/unsized/issue-91803.stderr +++ b/tests/ui/unsized/issue-91803.stderr @@ -1,4 +1,4 @@ -error[E0746]: return type cannot have an unboxed trait object +error[E0746]: return type cannot be a trait object without pointer indirection --> $DIR/issue-91803.rs:3:43 | LL | fn or<'a>(first: &'static dyn Foo<'a>) -> dyn Foo<'a> { @@ -6,8 +6,9 @@ LL | fn or<'a>(first: &'static dyn Foo<'a>) -> dyn Foo<'a> { | help: consider returning an `impl Trait` instead of a `dyn Trait` | -LL | fn or<'a>(first: &'static dyn Foo<'a>) -> impl Foo<'a> { - | ~~~~ +LL - fn or<'a>(first: &'static dyn Foo<'a>) -> dyn Foo<'a> { +LL + fn or<'a>(first: &'static dyn Foo<'a>) -> impl Foo<'a> { + | help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL | fn or<'a>(first: &'static dyn Foo<'a>) -> Box<dyn Foo<'a>> { diff --git a/tests/ui/unsized/maybe-bounds-where.rs b/tests/ui/unsized/maybe-bounds-where.rs index 7e82a3eb449..4c4141631a7 100644 --- a/tests/ui/unsized/maybe-bounds-where.rs +++ b/tests/ui/unsized/maybe-bounds-where.rs @@ -11,11 +11,11 @@ trait Trait<'a> {} struct S4<T>(T) where for<'a> T: ?Trait<'a>; //~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared -//~| WARN relaxing a default bound only does something for `?Sized` +//~| ERROR relaxing a default bound only does something for `?Sized` struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized; //~^ ERROR type parameter has more than one relaxed default bound -//~| WARN relaxing a default bound only does something for `?Sized` +//~| ERROR relaxing a default bound only does something for `?Sized` impl<T> S1<T> { fn f() where T: ?Sized {} diff --git a/tests/ui/unsized/maybe-bounds-where.stderr b/tests/ui/unsized/maybe-bounds-where.stderr index f7851261667..fb6d37c2966 100644 --- a/tests/ui/unsized/maybe-bounds-where.stderr +++ b/tests/ui/unsized/maybe-bounds-where.stderr @@ -43,7 +43,7 @@ LL | fn f() where T: ?Sized {} = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-bounds-where.rs:12:34 | LL | struct S4<T>(T) where for<'a> T: ?Trait<'a>; @@ -58,13 +58,13 @@ LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized; = help: add `#![feature(more_maybe_bounds)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default +error: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default --> $DIR/maybe-bounds-where.rs:16:33 | LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized; | ^^^^^^^^^^^^^^^ -error: aborting due to 6 previous errors; 2 warnings emitted +error: aborting due to 8 previous errors Some errors have detailed explanations: E0203, E0658. For more information about an error, try `rustc --explain E0203`. diff --git a/tests/ui/variants/variant-used-as-type.stderr b/tests/ui/variants/variant-used-as-type.stderr index 64424abbcec..1857c10a8e9 100644 --- a/tests/ui/variants/variant-used-as-type.stderr +++ b/tests/ui/variants/variant-used-as-type.stderr @@ -6,10 +6,12 @@ LL | B(Ty::A), | help: try using the variant's enum | -LL | B(E), - | ~ -LL | B(Ty), - | ~~ +LL - B(Ty::A), +LL + B(E), + | +LL - B(Ty::A), +LL + B(Ty), + | error[E0573]: expected type, found variant `E::A` --> $DIR/variant-used-as-type.rs:17:6 @@ -19,10 +21,12 @@ LL | impl E::A {} | help: try using the variant's enum | -LL | impl E {} - | ~ -LL | impl Ty {} - | ~~ +LL - impl E::A {} +LL + impl E {} + | +LL - impl E::A {} +LL + impl Ty {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/wait-forked-but-failed-child.rs b/tests/ui/wait-forked-but-failed-child.rs index 04f1c1a65d5..4a7f2bee9d9 100644 --- a/tests/ui/wait-forked-but-failed-child.rs +++ b/tests/ui/wait-forked-but-failed-child.rs @@ -31,8 +31,17 @@ fn find_zombies() { // https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html let ps_cmd_output = Command::new("ps").args(&["-A", "-o", "pid,ppid,args"]).output().unwrap(); let ps_output = String::from_utf8_lossy(&ps_cmd_output.stdout); + // On AIX, the PPID is not always present, such as when a process is blocked + // (marked as <exiting>), or if a process is idle. In these situations, + // the PPID column contains a "-" for the respective process. + // Filter out any lines that have a "-" as the PPID as the PPID is + // expected to be an integer. + let filtered_ps: Vec<_> = ps_output + .lines() + .filter(|line| line.split_whitespace().nth(1) != Some("-")) + .collect(); - for (line_no, line) in ps_output.split('\n').enumerate() { + for (line_no, line) in filtered_ps.into_iter().enumerate() { if 0 < line_no && 0 < line.len() && my_pid == line.split(' ').filter(|w| 0 < w.len()).nth(1) .expect("1st column should be PPID") diff --git a/tests/ui/weird-exprs.rs b/tests/ui/weird-exprs.rs index 08b5517aae2..55a8d580a8b 100644 --- a/tests/ui/weird-exprs.rs +++ b/tests/ui/weird-exprs.rs @@ -34,7 +34,7 @@ fn what() { let i = &Cell::new(false); let dont = {||the(i)}; dont(); - assert!((i.get())); + assert!(i.get()); } fn zombiejesus() { @@ -69,8 +69,8 @@ fn notsure() { fn canttouchthis() -> usize { fn p() -> bool { true } - let _a = (assert!((true)) == (assert!(p()))); - let _c = (assert!((p())) == ()); + let _a = (assert!(true) == (assert!(p()))); + let _c = (assert!(p()) == ()); let _b: bool = (println!("{}", 0) == (return 0)); } diff --git a/tests/ui/wf/hir-wf-check-erase-regions.rs b/tests/ui/wf/hir-wf-check-erase-regions.rs index 01893044c27..20cc1cfe730 100644 --- a/tests/ui/wf/hir-wf-check-erase-regions.rs +++ b/tests/ui/wf/hir-wf-check-erase-regions.rs @@ -8,7 +8,9 @@ impl<'a, T, const N: usize> IntoIterator for &'a Table<T, N> { //~^ ERROR `&'a T` is not an iterator type Item = &'a T; - fn into_iter(self) -> Self::IntoIter { //~ ERROR `&'a T` is not an iterator + fn into_iter(self) -> Self::IntoIter { + //~^ ERROR `&'a T` is not an iterator + //~| ERROR `&T` is not an iterator unimplemented!() } } diff --git a/tests/ui/wf/hir-wf-check-erase-regions.stderr b/tests/ui/wf/hir-wf-check-erase-regions.stderr index 4b696dc1d1d..e4d48bf82c0 100644 --- a/tests/ui/wf/hir-wf-check-erase-regions.stderr +++ b/tests/ui/wf/hir-wf-check-erase-regions.stderr @@ -34,6 +34,16 @@ LL | fn into_iter(self) -> Self::IntoIter { note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL -error: aborting due to 3 previous errors +error[E0277]: `&T` is not an iterator + --> $DIR/hir-wf-check-erase-regions.rs:11:27 + | +LL | fn into_iter(self) -> Self::IntoIter { + | ^^^^^^^^^^^^^^ `&T` is not an iterator + | + = help: the trait `Iterator` is not implemented for `&T` + = help: the trait `Iterator` is implemented for `&mut I` + = note: required for `&T` to implement `IntoIterator` + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr index 339f7b2cc82..3b4de0753af 100644 --- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr @@ -96,8 +96,9 @@ LL | fn fnc<const N: Trait = u32>(&self) -> Trait { | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn fnc<const N: Trait = u32>(&self) -> Self { - | ~~~~ +LL - fn fnc<const N: Trait = u32>(&self) -> Trait { +LL + fn fnc<const N: Trait = u32>(&self) -> Self { + | error: aborting due to 7 previous errors; 3 warnings emitted diff --git a/tests/ui/wf/issue-87495.stderr b/tests/ui/wf/issue-87495.stderr index 7be327e61d1..0c293e3576d 100644 --- a/tests/ui/wf/issue-87495.stderr +++ b/tests/ui/wf/issue-87495.stderr @@ -5,7 +5,7 @@ LL | const CONST: (bool, dyn T); | ^^^^^ `T` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/issue-87495.rs:4:11 | LL | trait T { diff --git a/tests/ui/issues/issue-40749.rs b/tests/ui/wf/range-expr-root-of-constant-issue-40749.rs index 0a847853b12..0a847853b12 100644 --- a/tests/ui/issues/issue-40749.rs +++ b/tests/ui/wf/range-expr-root-of-constant-issue-40749.rs diff --git a/tests/ui/issues/issue-40749.stderr b/tests/ui/wf/range-expr-root-of-constant-issue-40749.stderr index f7770e00013..482773a3944 100644 --- a/tests/ui/issues/issue-40749.stderr +++ b/tests/ui/wf/range-expr-root-of-constant-issue-40749.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-40749.rs:2:9 + --> $DIR/range-expr-root-of-constant-issue-40749.rs:2:9 | LL | [0; ..10]; | ^^^^ expected `usize`, found `RangeTo<{integer}>` diff --git a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.stderr b/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.stderr index 0b7f4cd4362..f3e4f2a63e9 100644 --- a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.stderr +++ b/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.stderr @@ -5,7 +5,7 @@ LL | let t_box: Box<dyn Trait> = Box::new(S); | ^^^^^^^^^^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:6:14 | LL | trait Trait: Sized {} @@ -22,7 +22,7 @@ LL | takes_box(Box::new(S)); | ^^^^^^^^^^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:6:14 | LL | trait Trait: Sized {} @@ -39,7 +39,7 @@ LL | Box::new(S) as Box<dyn Trait>; | ^^^^^^^^^^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:6:14 | LL | trait Trait: Sized {} diff --git a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.stderr b/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.stderr index 3f50e1192cf..716d0e78ff1 100644 --- a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.stderr +++ b/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.stderr @@ -5,7 +5,7 @@ LL | let t: &dyn Trait = &S; | ^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:6:14 | LL | trait Trait: Sized {} @@ -22,7 +22,7 @@ LL | takes_trait(&S); | ^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:6:14 | LL | trait Trait: Sized {} @@ -39,7 +39,7 @@ LL | &S as &dyn Trait; | ^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:6:14 | LL | trait Trait: Sized {} diff --git a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr b/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr index 8f68f9c5b6b..a7405ce4caa 100644 --- a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr +++ b/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr @@ -19,7 +19,7 @@ LL | Some(()) => &S, | ^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/wf-dyn-incompat-trait-obj-match.rs:6:14 | LL | trait Trait: Sized {} @@ -40,7 +40,7 @@ LL | None => &R, | ^^ `Trait` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/wf-dyn-incompat-trait-obj-match.rs:6:14 | LL | trait Trait: Sized {} diff --git a/tests/ui/wf/wf-dyn-incompatible.stderr b/tests/ui/wf/wf-dyn-incompatible.stderr index 1803376aaa1..e61b37d9293 100644 --- a/tests/ui/wf/wf-dyn-incompatible.stderr +++ b/tests/ui/wf/wf-dyn-incompatible.stderr @@ -5,7 +5,7 @@ LL | let _x: &dyn A; | ^^^^^^ `A` 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> --> $DIR/wf-dyn-incompatible.rs:5:23 | LL | trait A { diff --git a/tests/ui/wf/wf-fn-where-clause.stderr b/tests/ui/wf/wf-fn-where-clause.stderr index d73376e9861..b419bc8347f 100644 --- a/tests/ui/wf/wf-fn-where-clause.stderr +++ b/tests/ui/wf/wf-fn-where-clause.stderr @@ -22,7 +22,7 @@ LL | fn bar() where Vec<dyn Copy>:, {} | = note: the trait is not dyn compatible because it requires `Self: Sized` = 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#object-safety> + for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> error[E0277]: the size for values of type `(dyn Copy + 'static)` cannot be known at compilation time --> $DIR/wf-fn-where-clause.rs:12:16 diff --git a/tests/ui/wf/wf-normalization-sized.next.stderr b/tests/ui/wf/wf-normalization-sized.next.stderr index 1e898fb7b78..83b56bb6b19 100644 --- a/tests/ui/wf/wf-normalization-sized.next.stderr +++ b/tests/ui/wf/wf-normalization-sized.next.stderr @@ -5,6 +5,7 @@ LL | const _: <[[[[[[u8]]]]]] as WellUnformed>::RequestNormalize = (); | ^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[[[[[u8]]]]]` + = note: slice and array elements must have `Sized` type error[E0277]: the size for values of type `[[[[[u8]]]]]` cannot be known at compilation time --> $DIR/wf-normalization-sized.rs:19:11 @@ -13,6 +14,7 @@ LL | const _: <[[[[[[u8]]]]]] as WellUnformed>::RequestNormalize = (); | ^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[[[[[u8]]]]]` + = note: slice and array elements must have `Sized` type = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0277]: the size for values of type `str` cannot be known at compilation time @@ -22,6 +24,8 @@ LL | const _: <Vec<str> as WellUnformed>::RequestNormalize = (); | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` +note: required by an implicit `Sized` bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/wf-normalization-sized.rs:22:11 @@ -30,6 +34,8 @@ LL | const _: <Vec<str> as WellUnformed>::RequestNormalize = (); | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `str` +note: required by an implicit `Sized` bound in `Vec` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 4 previous errors diff --git a/tests/ui/wf/wf-trait-default-fn-ret.rs b/tests/ui/wf/wf-trait-default-fn-ret.rs index 2103dae8d23..a7f83dcf678 100644 --- a/tests/ui/wf/wf-trait-default-fn-ret.rs +++ b/tests/ui/wf/wf-trait-default-fn-ret.rs @@ -1,5 +1,4 @@ -// Check that we test WF conditions for fn arguments. Because the -// current code is so goofy, this is only a warning for now. +// Check that we test WF conditions for fn arguments. #![feature(rustc_attrs)] #![allow(dead_code)] diff --git a/tests/ui/wf/wf-trait-default-fn-ret.stderr b/tests/ui/wf/wf-trait-default-fn-ret.stderr index f749ac7b1b3..f0d1b55edc4 100644 --- a/tests/ui/wf/wf-trait-default-fn-ret.stderr +++ b/tests/ui/wf/wf-trait-default-fn-ret.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `Self: Eq` is not satisfied - --> $DIR/wf-trait-default-fn-ret.rs:11:22 + --> $DIR/wf-trait-default-fn-ret.rs:10:22 | LL | fn bar(&self) -> Bar<Self> { | ^^^^^^^^^ the trait `Eq` is not implemented for `Self` | note: required by a bound in `Bar` - --> $DIR/wf-trait-default-fn-ret.rs:8:14 + --> $DIR/wf-trait-default-fn-ret.rs:7:14 | LL | struct Bar<T:Eq+?Sized> { value: Box<T> } | ^^ required by this bound in `Bar` diff --git a/tests/ui/wf/wf-trait-fn-arg.next.stderr b/tests/ui/wf/wf-trait-fn-arg.next.stderr index c55dc5c8a12..d5dd36fad6d 100644 --- a/tests/ui/wf/wf-trait-fn-arg.next.stderr +++ b/tests/ui/wf/wf-trait-fn-arg.next.stderr @@ -4,6 +4,11 @@ error[E0277]: the trait bound `Self: Eq` is not satisfied LL | fn bar(&self, x: &Bar<Self>); | ^^^^^^^^^ the trait `Eq` is not implemented for `Self` | +note: required by a bound in `Bar` + --> $DIR/wf-trait-fn-arg.rs:11:15 + | +LL | struct Bar<T: Eq + ?Sized> { + | ^^ required by this bound in `Bar` help: consider further restricting `Self` | LL | fn bar(&self, x: &Bar<Self>) where Self: Eq; diff --git a/tests/ui/wf/wf-trait-fn-ret.next.stderr b/tests/ui/wf/wf-trait-fn-ret.next.stderr index b3dca17672d..0ad786c2fd5 100644 --- a/tests/ui/wf/wf-trait-fn-ret.next.stderr +++ b/tests/ui/wf/wf-trait-fn-ret.next.stderr @@ -4,6 +4,11 @@ error[E0277]: the trait bound `Self: Eq` is not satisfied LL | fn bar(&self) -> &Bar<Self>; | ^^^^^^^^^ the trait `Eq` is not implemented for `Self` | +note: required by a bound in `Bar` + --> $DIR/wf-trait-fn-ret.rs:10:15 + | +LL | struct Bar<T: Eq + ?Sized> { + | ^^ required by this bound in `Bar` help: consider further restricting `Self` | LL | fn bar(&self) -> &Bar<Self> where Self: Eq; diff --git a/tests/ui/wf/wf-trait-fn-where-clause.next.stderr b/tests/ui/wf/wf-trait-fn-where-clause.next.stderr index 8c8a5fa3e70..db5454d0f3c 100644 --- a/tests/ui/wf/wf-trait-fn-where-clause.next.stderr +++ b/tests/ui/wf/wf-trait-fn-where-clause.next.stderr @@ -4,6 +4,11 @@ error[E0277]: the trait bound `Self: Eq` is not satisfied LL | Bar<Self>: Copy; | ^^^^ the trait `Eq` is not implemented for `Self` | +note: required by a bound in `Bar` + --> $DIR/wf-trait-fn-where-clause.rs:10:15 + | +LL | struct Bar<T: Eq + ?Sized> { + | ^^ required by this bound in `Bar` help: consider further restricting `Self` | LL | Bar<Self>: Copy, Self: Eq; diff --git a/tests/ui/where-clauses/ignore-err-clauses.rs b/tests/ui/where-clauses/ignore-err-clauses.rs index c76f0e1a8b2..428ebf4b408 100644 --- a/tests/ui/where-clauses/ignore-err-clauses.rs +++ b/tests/ui/where-clauses/ignore-err-clauses.rs @@ -1,6 +1,7 @@ use std::ops::Add; fn dbl<T>(x: T) -> <T as Add>::Output +//~^ ERROR type annotations needed where T: Copy + Add, UUU: Copy, diff --git a/tests/ui/where-clauses/ignore-err-clauses.stderr b/tests/ui/where-clauses/ignore-err-clauses.stderr index 4cf553da4c5..fbf1b99334f 100644 --- a/tests/ui/where-clauses/ignore-err-clauses.stderr +++ b/tests/ui/where-clauses/ignore-err-clauses.stderr @@ -1,9 +1,16 @@ error[E0412]: cannot find type `UUU` in this scope - --> $DIR/ignore-err-clauses.rs:6:5 + --> $DIR/ignore-err-clauses.rs:7:5 | LL | UUU: Copy, | ^^^ not found in this scope -error: aborting due to 1 previous error +error[E0282]: type annotations needed + --> $DIR/ignore-err-clauses.rs:3:14 + | +LL | fn dbl<T>(x: T) -> <T as Add>::Output + | ^ cannot infer type for type parameter `T` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0412`. +Some errors have detailed explanations: E0282, E0412. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/issues/issue-40235.rs b/tests/ui/while/while-let-scope-issue-40235.rs index 2bdbb2f229e..7d5dfc64a90 100644 --- a/tests/ui/issues/issue-40235.rs +++ b/tests/ui/while/while-let-scope-issue-40235.rs @@ -1,4 +1,4 @@ -//@ run-pass +//@ check-pass #![allow(unused_variables)] fn foo() {} |
