diff options
| author | Ralf Jung <post@ralfj.de> | 2024-12-20 06:29:50 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-20 06:29:50 +0000 |
| commit | db960a25d1cd3cf848506561ac88e7d338c4366c (patch) | |
| tree | 72ad079ee9a4274d62260de1889ae8a545ac8a74 /tests | |
| parent | 0aec399b830cc53e14c056bbd88f93e937129a5b (diff) | |
| parent | 5e2ce7eb7a76908404d9532cae2628d38cc62b4b (diff) | |
| download | rust-db960a25d1cd3cf848506561ac88e7d338c4366c.tar.gz rust-db960a25d1cd3cf848506561ac88e7d338c4366c.zip | |
Merge pull request #4100 from rust-lang/rustup-2024-12-20
Automatic Rustup
Diffstat (limited to 'tests')
171 files changed, 2185 insertions, 1114 deletions
diff --git a/tests/assembly/asm/aarch64-el2vmsa.rs b/tests/assembly/asm/aarch64-el2vmsa.rs index c217f008c07..3652d58d85a 100644 --- a/tests/assembly/asm/aarch64-el2vmsa.rs +++ b/tests/assembly/asm/aarch64-el2vmsa.rs @@ -1,18 +1,14 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![crate_type = "rlib"] #![no_core] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // CHECK-LABEL: ttbr0_el2: #[no_mangle] diff --git a/tests/assembly/asm/aarch64-modifiers.rs b/tests/assembly/asm/aarch64-modifiers.rs index a4a41dd96c1..a3956d21a06 100644 --- a/tests/assembly/asm/aarch64-modifiers.rs +++ b/tests/assembly/asm/aarch64-modifiers.rs @@ -1,29 +1,17 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: -O -C panic=abort //@ compile-flags: --target aarch64-unknown-linux-gnu //@ compile-flags: -Zmerge-functions=disabled //@ needs-llvm-components: aarch64 -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; macro_rules! check { ($func:ident $reg:ident $code:literal) => { diff --git a/tests/assembly/asm/aarch64-types.rs b/tests/assembly/asm/aarch64-types.rs index 22e60cd8159..439385b14b0 100644 --- a/tests/assembly/asm/aarch64-types.rs +++ b/tests/assembly/asm/aarch64-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: aarch64 arm64ec //@ assembly-output: emit-asm //@ [aarch64] compile-flags: --target aarch64-unknown-linux-gnu @@ -6,33 +7,15 @@ //@ [arm64ec] needs-llvm-components: aarch64 //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, repr_simd, f16, f128)] +#![feature(no_core, repr_simd, f16, f128)] #![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)] +#![feature(auto_traits, lang_items)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -// Do we really need to use no_core for this?!? -impl<T: Copy, const N: usize> Copy for [T; N] {} +extern crate minicore; +use minicore::*; type ptr = *mut u8; @@ -65,15 +48,6 @@ pub struct f32x4([f32; 4]); #[repr(simd)] pub struct f64x2([f64; 2]); -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for f16 {} -impl Copy for i32 {} -impl Copy for f32 {} -impl Copy for i64 {} -impl Copy for f64 {} -impl Copy for f128 {} -impl Copy for ptr {} impl Copy for i8x8 {} impl Copy for i16x4 {} impl Copy for i32x2 {} diff --git a/tests/assembly/asm/arm-modifiers.rs b/tests/assembly/asm/arm-modifiers.rs index 7d8d7e83870..562b6bed74c 100644 --- a/tests/assembly/asm/arm-modifiers.rs +++ b/tests/assembly/asm/arm-modifiers.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: -O -C panic=abort //@ compile-flags: --target armv7-unknown-linux-gnueabihf @@ -5,38 +6,17 @@ //@ compile-flags: -Zmerge-functions=disabled //@ needs-llvm-components: arm -#![feature(no_core, lang_items, rustc_attrs, repr_simd)] +#![feature(no_core, repr_simd)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -// Do we really need to use no_core for this?!? -impl<T: Copy, const N: usize> Copy for [T; N] {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct f32x4([f32; 4]); -impl Copy for i32 {} -impl Copy for f32 {} -impl Copy for f64 {} impl Copy for f32x4 {} macro_rules! check { diff --git a/tests/assembly/asm/arm-types.rs b/tests/assembly/asm/arm-types.rs index 9cebb588aaf..fb93f474c20 100644 --- a/tests/assembly/asm/arm-types.rs +++ b/tests/assembly/asm/arm-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: base d32 neon //@ assembly-output: emit-asm //@ compile-flags: --target armv7-unknown-linux-gnueabihf @@ -8,31 +9,13 @@ //@[neon] filecheck-flags: --check-prefix d32 //@ needs-llvm-components: arm -#![feature(no_core, lang_items, rustc_attrs, repr_simd, f16)] +#![feature(no_core, repr_simd, f16)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -// Do we really need to use no_core for this?!? -impl<T: Copy, const N: usize> Copy for [T; N] {} +extern crate minicore; +use minicore::*; type ptr = *mut u8; @@ -61,14 +44,6 @@ pub struct f16x8([f16; 8]); #[repr(simd)] pub struct f32x4([f32; 4]); -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for f16 {} -impl Copy for f32 {} -impl Copy for i64 {} -impl Copy for f64 {} -impl Copy for ptr {} impl Copy for i8x8 {} impl Copy for i16x4 {} impl Copy for i32x2 {} diff --git a/tests/assembly/asm/avr-modifiers.rs b/tests/assembly/asm/avr-modifiers.rs index e94375f9596..585fdd7b725 100644 --- a/tests/assembly/asm/avr-modifiers.rs +++ b/tests/assembly/asm/avr-modifiers.rs @@ -1,34 +1,18 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target avr-unknown-gnu-atmega328 //@ needs-llvm-components: avr -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const u64; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for ptr {} - macro_rules! check { ($func:ident $hi:literal $lo:literal $reg:tt) => { #[no_mangle] diff --git a/tests/assembly/asm/avr-types.rs b/tests/assembly/asm/avr-types.rs index 88b16895e8d..25cf3ec3b4b 100644 --- a/tests/assembly/asm/avr-types.rs +++ b/tests/assembly/asm/avr-types.rs @@ -1,34 +1,18 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target avr-unknown-gnu-atmega328 //@ needs-llvm-components: avr -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const u64; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for ptr {} - macro_rules! check { ($func:ident $ty:ident $class:ident) => { #[no_mangle] diff --git a/tests/assembly/asm/bpf-types.rs b/tests/assembly/asm/bpf-types.rs index 0a9ec7dd52b..07ea7bd5ce0 100644 --- a/tests/assembly/asm/bpf-types.rs +++ b/tests/assembly/asm/bpf-types.rs @@ -1,38 +1,18 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target bpfel-unknown-none -C target_feature=+alu32 //@ needs-llvm-components: bpf -#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const u64; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for ptr {} - macro_rules! check { ($func:ident $ty:ident $class:ident) => { #[no_mangle] diff --git a/tests/assembly/asm/hexagon-types.rs b/tests/assembly/asm/hexagon-types.rs index 9389fcf9cba..ce80fa75b35 100644 --- a/tests/assembly/asm/hexagon-types.rs +++ b/tests/assembly/asm/hexagon-types.rs @@ -1,38 +1,19 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target hexagon-unknown-linux-musl //@ compile-flags: -Zmerge-functions=disabled //@ needs-llvm-components: hexagon -#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const i32; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for f32 {} -impl Copy for ptr {} extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/assembly/asm/loongarch-type.rs b/tests/assembly/asm/loongarch-type.rs index c51d35876d9..86d9e03bc93 100644 --- a/tests/assembly/asm/loongarch-type.rs +++ b/tests/assembly/asm/loongarch-type.rs @@ -1,40 +1,19 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target loongarch64-unknown-linux-gnu //@ compile-flags: -Zmerge-functions=disabled //@ needs-llvm-components: loongarch -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const i32; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for f32 {} -impl Copy for f64 {} -impl Copy for ptr {} extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/assembly/asm/m68k-types.rs b/tests/assembly/asm/m68k-types.rs index b3e86b709c3..9e4f6d9a1a9 100644 --- a/tests/assembly/asm/m68k-types.rs +++ b/tests/assembly/asm/m68k-types.rs @@ -1,34 +1,18 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target m68k-unknown-linux-gnu //@ needs-llvm-components: m68k -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const u64; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for ptr {} - macro_rules! check { ($func:ident $ty:ident $class:ident $mov:literal) => { #[no_mangle] diff --git a/tests/assembly/asm/mips-types.rs b/tests/assembly/asm/mips-types.rs index f40a28be4a7..00e8ce0b874 100644 --- a/tests/assembly/asm/mips-types.rs +++ b/tests/assembly/asm/mips-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: mips32 mips64 //@ assembly-output: emit-asm //@[mips32] compile-flags: --target mips-unknown-linux-gnu @@ -6,39 +7,16 @@ //@[mips64] needs-llvm-components: mips //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const i32; -impl Copy for i8 {} -impl Copy for u8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for f32 {} -impl Copy for f64 {} -impl Copy for ptr {} extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/assembly/asm/msp430-types.rs b/tests/assembly/asm/msp430-types.rs index ae09b8b070d..442dc77999f 100644 --- a/tests/assembly/asm/msp430-types.rs +++ b/tests/assembly/asm/msp430-types.rs @@ -1,34 +1,18 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target msp430-none-elf //@ needs-llvm-components: msp430 -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const i16; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for ptr {} - macro_rules! check { ($func:ident $ty:ident $class:ident) => { #[no_mangle] diff --git a/tests/assembly/asm/nvptx-types.rs b/tests/assembly/asm/nvptx-types.rs index 0dd3162b4c0..7e8ebd03024 100644 --- a/tests/assembly/asm/nvptx-types.rs +++ b/tests/assembly/asm/nvptx-types.rs @@ -1,35 +1,17 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target nvptx64-nvidia-cuda -//@ compile-flags: --crate-type cdylib //@ needs-llvm-components: nvptx -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] +#![crate_type = "rlib"] #![no_core] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *mut u8; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for f32 {} -impl Copy for i64 {} -impl Copy for f64 {} -impl Copy for ptr {} - // NVPTX does not support static variables #[no_mangle] fn extern_func() {} diff --git a/tests/assembly/asm/powerpc-types.rs b/tests/assembly/asm/powerpc-types.rs index aa35c4d8865..4291e4c02f3 100644 --- a/tests/assembly/asm/powerpc-types.rs +++ b/tests/assembly/asm/powerpc-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: powerpc powerpc_altivec powerpc_vsx powerpc64 powerpc64_vsx //@ assembly-output: emit-asm //@[powerpc] compile-flags: --target powerpc-unknown-linux-gnu @@ -12,11 +13,14 @@ //@[powerpc64_vsx] needs-llvm-components: powerpc //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] +#![feature(no_core, repr_simd, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] +extern crate minicore; +use minicore::*; + #[cfg_attr(altivec, cfg(not(target_feature = "altivec")))] #[cfg_attr(not(altivec), cfg(target_feature = "altivec"))] compile_error!("altivec cfg and target feature mismatch"); @@ -24,26 +28,6 @@ compile_error!("altivec cfg and target feature mismatch"); #[cfg_attr(not(vsx), cfg(target_feature = "vsx"))] compile_error!("vsx cfg and target feature mismatch"); -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl<T: Copy, const N: usize> Copy for [T; N] {} - type ptr = *const i32; #[repr(simd)] @@ -59,14 +43,6 @@ pub struct f32x4([f32; 4]); #[repr(simd)] pub struct f64x2([f64; 2]); -impl Copy for i8 {} -impl Copy for u8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for f32 {} -impl Copy for f64 {} -impl Copy for ptr {} impl Copy for i8x16 {} impl Copy for i16x8 {} impl Copy for i32x4 {} diff --git a/tests/assembly/asm/riscv-types.rs b/tests/assembly/asm/riscv-types.rs index 1f5d7d85b0a..724aa154da8 100644 --- a/tests/assembly/asm/riscv-types.rs +++ b/tests/assembly/asm/riscv-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: riscv64 riscv32 riscv64-zfhmin riscv32-zfhmin riscv64-zfh riscv32-zfh //@ assembly-output: emit-asm @@ -29,40 +30,16 @@ //@ compile-flags: -C target-feature=+d //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, f16)] +#![feature(no_core, f16)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *mut u8; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for f16 {} -impl Copy for i32 {} -impl Copy for f32 {} -impl Copy for i64 {} -impl Copy for f64 {} -impl Copy for ptr {} - extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/assembly/asm/s390x-types.rs b/tests/assembly/asm/s390x-types.rs index 3da22d6c77b..e6fe38ecb0d 100644 --- a/tests/assembly/asm/s390x-types.rs +++ b/tests/assembly/asm/s390x-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: s390x s390x_vector //@ assembly-output: emit-asm //@[s390x] compile-flags: --target s390x-unknown-linux-gnu @@ -6,31 +7,14 @@ //@[s390x_vector] needs-llvm-components: systemz //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, repr_simd, f128)] +#![feature(no_core, repr_simd, f128)] #![cfg_attr(s390x_vector, feature(asm_experimental_reg))] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl<T: Copy, const N: usize> Copy for [T; N] {} +extern crate minicore; +use minicore::*; type ptr = *const i32; @@ -47,16 +31,6 @@ pub struct f32x4([f32; 4]); #[repr(simd)] pub struct f64x2([f64; 2]); -impl Copy for i8 {} -impl Copy for u8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for i128 {} -impl Copy for f32 {} -impl Copy for f64 {} -impl Copy for f128 {} -impl Copy for ptr {} impl Copy for i8x16 {} impl Copy for i16x8 {} impl Copy for i32x4 {} diff --git a/tests/assembly/asm/sparc-types.rs b/tests/assembly/asm/sparc-types.rs index 2270679e837..49cc377cd95 100644 --- a/tests/assembly/asm/sparc-types.rs +++ b/tests/assembly/asm/sparc-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: sparc sparcv8plus sparc64 //@ assembly-output: emit-asm //@[sparc] compile-flags: --target sparc-unknown-none-elf @@ -8,40 +9,16 @@ //@[sparc64] needs-llvm-components: sparc //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *const i32; -impl Copy for i8 {} -impl Copy for u8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for f32 {} -impl Copy for f64 {} -impl Copy for ptr {} - extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/assembly/asm/wasm-types.rs b/tests/assembly/asm/wasm-types.rs index fe5ce836bc6..78e555c5317 100644 --- a/tests/assembly/asm/wasm-types.rs +++ b/tests/assembly/asm/wasm-types.rs @@ -1,35 +1,17 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target wasm32-unknown-unknown -//@ compile-flags: --crate-type cdylib //@ needs-llvm-components: webassembly -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] +#![crate_type = "rlib"] #![no_core] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; type ptr = *mut u8; -impl Copy for i8 {} -impl Copy for i16 {} -impl Copy for i32 {} -impl Copy for f32 {} -impl Copy for i64 {} -impl Copy for f64 {} -impl Copy for ptr {} - extern "C" { fn extern_func(); static extern_static: u8; diff --git a/tests/assembly/asm/x86-modifiers.rs b/tests/assembly/asm/x86-modifiers.rs index 5a48af9205f..53e4b92f84a 100644 --- a/tests/assembly/asm/x86-modifiers.rs +++ b/tests/assembly/asm/x86-modifiers.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86_64 i686 //@ assembly-output: emit-asm //@ compile-flags: -O -C panic=abort @@ -9,30 +10,13 @@ //@ compile-flags: -C target-feature=+avx512bw //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; macro_rules! check { ($func:ident $modifier:literal $reg:ident $mov:literal) => { diff --git a/tests/assembly/asm/x86-types.rs b/tests/assembly/asm/x86-types.rs index 567dc7a8245..6120ed0d532 100644 --- a/tests/assembly/asm/x86-types.rs +++ b/tests/assembly/asm/x86-types.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86_64 i686 //@ assembly-output: emit-asm //@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu @@ -8,31 +9,13 @@ //@ compile-flags: -C target-feature=+avx512bw //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, repr_simd, f16, f128)] +#![feature(no_core, repr_simd, f16, f128)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! concat { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! stringify { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -// Do we really need to use no_core for this?!? -impl<T: Copy, const N: usize> Copy for [T; N] {} +extern crate minicore; +use minicore::*; type ptr = *mut u8; @@ -90,7 +73,6 @@ macro_rules! impl_copy { } impl_copy!( - i8 i16 f16 i32 f32 i64 f64 f128 ptr i8x16 i16x8 i32x4 i64x2 f16x8 f32x4 f64x2 i8x32 i16x16 i32x8 i64x4 f16x16 f32x8 f64x4 i8x64 i16x32 i32x16 i64x8 f16x32 f32x16 f64x8 diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index 2fa0c550efb..a68552175c3 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -14,7 +14,7 @@ //! <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)] +#![feature(no_core, lang_items, rustc_attrs, decl_macro, naked_functions, f16, f128)] #![allow(unused, improper_ctypes_definitions, internal_features)] #![feature(asm_experimental_arch)] #![no_std] @@ -40,7 +40,12 @@ impl<T: ?Sized> LegacyReceiver for &mut T {} pub trait Copy: Sized {} impl_marker_trait!( - Copy => [ bool, char, isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64 ] + Copy => [ + bool, char, + isize, i8, i16, i32, i64, i128, + usize, u8, u16, u32, u64, u128, + f16, f32, f64, f128, + ] ); impl<'a, T: ?Sized> Copy for &'a T {} impl<T: ?Sized> Copy for *const T {} @@ -88,3 +93,18 @@ pub macro naked_asm("assembly template", $(operands,)* $(options($(option),*))?) pub macro global_asm("assembly template", $(operands,)* $(options($(option),*))?) { /* compiler built-in */ } + +#[rustc_builtin_macro] +#[macro_export] +macro_rules! concat { + ($($e:expr),* $(,)?) => { + /* compiler built-in */ + }; +} +#[rustc_builtin_macro] +#[macro_export] +macro_rules! stringify { + ($($t:tt)*) => { + /* compiler built-in */ + }; +} diff --git a/tests/codegen-units/item-collection/generic-impl.rs b/tests/codegen-units/item-collection/generic-impl.rs index 23d09e0d8af..f6e49f6e6df 100644 --- a/tests/codegen-units/item-collection/generic-impl.rs +++ b/tests/codegen-units/item-collection/generic-impl.rs @@ -14,7 +14,7 @@ fn id<T>(x: T) -> T { impl<T> Struct<T> { fn new(x: T) -> Struct<T> { - Struct { x: x, f: id } + Struct { x, f: id } } fn get<T2>(self, x: T2) -> (T, T2) { diff --git a/tests/codegen/async-fn-debug-awaitee-field.rs b/tests/codegen/async-fn-debug-awaitee-field.rs index d1a7d738e9e..ab13d4509e2 100644 --- a/tests/codegen/async-fn-debug-awaitee-field.rs +++ b/tests/codegen/async-fn-debug-awaitee-field.rs @@ -1,8 +1,12 @@ -// This test makes sure that the coroutine field capturing the awaitee in a `.await` expression -// is called "__awaitee" in debuginfo. This name must not be changed since debuggers and debugger -// extensions rely on the field having this name. - // ignore-tidy-linelength +//! This test makes sure that the coroutine field capturing the awaitee in a `.await` expression +//! is called `__awaitee` in debuginfo. This name must not be changed since debuggers and debugger +//! extensions rely on the field having this name. + +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc + //@ compile-flags: -C debuginfo=2 --edition=2018 -Copt-level=0 #![crate_type = "lib"] diff --git a/tests/codegen/debug-accessibility/crate-enum.rs b/tests/codegen/debug-accessibility/crate-enum.rs index c80700d7b28..9ad5a6fd0ff 100644 --- a/tests/codegen/debug-accessibility/crate-enum.rs +++ b/tests/codegen/debug-accessibility/crate-enum.rs @@ -1,9 +1,11 @@ -//@ compile-flags: -C debuginfo=2 // ignore-tidy-linelength +//! Checks that visibility information is present in the debuginfo for crate-visibility enums. -#![allow(dead_code)] +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc -// Checks that visibility information is present in the debuginfo for crate-visibility enums. +//@ compile-flags: -C debuginfo=2 mod module { use std::hint::black_box; diff --git a/tests/codegen/debug-accessibility/private-enum.rs b/tests/codegen/debug-accessibility/private-enum.rs index 22d49a40eff..002336c03b3 100644 --- a/tests/codegen/debug-accessibility/private-enum.rs +++ b/tests/codegen/debug-accessibility/private-enum.rs @@ -1,9 +1,10 @@ -//@ compile-flags: -C debuginfo=2 // ignore-tidy-linelength +//! Checks that visibility information is present in the debuginfo for private enums. -#![allow(dead_code)] - -// Checks that visibility information is present in the debuginfo for private enums. +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc +//@ compile-flags: -C debuginfo=2 use std::hint::black_box; diff --git a/tests/codegen/debug-accessibility/public-enum.rs b/tests/codegen/debug-accessibility/public-enum.rs index f16ccf1a3c9..e5cd1ab7350 100644 --- a/tests/codegen/debug-accessibility/public-enum.rs +++ b/tests/codegen/debug-accessibility/public-enum.rs @@ -1,9 +1,11 @@ -//@ compile-flags: -C debuginfo=2 // ignore-tidy-linelength +//! Checks that visibility information is present in the debuginfo for types and their fields. -#![allow(dead_code)] +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc -// Checks that visibility information is present in the debuginfo for types and their fields. +//@ compile-flags: -C debuginfo=2 use std::hint::black_box; diff --git a/tests/codegen/debug-accessibility/super-enum.rs b/tests/codegen/debug-accessibility/super-enum.rs index 1b6d7d793ed..8e34d8be01f 100644 --- a/tests/codegen/debug-accessibility/super-enum.rs +++ b/tests/codegen/debug-accessibility/super-enum.rs @@ -1,9 +1,10 @@ -//@ compile-flags: -C debuginfo=2 // ignore-tidy-linelength +//! Checks that visibility information is present in the debuginfo for super-visibility enums. -#![allow(dead_code)] - -// Checks that visibility information is present in the debuginfo for super-visibility enums. +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc +//@ compile-flags: -C debuginfo=2 mod module { use std::hint::black_box; diff --git a/tests/codegen/debug-vtable.rs b/tests/codegen/debug-vtable.rs index 036fff6cd23..b9808e4079b 100644 --- a/tests/codegen/debug-vtable.rs +++ b/tests/codegen/debug-vtable.rs @@ -1,5 +1,10 @@ -// This test checks the debuginfo for the expected 3 vtables is generated for correct names and number -// of entries. +// ignore-tidy-linelength +//! This test checks the debuginfo for the expected 3 vtables is generated for correct names and +//! number of entries. + +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc // Use the v0 symbol mangling scheme to codegen order independent of rustc version. // Unnamed items like shims are generated in lexicographical order of their symbol name and in the @@ -7,7 +12,6 @@ // of the name, thus randomizing item order with respect to rustc version. //@ compile-flags: -Cdebuginfo=2 -Copt-level=0 -Csymbol-mangling-version=v0 -// ignore-tidy-linelength // Make sure that vtables don't have the unnamed_addr attribute when debuginfo is enabled. // This helps debuggers more reliably map from dyn pointer to concrete type. diff --git a/tests/codegen/debuginfo-generic-closure-env-names.rs b/tests/codegen/debuginfo-generic-closure-env-names.rs index 6d56fbc40ab..6b314c9abae 100644 --- a/tests/codegen/debuginfo-generic-closure-env-names.rs +++ b/tests/codegen/debuginfo-generic-closure-env-names.rs @@ -1,14 +1,17 @@ -// This test checks that we get proper type names for closure environments and -// async-fn environments in debuginfo, especially making sure that generic arguments -// of the enclosing functions don't get lost. -// -// Unfortunately, the order that debuginfo gets emitted into LLVM IR becomes a bit hard -// to predict once async fns are involved, so DAG allows any order. -// -// Note that the test does not check async-fns when targeting MSVC because debuginfo for -// those does not follow the enum-fallback encoding yet and thus is incomplete. - // ignore-tidy-linelength +//! This test checks that we get proper type names for closure environments and +//! async-fn environments in debuginfo, especially making sure that generic arguments +//! of the enclosing functions don't get lost. +//! +//! Unfortunately, the order that debuginfo gets emitted into LLVM IR becomes a bit hard +//! to predict once async fns are involved, so DAG allows any order. +//! +//! Note that the test does not check async-fns when targeting MSVC because debuginfo for +//! those does not follow the enum-fallback encoding yet and thus is incomplete. + +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc // Use the v0 symbol mangling scheme to codegen order independent of rustc version. // Unnamed items like shims are generated in lexicographical order of their symbol name and in the diff --git a/tests/codegen/issues/issue-15953.rs b/tests/codegen/issues/issue-15953.rs index 28d28428904..70e597ac1dd 100644 --- a/tests/codegen/issues/issue-15953.rs +++ b/tests/codegen/issues/issue-15953.rs @@ -9,7 +9,7 @@ struct Foo { #[no_mangle] // CHECK: memcpy fn interior(x: Vec<i32>) -> Vec<i32> { - let Foo { x } = Foo { x: x }; + let Foo { x } = Foo { x }; x } diff --git a/tests/codegen/issues/issue-98678-async.rs b/tests/codegen/issues/issue-98678-async.rs index 75f5d82eee5..3dd06bb5194 100644 --- a/tests/codegen/issues/issue-98678-async.rs +++ b/tests/codegen/issues/issue-98678-async.rs @@ -1,11 +1,13 @@ -// This test verifies the accuracy of emitted file and line debuginfo metadata for async blocks and -// async functions. -// +// ignore-tidy-linelength +//! This test verifies the accuracy of emitted file and line debuginfo metadata for async blocks and +//! async functions. + +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc //@ edition:2021 //@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true -// ignore-tidy-linelength - // NONMSVC-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*[/\\]}}issue-98678-async.rs{{".*}}) // MSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\issue-98678-async.rs{{".*}}) diff --git a/tests/codegen/issues/issue-98678-closure-coroutine.rs b/tests/codegen/issues/issue-98678-closure-coroutine.rs index 0730e56bf31..8763bcb799d 100644 --- a/tests/codegen/issues/issue-98678-closure-coroutine.rs +++ b/tests/codegen/issues/issue-98678-closure-coroutine.rs @@ -1,10 +1,13 @@ -// This test verifies the accuracy of emitted file and line debuginfo metadata for closures and -// coroutines. -// -//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true +// ignore-tidy-linelength +//! This test verifies the accuracy of emitted file and line debuginfo metadata for closures and +//! coroutines. + #![feature(coroutines, stmt_expr_attributes)] -// ignore-tidy-linelength +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc +//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true // NONMSVC-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*[/\\]}}issue-98678-closure-coroutine.rs{{".*}}) // MSVC-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\issue-98678-closure-coroutine.rs{{".*}}) diff --git a/tests/codegen/issues/issue-98678-enum.rs b/tests/codegen/issues/issue-98678-enum.rs index 62c6cded866..87bf8797293 100644 --- a/tests/codegen/issues/issue-98678-enum.rs +++ b/tests/codegen/issues/issue-98678-enum.rs @@ -1,8 +1,10 @@ -// This test verifies the accuracy of emitted file and line debuginfo metadata enums. -// -//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true - // ignore-tidy-linelength +//! This test verifies the accuracy of emitted file and line debuginfo metadata enums. + +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc +//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true // NONMSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*[/\\]}}issue-98678-enum.rs{{".*}}) // MSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\issue-98678-enum.rs{{".*}}) diff --git a/tests/codegen/issues/issue-98678-struct-union.rs b/tests/codegen/issues/issue-98678-struct-union.rs index bf2d6e731aa..a83a585a433 100644 --- a/tests/codegen/issues/issue-98678-struct-union.rs +++ b/tests/codegen/issues/issue-98678-struct-union.rs @@ -1,9 +1,11 @@ -// This test verifies the accuracy of emitted file and line debuginfo metadata for structs and -// unions. -// -//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true - // ignore-tidy-linelength +//! This test verifies the accuracy of emitted file and line debuginfo metadata for structs and +//! unions. + +//@ revisions: MSVC NONMSVC +//@[MSVC] only-msvc +//@[NONMSVC] ignore-msvc +//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true // NONMSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*[/\\]}}issue-98678-struct-union.rs{{".*}}) // MSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\issue-98678-struct-union.rs{{".*}}) diff --git a/tests/codegen/meta-filecheck/msvc-prefix-good.rs b/tests/codegen/meta-filecheck/msvc-prefix-good.rs deleted file mode 100644 index 580d20d5438..00000000000 --- a/tests/codegen/meta-filecheck/msvc-prefix-good.rs +++ /dev/null @@ -1,7 +0,0 @@ -// One of MSVC or NONMSVC should always be defined, so this test should pass. - -// (one of these should always be present) - -// MSVC: main -// NONMSVC: main -fn main() {} diff --git a/tests/coverage/attr/impl.cov-map b/tests/coverage/attr/impl.cov-map index afb91af6829..4d068c290f4 100644 --- a/tests/coverage/attr/impl.cov-map +++ b/tests/coverage/attr/impl.cov-map @@ -1,27 +1,27 @@ Function name: <impl::MyStruct>::off_on (unused) -Raw bytes (9): 0x[01, 01, 00, 01, 00, 0d, 05, 00, 13] +Raw bytes (9): 0x[01, 01, 00, 01, 00, 0e, 05, 00, 13] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Zero) at (prev + 13, 5) to (start + 0, 19) +- Code(Zero) at (prev + 14, 5) to (start + 0, 19) Highest counter ID seen: (none) Function name: <impl::MyStruct>::on_inherit (unused) -Raw bytes (9): 0x[01, 01, 00, 01, 00, 15, 05, 00, 17] +Raw bytes (9): 0x[01, 01, 00, 01, 00, 16, 05, 00, 17] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Zero) at (prev + 21, 5) to (start + 0, 23) +- Code(Zero) at (prev + 22, 5) to (start + 0, 23) Highest counter ID seen: (none) Function name: <impl::MyStruct>::on_on (unused) -Raw bytes (9): 0x[01, 01, 00, 01, 00, 18, 05, 00, 12] +Raw bytes (9): 0x[01, 01, 00, 01, 00, 19, 05, 00, 12] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Zero) at (prev + 24, 5) to (start + 0, 18) +- Code(Zero) at (prev + 25, 5) to (start + 0, 18) Highest counter ID seen: (none) diff --git a/tests/coverage/attr/impl.coverage b/tests/coverage/attr/impl.coverage index 205b9e830a5..af00df5d743 100644 --- a/tests/coverage/attr/impl.coverage +++ b/tests/coverage/attr/impl.coverage @@ -1,4 +1,5 @@ LL| |//@ edition: 2021 + LL| |//@ reference: attributes.coverage.nesting LL| | LL| |// Checks that `#[coverage(..)]` can be applied to impl and impl-trait blocks, LL| |// and is inherited by any enclosed functions. diff --git a/tests/coverage/attr/impl.rs b/tests/coverage/attr/impl.rs index 8c1f991926d..db08fdc4179 100644 --- a/tests/coverage/attr/impl.rs +++ b/tests/coverage/attr/impl.rs @@ -1,4 +1,5 @@ //@ edition: 2021 +//@ reference: attributes.coverage.nesting // Checks that `#[coverage(..)]` can be applied to impl and impl-trait blocks, // and is inherited by any enclosed functions. diff --git a/tests/coverage/attr/module.cov-map b/tests/coverage/attr/module.cov-map index 3efc745dba3..b318ac85a6c 100644 --- a/tests/coverage/attr/module.cov-map +++ b/tests/coverage/attr/module.cov-map @@ -1,27 +1,27 @@ Function name: module::off::on (unused) -Raw bytes (9): 0x[01, 01, 00, 01, 00, 0b, 05, 00, 0f] +Raw bytes (9): 0x[01, 01, 00, 01, 00, 0c, 05, 00, 0f] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Zero) at (prev + 11, 5) to (start + 0, 15) +- Code(Zero) at (prev + 12, 5) to (start + 0, 15) Highest counter ID seen: (none) Function name: module::on::inherit (unused) -Raw bytes (9): 0x[01, 01, 00, 01, 00, 13, 05, 00, 14] +Raw bytes (9): 0x[01, 01, 00, 01, 00, 14, 05, 00, 14] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Zero) at (prev + 19, 5) to (start + 0, 20) +- Code(Zero) at (prev + 20, 5) to (start + 0, 20) Highest counter ID seen: (none) Function name: module::on::on (unused) -Raw bytes (9): 0x[01, 01, 00, 01, 00, 16, 05, 00, 0f] +Raw bytes (9): 0x[01, 01, 00, 01, 00, 17, 05, 00, 0f] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Zero) at (prev + 22, 5) to (start + 0, 15) +- Code(Zero) at (prev + 23, 5) to (start + 0, 15) Highest counter ID seen: (none) diff --git a/tests/coverage/attr/module.coverage b/tests/coverage/attr/module.coverage index acad0312069..732850fb04a 100644 --- a/tests/coverage/attr/module.coverage +++ b/tests/coverage/attr/module.coverage @@ -1,4 +1,5 @@ LL| |//@ edition: 2021 + LL| |//@ reference: attributes.coverage.nesting LL| | LL| |// Checks that `#[coverage(..)]` can be applied to modules, and is inherited LL| |// by any enclosed functions. diff --git a/tests/coverage/attr/module.rs b/tests/coverage/attr/module.rs index ed530d53e47..c0ec5bc1d62 100644 --- a/tests/coverage/attr/module.rs +++ b/tests/coverage/attr/module.rs @@ -1,4 +1,5 @@ //@ edition: 2021 +//@ reference: attributes.coverage.nesting // Checks that `#[coverage(..)]` can be applied to modules, and is inherited // by any enclosed functions. diff --git a/tests/coverage/attr/nested.cov-map b/tests/coverage/attr/nested.cov-map index 2bd95325373..138b3159ea5 100644 --- a/tests/coverage/attr/nested.cov-map +++ b/tests/coverage/attr/nested.cov-map @@ -1,20 +1,20 @@ Function name: nested::closure_expr -Raw bytes (14): 0x[01, 01, 00, 02, 01, 3f, 01, 01, 0f, 01, 0b, 05, 01, 02] +Raw bytes (14): 0x[01, 01, 00, 02, 01, 40, 01, 01, 0f, 01, 0b, 05, 01, 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 + 63, 1) to (start + 1, 15) +- Code(Counter(0)) at (prev + 64, 1) to (start + 1, 15) - Code(Counter(0)) at (prev + 11, 5) to (start + 1, 2) Highest counter ID seen: c0 Function name: nested::closure_tail -Raw bytes (14): 0x[01, 01, 00, 02, 01, 4e, 01, 01, 0f, 01, 11, 05, 01, 02] +Raw bytes (14): 0x[01, 01, 00, 02, 01, 4f, 01, 01, 0f, 01, 11, 05, 01, 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 + 78, 1) to (start + 1, 15) +- Code(Counter(0)) at (prev + 79, 1) to (start + 1, 15) - Code(Counter(0)) at (prev + 17, 5) to (start + 1, 2) Highest counter ID seen: c0 diff --git a/tests/coverage/attr/nested.coverage b/tests/coverage/attr/nested.coverage index 1e2525eb860..13e9aa0a8e8 100644 --- a/tests/coverage/attr/nested.coverage +++ b/tests/coverage/attr/nested.coverage @@ -1,5 +1,6 @@ LL| |#![feature(stmt_expr_attributes)] LL| |//@ edition: 2021 + LL| |//@ reference: attributes.coverage.nesting LL| | LL| |// Demonstrates the interaction between #[coverage(off)] and various kinds of LL| |// nested function. diff --git a/tests/coverage/attr/nested.rs b/tests/coverage/attr/nested.rs index 019f07428c1..184fa54c066 100644 --- a/tests/coverage/attr/nested.rs +++ b/tests/coverage/attr/nested.rs @@ -1,5 +1,6 @@ #![feature(stmt_expr_attributes)] //@ edition: 2021 +//@ reference: attributes.coverage.nesting // Demonstrates the interaction between #[coverage(off)] and various kinds of // nested function. diff --git a/tests/coverage/attr/off-on-sandwich.cov-map b/tests/coverage/attr/off-on-sandwich.cov-map index d7972d0cc9e..ae5c9bd19a2 100644 --- a/tests/coverage/attr/off-on-sandwich.cov-map +++ b/tests/coverage/attr/off-on-sandwich.cov-map @@ -1,30 +1,30 @@ Function name: off_on_sandwich::dense_a::dense_b -Raw bytes (14): 0x[01, 01, 00, 02, 01, 0e, 05, 02, 12, 01, 07, 05, 00, 06] +Raw bytes (14): 0x[01, 01, 00, 02, 01, 0f, 05, 02, 12, 01, 07, 05, 00, 06] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 14, 5) to (start + 2, 18) +- Code(Counter(0)) at (prev + 15, 5) to (start + 2, 18) - Code(Counter(0)) at (prev + 7, 5) to (start + 0, 6) Highest counter ID seen: c0 Function name: off_on_sandwich::sparse_a::sparse_b::sparse_c -Raw bytes (14): 0x[01, 01, 00, 02, 01, 20, 09, 02, 17, 01, 0b, 09, 00, 0a] +Raw bytes (14): 0x[01, 01, 00, 02, 01, 21, 09, 02, 17, 01, 0b, 09, 00, 0a] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 32, 9) to (start + 2, 23) +- Code(Counter(0)) at (prev + 33, 9) to (start + 2, 23) - Code(Counter(0)) at (prev + 11, 9) to (start + 0, 10) Highest counter ID seen: c0 Function name: off_on_sandwich::sparse_a::sparse_b::sparse_c::sparse_d -Raw bytes (14): 0x[01, 01, 00, 02, 01, 23, 0d, 02, 1b, 01, 07, 0d, 00, 0e] +Raw bytes (14): 0x[01, 01, 00, 02, 01, 24, 0d, 02, 1b, 01, 07, 0d, 00, 0e] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 35, 13) to (start + 2, 27) +- Code(Counter(0)) at (prev + 36, 13) to (start + 2, 27) - Code(Counter(0)) at (prev + 7, 13) to (start + 0, 14) Highest counter ID seen: c0 diff --git a/tests/coverage/attr/off-on-sandwich.coverage b/tests/coverage/attr/off-on-sandwich.coverage index f23c248c0eb..7a8c01b31eb 100644 --- a/tests/coverage/attr/off-on-sandwich.coverage +++ b/tests/coverage/attr/off-on-sandwich.coverage @@ -1,4 +1,5 @@ LL| |//@ edition: 2021 + LL| |//@ reference: attributes.coverage.nesting LL| | LL| |// Demonstrates the interaction of `#[coverage(off)]` and `#[coverage(on)]` LL| |// in nested functions. diff --git a/tests/coverage/attr/off-on-sandwich.rs b/tests/coverage/attr/off-on-sandwich.rs index 4272365d87d..6603e071dee 100644 --- a/tests/coverage/attr/off-on-sandwich.rs +++ b/tests/coverage/attr/off-on-sandwich.rs @@ -1,4 +1,5 @@ //@ edition: 2021 +//@ reference: attributes.coverage.nesting // Demonstrates the interaction of `#[coverage(off)]` and `#[coverage(on)]` // in nested functions. diff --git a/tests/coverage/auxiliary/discard_all_helper.rs b/tests/coverage/auxiliary/discard_all_helper.rs new file mode 100644 index 00000000000..9290bac7e53 --- /dev/null +++ b/tests/coverage/auxiliary/discard_all_helper.rs @@ -0,0 +1,6 @@ +//@ edition: 2021 + +// Force this function to be generated in its home crate, so that it ends up +// with normal coverage metadata. +#[inline(never)] +pub fn external_function() {} diff --git a/tests/coverage/discard-all-issue-133606.coverage b/tests/coverage/discard-all-issue-133606.coverage new file mode 100644 index 00000000000..8f5a32f6d70 --- /dev/null +++ b/tests/coverage/discard-all-issue-133606.coverage @@ -0,0 +1,7 @@ + LL| |//@ edition: 2021 + LL| | + LL| |// Force this function to be generated in its home crate, so that it ends up + LL| |// with normal coverage metadata. + LL| |#[inline(never)] + LL| 1|pub fn external_function() {} + diff --git a/tests/coverage/discard-all-issue-133606.rs b/tests/coverage/discard-all-issue-133606.rs new file mode 100644 index 00000000000..91c278b2bb8 --- /dev/null +++ b/tests/coverage/discard-all-issue-133606.rs @@ -0,0 +1,24 @@ +//! Regression test for <https://github.com/rust-lang/rust/issues/133606>. +//! +//! In rare cases, all of a function's coverage spans are discarded at a late +//! stage during codegen. When that happens, the subsequent code needs to take +//! special care to avoid emitting coverage metadata that would cause `llvm-cov` +//! to fail with a fatal error. +//! +//! We currently don't know of a concise way to reproduce that scenario with +//! ordinary Rust source code, so instead we set a special testing-only flag to +//! force it to occur. + +//@ edition: 2021 +//@ compile-flags: -Zcoverage-options=discard-all-spans-in-codegen + +// The `llvm-cov` tool will complain if the test binary ends up having no +// coverage metadata at all. To prevent that, we also link to instrumented +// code in an auxiliary crate that doesn't have the special flag set. + +//@ aux-build: discard_all_helper.rs +extern crate discard_all_helper; + +fn main() { + discard_all_helper::external_function(); +} diff --git a/tests/coverage/no_cov_crate.cov-map b/tests/coverage/no_cov_crate.cov-map index dd01774b9c4..0eb86ef9366 100644 --- a/tests/coverage/no_cov_crate.cov-map +++ b/tests/coverage/no_cov_crate.cov-map @@ -1,67 +1,67 @@ Function name: no_cov_crate::add_coverage_1 -Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 01, 02, 02] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 15, 01, 02, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 19, 1) to (start + 2, 2) +- Code(Counter(0)) at (prev + 21, 1) to (start + 2, 2) Highest counter ID seen: c0 Function name: no_cov_crate::add_coverage_2 -Raw bytes (9): 0x[01, 01, 00, 01, 01, 17, 01, 02, 02] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 19, 01, 02, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 23, 1) to (start + 2, 2) +- Code(Counter(0)) at (prev + 25, 1) to (start + 2, 2) Highest counter ID seen: c0 Function name: no_cov_crate::add_coverage_not_called (unused) -Raw bytes (9): 0x[01, 01, 00, 01, 00, 1c, 01, 02, 02] +Raw bytes (9): 0x[01, 01, 00, 01, 00, 1e, 01, 02, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Zero) at (prev + 28, 1) to (start + 2, 2) +- Code(Zero) at (prev + 30, 1) to (start + 2, 2) Highest counter ID seen: (none) Function name: no_cov_crate::main -Raw bytes (9): 0x[01, 01, 00, 01, 01, 4c, 01, 0b, 02] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 4e, 01, 0b, 02] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 1 -- Code(Counter(0)) at (prev + 76, 1) to (start + 11, 2) +- Code(Counter(0)) at (prev + 78, 1) to (start + 11, 2) Highest counter ID seen: c0 Function name: no_cov_crate::nested_fns::outer -Raw bytes (14): 0x[01, 01, 00, 02, 01, 30, 05, 02, 23, 01, 0c, 05, 00, 06] +Raw bytes (14): 0x[01, 01, 00, 02, 01, 32, 05, 02, 23, 01, 0c, 05, 00, 06] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 48, 5) to (start + 2, 35) +- Code(Counter(0)) at (prev + 50, 5) to (start + 2, 35) - Code(Counter(0)) at (prev + 12, 5) to (start + 0, 6) Highest counter ID seen: c0 Function name: no_cov_crate::nested_fns::outer_both_covered -Raw bytes (14): 0x[01, 01, 00, 02, 01, 3e, 05, 02, 17, 01, 0b, 05, 00, 06] +Raw bytes (14): 0x[01, 01, 00, 02, 01, 40, 05, 02, 17, 01, 0b, 05, 00, 06] Number of files: 1 - file 0 => global file 1 Number of expressions: 0 Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 62, 5) to (start + 2, 23) +- Code(Counter(0)) at (prev + 64, 5) to (start + 2, 23) - Code(Counter(0)) at (prev + 11, 5) to (start + 0, 6) Highest counter ID seen: c0 Function name: no_cov_crate::nested_fns::outer_both_covered::inner -Raw bytes (26): 0x[01, 01, 01, 01, 05, 04, 01, 42, 09, 01, 17, 05, 01, 18, 02, 0e, 02, 02, 14, 02, 0e, 01, 03, 09, 00, 0a] +Raw bytes (26): 0x[01, 01, 01, 01, 05, 04, 01, 44, 09, 01, 17, 05, 01, 18, 02, 0e, 02, 02, 14, 02, 0e, 01, 03, 09, 00, 0a] Number of files: 1 - file 0 => global file 1 Number of expressions: 1 - expression 0 operands: lhs = Counter(0), rhs = Counter(1) Number of file 0 mappings: 4 -- Code(Counter(0)) at (prev + 66, 9) to (start + 1, 23) +- Code(Counter(0)) at (prev + 68, 9) to (start + 1, 23) - Code(Counter(1)) at (prev + 1, 24) to (start + 2, 14) - Code(Expression(0, Sub)) at (prev + 2, 20) to (start + 2, 14) = (c0 - c1) diff --git a/tests/coverage/no_cov_crate.coverage b/tests/coverage/no_cov_crate.coverage index b08e5604454..a75057287bc 100644 --- a/tests/coverage/no_cov_crate.coverage +++ b/tests/coverage/no_cov_crate.coverage @@ -1,4 +1,6 @@ LL| |// Enables `coverage(off)` on the entire crate + LL| |//@ reference: attributes.coverage.intro + LL| |//@ reference: attributes.coverage.nesting LL| | LL| |#[coverage(off)] LL| |fn do_not_add_coverage_1() { diff --git a/tests/coverage/no_cov_crate.rs b/tests/coverage/no_cov_crate.rs index 1b4b384b167..df8594e9790 100644 --- a/tests/coverage/no_cov_crate.rs +++ b/tests/coverage/no_cov_crate.rs @@ -1,4 +1,6 @@ // Enables `coverage(off)` on the entire crate +//@ reference: attributes.coverage.intro +//@ reference: attributes.coverage.nesting #[coverage(off)] fn do_not_add_coverage_1() { diff --git a/tests/crashes/124021.rs b/tests/crashes/124021.rs deleted file mode 100644 index a2b6b7f9a66..00000000000 --- a/tests/crashes/124021.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ known-bug: #124021 -type Opaque2<'a> = impl Sized + 'a; - -fn test2() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque2<'a>, Opaque2<'a>) { - |x| x -} diff --git a/tests/crashes/133639.rs b/tests/crashes/133639.rs deleted file mode 100644 index d522b0730cf..00000000000 --- a/tests/crashes/133639.rs +++ /dev/null @@ -1,33 +0,0 @@ -//@ known-bug: #133639 - -#![feature(with_negative_coherence)] -#![feature(min_specialization)] -#![feature(generic_const_exprs)] - -#![crate_type = "lib"] -use std::str::FromStr; - -struct a<const b: bool>; - -trait c {} - -impl<const d: u32> FromStr for e<d> -where - a<{ d <= 2 }>: c, -{ - type Err = (); - fn from_str(f: &str) -> Result<Self, Self::Err> { - unimplemented!() - } -} -struct e<const d: u32>; - -impl<const d: u32> FromStr for e<d> -where - a<{ d <= 2 }>: c, -{ - type Err = (); - fn from_str(f: &str) -> Result<Self, Self::Err> { - unimplemented!() - } -} diff --git a/tests/crashes/134005.rs b/tests/crashes/134005.rs deleted file mode 100644 index c1f4c758a14..00000000000 --- a/tests/crashes/134005.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ known-bug: #134005 - -fn main() { - let _ = [std::ops::Add::add, std::ops::Mul::mul, main as fn(_, &_)]; -} 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 f0d128ec02e..69ef6016d25 100644 --- a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff @@ -30,12 +30,12 @@ + 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)) => 13:1 - 14:21; -+ coverage Code(Counter(1)) => 15:17 - 15:33; -+ coverage Code(Counter(2)) => 16:17 - 16:33; -+ coverage Code(Counter(3)) => 17:17 - 17:33; -+ coverage Code(Expression(2)) => 18:17 - 18:33; -+ coverage Code(Counter(0)) => 20:1 - 20:2; ++ coverage Code(Counter(0)) => $DIR/branch_match_arms.rs:13:1: 14:21 (#0); ++ coverage Code(Counter(1)) => $DIR/branch_match_arms.rs:15:17: 15:33 (#0); ++ coverage Code(Counter(2)) => $DIR/branch_match_arms.rs:16:17: 16:33 (#0); ++ coverage Code(Counter(3)) => $DIR/branch_match_arms.rs:17:17: 17:33 (#0); ++ coverage Code(Expression(2)) => $DIR/branch_match_arms.rs:18:17: 18:33 (#0); ++ coverage Code(Counter(0)) => $DIR/branch_match_arms.rs:20:2: 20:2 (#0); + bb0: { + Coverage::CounterIncrement(0); diff --git a/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff index 2efb1fd0a17..148ff86354b 100644 --- a/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff @@ -5,7 +5,7 @@ let mut _0: bool; + coverage body span: $DIR/instrument_coverage.rs:19:18: 21:2 (#0) -+ coverage Code(Counter(0)) => 19:1 - 21:2; ++ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:19:1: 21:2 (#0); + bb0: { + Coverage::CounterIncrement(0); diff --git a/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff index a179824d6c7..b480d1ac13a 100644 --- a/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff @@ -9,11 +9,11 @@ + coverage body span: $DIR/instrument_coverage.rs:10:11: 16:2 (#0) + coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Add, rhs: Counter(1) }; -+ coverage Code(Counter(0)) => 10:1 - 10:11; -+ coverage Code(Expression(0)) => 12:12 - 12:17; -+ coverage Code(Counter(0)) => 13:13 - 13:18; -+ coverage Code(Counter(1)) => 14:9 - 14:10; -+ coverage Code(Counter(0)) => 16:1 - 16:2; ++ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:10:1: 10:11 (#0); ++ coverage Code(Expression(0)) => $DIR/instrument_coverage.rs:12:12: 12:17 (#0); ++ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:13:13: 13:18 (#0); ++ coverage Code(Counter(1)) => $DIR/instrument_coverage.rs:14:10: 14:10 (#0); ++ coverage Code(Counter(0)) => $DIR/instrument_coverage.rs:16:2: 16:2 (#0); + bb0: { + Coverage::CounterIncrement(0); 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 082539369f7..2c7ec6e85eb 100644 --- a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff +++ b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff @@ -9,11 +9,11 @@ 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)) => 13:1 - 14:36; - coverage Code(Expression(0)) => 14:37 - 14:39; - coverage Code(Counter(1)) => 14:38 - 14:39; - coverage Code(Counter(0)) => 15:1 - 15:2; - coverage Branch { true_term: Expression(0), false_term: Counter(1) } => 14:8 - 14:36; + 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); bb0: { Coverage::CounterIncrement(0); 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 8635818c6a7..c08265eb0e9 100644 --- a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff @@ -9,11 +9,11 @@ + 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)) => 13:1 - 14:36; -+ coverage Code(Expression(0)) => 14:37 - 14:39; -+ coverage Code(Counter(1)) => 14:38 - 14:39; -+ coverage Code(Counter(0)) => 15:1 - 15:2; -+ coverage Branch { true_term: Expression(0), false_term: Counter(1) } => 14:8 - 14:36; ++ 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); + bb0: { + Coverage::CounterIncrement(0); diff --git a/tests/mir-opt/early_otherwise_branch.opt5.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch.opt5.EarlyOtherwiseBranch.diff new file mode 100644 index 00000000000..b7447ef0c46 --- /dev/null +++ b/tests/mir-opt/early_otherwise_branch.opt5.EarlyOtherwiseBranch.diff @@ -0,0 +1,77 @@ +- // MIR for `opt5` before EarlyOtherwiseBranch ++ // MIR for `opt5` after EarlyOtherwiseBranch + + fn opt5(_1: u32, _2: u32) -> u32 { + debug x => _1; + debug y => _2; + let mut _0: u32; + let mut _3: (u32, u32); + let mut _4: u32; + let mut _5: u32; ++ let mut _6: bool; + + bb0: { + StorageLive(_3); + StorageLive(_4); + _4 = copy _1; + StorageLive(_5); + _5 = copy _2; + _3 = (move _4, move _5); + StorageDead(_5); + StorageDead(_4); +- switchInt(copy (_3.0: u32)) -> [1: bb2, 2: bb3, 3: bb4, otherwise: bb1]; ++ StorageLive(_6); ++ _6 = Ne(copy (_3.0: u32), copy (_3.1: u32)); ++ switchInt(move _6) -> [0: bb6, otherwise: bb1]; + } + + bb1: { ++ StorageDead(_6); + _0 = const 0_u32; +- goto -> bb8; ++ goto -> bb5; + } + + bb2: { +- switchInt(copy (_3.1: u32)) -> [1: bb7, otherwise: bb1]; ++ _0 = const 6_u32; ++ goto -> bb5; + } + + bb3: { +- switchInt(copy (_3.1: u32)) -> [2: bb6, otherwise: bb1]; ++ _0 = const 5_u32; ++ goto -> bb5; + } + + bb4: { +- switchInt(copy (_3.1: u32)) -> [3: bb5, otherwise: bb1]; ++ _0 = const 4_u32; ++ goto -> bb5; + } + + bb5: { +- _0 = const 6_u32; +- goto -> bb8; ++ StorageDead(_3); ++ return; + } + + bb6: { +- _0 = const 5_u32; +- goto -> bb8; +- } +- +- bb7: { +- _0 = const 4_u32; +- goto -> bb8; +- } +- +- bb8: { +- StorageDead(_3); +- return; ++ StorageDead(_6); ++ switchInt(copy (_3.0: u32)) -> [1: bb4, 2: bb3, 3: bb2, otherwise: bb1]; + } + } + diff --git a/tests/mir-opt/early_otherwise_branch.opt5_failed.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch.opt5_failed.EarlyOtherwiseBranch.diff new file mode 100644 index 00000000000..af16271f8b1 --- /dev/null +++ b/tests/mir-opt/early_otherwise_branch.opt5_failed.EarlyOtherwiseBranch.diff @@ -0,0 +1,61 @@ +- // MIR for `opt5_failed` before EarlyOtherwiseBranch ++ // MIR for `opt5_failed` after EarlyOtherwiseBranch + + fn opt5_failed(_1: u32, _2: u32) -> u32 { + debug x => _1; + debug y => _2; + let mut _0: u32; + let mut _3: (u32, u32); + let mut _4: u32; + let mut _5: u32; + + bb0: { + StorageLive(_3); + StorageLive(_4); + _4 = copy _1; + StorageLive(_5); + _5 = copy _2; + _3 = (move _4, move _5); + StorageDead(_5); + StorageDead(_4); + switchInt(copy (_3.0: u32)) -> [1: bb2, 2: bb3, 3: bb4, otherwise: bb1]; + } + + bb1: { + _0 = const 0_u32; + goto -> bb8; + } + + bb2: { + switchInt(copy (_3.1: u32)) -> [1: bb7, otherwise: bb1]; + } + + bb3: { + switchInt(copy (_3.1: u32)) -> [2: bb6, otherwise: bb1]; + } + + bb4: { + switchInt(copy (_3.1: u32)) -> [2: bb5, otherwise: bb1]; + } + + bb5: { + _0 = const 6_u32; + goto -> bb8; + } + + bb6: { + _0 = const 5_u32; + goto -> bb8; + } + + bb7: { + _0 = const 4_u32; + goto -> bb8; + } + + bb8: { + StorageDead(_3); + return; + } + } + diff --git a/tests/mir-opt/early_otherwise_branch.opt5_failed_type.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch.opt5_failed_type.EarlyOtherwiseBranch.diff new file mode 100644 index 00000000000..23f14b843b3 --- /dev/null +++ b/tests/mir-opt/early_otherwise_branch.opt5_failed_type.EarlyOtherwiseBranch.diff @@ -0,0 +1,61 @@ +- // MIR for `opt5_failed_type` before EarlyOtherwiseBranch ++ // MIR for `opt5_failed_type` after EarlyOtherwiseBranch + + fn opt5_failed_type(_1: u32, _2: u64) -> u32 { + debug x => _1; + debug y => _2; + let mut _0: u32; + let mut _3: (u32, u64); + let mut _4: u32; + let mut _5: u64; + + bb0: { + StorageLive(_3); + StorageLive(_4); + _4 = copy _1; + StorageLive(_5); + _5 = copy _2; + _3 = (move _4, move _5); + StorageDead(_5); + StorageDead(_4); + switchInt(copy (_3.0: u32)) -> [1: bb2, 2: bb3, 3: bb4, otherwise: bb1]; + } + + bb1: { + _0 = const 0_u32; + goto -> bb8; + } + + bb2: { + switchInt(copy (_3.1: u64)) -> [1: bb7, otherwise: bb1]; + } + + bb3: { + switchInt(copy (_3.1: u64)) -> [2: bb6, otherwise: bb1]; + } + + bb4: { + switchInt(copy (_3.1: u64)) -> [3: bb5, otherwise: bb1]; + } + + bb5: { + _0 = const 6_u32; + goto -> bb8; + } + + bb6: { + _0 = const 5_u32; + goto -> bb8; + } + + bb7: { + _0 = const 4_u32; + goto -> bb8; + } + + bb8: { + StorageDead(_3); + return; + } + } + diff --git a/tests/mir-opt/early_otherwise_branch.rs b/tests/mir-opt/early_otherwise_branch.rs index 47bd4be295b..382c38ceb3a 100644 --- a/tests/mir-opt/early_otherwise_branch.rs +++ b/tests/mir-opt/early_otherwise_branch.rs @@ -78,9 +78,57 @@ fn opt4(x: Option2<u32>, y: Option2<u32>) -> u32 { } } +// EMIT_MIR early_otherwise_branch.opt5.EarlyOtherwiseBranch.diff +fn opt5(x: u32, y: u32) -> u32 { + // CHECK-LABEL: fn opt5( + // CHECK: let mut [[CMP_LOCAL:_.*]]: bool; + // CHECK: bb0: { + // CHECK: [[CMP_LOCAL]] = Ne( + // CHECK: switchInt(move [[CMP_LOCAL]]) -> [ + // CHECK-NEXT: } + match (x, y) { + (1, 1) => 4, + (2, 2) => 5, + (3, 3) => 6, + _ => 0, + } +} + +// EMIT_MIR early_otherwise_branch.opt5_failed.EarlyOtherwiseBranch.diff +fn opt5_failed(x: u32, y: u32) -> u32 { + // CHECK-LABEL: fn opt5_failed( + // CHECK: bb0: { + // CHECK-NOT: Ne( + // CHECK: switchInt( + // CHECK-NEXT: } + match (x, y) { + (1, 1) => 4, + (2, 2) => 5, + (3, 2) => 6, + _ => 0, + } +} + +// EMIT_MIR early_otherwise_branch.opt5_failed_type.EarlyOtherwiseBranch.diff +fn opt5_failed_type(x: u32, y: u64) -> u32 { + // CHECK-LABEL: fn opt5_failed_type( + // CHECK: bb0: { + // CHECK-NOT: Ne( + // CHECK: switchInt( + // CHECK-NEXT: } + match (x, y) { + (1, 1) => 4, + (2, 2) => 5, + (3, 3) => 6, + _ => 0, + } +} + fn main() { opt1(None, Some(0)); opt2(None, Some(0)); opt3(Option2::None, Option2::Some(false)); opt4(Option2::None, Option2::Some(0)); + opt5(0, 0); + opt5_failed(0, 0); } diff --git a/tests/mir-opt/early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff new file mode 100644 index 00000000000..b6450e43b09 --- /dev/null +++ b/tests/mir-opt/early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff @@ -0,0 +1,126 @@ +- // MIR for `poll` before EarlyOtherwiseBranch ++ // MIR for `poll` after EarlyOtherwiseBranch + + fn poll(_1: Poll<Result<Option<Vec<u8>>, u8>>) -> () { + debug val => _1; + let mut _0: (); + let mut _2: isize; + let mut _3: isize; + let mut _4: isize; + let _5: std::vec::Vec<u8>; + let _6: u8; + let mut _7: bool; + let mut _8: bool; + let mut _9: isize; + scope 1 { + debug _trailers => _5; + } + scope 2 { + debug _err => _6; + } + + bb0: { + _7 = const false; + _8 = const false; + _7 = const true; + _8 = const true; + _4 = discriminant(_1); + switchInt(copy _4) -> [0: bb2, 1: bb4, otherwise: bb1]; + } + + bb1: { + unreachable; + } + + bb2: { + _3 = discriminant(((_1 as Ready).0: std::result::Result<std::option::Option<std::vec::Vec<u8>>, u8>)); + switchInt(copy _3) -> [0: bb3, 1: bb6, otherwise: bb1]; + } + + bb3: { + _2 = discriminant(((((_1 as Ready).0: std::result::Result<std::option::Option<std::vec::Vec<u8>>, u8>) as Ok).0: std::option::Option<std::vec::Vec<u8>>)); + switchInt(copy _2) -> [0: bb5, 1: bb7, otherwise: bb1]; + } + + bb4: { + _0 = const (); + goto -> bb17; + } + + bb5: { + _0 = const (); + goto -> bb17; + } + + bb6: { + StorageLive(_6); + _6 = copy ((((_1 as Ready).0: std::result::Result<std::option::Option<std::vec::Vec<u8>>, u8>) as Err).0: u8); + _0 = const (); + StorageDead(_6); + goto -> bb17; + } + + bb7: { + StorageLive(_5); + _5 = move ((((((_1 as Ready).0: std::result::Result<std::option::Option<std::vec::Vec<u8>>, u8>) as Ok).0: std::option::Option<std::vec::Vec<u8>>) as Some).0: std::vec::Vec<u8>); + _0 = const (); + drop(_5) -> [return: bb8, unwind: bb20]; + } + + bb8: { + StorageDead(_5); + goto -> bb17; + } + + bb9 (cleanup): { + resume; + } + + bb10: { + return; + } + + bb11: { + switchInt(copy _7) -> [0: bb12, otherwise: bb16]; + } + + bb12: { + _7 = const false; + goto -> bb10; + } + + bb13: { + switchInt(copy _8) -> [0: bb14, otherwise: bb15]; + } + + bb14: { + _8 = const false; + goto -> bb12; + } + + bb15: { + goto -> bb14; + } + + bb16: { + _9 = discriminant(((_1 as Ready).0: std::result::Result<std::option::Option<std::vec::Vec<u8>>, u8>)); + switchInt(move _9) -> [0: bb13, otherwise: bb12]; + } + + bb17: { + switchInt(copy _4) -> [0: bb11, otherwise: bb10]; + } + + bb18 (cleanup): { + switchInt(copy _3) -> [0: bb19, otherwise: bb9]; + } + + bb19 (cleanup): { + goto -> bb9; + } + + bb20 (cleanup): { + switchInt(copy _4) -> [0: bb18, otherwise: bb9]; + } + } + diff --git a/tests/mir-opt/early_otherwise_branch_unwind.rs b/tests/mir-opt/early_otherwise_branch_unwind.rs new file mode 100644 index 00000000000..cbccf11729a --- /dev/null +++ b/tests/mir-opt/early_otherwise_branch_unwind.rs @@ -0,0 +1,38 @@ +//@ test-mir-pass: EarlyOtherwiseBranch +//@ compile-flags: -Zmir-enable-passes=+GVN,+SimplifyLocals-after-value-numbering +//@ needs-unwind + +use std::task::Poll; + +// We find a matching pattern in the unwind path, +// and we need to create a cleanup BB for this case to meet the unwind invariants rule. +// NB: This transform is not happening currently. + +// EMIT_MIR early_otherwise_branch_unwind.unwind.EarlyOtherwiseBranch.diff +fn unwind<T>(val: Option<Option<Option<T>>>) { + // CHECK-LABEL: fn unwind( + // CHECK: drop({{.*}}) -> [return: bb{{.*}}, unwind: [[PARENT_UNWIND_BB:bb.*]]]; + // CHECK: [[PARENT_UNWIND_BB]] (cleanup): { + // CHECK-NEXT: switchInt + match val { + Some(Some(Some(_v))) => {} + Some(Some(None)) => {} + Some(None) => {} + None => {} + } +} + +// From https://github.com/rust-lang/rust/issues/130769#issuecomment-2370443086. +// EMIT_MIR early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff +pub fn poll(val: Poll<Result<Option<Vec<u8>>, u8>>) { + // CHECK-LABEL: fn poll( + // CHECK: drop({{.*}}) -> [return: bb{{.*}}, unwind: [[PARENT_UNWIND_BB:bb.*]]]; + // CHECK: [[PARENT_UNWIND_BB]] (cleanup): { + // CHECK-NEXT: switchInt + match val { + Poll::Ready(Ok(Some(_trailers))) => {} + Poll::Ready(Err(_err)) => {} + Poll::Ready(Ok(None)) => {} + Poll::Pending => {} + } +} diff --git a/tests/mir-opt/early_otherwise_branch_unwind.unwind.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_unwind.unwind.EarlyOtherwiseBranch.diff new file mode 100644 index 00000000000..2b2c007e082 --- /dev/null +++ b/tests/mir-opt/early_otherwise_branch_unwind.unwind.EarlyOtherwiseBranch.diff @@ -0,0 +1,119 @@ +- // MIR for `unwind` before EarlyOtherwiseBranch ++ // MIR for `unwind` after EarlyOtherwiseBranch + + fn unwind(_1: Option<Option<Option<T>>>) -> () { + debug val => _1; + let mut _0: (); + let mut _2: isize; + let mut _3: isize; + let mut _4: isize; + let _5: T; + let mut _6: bool; + let mut _7: bool; + let mut _8: isize; + scope 1 { + debug _v => _5; + } + + bb0: { + _6 = const false; + _7 = const false; + _6 = const true; + _7 = const true; + _4 = discriminant(_1); + switchInt(copy _4) -> [0: bb4, 1: bb2, otherwise: bb1]; + } + + bb1: { + unreachable; + } + + bb2: { + _3 = discriminant(((_1 as Some).0: std::option::Option<std::option::Option<T>>)); + switchInt(copy _3) -> [0: bb5, 1: bb3, otherwise: bb1]; + } + + bb3: { + _2 = discriminant(((((_1 as Some).0: std::option::Option<std::option::Option<T>>) as Some).0: std::option::Option<T>)); + switchInt(copy _2) -> [0: bb6, 1: bb7, otherwise: bb1]; + } + + bb4: { + _0 = const (); + goto -> bb17; + } + + bb5: { + _0 = const (); + goto -> bb17; + } + + bb6: { + _0 = const (); + goto -> bb17; + } + + bb7: { + StorageLive(_5); + _5 = move ((((((_1 as Some).0: std::option::Option<std::option::Option<T>>) as Some).0: std::option::Option<T>) as Some).0: T); + _0 = const (); + drop(_5) -> [return: bb8, unwind: bb20]; + } + + bb8: { + StorageDead(_5); + goto -> bb17; + } + + bb9 (cleanup): { + resume; + } + + bb10: { + return; + } + + bb11: { + switchInt(copy _6) -> [0: bb12, otherwise: bb16]; + } + + bb12: { + _6 = const false; + goto -> bb10; + } + + bb13: { + switchInt(copy _7) -> [0: bb14, otherwise: bb15]; + } + + bb14: { + _7 = const false; + goto -> bb12; + } + + bb15: { + goto -> bb14; + } + + bb16: { + _8 = discriminant(((_1 as Some).0: std::option::Option<std::option::Option<T>>)); + switchInt(move _8) -> [1: bb13, otherwise: bb12]; + } + + bb17: { + switchInt(copy _4) -> [1: bb11, otherwise: bb10]; + } + + bb18 (cleanup): { + switchInt(copy _3) -> [1: bb19, otherwise: bb9]; + } + + bb19 (cleanup): { + goto -> bb9; + } + + bb20 (cleanup): { + switchInt(copy _4) -> [1: bb18, otherwise: bb9]; + } + } + diff --git a/tests/mir-opt/set_no_discriminant.f.JumpThreading.diff b/tests/mir-opt/set_no_discriminant.f.JumpThreading.diff index 3d9852aef65..992b16fabf6 100644 --- a/tests/mir-opt/set_no_discriminant.f.JumpThreading.diff +++ b/tests/mir-opt/set_no_discriminant.f.JumpThreading.diff @@ -10,7 +10,8 @@ _2 = E::<char>::A; discriminant(_2) = 1; _1 = discriminant(_2); - switchInt(copy _1) -> [0: bb1, otherwise: bb2]; +- switchInt(copy _1) -> [0: bb1, otherwise: bb2]; ++ goto -> bb2; } bb1: { diff --git a/tests/mir-opt/set_no_discriminant.generic.JumpThreading.diff b/tests/mir-opt/set_no_discriminant.generic.JumpThreading.diff index c7af1638316..0600b751699 100644 --- a/tests/mir-opt/set_no_discriminant.generic.JumpThreading.diff +++ b/tests/mir-opt/set_no_discriminant.generic.JumpThreading.diff @@ -10,7 +10,8 @@ _2 = E::<T>::A; discriminant(_2) = 1; _1 = discriminant(_2); - switchInt(copy _1) -> [0: bb1, otherwise: bb2]; +- switchInt(copy _1) -> [0: bb1, otherwise: bb2]; ++ goto -> bb2; } bb1: { diff --git a/tests/mir-opt/set_no_discriminant.rs b/tests/mir-opt/set_no_discriminant.rs index 586e28ae426..c44575a4d61 100644 --- a/tests/mir-opt/set_no_discriminant.rs +++ b/tests/mir-opt/set_no_discriminant.rs @@ -1,5 +1,6 @@ // `SetDiscriminant` does not actually write anything if the chosen variant is the untagged variant -// of a niche encoding. Verify that we do not thread over this case. +// of a niche encoding. However, it is UB to call `SetDiscriminant` with the untagged variant if the +// value currently encodes a different variant. Verify that we do correctly thread in this case. //@ test-mir-pass: JumpThreading #![feature(custom_mir)] @@ -16,20 +17,21 @@ enum E<T> { #[custom_mir(dialect = "runtime")] pub fn f() -> usize { // CHECK-LABEL: fn f( - // CHECK-NOT: goto - // CHECK: switchInt( - // CHECK-NOT: goto + // CHECK-NOT: switchInt + // CHECK: goto + // CHECK-NOT: switchInt mir! { let a: isize; let e: E<char>; { e = E::A; - SetDiscriminant(e, 1); + SetDiscriminant(e, 1); // UB! a = Discriminant(e); match a { 0 => bb0, _ => bb1, } + } bb0 = { RET = 0; @@ -46,15 +48,15 @@ pub fn f() -> usize { #[custom_mir(dialect = "runtime")] pub fn generic<T>() -> usize { // CHECK-LABEL: fn generic( - // CHECK-NOT: goto - // CHECK: switchInt( - // CHECK-NOT: goto + // CHECK-NOT: switchInt + // CHECK: goto + // CHECK-NOT: switchInt mir! { let a: isize; let e: E<T>; { e = E::A; - SetDiscriminant(e, 1); + SetDiscriminant(e, 1); // UB! a = Discriminant(e); match a { 0 => bb0, @@ -72,6 +74,7 @@ pub fn generic<T>() -> usize { } } +// CHECK-LABEL: fn main( fn main() { assert_eq!(f(), 0); assert_eq!(generic::<char>(), 0); diff --git a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir new file mode 100644 index 00000000000..e9bbe30bd77 --- /dev/null +++ b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-abort.mir @@ -0,0 +1,159 @@ +// MIR for `method_1` after ElaborateDrops + +fn method_1(_1: Guard) -> () { + debug g => _1; + let mut _0: (); + let mut _2: std::result::Result<OtherDrop, ()>; + let mut _3: &Guard; + let _4: &Guard; + let _5: Guard; + let mut _6: &Guard; + let mut _7: isize; + let _8: OtherDrop; + let _9: (); + let mut _10: bool; + let mut _11: isize; + let mut _12: isize; + let mut _13: isize; + scope 1 { + debug other_drop => _8; + } + scope 2 { + debug err => _9; + } + + bb0: { + _10 = const false; + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); + StorageLive(_5); + StorageLive(_6); + _6 = &_1; + _5 = <Guard as Clone>::clone(move _6) -> [return: bb1, unwind: bb13]; + } + + bb1: { + StorageDead(_6); + _4 = &_5; + _3 = &(*_4); + _2 = method_2(move _3) -> [return: bb2, unwind: bb12]; + } + + bb2: { + _10 = const true; + StorageDead(_3); + PlaceMention(_2); + _7 = discriminant(_2); + switchInt(move _7) -> [0: bb5, 1: bb4, otherwise: bb3]; + } + + bb3: { + unreachable; + } + + bb4: { + StorageLive(_9); + _9 = copy ((_2 as Err).0: ()); + _0 = const (); + StorageDead(_9); + goto -> bb7; + } + + bb5: { + StorageLive(_8); + _8 = move ((_2 as Ok).0: OtherDrop); + _0 = const (); + drop(_8) -> [return: bb6, unwind: bb11]; + } + + bb6: { + StorageDead(_8); + goto -> bb7; + } + + bb7: { + backward incompatible drop(_2); + backward incompatible drop(_5); + goto -> bb21; + } + + bb8: { + drop(_5) -> [return: bb9, unwind: bb13]; + } + + bb9: { + StorageDead(_5); + StorageDead(_4); + _10 = const false; + StorageDead(_2); + drop(_1) -> [return: bb10, unwind: bb14]; + } + + bb10: { + return; + } + + bb11 (cleanup): { + goto -> bb25; + } + + bb12 (cleanup): { + drop(_5) -> [return: bb13, unwind terminate(cleanup)]; + } + + bb13 (cleanup): { + drop(_1) -> [return: bb14, unwind terminate(cleanup)]; + } + + bb14 (cleanup): { + resume; + } + + bb15: { + goto -> bb8; + } + + bb16 (cleanup): { + goto -> bb12; + } + + bb17 (cleanup): { + goto -> bb12; + } + + bb18: { + goto -> bb15; + } + + bb19: { + goto -> bb15; + } + + bb20 (cleanup): { + goto -> bb12; + } + + bb21: { + _11 = discriminant(_2); + switchInt(move _11) -> [0: bb18, otherwise: bb19]; + } + + bb22 (cleanup): { + _12 = discriminant(_2); + switchInt(move _12) -> [0: bb16, otherwise: bb20]; + } + + bb23 (cleanup): { + goto -> bb12; + } + + bb24 (cleanup): { + goto -> bb12; + } + + bb25 (cleanup): { + _13 = discriminant(_2); + switchInt(move _13) -> [0: bb23, otherwise: bb24]; + } +} diff --git a/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir new file mode 100644 index 00000000000..e9bbe30bd77 --- /dev/null +++ b/tests/mir-opt/tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.panic-unwind.mir @@ -0,0 +1,159 @@ +// MIR for `method_1` after ElaborateDrops + +fn method_1(_1: Guard) -> () { + debug g => _1; + let mut _0: (); + let mut _2: std::result::Result<OtherDrop, ()>; + let mut _3: &Guard; + let _4: &Guard; + let _5: Guard; + let mut _6: &Guard; + let mut _7: isize; + let _8: OtherDrop; + let _9: (); + let mut _10: bool; + let mut _11: isize; + let mut _12: isize; + let mut _13: isize; + scope 1 { + debug other_drop => _8; + } + scope 2 { + debug err => _9; + } + + bb0: { + _10 = const false; + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); + StorageLive(_5); + StorageLive(_6); + _6 = &_1; + _5 = <Guard as Clone>::clone(move _6) -> [return: bb1, unwind: bb13]; + } + + bb1: { + StorageDead(_6); + _4 = &_5; + _3 = &(*_4); + _2 = method_2(move _3) -> [return: bb2, unwind: bb12]; + } + + bb2: { + _10 = const true; + StorageDead(_3); + PlaceMention(_2); + _7 = discriminant(_2); + switchInt(move _7) -> [0: bb5, 1: bb4, otherwise: bb3]; + } + + bb3: { + unreachable; + } + + bb4: { + StorageLive(_9); + _9 = copy ((_2 as Err).0: ()); + _0 = const (); + StorageDead(_9); + goto -> bb7; + } + + bb5: { + StorageLive(_8); + _8 = move ((_2 as Ok).0: OtherDrop); + _0 = const (); + drop(_8) -> [return: bb6, unwind: bb11]; + } + + bb6: { + StorageDead(_8); + goto -> bb7; + } + + bb7: { + backward incompatible drop(_2); + backward incompatible drop(_5); + goto -> bb21; + } + + bb8: { + drop(_5) -> [return: bb9, unwind: bb13]; + } + + bb9: { + StorageDead(_5); + StorageDead(_4); + _10 = const false; + StorageDead(_2); + drop(_1) -> [return: bb10, unwind: bb14]; + } + + bb10: { + return; + } + + bb11 (cleanup): { + goto -> bb25; + } + + bb12 (cleanup): { + drop(_5) -> [return: bb13, unwind terminate(cleanup)]; + } + + bb13 (cleanup): { + drop(_1) -> [return: bb14, unwind terminate(cleanup)]; + } + + bb14 (cleanup): { + resume; + } + + bb15: { + goto -> bb8; + } + + bb16 (cleanup): { + goto -> bb12; + } + + bb17 (cleanup): { + goto -> bb12; + } + + bb18: { + goto -> bb15; + } + + bb19: { + goto -> bb15; + } + + bb20 (cleanup): { + goto -> bb12; + } + + bb21: { + _11 = discriminant(_2); + switchInt(move _11) -> [0: bb18, otherwise: bb19]; + } + + bb22 (cleanup): { + _12 = discriminant(_2); + switchInt(move _12) -> [0: bb16, otherwise: bb20]; + } + + bb23 (cleanup): { + goto -> bb12; + } + + bb24 (cleanup): { + goto -> bb12; + } + + bb25 (cleanup): { + _13 = discriminant(_2); + switchInt(move _13) -> [0: bb23, otherwise: bb24]; + } +} diff --git a/tests/mir-opt/tail_expr_drop_order_unwind.rs b/tests/mir-opt/tail_expr_drop_order_unwind.rs new file mode 100644 index 00000000000..065e08c3409 --- /dev/null +++ b/tests/mir-opt/tail_expr_drop_order_unwind.rs @@ -0,0 +1,36 @@ +// skip-filecheck +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY +// EMIT_MIR tail_expr_drop_order_unwind.method_1.ElaborateDrops.after.mir + +#![deny(tail_expr_drop_order)] + +use std::backtrace::Backtrace; + +#[derive(Clone)] +struct Guard; +impl Drop for Guard { + fn drop(&mut self) { + println!("Drop!"); + } +} + +#[derive(Clone)] +struct OtherDrop; +impl Drop for OtherDrop { + fn drop(&mut self) { + println!("Drop!"); + } +} + +fn method_1(g: Guard) { + match method_2(&g.clone()) { + Ok(other_drop) => { + // repro needs something else being dropped too. + } + Err(err) => {} + } +} + +fn method_2(_: &Guard) -> Result<OtherDrop, ()> { + panic!("Method 2 panics!"); +} diff --git a/tests/run-make/extern-fn-struct-passing-abi/test.rs b/tests/run-make/extern-fn-struct-passing-abi/test.rs index f898592fce9..928b1d4a931 100644 --- a/tests/run-make/extern-fn-struct-passing-abi/test.rs +++ b/tests/run-make/extern-fn-struct-passing-abi/test.rs @@ -126,7 +126,7 @@ extern "C" { fn main() { let s = Rect { a: 553, b: 554, c: 555, d: 556 }; - let t = BiggerRect { s: s, a: 27834, b: 7657 }; + let t = BiggerRect { s, a: 27834, b: 7657 }; let u = FloatRect { a: 3489, b: 3490, c: 8. }; let v = Huge { a: 5647, b: 5648, c: 5649, d: 5650, e: 5651 }; let w = Huge64 { a: 1234, b: 1335, c: 1436, d: 1537, e: 1638 }; diff --git a/tests/run-make/symbols-include-type-name/lib.rs b/tests/run-make/symbols-include-type-name/lib.rs index 37d44591767..7fd42c8b4b4 100644 --- a/tests/run-make/symbols-include-type-name/lib.rs +++ b/tests/run-make/symbols-include-type-name/lib.rs @@ -4,7 +4,7 @@ pub struct Def { impl Def { pub fn new(id: i32) -> Def { - Def { id: id } + Def { id } } } diff --git a/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr index 67540949f4d..e017b1f34a1 100644 --- a/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr +++ b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr @@ -1,8 +1,8 @@ error: unknown lint: `rustdoc::missing_doc_code_examples` - --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:4:1 + --> $DIR/feature-gate-rustdoc_missing_doc_code_examples.rs:4:10 | LL | #![allow(rustdoc::missing_doc_code_examples)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `rustdoc::missing_doc_code_examples` lint is unstable = note: see issue #101730 <https://github.com/rust-lang/rust/issues/101730> for more information diff --git a/tests/rustdoc/intra-doc/link-in-footnotes-132208.rs b/tests/rustdoc/intra-doc/link-in-footnotes-132208.rs new file mode 100644 index 00000000000..c9b97eafd2f --- /dev/null +++ b/tests/rustdoc/intra-doc/link-in-footnotes-132208.rs @@ -0,0 +1,24 @@ +// Rustdoc has multiple passes and if the footnote pass is run before the link replacer +// one, intra doc links are not generated inside footnote definitions. This test +// therefore ensures that intra-doc link are correctly generated inside footnote +// definitions. +// +// Regression test for <https://github.com/rust-lang/rust/issues/132208>. + +#![crate_name = "foo"] + +//@ has 'foo/index.html' +//@ has - '//*[@class="docblock"]//a[@href="struct.Bar.html"]' 'a' +//@ has - '//*[@class="docblock"]//*[@class="footnotes"]//a[@href="struct.Foo.html"]' 'b' + +//! [a]: crate::Bar +//! [b]: crate::Foo +//! +//! link in body: [a] +//! +//! see footnote[^1] +//! +//! [^1]: link in footnote: [b] + +pub struct Bar; +pub struct Foo; diff --git a/tests/ui/attr-bad-crate-attr.rs b/tests/ui/attr-bad-crate-attr.rs deleted file mode 100644 index b9100ecfb67..00000000000 --- a/tests/ui/attr-bad-crate-attr.rs +++ /dev/null @@ -1,4 +0,0 @@ -//@ error-pattern: expected item - -#![attr = "val"] -#[attr = "val"] // Unterminated diff --git a/tests/ui/attr-shebang.rs b/tests/ui/attr-shebang.rs deleted file mode 100644 index 67c371aeaac..00000000000 --- a/tests/ui/attr-shebang.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ run-pass - -#![allow(stable_features)] -#![feature(rust1)] -pub fn main() { } diff --git a/tests/ui/attributes/attr-bad-crate-attr.rs b/tests/ui/attributes/attr-bad-crate-attr.rs new file mode 100644 index 00000000000..9de0abca9a7 --- /dev/null +++ b/tests/ui/attributes/attr-bad-crate-attr.rs @@ -0,0 +1,9 @@ +//! Check that we permit a crate-level inner attribute but reject a dangling outer attribute which +//! does not have a following thing that it can target. +//! +//! See <https://doc.rust-lang.org/reference/attributes.html>. + +//@ error-pattern: expected item + +#![attr = "val"] +#[attr = "val"] // Unterminated diff --git a/tests/ui/attr-bad-crate-attr.stderr b/tests/ui/attributes/attr-bad-crate-attr.stderr index 9df991f71b3..69eabd32230 100644 --- a/tests/ui/attr-bad-crate-attr.stderr +++ b/tests/ui/attributes/attr-bad-crate-attr.stderr @@ -1,5 +1,5 @@ error: expected item after attributes - --> $DIR/attr-bad-crate-attr.rs:4:1 + --> $DIR/attr-bad-crate-attr.rs:9:1 | LL | #[attr = "val"] // Unterminated | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/attr-shebang.rs b/tests/ui/attributes/attr-shebang.rs new file mode 100644 index 00000000000..af446dc56e3 --- /dev/null +++ b/tests/ui/attributes/attr-shebang.rs @@ -0,0 +1,7 @@ +//! Check that we accept crate-level inner attributes with the `#![..]` shebang syntax. + +//@ check-pass + +#![allow(stable_features)] +#![feature(rust1)] +pub fn main() { } diff --git a/tests/ui/attr-usage-inline.rs b/tests/ui/attributes/inline/attr-usage-inline.rs index 674c12454cd..d8ca0fce163 100644 --- a/tests/ui/attr-usage-inline.rs +++ b/tests/ui/attributes/inline/attr-usage-inline.rs @@ -1,4 +1,5 @@ -#![allow(dead_code)] +//! Check that `#[inline]` attribute can only be applied to fn-like targets (e.g. function or +//! closure), and when misapplied to other targets an error is emitted. #[inline] fn f() {} diff --git a/tests/ui/attr-usage-inline.stderr b/tests/ui/attributes/inline/attr-usage-inline.stderr index 22a0bf47e20..2123438032c 100644 --- a/tests/ui/attr-usage-inline.stderr +++ b/tests/ui/attributes/inline/attr-usage-inline.stderr @@ -1,5 +1,5 @@ error[E0518]: attribute should be applied to function or closure - --> $DIR/attr-usage-inline.rs:6:1 + --> $DIR/attr-usage-inline.rs:7:1 | LL | #[inline] | ^^^^^^^^^ @@ -7,7 +7,7 @@ LL | struct S; | --------- not a function or closure error[E0518]: attribute should be applied to function or closure - --> $DIR/attr-usage-inline.rs:20:1 + --> $DIR/attr-usage-inline.rs:21:1 | LL | #[inline] | ^^^^^^^^^ not a function or closure diff --git a/tests/ui/borrowck/overwrite-anon-late-param-regions.rs b/tests/ui/borrowck/overwrite-anon-late-param-regions.rs new file mode 100644 index 00000000000..7b0f784068f --- /dev/null +++ b/tests/ui/borrowck/overwrite-anon-late-param-regions.rs @@ -0,0 +1,15 @@ +// A regression test for #124021. When liberating the late bound regions here +// we encounter multiple `LateBoundRegion::Anon`. These ended up resulting in +// distinct nll vars, but mapped to the same `RegionKind::LateParam`. This +// then caused an ICE when trying to fetch lazily computed information for the +// nll var of an overwritten liberated bound region. +#![feature(type_alias_impl_trait)] +type Opaque2<'a> = impl Sized + 'a; + +fn test2() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque2<'a>, Opaque2<'a>) { + |x| x + //~^ ERROR lifetime may not live long enough + //~| ERROR expected generic lifetime parameter, found `'a` +} + +fn main() {} diff --git a/tests/ui/borrowck/overwrite-anon-late-param-regions.stderr b/tests/ui/borrowck/overwrite-anon-late-param-regions.stderr new file mode 100644 index 00000000000..c5b7284271e --- /dev/null +++ b/tests/ui/borrowck/overwrite-anon-late-param-regions.stderr @@ -0,0 +1,21 @@ +error: lifetime may not live long enough + --> $DIR/overwrite-anon-late-param-regions.rs:10:9 + | +LL | |x| x + | - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | | + | has type `(&str, &'1 str)` + | has type `(&'2 str, &str)` + +error[E0792]: expected generic lifetime parameter, found `'a` + --> $DIR/overwrite-anon-late-param-regions.rs:10:5 + | +LL | type Opaque2<'a> = impl Sized + 'a; + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | |x| x + | ^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.rs b/tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.rs new file mode 100644 index 00000000000..d3ae863bee9 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.rs @@ -0,0 +1,19 @@ +//@ check-pass + +// Regression test for #133639. + +#![feature(with_negative_coherence)] +#![feature(min_specialization)] +#![feature(generic_const_exprs)] +//~^ WARNING the feature `generic_const_exprs` is incomplete + +#![crate_type = "lib"] +trait Trait {} +struct A<const B: bool>; + +trait C {} + +impl<const D: u32> Trait for E<D> where A<{ D <= 2 }>: C {} +struct E<const D: u32>; + +impl<const D: u32> Trait for E<D> where A<{ D <= 2 }>: C {} diff --git a/tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.stderr b/tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.stderr new file mode 100644 index 00000000000..f17b248d856 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.stderr @@ -0,0 +1,11 @@ +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/specialization-fuzzing-ice-133639.rs:7:12 + | +LL | #![feature(generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/const-generics/min_const_generics/param-env-eager-norm-dedup.rs b/tests/ui/const-generics/min_const_generics/param-env-eager-norm-dedup.rs index 9600b3875ba..2e97e3fe004 100644 --- a/tests/ui/const-generics/min_const_generics/param-env-eager-norm-dedup.rs +++ b/tests/ui/const-generics/min_const_generics/param-env-eager-norm-dedup.rs @@ -1,3 +1,6 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver //@ check-pass // This caused a regression in a crater run in #132325. diff --git a/tests/ui/coverage-attr/bad-attr-ice.rs b/tests/ui/coverage-attr/bad-attr-ice.rs index eaf9ec255dc..4b58989e3a2 100644 --- a/tests/ui/coverage-attr/bad-attr-ice.rs +++ b/tests/ui/coverage-attr/bad-attr-ice.rs @@ -1,5 +1,6 @@ //@ compile-flags: -Cinstrument-coverage //@ needs-profiler-runtime +//@ reference: attributes.coverage.syntax // Malformed `#[coverage(..)]` attributes should not cause an ICE when built // with `-Cinstrument-coverage`. diff --git a/tests/ui/coverage-attr/bad-attr-ice.stderr b/tests/ui/coverage-attr/bad-attr-ice.stderr index e48436ccdfe..dc88bb8d1a4 100644 --- a/tests/ui/coverage-attr/bad-attr-ice.stderr +++ b/tests/ui/coverage-attr/bad-attr-ice.stderr @@ -1,5 +1,5 @@ error: malformed `coverage` attribute input - --> $DIR/bad-attr-ice.rs:8:1 + --> $DIR/bad-attr-ice.rs:9:1 | LL | #[coverage] | ^^^^^^^^^^^ diff --git a/tests/ui/coverage-attr/bad-syntax.rs b/tests/ui/coverage-attr/bad-syntax.rs index fa2b25ceccd..ad6c5dc03f1 100644 --- a/tests/ui/coverage-attr/bad-syntax.rs +++ b/tests/ui/coverage-attr/bad-syntax.rs @@ -1,4 +1,6 @@ //@ edition: 2021 +//@ reference: attributes.coverage.syntax +//@ reference: attributes.coverage.duplicates // Tests the error messages produced (or not produced) by various unusual // uses of the `#[coverage(..)]` attribute. diff --git a/tests/ui/coverage-attr/bad-syntax.stderr b/tests/ui/coverage-attr/bad-syntax.stderr index e1833b57a72..072a8c4ca94 100644 --- a/tests/ui/coverage-attr/bad-syntax.stderr +++ b/tests/ui/coverage-attr/bad-syntax.stderr @@ -1,5 +1,5 @@ error: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:14:1 + --> $DIR/bad-syntax.rs:16:1 | LL | #[coverage] | ^^^^^^^^^^^ @@ -12,7 +12,7 @@ LL | #[coverage(on)] | ~~~~~~~~~~~~~~~ error: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:17:1 + --> $DIR/bad-syntax.rs:19:1 | LL | #[coverage = true] | ^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | #[coverage(on)] | ~~~~~~~~~~~~~~~ error: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:20:1 + --> $DIR/bad-syntax.rs:22:1 | LL | #[coverage()] | ^^^^^^^^^^^^^ @@ -38,7 +38,7 @@ LL | #[coverage(on)] | ~~~~~~~~~~~~~~~ error: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:23:1 + --> $DIR/bad-syntax.rs:25:1 | LL | #[coverage(off, off)] | ^^^^^^^^^^^^^^^^^^^^^ @@ -51,7 +51,7 @@ LL | #[coverage(on)] | ~~~~~~~~~~~~~~~ error: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:26:1 + --> $DIR/bad-syntax.rs:28:1 | LL | #[coverage(off, on)] | ^^^^^^^^^^^^^^^^^^^^ @@ -64,7 +64,7 @@ LL | #[coverage(on)] | ~~~~~~~~~~~~~~~ error: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:29:1 + --> $DIR/bad-syntax.rs:31:1 | LL | #[coverage(bogus)] | ^^^^^^^^^^^^^^^^^^ @@ -77,7 +77,7 @@ LL | #[coverage(on)] | ~~~~~~~~~~~~~~~ error: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:32:1 + --> $DIR/bad-syntax.rs:34:1 | LL | #[coverage(bogus, off)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -90,7 +90,7 @@ LL | #[coverage(on)] | ~~~~~~~~~~~~~~~ error: malformed `coverage` attribute input - --> $DIR/bad-syntax.rs:35:1 + --> $DIR/bad-syntax.rs:37:1 | LL | #[coverage(off, bogus)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL | #[coverage(on)] | ~~~~~~~~~~~~~~~ error: expected identifier, found `,` - --> $DIR/bad-syntax.rs:41:12 + --> $DIR/bad-syntax.rs:43:12 | LL | #[coverage(,off)] | ^ expected identifier @@ -115,25 +115,25 @@ LL + #[coverage(off)] | error: multiple `coverage` attributes - --> $DIR/bad-syntax.rs:6:1 + --> $DIR/bad-syntax.rs:8:1 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/bad-syntax.rs:7:1 + --> $DIR/bad-syntax.rs:9:1 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ error: multiple `coverage` attributes - --> $DIR/bad-syntax.rs:10:1 + --> $DIR/bad-syntax.rs:12:1 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/bad-syntax.rs:11:1 + --> $DIR/bad-syntax.rs:13:1 | LL | #[coverage(on)] | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/coverage-attr/name-value.rs b/tests/ui/coverage-attr/name-value.rs index 4d09b3796a7..cdb2f6490f2 100644 --- a/tests/ui/coverage-attr/name-value.rs +++ b/tests/ui/coverage-attr/name-value.rs @@ -1,4 +1,5 @@ //@ edition: 2021 +//@ reference: attributes.coverage.syntax // Demonstrates the diagnostics produced when using the syntax // `#[coverage = "off"]`, which should not be allowed. diff --git a/tests/ui/coverage-attr/name-value.stderr b/tests/ui/coverage-attr/name-value.stderr index 48581df52f7..38101764d6f 100644 --- a/tests/ui/coverage-attr/name-value.stderr +++ b/tests/ui/coverage-attr/name-value.stderr @@ -1,5 +1,5 @@ error: malformed `coverage` attribute input - --> $DIR/name-value.rs:10:1 + --> $DIR/name-value.rs:11:1 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -12,7 +12,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/name-value.rs:15:5 + --> $DIR/name-value.rs:16:5 | LL | #![coverage = "off"] | ^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | #![coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/name-value.rs:19:1 + --> $DIR/name-value.rs:20:1 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -38,7 +38,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/name-value.rs:27:5 + --> $DIR/name-value.rs:28:5 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -51,7 +51,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/name-value.rs:24:1 + --> $DIR/name-value.rs:25:1 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -64,7 +64,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/name-value.rs:37:5 + --> $DIR/name-value.rs:38:5 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -77,7 +77,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/name-value.rs:42:5 + --> $DIR/name-value.rs:43:5 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -90,7 +90,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/name-value.rs:33:1 + --> $DIR/name-value.rs:34:1 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/name-value.rs:51:5 + --> $DIR/name-value.rs:52:5 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -116,7 +116,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/name-value.rs:56:5 + --> $DIR/name-value.rs:57:5 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -129,7 +129,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/name-value.rs:48:1 + --> $DIR/name-value.rs:49:1 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -142,7 +142,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/name-value.rs:62:1 + --> $DIR/name-value.rs:63:1 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -155,7 +155,7 @@ LL | #[coverage(on)] | error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/name-value.rs:19:1 + --> $DIR/name-value.rs:20:1 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -164,7 +164,7 @@ LL | struct MyStruct; | ---------------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/name-value.rs:33:1 + --> $DIR/name-value.rs:34:1 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -177,7 +177,7 @@ LL | | } | |_- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/name-value.rs:37:5 + --> $DIR/name-value.rs:38:5 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -186,7 +186,7 @@ LL | const X: u32; | ------------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/name-value.rs:42:5 + --> $DIR/name-value.rs:43:5 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -195,7 +195,7 @@ LL | type T; | ------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/name-value.rs:27:5 + --> $DIR/name-value.rs:28:5 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -204,7 +204,7 @@ LL | const X: u32 = 7; | ----------------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/name-value.rs:51:5 + --> $DIR/name-value.rs:52:5 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ @@ -213,7 +213,7 @@ LL | const X: u32 = 8; | ----------------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/name-value.rs:56:5 + --> $DIR/name-value.rs:57:5 | LL | #[coverage = "off"] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/coverage-attr/no-coverage.rs b/tests/ui/coverage-attr/no-coverage.rs index 634eceee0f6..691456aee40 100644 --- a/tests/ui/coverage-attr/no-coverage.rs +++ b/tests/ui/coverage-attr/no-coverage.rs @@ -1,3 +1,5 @@ +//@ reference: attributes.coverage.allowed-positions + #![feature(extern_types)] #![feature(impl_trait_in_assoc_type)] #![warn(unused_attributes)] diff --git a/tests/ui/coverage-attr/no-coverage.stderr b/tests/ui/coverage-attr/no-coverage.stderr index 6f117c68f88..2421d2771f5 100644 --- a/tests/ui/coverage-attr/no-coverage.stderr +++ b/tests/ui/coverage-attr/no-coverage.stderr @@ -1,5 +1,5 @@ error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/no-coverage.rs:6:1 + --> $DIR/no-coverage.rs:8:1 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ @@ -12,7 +12,7 @@ LL | | } | |_- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/no-coverage.rs:38:5 + --> $DIR/no-coverage.rs:40:5 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ @@ -20,7 +20,7 @@ LL | let _ = (); | ----------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/no-coverage.rs:42:9 + --> $DIR/no-coverage.rs:44:9 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ @@ -28,7 +28,7 @@ LL | () => (), | -------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/no-coverage.rs:46:5 + --> $DIR/no-coverage.rs:48:5 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ @@ -36,7 +36,7 @@ LL | return (); | --------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/no-coverage.rs:8:5 + --> $DIR/no-coverage.rs:10:5 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ @@ -44,7 +44,7 @@ LL | const X: u32; | ------------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/no-coverage.rs:11:5 + --> $DIR/no-coverage.rs:13:5 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ @@ -52,7 +52,7 @@ LL | type T; | ------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/no-coverage.rs:21:5 + --> $DIR/no-coverage.rs:23:5 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ @@ -60,7 +60,7 @@ LL | type T = Self; | -------------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/no-coverage.rs:24:5 + --> $DIR/no-coverage.rs:26:5 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ @@ -68,7 +68,7 @@ LL | type U = impl Trait; | -------------------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/no-coverage.rs:29:5 + --> $DIR/no-coverage.rs:31:5 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ @@ -76,7 +76,7 @@ LL | static X: u32; | -------------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/no-coverage.rs:32:5 + --> $DIR/no-coverage.rs:34:5 | LL | #[coverage(off)] | ^^^^^^^^^^^^^^^^ @@ -84,7 +84,7 @@ LL | type T; | ------- not a function or closure error: unconstrained opaque type - --> $DIR/no-coverage.rs:25:14 + --> $DIR/no-coverage.rs:27:14 | LL | type U = impl Trait; | ^^^^^^^^^^ diff --git a/tests/ui/coverage-attr/subword.rs b/tests/ui/coverage-attr/subword.rs index 00c8dea3d37..ff5b750e70e 100644 --- a/tests/ui/coverage-attr/subword.rs +++ b/tests/ui/coverage-attr/subword.rs @@ -1,4 +1,5 @@ //@ edition: 2021 +//@ reference: attributes.coverage.syntax // Check that yes/no in `#[coverage(yes)]` and `#[coverage(no)]` must be bare // words, not part of a more complicated substructure. diff --git a/tests/ui/coverage-attr/subword.stderr b/tests/ui/coverage-attr/subword.stderr index 60e58c015d8..3a106898f8b 100644 --- a/tests/ui/coverage-attr/subword.stderr +++ b/tests/ui/coverage-attr/subword.stderr @@ -1,5 +1,5 @@ error: malformed `coverage` attribute input - --> $DIR/subword.rs:6:1 + --> $DIR/subword.rs:7:1 | LL | #[coverage(yes(milord))] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -12,7 +12,7 @@ LL | #[coverage(on)] | ~~~~~~~~~~~~~~~ error: malformed `coverage` attribute input - --> $DIR/subword.rs:9:1 + --> $DIR/subword.rs:10:1 | LL | #[coverage(no(milord))] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | #[coverage(on)] | ~~~~~~~~~~~~~~~ error: malformed `coverage` attribute input - --> $DIR/subword.rs:12:1 + --> $DIR/subword.rs:13:1 | LL | #[coverage(yes = "milord")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -38,7 +38,7 @@ LL | #[coverage(on)] | ~~~~~~~~~~~~~~~ error: malformed `coverage` attribute input - --> $DIR/subword.rs:15:1 + --> $DIR/subword.rs:16:1 | LL | #[coverage(no = "milord")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/coverage-attr/word-only.rs b/tests/ui/coverage-attr/word-only.rs index 6d9503593f0..496268fd8c8 100644 --- a/tests/ui/coverage-attr/word-only.rs +++ b/tests/ui/coverage-attr/word-only.rs @@ -1,4 +1,5 @@ //@ edition: 2021 +//@ reference: attributes.coverage.syntax // Demonstrates the diagnostics produced when using the syntax `#[coverage]`, // which should not be allowed. diff --git a/tests/ui/coverage-attr/word-only.stderr b/tests/ui/coverage-attr/word-only.stderr index de025cad96f..154ea61f3a3 100644 --- a/tests/ui/coverage-attr/word-only.stderr +++ b/tests/ui/coverage-attr/word-only.stderr @@ -1,5 +1,5 @@ error: malformed `coverage` attribute input - --> $DIR/word-only.rs:10:1 + --> $DIR/word-only.rs:11:1 | LL | #[coverage] | ^^^^^^^^^^^ @@ -12,7 +12,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/word-only.rs:15:5 + --> $DIR/word-only.rs:16:5 | LL | #![coverage] | ^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | #![coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/word-only.rs:19:1 + --> $DIR/word-only.rs:20:1 | LL | #[coverage] | ^^^^^^^^^^^ @@ -38,7 +38,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/word-only.rs:27:5 + --> $DIR/word-only.rs:28:5 | LL | #[coverage] | ^^^^^^^^^^^ @@ -51,7 +51,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/word-only.rs:24:1 + --> $DIR/word-only.rs:25:1 | LL | #[coverage] | ^^^^^^^^^^^ @@ -64,7 +64,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/word-only.rs:37:5 + --> $DIR/word-only.rs:38:5 | LL | #[coverage] | ^^^^^^^^^^^ @@ -77,7 +77,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/word-only.rs:42:5 + --> $DIR/word-only.rs:43:5 | LL | #[coverage] | ^^^^^^^^^^^ @@ -90,7 +90,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/word-only.rs:33:1 + --> $DIR/word-only.rs:34:1 | LL | #[coverage] | ^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/word-only.rs:51:5 + --> $DIR/word-only.rs:52:5 | LL | #[coverage] | ^^^^^^^^^^^ @@ -116,7 +116,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/word-only.rs:56:5 + --> $DIR/word-only.rs:57:5 | LL | #[coverage] | ^^^^^^^^^^^ @@ -129,7 +129,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/word-only.rs:48:1 + --> $DIR/word-only.rs:49:1 | LL | #[coverage] | ^^^^^^^^^^^ @@ -142,7 +142,7 @@ LL | #[coverage(on)] | error: malformed `coverage` attribute input - --> $DIR/word-only.rs:62:1 + --> $DIR/word-only.rs:63:1 | LL | #[coverage] | ^^^^^^^^^^^ @@ -155,7 +155,7 @@ LL | #[coverage(on)] | error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/word-only.rs:19:1 + --> $DIR/word-only.rs:20:1 | LL | #[coverage] | ^^^^^^^^^^^ @@ -164,7 +164,7 @@ LL | struct MyStruct; | ---------------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/word-only.rs:33:1 + --> $DIR/word-only.rs:34:1 | LL | #[coverage] | ^^^^^^^^^^^ @@ -177,7 +177,7 @@ LL | | } | |_- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/word-only.rs:37:5 + --> $DIR/word-only.rs:38:5 | LL | #[coverage] | ^^^^^^^^^^^ @@ -186,7 +186,7 @@ LL | const X: u32; | ------------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/word-only.rs:42:5 + --> $DIR/word-only.rs:43:5 | LL | #[coverage] | ^^^^^^^^^^^ @@ -195,7 +195,7 @@ LL | type T; | ------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/word-only.rs:27:5 + --> $DIR/word-only.rs:28:5 | LL | #[coverage] | ^^^^^^^^^^^ @@ -204,7 +204,7 @@ LL | const X: u32 = 7; | ----------------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/word-only.rs:51:5 + --> $DIR/word-only.rs:52:5 | LL | #[coverage] | ^^^^^^^^^^^ @@ -213,7 +213,7 @@ LL | const X: u32 = 8; | ----------------- not a function or closure error[E0788]: attribute should be applied to a function definition or closure - --> $DIR/word-only.rs:56:5 + --> $DIR/word-only.rs:57:5 | LL | #[coverage] | ^^^^^^^^^^^ 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 5d0c1826411..28e7975c7a2 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:57:15 + --> $DIR/as_expression.rs:55: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 1e1eae852f9..1b76669ccb0 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:57:21 + --> $DIR/as_expression.rs:55: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:48:12 + --> $DIR/as_expression.rs:46:12 | LL | fn check<T>(&self, _: T) -> <T as AsExpression<<Self as Expression>::SqlType>>::Expression | ----- required by a bound in this associated function @@ -17,7 +17,7 @@ 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:57:15 + --> $DIR/as_expression.rs:55:15 | LL | SelectInt.check("bar"); | ^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str` @@ -27,7 +27,7 @@ LL | SelectInt.check("bar"); = help: for that trait implementation, expected `Text`, found `Integer` error[E0271]: type mismatch resolving `<SelectInt as Expression>::SqlType == Text` - --> $DIR/as_expression.rs:57:5 + --> $DIR/as_expression.rs:55:5 | LL | SelectInt.check("bar"); | ^^^^^^^^^^^^^^^^^^^^^^ expected `Text`, found `Integer` 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 37b4429f694..583b3c4675a 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs @@ -2,8 +2,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(do_not_recommend)] - pub trait Expression { type SqlType; } diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.rs b/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.rs deleted file mode 100644 index 5548fa2f52e..00000000000 --- a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![allow(unknown_or_malformed_diagnostic_attributes)] - -trait Foo {} - -#[diagnostic::do_not_recommend] -impl<A> Foo for (A,) {} - -#[diagnostic::do_not_recommend] -impl<A, B> Foo for (A, B) {} - -#[diagnostic::do_not_recommend] -impl<A, B, C> Foo for (A, B, C) {} - -impl Foo for i32 {} - -fn check(a: impl Foo) {} - -fn main() { - check(()); - //~^ ERROR the trait bound `(): Foo` is not satisfied -} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr deleted file mode 100644 index be17476524a..00000000000 --- a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0277]: the trait bound `(): Foo` is not satisfied - --> $DIR/do_not_apply_attribute_without_feature_flag.rs:19:11 - | -LL | check(()); - | ----- ^^ the trait `Foo` is not implemented for `()` - | | - | required by a bound introduced by this call - | - = help: the following other types implement trait `Foo`: - (A, B) - (A, B, C) - (A,) -note: required by a bound in `check` - --> $DIR/do_not_apply_attribute_without_feature_flag.rs:16:18 - | -LL | fn check(a: impl Foo) {} - | ^^^ required by this bound in `check` -help: use a unary tuple instead - | -LL | check(((),)); - | + ++ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.current.stderr new file mode 100644 index 00000000000..47597a5d405 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.current.stderr @@ -0,0 +1,22 @@ +warning: `#[diagnostic::do_not_recommend]` does not expect any arguments + --> $DIR/does_not_acccept_args.rs:10:1 + | +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 + | +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 + | +LL | #[diagnostic::do_not_recommend(not_accepted(42))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 3 warnings emitted + 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 new file mode 100644 index 00000000000..47597a5d405 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.next.stderr @@ -0,0 +1,22 @@ +warning: `#[diagnostic::do_not_recommend]` does not expect any arguments + --> $DIR/does_not_acccept_args.rs:10:1 + | +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 + | +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 + | +LL | #[diagnostic::do_not_recommend(not_accepted(42))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 3 warnings emitted + 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 new file mode 100644 index 00000000000..eeff5e2e6e8 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.rs @@ -0,0 +1,22 @@ +//@ check-pass +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +trait Foo {} +trait Bar {} +trait Baz {} + +#[diagnostic::do_not_recommend(not_accepted)] +//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments +impl<T> Foo for T where T: Send {} + +#[diagnostic::do_not_recommend(not_accepted = "foo")] +//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments +impl<T> Bar for T where T: Send {} + +#[diagnostic::do_not_recommend(not_accepted(42))] +//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments +impl<T> Baz for T where T: Send {} + +fn main() {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.rs b/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.rs deleted file mode 100644 index 5a26d28188c..00000000000 --- a/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(do_not_recommend)] - -pub trait Foo {} - -impl Foo for i32 {} - -pub trait Bar {} - -#[diagnostic::do_not_recommend] -impl<T: Foo> Bar for T {} - -fn stuff<T: Bar>(_: T) {} - -fn main() { - stuff(1u8); - //~^ the trait bound `u8: Bar` is not satisfied -} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.stderr deleted file mode 100644 index 3951231fa2e..00000000000 --- a/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0277]: the trait bound `u8: Bar` is not satisfied - --> $DIR/feature-gate-do_not_recommend.rs:15:11 - | -LL | stuff(1u8); - | ^^^ the trait `Bar` is not implemented for `u8` - | -note: required by a bound in `stuff` - --> $DIR/feature-gate-do_not_recommend.rs:12:13 - | -LL | fn stuff<T: Bar>(_: T) {} - | ^^^ required by this bound in `stuff` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr index c83fd46db58..ee6ebabadd9 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.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:4:1 + --> $DIR/incorrect-locations.rs:6:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,46 +7,52 @@ 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:8:1 + --> $DIR/incorrect-locations.rs:10:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:12:1 + --> $DIR/incorrect-locations.rs:14:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:16:1 + --> $DIR/incorrect-locations.rs:18:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:20:1 + --> $DIR/incorrect-locations.rs:22:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:24:1 + --> $DIR/incorrect-locations.rs:26:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:28:1 + --> $DIR/incorrect-locations.rs:30:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:32:1 + --> $DIR/incorrect-locations.rs:34:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: 8 warnings emitted +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:38:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 9 warnings emitted 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 new file mode 100644 index 00000000000..ee6ebabadd9 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr @@ -0,0 +1,58 @@ +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:6:1 + | +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 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:14:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:18:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:22:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:26:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:30:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:34:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:38:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 9 warnings emitted + 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 400ef83873e..1cf436aa2af 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs @@ -1,5 +1,7 @@ //@ check-pass -#![feature(do_not_recommend)] +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver #[diagnostic::do_not_recommend] //~^WARN `#[diagnostic::do_not_recommend]` can only be placed @@ -19,6 +21,10 @@ enum Enum {} #[diagnostic::do_not_recommend] //~^WARN `#[diagnostic::do_not_recommend]` can only be placed +impl Enum {} + +#[diagnostic::do_not_recommend] +//~^WARN `#[diagnostic::do_not_recommend]` can only be placed extern "C" {} #[diagnostic::do_not_recommend] diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr new file mode 100644 index 00000000000..b14c68d6897 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `(): Root` is not satisfied + --> $DIR/nested.rs:21:18 + | +LL | needs_root::<()>(); + | ^^ the trait `Root` is not implemented for `()` + | +note: required by a bound in `needs_root` + --> $DIR/nested.rs:18:18 + | +LL | fn needs_root<T: Root>() {} + | ^^^^ required by this bound in `needs_root` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr new file mode 100644 index 00000000000..b14c68d6897 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `(): Root` is not satisfied + --> $DIR/nested.rs:21:18 + | +LL | needs_root::<()>(); + | ^^ the trait `Root` is not implemented for `()` + | +note: required by a bound in `needs_root` + --> $DIR/nested.rs:18:18 + | +LL | fn needs_root<T: Root>() {} + | ^^^^ required by this bound in `needs_root` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/nested.rs b/tests/ui/diagnostic_namespace/do_not_recommend/nested.rs new file mode 100644 index 00000000000..6534157d1fb --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/nested.rs @@ -0,0 +1,23 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +trait Root {} +trait DontRecommend {} +trait Other {} +trait Child {} + +#[diagnostic::do_not_recommend] +impl<T> Root for T where T: DontRecommend {} + +impl<T> DontRecommend for T where T: Other {} + +#[diagnostic::do_not_recommend] +impl<T> Other for T where T: Child {} + +fn needs_root<T: Root>() {} + +fn main() { + needs_root::<()>(); + //~^ ERROR the trait bound `(): Root` is not satisfied +} 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 729cb5694e2..884b13c17b8 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:17:17 + --> $DIR/simple.rs:15:17 | LL | needs_foo::<*mut ()>(); | ^^^^^^^ the trait `Foo` is not implemented for `*mut ()` | note: required by a bound in `needs_foo` - --> $DIR/simple.rs:12:17 + --> $DIR/simple.rs:10: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 729cb5694e2..884b13c17b8 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:17:17 + --> $DIR/simple.rs:15:17 | LL | needs_foo::<*mut ()>(); | ^^^^^^^ the trait `Foo` is not implemented for `*mut ()` | note: required by a bound in `needs_foo` - --> $DIR/simple.rs:12:17 + --> $DIR/simple.rs:10: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 780649b009c..6bca2b724d2 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs @@ -2,8 +2,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(do_not_recommend)] - trait Foo {} #[diagnostic::do_not_recommend] 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 41a10a61e1d..d8605806395 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:19:18 + --> $DIR/stacked.rs:17:18 | LL | needs_root::<()>(); | ^^ the trait `Root` is not implemented for `()` | note: required by a bound in `needs_root` - --> $DIR/stacked.rs:16:18 + --> $DIR/stacked.rs:14: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 41a10a61e1d..d8605806395 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:19:18 + --> $DIR/stacked.rs:17:18 | LL | needs_root::<()>(); | ^^ the trait `Root` is not implemented for `()` | note: required by a bound in `needs_root` - --> $DIR/stacked.rs:16:18 + --> $DIR/stacked.rs:14: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 fc355bdc4e2..842e04b9d90 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/stacked.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/stacked.rs @@ -2,8 +2,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(do_not_recommend)] - trait Root {} trait DontRecommend {} trait Other {} 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 ca9a6ebc1c4..95ccbb92a89 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:23:11 + --> $DIR/supress_suggestions_in_help.rs:21: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:20:18 + --> $DIR/supress_suggestions_in_help.rs:18: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 ca9a6ebc1c4..95ccbb92a89 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:23:11 + --> $DIR/supress_suggestions_in_help.rs:21: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:20:18 + --> $DIR/supress_suggestions_in_help.rs:18: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 ef6f255c351..2c7c1516123 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 @@ -2,8 +2,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(do_not_recommend)] - trait Foo {} #[diagnostic::do_not_recommend] 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 bcede8a255f..b53febbb71a 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:25:14 + --> $DIR/type_mismatch.rs:23:14 | LL | verify::<u8>(); | ^^ the trait `TheImportantOne` is not implemented for `u8` | note: required by a bound in `verify` - --> $DIR/type_mismatch.rs:22:14 + --> $DIR/type_mismatch.rs:20: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 bcede8a255f..b53febbb71a 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:25:14 + --> $DIR/type_mismatch.rs:23:14 | LL | verify::<u8>(); | ^^ the trait `TheImportantOne` is not implemented for `u8` | note: required by a bound in `verify` - --> $DIR/type_mismatch.rs:22:14 + --> $DIR/type_mismatch.rs:20: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 d6721ccc848..7f30fdb06c7 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.rs @@ -2,8 +2,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(do_not_recommend)] - #[diagnostic::on_unimplemented(message = "Very important message!")] trait TheImportantOne {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.rs b/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.rs deleted file mode 100644 index ccc687aa5b3..00000000000 --- a/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![deny(unknown_or_malformed_diagnostic_attributes)] -trait Foo {} - -#[diagnostic::do_not_recommend] -//~^ ERROR unknown diagnostic attribute [unknown_or_malformed_diagnostic_attributes] -impl Foo for i32 {} - -fn main() {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.stderr deleted file mode 100644 index d8332229d4f..00000000000 --- a/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: unknown diagnostic attribute - --> $DIR/unstable-feature.rs:4:15 - | -LL | #[diagnostic::do_not_recommend] - | ^^^^^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/unstable-feature.rs:1:9 - | -LL | #![deny(unknown_or_malformed_diagnostic_attributes)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - 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 new file mode 100644 index 00000000000..a8429ff60f8 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.current.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/with_lifetime.rs:17:5 + | +LL | fn foo<'a>(a: &'a ()) { + | -- lifetime `'a` defined here +LL | needs_root::<&'a ()>(); + | ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to 1 previous error + 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 new file mode 100644 index 00000000000..a8429ff60f8 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.next.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/with_lifetime.rs:17:5 + | +LL | fn foo<'a>(a: &'a ()) { + | -- lifetime `'a` defined here +LL | needs_root::<&'a ()>(); + | ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to 1 previous error + diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs new file mode 100644 index 00000000000..6a67d83d5fe --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs @@ -0,0 +1,23 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +trait Root {} +trait DontRecommend {} + +impl<T> Root for T where T: DontRecommend {} + +// this has no effect yet for resolving the trait error below +#[diagnostic::do_not_recommend] +impl<T> DontRecommend for &'static T {} + +fn needs_root<T: Root>() {} + +fn foo<'a>(a: &'a ()) { + needs_root::<&'a ()>(); + //~^ ERROR lifetime may not live long enough +} + +fn main() { + foo(&()); +} diff --git a/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr b/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr index 8a43d615963..0c7e68a599c 100644 --- a/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr +++ b/tests/ui/feature-gates/feature-gate-multiple_supertrait_upcastable.stderr @@ -1,8 +1,8 @@ warning: unknown lint: `multiple_supertrait_upcastable` - --> $DIR/feature-gate-multiple_supertrait_upcastable.rs:3:1 + --> $DIR/feature-gate-multiple_supertrait_upcastable.rs:3:9 | LL | #![deny(multiple_supertrait_upcastable)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `multiple_supertrait_upcastable` lint is unstable = help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable @@ -10,10 +10,10 @@ LL | #![deny(multiple_supertrait_upcastable)] = note: `#[warn(unknown_lints)]` on by default warning: unknown lint: `multiple_supertrait_upcastable` - --> $DIR/feature-gate-multiple_supertrait_upcastable.rs:5:1 + --> $DIR/feature-gate-multiple_supertrait_upcastable.rs:5:9 | LL | #![warn(multiple_supertrait_upcastable)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `multiple_supertrait_upcastable` lint is unstable = help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable diff --git a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr index 41764c8e018..7a453521590 100644 --- a/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr +++ b/tests/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr @@ -1,8 +1,8 @@ warning: unknown lint: `non_exhaustive_omitted_patterns` - --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:3:1 + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:3:9 | LL | #![deny(non_exhaustive_omitted_patterns)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `non_exhaustive_omitted_patterns` lint is unstable = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information @@ -11,10 +11,10 @@ LL | #![deny(non_exhaustive_omitted_patterns)] = note: `#[warn(unknown_lints)]` on by default warning: unknown lint: `non_exhaustive_omitted_patterns` - --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:5:1 + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:5:10 | LL | #![allow(non_exhaustive_omitted_patterns)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `non_exhaustive_omitted_patterns` lint is unstable = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information @@ -22,10 +22,10 @@ LL | #![allow(non_exhaustive_omitted_patterns)] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date warning: unknown lint: `non_exhaustive_omitted_patterns` - --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5 + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:13 | LL | #[allow(non_exhaustive_omitted_patterns)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `non_exhaustive_omitted_patterns` lint is unstable = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information @@ -33,10 +33,10 @@ LL | #[allow(non_exhaustive_omitted_patterns)] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date warning: unknown lint: `non_exhaustive_omitted_patterns` - --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:5 + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:15:13 | LL | #[allow(non_exhaustive_omitted_patterns)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `non_exhaustive_omitted_patterns` lint is unstable = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information @@ -45,10 +45,10 @@ LL | #[allow(non_exhaustive_omitted_patterns)] = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` warning: unknown lint: `non_exhaustive_omitted_patterns` - --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:24:5 + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:24:12 | LL | #[warn(non_exhaustive_omitted_patterns)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `non_exhaustive_omitted_patterns` lint is unstable = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information @@ -56,10 +56,10 @@ LL | #[warn(non_exhaustive_omitted_patterns)] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date warning: unknown lint: `non_exhaustive_omitted_patterns` - --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:24:5 + --> $DIR/feature-gate-non_exhaustive_omitted_patterns_lint.rs:24:12 | LL | #[warn(non_exhaustive_omitted_patterns)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `non_exhaustive_omitted_patterns` lint is unstable = note: see issue #89554 <https://github.com/rust-lang/rust/issues/89554> for more information diff --git a/tests/ui/feature-gates/feature-gate-strict_provenance_lints.stderr b/tests/ui/feature-gates/feature-gate-strict_provenance_lints.stderr index 15428cbd4be..3f3b49bc606 100644 --- a/tests/ui/feature-gates/feature-gate-strict_provenance_lints.stderr +++ b/tests/ui/feature-gates/feature-gate-strict_provenance_lints.stderr @@ -1,8 +1,8 @@ warning: unknown lint: `fuzzy_provenance_casts` - --> $DIR/feature-gate-strict_provenance_lints.rs:3:1 + --> $DIR/feature-gate-strict_provenance_lints.rs:3:9 | LL | #![deny(fuzzy_provenance_casts)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: the `fuzzy_provenance_casts` lint is unstable = note: see issue #130351 <https://github.com/rust-lang/rust/issues/130351> for more information @@ -11,10 +11,10 @@ LL | #![deny(fuzzy_provenance_casts)] = note: `#[warn(unknown_lints)]` on by default warning: unknown lint: `lossy_provenance_casts` - --> $DIR/feature-gate-strict_provenance_lints.rs:5:1 + --> $DIR/feature-gate-strict_provenance_lints.rs:5:9 | LL | #![deny(lossy_provenance_casts)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: the `lossy_provenance_casts` lint is unstable = note: see issue #130351 <https://github.com/rust-lang/rust/issues/130351> for more information diff --git a/tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr b/tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr index 5dc303da742..e460688e5fc 100644 --- a/tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr +++ b/tests/ui/feature-gates/feature-gate-test_unstable_lint.stderr @@ -1,8 +1,8 @@ warning: unknown lint: `test_unstable_lint` - --> $DIR/feature-gate-test_unstable_lint.rs:4:1 + --> $DIR/feature-gate-test_unstable_lint.rs:4:10 | LL | #![allow(test_unstable_lint)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ | = note: the `test_unstable_lint` lint is unstable = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable diff --git a/tests/ui/feature-gates/feature-gate-unqualified-local-imports.stderr b/tests/ui/feature-gates/feature-gate-unqualified-local-imports.stderr index 22cd3bf4c6f..bc8edd847cc 100644 --- a/tests/ui/feature-gates/feature-gate-unqualified-local-imports.stderr +++ b/tests/ui/feature-gates/feature-gate-unqualified-local-imports.stderr @@ -1,8 +1,8 @@ warning: unknown lint: `unqualified_local_imports` - --> $DIR/feature-gate-unqualified-local-imports.rs:3:1 + --> $DIR/feature-gate-unqualified-local-imports.rs:3:10 | LL | #![allow(unqualified_local_imports)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the `unqualified_local_imports` lint is unstable = help: add `#![feature(unqualified_local_imports)]` to the crate attributes to enable diff --git a/tests/ui/function-pointer/signature-mismatch.rs b/tests/ui/function-pointer/signature-mismatch.rs new file mode 100644 index 00000000000..f269e9bf84b --- /dev/null +++ b/tests/ui/function-pointer/signature-mismatch.rs @@ -0,0 +1,6 @@ +//! This test used to hit an assertion instead of erroring and bailing out. + +fn main() { + let _ = [std::ops::Add::add, std::ops::Mul::mul, std::ops::Mul::mul as fn(_, &_)]; + //~^ ERROR: mismatched types +} diff --git a/tests/ui/function-pointer/signature-mismatch.stderr b/tests/ui/function-pointer/signature-mismatch.stderr new file mode 100644 index 00000000000..f02a576e511 --- /dev/null +++ b/tests/ui/function-pointer/signature-mismatch.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/signature-mismatch.rs:4:54 + | +LL | let _ = [std::ops::Add::add, std::ops::Mul::mul, std::ops::Mul::mul as fn(_, &_)]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected fn pointer `fn(_, _) -> _` + found fn pointer `for<'a> fn(_, &'a _) -> ()` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.next.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.next.stderr deleted file mode 100644 index 9e04e90a98a..00000000000 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.next.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0284]: type annotations needed: cannot satisfy `Foo == _` - --> $DIR/norm-before-method-resolution-opaque-type.rs:15:19 - | -LL | fn weird_bound<X>(x: &<X as Trait<'static>>::Out<Foo>) -> X - | ^ cannot satisfy `Foo == _` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr index 479f5984355..57cbe169118 100644 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.old.stderr @@ -1,12 +1,12 @@ error: item does not constrain `Foo::{opaque#0}`, but has it in its signature - --> $DIR/norm-before-method-resolution-opaque-type.rs:15:4 + --> $DIR/norm-before-method-resolution-opaque-type.rs:16:4 | LL | fn weird_bound<X>(x: &<X as Trait<'static>>::Out<Foo>) -> X | ^^^^^^^^^^^ | = note: consider moving the opaque type's declaration and defining uses into a separate module note: this opaque type is in the signature - --> $DIR/norm-before-method-resolution-opaque-type.rs:13:12 + --> $DIR/norm-before-method-resolution-opaque-type.rs:14:12 | LL | type Foo = impl Sized; | ^^^^^^^^^^ diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs index ffbfc622bb0..43207d89276 100644 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs @@ -1,5 +1,6 @@ //@ revisions: old next //@[next] compile-flags: -Znext-solver +//@[next] check-pass #![feature(type_alias_impl_trait)] trait Trait<'a> { @@ -14,7 +15,6 @@ type Foo = impl Sized; fn weird_bound<X>(x: &<X as Trait<'static>>::Out<Foo>) -> X //[old]~^ ERROR: item does not constrain -//[next]~^^ ERROR: cannot satisfy `Foo == _` where for<'a> X: Trait<'a>, for<'a> <X as Trait<'a>>::Out<()>: Copy, diff --git a/tests/ui/lint/must_not_suspend/gated.stderr b/tests/ui/lint/must_not_suspend/gated.stderr index aff1b6a2ac4..8ec3202c5af 100644 --- a/tests/ui/lint/must_not_suspend/gated.stderr +++ b/tests/ui/lint/must_not_suspend/gated.stderr @@ -1,8 +1,8 @@ warning: unknown lint: `must_not_suspend` - --> $DIR/gated.rs:4:1 + --> $DIR/gated.rs:4:9 | LL | #![deny(must_not_suspend)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ | = note: the `must_not_suspend` lint is unstable = note: see issue #83310 <https://github.com/rust-lang/rust/issues/83310> for more information diff --git a/tests/ui/associated-path-shl.rs b/tests/ui/parser/associated-path-shl.rs index 20a6fd83faa..20a6fd83faa 100644 --- a/tests/ui/associated-path-shl.rs +++ b/tests/ui/parser/associated-path-shl.rs diff --git a/tests/ui/associated-path-shl.stderr b/tests/ui/parser/associated-path-shl.stderr index 71ee93f4835..71ee93f4835 100644 --- a/tests/ui/associated-path-shl.stderr +++ b/tests/ui/parser/associated-path-shl.stderr 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 086671e69cb..e2b2c987610 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let &mut Foo(mut x) = &mut Foo(0); - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let &Foo(ref x) = &Foo(0); - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, &0u8); let &mut Foo(ref x) = &mut Foo(0); - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let &Foo(&mut x) = &Foo(&mut 0); - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let &mut Foo(&x) = &mut Foo(&0); - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let &mut Foo(&mut x) = &mut Foo(&mut 0); - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); } if let &&&&&Some(&mut x) = &&&&&Some(&mut 0u8) { - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); } if let &&&&&mut Some(&x) = &&&&&mut Some(&0u8) { - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 &(Struct { a: &Some(&0), b: &Some(&0), c: &Some(&0) }) { @@ -135,7 +135,7 @@ 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 assert_type_eq(x, 0u32); assert_type_eq(y, 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 acceafdb7ec..098540adfa2 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let Foo(mut x) = &mut Foo(0); - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let Foo(ref x) = &Foo(0); - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, &0u8); let Foo(ref x) = &mut Foo(0); - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let Foo(&mut x) = &Foo(&mut 0); - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let Foo(&x) = &mut Foo(&0); - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); let Foo(&mut x) = &mut Foo(&mut 0); - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); } if let Some(&mut x) = &&&&&Some(&mut 0u8) { - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 assert_type_eq(x, 0u8); } if let Some(&x) = &&&&&mut Some(&0u8) { - //~^ ERROR: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 //~| WARN: this changes meaning in Rust 2024 &(Struct { a: &Some(&0), b: &Some(&0), c: &Some(&0) }) { @@ -135,7 +135,7 @@ 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: patterns are not allowed to reset the default binding mode + //~^ ERROR: this pattern relies on behavior which may change in edition 2024 assert_type_eq(x, 0u32); assert_type_eq(y, 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 91aa987c737..83346b9dd4a 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,10 +1,8 @@ -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:25:9 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/migration_lint.rs:25:13 | LL | let Foo(mut x) = &Foo(0); - | -^^^^^^^^^ - | | - | help: desugar the match ergonomics: `&` + | ^^^ requires binding by-value, but the implicit default is by-reference | = 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> @@ -13,176 +11,211 @@ note: the lint level is defined here | LL | #![deny(rust_2024_incompatible_pat)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: make the implied reference pattern explicit + | +LL | let &Foo(mut x) = &Foo(0); + | + -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:30:9 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/migration_lint.rs:30:13 | LL | let Foo(mut x) = &mut Foo(0); - | -^^^^^^^^^ - | | - | help: desugar the match ergonomics: `&mut` + | ^^^ requires binding by-value, but the implicit default is by-reference | = 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 + | +LL | let &mut Foo(mut x) = &mut Foo(0); + | ++++ -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:35:9 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/migration_lint.rs:35:13 | LL | let Foo(ref x) = &Foo(0); - | -^^^^^^^^^ - | | - | help: desugar the match ergonomics: `&` + | ^^^ cannot override to bind by-reference when that is the implicit default | = 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 + | +LL | let &Foo(ref x) = &Foo(0); + | + -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:40:9 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/migration_lint.rs:40:13 | LL | let Foo(ref x) = &mut Foo(0); - | -^^^^^^^^^ - | | - | help: desugar the match ergonomics: `&mut` + | ^^^ cannot override to bind by-reference when that is the implicit default | = 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 + | +LL | let &mut Foo(ref x) = &mut Foo(0); + | ++++ -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:57:9 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/migration_lint.rs:57:13 | LL | let Foo(&x) = &Foo(&0); - | -^^^^^^ - | | - | help: desugar the match ergonomics: `&` + | ^ cannot implicitly match against multiple layers of reference | = 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 + | +LL | let &Foo(&x) = &Foo(&0); + | + -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:62:9 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/migration_lint.rs:62:13 | LL | let Foo(&mut x) = &Foo(&mut 0); - | -^^^^^^^^^^ - | | - | help: desugar the match ergonomics: `&` + | ^^^^ cannot implicitly match against multiple layers of reference | = 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 + | +LL | let &Foo(&mut x) = &Foo(&mut 0); + | + -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:67:9 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/migration_lint.rs:67:13 | LL | let Foo(&x) = &mut Foo(&0); - | -^^^^^^ - | | - | help: desugar the match ergonomics: `&mut` + | ^ cannot implicitly match against multiple layers of reference | = 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 + | +LL | let &mut Foo(&x) = &mut Foo(&0); + | ++++ -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:72:9 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/migration_lint.rs:72:13 | LL | let Foo(&mut x) = &mut Foo(&mut 0); - | -^^^^^^^^^^ - | | - | help: desugar the match ergonomics: `&mut` + | ^^^^ cannot implicitly match against multiple layers of reference | = 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 + | +LL | let &mut Foo(&mut x) = &mut Foo(&mut 0); + | ++++ -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:81:12 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/migration_lint.rs:81:17 | LL | if let Some(&x) = &&&&&Some(&0u8) { - | -^^^^^^^ - | | - | help: desugar the match ergonomics: `&&&&&` + | ^ cannot implicitly match against multiple layers of reference | = 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 patterns explicit + | +LL | if let &&&&&Some(&x) = &&&&&Some(&0u8) { + | +++++ -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:87:12 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/migration_lint.rs:87:17 | LL | if let Some(&mut x) = &&&&&Some(&mut 0u8) { - | -^^^^^^^^^^^ - | | - | help: desugar the match ergonomics: `&&&&&` + | ^^^^ cannot implicitly match against multiple layers of reference | = 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 patterns explicit + | +LL | if let &&&&&Some(&mut x) = &&&&&Some(&mut 0u8) { + | +++++ -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:93:12 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/migration_lint.rs:93:17 | LL | if let Some(&x) = &&&&&mut Some(&0u8) { - | -^^^^^^^ - | | - | help: desugar the match ergonomics: `&&&&&mut` + | ^ cannot implicitly match against multiple layers of reference | = 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 patterns explicit + | +LL | if let &&&&&mut Some(&x) = &&&&&mut Some(&0u8) { + | ++++++++ -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:99:12 +error: this pattern relies on behavior which may change in edition 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 | = 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: desugar the match ergonomics +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: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:111:9 +error: this pattern relies on behavior which may change in edition 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 | = 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: desugar the match ergonomics +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: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:117:9 +error: this pattern relies on behavior which may change in edition 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 + | | + | cannot implicitly match against multiple layers of reference | = 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: desugar the match ergonomics +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: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:124:12 +error: this pattern relies on behavior which may change in edition 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 + | | + | cannot implicitly match against multiple layers of reference | = 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: desugar the match ergonomics +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: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/migration_lint.rs:137:9 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/migration_lint.rs:137:15 | LL | (Some(mut x), migration_lint_macros::mixed_edition_pat!(y)) => { - | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: desugar the match ergonomics: `&` + | ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ default binding mode is reset within expansion + | | + | requires binding by-value, but the implicit default is by-reference + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> + = 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 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 50b716a1111..5ba554fc6e5 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 patterns are not allowed to reset the default binding mode +test_pat_on_type![(&x,): &(&T,)]; //~ ERROR this pattern relies on behavior which may change in edition 2024 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 patterns are not allowed to reset the default binding mode +test_pat_on_type![(&mut x,): &(&mut T,)]; //~ ERROR this pattern relies on behavior which may change in edition 2024 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 patterns are not allowed to reset the default binding mode -test_pat_on_type![(mut x,): &(T,)]; //~ ERROR patterns are not allowed to reset the default binding mode -test_pat_on_type![(ref x,): &(T,)]; //~ ERROR patterns are not allowed to reset the default binding mode -test_pat_on_type![(ref mut x,): &mut (T,)]; //~ ERROR patterns are not allowed to reset the default binding mode +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 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 patterns are not allowed to reset the default binding mode + (&x,) => x, //~ ERROR this pattern relies on behavior which may change in edition 2024 } } 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 92058095f84..affdca1d449 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,61 +99,89 @@ LL - test_pat_on_type![Foo { f: (&x,) }: &mut Foo]; LL + test_pat_on_type![Foo { f: (x,) }: &mut Foo]; | -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/min_match_ergonomics_fail.rs:24:19 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/min_match_ergonomics_fail.rs:24:20 | LL | test_pat_on_type![(&x,): &(&T,)]; - | -^^^^ - | | - | help: desugar the match ergonomics: `&` + | ^ cannot implicitly match against multiple layers of reference + | + = 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 + | +LL | test_pat_on_type![&(&x,): &(&T,)]; + | + -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/min_match_ergonomics_fail.rs:27:19 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/min_match_ergonomics_fail.rs:27:20 | LL | test_pat_on_type![(&mut x,): &(&mut T,)]; - | -^^^^^^^^ - | | - | help: desugar the match ergonomics: `&` + | ^^^^ cannot implicitly match against multiple layers of reference + | + = 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 + | +LL | test_pat_on_type![&(&mut x,): &(&mut T,)]; + | + -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/min_match_ergonomics_fail.rs:31:19 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/min_match_ergonomics_fail.rs:31:28 | LL | test_pat_on_type![Foo { f: &(x,) }: &Foo]; - | -^^^^^^^^^^^^^^^ - | | - | help: desugar the match ergonomics: `&` + | ^ cannot implicitly match against multiple layers of reference + | + = 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 + | +LL | test_pat_on_type![&Foo { f: &(x,) }: &Foo]; + | + -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/min_match_ergonomics_fail.rs:32:19 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/min_match_ergonomics_fail.rs:32:20 | LL | test_pat_on_type![(mut x,): &(T,)]; - | -^^^^^^^ - | | - | help: desugar the match ergonomics: `&` + | ^^^ requires binding by-value, but the implicit default is by-reference + | + = 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 + | +LL | test_pat_on_type![&(mut x,): &(T,)]; + | + -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/min_match_ergonomics_fail.rs:33:19 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/min_match_ergonomics_fail.rs:33:20 | LL | test_pat_on_type![(ref x,): &(T,)]; - | -^^^^^^^ - | | - | help: desugar the match ergonomics: `&` + | ^^^ cannot override to bind by-reference when that is the implicit default + | + = 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 + | +LL | test_pat_on_type![&(ref x,): &(T,)]; + | + -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/min_match_ergonomics_fail.rs:34:19 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/min_match_ergonomics_fail.rs:34:20 | LL | test_pat_on_type![(ref mut x,): &mut (T,)]; - | -^^^^^^^^^^^ - | | - | help: desugar the match ergonomics: `&mut` + | ^^^^^^^ cannot override to bind by-reference when that is the implicit default + | + = 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 + | +LL | test_pat_on_type![&mut (ref mut x,): &mut (T,)]; + | ++++ -error: patterns are not allowed to reset the default binding mode in edition 2024 - --> $DIR/min_match_ergonomics_fail.rs:43:9 +error: this pattern relies on behavior which may change in edition 2024 + --> $DIR/min_match_ergonomics_fail.rs:43:10 | LL | (&x,) => x, - | -^^^^ - | | - | help: desugar the match ergonomics: `&` + | ^ cannot implicitly match against multiple layers of reference + | + = 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 + | +LL | &(&x,) => x, + | + error: aborting due to 13 previous errors diff --git a/tests/ui/pattern/slice-pattern-refutable.stderr b/tests/ui/pattern/slice-pattern-refutable.stderr index df5b58d3e9c..3d9f769d134 100644 --- a/tests/ui/pattern/slice-pattern-refutable.stderr +++ b/tests/ui/pattern/slice-pattern-refutable.stderr @@ -1,13 +1,15 @@ error[E0282]: type annotations needed - --> $DIR/slice-pattern-refutable.rs:14:9 + --> $DIR/slice-pattern-refutable.rs:14:28 | LL | let [a, b, c] = Zeroes.into() else { - | ^^^^^^^^^ + | --------- ^^^^ + | | + | type must be known at this point | -help: consider giving this pattern a type +help: try using a fully qualified path to specify the expected types | -LL | let [a, b, c]: /* Type */ = 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 diff --git a/tests/ui/pattern/slice-patterns-ambiguity.stderr b/tests/ui/pattern/slice-patterns-ambiguity.stderr index 3ef99d0e2d1..690776196ce 100644 --- a/tests/ui/pattern/slice-patterns-ambiguity.stderr +++ b/tests/ui/pattern/slice-patterns-ambiguity.stderr @@ -1,13 +1,15 @@ -error[E0282]: type annotations needed for `&_` - --> $DIR/slice-patterns-ambiguity.rs:25:9 +error[E0282]: type annotations needed + --> $DIR/slice-patterns-ambiguity.rs:25:26 | LL | let &[a, b] = Zeroes.into() else { - | ^^^^^^^ + | ------ ^^^^ + | | + | type must be known at this point | -help: consider giving this pattern a type, where the placeholders `_` are specified +help: try using a fully qualified path to specify the expected types | -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 diff --git a/tests/ui/attrs-resolution-errors.rs b/tests/ui/resolve/attr-macros-positional-rejection.rs index 8770fb1ded8..11382ff1399 100644 --- a/tests/ui/attrs-resolution-errors.rs +++ b/tests/ui/resolve/attr-macros-positional-rejection.rs @@ -1,3 +1,12 @@ +//! Check that certain positions (listed below) only permit *non-macro* attributes and reject +//! attribute macros: +//! +//! - Enum variants +//! - Struct fields +//! - Field in a struct pattern +//! - Match arm +//! - Field in struct initialization expression + enum FooEnum { #[test] //~^ ERROR expected non-macro attribute, found attribute macro @@ -32,7 +41,7 @@ fn main() { _ => {} } - let _another_foo_strunct = FooStruct { + let _another_foo_struct = FooStruct { #[test] //~^ ERROR expected non-macro attribute, found attribute macro bar: 1, diff --git a/tests/ui/attrs-resolution-errors.stderr b/tests/ui/resolve/attr-macros-positional-rejection.stderr index 883f96e5c19..faea511f315 100644 --- a/tests/ui/attrs-resolution-errors.stderr +++ b/tests/ui/resolve/attr-macros-positional-rejection.stderr @@ -1,29 +1,29 @@ error: expected non-macro attribute, found attribute macro `test` - --> $DIR/attrs-resolution-errors.rs:2:7 + --> $DIR/attr-macros-positional-rejection.rs:11:7 | LL | #[test] | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/attrs-resolution-errors.rs:8:7 + --> $DIR/attr-macros-positional-rejection.rs:17:7 | LL | #[test] | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/attrs-resolution-errors.rs:23:15 + --> $DIR/attr-macros-positional-rejection.rs:32:15 | LL | #[test] bar | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/attrs-resolution-errors.rs:30:11 + --> $DIR/attr-macros-positional-rejection.rs:39:11 | LL | #[test] | ^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `test` - --> $DIR/attrs-resolution-errors.rs:36:11 + --> $DIR/attr-macros-positional-rejection.rs:45:11 | LL | #[test] | ^^^^ not a non-macro attribute diff --git a/tests/ui/attrs-resolution.rs b/tests/ui/resolve/non-macro-attrs-accepted.rs index 38dd3812d68..76a04b2e837 100644 --- a/tests/ui/attrs-resolution.rs +++ b/tests/ui/resolve/non-macro-attrs-accepted.rs @@ -1,3 +1,11 @@ +//! Check that certain positions (listed below) permit *non-macro* attributes. +//! +//! - Enum variants +//! - Struct fields +//! - Field in a struct pattern +//! - Match arm +//! - Field in struct initialization expression + //@ check-pass enum FooEnum { @@ -30,7 +38,7 @@ fn main() { _ => {} } - let _another_foo_strunct = FooStruct { + let _another_foo_struct = FooStruct { #[rustfmt::skip] bar: 1, }; diff --git a/tests/ui/traits/const-traits/const-cond-for-rpitit.rs b/tests/ui/traits/const-traits/const-cond-for-rpitit.rs new file mode 100644 index 00000000000..50bf93f9a03 --- /dev/null +++ b/tests/ui/traits/const-traits/const-cond-for-rpitit.rs @@ -0,0 +1,22 @@ +//@ compile-flags: -Znext-solver +//@ check-pass + +#![feature(const_trait_impl)] +#![allow(refining_impl_trait)] + +#[const_trait] +pub trait Foo { + fn method(self) -> impl ~const Bar; +} + +#[const_trait] +pub trait Bar {} + +struct A<T>(T); +impl<T> const Foo for A<T> where A<T>: ~const Bar { + fn method(self) -> impl ~const Bar { + self + } +} + +fn main() {} diff --git a/tests/ui/traits/const-traits/const-impl-trait.rs b/tests/ui/traits/const-traits/const-impl-trait.rs index 61b8c9a5bff..d7fe43ef37c 100644 --- a/tests/ui/traits/const-traits/const-impl-trait.rs +++ b/tests/ui/traits/const-traits/const-impl-trait.rs @@ -1,15 +1,10 @@ //@ compile-flags: -Znext-solver //@ known-bug: #110395 -//@ failure-status: 101 -//@ dont-check-compiler-stderr -// Broken until we have `&T: const Deref` impl in stdlib + +// Broken until we have `const PartialEq` impl in stdlib #![allow(incomplete_features)] -#![feature( - const_trait_impl, - effects, - const_cmp, -)] +#![feature(const_trait_impl, const_cmp, const_destruct)] use std::marker::Destruct; @@ -17,9 +12,9 @@ const fn cmp(a: &impl ~const PartialEq) -> bool { a == a } -const fn wrap(x: impl ~const PartialEq + ~const Destruct) - -> impl ~const PartialEq + ~const Destruct -{ +const fn wrap( + x: impl ~const PartialEq + ~const Destruct, +) -> impl ~const PartialEq + ~const Destruct { x } @@ -48,11 +43,15 @@ trait T {} struct S; impl const T for S {} -const fn rpit() -> impl ~const T { S } +const fn rpit() -> impl ~const T { + S +} const fn apit(_: impl ~const T + ~const Destruct) {} -const fn rpit_assoc_bound() -> impl IntoIterator<Item: ~const T> { Some(S) } +const fn rpit_assoc_bound() -> impl IntoIterator<Item: ~const T> { + Some(S) +} const fn apit_assoc_bound(_: impl IntoIterator<Item: ~const T> + ~const Destruct) {} diff --git a/tests/ui/traits/const-traits/const-impl-trait.stderr b/tests/ui/traits/const-traits/const-impl-trait.stderr new file mode 100644 index 00000000000..4e320059448 --- /dev/null +++ b/tests/ui/traits/const-traits/const-impl-trait.stderr @@ -0,0 +1,187 @@ +error[E0635]: unknown feature `const_cmp` + --> $DIR/const-impl-trait.rs:7:30 + | +LL | #![feature(const_trait_impl, const_cmp, const_destruct)] + | ^^^^^^^^^ + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:11:23 + | +LL | const fn cmp(a: &impl ~const PartialEq) -> bool { + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:11:23 + | +LL | const fn cmp(a: &impl ~const PartialEq) -> bool { + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:16:13 + | +LL | x: impl ~const PartialEq + ~const Destruct, + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:17:11 + | +LL | ) -> impl ~const PartialEq + ~const Destruct { + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:17:11 + | +LL | ) -> impl ~const PartialEq + ~const Destruct { + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:17:11 + | +LL | ) -> impl ~const PartialEq + ~const Destruct { + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:16:13 + | +LL | x: impl ~const PartialEq + ~const Destruct, + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:23:22 + | +LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy; + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:27:22 + | +LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy { + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:27:22 + | +LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy { + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:23:22 + | +LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy; + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:23:22 + | +LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy; + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:27:22 + | +LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy { + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:23:22 + | +LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy; + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: `~const` can only be applied to `#[const_trait]` traits + --> $DIR/const-impl-trait.rs:23:22 + | +LL | fn huh() -> impl ~const PartialEq + ~const Destruct + Copy; + | ^^^^^^ can't be applied to `PartialEq` + | +note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]` + --> $SRC_DIR/core/src/cmp.rs:LL:COL + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0015]: cannot call non-const operator in constants + --> $DIR/const-impl-trait.rs:35:13 + | +LL | assert!(wrap(123) == wrap(123)); + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + +error[E0015]: cannot call non-const operator in constants + --> $DIR/const-impl-trait.rs:36:13 + | +LL | assert!(wrap(123) != wrap(456)); + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + +error[E0015]: cannot call non-const operator in constants + --> $DIR/const-impl-trait.rs:38:13 + | +LL | assert!(x == x); + | ^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + +error[E0015]: cannot call non-const operator in constant functions + --> $DIR/const-impl-trait.rs:12:5 + | +LL | a == a + | ^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 20 previous errors + +Some errors have detailed explanations: E0015, E0635. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.rs b/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.rs index 00dc7a9d337..fbf4cadc678 100644 --- a/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.rs +++ b/tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.rs @@ -37,9 +37,4 @@ fn foo<T: Unnormalizable>() { // result in a cyclic type. However, we can still unify these types by first // normalizing the inner associated type. Emitting an error here would be incomplete. drop::<T>(t); - - // FIXME(-Znext-solver): This line is necessary due to an unrelated solver bug - // and should get removed in the future. - // https://github.com/rust-lang/trait-system-refactor-initiative/issues/96 - drop::<Inv<<T as Unnormalizable>::Assoc>>(u); } diff --git a/tests/ui/traits/winnowing/global-non-global-env-1.rs b/tests/ui/traits/winnowing/global-non-global-env-1.rs index d232d32dddf..75c184b65bf 100644 --- a/tests/ui/traits/winnowing/global-non-global-env-1.rs +++ b/tests/ui/traits/winnowing/global-non-global-env-1.rs @@ -1,3 +1,6 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver //@ check-pass // A regression test for an edge case of candidate selection diff --git a/tests/ui/traits/winnowing/global-non-global-env-2.rs b/tests/ui/traits/winnowing/global-non-global-env-2.rs index c73d0f06cd9..128ec2a40da 100644 --- a/tests/ui/traits/winnowing/global-non-global-env-2.rs +++ b/tests/ui/traits/winnowing/global-non-global-env-2.rs @@ -1,3 +1,6 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver //@ check-pass // A regression test for an edge case of candidate selection diff --git a/tests/ui/traits/winnowing/global-non-global-env-3.rs b/tests/ui/traits/winnowing/global-non-global-env-3.rs index 008d07e4144..7e5dbd4ba8e 100644 --- a/tests/ui/traits/winnowing/global-non-global-env-3.rs +++ b/tests/ui/traits/winnowing/global-non-global-env-3.rs @@ -1,3 +1,6 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver //@ check-pass // A regression test for an edge case of candidate selection diff --git a/tests/ui/traits/winnowing/global-non-global-env-4.rs b/tests/ui/traits/winnowing/global-non-global-env-4.rs index 74793620c9e..2dc082be45c 100644 --- a/tests/ui/traits/winnowing/global-non-global-env-4.rs +++ b/tests/ui/traits/winnowing/global-non-global-env-4.rs @@ -1,3 +1,6 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver //@ check-pass // A regression test for an edge case of candidate selection diff --git a/tests/ui/attempted-access-non-fatal.rs b/tests/ui/typeck/attempted-access-non-fatal.rs index 15deb9e2f60..15deb9e2f60 100644 --- a/tests/ui/attempted-access-non-fatal.rs +++ b/tests/ui/typeck/attempted-access-non-fatal.rs diff --git a/tests/ui/attempted-access-non-fatal.stderr b/tests/ui/typeck/attempted-access-non-fatal.stderr index bff669727a1..bff669727a1 100644 --- a/tests/ui/attempted-access-non-fatal.stderr +++ b/tests/ui/typeck/attempted-access-non-fatal.stderr diff --git a/tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr b/tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr index e486f04f273..4ff90945397 100644 --- a/tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr +++ b/tests/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr @@ -1,8 +1,8 @@ error: unknown lint: `test_unstable_lint` - --> $DIR/deny-unstable-lint-inline.rs:4:1 + --> $DIR/deny-unstable-lint-inline.rs:4:10 | LL | #![allow(test_unstable_lint)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ | = note: the `test_unstable_lint` lint is unstable = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable diff --git a/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr b/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr index 981d3b1a874..7d56b360837 100644 --- a/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr +++ b/tests/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr @@ -1,8 +1,8 @@ warning: unknown lint: `test_unstable_lint` - --> $DIR/warn-unknown-unstable-lint-inline.rs:4:1 + --> $DIR/warn-unknown-unstable-lint-inline.rs:4:10 | LL | #![allow(test_unstable_lint)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ | = note: the `test_unstable_lint` lint is unstable = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable |
