diff options
Diffstat (limited to 'tests')
1339 files changed, 16887 insertions, 6284 deletions
diff --git a/tests/assembly/aarch64-pointer-auth.rs b/tests/assembly/aarch64-pointer-auth.rs index 1e53878a2cc..344e9e74bc2 100644 --- a/tests/assembly/aarch64-pointer-auth.rs +++ b/tests/assembly/aarch64-pointer-auth.rs @@ -1,9 +1,13 @@ // Test that PAC instructions are emitted when branch-protection is specified. +//@ revisions: PACRET PAUTHLR_NOP PAUTHLR //@ assembly-output: emit-asm -//@ compile-flags: --target aarch64-unknown-linux-gnu -//@ compile-flags: -Z branch-protection=pac-ret,leaf //@ needs-llvm-components: aarch64 +//@ compile-flags: --target aarch64-unknown-linux-gnu +//@ [PACRET] compile-flags: -Z branch-protection=pac-ret,leaf +//@ [PAUTHLR_NOP] compile-flags: -Z branch-protection=pac-ret,pc,leaf +//@ [PAUTHLR] compile-flags: -C target-feature=+pauth-lr -Z branch-protection=pac-ret,pc,leaf +//@ min-llvm-version: 19 #![feature(no_core, lang_items)] #![no_std] @@ -13,8 +17,13 @@ #[lang = "sized"] trait Sized {} -// CHECK: hint #25 -// CHECK: hint #29 +// PACRET: hint #25 +// PACRET: hint #29 +// PAUTHLR_NOP: hint #25 +// PAUTHLR_NOP: hint #39 +// PAUTHLR_NOP: hint #29 +// PAUTHLR: paciasppc +// PAUTHLR: autiasppc #[no_mangle] pub fn test() -> u8 { 42 diff --git a/tests/assembly/asm-comments.rs b/tests/assembly/asm/comments.rs index 557009975dd..557009975dd 100644 --- a/tests/assembly/asm-comments.rs +++ b/tests/assembly/asm/comments.rs diff --git a/tests/assembly/asm/loongarch-type.rs b/tests/assembly/asm/loongarch-type.rs index 1b097f41105..c51d35876d9 100644 --- a/tests/assembly/asm/loongarch-type.rs +++ b/tests/assembly/asm/loongarch-type.rs @@ -3,7 +3,7 @@ //@ compile-flags: -Zmerge-functions=disabled //@ needs-llvm-components: loongarch -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![feature(no_core, lang_items, rustc_attrs)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] diff --git a/tests/assembly/asm/s390x-types.rs b/tests/assembly/asm/s390x-types.rs index e68b18d7aa6..b1522198a08 100644 --- a/tests/assembly/asm/s390x-types.rs +++ b/tests/assembly/asm/s390x-types.rs @@ -4,7 +4,7 @@ //@[s390x] needs-llvm-components: systemz //@ compile-flags: -Zmerge-functions=disabled -#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] +#![feature(no_core, lang_items, rustc_attrs, repr_simd)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] diff --git a/tests/assembly/asm/sparc-types.rs b/tests/assembly/asm/sparc-types.rs new file mode 100644 index 00000000000..2270679e837 --- /dev/null +++ b/tests/assembly/asm/sparc-types.rs @@ -0,0 +1,168 @@ +//@ revisions: sparc sparcv8plus sparc64 +//@ assembly-output: emit-asm +//@[sparc] compile-flags: --target sparc-unknown-none-elf +//@[sparc] needs-llvm-components: sparc +//@[sparcv8plus] compile-flags: --target sparc-unknown-linux-gnu +//@[sparcv8plus] needs-llvm-components: sparc +//@[sparc64] compile-flags: --target sparc64-unknown-linux-gnu +//@[sparc64] needs-llvm-components: sparc +//@ compile-flags: -Zmerge-functions=disabled + +#![feature(no_core, lang_items, rustc_attrs, repr_simd, 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 {} + +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; +} + +macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => { + #[no_mangle] + pub unsafe fn $func(x: $ty) -> $ty { + let y; + asm!(concat!($mov," {}, {}"), in($class) x, out($class) y); + y + } +};} + +macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => { + #[no_mangle] + pub unsafe fn $func(x: $ty) -> $ty { + let y; + asm!(concat!($mov, " %", $reg, ", %", $reg), in($reg) x, lateout($reg) y); + y + } +};} + +// CHECK-LABEL: sym_fn_32: +// CHECK: !APP +// CHECK-NEXT: call extern_func +// CHECK-NEXT: !NO_APP +#[no_mangle] +pub unsafe fn sym_fn_32() { + asm!("call {}", sym extern_func); +} + +// CHECK-LABEL: sym_static: +// CHECK: !APP +// CHECK-NEXT: call extern_static +// CHECK-NEXT: !NO_APP +#[no_mangle] +pub unsafe fn sym_static() { + asm!("call {}", sym extern_static); +} + +// CHECK-LABEL: reg_i8: +// CHECK: !APP +// CHECK-NEXT: mov %{{[goli]}}{{[0-9]+}}, %{{[goli]}}{{[0-9]+}} +// CHECK-NEXT: !NO_APP +check!(reg_i8, i8, reg, "mov"); + +// CHECK-LABEL: reg_i16: +// CHECK: !APP +// CHECK-NEXT: mov %{{[goli]}}{{[0-9]+}}, %{{[goli]}}{{[0-9]+}} +// CHECK-NEXT: !NO_APP +check!(reg_i16, i16, reg, "mov"); + +// CHECK-LABEL: reg_i32: +// CHECK: !APP +// CHECK-NEXT: mov %{{[goli]}}{{[0-9]+}}, %{{[goli]}}{{[0-9]+}} +// CHECK-NEXT: !NO_APP +check!(reg_i32, i32, reg, "mov"); + +// FIXME: should be allowed for sparcv8plus but not yet supported in LLVM +// sparc64-LABEL: reg_i64: +// sparc64: !APP +// sparc64-NEXT: mov %{{[goli]}}{{[0-9]+}}, %{{[goli]}}{{[0-9]+}} +// sparc64-NEXT: !NO_APP +#[cfg(sparc64)] +check!(reg_i64, i64, reg, "mov"); + +// CHECK-LABEL: reg_ptr: +// CHECK: !APP +// CHECK-NEXT: mov %{{[goli]}}{{[0-9]+}}, %{{[goli]}}{{[0-9]+}} +// CHECK-NEXT: !NO_APP +check!(reg_ptr, ptr, reg, "mov"); + +// CHECK-LABEL: o0_i8: +// CHECK: !APP +// CHECK-NEXT: mov %o0, %o0 +// CHECK-NEXT: !NO_APP +check_reg!(o0_i8, i8, "o0", "mov"); + +// CHECK-LABEL: o0_i16: +// CHECK: !APP +// CHECK-NEXT: mov %o0, %o0 +// CHECK-NEXT: !NO_APP +check_reg!(o0_i16, i16, "o0", "mov"); + +// CHECK-LABEL: o0_i32: +// CHECK: !APP +// CHECK-NEXT: mov %o0, %o0 +// CHECK-NEXT: !NO_APP +check_reg!(o0_i32, i32, "o0", "mov"); + +// FIXME: should be allowed for sparcv8plus but not yet supported in LLVM +// sparc64-LABEL: o0_i64: +// sparc64: !APP +// sparc64-NEXT: mov %o0, %o0 +// sparc64-NEXT: !NO_APP +#[cfg(sparc64)] +check_reg!(o0_i64, i64, "o0", "mov"); + +// CHECK-LABEL: r9_i8: +// CHECK: !APP +// CHECK-NEXT: mov %o1, %o1 +// CHECK-NEXT: !NO_APP +check_reg!(r9_i8, i8, "r9", "mov"); + +// CHECK-LABEL: r9_i16: +// CHECK: !APP +// CHECK-NEXT: mov %o1, %o1 +// CHECK-NEXT: !NO_APP +check_reg!(r9_i16, i16, "r9", "mov"); + +// CHECK-LABEL: r9_i32: +// CHECK: !APP +// CHECK-NEXT: mov %o1, %o1 +// CHECK-NEXT: !NO_APP +check_reg!(r9_i32, i32, "r9", "mov"); + +// FIXME: should be allowed for sparcv8plus but not yet supported in LLVM +// sparc64-LABEL: r9_i64: +// sparc64: !APP +// sparc64-NEXT: mov %o1, %o1 +// sparc64-NEXT: !NO_APP +#[cfg(sparc64)] +check_reg!(r9_i64, i64, "r9", "mov"); diff --git a/tests/assembly/compiletest-self-test/use-minicore-no-run.rs b/tests/assembly/compiletest-self-test/use-minicore-no-run.rs new file mode 100644 index 00000000000..0e4f05c4b37 --- /dev/null +++ b/tests/assembly/compiletest-self-test/use-minicore-no-run.rs @@ -0,0 +1,5 @@ +//! `compiletest` self-test to check that `add-core-stubs` is incompatible with run pass modes. + +//@ add-core-stubs +//@ run-pass +//@ should-fail diff --git a/tests/assembly/riscv-soft-abi-with-float-features.rs b/tests/assembly/riscv-soft-abi-with-float-features.rs index 733137f5700..6d6001af084 100644 --- a/tests/assembly/riscv-soft-abi-with-float-features.rs +++ b/tests/assembly/riscv-soft-abi-with-float-features.rs @@ -1,6 +1,9 @@ //@ assembly-output: emit-asm //@ compile-flags: --target riscv64imac-unknown-none-elf -Ctarget-feature=+f,+d //@ needs-llvm-components: riscv +//@ revisions: LLVM-PRE-20 LLVM-POST-20 +//@ [LLVM-PRE-20] ignore-llvm-version: 20 - 99 +//@ [LLVM-POST-20] min-llvm-version: 20 #![feature(no_core, lang_items, f16)] #![crate_type = "lib"] @@ -31,9 +34,11 @@ pub extern "C" fn read_f16(x: &f16) -> f16 { // CHECK-LABEL: read_f32 #[no_mangle] pub extern "C" fn read_f32(x: &f32) -> f32 { - // CHECK: flw fa5, 0(a0) - // CHECK-NEXT: fmv.x.w a0, fa5 - // CHECK-NEXT: ret + // LLVM-PRE-20: flw fa5, 0(a0) + // LLVM-PRE-20-NEXT: fmv.x.w a0, fa5 + // LLVM-PRE-20-NEXT: ret + // LLVM-POST-20: lw a0, 0(a0) + // LLVM-POST-20-NEXT: ret *x } diff --git a/tests/assembly/rust-abi-arg-attr.rs b/tests/assembly/rust-abi-arg-attr.rs index 2a113eed4ba..e55a53fbdeb 100644 --- a/tests/assembly/rust-abi-arg-attr.rs +++ b/tests/assembly/rust-abi-arg-attr.rs @@ -50,9 +50,10 @@ enum Ordering { Greater = 1, } -extern "rust-intrinsic" { - #[rustc_safe_intrinsic] - fn three_way_compare<T: Copy>(lhs: T, rhs: T) -> Ordering; +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +fn three_way_compare<T: Copy>(lhs: T, rhs: T) -> Ordering { + loop {} } // ^^^^^ core diff --git a/tests/assembly/targets/targets-elf.rs b/tests/assembly/targets/targets-elf.rs index 1857633a8bf..7d50647bed1 100644 --- a/tests/assembly/targets/targets-elf.rs +++ b/tests/assembly/targets/targets-elf.rs @@ -525,9 +525,6 @@ //@ revisions: wasm32v1_none //@ [wasm32v1_none] compile-flags: --target wasm32v1-none //@ [wasm32v1_none] needs-llvm-components: webassembly -//@ revisions: wasm32_wasi -//@ [wasm32_wasi] compile-flags: --target wasm32-wasi -//@ [wasm32_wasi] needs-llvm-components: webassembly //@ revisions: wasm32_wasip1 //@ [wasm32_wasip1] compile-flags: --target wasm32-wasip1 //@ [wasm32_wasip1] needs-llvm-components: webassembly diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs new file mode 100644 index 00000000000..1e9f2ee59b4 --- /dev/null +++ b/tests/auxiliary/minicore.rs @@ -0,0 +1,81 @@ +//! Auxiliary `minicore` prelude which stubs out `core` items for `no_core` tests that need to work +//! in cross-compilation scenarios where no `core` is available (that don't want nor need to +//! `-Zbuild-std`). +//! +//! # Important notes +//! +//! - `minicore` is **only** intended for `core` items, and the stubs should match the actual `core` +//! items. +//! - Be careful of adding new features and things that are only available for a subset of targets. +//! +//! # References +//! +//! This is partially adapted from `rustc_codegen_cranelift`: +//! <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)] +#![allow(unused, improper_ctypes_definitions, internal_features)] +#![feature(asm_experimental_arch)] +#![no_std] +#![no_core] + +// `core` has some exotic `marker_impls!` macro for handling the with-generics cases, but for our +// purposes, just use a simple macro_rules macro. +macro_rules! impl_marker_trait { + ($Trait:ident => [$( $ty:ident ),* $(,)?] ) => { + $( impl $Trait for $ty {} )* + } +} + +#[lang = "sized"] +pub trait Sized {} + +#[lang = "legacy_receiver"] +pub trait LegacyReceiver {} +impl<T: ?Sized> LegacyReceiver for &T {} +impl<T: ?Sized> LegacyReceiver for &mut T {} + +#[lang = "copy"] +pub trait Copy: Sized {} + +impl_marker_trait!( + Copy => [ bool, char, isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64 ] +); +impl<'a, T: ?Sized> Copy for &'a T {} +impl<T: ?Sized> Copy for *const T {} +impl<T: ?Sized> Copy for *mut T {} + +#[lang = "phantom_data"] +pub struct PhantomData<T: ?Sized>; +impl<T: ?Sized> Copy for PhantomData<T> {} + +pub enum Option<T> { + None, + Some(T), +} +impl<T: Copy> Copy for Option<T> {} + +pub enum Result<T, E> { + Ok(T), + Err(E), +} +impl<T: Copy, E: Copy> Copy for Result<T, E> {} + +#[lang = "manually_drop"] +#[repr(transparent)] +pub struct ManuallyDrop<T: ?Sized> { + value: T, +} +impl<T: Copy + ?Sized> Copy for ManuallyDrop<T> {} + +#[lang = "unsafe_cell"] +#[repr(transparent)] +pub struct UnsafeCell<T: ?Sized> { + value: T, +} + +#[rustc_builtin_macro] +pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) { + /* compiler built-in */ +} diff --git a/tests/codegen/asm-powerpc-clobbers.rs b/tests/codegen/asm-powerpc-clobbers.rs deleted file mode 100644 index 0be1b66bd99..00000000000 --- a/tests/codegen/asm-powerpc-clobbers.rs +++ /dev/null @@ -1,47 +0,0 @@ -//@ revisions: powerpc powerpc64 powerpc64le -//@[powerpc] compile-flags: --target powerpc-unknown-linux-gnu -//@[powerpc] needs-llvm-components: powerpc -//@[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu -//@[powerpc64] needs-llvm-components: powerpc -//@[powerpc64le] compile-flags: --target powerpc64le-unknown-linux-gnu -//@[powerpc64le] needs-llvm-components: powerpc - -#![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] -#![no_core] - -#[lang = "sized"] -trait Sized {} - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} - -// CHECK-LABEL: @cr_clobber -// CHECK: call void asm sideeffect "", "~{cr}"() -#[no_mangle] -pub unsafe fn cr_clobber() { - asm!("", out("cr") _, options(nostack, nomem)); -} - -// CHECK-LABEL: @cr0_clobber -// CHECK: call void asm sideeffect "", "~{cr0}"() -#[no_mangle] -pub unsafe fn cr0_clobber() { - asm!("", out("cr0") _, options(nostack, nomem)); -} - -// CHECK-LABEL: @cr5_clobber -// CHECK: call void asm sideeffect "", "~{cr5}"() -#[no_mangle] -pub unsafe fn cr5_clobber() { - asm!("", out("cr5") _, options(nostack, nomem)); -} - -// CHECK-LABEL: @xer_clobber -// CHECK: call void asm sideeffect "", "~{xer}"() -#[no_mangle] -pub unsafe fn xer_clobber() { - asm!("", out("xer") _, options(nostack, nomem)); -} diff --git a/tests/codegen/asm-arm64ec-clobbers.rs b/tests/codegen/asm/arm64ec-clobbers.rs index 2ec61907947..2ec61907947 100644 --- a/tests/codegen/asm-arm64ec-clobbers.rs +++ b/tests/codegen/asm/arm64ec-clobbers.rs diff --git a/tests/codegen/foo.s b/tests/codegen/asm/foo.s index 304d82aa0c6..304d82aa0c6 100644 --- a/tests/codegen/foo.s +++ b/tests/codegen/asm/foo.s diff --git a/tests/codegen/global_asm.rs b/tests/codegen/asm/global_asm.rs index 32075daa3cf..32075daa3cf 100644 --- a/tests/codegen/global_asm.rs +++ b/tests/codegen/asm/global_asm.rs diff --git a/tests/codegen/global_asm_include.rs b/tests/codegen/asm/global_asm_include.rs index 98be9c3e333..98be9c3e333 100644 --- a/tests/codegen/global_asm_include.rs +++ b/tests/codegen/asm/global_asm_include.rs diff --git a/tests/codegen/global_asm_x2.rs b/tests/codegen/asm/global_asm_x2.rs index 9e3a00f0680..9e3a00f0680 100644 --- a/tests/codegen/global_asm_x2.rs +++ b/tests/codegen/asm/global_asm_x2.rs diff --git a/tests/codegen/asm-goto.rs b/tests/codegen/asm/goto.rs index e522d0da5b4..e522d0da5b4 100644 --- a/tests/codegen/asm-goto.rs +++ b/tests/codegen/asm/goto.rs diff --git a/tests/codegen/asm-may_unwind.rs b/tests/codegen/asm/may_unwind.rs index be66b3975ff..be66b3975ff 100644 --- a/tests/codegen/asm-may_unwind.rs +++ b/tests/codegen/asm/may_unwind.rs diff --git a/tests/codegen/asm-maybe-uninit.rs b/tests/codegen/asm/maybe-uninit.rs index 55813c35a46..55813c35a46 100644 --- a/tests/codegen/asm-maybe-uninit.rs +++ b/tests/codegen/asm/maybe-uninit.rs diff --git a/tests/codegen/asm-msp430-clobbers.rs b/tests/codegen/asm/msp430-clobbers.rs index c00c04f3088..c00c04f3088 100644 --- a/tests/codegen/asm-msp430-clobbers.rs +++ b/tests/codegen/asm/msp430-clobbers.rs diff --git a/tests/codegen/asm-multiple-options.rs b/tests/codegen/asm/multiple-options.rs index 1ee295e32c9..1ee295e32c9 100644 --- a/tests/codegen/asm-multiple-options.rs +++ b/tests/codegen/asm/multiple-options.rs diff --git a/tests/codegen/asm-options.rs b/tests/codegen/asm/options.rs index 96a72c2f5ae..96a72c2f5ae 100644 --- a/tests/codegen/asm-options.rs +++ b/tests/codegen/asm/options.rs diff --git a/tests/codegen/asm/powerpc-clobbers.rs b/tests/codegen/asm/powerpc-clobbers.rs new file mode 100644 index 00000000000..e97e8300ca7 --- /dev/null +++ b/tests/codegen/asm/powerpc-clobbers.rs @@ -0,0 +1,63 @@ +//@ revisions: powerpc powerpc64 powerpc64le aix64 +//@[powerpc] compile-flags: --target powerpc-unknown-linux-gnu +//@[powerpc] needs-llvm-components: powerpc +//@[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu +//@[powerpc64] needs-llvm-components: powerpc +//@[powerpc64le] compile-flags: --target powerpc64le-unknown-linux-gnu +//@[powerpc64le] needs-llvm-components: powerpc +//@[aix64] compile-flags: --target powerpc64-ibm-aix +//@[aix64] needs-llvm-components: powerpc + +#![crate_type = "rlib"] +#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +#[rustc_builtin_macro] +macro_rules! asm { + () => {}; +} + +// CHECK-LABEL: @cr_clobber +// CHECK: call void asm sideeffect "", "~{cr}"() +#[no_mangle] +pub unsafe fn cr_clobber() { + asm!("", out("cr") _, options(nostack, nomem, preserves_flags)); +} + +// CHECK-LABEL: @cr0_clobber +// CHECK: call void asm sideeffect "", "~{cr0}"() +#[no_mangle] +pub unsafe fn cr0_clobber() { + asm!("", out("cr0") _, options(nostack, nomem, preserves_flags)); +} + +// CHECK-LABEL: @cr5_clobber +// CHECK: call void asm sideeffect "", "~{cr5}"() +#[no_mangle] +pub unsafe fn cr5_clobber() { + asm!("", out("cr5") _, options(nostack, nomem, preserves_flags)); +} + +// CHECK-LABEL: @xer_clobber +// CHECK: call void asm sideeffect "", "~{xer}"() +#[no_mangle] +pub unsafe fn xer_clobber() { + asm!("", out("xer") _, options(nostack, nomem, preserves_flags)); +} + +// CHECK-LABEL: @v0_clobber +// CHECK: call void asm sideeffect "", "~{v0}"() +#[no_mangle] +pub unsafe fn v0_clobber() { + asm!("", out("v0") _, options(nostack, nomem, preserves_flags)); +} + +// CHECK-LABEL: @clobber_abi +// CHECK: asm sideeffect "", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},={f0},={f1},={f2},={f3},={f4},={f5},={f6},={f7},={f8},={f9},={f10},={f11},={f12},={f13},~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7},~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15},~{v16},~{v17},~{v18},~{v19},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{xer}"() +#[no_mangle] +pub unsafe fn clobber_abi() { + asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags)); +} diff --git a/tests/codegen/asm-s390x-clobbers.rs b/tests/codegen/asm/s390x-clobbers.rs index 45f72206bdf..56d82b4b044 100644 --- a/tests/codegen/asm-s390x-clobbers.rs +++ b/tests/codegen/asm/s390x-clobbers.rs @@ -3,7 +3,7 @@ //@[s390x] needs-llvm-components: systemz #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] +#![feature(no_core, rustc_attrs, lang_items)] #![no_core] #[lang = "sized"] diff --git a/tests/codegen/asm-sanitize-llvm.rs b/tests/codegen/asm/sanitize-llvm.rs index fb332f9a0f3..fb332f9a0f3 100644 --- a/tests/codegen/asm-sanitize-llvm.rs +++ b/tests/codegen/asm/sanitize-llvm.rs diff --git a/tests/codegen/asm/sparc-clobbers.rs b/tests/codegen/asm/sparc-clobbers.rs new file mode 100644 index 00000000000..843abd55352 --- /dev/null +++ b/tests/codegen/asm/sparc-clobbers.rs @@ -0,0 +1,40 @@ +//@ revisions: sparc sparcv8plus sparc64 +//@[sparc] compile-flags: --target sparc-unknown-none-elf +//@[sparc] needs-llvm-components: sparc +//@[sparcv8plus] compile-flags: --target sparc-unknown-linux-gnu +//@[sparcv8plus] needs-llvm-components: sparc +//@[sparc64] compile-flags: --target sparc64-unknown-linux-gnu +//@[sparc64] needs-llvm-components: sparc + +#![crate_type = "rlib"] +#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +#[rustc_builtin_macro] +macro_rules! asm { + () => {}; +} + +// CHECK-LABEL: @cc_clobber +// CHECK: call void asm sideeffect "", "~{icc},~{fcc0},~{fcc1},~{fcc2},~{fcc3}"() +#[no_mangle] +pub unsafe fn cc_clobber() { + asm!("", options(nostack, nomem)); +} + +// CHECK-LABEL: @no_clobber +// CHECK: call void asm sideeffect "", ""() +#[no_mangle] +pub unsafe fn no_clobber() { + asm!("", options(nostack, nomem, preserves_flags)); +} + +// CHECK-LABEL: @y_clobber +// CHECK: call void asm sideeffect "", "~{y}"() +#[no_mangle] +pub unsafe fn y_clobber() { + asm!("", out("y") _, options(nostack, nomem, preserves_flags)); +} diff --git a/tests/codegen/asm-clobber_abi.rs b/tests/codegen/asm/x86-clobber_abi.rs index cc563474bf8..cc563474bf8 100644 --- a/tests/codegen/asm-clobber_abi.rs +++ b/tests/codegen/asm/x86-clobber_abi.rs diff --git a/tests/codegen/asm-clobbers.rs b/tests/codegen/asm/x86-clobbers.rs index 4094db74134..4094db74134 100644 --- a/tests/codegen/asm-clobbers.rs +++ b/tests/codegen/asm/x86-clobbers.rs diff --git a/tests/codegen/asm-target-clobbers.rs b/tests/codegen/asm/x86-target-clobbers.rs index 119372491ff..119372491ff 100644 --- a/tests/codegen/asm-target-clobbers.rs +++ b/tests/codegen/asm/x86-target-clobbers.rs diff --git a/tests/codegen/binary-heap-peek-mut-pop-no-panic.rs b/tests/codegen/binary-heap-peek-mut-pop-no-panic.rs index 9cf4f210e52..e3bc9a4761c 100644 --- a/tests/codegen/binary-heap-peek-mut-pop-no-panic.rs +++ b/tests/codegen/binary-heap-peek-mut-pop-no-panic.rs @@ -1,5 +1,5 @@ //@ compile-flags: -O -//@ ignore-debug +//@ ignore-std-debug-assertions #![crate_type = "lib"] use std::collections::binary_heap::PeekMut; diff --git a/tests/codegen/branch-protection.rs b/tests/codegen/branch-protection.rs index 2f5ff9e98c2..945bad05625 100644 --- a/tests/codegen/branch-protection.rs +++ b/tests/codegen/branch-protection.rs @@ -1,11 +1,15 @@ // Test that the correct module flags are emitted with different branch protection flags. -//@ revisions: BTI PACRET LEAF BKEY NONE +//@ revisions: BTI PACRET LEAF BKEY PAUTHLR PAUTHLR_BKEY PAUTHLR_LEAF PAUTHLR_BTI NONE //@ needs-llvm-components: aarch64 //@ [BTI] compile-flags: -Z branch-protection=bti //@ [PACRET] compile-flags: -Z branch-protection=pac-ret //@ [LEAF] compile-flags: -Z branch-protection=pac-ret,leaf //@ [BKEY] compile-flags: -Z branch-protection=pac-ret,b-key +//@ [PAUTHLR] compile-flags: -Z branch-protection=pac-ret,pc +//@ [PAUTHLR_BKEY] compile-flags: -Z branch-protection=pac-ret,pc,b-key +//@ [PAUTHLR_LEAF] compile-flags: -Z branch-protection=pac-ret,pc,leaf +//@ [PAUTHLR_BTI] compile-flags: -Z branch-protection=bti,pac-ret,pc //@ compile-flags: --target aarch64-unknown-linux-gnu //@ min-llvm-version: 19 @@ -24,6 +28,7 @@ pub fn test() {} // BTI: attributes [[ATTR]] = {{.*}} "branch-target-enforcement" // BTI: !"branch-target-enforcement", i32 1 // BTI: !"sign-return-address", i32 0 +// BTI: !"branch-protection-pauth-lr", i32 0 // BTI: !"sign-return-address-all", i32 0 // BTI: !"sign-return-address-with-bkey", i32 0 @@ -31,6 +36,7 @@ pub fn test() {} // PACRET-SAME: "sign-return-address-key"="a_key" // PACRET: !"branch-target-enforcement", i32 0 // PACRET: !"sign-return-address", i32 1 +// PACRET: !"branch-protection-pauth-lr", i32 0 // PACRET: !"sign-return-address-all", i32 0 // PACRET: !"sign-return-address-with-bkey", i32 0 @@ -38,6 +44,7 @@ pub fn test() {} // LEAF-SAME: "sign-return-address-key"="a_key" // LEAF: !"branch-target-enforcement", i32 0 // LEAF: !"sign-return-address", i32 1 +// LEAF: !"branch-protection-pauth-lr", i32 0 // LEAF: !"sign-return-address-all", i32 1 // LEAF: !"sign-return-address-with-bkey", i32 0 @@ -45,9 +52,42 @@ pub fn test() {} // BKEY-SAME: "sign-return-address-key"="b_key" // BKEY: !"branch-target-enforcement", i32 0 // BKEY: !"sign-return-address", i32 1 +// BKEY: !"branch-protection-pauth-lr", i32 0 // BKEY: !"sign-return-address-all", i32 0 // BKEY: !"sign-return-address-with-bkey", i32 1 +// PAUTHLR: attributes [[ATTR]] = {{.*}} "sign-return-address"="non-leaf" +// PAUTHLR-SAME: "sign-return-address-key"="a_key" +// PAUTHLR: !"branch-target-enforcement", i32 0 +// PAUTHLR: !"sign-return-address", i32 1 +// PAUTHLR: !"branch-protection-pauth-lr", i32 1 +// PAUTHLR: !"sign-return-address-all", i32 0 +// PAUTHLR: !"sign-return-address-with-bkey", i32 0 + +// PAUTHLR_BKEY: attributes [[ATTR]] = {{.*}} "sign-return-address"="non-leaf" +// PAUTHLR_BKEY-SAME: "sign-return-address-key"="b_key" +// PAUTHLR_BKEY: !"branch-target-enforcement", i32 0 +// PAUTHLR_BKEY: !"sign-return-address", i32 1 +// PAUTHLR_BKEY: !"branch-protection-pauth-lr", i32 1 +// PAUTHLR_BKEY: !"sign-return-address-all", i32 0 +// PAUTHLR_BKEY: !"sign-return-address-with-bkey", i32 1 + +// PAUTHLR_LEAF: attributes [[ATTR]] = {{.*}} "sign-return-address"="all" +// PAUTHLR_LEAF-SAME: "sign-return-address-key"="a_key" +// PAUTHLR_LEAF: !"branch-target-enforcement", i32 0 +// PAUTHLR_LEAF: !"sign-return-address", i32 1 +// PAUTHLR_LEAF: !"branch-protection-pauth-lr", i32 1 +// PAUTHLR_LEAF: !"sign-return-address-all", i32 1 +// PAUTHLR_LEAF: !"sign-return-address-with-bkey", i32 0 + +// PAUTHLR_BTI: attributes [[ATTR]] = {{.*}} "sign-return-address"="non-leaf" +// PAUTHLR_BTI-SAME: "sign-return-address-key"="a_key" +// PAUTHLR_BTI: !"branch-target-enforcement", i32 1 +// PAUTHLR_BTI: !"sign-return-address", i32 1 +// PAUTHLR_BTI: !"branch-protection-pauth-lr", i32 1 +// PAUTHLR_BTI: !"sign-return-address-all", i32 0 +// PAUTHLR_BTI: !"sign-return-address-with-bkey", i32 0 + // NONE-NOT: branch-target-enforcement // NONE-NOT: sign-return-address // NONE-NOT: sign-return-address-all diff --git a/tests/codegen/clone_as_copy.rs b/tests/codegen/clone_as_copy.rs index 36a59ae56b7..6ba198297e2 100644 --- a/tests/codegen/clone_as_copy.rs +++ b/tests/codegen/clone_as_copy.rs @@ -1,4 +1,6 @@ //@ revisions: DEBUGINFO NODEBUGINFO +//@ compile-flags: -Zunsound-mir-opts +// FIXME: see <https://github.com/rust-lang/rust/issues/132353> //@ compile-flags: -O -Cno-prepopulate-passes //@ [DEBUGINFO] compile-flags: -Cdebuginfo=full diff --git a/tests/codegen/compiletest-self-test/minicore-smoke-test.rs b/tests/codegen/compiletest-self-test/minicore-smoke-test.rs new file mode 100644 index 00000000000..9dd1bf29c6c --- /dev/null +++ b/tests/codegen/compiletest-self-test/minicore-smoke-test.rs @@ -0,0 +1,20 @@ +//! Basic smoke test for `minicore` test auxiliary. + +//@ add-core-stubs +//@ compile-flags: --target=x86_64-unknown-linux-gnu +//@ needs-llvm-components: x86 + +#![crate_type = "lib"] +#![feature(no_core)] +#![no_std] +#![no_core] + +extern crate minicore; +use minicore::*; + +struct Meow; +impl Copy for Meow {} + +// CHECK-LABEL: meow +#[no_mangle] +fn meow() {} diff --git a/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs b/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs new file mode 100644 index 00000000000..159ecfd0974 --- /dev/null +++ b/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs @@ -0,0 +1,11 @@ +//@ force-host +//@ no-prefer-dynamic +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::*; + +#[proc_macro] +pub fn square_twice(_item: TokenStream) -> TokenStream { + "(square(env::vars().count() as i32), square(env::vars().count() as i32))".parse().unwrap() +} diff --git a/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs b/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs new file mode 100644 index 00000000000..c3858044c0c --- /dev/null +++ b/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs @@ -0,0 +1,53 @@ +//@ min-llvm-version: 19 +//@ compile-flags: -Cdebuginfo=2 -Copt-level=0 -Zmir-enable-passes=+Inline +// MSVC is different because of the individual allocas. +//@ ignore-msvc + +//@ aux-build:macro_def.rs + +// Find the variable. +// CHECK-DAG: ![[#var_dbg:]] = !DILocalVariable(name: "n",{{( arg: 1,)?}} scope: ![[#var_scope:]] + +// Find both dbg_declares. These will proceed the variable metadata, of course, so we're looking +// backwards. +// CHECK-DAG: dbg_declare(ptr %n.dbg.spill{{[0-9]}}, ![[#var_dbg]], !DIExpression(), ![[#var_loc2:]]) +// CHECK-DAG: dbg_declare(ptr %n.dbg.spill, ![[#var_dbg]], !DIExpression(), ![[#var_loc1:]]) + +// Find the first location definition, looking forwards again. +// CHECK: ![[#var_loc1]] = !DILocation +// CHECK-SAME: scope: ![[#var_scope:]], inlinedAt: ![[#var_inlinedAt1:]] + +// Find the first location's inlinedAt +// NB: If we fail here it's *probably* because we failed to produce two +// different locations and ended up reusing an earlier one. +// CHECK: ![[#var_inlinedAt1]] = !DILocation +// CHECK-SAME: scope: ![[var_inlinedAt1_scope:]] + +// Find the second location definition, still looking forwards. +// NB: If we failed to produce two different locations, the test will +// definitely fail by this point (if it hasn't already) because we won't +// be able to find the same line again. +// CHECK: ![[#var_loc2]] = !DILocation +// CHECK-SAME: scope: ![[#var_scope]], inlinedAt: ![[#var_inlinedAt2:]] + +// Find the second location's inlinedAt. +// CHECK: ![[#var_inlinedAt2]] = !DILocation +// CHECK-SAME: scope: ![[#var_inlinedAt2_scope:]] + +// Finally, check that a discriminator was emitted for the second scope. +// FIXMEkhuey ideally we would check that *either* scope has a discriminator +// but I don't know that it's possible to check that with FileCheck. +// CHECK: ![[#var_inlinedAt2_scope]] = !DILexicalBlockFile +// CHECK-SAME: discriminator: [[#]] +extern crate macro_def; + +use std::env; + +fn square(n: i32) -> i32 { + n * n +} + +fn main() { + let (z1, z2) = macro_def::square_twice!(); + println!("{z1} == {z2}"); +} diff --git a/tests/codegen/function-arguments.rs b/tests/codegen/function-arguments.rs index 7fa1d659885..503799d3ed2 100644 --- a/tests/codegen/function-arguments.rs +++ b/tests/codegen/function-arguments.rs @@ -1,5 +1,6 @@ //@ compile-flags: -O -C no-prepopulate-passes #![crate_type = "lib"] +#![feature(rustc_attrs)] #![feature(dyn_star)] #![feature(allocator_api)] @@ -143,13 +144,28 @@ pub fn indirect_struct(_: S) {} #[no_mangle] pub fn borrowed_struct(_: &S) {} -// CHECK: @option_borrow(ptr noalias noundef readonly align 4 dereferenceable_or_null(4) %x) +// CHECK: @option_borrow(ptr noalias noundef readonly align 4 dereferenceable_or_null(4) %_x) #[no_mangle] -pub fn option_borrow(x: Option<&i32>) {} +pub fn option_borrow(_x: Option<&i32>) {} -// CHECK: @option_borrow_mut(ptr noalias noundef align 4 dereferenceable_or_null(4) %x) +// CHECK: @option_borrow_mut(ptr noalias noundef align 4 dereferenceable_or_null(4) %_x) #[no_mangle] -pub fn option_borrow_mut(x: Option<&mut i32>) {} +pub fn option_borrow_mut(_x: Option<&mut i32>) {} + +// Function that must NOT have `dereferenceable` or `align`. +#[rustc_layout_scalar_valid_range_start(16)] +pub struct RestrictedAddress(&'static i16); +enum E { + A(RestrictedAddress), + B, + C, +} +// If the `nonnull` ever goes missing, you might have to tweak the +// scalar_valid_range on `RestrictedAddress` to get it back. You +// might even have to add a `rustc_layout_scalar_valid_range_end`. +// CHECK: @nonnull_and_nondereferenceable(ptr noundef nonnull %_x) +#[no_mangle] +pub fn nonnull_and_nondereferenceable(_x: E) {} // CHECK: @raw_struct(ptr noundef %_1) #[no_mangle] diff --git a/tests/codegen/issues/issue-64219-fn-ptr-call-returning-never-is-noreturn.rs b/tests/codegen/issues/issue-64219-fn-ptr-call-returning-never-is-noreturn.rs new file mode 100644 index 00000000000..86d020e1751 --- /dev/null +++ b/tests/codegen/issues/issue-64219-fn-ptr-call-returning-never-is-noreturn.rs @@ -0,0 +1,19 @@ +//! Test for https://github.com/rust-lang/rust/issues/64219 +//! Check if `noreturn` attribute is applied on calls to +//! function pointers returning `!` (never type). + +#![crate_type = "lib"] + +extern "C" { + static FOO: fn() -> !; +} + +// CHECK-LABEL: @foo +#[no_mangle] +pub unsafe fn foo() { + // CHECK: call + // CHECK-SAME: [[NUM:#[0-9]+$]] + FOO(); +} + +// CHECK: attributes [[NUM]] = {{{.*}} noreturn {{.*}}} diff --git a/tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs b/tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs new file mode 100644 index 00000000000..a8fab61b13e --- /dev/null +++ b/tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs @@ -0,0 +1,26 @@ +//@ compile-flags: -O +//! Test for https://github.com/rust-lang/rust/issues/86109 +//! Check LLVM can eliminate the impossible division by zero check by +//! ensuring there is no call (to panic) instruction. +//! +//! This has been fixed since `rustc 1.70.0`. + +#![crate_type = "lib"] + +type T = i16; + +// CHECK-LABEL: @foo +#[no_mangle] +pub fn foo(start: T) -> T { + // CHECK-NOT: panic + if start <= 0 { + return 0; + } + let mut count = 0; + for i in start..10_000 { + if 752 % i != 0 { + count += 1; + } + } + count +} diff --git a/tests/codegen/mem-replace-big-type.rs b/tests/codegen/mem-replace-big-type.rs index e62f1a953df..e62adfa0ba6 100644 --- a/tests/codegen/mem-replace-big-type.rs +++ b/tests/codegen/mem-replace-big-type.rs @@ -4,7 +4,8 @@ // known to be `1` after inlining). //@ compile-flags: -C no-prepopulate-passes -Zinline-mir=no -//@ ignore-debug: precondition checks in ptr::read make them a bad candidate for MIR inlining +//@ ignore-std-debug-assertions +// Reason: precondition checks in ptr::read make them a bad candidate for MIR inlining //@ needs-deterministic-layouts #![crate_type = "lib"] diff --git a/tests/codegen/mem-replace-simple-type.rs b/tests/codegen/mem-replace-simple-type.rs index 7209fa21925..41c3660dc15 100644 --- a/tests/codegen/mem-replace-simple-type.rs +++ b/tests/codegen/mem-replace-simple-type.rs @@ -1,6 +1,7 @@ //@ compile-flags: -O -C no-prepopulate-passes //@ only-x86_64 (to not worry about usize differing) -//@ ignore-debug: precondition checks make mem::replace not a candidate for MIR inlining +//@ ignore-std-debug-assertions +// Reason: precondition checks make mem::replace not a candidate for MIR inlining #![crate_type = "lib"] diff --git a/tests/codegen/repr/transparent-opaque-ptr.rs b/tests/codegen/repr/transparent-opaque-ptr.rs index 4e7b38bca39..29c03f0d5d9 100644 --- a/tests/codegen/repr/transparent-opaque-ptr.rs +++ b/tests/codegen/repr/transparent-opaque-ptr.rs @@ -1,12 +1,12 @@ -//@ revisions: aarch64-linux aarch64-darwin wasm32-wasi +//@ revisions: aarch64-linux aarch64-darwin wasm32-wasip1 //@ compile-flags: -O -C no-prepopulate-passes //@[aarch64-linux] compile-flags: --target aarch64-unknown-linux-gnu //@[aarch64-linux] needs-llvm-components: aarch64 //@[aarch64-darwin] compile-flags: --target aarch64-apple-darwin //@[aarch64-darwin] needs-llvm-components: aarch64 -//@[wasm32-wasi] compile-flags: --target wasm32-wasi -//@[wasm32-wasi] needs-llvm-components: webassembly +//@[wasm32-wasip1] compile-flags: --target wasm32-wasip1 +//@[wasm32-wasip1] needs-llvm-components: webassembly // See ./transparent.rs // Some platforms pass large aggregates using immediate arrays in LLVMIR diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs index 81ac90269b7..e9112f1f321 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs @@ -31,7 +31,7 @@ extern "rust-intrinsic" { // CHECK-LABEL: @bitmask_int #[no_mangle] pub unsafe fn bitmask_int(x: i32x2) -> u8 { - // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> %{{x|1}}, <i32 31, i32 31> + // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> %{{x|1}}, {{<i32 31, i32 31>|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> // CHECK: [[C:%[0-9]+]] = bitcast <2 x i1> [[B]] to i2 // CHECK: %{{[0-9]+}} = zext i2 [[C]] to i8 @@ -41,7 +41,7 @@ pub unsafe fn bitmask_int(x: i32x2) -> u8 { // CHECK-LABEL: @bitmask_uint #[no_mangle] pub unsafe fn bitmask_uint(x: u32x2) -> u8 { - // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> %{{x|1}}, <i32 31, i32 31> + // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> %{{x|1}}, {{<i32 31, i32 31>|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> // CHECK: [[C:%[0-9]+]] = bitcast <2 x i1> [[B]] to i2 // CHECK: %{{[0-9]+}} = zext i2 [[C]] to i8 @@ -51,7 +51,7 @@ pub unsafe fn bitmask_uint(x: u32x2) -> u8 { // CHECK-LABEL: @bitmask_int16 #[no_mangle] pub unsafe fn bitmask_int16(x: i8x16) -> u16 { - // CHECK: [[A:%[0-9]+]] = lshr <16 x i8> %{{x|1|2}}, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7> + // CHECK: [[A:%[0-9]+]] = lshr <16 x i8> %{{x|1|2}}, {{<i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>|splat \(i8 7\)}} // CHECK: [[B:%[0-9]+]] = trunc <16 x i8> [[A]] to <16 x i1> // CHECK: %{{[0-9]+}} = bitcast <16 x i1> [[B]] to i16 // CHECK-NOT: zext diff --git a/tests/codegen/slice-reverse.rs b/tests/codegen/slice-reverse.rs index 21add929f05..87cdad47962 100644 --- a/tests/codegen/slice-reverse.rs +++ b/tests/codegen/slice-reverse.rs @@ -1,6 +1,6 @@ //@ compile-flags: -O //@ only-x86_64 -//@ ignore-debug: debug assertions prevent generating shufflevector +//@ ignore-std-debug-assertions (debug assertions prevent generating shufflevector) #![crate_type = "lib"] diff --git a/tests/codegen/try_question_mark_nop.rs b/tests/codegen/try_question_mark_nop.rs index 65167f5c5af..b68ecce869e 100644 --- a/tests/codegen/try_question_mark_nop.rs +++ b/tests/codegen/try_question_mark_nop.rs @@ -5,6 +5,7 @@ //@[NINETEEN] min-llvm-version: 19 //@[NINETEEN] ignore-llvm-version: 20-99 //@[TWENTY] min-llvm-version: 20 +//@ min-llvm-version: 19 #![crate_type = "lib"] #![feature(try_blocks)] @@ -16,12 +17,12 @@ use std::ptr::NonNull; #[no_mangle] pub fn option_nop_match_32(x: Option<u32>) -> Option<u32> { // CHECK: start: - // NINETEEN-NEXT: [[TRUNC:%.*]] = trunc nuw i32 %0 to i1 - // NINETEEN-NEXT: [[FIRST:%.*]] = select i1 [[TRUNC]], i32 %0 - // NINETEEN-NEXT: insertvalue { i32, i32 } poison, i32 [[FIRST]], 0 - // TWENTY-NEXT: insertvalue { i32, i32 } poison, i32 %0, 0 - // CHECK-NEXT: insertvalue { i32, i32 } - // CHECK-NEXT: ret { i32, i32 } + // TWENTY-NEXT: %trunc = trunc nuw i32 %0 to i1 + // TWENTY-NEXT: %.2 = select i1 %trunc, i32 %1, i32 undef + // CHECK-NEXT: [[REG1:%.*]] = insertvalue { i32, i32 } poison, i32 %0, 0 + // NINETEEN-NEXT: [[REG2:%.*]] = insertvalue { i32, i32 } [[REG1]], i32 %1, 1 + // TWENTY-NEXT: [[REG2:%.*]] = insertvalue { i32, i32 } [[REG1]], i32 %.2, 1 + // CHECK-NEXT: ret { i32, i32 } [[REG2]] match x { Some(x) => Some(x), None => None, @@ -32,6 +33,8 @@ pub fn option_nop_match_32(x: Option<u32>) -> Option<u32> { #[no_mangle] pub fn option_nop_traits_32(x: Option<u32>) -> Option<u32> { // CHECK: start: + // TWENTY-NEXT: %trunc = trunc nuw i32 %0 to i1 + // TWENTY-NEXT: %.1 = select i1 %trunc, i32 %1, i32 undef // CHECK-NEXT: insertvalue { i32, i32 } // CHECK-NEXT: insertvalue { i32, i32 } // CHECK-NEXT: ret { i32, i32 } diff --git a/tests/codegen/vec-in-place.rs b/tests/codegen/vec-in-place.rs index c6b77363a4e..5d05f242617 100644 --- a/tests/codegen/vec-in-place.rs +++ b/tests/codegen/vec-in-place.rs @@ -1,4 +1,4 @@ -//@ ignore-debug: FIXME: checks for call detect scoped noalias metadata +//@ ignore-std-debug-assertions (FIXME: checks for call detect scoped noalias metadata) //@ compile-flags: -O -Z merge-functions=disabled #![crate_type = "lib"] diff --git a/tests/codegen/vec-shrink-panik.rs b/tests/codegen/vec-shrink-panik.rs index 4b798fe6c9c..873904c2569 100644 --- a/tests/codegen/vec-shrink-panik.rs +++ b/tests/codegen/vec-shrink-panik.rs @@ -1,7 +1,7 @@ // LLVM 17 realizes double panic is not possible and doesn't generate calls // to panic_cannot_unwind. //@ compile-flags: -O -//@ ignore-debug: plain old debug assertions +//@ ignore-std-debug-assertions (plain old debug assertions) //@ needs-unwind #![crate_type = "lib"] #![feature(shrink_to)] diff --git a/tests/codegen/vec-with-capacity.rs b/tests/codegen/vec-with-capacity.rs index 47051f2eef8..e8c5bc88bd0 100644 --- a/tests/codegen/vec-with-capacity.rs +++ b/tests/codegen/vec-with-capacity.rs @@ -1,5 +1,5 @@ //@ compile-flags: -O -//@ ignore-debug +//@ ignore-std-debug-assertions // (with debug assertions turned on, `assert_unchecked` generates a real assertion) #![crate_type = "lib"] diff --git a/tests/codegen/vecdeque-drain.rs b/tests/codegen/vecdeque-drain.rs index fca1ed367e6..8a34ba0674b 100644 --- a/tests/codegen/vecdeque-drain.rs +++ b/tests/codegen/vecdeque-drain.rs @@ -2,7 +2,7 @@ //@ compile-flags: -O //@ needs-deterministic-layouts -//@ ignore-debug: FIXME: checks for call detect scoped noalias metadata +//@ ignore-std-debug-assertions (FIXME: checks for call detect scoped noalias metadata) #![crate_type = "lib"] diff --git a/tests/codegen/vecdeque_no_panic.rs b/tests/codegen/vecdeque_no_panic.rs index be2c4810ebc..da948d12254 100644 --- a/tests/codegen/vecdeque_no_panic.rs +++ b/tests/codegen/vecdeque_no_panic.rs @@ -1,7 +1,7 @@ // This test checks that `VecDeque::front[_mut]()` and `VecDeque::back[_mut]()` can't panic. //@ compile-flags: -O -//@ ignore-debug: plain old debug assertions +//@ ignore-std-debug-assertions (plain old debug assertions) #![crate_type = "lib"] diff --git a/tests/coverage/auxiliary/inline_mixed_helper.rs b/tests/coverage/auxiliary/inline_mixed_helper.rs new file mode 100644 index 00000000000..1e91ab8ce7c --- /dev/null +++ b/tests/coverage/auxiliary/inline_mixed_helper.rs @@ -0,0 +1,13 @@ +//@ edition: 2021 +//@ compile-flags: -Cinstrument-coverage=on + +#[inline] +pub fn inline_me() {} + +#[inline(never)] +pub fn no_inlining_please() {} + +pub fn generic<T>() {} + +// FIXME(#132436): Even though this doesn't ICE, it still produces coverage +// reports that undercount the affected code. diff --git a/tests/coverage/inline_mixed.rs b/tests/coverage/inline_mixed.rs new file mode 100644 index 00000000000..163cc7d7d6c --- /dev/null +++ b/tests/coverage/inline_mixed.rs @@ -0,0 +1,19 @@ +//@ edition: 2021 +//@ compile-flags: -Cinstrument-coverage=off +//@ ignore-coverage-run +//@ aux-crate: inline_mixed_helper=inline_mixed_helper.rs + +// Regression test for <https://github.com/rust-lang/rust/pull/132395>. +// Various forms of cross-crate inlining can cause coverage statements to be +// inlined into crates that are being built without coverage instrumentation. +// At the very least, we need to not ICE when that happens. + +fn main() { + inline_mixed_helper::inline_me(); + inline_mixed_helper::no_inlining_please(); + inline_mixed_helper::generic::<u32>(); +} + +// FIXME(#132437): We currently don't test this in coverage-run mode, because +// whether or not it produces a `.profraw` file appears to differ between +// platforms. diff --git a/tests/crashes/112623.rs b/tests/crashes/112623.rs index fc7361bfcb2..592ad742e5f 100644 --- a/tests/crashes/112623.rs +++ b/tests/crashes/112623.rs @@ -1,6 +1,6 @@ //@ known-bug: #112623 -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Value { diff --git a/tests/crashes/119701.rs b/tests/crashes/119701.rs index 5f681bb8da8..bdb326ea76b 100644 --- a/tests/crashes/119701.rs +++ b/tests/crashes/119701.rs @@ -1,5 +1,5 @@ //@ known-bug: #119701 -#![feature(const_trait_impl, effects, generic_const_exprs)] +#![feature(const_trait_impl, generic_const_exprs)] fn main() { let _ = process::<()>([()]); diff --git a/tests/crashes/121411.rs b/tests/crashes/121411.rs index ef7b16579dd..2456910e6fa 100644 --- a/tests/crashes/121411.rs +++ b/tests/crashes/121411.rs @@ -1,5 +1,5 @@ //@ known-bug: #121411 -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Foo { diff --git a/tests/crashes/125249.rs b/tests/crashes/125249.rs deleted file mode 100644 index 1cf6338a0d6..00000000000 --- a/tests/crashes/125249.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ known-bug: rust-lang/rust#125185 -#![feature(return_position_impl_trait_in_trait, return_type_notation)] - -trait IntFactory { - fn stream(&self) -> impl IntFactory<stream(..): IntFactory<stream(..): Send> + Send>; -} - -pub fn main() {} diff --git a/tests/crashes/126268.rs b/tests/crashes/126268.rs new file mode 100644 index 00000000000..82e52fa115d --- /dev/null +++ b/tests/crashes/126268.rs @@ -0,0 +1,18 @@ +//@ known-bug: #126268 +#![feature(min_specialization)] + +trait Trait {} + +impl<T> Trait for T {} + +trait Data { + type Elem; +} + +struct DatasetIter<'a, R: Data> { + data: &'a R::Elem, +} + +pub struct ArrayBase {} + +impl<'a> Trait for DatasetIter<'a, ArrayBase> {} diff --git a/tests/crashes/126725.rs b/tests/crashes/126725.rs deleted file mode 100644 index d7a7d21ae42..00000000000 --- a/tests/crashes/126725.rs +++ /dev/null @@ -1,20 +0,0 @@ -//@ known-bug: rust-lang/rust#126725 -trait Foo { - fn foo<'a>(&'a self) -> <&'a impl Sized as Bar>::Output; -} - -trait Bar { - type Output; -} - -struct X(i32); - -impl<'a> Bar for &'a X { - type Output = &'a i32; -} - -impl Foo for X { - fn foo<'a>(&'a self) -> <&'a Self as Bar>::Output { - &self.0 - } -} diff --git a/tests/crashes/131050.rs b/tests/crashes/131050.rs index 07f8662d016..3e3a600ef3d 100644 --- a/tests/crashes/131050.rs +++ b/tests/crashes/131050.rs @@ -1,25 +1,21 @@ //@ known-bug: #131050 //@ compile-flags: --edition=2021 -fn query_as<D>() {} +use std::future::Future; -async fn create_user() { - query_as(); -} +fn invalid_future() -> impl Future {} -async fn post_user_filter() -> impl Filter { - AndThen(&(), || async { create_user().await }) +fn create_complex_future() -> impl Future<Output = impl ReturnsSend> { + async { &|| async { invalid_future().await } } } -async fn get_app() -> impl Send { - post_user_filter().await +fn coerce_impl_trait() -> impl Future<Output = impl Send> { + create_complex_future() } -trait Filter {} - -struct AndThen<T, F>(T, F); +trait ReturnsSend {} -impl<T, F, R> Filter for AndThen<T, F> +impl<F, R> ReturnsSend for F where F: Fn() -> R, R: Send, diff --git a/tests/crashes/131342-2.rs b/tests/crashes/131342-2.rs deleted file mode 100644 index 79b6a837a49..00000000000 --- a/tests/crashes/131342-2.rs +++ /dev/null @@ -1,40 +0,0 @@ -//@ known-bug: #131342 -// see also: 131342.rs - -fn main() { - problem_thingy(Once); -} - -struct Once; - -impl Iterator for Once { - type Item = (); -} - -fn problem_thingy(items: impl Iterator) { - let peeker = items.peekable(); - problem_thingy(&peeker); -} - -trait Iterator { - type Item; - - fn peekable(self) -> Peekable<Self> - where - Self: Sized, - { - loop {} - } -} - -struct Peekable<I: Iterator> { - _peeked: I::Item, -} - -impl<I: Iterator> Iterator for Peekable<I> { - type Item = I::Item; -} - -impl<I: Iterator + ?Sized> Iterator for &I { - type Item = I::Item; -} diff --git a/tests/crashes/131342.rs b/tests/crashes/131342.rs index 7f7ee9c9ac1..f4404092917 100644 --- a/tests/crashes/131342.rs +++ b/tests/crashes/131342.rs @@ -1,16 +1,15 @@ //@ known-bug: #131342 -// see also: 131342-2.rs fn main() { - let mut items = vec![1, 2, 3, 4, 5].into_iter(); - problem_thingy(&mut items); + let mut items = vec![1, 2, 3, 4, 5].into_iter(); + problem_thingy(&mut items); } fn problem_thingy(items: &mut impl Iterator<Item = u8>) { - let mut peeker = items.peekable(); - match peeker.peek() { - Some(_) => (), - None => return (), - } - problem_thingy(&mut peeker); + let mut peeker = items.peekable(); + match peeker.peek() { + Some(_) => (), + None => return (), + } + problem_thingy(&mut peeker); } diff --git a/tests/crashes/132126.rs b/tests/crashes/132126.rs new file mode 100644 index 00000000000..6a42853d469 --- /dev/null +++ b/tests/crashes/132126.rs @@ -0,0 +1,2 @@ +//@ known-bug: #132126 +trait UnsafeCopy where Self: use<Self> {} diff --git a/tests/crashes/132127.rs b/tests/crashes/132127.rs new file mode 100644 index 00000000000..cca354b9876 --- /dev/null +++ b/tests/crashes/132127.rs @@ -0,0 +1,9 @@ +//@ known-bug: #132127 +#![feature(dyn_star)] + +trait Trait {} + +fn main() { + let x: dyn* Trait + Send = 1usize; + x as dyn* Trait; +} diff --git a/tests/crashes/132142.rs b/tests/crashes/132142.rs new file mode 100644 index 00000000000..9a026f3bca7 --- /dev/null +++ b/tests/crashes/132142.rs @@ -0,0 +1,3 @@ +//@ known-bug: #132142 + +async extern "C-cmse-nonsecure-entry" fn fun(...) {} diff --git a/tests/crashes/132320.rs b/tests/crashes/132320.rs new file mode 100644 index 00000000000..79181c3a2c5 --- /dev/null +++ b/tests/crashes/132320.rs @@ -0,0 +1,15 @@ +//@ known-bug: #132320 +//@ compile-flags: -Znext-solver=globally + +trait Foo { + type Item; + fn foo(&mut self); +} + +impl Foo for () { + type Item = Option<()>; + + fn foo(&mut self) { + let _ = Self::Item::None; + } +} diff --git a/tests/crashes/132330.rs b/tests/crashes/132330.rs new file mode 100644 index 00000000000..3432685749d --- /dev/null +++ b/tests/crashes/132330.rs @@ -0,0 +1,28 @@ +//@ known-bug: #132330 +//@compile-flags: -Znext-solver=globally + +trait Service { + type S; +} + +trait Framing { + type F; +} + +impl Framing for () { + type F = (); +} + +trait HttpService<F: Framing>: Service<S = F::F> {} + +type BoxService = Box<dyn HttpService<(), S = ()>>; + +fn build_server<F: FnOnce() -> BoxService>(_: F) {} + +fn make_server<F: Framing>() -> Box<dyn HttpService<F, S = F::F>> { + unimplemented!() +} + +fn main() { + build_server(|| make_server()) +} diff --git a/tests/crashes/132335.rs b/tests/crashes/132335.rs new file mode 100644 index 00000000000..2294539cfcf --- /dev/null +++ b/tests/crashes/132335.rs @@ -0,0 +1,13 @@ +//@ known-bug: #132335 +//@ compile-flags: -Znext-solver=globally --crate-type lib --edition=2018 +use core::future::Future; +use core::pin::Pin; + +pub trait Unit {} +impl Unit for () {} + +pub fn get_all_files_in_dir() -> Pin<Box<dyn Future<Output = impl Unit>>> { + Box::pin(async { + get_all_files_in_dir().await; + }) +} diff --git a/tests/crashes/132391.rs b/tests/crashes/132391.rs new file mode 100644 index 00000000000..6c8c2c3a878 --- /dev/null +++ b/tests/crashes/132391.rs @@ -0,0 +1,8 @@ +//@ known-bug: #123291 + +trait MyTrait { + #[repr(align)] + fn myfun(); +} + +pub fn main() {} diff --git a/tests/crashes/132430.rs b/tests/crashes/132430.rs new file mode 100644 index 00000000000..995bdf06224 --- /dev/null +++ b/tests/crashes/132430.rs @@ -0,0 +1,9 @@ +//@ known-bug: #132430 + +//@compile-flags: --edition=2018 --crate-type=lib +#![feature(cmse_nonsecure_entry)] +struct Test; + +impl Test { + pub async unsafe extern "C-cmse-nonsecure-entry" fn test(val: &str) {} +} diff --git a/tests/crashes/132530.rs b/tests/crashes/132530.rs new file mode 100644 index 00000000000..b43da62bfc1 --- /dev/null +++ b/tests/crashes/132530.rs @@ -0,0 +1,9 @@ +//@ known-bug: #132530 + +#![feature(non_lifetime_binders)] + +trait Trait<'a, A> { + type Assoc<'a> = i32; +} + +fn a() -> impl for<T> Trait<Assoc = impl Trait<T>> {} diff --git a/tests/crashes/23707.rs b/tests/crashes/23707.rs deleted file mode 100644 index 4105933c60f..00000000000 --- a/tests/crashes/23707.rs +++ /dev/null @@ -1,109 +0,0 @@ -//@ known-bug: #23707 -//@ compile-flags: -Copt-level=0 --edition=2021 -//@ only-x86_64 -#![recursion_limit="2048"] - -use std::marker::PhantomData; -use std::fmt; -use std::fmt::Debug; - -pub struct Z( () ); -pub struct S<T> (PhantomData<T>); - - -pub trait Nat { - fn sing() -> Self; - fn get(&self) -> usize; -} - -impl Nat for Z { - fn sing() -> Z { Z( () ) } - #[inline(always)] - fn get(&self) -> usize { - 0 - } -} - -impl<T : Nat> Nat for S<T> { - fn sing() -> S<T> { S::<T>( PhantomData::<T> ) } - #[inline(always)] - fn get(&self) -> usize { - let prd : T = Nat::sing(); - 1 + prd.get() - } -} - -pub type N0 = Z; -pub type N1 = S<N0>; -pub type N2 = S<N1>; -pub type N3 = S<N2>; -pub type N4 = S<N3>; -pub type N5 = S<N4>; - - -pub struct Node<D : Nat>(usize,PhantomData<D>); - -impl<D:Nat> Node<D> { - pub fn push(&self, c : usize) -> Node<S<D>> { - let Node(i,_) = *self; - Node(10*i+c, PhantomData::<S<D>>) - } -} - -impl<D:Nat> Node<S<D>> { - pub fn pop(&self) -> (Node<D>,usize) { - let Node(i,_) = *self; - (Node(i/10, PhantomData::<D>), i-10*(i/10)) - } -} - -impl<D:Nat> Debug for Node<D> { - fn fmt(&self, f : &mut fmt::Formatter) -> fmt::Result { - let s : D = Nat::sing(); - write!(f, "Node<{}>: i= {}", - s.get(), self.0) - } -} -pub trait Step { - fn step(&self, usize) -> Self; -} - -impl Step for Node<N0> { - #[inline(always)] - fn step(&self, n : usize) -> Node<N0> { - println!("base case"); - Node(n,PhantomData::<N0>) - } -} - -impl<D:Nat> Step for Node<S<D>> - where Node<D> : Step { - #[inline(always)] - fn step(&self, n : usize) -> Node<S<D>> { - println!("rec"); - let (par,c) = self.pop(); - let cnew = c+n; - par.step(c).push(cnew) - } - -} - -fn tst<D:Nat>(ref p : &Node<D>, c : usize) -> usize - where Node<D> : Step { - let Node(i,_) = p.step(c); - i -} - - - -fn main() { - let nd : Node<N3> = Node(555,PhantomData::<N3>); - - // overflow...core::marker::Size - let Node(g,_) = tst(nd,1); - - // ok - //let Node(g,_) = nd.step(1); - - println!("{:?}", g); -} diff --git a/tests/crashes/README.md b/tests/crashes/README.md index 71ce9b2eca6..2dc81a115df 100644 --- a/tests/crashes/README.md +++ b/tests/crashes/README.md @@ -8,7 +8,7 @@ A test will "pass" if rustc exits with something other than 1 or 0. When adding crashes from https://github.com/rust-lang/rust/issues, the issue number should be noted in the file name (12345.rs should suffice) -and perhaps also inside the file via `//@ known-bug #4321` +and also inside the file via `//@ known-bug #4321` if possible. If you happen to fix one of the crashes, please move it to a fitting subdirectory in `tests/ui` and give it a meaningful name. @@ -21,3 +21,5 @@ to the description of your pull request will ensure the corresponding tickets will be closed automatically upon merge. The ticket ids can be found in the file name or the `known-bug` annotation inside the testfile. + +Please do not re-report any crashes that you find here! diff --git a/tests/mir-opt/gvn_clone.rs b/tests/mir-opt/gvn_clone.rs index 08938c0e1b4..c16b665fbd3 100644 --- a/tests/mir-opt/gvn_clone.rs +++ b/tests/mir-opt/gvn_clone.rs @@ -1,3 +1,5 @@ +//@ compile-flags: -Zunsound-mir-opts +// FIXME: see <https://github.com/rust-lang/rust/issues/132353> //@ test-mir-pass: GVN //@ compile-flags: -Zmir-enable-passes=+InstSimplify-before-inline diff --git a/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff b/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff index 57b0980a0bd..8d5991872e1 100644 --- a/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff +++ b/tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff @@ -1,7 +1,7 @@ -- // MIR for `<impl at $DIR/gvn_clone.rs:12:10: 12:15>::clone` before GVN -+ // MIR for `<impl at $DIR/gvn_clone.rs:12:10: 12:15>::clone` after GVN +- // MIR for `<impl at $DIR/gvn_clone.rs:14:10: 14:15>::clone` before GVN ++ // MIR for `<impl at $DIR/gvn_clone.rs:14:10: 14:15>::clone` after GVN - fn <impl at $DIR/gvn_clone.rs:12:10: 12:15>::clone(_1: &AllCopy) -> AllCopy { + fn <impl at $DIR/gvn_clone.rs:14:10: 14:15>::clone(_1: &AllCopy) -> AllCopy { debug self => _1; let mut _0: AllCopy; let mut _2: i32; diff --git a/tests/mir-opt/gvn_copy_aggregate.rs b/tests/mir-opt/gvn_copy_aggregate.rs index c9473025a15..7c181d1ad37 100644 --- a/tests/mir-opt/gvn_copy_aggregate.rs +++ b/tests/mir-opt/gvn_copy_aggregate.rs @@ -1,3 +1,5 @@ +//@ compile-flags: -Zunsound-mir-opts +// FIXME: see <https://github.com/rust-lang/rust/issues/132353. //@ test-mir-pass: GVN //@ compile-flags: -Cpanic=abort diff --git a/tests/mir-opt/pre-codegen/clone_as_copy.rs b/tests/mir-opt/pre-codegen/clone_as_copy.rs index f5ff1854d38..ae4661e93fd 100644 --- a/tests/mir-opt/pre-codegen/clone_as_copy.rs +++ b/tests/mir-opt/pre-codegen/clone_as_copy.rs @@ -1,3 +1,5 @@ +//@ compile-flags: -Zunsound-mir-opts +// FIXME: see <https://github.com/rust-lang/rust/issues/132353> //@ compile-flags: -Cdebuginfo=full // Check if we have transformed the nested clone to the copy in the complete pipeline. diff --git a/tests/mir-opt/pre-codegen/mem_replace.rs b/tests/mir-opt/pre-codegen/mem_replace.rs index a68fe31f609..be23dcdb22a 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.rs +++ b/tests/mir-opt/pre-codegen/mem_replace.rs @@ -1,6 +1,7 @@ // skip-filecheck //@ compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 -Zinline-mir -//@ ignore-debug: precondition checks on ptr::read/write are under cfg(debug_assertions) +//@ ignore-std-debug-assertions +// Reason: precondition checks on ptr::read/write are under cfg(debug_assertions) // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir index 9020cf1ef37..62a9cd9131f 100644 --- a/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir @@ -3,9 +3,13 @@ fn <impl at $DIR/no_inlined_clone.rs:9:10: 9:15>::clone(_1: &Foo) -> Foo { debug self => _1; let mut _0: Foo; + let mut _2: i32; bb0: { - _0 = copy (*_1); + StorageLive(_2); + _2 = copy ((*_1).0: i32); + _0 = Foo { a: move _2 }; + StorageDead(_2); return; } } diff --git a/tests/mir-opt/pre-codegen/ptr_offset.rs b/tests/mir-opt/pre-codegen/ptr_offset.rs index 88ee00296a0..120be99fc94 100644 --- a/tests/mir-opt/pre-codegen/ptr_offset.rs +++ b/tests/mir-opt/pre-codegen/ptr_offset.rs @@ -1,6 +1,6 @@ // skip-filecheck //@ compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 -Zinline-mir -//@ ignore-debug: precondition checks are under cfg(debug_assertions) +//@ ignore-std-debug-assertions (precondition checks are under cfg(debug_assertions)) // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs index fee4214982d..46ded729852 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.rs +++ b/tests/mir-opt/pre-codegen/slice_iter.rs @@ -1,7 +1,7 @@ // skip-filecheck //@ compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 //@ only-64bit (constants for `None::<&T>` show in the output) -//@ ignore-debug: precondition checks on ptr::add are under cfg(debug_assertions) +//@ ignore-std-debug-assertions (precondition checks on ptr::add are under cfg(debug_assertions)) // EMIT_MIR_FOR_EACH_PANIC_STRATEGY #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir index 889e80d26e1..ac485f485b1 100644 --- a/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir @@ -19,14 +19,14 @@ fn old(_1: Result<T, E>) -> Result<T, E> { } bb1: { - _3 = copy ((_1 as Ok).0: T); - _0 = copy _1; + _3 = move ((_1 as Ok).0: T); + _0 = Result::<T, E>::Ok(copy _3); goto -> bb3; } bb2: { - _4 = copy ((_1 as Err).0: E); - _0 = copy _1; + _4 = move ((_1 as Err).0: E); + _0 = Result::<T, E>::Err(copy _4); goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir index 4d964b0afb7..c3091bd4395 100644 --- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir @@ -7,7 +7,7 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { debug self => _1; scope 2 (inlined Vec::<u8>::as_slice) { debug self => _1; - let mut _6: usize; + let mut _7: usize; scope 3 (inlined Vec::<u8>::as_ptr) { debug self => _1; let mut _2: &alloc::raw_vec::RawVec<u8>; @@ -16,6 +16,7 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { let mut _3: &alloc::raw_vec::RawVecInner; scope 5 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) { debug self => _3; + let mut _6: std::ptr::NonNull<u8>; scope 6 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) { debug self => _3; let mut _4: std::ptr::NonNull<u8>; @@ -31,20 +32,20 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { } } scope 10 (inlined Unique::<u8>::as_non_null_ptr) { - debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4; + debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _6; debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>; } } scope 11 (inlined NonNull::<u8>::as_ptr) { - debug self => _4; + debug self => _6; } } } } scope 12 (inlined std::slice::from_raw_parts::<'_, u8>) { debug data => _5; - debug len => _6; - let _7: *const [u8]; + debug len => _7; + let _8: *const [u8]; scope 13 (inlined core::ub_checks::check_language_ub) { scope 14 (inlined core::ub_checks::check_language_ub::runtime) { } @@ -55,10 +56,10 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { } scope 17 (inlined slice_from_raw_parts::<u8>) { debug data => _5; - debug len => _6; + debug len => _7; scope 18 (inlined std::ptr::from_raw_parts::<[u8], u8>) { debug data_pointer => _5; - debug metadata => _6; + debug metadata => _7; } } } @@ -70,17 +71,22 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { _2 = &((*_1).0: alloc::raw_vec::RawVec<u8>); StorageLive(_3); _3 = &(((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner); + StorageLive(_6); + StorageLive(_4); _4 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>); _5 = copy (_4.0: *const u8); + _6 = NonNull::<u8> { pointer: copy _5 }; + StorageDead(_4); + StorageDead(_6); StorageDead(_3); StorageDead(_2); - StorageLive(_6); - _6 = copy ((*_1).1: usize); StorageLive(_7); - _7 = *const [u8] from (copy _5, copy _6); - _0 = &(*_7); + _7 = copy ((*_1).1: usize); + StorageLive(_8); + _8 = *const [u8] from (copy _5, copy _7); + _0 = &(*_8); + StorageDead(_8); StorageDead(_7); - StorageDead(_6); return; } } diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir index 4d964b0afb7..c3091bd4395 100644 --- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir @@ -7,7 +7,7 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { debug self => _1; scope 2 (inlined Vec::<u8>::as_slice) { debug self => _1; - let mut _6: usize; + let mut _7: usize; scope 3 (inlined Vec::<u8>::as_ptr) { debug self => _1; let mut _2: &alloc::raw_vec::RawVec<u8>; @@ -16,6 +16,7 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { let mut _3: &alloc::raw_vec::RawVecInner; scope 5 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) { debug self => _3; + let mut _6: std::ptr::NonNull<u8>; scope 6 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) { debug self => _3; let mut _4: std::ptr::NonNull<u8>; @@ -31,20 +32,20 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { } } scope 10 (inlined Unique::<u8>::as_non_null_ptr) { - debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _4; + debug ((self: Unique<u8>).0: std::ptr::NonNull<u8>) => _6; debug ((self: Unique<u8>).1: std::marker::PhantomData<u8>) => const PhantomData::<u8>; } } scope 11 (inlined NonNull::<u8>::as_ptr) { - debug self => _4; + debug self => _6; } } } } scope 12 (inlined std::slice::from_raw_parts::<'_, u8>) { debug data => _5; - debug len => _6; - let _7: *const [u8]; + debug len => _7; + let _8: *const [u8]; scope 13 (inlined core::ub_checks::check_language_ub) { scope 14 (inlined core::ub_checks::check_language_ub::runtime) { } @@ -55,10 +56,10 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { } scope 17 (inlined slice_from_raw_parts::<u8>) { debug data => _5; - debug len => _6; + debug len => _7; scope 18 (inlined std::ptr::from_raw_parts::<[u8], u8>) { debug data_pointer => _5; - debug metadata => _6; + debug metadata => _7; } } } @@ -70,17 +71,22 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { _2 = &((*_1).0: alloc::raw_vec::RawVec<u8>); StorageLive(_3); _3 = &(((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner); + StorageLive(_6); + StorageLive(_4); _4 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>); _5 = copy (_4.0: *const u8); + _6 = NonNull::<u8> { pointer: copy _5 }; + StorageDead(_4); + StorageDead(_6); StorageDead(_3); StorageDead(_2); - StorageLive(_6); - _6 = copy ((*_1).1: usize); StorageLive(_7); - _7 = *const [u8] from (copy _5, copy _6); - _0 = &(*_7); + _7 = copy ((*_1).1: usize); + StorageLive(_8); + _8 = *const [u8] from (copy _5, copy _7); + _0 = &(*_8); + StorageDead(_8); StorageDead(_7); - StorageDead(_6); return; } } diff --git a/tests/mir-opt/simplify_aggregate_to_copy_miscompile.foo.GVN.diff b/tests/mir-opt/simplify_aggregate_to_copy_miscompile.foo.GVN.diff new file mode 100644 index 00000000000..22d4277ee45 --- /dev/null +++ b/tests/mir-opt/simplify_aggregate_to_copy_miscompile.foo.GVN.diff @@ -0,0 +1,72 @@ +- // MIR for `foo` before GVN ++ // MIR for `foo` after GVN + + fn foo(_1: &mut Option<i32>) -> Option<i32> { + debug v => _1; + let mut _0: std::option::Option<i32>; + let mut _2: &std::option::Option<i32>; + let mut _3: &std::option::Option<i32>; + let _4: &&mut std::option::Option<i32>; + let mut _5: isize; + let mut _7: !; + let mut _8: std::option::Option<i32>; + let mut _9: i32; + let mut _10: !; + let mut _11: &mut std::option::Option<i32>; + scope 1 { + debug col => _6; + let _6: i32; + } + + bb0: { +- StorageLive(_2); ++ nop; + StorageLive(_3); + StorageLive(_4); + _4 = &_1; +- _11 = deref_copy (*_4); +- _3 = &(*_11); ++ _11 = copy _1; ++ _3 = &(*_1); + _2 = get(move _3) -> [return: bb1, unwind unreachable]; + } + + bb1: { + StorageDead(_3); + _5 = discriminant((*_2)); + switchInt(move _5) -> [1: bb2, otherwise: bb3]; + } + + bb2: { +- StorageLive(_6); ++ nop; + _6 = copy (((*_2) as Some).0: i32); + StorageLive(_8); +- _8 = Option::<i32>::None; +- (*_1) = move _8; ++ _8 = const Option::<i32>::None; ++ (*_1) = const Option::<i32>::None; + StorageDead(_8); + StorageLive(_9); + _9 = copy _6; +- _0 = Option::<i32>::Some(move _9); ++ _0 = copy (*_2); + StorageDead(_9); +- StorageDead(_6); ++ nop; + StorageDead(_4); +- StorageDead(_2); ++ nop; + return; + } + + bb3: { + StorageLive(_10); + unreachable; + } ++ } ++ ++ ALLOC0 (size: 8, align: 4) { ++ 00 00 00 00 __ __ __ __ │ ....░░░░ + } + diff --git a/tests/mir-opt/simplify_aggregate_to_copy_miscompile.rs b/tests/mir-opt/simplify_aggregate_to_copy_miscompile.rs new file mode 100644 index 00000000000..47721b768be --- /dev/null +++ b/tests/mir-opt/simplify_aggregate_to_copy_miscompile.rs @@ -0,0 +1,32 @@ +//! The `simplify_aggregate_to_copy` mir-opt introduced in +//! <https://github.com/rust-lang/rust/pull/128299> caused a miscompile because the initial +//! implementation +//! +//! > introduce[d] new dereferences without checking for aliasing +//! +//! This test demonstrates the behavior, and should be adjusted or removed when fixing and relanding +//! the mir-opt. +#![crate_type = "lib"] +// skip-filecheck +//@ compile-flags: -O -Zunsound-mir-opts +//@ test-mir-pass: GVN +#![allow(internal_features)] +#![feature(rustc_attrs, core_intrinsics)] + +// EMIT_MIR simplify_aggregate_to_copy_miscompile.foo.GVN.diff +#[no_mangle] +fn foo(v: &mut Option<i32>) -> Option<i32> { + if let &Some(col) = get(&v) { + *v = None; + return Some(col); + } else { + unsafe { std::intrinsics::unreachable() } + } +} + +#[no_mangle] +#[inline(never)] +#[rustc_nounwind] +fn get(v: &Option<i32>) -> &Option<i32> { + v +} diff --git a/tests/run-make/crate-loading/multiple-dep-versions-3.rs b/tests/run-make/crate-loading/multiple-dep-versions-3.rs index 07d888e9f10..f5c4d1baa81 100644 --- a/tests/run-make/crate-loading/multiple-dep-versions-3.rs +++ b/tests/run-make/crate-loading/multiple-dep-versions-3.rs @@ -3,3 +3,8 @@ extern crate dependency; pub use dependency::Type; +pub struct OtherType; +impl dependency::Trait for OtherType { + fn foo(&self) {} + fn bar() {} +} diff --git a/tests/run-make/crate-loading/multiple-dep-versions.rs b/tests/run-make/crate-loading/multiple-dep-versions.rs index 113af9c3025..c68a9e6489f 100644 --- a/tests/run-make/crate-loading/multiple-dep-versions.rs +++ b/tests/run-make/crate-loading/multiple-dep-versions.rs @@ -1,10 +1,11 @@ extern crate dep_2_reexport; extern crate dependency; -use dep_2_reexport::Type; +use dep_2_reexport::{OtherType, Type}; use dependency::{Trait, do_something}; fn main() { do_something(Type); Type.foo(); Type::bar(); + do_something(OtherType); } diff --git a/tests/run-make/crate-loading/rmake.rs b/tests/run-make/crate-loading/rmake.rs index 5d3302c7b02..2d5913c4bcb 100644 --- a/tests/run-make/crate-loading/rmake.rs +++ b/tests/run-make/crate-loading/rmake.rs @@ -18,47 +18,39 @@ fn main() { .extern_("dependency", rust_lib_name("dependency")) .extern_("dep_2_reexport", rust_lib_name("foo")) .run_fail() - .assert_stderr_contains( - r#"error[E0277]: the trait bound `dep_2_reexport::Type: Trait` is not satisfied - --> multiple-dep-versions.rs:7:18 - | -7 | do_something(Type); - | ------------ ^^^^ the trait `Trait` is not implemented for `dep_2_reexport::Type` - | | - | required by a bound introduced by this call - | -help: there are multiple different versions of crate `dependency` in the dependency graph - --> multiple-dep-versions.rs:1:1 - | -1 | extern crate dep_2_reexport; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one version of crate `dependency` is used here, as a dependency of crate `foo` -2 | extern crate dependency; - | ^^^^^^^^^^^^^^^^^^^^^^^^ one version of crate `dependency` is used here, as a direct dependency of the current crate"#, - ) - .assert_stderr_contains( - r#" -3 | pub struct Type(pub i32); - | ^^^^^^^^^^^^^^^ this type implements the required trait -4 | pub trait Trait { - | --------------- this is the required trait"#, - ) - .assert_stderr_contains( - r#" -3 | pub struct Type; - | ^^^^^^^^^^^^^^^ this type doesn't implement the required trait"#, - ) - .assert_stderr_contains( - r#" -error[E0599]: no method named `foo` found for struct `dep_2_reexport::Type` in the current scope + .assert_stderr_contains(r#"error[E0277]: the trait bound `dep_2_reexport::Type: Trait` is not satisfied because the trait comes from a different crate version + --> multiple-dep-versions.rs:7:18 + | +7 | do_something(Type); + | ^^^^ the trait `Trait` is not implemented for `dep_2_reexport::Type` + | +note: there are multiple different versions of crate `dependency` in the dependency graph"#) + .assert_stderr_contains(r#" +3 | pub struct Type(pub i32); + | --------------- this type implements the required trait +4 | pub trait Trait { + | ^^^^^^^^^^^^^^^ this is the required trait +"#) + .assert_stderr_contains(r#" +1 | extern crate dep_2_reexport; + | ---------------------------- one version of crate `dependency` is used here, as a dependency of crate `foo` +2 | extern crate dependency; + | ------------------------ one version of crate `dependency` is used here, as a direct dependency of the current crate"#) + .assert_stderr_contains(r#" +3 | pub struct Type; + | --------------- this type doesn't implement the required trait +4 | pub trait Trait { + | --------------- this is the found trait + = note: two types coming from two different versions of the same crate are different types even if they look the same + = help: you can use `cargo tree` to explore your dependency tree"#) + .assert_stderr_contains(r#"error[E0599]: no method named `foo` found for struct `dep_2_reexport::Type` in the current scope --> multiple-dep-versions.rs:8:10 | 8 | Type.foo(); | ^^^ method not found in `Type` | -note: there are multiple different versions of crate `dependency` in the dependency graph"#, - ) - .assert_stderr_contains( - r#" +note: there are multiple different versions of crate `dependency` in the dependency graph"#) + .assert_stderr_contains(r#" 4 | pub trait Trait { | ^^^^^^^^^^^^^^^ this is the trait that is needed 5 | fn foo(&self); @@ -67,25 +59,19 @@ note: there are multiple different versions of crate `dependency` in the depende ::: multiple-dep-versions.rs:4:18 | 4 | use dependency::{Trait, do_something}; - | ----- `Trait` imported here doesn't correspond to the right version of crate `dependency`"#, - ) - .assert_stderr_contains( - r#" + | ----- `Trait` imported here doesn't correspond to the right version of crate `dependency`"#) + .assert_stderr_contains(r#" 4 | pub trait Trait { - | --------------- this is the trait that was imported"#, - ) - .assert_stderr_contains( - r#" + | --------------- this is the trait that was imported"#) + .assert_stderr_contains(r#" error[E0599]: no function or associated item named `bar` found for struct `dep_2_reexport::Type` in the current scope --> multiple-dep-versions.rs:9:11 | 9 | Type::bar(); | ^^^ function or associated item not found in `Type` | -note: there are multiple different versions of crate `dependency` in the dependency graph"#, - ) - .assert_stderr_contains( - r#" +note: there are multiple different versions of crate `dependency` in the dependency graph"#) + .assert_stderr_contains(r#" 4 | pub trait Trait { | ^^^^^^^^^^^^^^^ this is the trait that is needed 5 | fn foo(&self); @@ -95,6 +81,9 @@ note: there are multiple different versions of crate `dependency` in the depende ::: multiple-dep-versions.rs:4:18 | 4 | use dependency::{Trait, do_something}; - | ----- `Trait` imported here doesn't correspond to the right version of crate `dependency`"#, - ); + | ----- `Trait` imported here doesn't correspond to the right version of crate `dependency`"#) + .assert_stderr_contains( + r#" +6 | pub struct OtherType; + | -------------------- this type doesn't implement the required trait"#); } diff --git a/tests/run-make/cross-lang-lto-clang/rmake.rs b/tests/run-make/cross-lang-lto-clang/rmake.rs index 1b15a54aacb..3fed6ea2066 100644 --- a/tests/run-make/cross-lang-lto-clang/rmake.rs +++ b/tests/run-make/cross-lang-lto-clang/rmake.rs @@ -9,6 +9,24 @@ use run_make_support::{clang, env_var, llvm_ar, llvm_objdump, rustc, static_lib_name}; +#[cfg(any(target_arch = "aarch64", target_arch = "arm"))] +static RUST_ALWAYS_INLINED_PATTERN: &'static str = "bl.*<rust_always_inlined>"; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +static RUST_ALWAYS_INLINED_PATTERN: &'static str = "call.*rust_always_inlined"; +#[cfg(any(target_arch = "aarch64", target_arch = "arm"))] +static C_ALWAYS_INLINED_PATTERN: &'static str = "bl.*<c_always_inlined>"; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +static C_ALWAYS_INLINED_PATTERN: &'static str = "call.*c_always_inlined"; + +#[cfg(any(target_arch = "aarch64", target_arch = "arm"))] +static RUST_NEVER_INLINED_PATTERN: &'static str = "bl.*<rust_never_inlined>"; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +static RUST_NEVER_INLINED_PATTERN: &'static str = "call.*rust_never_inlined"; +#[cfg(any(target_arch = "aarch64", target_arch = "arm"))] +static C_NEVER_INLINED_PATTERN: &'static str = "bl.*<c_never_inlined>"; +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +static C_NEVER_INLINED_PATTERN: &'static str = "call.*c_never_inlined"; + fn main() { rustc() .linker_plugin_lto("on") @@ -31,14 +49,14 @@ fn main() { .disassemble() .input("cmain") .run() - .assert_stdout_not_contains_regex("call.*rust_always_inlined"); + .assert_stdout_not_contains_regex(RUST_ALWAYS_INLINED_PATTERN); // As a sanity check, make sure we do find a call instruction to a // non-inlined function llvm_objdump() .disassemble() .input("cmain") .run() - .assert_stdout_contains_regex("call.*rust_never_inlined"); + .assert_stdout_contains_regex(RUST_NEVER_INLINED_PATTERN); clang().input("clib.c").lto("thin").arg("-c").out_exe("clib.o").arg("-O2").run(); llvm_ar().obj_to_ar().output_input(static_lib_name("xyz"), "clib.o").run(); rustc() @@ -53,10 +71,10 @@ fn main() { .disassemble() .input("rsmain") .run() - .assert_stdout_not_contains_regex("call.*c_always_inlined"); + .assert_stdout_not_contains_regex(C_ALWAYS_INLINED_PATTERN); llvm_objdump() .disassemble() .input("rsmain") .run() - .assert_stdout_contains_regex("call.*c_never_inlined"); + .assert_stdout_contains_regex(C_NEVER_INLINED_PATTERN); } diff --git a/tests/run-make/cross-lang-lto-riscv-abi/rmake.rs b/tests/run-make/cross-lang-lto-riscv-abi/rmake.rs index 92573353a74..e595dbea94d 100644 --- a/tests/run-make/cross-lang-lto-riscv-abi/rmake.rs +++ b/tests/run-make/cross-lang-lto-riscv-abi/rmake.rs @@ -1,21 +1,20 @@ -//! Make sure that cross-language LTO works on riscv targets, -//! which requires extra `target-abi` metadata to be emitted. +//! Make sure that cross-language LTO works on riscv targets, which requires extra `target-abi` +//! metadata to be emitted. //@ needs-force-clang-based-tests -//@ needs-llvm-components riscv +//@ needs-llvm-components: riscv -//@ needs-force-clang-based-tests -// FIXME(#126180): This test can only run on `x86_64-gnu-debug`, because that CI job sets -// RUSTBUILD_FORCE_CLANG_BASED_TESTS and only runs tests which contain "clang" in their -// name. -// However, this test does not run at all as its name does not contain "clang". - -use std::path::PathBuf; -use std::process::{Command, Output}; -use std::{env, str}; +// ignore-tidy-linelength -use run_make_support::{bin_name, clang, llvm_readobj, rustc}; +use object::elf; +use object::read::elf as readelf; +use run_make_support::{bin_name, clang, object, rfs, rustc}; -fn check_target(target: &str, clang_target: &str, carch: &str, is_double_float: bool) { +fn check_target<H: readelf::FileHeader<Endian = object::Endianness>>( + target: &str, + clang_target: &str, + carch: &str, + is_double_float: bool, +) { eprintln!("Checking target {target}"); // Rust part rustc() @@ -39,16 +38,55 @@ fn check_target(target: &str, clang_target: &str, carch: &str, is_double_float: // Check that the built binary has correct float abi let executable = bin_name("riscv-xlto"); - let output = llvm_readobj().input(&executable).file_header().run(); - let stdout = String::from_utf8_lossy(&output.stdout); - eprintln!("obj:\n{}", stdout); - - assert!(!(is_double_float ^ stdout.contains("EF_RISCV_FLOAT_ABI_DOUBLE"))); + let data = rfs::read(&executable); + let header = <H>::parse(&*data).unwrap(); + let endian = match header.e_ident().data { + elf::ELFDATA2LSB => object::Endianness::Little, + elf::ELFDATA2MSB => object::Endianness::Big, + x => unreachable!("invalid e_ident data: {:#010b}", x), + }; + // Check `(e_flags & EF_RISCV_FLOAT_ABI) == EF_RISCV_FLOAT_ABI_DOUBLE`. + // + // See + // <https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#elf-object-files>. + if is_double_float { + assert_eq!( + header.e_flags(endian) & elf::EF_RISCV_FLOAT_ABI, + elf::EF_RISCV_FLOAT_ABI_DOUBLE, + "expected {target} to use double ABI, but it did not" + ); + } else { + assert_ne!( + header.e_flags(endian) & elf::EF_RISCV_FLOAT_ABI, + elf::EF_RISCV_FLOAT_ABI_DOUBLE, + "did not expected {target} to use double ABI" + ); + } } fn main() { - check_target("riscv64gc-unknown-linux-gnu", "riscv64-linux-gnu", "rv64gc", true); - check_target("riscv64imac-unknown-none-elf", "riscv64-unknown-elf", "rv64imac", false); - check_target("riscv32imac-unknown-none-elf", "riscv32-unknown-elf", "rv32imac", false); - check_target("riscv32gc-unknown-linux-gnu", "riscv32-linux-gnu", "rv32gc", true); + check_target::<elf::FileHeader64<object::Endianness>>( + "riscv64gc-unknown-linux-gnu", + "riscv64-linux-gnu", + "rv64gc", + true, + ); + check_target::<elf::FileHeader64<object::Endianness>>( + "riscv64imac-unknown-none-elf", + "riscv64-unknown-elf", + "rv64imac", + false, + ); + check_target::<elf::FileHeader32<object::Endianness>>( + "riscv32imac-unknown-none-elf", + "riscv32-unknown-elf", + "rv32imac", + false, + ); + check_target::<elf::FileHeader32<object::Endianness>>( + "riscv32gc-unknown-linux-gnu", + "riscv32-linux-gnu", + "rv32gc", + true, + ); } diff --git a/tests/run-make/issue-84395-lto-embed-bitcode/Makefile b/tests/run-make/issue-84395-lto-embed-bitcode/Makefile deleted file mode 100644 index aabe90754a6..00000000000 --- a/tests/run-make/issue-84395-lto-embed-bitcode/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# needs-force-clang-based-tests - -# FIXME(#126180): This test doesn't actually run anywhere, because the only -# CI job that sets RUSTBUILD_FORCE_CLANG_BASED_TESTS runs very few tests. - -# This test makes sure the embed bitcode in elf created with -# lto-embed-bitcode=optimized is valid llvm BC module. - -include ../tools.mk - -all: - $(RUSTC) test.rs --target $(TARGET) -Clink-arg=-fuse-ld=lld -Clinker-plugin-lto -Clinker=$(CLANG) -Clink-arg=-Wl,--plugin-opt=-lto-embed-bitcode=optimized -Zemit-thin-lto=no - $(LLVM_BIN_DIR)/objcopy --dump-section .llvmbc=$(TMPDIR)/test.bc $(TMPDIR)/test - $(LLVM_BIN_DIR)/llvm-dis $(TMPDIR)/test.bc diff --git a/tests/run-make/issue-84395-lto-embed-bitcode/rmake.rs b/tests/run-make/issue-84395-lto-embed-bitcode/rmake.rs new file mode 100644 index 00000000000..450d8a9f099 --- /dev/null +++ b/tests/run-make/issue-84395-lto-embed-bitcode/rmake.rs @@ -0,0 +1,27 @@ +//! Smoke test to make sure the embed bitcode in elf created with +//! `--plugin-opt=-lto-embed-bitcode=optimized` is valid llvm BC module. +//! +//! See <https://github.com/rust-lang/rust/issues/84395> where passing +//! `-lto-embed-bitcode=optimized` to lld when linking rust code via `linker-plugin-lto` doesn't +//! produce the expected result. +//! +//! See PR <https://github.com/rust-lang/rust/pull/98162> which initially introduced this test. + +//@ needs-force-clang-based-tests + +use run_make_support::{env_var, llvm_dis, llvm_objcopy, rustc}; + +fn main() { + rustc() + .input("test.rs") + .arg("-Clink-arg=-fuse-ld=lld") + .arg("-Clinker-plugin-lto") + .arg(format!("-Clinker={}", env_var("CLANG"))) + .arg("-Clink-arg=-Wl,--plugin-opt=-lto-embed-bitcode=optimized") + .arg("-Zemit-thin-lto=no") + .run(); + + llvm_objcopy().dump_section(".llvmbc", "test.bc").arg("test").run(); + + llvm_dis().arg("test.bc").run(); +} diff --git a/tests/run-make/linkage-attr-framework/main.rs b/tests/run-make/linkage-attr-framework/main.rs new file mode 100644 index 00000000000..8efabc83e62 --- /dev/null +++ b/tests/run-make/linkage-attr-framework/main.rs @@ -0,0 +1,17 @@ +#![cfg_attr(any(weak, both), feature(link_arg_attribute))] + +#[cfg_attr(any(link, both), link(name = "CoreFoundation", kind = "framework"))] +#[cfg_attr( + any(weak, both), + link(name = "-weak_framework", kind = "link-arg", modifiers = "+verbatim"), + link(name = "CoreFoundation", kind = "link-arg", modifiers = "+verbatim") +)] +extern "C" { + fn CFRunLoopGetTypeID() -> core::ffi::c_ulong; +} + +fn main() { + unsafe { + CFRunLoopGetTypeID(); + } +} diff --git a/tests/run-make/linkage-attr-framework/rmake.rs b/tests/run-make/linkage-attr-framework/rmake.rs new file mode 100644 index 00000000000..4450350f96e --- /dev/null +++ b/tests/run-make/linkage-attr-framework/rmake.rs @@ -0,0 +1,26 @@ +//! Check that linking frameworks on Apple platforms works. + +//@ only-apple + +use run_make_support::{Rustc, run, rustc}; + +fn compile(cfg: &str) -> Rustc { + let mut rustc = rustc(); + rustc.cfg(cfg).input("main.rs"); + rustc +} + +fn main() { + for cfg in ["link", "weak", "both"] { + compile(cfg).run(); + run("main"); + } + + let errs = compile("omit").run_fail(); + // The linker's exact error output changes between Xcode versions, depends on + // linker invocation details, and the linker sometimes outputs more warnings. + errs.assert_stderr_contains_regex(r"error: linking with `.*` failed"); + errs.assert_stderr_contains_regex(r"(Undefined symbols|ld: symbol[^\s]* not found)"); + errs.assert_stderr_contains_regex(r".?_CFRunLoopGetTypeID.?, referenced from:"); + errs.assert_stderr_contains("clang: error: linker command failed with exit code 1"); +} diff --git a/tests/run-make/pointer-auth-link-with-c-lto-clang/rmake.rs b/tests/run-make/pointer-auth-link-with-c-lto-clang/rmake.rs new file mode 100644 index 00000000000..cf6e3d86377 --- /dev/null +++ b/tests/run-make/pointer-auth-link-with-c-lto-clang/rmake.rs @@ -0,0 +1,36 @@ +// `-Z branch protection` is an unstable compiler feature which adds pointer-authentication +// code (PAC), a useful hashing measure for verifying that pointers have not been modified. +// This test checks that compilation and execution is successful when this feature is activated, +// with some of its possible extra arguments (bti, pac-ret, leaf) when doing LTO. +// See https://github.com/rust-lang/rust/pull/88354 + +//@ needs-force-clang-based-tests +//@ only-aarch64 +// Reason: branch protection is not supported on other architectures +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +use run_make_support::{clang, env_var, llvm_ar, run, rustc, static_lib_name}; + +fn main() { + clang() + .arg("-v") + .lto("thin") + .arg("-mbranch-protection=bti+pac-ret+leaf") + .arg("-O2") + .arg("-c") + .out_exe("test.o") + .input("test.c") + .run(); + llvm_ar().obj_to_ar().output_input(static_lib_name("test"), "test.o").run(); + rustc() + .linker_plugin_lto("on") + .opt_level("2") + .linker(&env_var("CLANG")) + .link_arg("-fuse-ld=lld") + .arg("-Zbranch-protection=bti,pac-ret,leaf") + .input("test.rs") + .output("test.bin") + .run(); + run("test.bin"); +} diff --git a/tests/run-make/pointer-auth-link-with-c-lto-clang/test.c b/tests/run-make/pointer-auth-link-with-c-lto-clang/test.c new file mode 100644 index 00000000000..9fe07f82f9e --- /dev/null +++ b/tests/run-make/pointer-auth-link-with-c-lto-clang/test.c @@ -0,0 +1 @@ +int foo() { return 0; } diff --git a/tests/run-make/pointer-auth-link-with-c-lto-clang/test.rs b/tests/run-make/pointer-auth-link-with-c-lto-clang/test.rs new file mode 100644 index 00000000000..1a3be80e898 --- /dev/null +++ b/tests/run-make/pointer-auth-link-with-c-lto-clang/test.rs @@ -0,0 +1,10 @@ +#[link(name = "test")] +extern "C" { + fn foo() -> i32; +} + +fn main() { + unsafe { + foo(); + } +} diff --git a/tests/run-make/pointer-auth-link-with-c/rmake.rs b/tests/run-make/pointer-auth-link-with-c/rmake.rs index 960eafa546b..7b6dff10eae 100644 --- a/tests/run-make/pointer-auth-link-with-c/rmake.rs +++ b/tests/run-make/pointer-auth-link-with-c/rmake.rs @@ -1,7 +1,7 @@ // `-Z branch protection` is an unstable compiler feature which adds pointer-authentication // code (PAC), a useful hashing measure for verifying that pointers have not been modified. // This test checks that compilation and execution is successful when this feature is activated, -// with some of its possible extra arguments (bti, pac-ret, leaf). +// with some of its possible extra arguments (bti, pac-ret, pc, leaf, b-key). // See https://github.com/rust-lang/rust/pull/88354 //@ only-aarch64 @@ -25,4 +25,16 @@ fn main() { llvm_ar().obj_to_ar().output_input("libtest.a", &obj_file).run(); rustc().arg("-Zbranch-protection=bti,pac-ret,leaf").input("test.rs").run(); run("test"); + + // FIXME: +pc was only recently added to LLVM + // cc().arg("-v") + // .arg("-c") + // .out_exe("test") + // .input("test.c") + // .arg("-mbranch-protection=bti+pac-ret+pc+leaf") + // .run(); + // let obj_file = if is_msvc() { "test.obj" } else { "test" }; + // llvm_ar().obj_to_ar().output_input("libtest.a", &obj_file).run(); + // rustc().arg("-Zbranch-protection=bti,pac-ret,pc,leaf").input("test.rs").run(); + // run("test"); } diff --git a/tests/run-make/print-target-cpus-native/rmake.rs b/tests/run-make/print-target-cpus-native/rmake.rs new file mode 100644 index 00000000000..3bd210654db --- /dev/null +++ b/tests/run-make/print-target-cpus-native/rmake.rs @@ -0,0 +1,39 @@ +//@ ignore-cross-compile +//@ needs-llvm-components: aarch64 x86 +// FIXME(#132514): Is needs-llvm-components actually necessary for this test? + +use run_make_support::{assert_contains_regex, rfs, rustc, target}; + +// Test that when querying `--print=target-cpus` for a target with the same +// architecture as the host, the first CPU is "native" with a suitable remark. + +fn main() { + let expected = r"^Available CPUs for this target: + native +- Select the CPU of the current host \(currently [^ )]+\)\. +"; + + // Without an explicit target. + rustc().print("target-cpus").run().assert_stdout_contains_regex(expected); + + // With an explicit target that happens to be the host. + let host = target(); // Because of ignore-cross-compile, assume host == target. + rustc().print("target-cpus").target(host).run().assert_stdout_contains_regex(expected); + + // With an explicit output path. + rustc().print("target-cpus=./xyzzy.txt").run().assert_stdout_equals(""); + assert_contains_regex(rfs::read_to_string("./xyzzy.txt"), expected); + + // Now try some cross-target queries with the same arch as the host. + // (Specify multiple targets so that at least one of them is not the host.) + let cross_targets: &[&str] = if cfg!(target_arch = "aarch64") { + &["aarch64-unknown-linux-gnu", "aarch64-apple-darwin"] + } else if cfg!(target_arch = "x86_64") { + &["x86_64-unknown-linux-gnu", "x86_64-apple-darwin"] + } else { + &[] + }; + for target in cross_targets { + println!("Trying target: {target}"); + rustc().print("target-cpus").target(target).run().assert_stdout_contains_regex(expected); + } +} diff --git a/tests/run-make/profile/rmake.rs b/tests/run-make/profile/rmake.rs deleted file mode 100644 index 58a1b53c040..00000000000 --- a/tests/run-make/profile/rmake.rs +++ /dev/null @@ -1,21 +0,0 @@ -// This test revolves around the rustc flag -Z profile, which should -// generate a .gcno file (initial profiling information) as well -// as a .gcda file (branch counters). The path where these are emitted -// should also be configurable with -Z profile-emit. This test checks -// that the files are produced, and then that the latter flag is respected. -// See https://github.com/rust-lang/rust/pull/42433 - -//@ ignore-cross-compile -//@ needs-profiler-runtime - -use run_make_support::{path, run, rustc}; - -fn main() { - rustc().arg("-g").arg("-Zprofile").input("test.rs").run(); - run("test"); - assert!(path("test.gcno").exists(), "no .gcno file"); - assert!(path("test.gcda").exists(), "no .gcda file"); - rustc().arg("-g").arg("-Zprofile").arg("-Zprofile-emit=abc/abc.gcda").input("test.rs").run(); - run("test"); - assert!(path("abc/abc.gcda").exists(), "gcda file not emitted to defined path"); -} diff --git a/tests/run-make/profile/test.rs b/tests/run-make/profile/test.rs deleted file mode 100644 index f328e4d9d04..00000000000 --- a/tests/run-make/profile/test.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/tests/run-make/rustc-help/help-v.diff b/tests/run-make/rustc-help/help-v.diff new file mode 100644 index 00000000000..22c5dd81bdb --- /dev/null +++ b/tests/run-make/rustc-help/help-v.diff @@ -0,0 +1,29 @@ +@@ -51,10 +51,27 @@ + Set a codegen option + -V, --version Print version info and exit + -v, --verbose Use verbose output ++ --extern NAME[=PATH] ++ Specify where an external rust library is located ++ --sysroot PATH Override the system root ++ --error-format human|json|short ++ How errors and other messages are produced ++ --json CONFIG Configure the JSON output of the compiler ++ --color auto|always|never ++ Configure coloring of output: ++ auto = colorize, if output goes to a tty (default); ++ always = always colorize output; ++ never = never colorize output ++ --diagnostic-width WIDTH ++ Inform rustc of the width of the output so that ++ diagnostics can be truncated to fit ++ --remap-path-prefix FROM=TO ++ Remap source names in all output (compiler messages ++ and output files) ++ @path Read newline separated options from `path` + + Additional help: + -C help Print codegen options + -W help Print 'lint' options and default settings + -Z help Print unstable compiler options +- --help -v Print the full set of options rustc accepts + diff --git a/tests/run-make/rustc-help/help-v.stdout b/tests/run-make/rustc-help/help-v.stdout new file mode 100644 index 00000000000..dbd67b57df2 --- /dev/null +++ b/tests/run-make/rustc-help/help-v.stdout @@ -0,0 +1,77 @@ +Usage: rustc [OPTIONS] INPUT + +Options: + -h, --help Display this message + --cfg SPEC Configure the compilation environment. + SPEC supports the syntax `NAME[="VALUE"]`. + --check-cfg SPEC + Provide list of expected cfgs for checking + -L [KIND=]PATH Add a directory to the library search path. The + optional KIND can be one of dependency, crate, native, + framework, or all (the default). + -l [KIND[:MODIFIERS]=]NAME[:RENAME] + Link the generated crate(s) to the specified native + library NAME. The optional KIND can be one of + static, framework, or dylib (the default). + Optional comma separated MODIFIERS + (bundle|verbatim|whole-archive|as-needed) + may be specified each with a prefix of either '+' to + enable or '-' to disable. + --crate-type [bin|lib|rlib|dylib|cdylib|staticlib|proc-macro] + Comma separated list of types of crates + for the compiler to emit + --crate-name NAME + Specify the name of the crate being built + --edition 2015|2018|2021|2024 + Specify which edition of the compiler to use when + compiling code. The default is 2015 and the latest + stable edition is 2021. + --emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir] + Comma separated list of types of output for the + compiler to emit + --print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target] + Compiler information to print on stdout + -g Equivalent to -C debuginfo=2 + -O Equivalent to -C opt-level=2 + -o FILENAME Write output to <filename> + --out-dir DIR Write output to compiler-chosen filename in <dir> + --explain OPT Provide a detailed explanation of an error message + --test Build a test harness + --target TARGET Target triple for which the code is compiled + -A, --allow LINT Set lint allowed + -W, --warn LINT Set lint warnings + --force-warn LINT + Set lint force-warn + -D, --deny LINT Set lint denied + -F, --forbid LINT Set lint forbidden + --cap-lints LEVEL + Set the most restrictive lint level. More restrictive + lints are capped at this level + -C, --codegen OPT[=VALUE] + Set a codegen option + -V, --version Print version info and exit + -v, --verbose Use verbose output + --extern NAME[=PATH] + Specify where an external rust library is located + --sysroot PATH Override the system root + --error-format human|json|short + How errors and other messages are produced + --json CONFIG Configure the JSON output of the compiler + --color auto|always|never + Configure coloring of output: + auto = colorize, if output goes to a tty (default); + always = always colorize output; + never = never colorize output + --diagnostic-width WIDTH + Inform rustc of the width of the output so that + diagnostics can be truncated to fit + --remap-path-prefix FROM=TO + Remap source names in all output (compiler messages + and output files) + @path Read newline separated options from `path` + +Additional help: + -C help Print codegen options + -W help Print 'lint' options and default settings + -Z help Print unstable compiler options + diff --git a/tests/run-make/rustc-help/help.stdout b/tests/run-make/rustc-help/help.stdout new file mode 100644 index 00000000000..a7d07162799 --- /dev/null +++ b/tests/run-make/rustc-help/help.stdout @@ -0,0 +1,60 @@ +Usage: rustc [OPTIONS] INPUT + +Options: + -h, --help Display this message + --cfg SPEC Configure the compilation environment. + SPEC supports the syntax `NAME[="VALUE"]`. + --check-cfg SPEC + Provide list of expected cfgs for checking + -L [KIND=]PATH Add a directory to the library search path. The + optional KIND can be one of dependency, crate, native, + framework, or all (the default). + -l [KIND[:MODIFIERS]=]NAME[:RENAME] + Link the generated crate(s) to the specified native + library NAME. The optional KIND can be one of + static, framework, or dylib (the default). + Optional comma separated MODIFIERS + (bundle|verbatim|whole-archive|as-needed) + may be specified each with a prefix of either '+' to + enable or '-' to disable. + --crate-type [bin|lib|rlib|dylib|cdylib|staticlib|proc-macro] + Comma separated list of types of crates + for the compiler to emit + --crate-name NAME + Specify the name of the crate being built + --edition 2015|2018|2021|2024 + Specify which edition of the compiler to use when + compiling code. The default is 2015 and the latest + stable edition is 2021. + --emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir] + Comma separated list of types of output for the + compiler to emit + --print [crate-name|file-names|sysroot|target-libdir|cfg|check-cfg|calling-conventions|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|all-target-specs-json|native-static-libs|stack-protector-strategies|link-args|deployment-target] + Compiler information to print on stdout + -g Equivalent to -C debuginfo=2 + -O Equivalent to -C opt-level=2 + -o FILENAME Write output to <filename> + --out-dir DIR Write output to compiler-chosen filename in <dir> + --explain OPT Provide a detailed explanation of an error message + --test Build a test harness + --target TARGET Target triple for which the code is compiled + -A, --allow LINT Set lint allowed + -W, --warn LINT Set lint warnings + --force-warn LINT + Set lint force-warn + -D, --deny LINT Set lint denied + -F, --forbid LINT Set lint forbidden + --cap-lints LEVEL + Set the most restrictive lint level. More restrictive + lints are capped at this level + -C, --codegen OPT[=VALUE] + Set a codegen option + -V, --version Print version info and exit + -v, --verbose Use verbose output + +Additional help: + -C help Print codegen options + -W help Print 'lint' options and default settings + -Z help Print unstable compiler options + --help -v Print the full set of options rustc accepts + diff --git a/tests/run-make/rustc-help/rmake.rs b/tests/run-make/rustc-help/rmake.rs new file mode 100644 index 00000000000..85e90e6352d --- /dev/null +++ b/tests/run-make/rustc-help/rmake.rs @@ -0,0 +1,21 @@ +// Tests `rustc --help` and similar invocations against snapshots and each other. + +use run_make_support::{bare_rustc, diff, similar}; + +fn main() { + // `rustc --help` + let help = bare_rustc().arg("--help").run().stdout_utf8(); + diff().expected_file("help.stdout").actual_text("(rustc --help)", &help).run(); + + // `rustc` should be the same as `rustc --help` + let bare = bare_rustc().run().stdout_utf8(); + diff().expected_text("(rustc --help)", &help).actual_text("(rustc)", &bare).run(); + + // `rustc --help -v` should give a similar but longer help message + let help_v = bare_rustc().arg("--help").arg("-v").run().stdout_utf8(); + diff().expected_file("help-v.stdout").actual_text("(rustc --help -v)", &help_v).run(); + + // Check the diff between `rustc --help` and `rustc --help -v`. + let help_v_diff = similar::TextDiff::from_lines(&help, &help_v).unified_diff().to_string(); + diff().expected_file("help-v.diff").actual_text("actual", &help_v_diff).run(); +} diff --git a/tests/run-make/target-specs/definitely-not-builtin-target.json b/tests/run-make/target-specs/definitely-not-builtin-target.json deleted file mode 100644 index b36fa993d97..00000000000 --- a/tests/run-make/target-specs/definitely-not-builtin-target.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "arch": "x86_64", - "is-builtin": true, - "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", - "llvm-target": "x86_64-unknown-unknown-gnu", - "target-pointer-width": "64" -} diff --git a/tests/run-make/target-specs/rmake.rs b/tests/run-make/target-specs/rmake.rs index 499c6c2079a..79c888ab340 100644 --- a/tests/run-make/target-specs/rmake.rs +++ b/tests/run-make/target-specs/rmake.rs @@ -54,11 +54,6 @@ fn main() { .run(); rustc() .input("foo.rs") - .target("definitely-not-builtin-target") - .run_fail() - .assert_stderr_contains("may not set is_builtin"); - rustc() - .input("foo.rs") .target("endianness-mismatch") .run_fail() .assert_stderr_contains(r#""data-layout" claims architecture is little-endian"#); diff --git a/tests/rustdoc-gui/check-stab-in-docblock.goml b/tests/rustdoc-gui/check-stab-in-docblock.goml index f25c88690e5..916bea6b069 100644 --- a/tests/rustdoc-gui/check-stab-in-docblock.goml +++ b/tests/rustdoc-gui/check-stab-in-docblock.goml @@ -1,5 +1,5 @@ // This test checks that using `.stab` attributes in `.docblock` elements doesn't -// create scrollable paragraphs. +// create scrollable paragraphs and is correctly displayed (not making weird blocks). go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // Needs the text to be display to check for scrollable content. show-text: true @@ -31,3 +31,15 @@ assert-property: ( ".top-doc .docblock p:nth-of-type(3)", {"scrollHeight": |clientHeight|, "scrollWidth": |clientWidth|}, ) + +// Ensure that `<code>` elements in code don't make big blocks. +compare-elements-size-near: ( + "#reexport\.TheStdReexport > code", + ".docblock p span[data-span='1']", + {"height": 1}, +) +compare-elements-size-near: ( + "#reexport\.TheStdReexport > code", + ".docblock p span[data-span='2']", + {"height": 1}, +) diff --git a/tests/rustdoc-gui/docblock-big-code-mobile.goml b/tests/rustdoc-gui/docblock-big-code-mobile.goml index 6fc6834768e..71e08e2c7e2 100644 --- a/tests/rustdoc-gui/docblock-big-code-mobile.goml +++ b/tests/rustdoc-gui/docblock-big-code-mobile.goml @@ -1,13 +1,15 @@ // If we have a long `<code>`, we need to ensure that it'll be fully displayed on mobile, meaning // that it'll be on two lines. + emulate: "iPhone 8" // it has the following size: (375, 667) go-to: "file://" + |DOC_PATH| + "/test_docs/long_code_block/index.html" -// We now check that the block is on two lines: show-text: true // We need to enable text draw to be able to have the "real" size + +// We now check that the block is on two lines: // Little explanations for this test: if the text wasn't displayed on two lines, it would take -// around 20px (which is the font size). -assert-property: (".docblock p > code", {"offsetHeight": "44"}) +// around 24px (which is the font size). +assert-size: (".docblock p > code", {"height": 48}) // Same check, but where the long code block is also a link go-to: "file://" + |DOC_PATH| + "/test_docs/long_code_block_link/index.html" -assert-property: (".docblock p > a > code", {"offsetHeight": "44"}) +assert-size: (".docblock p > a > code", {"height": 48}) diff --git a/tests/rustdoc-gui/fields.goml b/tests/rustdoc-gui/fields.goml index b8139a2edac..dce9918c332 100644 --- a/tests/rustdoc-gui/fields.goml +++ b/tests/rustdoc-gui/fields.goml @@ -1,13 +1,37 @@ -// This test checks that fields are displayed as expected (one by line). -go-to: "file://" + |DOC_PATH| + "/test_docs/fields/struct.Struct.html" -store-position: ("#structfield\.a", {"y": a_y}) -store-position: ("#structfield\.b", {"y": b_y}) -assert: |a_y| < |b_y| +// This test checks that fields are displayed as expected (one by line) and they are surrounded +// by margins. -go-to: "file://" + |DOC_PATH| + "/test_docs/fields/union.Union.html" -store-position: ("#structfield\.a", {"y": a_y}) -store-position: ("#structfield\.b", {"y": b_y}) -assert: |a_y| < |b_y| +store-value: (margin, "9.6px") +define-function: ( + "check-fields", + [path, selector_1, selector_2], + block { + go-to: "file://" + |DOC_PATH| + "/test_docs/fields/" + |path| + store-position: (|selector_1|, {"y": a_y}) + store-position: (|selector_2|, {"y": b_y}) + assert: |a_y| < |b_y| + + // Check the margins. + assert-css: (".structfield.section-header", { + "margin-top": |margin|, + "margin-bottom": |margin|, + "margin-left": "0px", + "margin-right": "0px", + }, ALL) + } +) + +call-function: ("check-fields", { + "path": "struct.Struct.html", + "selector_1": "#structfield\.a", + "selector_2": "#structfield\.b", +}) + +call-function: ("check-fields", { + "path": "union.Union.html", + "selector_1": "#structfield\.a", + "selector_2": "#structfield\.b", +}) go-to: "file://" + |DOC_PATH| + "/test_docs/fields/enum.Enum.html" store-position: ("#variant\.A\.field\.a", {"y": a_y}) @@ -16,3 +40,11 @@ assert: |a_y| < |b_y| store-position: ("#variant\.B\.field\.a", {"y": a_y}) store-position: ("#variant\.B\.field\.b", {"y": b_y}) assert: |a_y| < |b_y| + +// Check the margins. +assert-css: (".sub-variant-field", { + "margin-top": |margin|, + "margin-bottom": |margin|, + "margin-left": "24px", + "margin-right": "0px", +}, ALL) diff --git a/tests/rustdoc-gui/struct-fields.goml b/tests/rustdoc-gui/struct-fields.goml index 3c87a4cd654..302a1a0d80b 100644 --- a/tests/rustdoc-gui/struct-fields.goml +++ b/tests/rustdoc-gui/struct-fields.goml @@ -1,4 +1,5 @@ -// This test ensures that each field is on its own line (In other words, they have display: block). +// This test ensures that each field is on its own line (In other words, they have +// `display: block`). go-to: "file://" + |DOC_PATH| + "/test_docs/struct.StructWithPublicUndocumentedFields.html" store-property: ("//*[@id='structfield.first']", {"offsetTop": first_top}) diff --git a/tests/rustdoc-js/extern-func.js b/tests/rustdoc-js/extern-func.js new file mode 100644 index 00000000000..a3fe2d8ea42 --- /dev/null +++ b/tests/rustdoc-js/extern-func.js @@ -0,0 +1,8 @@ +const EXPECTED = [ + { + 'query': 'c_float -> c_float', + 'others': [ + { 'path': 'extern_func', 'name': 'sqrt' } + ], + }, +]; diff --git a/tests/rustdoc-js/extern-func.rs b/tests/rustdoc-js/extern-func.rs new file mode 100644 index 00000000000..ab1e3e75da7 --- /dev/null +++ b/tests/rustdoc-js/extern-func.rs @@ -0,0 +1,5 @@ +use std::ffi::c_float; + +extern "C" { + pub fn sqrt(x: c_float) -> c_float; +} diff --git a/tests/rustdoc-ui/doctest/auxiliary/extern_macros_2024.rs b/tests/rustdoc-ui/doctest/auxiliary/extern_macros_2024.rs new file mode 100644 index 00000000000..354427000bf --- /dev/null +++ b/tests/rustdoc-ui/doctest/auxiliary/extern_macros_2024.rs @@ -0,0 +1,10 @@ +//@ edition:2024 +//@ compile-flags:-Z unstable-options +#![crate_name="extern_macros"] +#[macro_export] +macro_rules! attrs_on_struct { + ( $( #[$attr:meta] )* ) => { + $( #[$attr] )* + pub struct ExpandedStruct; + } +} diff --git a/tests/rustdoc-ui/doctest/auxiliary/relative-dir-empty-file b/tests/rustdoc-ui/doctest/auxiliary/relative-dir-empty-file new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/tests/rustdoc-ui/doctest/auxiliary/relative-dir-empty-file diff --git a/tests/rustdoc-ui/doctest/auxiliary/relative-dir.md b/tests/rustdoc-ui/doctest/auxiliary/relative-dir.md new file mode 100644 index 00000000000..90097ce82fb --- /dev/null +++ b/tests/rustdoc-ui/doctest/auxiliary/relative-dir.md @@ -0,0 +1,3 @@ +```rust +let x = include_bytes!("relative-dir-empty-file"); +``` diff --git a/tests/rustdoc-ui/doctest/dead-code-2024.rs b/tests/rustdoc-ui/doctest/dead-code-2024.rs new file mode 100644 index 00000000000..4c77112e61a --- /dev/null +++ b/tests/rustdoc-ui/doctest/dead-code-2024.rs @@ -0,0 +1,15 @@ +// This test ensures that the 2024 edition merged doctest will not use `#[allow(unused)]`. + +//@ compile-flags:--test -Zunstable-options --edition 2024 +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ failure-status: 101 + +#![doc(test(attr(allow(unused_variables), deny(warnings))))] + +/// Example +/// +/// ```rust,no_run +/// trait T { fn f(); } +/// ``` +pub fn f() {} diff --git a/tests/rustdoc-ui/doctest/dead-code-2024.stdout b/tests/rustdoc-ui/doctest/dead-code-2024.stdout new file mode 100644 index 00000000000..69dd4e2ede1 --- /dev/null +++ b/tests/rustdoc-ui/doctest/dead-code-2024.stdout @@ -0,0 +1,29 @@ + +running 1 test +test $DIR/dead-code-2024.rs - f (line 12) - compile ... FAILED + +failures: + +---- $DIR/dead-code-2024.rs - f (line 12) stdout ---- +error: trait `T` is never used + --> $DIR/dead-code-2024.rs:13:7 + | +LL | trait T { fn f(); } + | ^ + | +note: the lint level is defined here + --> $DIR/dead-code-2024.rs:11:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(dead_code)]` implied by `#[deny(warnings)]` + +error: aborting due to 1 previous error + +Couldn't compile the test. + +failures: + $DIR/dead-code-2024.rs - f (line 12) + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/dead-code.rs b/tests/rustdoc-ui/doctest/dead-code.rs new file mode 100644 index 00000000000..cb9b4c28f6c --- /dev/null +++ b/tests/rustdoc-ui/doctest/dead-code.rs @@ -0,0 +1,15 @@ +// This test ensures that the doctest will not use `#[allow(unused)]`. + +//@ compile-flags:--test +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ failure-status: 101 + +#![doc(test(attr(allow(unused_variables), deny(warnings))))] + +/// Example +/// +/// ```rust,no_run +/// trait T { fn f(); } +/// ``` +pub fn f() {} diff --git a/tests/rustdoc-ui/doctest/dead-code.stdout b/tests/rustdoc-ui/doctest/dead-code.stdout new file mode 100644 index 00000000000..38d15d5c1bc --- /dev/null +++ b/tests/rustdoc-ui/doctest/dead-code.stdout @@ -0,0 +1,29 @@ + +running 1 test +test $DIR/dead-code.rs - f (line 12) - compile ... FAILED + +failures: + +---- $DIR/dead-code.rs - f (line 12) stdout ---- +error: trait `T` is never used + --> $DIR/dead-code.rs:13:7 + | +LL | trait T { fn f(); } + | ^ + | +note: the lint level is defined here + --> $DIR/dead-code.rs:11:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(dead_code)]` implied by `#[deny(warnings)]` + +error: aborting due to 1 previous error + +Couldn't compile the test. + +failures: + $DIR/dead-code.rs - f (line 12) + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs b/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs index 4fc0674a0c9..bae61992eb2 100644 --- a/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs +++ b/tests/rustdoc-ui/doctest/doctest-output-include-fail.rs @@ -1,4 +1,5 @@ -//@ compile-flags:--test --test-args=--test-threads=1 +//@ edition:2024 +//@ compile-flags:--test --test-args=--test-threads=1 -Z unstable-options //@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ failure-status: 101 diff --git a/tests/rustdoc-ui/doctest/doctest-output.edition2015.stdout b/tests/rustdoc-ui/doctest/doctest-output.edition2015.stdout new file mode 100644 index 00000000000..0e2e30390ad --- /dev/null +++ b/tests/rustdoc-ui/doctest/doctest-output.edition2015.stdout @@ -0,0 +1,8 @@ + +running 3 tests +test $DIR/doctest-output.rs - (line 12) ... ok +test $DIR/doctest-output.rs - ExpandedStruct (line 28) ... ok +test $DIR/doctest-output.rs - foo::bar (line 22) ... ok + +test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/doctest-output.edition2024.stdout b/tests/rustdoc-ui/doctest/doctest-output.edition2024.stdout new file mode 100644 index 00000000000..0e2e30390ad --- /dev/null +++ b/tests/rustdoc-ui/doctest/doctest-output.edition2024.stdout @@ -0,0 +1,8 @@ + +running 3 tests +test $DIR/doctest-output.rs - (line 12) ... ok +test $DIR/doctest-output.rs - ExpandedStruct (line 28) ... ok +test $DIR/doctest-output.rs - foo::bar (line 22) ... ok + +test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/doctest-output.rs b/tests/rustdoc-ui/doctest/doctest-output.rs index 72394a4bed3..0e5ccf0b090 100644 --- a/tests/rustdoc-ui/doctest/doctest-output.rs +++ b/tests/rustdoc-ui/doctest/doctest-output.rs @@ -1,6 +1,10 @@ -//@ edition:2018 -//@ aux-build:extern_macros.rs -//@ compile-flags:--test --test-args=--test-threads=1 +//@ revisions: edition2015 edition2024 +//@[edition2015]edition:2015 +//@[edition2015]aux-build:extern_macros.rs +//@[edition2015]compile-flags:--test --test-args=--test-threads=1 +//@[edition2024]edition:2015 +//@[edition2024]aux-build:extern_macros.rs +//@[edition2024]compile-flags:--test --test-args=--test-threads=1 -Z unstable-options //@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ check-pass diff --git a/tests/rustdoc-ui/doctest/doctest-output.stdout b/tests/rustdoc-ui/doctest/doctest-output.stdout deleted file mode 100644 index c3b1570c43e..00000000000 --- a/tests/rustdoc-ui/doctest/doctest-output.stdout +++ /dev/null @@ -1,8 +0,0 @@ - -running 3 tests -test $DIR/doctest-output.rs - (line 8) ... ok -test $DIR/doctest-output.rs - ExpandedStruct (line 25) ... ok -test $DIR/doctest-output.rs - foo::bar (line 18) ... ok - -test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME - diff --git a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout new file mode 100644 index 00000000000..ca6e7750264 --- /dev/null +++ b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2015.stdout @@ -0,0 +1,24 @@ + +running 1 test +test $DIR/relative-path-include-bytes-132203.rs - (line 18) ... FAILED + +failures: + +---- $DIR/relative-path-include-bytes-132203.rs - (line 18) stdout ---- +error: couldn't read `$DIR/relative-dir-empty-file`: No such file or directory (os error 2) + --> $DIR/relative-path-include-bytes-132203.rs:19:9 + | +LL | let x = include_bytes!("relative-dir-empty-file"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 1 previous error + +Couldn't compile the test. + +failures: + $DIR/relative-path-include-bytes-132203.rs - (line 18) + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2024.stdout b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2024.stdout new file mode 100644 index 00000000000..e4c65703081 --- /dev/null +++ b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.edition2024.stdout @@ -0,0 +1,6 @@ + +running 1 test +test $DIR/auxiliary/relative-dir.md - (line 1) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs new file mode 100644 index 00000000000..b393d126306 --- /dev/null +++ b/tests/rustdoc-ui/doctest/relative-path-include-bytes-132203.rs @@ -0,0 +1,18 @@ +//@ ignore-windows +//@ revisions: edition2015 edition2024 +//@[edition2015]edition:2015 +//@[edition2015]check-fail +//@[edition2015]failure-status: 101 +//@[edition2015]compile-flags:--test --test-args=--test-threads=1 +//@[edition2024]edition:2024 +//@[edition2024]check-pass +//@[edition2024]compile-flags:--test --test-args=--test-threads=1 -Z unstable-options +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" + +// https://github.com/rust-lang/rust/issues/132203 +// This version, because it's edition2024, passes thanks to the new +// relative path. The edition2015 version fails, because paths are +// resolved relative to the rs file instead of relative to the md file. + +#![doc=include_str!("auxiliary/relative-dir.md")] diff --git a/tests/rustdoc-ui/show-coverage-json.rs b/tests/rustdoc-ui/show-coverage-json.rs new file mode 100644 index 00000000000..3851e34fe35 --- /dev/null +++ b/tests/rustdoc-ui/show-coverage-json.rs @@ -0,0 +1,13 @@ +//@ compile-flags: -Z unstable-options --show-coverage --output-format=json +//@ check-pass + +mod bar { + /// a + /// + /// ``` + /// let x = 0; + /// ``` + pub struct Foo; +} + +pub use bar::Foo; diff --git a/tests/rustdoc-ui/show-coverage-json.stdout b/tests/rustdoc-ui/show-coverage-json.stdout new file mode 100644 index 00000000000..ed5b5a60212 --- /dev/null +++ b/tests/rustdoc-ui/show-coverage-json.stdout @@ -0,0 +1 @@ +{"$DIR/show-coverage-json.rs":{"total":2,"with_docs":1,"total_examples":2,"with_examples":1}} diff --git a/tests/rustdoc-ui/show-coverage.rs b/tests/rustdoc-ui/show-coverage.rs new file mode 100644 index 00000000000..00bb1606a82 --- /dev/null +++ b/tests/rustdoc-ui/show-coverage.rs @@ -0,0 +1,13 @@ +//@ compile-flags: -Z unstable-options --show-coverage +//@ check-pass + +mod bar { + /// a + /// + /// ``` + /// let x = 0; + /// ``` + pub struct Foo; +} + +pub use bar::Foo; diff --git a/tests/rustdoc-ui/show-coverage.stdout b/tests/rustdoc-ui/show-coverage.stdout new file mode 100644 index 00000000000..b3b7679771f --- /dev/null +++ b/tests/rustdoc-ui/show-coverage.stdout @@ -0,0 +1,7 @@ ++-------------------------------------+------------+------------+------------+------------+ +| File | Documented | Percentage | Examples | Percentage | ++-------------------------------------+------------+------------+------------+------------+ +| ...ests/rustdoc-ui/show-coverage.rs | 1 | 50.0% | 1 | 50.0% | ++-------------------------------------+------------+------------+------------+------------+ +| Total | 1 | 50.0% | 1 | 50.0% | ++-------------------------------------+------------+------------+------------+------------+ diff --git a/tests/rustdoc/const-display.rs b/tests/rustdoc/const-display.rs index a71825d883d..bc4270c421d 100644 --- a/tests/rustdoc/const-display.rs +++ b/tests/rustdoc/const-display.rs @@ -89,10 +89,4 @@ impl Bar { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const2", since = "1.2.0")] pub const fn stable_impl() -> u32 { 42 } - - // Show const-stability even for unstable functions. - //@ matches 'foo/struct.Bar.html' '//span[@class="since"]' '^const: 1.3.0$' - #[unstable(feature = "foo2", issue = "none")] - #[rustc_const_stable(feature = "const3", since = "1.3.0")] - pub const fn const_stable_unstable() -> u32 { 42 } } diff --git a/tests/rustdoc/const-effect-param.rs b/tests/rustdoc/const-effect-param.rs index 3c81700ba83..cceb0adac30 100644 --- a/tests/rustdoc/const-effect-param.rs +++ b/tests/rustdoc/const-effect-param.rs @@ -1,8 +1,7 @@ // Check that we don't render host effect parameters & arguments. #![crate_name = "foo"] -#![feature(effects, const_trait_impl)] -#![allow(incomplete_features)] +#![feature(const_trait_impl)] #[const_trait] pub trait Tr { diff --git a/tests/rustdoc/const-fn-effects.rs b/tests/rustdoc/const-fn-effects.rs index 4523870c8a5..df060a1aa1a 100644 --- a/tests/rustdoc/const-fn-effects.rs +++ b/tests/rustdoc/const-fn-effects.rs @@ -1,6 +1,4 @@ #![crate_name = "foo"] -#![feature(effects)] -#![allow(incomplete_features)] //@ has foo/fn.bar.html //@ has - '//pre[@class="rust item-decl"]' 'pub const fn bar() -> ' diff --git a/tests/rustdoc/const-intrinsic.rs b/tests/rustdoc/const-intrinsic.rs index 520e253469c..8444d4a3aa7 100644 --- a/tests/rustdoc/const-intrinsic.rs +++ b/tests/rustdoc/const-intrinsic.rs @@ -1,20 +1,26 @@ -#![feature(intrinsics)] +#![feature(intrinsics, rustc_attrs)] #![feature(staged_api)] #![crate_name = "foo"] #![stable(since="1.0.0", feature="rust1")] -extern "rust-intrinsic" { - //@ has 'foo/fn.transmute.html' - //@ has - '//pre[@class="rust item-decl"]' 'pub const unsafe extern "rust-intrinsic" fn transmute<T, U>(_: T) -> U' - #[stable(since="1.0.0", feature="rust1")] - #[rustc_const_stable(feature = "const_transmute", since = "1.56.0")] - pub fn transmute<T, U>(_: T) -> U; +//@ has 'foo/fn.transmute.html' +//@ has - '//pre[@class="rust item-decl"]' 'pub const unsafe fn transmute<T, U>(_: T) -> U' +#[stable(since="1.0.0", feature="rust1")] +#[rustc_const_stable(feature = "const_transmute", since = "1.56.0")] +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +pub const unsafe fn transmute<T, U>(_: T) -> U { + loop {} +} - //@ has 'foo/fn.unreachable.html' - //@ has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !' - #[stable(since="1.0.0", feature="rust1")] - pub fn unreachable() -> !; +//@ has 'foo/fn.unreachable.html' +//@ has - '//pre[@class="rust item-decl"]' 'pub unsafe fn unreachable() -> !' +#[stable(since="1.0.0", feature="rust1")] +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +pub unsafe fn unreachable() -> ! { + loop {} } extern "C" { diff --git a/tests/rustdoc/hidden-implementors-90781.rs b/tests/rustdoc/hidden-implementors-90781.rs new file mode 100644 index 00000000000..960a85b91f0 --- /dev/null +++ b/tests/rustdoc/hidden-implementors-90781.rs @@ -0,0 +1,78 @@ +//@ compile-flags: -Z unstable-options --document-hidden-items --document-private-items + +// regression test for https://github.com/rust-lang/rust/issues/90781 +#![crate_name = "foo"] + +//@ has foo/trait.TPubVis.html +//@ has - '//*[@id="implementors-list"]' 'HidPriv' +//@ has - '//*[@id="implementors-list"]' 'HidPub' +//@ has - '//*[@id="implementors-list"]' 'VisPriv' +//@ has - '//*[@id="implementors-list"]' 'VisPub' +pub trait TPubVis {} + +//@ has foo/trait.TPubHidden.html +//@ has - '//*[@id="implementors-list"]' 'HidPriv' +//@ has - '//*[@id="implementors-list"]' 'HidPub' +//@ has - '//*[@id="implementors-list"]' 'VisPriv' +//@ has - '//*[@id="implementors-list"]' 'VisPub' +#[doc(hidden)] +pub trait TPubHidden {} + +//@ has foo/trait.TPrivVis.html +//@ has - '//*[@id="implementors-list"]' 'HidPriv' +//@ has - '//*[@id="implementors-list"]' 'HidPub' +//@ has - '//*[@id="implementors-list"]' 'VisPriv' +//@ has - '//*[@id="implementors-list"]' 'VisPub' +trait TPrivVis {} + +#[doc(hidden)] +//@ has foo/trait.TPrivHidden.html +//@ has - '//*[@id="impl-TPrivHidden-for-HidPriv"]' 'HidPriv' +//@ has - '//*[@id="impl-TPrivHidden-for-HidPub"]' 'HidPub' +//@ has - '//*[@id="impl-TPrivHidden-for-VisPriv"]' 'VisPriv' +//@ has - '//*[@id="impl-TPrivHidden-for-VisPub"]' 'VisPub' +trait TPrivHidden {} + +//@ has foo/struct.VisPub.html +//@ has - '//*[@id="trait-implementations-list"]' 'TPrivHidden' +//@ has - '//*[@id="trait-implementations-list"]' 'TPrivVis' +//@ has - '//*[@id="trait-implementations-list"]' 'TPubHidden' +//@ has - '//*[@id="trait-implementations-list"]' 'TPubVis' +pub struct VisPub; + +//@ has foo/struct.VisPriv.html +//@ has - '//*[@id="trait-implementations-list"]' 'TPrivHidden' +//@ has - '//*[@id="trait-implementations-list"]' 'TPrivVis' +//@ has - '//*[@id="trait-implementations-list"]' 'TPubHidden' +//@ has - '//*[@id="trait-implementations-list"]' 'TPubVis' +struct VisPriv; + +//@ has foo/struct.HidPub.html +//@ has - '//*[@id="trait-implementations-list"]' 'TPrivHidden' +//@ has - '//*[@id="trait-implementations-list"]' 'TPrivVis' +//@ has - '//*[@id="trait-implementations-list"]' 'TPubHidden' +//@ has - '//*[@id="trait-implementations-list"]' 'TPubVis' +#[doc(hidden)] +pub struct HidPub; + +//@ has foo/struct.HidPriv.html +//@ has - '//*[@id="trait-implementations-list"]' 'TPrivHidden' +//@ has - '//*[@id="trait-implementations-list"]' 'TPrivVis' +//@ has - '//*[@id="trait-implementations-list"]' 'TPubHidden' +//@ has - '//*[@id="trait-implementations-list"]' 'TPubVis' +#[doc(hidden)] +struct HidPriv; + +macro_rules! implement { + ($trait:ident - $($struct:ident)+) => { + $( + impl $trait for $struct {} + )+ + } +} + + +implement!(TPubVis - VisPub VisPriv HidPub HidPriv); +implement!(TPubHidden - VisPub VisPriv HidPub HidPriv); +implement!(TPrivVis - VisPub VisPriv HidPub HidPriv); +implement!(TPrivHidden - VisPub VisPriv HidPub HidPriv); diff --git a/tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs b/tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs index 346f7120b5b..d301c355994 100644 --- a/tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs +++ b/tests/rustdoc/inline_cross/assoc_item_trait_bounds.rs @@ -22,6 +22,7 @@ extern crate assoc_item_trait_bounds as aux; //@ has - '//*[@id="associatedtype.Out12"]' "type Out12: for<'w> Helper<B<'w> = Cow<'w, str>, A<'w> = bool>" //@ has - '//*[@id="associatedtype.Out13"]' "type Out13: for<'fst, 'snd> Aid<'snd, Result<'fst> = &'fst mut str>" //@ has - '//*[@id="associatedtype.Out14"]' "type Out14<P: Copy + Eq, Q: ?Sized>" +//@ has - '//*[@id="associatedtype.Out15"]' "type Out15: AsyncFnMut(i32) -> bool" // // Snapshots: // Check that we don't render any where-clauses for the following associated types since diff --git a/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs b/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs index 551e97a2fa9..56708ec9310 100644 --- a/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs +++ b/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs @@ -1,3 +1,7 @@ +#![feature(async_closure)] + +use std::ops::AsyncFnMut; + pub trait Main { type Item; @@ -16,6 +20,7 @@ pub trait Main { type Out12: for<'w> Helper<B<'w> = std::borrow::Cow<'w, str>, A<'w> = bool>; type Out13: for<'fst, 'snd> Aid<'snd, Result<'fst> = &'fst mut str>; type Out14<P: Copy + Eq, Q: ?Sized>; + type Out15: AsyncFnMut(i32) -> bool; fn make<F>(_: F, _: impl FnMut(&str) -> bool) where diff --git a/tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs b/tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs index 161d0c9d54e..db198e0fce9 100644 --- a/tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs +++ b/tests/rustdoc/inline_cross/auxiliary/const-effect-param.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![feature(effects, const_trait_impl)] -#![allow(incomplete_features)] +#![feature(const_trait_impl)] #[const_trait] pub trait Resource {} diff --git a/tests/rustdoc/rfc-2632-const-trait-impl.rs b/tests/rustdoc/rfc-2632-const-trait-impl.rs index eb3e00af3b0..8a86e3e5e97 100644 --- a/tests/rustdoc/rfc-2632-const-trait-impl.rs +++ b/tests/rustdoc/rfc-2632-const-trait-impl.rs @@ -6,10 +6,9 @@ // stabilized when changing `@!has` to `@has`, and please do // not remove this test. // -// FIXME(effects) add `const_trait` to `Fn` so we use `~const` -// FIXME(effects) restore `const_trait` to `Destruct` -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +// FIXME(const_trait_impl) add `const_trait` to `Fn` so we use `~const` +// FIXME(const_trait_impl) restore `const_trait` to `Destruct` +#![feature(const_trait_impl)] #![crate_name = "foo"] use std::marker::Destruct; diff --git a/tests/rustdoc/safe-intrinsic.rs b/tests/rustdoc/safe-intrinsic.rs index b46ffed99c3..07af04ace60 100644 --- a/tests/rustdoc/safe-intrinsic.rs +++ b/tests/rustdoc/safe-intrinsic.rs @@ -5,18 +5,17 @@ #![no_core] #![crate_name = "foo"] -extern "rust-intrinsic" { - //@ has 'foo/fn.abort.html' - //@ has - '//pre[@class="rust item-decl"]' 'pub extern "rust-intrinsic" fn abort() -> !' - #[rustc_safe_intrinsic] - pub fn abort() -> !; - //@ has 'foo/fn.unreachable.html' - //@ has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "rust-intrinsic" fn unreachable() -> !' - pub fn unreachable() -> !; +//@ has 'foo/fn.abort.html' +//@ has - '//pre[@class="rust item-decl"]' 'pub fn abort() -> !' +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +pub fn abort() -> ! { + loop {} } - -extern "C" { - //@ has 'foo/fn.needs_drop.html' - //@ has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn needs_drop() -> !' - pub fn needs_drop() -> !; +//@ has 'foo/fn.unreachable.html' +//@ has - '//pre[@class="rust item-decl"]' 'pub unsafe fn unreachable() -> !' +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +pub unsafe fn unreachable() -> ! { + loop {} } diff --git a/tests/rustdoc/stability.rs b/tests/rustdoc/stability.rs index fc72154cad8..550eb0bc137 100644 --- a/tests/rustdoc/stability.rs +++ b/tests/rustdoc/stability.rs @@ -1,6 +1,8 @@ #![feature(staged_api)] +#![feature(rustc_attrs)] +#![feature(rustdoc_internals)] -#![stable(feature = "rust1", since = "1.0.0")] +#![stable(feature = "core", since = "1.6.0")] //@ has stability/index.html //@ has - '//ul[@class="item-table"]/li[1]//a' AaStable @@ -26,7 +28,7 @@ pub struct ZzStable; #[unstable(feature = "unstable", issue = "none")] pub mod unstable { //@ !hasraw stability/unstable/struct.StableInUnstable.html \ - // '//span[@class="since"]' + // '//div[@class="main-heading"]//span[@class="since"]' //@ has - '//div[@class="stab unstable"]' 'experimental' #[stable(feature = "rust1", since = "1.0.0")] pub struct StableInUnstable; @@ -34,52 +36,136 @@ pub mod unstable { #[stable(feature = "rust1", since = "1.0.0")] pub mod stable_in_unstable { //@ !hasraw stability/unstable/stable_in_unstable/struct.Inner.html \ - // '//span[@class="since"]' + // '//div[@class="main-heading"]//span[@class="since"]' //@ has - '//div[@class="stab unstable"]' 'experimental' #[stable(feature = "rust1", since = "1.0.0")] pub struct Inner; } + + //@ has stability/struct.AaStable.html \ + // '//*[@id="method.foo"]//span[@class="since"]' '2.2.2' + impl super::AaStable { + #[stable(feature = "rust2", since = "2.2.2")] + pub fn foo() {} + } + + //@ has stability/unstable/struct.StableInUnstable.html \ + // '//*[@id="method.foo"]//span[@class="since"]' '1.0.0' + impl StableInUnstable { + #[stable(feature = "rust1", since = "1.0.0")] + pub fn foo() {} + } +} + +#[unstable(feature = "unstable", issue = "none")] +#[doc(hidden)] +pub mod unstable_stripped { + //@ has stability/struct.AaStable.html \ + // '//*[@id="method.foo"]//span[@class="since"]' '2.2.2' + impl super::AaStable { + #[stable(feature = "rust2", since = "2.2.2")] + pub fn foo() {} + } } #[stable(feature = "rust2", since = "2.2.2")] pub mod stable_later { //@ has stability/stable_later/struct.StableInLater.html \ - // '//span[@class="since"]' '2.2.2' + // '//div[@class="main-heading"]//span[@class="since"]' '2.2.2' #[stable(feature = "rust1", since = "1.0.0")] pub struct StableInLater; #[stable(feature = "rust1", since = "1.0.0")] pub mod stable_in_later { //@ has stability/stable_later/stable_in_later/struct.Inner.html \ - // '//span[@class="since"]' '2.2.2' + // '//div[@class="main-heading"]//span[@class="since"]' '2.2.2' #[stable(feature = "rust1", since = "1.0.0")] pub struct Inner; } } #[stable(feature = "rust1", since = "1.0.0")] -pub mod stable_earlier { - //@ has stability/stable_earlier/struct.StableInUnstable.html \ - // '//span[@class="since"]' '1.0.0' +#[rustc_allowed_through_unstable_modules] +pub mod stable_earlier1 { + //@ has stability/stable_earlier1/struct.StableInUnstable.html \ + // '//div[@class="main-heading"]//span[@class="since"]' '1.0.0' + //@ has - '//*[@id="method.foo"]//span[@class="since"]' '1.0.0' + #[doc(inline)] + #[stable(feature = "rust1", since = "1.0.0")] + pub use crate::unstable::StableInUnstable; + + //@ has stability/stable_earlier1/stable_in_unstable/struct.Inner.html \ + // '//div[@class="main-heading"]//span[@class="since"]' '1.0.0' + #[doc(inline)] + #[stable(feature = "rust1", since = "1.0.0")] + pub use crate::unstable::stable_in_unstable; + + //@ has stability/stable_earlier1/struct.StableInLater.html \ + // '//div[@class="main-heading"]//span[@class="since"]' '1.0.0' + #[doc(inline)] + #[stable(feature = "rust1", since = "1.0.0")] + pub use crate::stable_later::StableInLater; + + //@ has stability/stable_earlier1/stable_in_later/struct.Inner.html \ + // '//div[@class="main-heading"]//span[@class="since"]' '1.0.0' + #[doc(inline)] + #[stable(feature = "rust1", since = "1.0.0")] + pub use crate::stable_later::stable_in_later; +} + +/// These will inherit the crate stability. +#[stable(feature = "rust1", since = "1.0.0")] +pub mod stable_earlier2 { + //@ has stability/stable_earlier2/struct.StableInUnstable.html \ + // '//div[@class="main-heading"]//span[@class="since"]' '1.6.0' + //@ has - '//*[@id="method.foo"]//span[@class="since"]' '1.0.0' #[doc(inline)] #[stable(feature = "rust1", since = "1.0.0")] pub use crate::unstable::StableInUnstable; - //@ has stability/stable_earlier/stable_in_unstable/struct.Inner.html \ - // '//span[@class="since"]' '1.0.0' + //@ has stability/stable_earlier2/stable_in_unstable/struct.Inner.html \ + // '//div[@class="main-heading"]//span[@class="since"]' '1.6.0' #[doc(inline)] #[stable(feature = "rust1", since = "1.0.0")] pub use crate::unstable::stable_in_unstable; - //@ has stability/stable_earlier/struct.StableInLater.html \ - // '//span[@class="since"]' '1.0.0' + //@ has stability/stable_earlier2/struct.StableInLater.html \ + // '//div[@class="main-heading"]//span[@class="since"]' '1.6.0' #[doc(inline)] #[stable(feature = "rust1", since = "1.0.0")] pub use crate::stable_later::StableInLater; - //@ has stability/stable_earlier/stable_in_later/struct.Inner.html \ - // '//span[@class="since"]' '1.0.0' + //@ has stability/stable_earlier2/stable_in_later/struct.Inner.html \ + // '//div[@class="main-heading"]//span[@class="since"]' '1.6.0' #[doc(inline)] #[stable(feature = "rust1", since = "1.0.0")] pub use crate::stable_later::stable_in_later; } + +//@ !hasraw stability/trait.UnstableTraitWithStableMethod.html \ +// '//div[@class="main-heading"]//span[@class="since"]' +//@ has - '//*[@id="tymethod.foo"]//span[@class="since"]' '1.0.0' +//@ has - '//*[@id="method.bar"]//span[@class="since"]' '1.0.0' +#[unstable(feature = "unstable", issue = "none")] +pub trait UnstableTraitWithStableMethod { + #[stable(feature = "rust1", since = "1.0.0")] + fn foo(); + #[stable(feature = "rust1", since = "1.0.0")] + fn bar() {} +} + +//@ has stability/primitive.i32.html \ +// '//div[@class="main-heading"]//span[@class="since"]' '1.0.0' +#[rustc_doc_primitive = "i32"] +// +/// `i32` is always stable in 1.0, even if you look at it from core. +#[stable(feature = "rust1", since = "1.0.0")] +mod prim_i32 {} + +//@ has stability/keyword.if.html \ +// '//div[@class="main-heading"]//span[@class="since"]' '1.0.0' +#[doc(keyword = "if")] +// +/// We currently don't document stability for keywords, but let's test it anyway. +#[stable(feature = "rust1", since = "1.0.0")] +mod if_keyword {} diff --git a/tests/ui-fulldeps/hash-stable-is-unstable.rs b/tests/ui-fulldeps/hash-stable-is-unstable.rs index e5d158a2661..dc778695287 100644 --- a/tests/ui-fulldeps/hash-stable-is-unstable.rs +++ b/tests/ui-fulldeps/hash-stable-is-unstable.rs @@ -1,24 +1,25 @@ +//@ ignore-stage1 FIXME: this line can be removed once these new error messages are in stage 0 rustc //@ compile-flags: -Zdeduplicate-diagnostics=yes extern crate rustc_data_structures; -//~^ use of unstable library feature 'rustc_private' +//~^ use of unstable library feature `rustc_private` //~| NOTE: issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date extern crate rustc_macros; -//~^ use of unstable library feature 'rustc_private' +//~^ use of unstable library feature `rustc_private` //~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date extern crate rustc_query_system; -//~^ use of unstable library feature 'rustc_private' +//~^ use of unstable library feature `rustc_private` //~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date use rustc_macros::HashStable; -//~^ use of unstable library feature 'rustc_private' +//~^ use of unstable library feature `rustc_private` //~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date #[derive(HashStable)] -//~^ use of unstable library feature 'rustc_private' +//~^ use of unstable library feature `rustc_private` //~| NOTE: in this expansion of #[derive(HashStable)] //~| NOTE: in this expansion of #[derive(HashStable)] //~| NOTE: in this expansion of #[derive(HashStable)] diff --git a/tests/ui-fulldeps/hash-stable-is-unstable.stderr b/tests/ui-fulldeps/hash-stable-is-unstable.stderr index c9aac624cbb..8d809175875 100644 --- a/tests/ui-fulldeps/hash-stable-is-unstable.stderr +++ b/tests/ui-fulldeps/hash-stable-is-unstable.stderr @@ -1,5 +1,5 @@ -error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:2:1 +error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? + --> $DIR/hash-stable-is-unstable.rs:3:1 | LL | extern crate rustc_data_structures; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,8 +8,8 @@ LL | extern crate rustc_data_structures; = help: add `#![feature(rustc_private)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:6:1 +error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? + --> $DIR/hash-stable-is-unstable.rs:7:1 | LL | extern crate rustc_macros; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -18,8 +18,8 @@ LL | extern crate rustc_macros; = help: add `#![feature(rustc_private)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:10:1 +error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? + --> $DIR/hash-stable-is-unstable.rs:11:1 | LL | extern crate rustc_query_system; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -28,8 +28,8 @@ LL | extern crate rustc_query_system; = help: add `#![feature(rustc_private)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:15:5 +error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? + --> $DIR/hash-stable-is-unstable.rs:16:5 | LL | use rustc_macros::HashStable; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -38,8 +38,8 @@ LL | use rustc_macros::HashStable; = help: add `#![feature(rustc_private)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/hash-stable-is-unstable.rs:20:10 +error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? + --> $DIR/hash-stable-is-unstable.rs:21:10 | LL | #[derive(HashStable)] | ^^^^^^^^^^ diff --git a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs index c3df917ed12..6eb698c96f6 100644 --- a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs +++ b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs @@ -6,7 +6,7 @@ extern crate rustc_middle; extern crate rustc_session; -use rustc_session::lint::{LintPass, LintVec}; +use rustc_session::lint::{LintPass, LintVec, Lint}; use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass}; declare_lint! { @@ -21,6 +21,10 @@ impl LintPass for Foo { //~ERROR implementing `LintPass` by hand fn name(&self) -> &'static str { "Foo" } + + fn get_lints(&self) -> Vec<&'static Lint> { + vec![TEST_LINT] + } } macro_rules! custom_lint_pass_macro { @@ -31,6 +35,10 @@ macro_rules! custom_lint_pass_macro { fn name(&self) -> &'static str { "Custom" } + + fn get_lints(&self) -> Vec<&'static Lint> { + vec![TEST_LINT] + } } }; } diff --git a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr index ad6e93334cd..824eb35424d 100644 --- a/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr +++ b/tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr @@ -12,7 +12,7 @@ LL | #![deny(rustc::lint_pass_impl_without_macro)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementing `LintPass` by hand - --> $DIR/lint_pass_impl_without_macro.rs:30:14 + --> $DIR/lint_pass_impl_without_macro.rs:34:14 | LL | impl LintPass for Custom { | ^^^^^^^^ diff --git a/tests/ui-fulldeps/pathless-extern-unstable.rs b/tests/ui-fulldeps/pathless-extern-unstable.rs index 2da1a7f0ddc..27272135696 100644 --- a/tests/ui-fulldeps/pathless-extern-unstable.rs +++ b/tests/ui-fulldeps/pathless-extern-unstable.rs @@ -1,9 +1,10 @@ +//@ ignore-stage1 FIXME: this line can be removed once these new error messages are in stage 0 rustc //@ edition:2018 //@ compile-flags:--extern rustc_middle // Test that `--extern rustc_middle` fails with `rustc_private`. pub use rustc_middle; -//~^ ERROR use of unstable library feature 'rustc_private' +//~^ ERROR use of unstable library feature `rustc_private` fn main() {} diff --git a/tests/ui-fulldeps/pathless-extern-unstable.stderr b/tests/ui-fulldeps/pathless-extern-unstable.stderr index 36e56adfdbd..a78b69f4d20 100644 --- a/tests/ui-fulldeps/pathless-extern-unstable.stderr +++ b/tests/ui-fulldeps/pathless-extern-unstable.stderr @@ -1,5 +1,5 @@ -error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? - --> $DIR/pathless-extern-unstable.rs:6:9 +error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? + --> $DIR/pathless-extern-unstable.rs:7:9 | LL | pub use rustc_middle; | ^^^^^^^^^^^^ diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index ff7af388514..03fca17aa55 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -1,10 +1,10 @@ -error: unsupported type attribute for diagnostic derive enum +error: derive(Diagnostic): unsupported type attribute for diagnostic derive enum --> $DIR/diagnostic-derive.rs:47:1 | LL | #[diag(no_crate_example, code = E0123)] | ^ -error: diagnostic slug not specified +error: derive(Diagnostic): diagnostic slug not specified --> $DIR/diagnostic-derive.rs:50:5 | LL | Foo, @@ -12,7 +12,7 @@ LL | Foo, | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: diagnostic slug not specified +error: derive(Diagnostic): diagnostic slug not specified --> $DIR/diagnostic-derive.rs:52:5 | LL | Bar, @@ -20,13 +20,13 @@ LL | Bar, | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: `#[nonsense(...)]` is not a valid attribute +error: derive(Diagnostic): `#[nonsense(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:63:1 | LL | #[nonsense(no_crate_example, code = E0123)] | ^ -error: diagnostic slug not specified +error: derive(Diagnostic): diagnostic slug not specified --> $DIR/diagnostic-derive.rs:63:1 | LL | #[nonsense(no_crate_example, code = E0123)] @@ -34,7 +34,7 @@ LL | #[nonsense(no_crate_example, code = E0123)] | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: diagnostic slug not specified +error: derive(Diagnostic): diagnostic slug not specified --> $DIR/diagnostic-derive.rs:70:1 | LL | #[diag(code = E0123)] @@ -42,13 +42,13 @@ LL | #[diag(code = E0123)] | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: diagnostic slug must be the first argument +error: derive(Diagnostic): diagnostic slug must be the first argument --> $DIR/diagnostic-derive.rs:80:16 | LL | #[diag(nonsense("foo"), code = E0123, slug = "foo")] | ^ -error: diagnostic slug not specified +error: derive(Diagnostic): diagnostic slug not specified --> $DIR/diagnostic-derive.rs:80:1 | LL | #[diag(nonsense("foo"), code = E0123, slug = "foo")] @@ -56,7 +56,7 @@ LL | #[diag(nonsense("foo"), code = E0123, slug = "foo")] | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: unknown argument +error: derive(Diagnostic): unknown argument --> $DIR/diagnostic-derive.rs:86:8 | LL | #[diag(nonsense = "...", code = E0123, slug = "foo")] @@ -64,7 +64,7 @@ LL | #[diag(nonsense = "...", code = E0123, slug = "foo")] | = note: only the `code` parameter is valid after the slug -error: diagnostic slug not specified +error: derive(Diagnostic): diagnostic slug not specified --> $DIR/diagnostic-derive.rs:86:1 | LL | #[diag(nonsense = "...", code = E0123, slug = "foo")] @@ -72,7 +72,7 @@ LL | #[diag(nonsense = "...", code = E0123, slug = "foo")] | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: unknown argument +error: derive(Diagnostic): unknown argument --> $DIR/diagnostic-derive.rs:92:8 | LL | #[diag(nonsense = 4, code = E0123, slug = "foo")] @@ -80,7 +80,7 @@ LL | #[diag(nonsense = 4, code = E0123, slug = "foo")] | = note: only the `code` parameter is valid after the slug -error: diagnostic slug not specified +error: derive(Diagnostic): diagnostic slug not specified --> $DIR/diagnostic-derive.rs:92:1 | LL | #[diag(nonsense = 4, code = E0123, slug = "foo")] @@ -88,7 +88,7 @@ LL | #[diag(nonsense = 4, code = E0123, slug = "foo")] | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: unknown argument +error: derive(Diagnostic): unknown argument --> $DIR/diagnostic-derive.rs:98:40 | LL | #[diag(no_crate_example, code = E0123, slug = "foo")] @@ -96,13 +96,13 @@ LL | #[diag(no_crate_example, code = E0123, slug = "foo")] | = note: only the `code` parameter is valid after the slug -error: `#[suggestion = ...]` is not a valid attribute +error: derive(Diagnostic): `#[suggestion = ...]` is not a valid attribute --> $DIR/diagnostic-derive.rs:105:5 | LL | #[suggestion = "bar"] | ^ -error: specified multiple times +error: derive(Diagnostic): attribute specified multiple times --> $DIR/diagnostic-derive.rs:112:8 | LL | #[diag(no_crate_example, code = E0456)] @@ -114,7 +114,7 @@ note: previously specified here LL | #[diag(no_crate_example, code = E0123)] | ^^^^^^^^^^^^^^^^ -error: specified multiple times +error: derive(Diagnostic): attribute specified multiple times --> $DIR/diagnostic-derive.rs:112:26 | LL | #[diag(no_crate_example, code = E0456)] @@ -126,7 +126,7 @@ note: previously specified here LL | #[diag(no_crate_example, code = E0123)] | ^^^^ -error: specified multiple times +error: derive(Diagnostic): attribute specified multiple times --> $DIR/diagnostic-derive.rs:118:40 | LL | #[diag(no_crate_example, code = E0123, code = E0456)] @@ -138,13 +138,13 @@ note: previously specified here LL | #[diag(no_crate_example, code = E0123, code = E0456)] | ^^^^ -error: diagnostic slug must be the first argument +error: derive(Diagnostic): diagnostic slug must be the first argument --> $DIR/diagnostic-derive.rs:123:43 | LL | #[diag(no_crate_example, no_crate::example, code = E0123)] | ^ -error: diagnostic slug not specified +error: derive(Diagnostic): diagnostic slug not specified --> $DIR/diagnostic-derive.rs:128:1 | LL | struct KindNotProvided {} @@ -152,7 +152,7 @@ LL | struct KindNotProvided {} | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: diagnostic slug not specified +error: derive(Diagnostic): diagnostic slug not specified --> $DIR/diagnostic-derive.rs:131:1 | LL | #[diag(code = E0123)] @@ -160,25 +160,25 @@ LL | #[diag(code = E0123)] | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` +error: derive(Diagnostic): the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` --> $DIR/diagnostic-derive.rs:142:5 | LL | #[primary_span] | ^ -error: `#[nonsense]` is not a valid attribute +error: derive(Diagnostic): `#[nonsense]` is not a valid attribute --> $DIR/diagnostic-derive.rs:150:5 | LL | #[nonsense] | ^ -error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` +error: derive(Diagnostic): the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` --> $DIR/diagnostic-derive.rs:167:5 | LL | #[label(no_crate_label)] | ^ -error: `name` doesn't refer to a field on this type +error: derive(Diagnostic): `name` doesn't refer to a field on this type --> $DIR/diagnostic-derive.rs:175:46 | LL | #[suggestion(no_crate_suggestion, code = "{name}")] @@ -202,19 +202,19 @@ LL | #[derive(Diagnostic)] = note: if you intended to print `}`, you can escape it using `}}` = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) -error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` +error: derive(Diagnostic): the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` --> $DIR/diagnostic-derive.rs:210:5 | LL | #[label(no_crate_label)] | ^ -error: suggestion without `code = "..."` +error: derive(Diagnostic): suggestion without `code = "..."` --> $DIR/diagnostic-derive.rs:229:5 | LL | #[suggestion(no_crate_suggestion)] | ^ -error: invalid nested attribute +error: derive(Diagnostic): invalid nested attribute --> $DIR/diagnostic-derive.rs:237:18 | LL | #[suggestion(nonsense = "bar")] @@ -222,13 +222,13 @@ LL | #[suggestion(nonsense = "bar")] | = help: only `no_span`, `style`, `code` and `applicability` are valid nested attributes -error: suggestion without `code = "..."` +error: derive(Diagnostic): suggestion without `code = "..."` --> $DIR/diagnostic-derive.rs:237:5 | LL | #[suggestion(nonsense = "bar")] | ^ -error: invalid nested attribute +error: derive(Diagnostic): invalid nested attribute --> $DIR/diagnostic-derive.rs:246:18 | LL | #[suggestion(msg = "bar")] @@ -236,13 +236,13 @@ LL | #[suggestion(msg = "bar")] | = help: only `no_span`, `style`, `code` and `applicability` are valid nested attributes -error: suggestion without `code = "..."` +error: derive(Diagnostic): suggestion without `code = "..."` --> $DIR/diagnostic-derive.rs:246:5 | LL | #[suggestion(msg = "bar")] | ^ -error: wrong field type for suggestion +error: derive(Diagnostic): wrong field type for suggestion --> $DIR/diagnostic-derive.rs:269:5 | LL | #[suggestion(no_crate_suggestion, code = "This is suggested code")] @@ -250,7 +250,7 @@ LL | #[suggestion(no_crate_suggestion, code = "This is suggested code")] | = help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)` -error: specified multiple times +error: derive(Diagnostic): attribute specified multiple times --> $DIR/diagnostic-derive.rs:285:24 | LL | suggestion: (Span, Span, Applicability), @@ -262,7 +262,7 @@ note: previously specified here LL | suggestion: (Span, Span, Applicability), | ^^^^ -error: specified multiple times +error: derive(Diagnostic): attribute specified multiple times --> $DIR/diagnostic-derive.rs:293:33 | LL | suggestion: (Applicability, Applicability, Span), @@ -274,13 +274,13 @@ note: previously specified here LL | suggestion: (Applicability, Applicability, Span), | ^^^^^^^^^^^^^ -error: `#[label = ...]` is not a valid attribute +error: derive(Diagnostic): `#[label = ...]` is not a valid attribute --> $DIR/diagnostic-derive.rs:300:5 | LL | #[label = "bar"] | ^ -error: specified multiple times +error: derive(Diagnostic): attribute specified multiple times --> $DIR/diagnostic-derive.rs:451:5 | LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "maybe-incorrect")] @@ -292,37 +292,37 @@ note: previously specified here LL | suggestion: (Span, Applicability), | ^^^^^^^^^^^^^ -error: invalid applicability +error: derive(Diagnostic): invalid applicability --> $DIR/diagnostic-derive.rs:459:69 | LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "batman")] | ^^^^^^^^ -error: the `#[help(...)]` attribute can only be applied to fields of type `Span`, `MultiSpan`, `bool` or `()` +error: derive(Diagnostic): the `#[help(...)]` attribute can only be applied to fields of type `Span`, `MultiSpan`, `bool` or `()` --> $DIR/diagnostic-derive.rs:526:5 | LL | #[help(no_crate_help)] | ^ -error: a diagnostic slug must be the first argument to the attribute +error: derive(Diagnostic): a diagnostic slug must be the first argument to the attribute --> $DIR/diagnostic-derive.rs:535:32 | LL | #[label(no_crate_label, foo)] | ^ -error: only `no_span` is a valid nested attribute +error: derive(Diagnostic): only `no_span` is a valid nested attribute --> $DIR/diagnostic-derive.rs:543:29 | LL | #[label(no_crate_label, foo = "...")] | ^^^ -error: only `no_span` is a valid nested attribute +error: derive(Diagnostic): only `no_span` is a valid nested attribute --> $DIR/diagnostic-derive.rs:551:29 | LL | #[label(no_crate_label, foo("..."))] | ^^^ -error: `#[primary_span]` is not a valid attribute +error: derive(Diagnostic): `#[primary_span]` is not a valid attribute --> $DIR/diagnostic-derive.rs:563:5 | LL | #[primary_span] @@ -330,13 +330,13 @@ LL | #[primary_span] | = help: the `primary_span` field attribute is not valid for lint diagnostics -error: `#[error(...)]` is not a valid attribute +error: derive(Diagnostic): `#[error(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:583:1 | LL | #[error(no_crate_example, code = E0123)] | ^ -error: diagnostic slug not specified +error: derive(Diagnostic): diagnostic slug not specified --> $DIR/diagnostic-derive.rs:583:1 | LL | #[error(no_crate_example, code = E0123)] @@ -344,13 +344,13 @@ LL | #[error(no_crate_example, code = E0123)] | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: `#[warn_(...)]` is not a valid attribute +error: derive(Diagnostic): `#[warn_(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:590:1 | LL | #[warn_(no_crate_example, code = E0123)] | ^ -error: diagnostic slug not specified +error: derive(Diagnostic): diagnostic slug not specified --> $DIR/diagnostic-derive.rs:590:1 | LL | #[warn_(no_crate_example, code = E0123)] @@ -358,13 +358,13 @@ LL | #[warn_(no_crate_example, code = E0123)] | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: `#[lint(...)]` is not a valid attribute +error: derive(Diagnostic): `#[lint(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:597:1 | LL | #[lint(no_crate_example, code = E0123)] | ^ -error: diagnostic slug not specified +error: derive(Diagnostic): diagnostic slug not specified --> $DIR/diagnostic-derive.rs:597:1 | LL | #[lint(no_crate_example, code = E0123)] @@ -372,13 +372,13 @@ LL | #[lint(no_crate_example, code = E0123)] | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` -error: `#[lint(...)]` is not a valid attribute +error: derive(Diagnostic): `#[lint(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:604:1 | LL | #[lint(no_crate_example, code = E0123)] | ^ -error: diagnostic slug not specified +error: derive(Diagnostic): diagnostic slug not specified --> $DIR/diagnostic-derive.rs:604:1 | LL | #[lint(no_crate_example, code = E0123)] @@ -386,7 +386,7 @@ LL | #[lint(no_crate_example, code = E0123)] | = help: specify the slug as the first argument to the attribute, such as `#[diag(compiletest_example)]` -error: specified multiple times +error: derive(Diagnostic): attribute specified multiple times --> $DIR/diagnostic-derive.rs:613:53 | LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] @@ -398,7 +398,7 @@ note: previously specified here LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")] | ^^^^ -error: wrong types for suggestion +error: derive(Diagnostic): wrong types for suggestion --> $DIR/diagnostic-derive.rs:622:24 | LL | suggestion: (Span, usize), @@ -406,7 +406,7 @@ LL | suggestion: (Span, usize), | = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)` -error: wrong types for suggestion +error: derive(Diagnostic): wrong types for suggestion --> $DIR/diagnostic-derive.rs:630:17 | LL | suggestion: (Span,), @@ -414,13 +414,13 @@ LL | suggestion: (Span,), | = help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)` -error: suggestion without `code = "..."` +error: derive(Diagnostic): suggestion without `code = "..."` --> $DIR/diagnostic-derive.rs:637:5 | LL | #[suggestion(no_crate_suggestion)] | ^ -error: `#[multipart_suggestion(...)]` is not a valid attribute +error: derive(Diagnostic): `#[multipart_suggestion(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:644:1 | LL | #[multipart_suggestion(no_crate_suggestion)] @@ -428,7 +428,7 @@ LL | #[multipart_suggestion(no_crate_suggestion)] | = help: consider creating a `Subdiagnostic` instead -error: `#[multipart_suggestion(...)]` is not a valid attribute +error: derive(Diagnostic): `#[multipart_suggestion(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:647:1 | LL | #[multipart_suggestion()] @@ -436,7 +436,7 @@ LL | #[multipart_suggestion()] | = help: consider creating a `Subdiagnostic` instead -error: `#[multipart_suggestion(...)]` is not a valid attribute +error: derive(Diagnostic): `#[multipart_suggestion(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:651:5 | LL | #[multipart_suggestion(no_crate_suggestion)] @@ -444,7 +444,7 @@ LL | #[multipart_suggestion(no_crate_suggestion)] | = help: consider creating a `Subdiagnostic` instead -error: `#[suggestion(...)]` is not a valid attribute +error: derive(Diagnostic): `#[suggestion(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:659:1 | LL | #[suggestion(no_crate_suggestion, code = "...")] @@ -452,7 +452,7 @@ LL | #[suggestion(no_crate_suggestion, code = "...")] | = help: `#[label]` and `#[suggestion]` can only be applied to fields -error: `#[label]` is not a valid attribute +error: derive(Diagnostic): `#[label]` is not a valid attribute --> $DIR/diagnostic-derive.rs:668:1 | LL | #[label] @@ -460,61 +460,61 @@ LL | #[label] | = help: `#[label]` and `#[suggestion]` can only be applied to fields -error: `#[subdiagnostic(...)]` is not a valid attribute +error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:702:5 | LL | #[subdiagnostic(bad)] | ^ -error: `#[subdiagnostic = ...]` is not a valid attribute +error: derive(Diagnostic): `#[subdiagnostic = ...]` is not a valid attribute --> $DIR/diagnostic-derive.rs:710:5 | LL | #[subdiagnostic = "bad"] | ^ -error: `#[subdiagnostic(...)]` is not a valid attribute +error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:718:5 | LL | #[subdiagnostic(bad, bad)] | ^ -error: `#[subdiagnostic(...)]` is not a valid attribute +error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:726:5 | LL | #[subdiagnostic("bad")] | ^ -error: `#[subdiagnostic(...)]` is not a valid attribute +error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:734:5 | LL | #[subdiagnostic(eager)] | ^ -error: `#[subdiagnostic(...)]` is not a valid attribute +error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:742:5 | LL | #[subdiagnostic(eager)] | ^ -error: `#[subdiagnostic(...)]` is not a valid attribute +error: derive(Diagnostic): `#[subdiagnostic(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:763:5 | LL | #[subdiagnostic(eager)] | ^ -error: expected at least one string literal for `code(...)` +error: derive(Diagnostic): expected at least one string literal for `code(...)` --> $DIR/diagnostic-derive.rs:794:23 | LL | #[suggestion(code())] | ^ -error: `code(...)` must contain only string literals +error: derive(Diagnostic): `code(...)` must contain only string literals --> $DIR/diagnostic-derive.rs:802:23 | LL | #[suggestion(code(foo))] | ^^^ -error: `#[suggestion(...)]` is not a valid attribute +error: derive(Diagnostic): `#[suggestion(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:826:5 | LL | #[suggestion(no_crate_suggestion, code = "")] diff --git a/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr b/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr index df1bad3cad0..4f54239f0fa 100644 --- a/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr +++ b/tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.stderr @@ -1,4 +1,4 @@ -error: diagnostic slug and crate name do not match +error: derive(Diagnostic): diagnostic slug and crate name do not match --> $DIR/enforce_slug_naming.rs:22:8 | LL | #[diag(compiletest_example, code = E0123)] diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr index 96f6ef06d1d..0ae7ba4c497 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr @@ -1,142 +1,142 @@ -error: label without `#[primary_span]` field +error: derive(Diagnostic): label without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:51:1 | LL | #[label(no_crate_example)] | ^ -error: diagnostic slug must be first argument of a `#[label(...)]` attribute +error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute --> $DIR/subdiagnostic-derive.rs:58:1 | LL | #[label] | ^ -error: `#[foo]` is not a valid attribute +error: derive(Diagnostic): `#[foo]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:67:1 | LL | #[foo] | ^ -error: `#[label = ...]` is not a valid attribute +error: derive(Diagnostic): `#[label = ...]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:77:1 | LL | #[label = "..."] | ^ -error: only `no_span` is a valid nested attribute +error: derive(Diagnostic): only `no_span` is a valid nested attribute --> $DIR/subdiagnostic-derive.rs:86:9 | LL | #[label(bug = "...")] | ^^^ -error: diagnostic slug must be first argument of a `#[label(...)]` attribute +error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute --> $DIR/subdiagnostic-derive.rs:86:1 | LL | #[label(bug = "...")] | ^ -error: only `no_span` is a valid nested attribute +error: derive(Diagnostic): only `no_span` is a valid nested attribute --> $DIR/subdiagnostic-derive.rs:106:9 | LL | #[label(slug = 4)] | ^^^^ -error: diagnostic slug must be first argument of a `#[label(...)]` attribute +error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute --> $DIR/subdiagnostic-derive.rs:106:1 | LL | #[label(slug = 4)] | ^ -error: only `no_span` is a valid nested attribute +error: derive(Diagnostic): only `no_span` is a valid nested attribute --> $DIR/subdiagnostic-derive.rs:116:9 | LL | #[label(slug("..."))] | ^^^^ -error: diagnostic slug must be first argument of a `#[label(...)]` attribute +error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute --> $DIR/subdiagnostic-derive.rs:116:1 | LL | #[label(slug("..."))] | ^ -error: diagnostic slug must be first argument of a `#[label(...)]` attribute +error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute --> $DIR/subdiagnostic-derive.rs:136:1 | LL | #[label()] | ^ -error: only `no_span` is a valid nested attribute +error: derive(Diagnostic): only `no_span` is a valid nested attribute --> $DIR/subdiagnostic-derive.rs:145:27 | LL | #[label(no_crate_example, code = "...")] | ^^^^ -error: only `no_span` is a valid nested attribute +error: derive(Diagnostic): only `no_span` is a valid nested attribute --> $DIR/subdiagnostic-derive.rs:154:27 | LL | #[label(no_crate_example, applicability = "machine-applicable")] | ^^^^^^^^^^^^^ -error: unsupported type attribute for subdiagnostic enum +error: derive(Diagnostic): unsupported type attribute for subdiagnostic enum --> $DIR/subdiagnostic-derive.rs:163:1 | LL | #[foo] | ^ -error: `#[bar]` is not a valid attribute +error: derive(Diagnostic): `#[bar]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:177:5 | LL | #[bar] | ^ -error: `#[bar = ...]` is not a valid attribute +error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:189:5 | LL | #[bar = "..."] | ^ -error: `#[bar = ...]` is not a valid attribute +error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:201:5 | LL | #[bar = 4] | ^ -error: `#[bar(...)]` is not a valid attribute +error: derive(Diagnostic): `#[bar(...)]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:213:5 | LL | #[bar("...")] | ^ -error: only `no_span` is a valid nested attribute +error: derive(Diagnostic): only `no_span` is a valid nested attribute --> $DIR/subdiagnostic-derive.rs:225:13 | LL | #[label(code = "...")] | ^^^^ -error: diagnostic slug must be first argument of a `#[label(...)]` attribute +error: derive(Diagnostic): diagnostic slug must be first argument of a `#[label(...)]` attribute --> $DIR/subdiagnostic-derive.rs:225:5 | LL | #[label(code = "...")] | ^ -error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` +error: derive(Diagnostic): the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` --> $DIR/subdiagnostic-derive.rs:254:5 | LL | #[primary_span] | ^ -error: label without `#[primary_span]` field +error: derive(Diagnostic): label without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:251:1 | LL | #[label(no_crate_example)] | ^ -error: `#[applicability]` is only valid on suggestions +error: derive(Diagnostic): `#[applicability]` is only valid on suggestions --> $DIR/subdiagnostic-derive.rs:264:5 | LL | #[applicability] | ^ -error: `#[bar]` is not a valid attribute +error: derive(Diagnostic): `#[bar]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:274:5 | LL | #[bar] @@ -144,13 +144,13 @@ LL | #[bar] | = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes -error: `#[bar = ...]` is not a valid attribute +error: derive(Diagnostic): `#[bar = ...]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:285:5 | LL | #[bar = "..."] | ^ -error: `#[bar(...)]` is not a valid attribute +error: derive(Diagnostic): `#[bar(...)]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:296:5 | LL | #[bar("...")] @@ -158,13 +158,13 @@ LL | #[bar("...")] | = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes -error: a diagnostic slug must be the first argument to the attribute +error: derive(Diagnostic): a diagnostic slug must be the first argument to the attribute --> $DIR/subdiagnostic-derive.rs:328:44 | LL | #[label(no_crate_example, no_crate::example)] | ^ -error: specified multiple times +error: derive(Diagnostic): attribute specified multiple times --> $DIR/subdiagnostic-derive.rs:341:5 | LL | #[primary_span] @@ -176,13 +176,13 @@ note: previously specified here LL | #[primary_span] | ^ -error: subdiagnostic kind not specified +error: derive(Diagnostic): subdiagnostic kind not specified --> $DIR/subdiagnostic-derive.rs:347:8 | LL | struct AG { | ^^ -error: specified multiple times +error: derive(Diagnostic): attribute specified multiple times --> $DIR/subdiagnostic-derive.rs:384:46 | LL | #[suggestion(no_crate_example, code = "...", code = "...")] @@ -194,7 +194,7 @@ note: previously specified here LL | #[suggestion(no_crate_example, code = "...", code = "...")] | ^^^^ -error: specified multiple times +error: derive(Diagnostic): attribute specified multiple times --> $DIR/subdiagnostic-derive.rs:402:5 | LL | #[applicability] @@ -206,49 +206,49 @@ note: previously specified here LL | #[applicability] | ^ -error: the `#[applicability]` attribute can only be applied to fields of type `Applicability` +error: derive(Diagnostic): the `#[applicability]` attribute can only be applied to fields of type `Applicability` --> $DIR/subdiagnostic-derive.rs:412:5 | LL | #[applicability] | ^ -error: suggestion without `code = "..."` +error: derive(Diagnostic): suggestion without `code = "..."` --> $DIR/subdiagnostic-derive.rs:425:1 | LL | #[suggestion(no_crate_example)] | ^ -error: invalid applicability +error: derive(Diagnostic): invalid applicability --> $DIR/subdiagnostic-derive.rs:435:62 | LL | #[suggestion(no_crate_example, code = "...", applicability = "foo")] | ^^^^^ -error: suggestion without `#[primary_span]` field +error: derive(Diagnostic): suggestion without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:453:1 | LL | #[suggestion(no_crate_example, code = "...")] | ^ -error: unsupported type attribute for subdiagnostic enum +error: derive(Diagnostic): unsupported type attribute for subdiagnostic enum --> $DIR/subdiagnostic-derive.rs:467:1 | LL | #[label] | ^ -error: `var` doesn't refer to a field on this type +error: derive(Diagnostic): `var` doesn't refer to a field on this type --> $DIR/subdiagnostic-derive.rs:487:39 | LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] | ^^^^^^^ -error: `var` doesn't refer to a field on this type +error: derive(Diagnostic): `var` doesn't refer to a field on this type --> $DIR/subdiagnostic-derive.rs:506:43 | LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")] | ^^^^^^^ -error: `#[suggestion_part]` is not a valid attribute +error: derive(Diagnostic): `#[suggestion_part]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:529:5 | LL | #[suggestion_part] @@ -256,7 +256,7 @@ LL | #[suggestion_part] | = help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead -error: `#[suggestion_part(...)]` is not a valid attribute +error: derive(Diagnostic): `#[suggestion_part(...)]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:532:5 | LL | #[suggestion_part(code = "...")] @@ -264,13 +264,13 @@ LL | #[suggestion_part(code = "...")] | = help: `#[suggestion_part(...)]` is only valid in multipart suggestions -error: suggestion without `#[primary_span]` field +error: derive(Diagnostic): suggestion without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:526:1 | LL | #[suggestion(no_crate_example, code = "...")] | ^ -error: invalid nested attribute +error: derive(Diagnostic): invalid nested attribute --> $DIR/subdiagnostic-derive.rs:541:42 | LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] @@ -278,25 +278,25 @@ LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "mac | = help: only `no_span`, `style` and `applicability` are valid nested attributes -error: multipart suggestion without any `#[suggestion_part(...)]` fields +error: derive(Diagnostic): multipart suggestion without any `#[suggestion_part(...)]` fields --> $DIR/subdiagnostic-derive.rs:541:1 | LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] | ^ -error: `#[suggestion_part(...)]` attribute without `code = "..."` +error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."` --> $DIR/subdiagnostic-derive.rs:551:5 | LL | #[suggestion_part] | ^ -error: `#[suggestion_part(...)]` attribute without `code = "..."` +error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."` --> $DIR/subdiagnostic-derive.rs:559:5 | LL | #[suggestion_part()] | ^ -error: `#[primary_span]` is not a valid attribute +error: derive(Diagnostic): `#[primary_span]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:568:5 | LL | #[primary_span] @@ -304,43 +304,43 @@ LL | #[primary_span] | = help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]` -error: multipart suggestion without any `#[suggestion_part(...)]` fields +error: derive(Diagnostic): multipart suggestion without any `#[suggestion_part(...)]` fields --> $DIR/subdiagnostic-derive.rs:565:1 | LL | #[multipart_suggestion(no_crate_example)] | ^ -error: `#[suggestion_part(...)]` attribute without `code = "..."` +error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."` --> $DIR/subdiagnostic-derive.rs:576:5 | LL | #[suggestion_part] | ^ -error: `#[suggestion_part(...)]` attribute without `code = "..."` +error: derive(Diagnostic): `#[suggestion_part(...)]` attribute without `code = "..."` --> $DIR/subdiagnostic-derive.rs:579:5 | LL | #[suggestion_part()] | ^ -error: `code` is the only valid nested attribute +error: derive(Diagnostic): `code` is the only valid nested attribute --> $DIR/subdiagnostic-derive.rs:582:23 | LL | #[suggestion_part(foo = "bar")] | ^^^ -error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` +error: derive(Diagnostic): the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` --> $DIR/subdiagnostic-derive.rs:587:5 | LL | #[suggestion_part(code = "...")] | ^ -error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` +error: derive(Diagnostic): the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` --> $DIR/subdiagnostic-derive.rs:590:5 | LL | #[suggestion_part()] | ^ -error: specified multiple times +error: derive(Diagnostic): attribute specified multiple times --> $DIR/subdiagnostic-derive.rs:598:37 | LL | #[suggestion_part(code = "...", code = ",,,")] @@ -352,37 +352,37 @@ note: previously specified here LL | #[suggestion_part(code = "...", code = ",,,")] | ^^^^ -error: `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."` +error: derive(Diagnostic): `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."` --> $DIR/subdiagnostic-derive.rs:627:5 | LL | #[applicability] | ^ -error: expected exactly one string literal for `code = ...` +error: derive(Diagnostic): expected exactly one string literal for `code = ...` --> $DIR/subdiagnostic-derive.rs:675:34 | LL | #[suggestion_part(code("foo"))] | ^ -error: expected exactly one string literal for `code = ...` +error: derive(Diagnostic): expected exactly one string literal for `code = ...` --> $DIR/subdiagnostic-derive.rs:686:41 | LL | #[suggestion_part(code("foo", "bar"))] | ^ -error: expected exactly one string literal for `code = ...` +error: derive(Diagnostic): expected exactly one string literal for `code = ...` --> $DIR/subdiagnostic-derive.rs:697:30 | LL | #[suggestion_part(code(3))] | ^ -error: expected exactly one string literal for `code = ...` +error: derive(Diagnostic): expected exactly one string literal for `code = ...` --> $DIR/subdiagnostic-derive.rs:708:29 | LL | #[suggestion_part(code())] | ^ -error: specified multiple times +error: derive(Diagnostic): attribute specified multiple times --> $DIR/subdiagnostic-derive.rs:763:1 | LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] @@ -394,7 +394,7 @@ note: previously specified here LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] | ^ -error: `#[suggestion_hidden(...)]` is not a valid attribute +error: derive(Diagnostic): `#[suggestion_hidden(...)]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:772:1 | LL | #[suggestion_hidden(no_crate_example, code = "")] @@ -402,7 +402,7 @@ LL | #[suggestion_hidden(no_crate_example, code = "")] | = help: Use `#[suggestion(..., style = "hidden")]` instead -error: `#[suggestion_hidden(...)]` is not a valid attribute +error: derive(Diagnostic): `#[suggestion_hidden(...)]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:780:1 | LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")] @@ -410,7 +410,7 @@ LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")] | = help: Use `#[suggestion(..., style = "hidden")]` instead -error: invalid suggestion style +error: derive(Diagnostic): invalid suggestion style --> $DIR/subdiagnostic-derive.rs:788:51 | LL | #[suggestion(no_crate_example, code = "", style = "foo")] @@ -418,25 +418,25 @@ LL | #[suggestion(no_crate_example, code = "", style = "foo")] | = help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only` -error: expected `= "xxx"` +error: derive(Diagnostic): expected `= "xxx"` --> $DIR/subdiagnostic-derive.rs:796:49 | LL | #[suggestion(no_crate_example, code = "", style = 42)] | ^ -error: a diagnostic slug must be the first argument to the attribute +error: derive(Diagnostic): a diagnostic slug must be the first argument to the attribute --> $DIR/subdiagnostic-derive.rs:804:48 | LL | #[suggestion(no_crate_example, code = "", style)] | ^ -error: expected `= "xxx"` +error: derive(Diagnostic): expected `= "xxx"` --> $DIR/subdiagnostic-derive.rs:812:48 | LL | #[suggestion(no_crate_example, code = "", style("foo"))] | ^ -error: `#[primary_span]` is not a valid attribute +error: derive(Diagnostic): `#[primary_span]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:825:5 | LL | #[primary_span] @@ -445,7 +445,7 @@ LL | #[primary_span] = note: there must be exactly one primary span = help: to create a suggestion with multiple spans, use `#[multipart_suggestion]` instead -error: suggestion without `#[primary_span]` field +error: derive(Diagnostic): suggestion without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:822:1 | LL | #[suggestion(no_crate_example, code = "")] diff --git a/tests/ui-fulldeps/stable-mir/check_crate_defs.rs b/tests/ui-fulldeps/stable-mir/check_crate_defs.rs new file mode 100644 index 00000000000..e039ca07dd4 --- /dev/null +++ b/tests/ui-fulldeps/stable-mir/check_crate_defs.rs @@ -0,0 +1,149 @@ +//@ run-pass +//! Test information about crate definitions (local and external). + +//@ ignore-stage1 +//@ ignore-cross-compile +//@ ignore-remote +//@ ignore-windows-gnu mingw has troubles with linking https://github.com/rust-lang/rust/pull/116837 + +#![feature(rustc_private)] +#![feature(assert_matches)] + +extern crate rustc_hir; +#[macro_use] +extern crate rustc_smir; +extern crate rustc_driver; +extern crate rustc_interface; +extern crate stable_mir; + +use rustc_smir::rustc_internal; +use stable_mir::CrateDef; +use std::collections::HashSet; +use std::io::Write; +use std::ops::ControlFlow; + +const CRATE_NAME: &str = "crate_defs"; + +/// This function uses the Stable MIR APIs to get information about the test crate. +fn test_stable_mir() -> ControlFlow<()> { + // Find items in the local crate. + let local = stable_mir::local_crate(); + check_items(&local.statics(), &["PRIVATE_STATIC", "dummy::PUBLIC_STATIC"]); + check_items( + &local.fn_defs(), + &[ + "top_level", + "dummy::public_fn", + "dummy::private_fn", + "dummy::PrivateStruct::new", + "<dummy::PrivateStruct as std::ops::Drop>::drop", + "DummyTrait::method", + "<T as DummyTrait>::method", + ], + ); + + // Find items inside core crate. + // FIXME: We are currently missing primitive type methods and trait implementations for external + // crates. + let core = stable_mir::find_crates("core").pop().expect("Cannot find `core` crate"); + contains( + &core.fn_defs(), + &[ + "std::fmt::Debug::fmt", + "std::option::Option::<T>::is_some", + "std::ptr::swap", + "<std::slice::Iter<'a, T> as std::iter::Iterator>::next", + "core::num::<impl u8>::abs_diff", + ], + ); + // Ensure nothing crashes. There is no public static in core that we can test here. + let _ = core.statics(); + + ControlFlow::Continue(()) +} + +/// Check if the list of definitions matches the expected list. +/// Note that order doesn't matter. +fn check_items<T: CrateDef>(items: &[T], expected: &[&str]) { + let expected: HashSet<_> = expected.iter().map(|s| s.to_string()).collect(); + let item_names: HashSet<_> = items.iter().map(|item| item.name()).collect(); + assert_eq!(item_names, expected); +} + +/// Check that the list contains the expected items. +fn contains<T: CrateDef + std::fmt::Debug>(items: &[T], expected: &[&str]) { + let expected: HashSet<_> = expected.iter().map(|s| s.to_string()).collect(); + let item_names = items.iter().map(|item| item.name()).collect(); + let not_found: Vec<_> = expected.difference(&item_names).collect(); + assert!(not_found.is_empty(), "Missing items: {:?}", not_found); +} + +/// This test will generate and analyze a dummy crate using the stable mir. +/// For that, it will first write the dummy crate into a file. +/// Then it will create a `StableMir` using custom arguments and then +/// it will run the compiler. +fn main() { + let path = "crate_definitions.rs"; + generate_input(&path).unwrap(); + let args = vec![ + "rustc".to_string(), + "--crate-type=lib".to_string(), + "--crate-name".to_string(), + CRATE_NAME.to_string(), + path.to_string(), + ]; + run!(args, test_stable_mir).unwrap(); +} + +fn generate_input(path: &str) -> std::io::Result<()> { + let mut file = std::fs::File::create(path)?; + write!( + file, + r#" + #![allow(dead_code, unused_variables)] + static PRIVATE_STATIC: u8 = 0; + fn top_level() -> &'static str {{ + "hello" + }} + + pub trait DummyTrait {{ + fn method(&self) -> Self; + }} + + impl<T: Copy> DummyTrait for T {{ + fn method(&self) -> T {{ + *self + }} + }} + + pub mod dummy {{ + pub static mut PUBLIC_STATIC: Option<char> = None; + + pub fn public_fn(input: bool) -> bool {{ + private_fn(!input) + }} + + fn private_fn(input: bool) -> bool {{ + todo!() + }} + + struct PrivateStruct {{ + field: u32, + }} + + impl PrivateStruct {{ + fn new() -> Self {{ + Self {{ field: 42 }} + }} + }} + + impl Drop for PrivateStruct {{ + fn drop(&mut self) {{ + println!("Dropping PrivateStruct"); + }} + }} + }} + "# + )?; + Ok(()) +} diff --git a/tests/ui-fulldeps/try-from-u32/errors.rs b/tests/ui-fulldeps/try-from-u32/errors.rs new file mode 100644 index 00000000000..0470063312c --- /dev/null +++ b/tests/ui-fulldeps/try-from-u32/errors.rs @@ -0,0 +1,24 @@ +#![feature(rustc_private)] +//@ edition: 2021 + +// Checks the error messages produced by `#[derive(TryFromU32)]`. + +extern crate rustc_macros; + +use rustc_macros::TryFromU32; + +#[derive(TryFromU32)] +struct MyStruct {} //~ type is not an enum + +#[derive(TryFromU32)] +enum NonTrivial { + A, + B(), + C {}, + D(bool), //~ enum variant cannot have fields + E(bool, bool), //~ enum variant cannot have fields + F { x: bool }, //~ enum variant cannot have fields + G { x: bool, y: bool }, //~ enum variant cannot have fields +} + +fn main() {} diff --git a/tests/ui-fulldeps/try-from-u32/errors.stderr b/tests/ui-fulldeps/try-from-u32/errors.stderr new file mode 100644 index 00000000000..d20567061d7 --- /dev/null +++ b/tests/ui-fulldeps/try-from-u32/errors.stderr @@ -0,0 +1,32 @@ +error: type is not an enum (TryFromU32) + --> $DIR/errors.rs:11:1 + | +LL | struct MyStruct {} + | ^^^^^^ + +error: enum variant cannot have fields (TryFromU32) + --> $DIR/errors.rs:18:7 + | +LL | D(bool), + | ^^^^ + +error: enum variant cannot have fields (TryFromU32) + --> $DIR/errors.rs:19:7 + | +LL | E(bool, bool), + | ^^^^ + +error: enum variant cannot have fields (TryFromU32) + --> $DIR/errors.rs:20:9 + | +LL | F { x: bool }, + | ^ + +error: enum variant cannot have fields (TryFromU32) + --> $DIR/errors.rs:21:9 + | +LL | G { x: bool, y: bool }, + | ^ + +error: aborting due to 5 previous errors + diff --git a/tests/ui-fulldeps/try-from-u32/hygiene.rs b/tests/ui-fulldeps/try-from-u32/hygiene.rs new file mode 100644 index 00000000000..e0655a64a64 --- /dev/null +++ b/tests/ui-fulldeps/try-from-u32/hygiene.rs @@ -0,0 +1,32 @@ +#![feature(rustc_private)] +//@ edition: 2021 +//@ check-pass + +// Checks that the derive macro still works even if the surrounding code has +// shadowed the relevant library types. + +extern crate rustc_macros; + +mod submod { + use rustc_macros::TryFromU32; + + struct Result; + trait TryFrom {} + #[allow(non_camel_case_types)] + struct u32; + struct Ok; + struct Err; + mod core {} + mod std {} + + #[derive(TryFromU32)] + pub(crate) enum MyEnum { + Zero, + One, + } +} + +fn main() { + use submod::MyEnum; + let _: Result<MyEnum, u32> = MyEnum::try_from(1u32); +} diff --git a/tests/ui-fulldeps/try-from-u32/values.rs b/tests/ui-fulldeps/try-from-u32/values.rs new file mode 100644 index 00000000000..180a8f2beb7 --- /dev/null +++ b/tests/ui-fulldeps/try-from-u32/values.rs @@ -0,0 +1,36 @@ +#![feature(assert_matches)] +#![feature(rustc_private)] +//@ edition: 2021 +//@ run-pass + +// Checks the values accepted by the `TryFrom<u32>` impl produced by `#[derive(TryFromU32)]`. + +extern crate rustc_macros; + +use core::assert_matches::assert_matches; +use rustc_macros::TryFromU32; + +#[derive(TryFromU32, Debug, PartialEq)] +#[repr(u32)] +enum Repr { + Zero, + One(), + Seven = 7, +} + +#[derive(TryFromU32, Debug)] +enum NoRepr { + Zero, + One, +} + +fn main() { + assert_eq!(Repr::try_from(0u32), Ok(Repr::Zero)); + assert_eq!(Repr::try_from(1u32), Ok(Repr::One())); + assert_eq!(Repr::try_from(2u32), Err(2)); + assert_eq!(Repr::try_from(7u32), Ok(Repr::Seven)); + + assert_matches!(NoRepr::try_from(0u32), Ok(NoRepr::Zero)); + assert_matches!(NoRepr::try_from(1u32), Ok(NoRepr::One)); + assert_matches!(NoRepr::try_from(2u32), Err(2)); +} diff --git a/tests/ui/abi/c-zst.other.stderr b/tests/ui/abi/c-zst.aarch64-darwin.stderr index 5a656e6ea66..7d384bc875f 100644 --- a/tests/ui/abi/c-zst.other.stderr +++ b/tests/ui/abi/c-zst.aarch64-darwin.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -36,7 +36,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -58,7 +58,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:27:1 + --> $DIR/c-zst.rs:63:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.powerpc-linux.stderr b/tests/ui/abi/c-zst.powerpc-linux.stderr index ba9738050d8..7980710bab6 100644 --- a/tests/ui/abi/c-zst.powerpc-linux.stderr +++ b/tests/ui/abi/c-zst.powerpc-linux.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -47,7 +47,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -69,7 +69,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:27:1 + --> $DIR/c-zst.rs:63:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.rs b/tests/ui/abi/c-zst.rs index 0cfd653b37e..69ebefa09ac 100644 --- a/tests/ui/abi/c-zst.rs +++ b/tests/ui/abi/c-zst.rs @@ -1,27 +1,63 @@ -//@ revisions: other other-linux x86_64-pc-windows-gnu s390x-linux sparc64-linux powerpc-linux //@ normalize-stderr-test: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN" -// ZSTs are only not ignored when the target_env is "gnu", "musl" or "uclibc". However, Rust does -// not currently support any other target_env on these architectures. - -// Ignore the ZST revisions -//@[other] ignore-x86_64-pc-windows-gnu -//@[other] ignore-linux -//@[other-linux] only-linux -//@[other-linux] ignore-s390x -//@[other-linux] ignore-sparc64 -//@[other-linux] ignore-powerpc - -// Pass the ZST indirectly revisions -//@[x86_64-pc-windows-gnu] only-x86_64-pc-windows-gnu -//@[s390x-linux] only-s390x -//@[s390x-linux] only-linux -//@[sparc64-linux] only-sparc64 -//@[sparc64-linux] only-linux -//@[powerpc-linux] only-powerpc -//@[powerpc-linux] only-linux - -#![feature(rustc_attrs)] +/*! +C doesn't have zero-sized types... except it does. + +Standard C doesn't, but some C compilers, like GCC, implement ZSTs as a compiler extension. +This historically has wound up interacting with processor-specific ABIs in fairly ad-hoc ways. +e.g. despite being "zero-sized", sometimes C compilers decide ZSTs consume registers. + +That means these two function signatures may not be compatible: + +``` +extern "C" fn((), i32, i32); +extern "C" fn(i32, (), i32); +``` +*/ + +/* + * ZST IN "C" IS ZERO-SIZED + */ + +//@ revisions: aarch64-darwin +//@[aarch64-darwin] compile-flags: --target aarch64-apple-darwin +//@[aarch64-darwin] needs-llvm-components: aarch64 + +//@ revisions: x86_64-linux +//@[x86_64-linux] compile-flags: --target x86_64-unknown-linux-gnu +//@[x86_64-linux] needs-llvm-components: x86 + + +/* + * ZST IN "C" IS PASS-BY-POINTER + */ + +// according to the SRV4 ABI, an aggregate is always passed in registers, +// and it so happens the GCC extension for ZSTs considers them as structs. +//@ revisions: powerpc-linux +//@[powerpc-linux] compile-flags: --target powerpc-unknown-linux-gnu +//@[powerpc-linux] needs-llvm-components: powerpc + +//@ revisions: s390x-linux +//@[s390x-linux] compile-flags: --target s390x-unknown-linux-gnu +//@[s390x-linux] needs-llvm-components: systemz + +//@ revisions: sparc64-linux +//@[sparc64-linux] compile-flags: --target sparc64-unknown-linux-gnu +//@[sparc64-linux] needs-llvm-components: sparc + +// The Win64 ABI uses slightly different handling for power-of-2 sizes in the ABI, +// so GCC decided that ZSTs are pass-by-pointer, as `0.is_power_of_two() == false` +//@ revisions: x86_64-pc-windows-gnu +//@[x86_64-pc-windows-gnu] compile-flags: --target x86_64-pc-windows-gnu +//@[x86_64-pc-windows-gnu] needs-llvm-components: x86 + + +#![feature(lang_items, no_core, rustc_attrs)] +#![no_core] #![crate_type = "lib"] +#[lang = "sized"] +trait Sized {} + #[rustc_abi(debug)] extern "C" fn pass_zst(_: ()) {} //~ ERROR: fn_abi diff --git a/tests/ui/abi/c-zst.s390x-linux.stderr b/tests/ui/abi/c-zst.s390x-linux.stderr index ba9738050d8..7980710bab6 100644 --- a/tests/ui/abi/c-zst.s390x-linux.stderr +++ b/tests/ui/abi/c-zst.s390x-linux.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -47,7 +47,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -69,7 +69,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:27:1 + --> $DIR/c-zst.rs:63:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.sparc64-linux.stderr b/tests/ui/abi/c-zst.sparc64-linux.stderr index ba9738050d8..7980710bab6 100644 --- a/tests/ui/abi/c-zst.sparc64-linux.stderr +++ b/tests/ui/abi/c-zst.sparc64-linux.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -47,7 +47,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -69,7 +69,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:27:1 + --> $DIR/c-zst.rs:63:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.other-linux.stderr b/tests/ui/abi/c-zst.x86_64-linux.stderr index 5a656e6ea66..7d384bc875f 100644 --- a/tests/ui/abi/c-zst.other-linux.stderr +++ b/tests/ui/abi/c-zst.x86_64-linux.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -36,7 +36,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -58,7 +58,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:27:1 + --> $DIR/c-zst.rs:63:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr index ba9738050d8..7980710bab6 100644 --- a/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr +++ b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -47,7 +47,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -69,7 +69,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: C, can_unwind: false, } - --> $DIR/c-zst.rs:27:1 + --> $DIR/c-zst.rs:63:1 | LL | extern "C" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs index 408dbea4ae8..01d90717107 100644 --- a/tests/ui/abi/compatibility.rs +++ b/tests/ui/abi/compatibility.rs @@ -1,4 +1,5 @@ //@ check-pass +//@ add-core-stubs //@ revisions: host //@ revisions: i686 //@[i686] compile-flags: --target i686-unknown-linux-gnu @@ -58,8 +59,10 @@ //@ revisions: nvptx64 //@[nvptx64] compile-flags: --target nvptx64-nvidia-cuda //@[nvptx64] needs-llvm-components: nvptx -#![feature(rustc_attrs, unsized_fn_params, transparent_unions)] -#![cfg_attr(not(host), feature(no_core, lang_items), no_std, no_core)] +#![feature(no_core, rustc_attrs, lang_items)] +#![feature(unsized_fn_params, transparent_unions)] +#![no_std] +#![no_core] #![allow(unused, improper_ctypes_definitions, internal_features)] // FIXME: some targets are broken in various ways. @@ -67,67 +70,24 @@ // sparc64: https://github.com/rust-lang/rust/issues/115336 // mips64: https://github.com/rust-lang/rust/issues/115404 -#[cfg(host)] -use std::{ - any::Any, marker::PhantomData, mem::ManuallyDrop, num::NonZero, ptr::NonNull, rc::Rc, sync::Arc, -}; +extern crate minicore; +use minicore::*; -/// To work cross-target this test must be no_core. -/// This little prelude supplies what we need. -#[cfg(not(host))] +/// To work cross-target this test must be no_core. This little prelude supplies what we need. +/// +/// Note that `minicore` provides a very minimal subset of `core` items (not yet complete). This +/// prelude contains `alloc` and non-`core` (but in `std`) items that minicore does not stub out. mod prelude { - #[lang = "sized"] - pub trait Sized {} + use minicore::*; - #[lang = "legacy_receiver"] - pub trait LegacyReceiver {} - impl<T: ?Sized> LegacyReceiver for &T {} - impl<T: ?Sized> LegacyReceiver for &mut T {} - - #[lang = "copy"] - pub trait Copy: Sized {} - impl Copy for i32 {} - impl Copy for f32 {} - impl<T: ?Sized> Copy for &T {} - impl<T: ?Sized> Copy for *const T {} - impl<T: ?Sized> Copy for *mut T {} + // Trait stub, no `type_id` method. + pub trait Any: 'static {} #[lang = "clone"] pub trait Clone: Sized { fn clone(&self) -> Self; } - #[lang = "phantom_data"] - pub struct PhantomData<T: ?Sized>; - impl<T: ?Sized> Copy for PhantomData<T> {} - - #[lang = "unsafe_cell"] - #[repr(transparent)] - pub struct UnsafeCell<T: ?Sized> { - value: T, - } - - pub trait Any: 'static {} - - pub enum Option<T> { - None, - Some(T), - } - impl<T: Copy> Copy for Option<T> {} - - pub enum Result<T, E> { - Ok(T), - Err(E), - } - impl<T: Copy, E: Copy> Copy for Result<T, E> {} - - #[lang = "manually_drop"] - #[repr(transparent)] - pub struct ManuallyDrop<T: ?Sized> { - value: T, - } - impl<T: Copy + ?Sized> Copy for ManuallyDrop<T> {} - #[repr(transparent)] #[rustc_layout_scalar_valid_range_start(1)] #[rustc_nonnull_optimization_guaranteed] @@ -185,7 +145,6 @@ mod prelude { alloc: A, } } -#[cfg(not(host))] use prelude::*; macro_rules! test_abi_compatible { diff --git a/tests/ui/abi/debug.stderr b/tests/ui/abi/debug.stderr index 7365839da89..aa51c42c58d 100644 --- a/tests/ui/abi/debug.stderr +++ b/tests/ui/abi/debug.stderr @@ -235,7 +235,7 @@ error: fn_abi_of(test_generic) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -317,7 +317,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -387,7 +387,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -426,7 +426,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Array { @@ -464,7 +464,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -497,7 +497,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Array { @@ -535,7 +535,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -610,7 +610,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -680,7 +680,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -756,7 +756,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -826,7 +826,7 @@ error: ABIs are not compatible abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -929,7 +929,7 @@ error: fn_abi_of(assoc_test) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/abi/sparcv8plus.rs b/tests/ui/abi/sparcv8plus.rs new file mode 100644 index 00000000000..108279b3494 --- /dev/null +++ b/tests/ui/abi/sparcv8plus.rs @@ -0,0 +1,43 @@ +//@ revisions: sparc sparcv8plus sparc_cpu_v9 sparc_feature_v8plus sparc_cpu_v9_feature_v8plus +//@[sparc] compile-flags: --target sparc-unknown-none-elf +//@[sparc] needs-llvm-components: sparc +//@[sparcv8plus] compile-flags: --target sparc-unknown-linux-gnu +//@[sparcv8plus] needs-llvm-components: sparc +//@[sparc_cpu_v9] compile-flags: --target sparc-unknown-none-elf -C target-cpu=v9 +//@[sparc_cpu_v9] needs-llvm-components: sparc +//@[sparc_feature_v8plus] compile-flags: --target sparc-unknown-none-elf -C target-feature=+v8plus +//@[sparc_feature_v8plus] needs-llvm-components: sparc +//@[sparc_cpu_v9_feature_v8plus] compile-flags: --target sparc-unknown-none-elf -C target-cpu=v9 -C target-feature=+v8plus +//@[sparc_cpu_v9_feature_v8plus] needs-llvm-components: sparc +//@ min-llvm-version: 19 + +#![crate_type = "rlib"] +#![feature(no_core, rustc_attrs, lang_items)] +#![no_core] + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +#[rustc_builtin_macro] +macro_rules! compile_error { + () => {}; +} + +#[cfg(all(not(target_feature = "v8plus"), not(target_feature = "v9")))] +compile_error!("-v8plus,-v9"); +//[sparc]~^ ERROR -v8plus,-v9 + +// FIXME: sparc_cpu_v9 should be in "-v8plus,+v9" group (fixed in LLVM 20) +#[cfg(all(target_feature = "v8plus", target_feature = "v9"))] +compile_error!("+v8plus,+v9"); +//[sparcv8plus,sparc_cpu_v9_feature_v8plus,sparc_cpu_v9]~^ ERROR +v8plus,+v9 + +// FIXME: should be rejected +#[cfg(all(target_feature = "v8plus", not(target_feature = "v9")))] +compile_error!("+v8plus,-v9 (FIXME)"); +//[sparc_feature_v8plus]~^ ERROR +v8plus,-v9 (FIXME) + +#[cfg(all(not(target_feature = "v8plus"), target_feature = "v9"))] +compile_error!("-v8plus,+v9"); diff --git a/tests/ui/abi/sparcv8plus.sparc.stderr b/tests/ui/abi/sparcv8plus.sparc.stderr new file mode 100644 index 00000000000..6d14ff53ab9 --- /dev/null +++ b/tests/ui/abi/sparcv8plus.sparc.stderr @@ -0,0 +1,8 @@ +error: -v8plus,-v9 + --> $DIR/sparcv8plus.rs:29:1 + | +LL | compile_error!("-v8plus,-v9"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr b/tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr new file mode 100644 index 00000000000..5e1e1fa5c79 --- /dev/null +++ b/tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr @@ -0,0 +1,8 @@ +error: +v8plus,+v9 + --> $DIR/sparcv8plus.rs:34:1 + | +LL | compile_error!("+v8plus,+v9"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/abi/sparcv8plus.sparc_cpu_v9_feature_v8plus.stderr b/tests/ui/abi/sparcv8plus.sparc_cpu_v9_feature_v8plus.stderr new file mode 100644 index 00000000000..5e1e1fa5c79 --- /dev/null +++ b/tests/ui/abi/sparcv8plus.sparc_cpu_v9_feature_v8plus.stderr @@ -0,0 +1,8 @@ +error: +v8plus,+v9 + --> $DIR/sparcv8plus.rs:34:1 + | +LL | compile_error!("+v8plus,+v9"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr b/tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr new file mode 100644 index 00000000000..8a5375a46bc --- /dev/null +++ b/tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr @@ -0,0 +1,8 @@ +error: +v8plus,-v9 (FIXME) + --> $DIR/sparcv8plus.rs:39:1 + | +LL | compile_error!("+v8plus,-v9 (FIXME)"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/abi/sparcv8plus.sparcv8plus.stderr b/tests/ui/abi/sparcv8plus.sparcv8plus.stderr new file mode 100644 index 00000000000..5e1e1fa5c79 --- /dev/null +++ b/tests/ui/abi/sparcv8plus.sparcv8plus.stderr @@ -0,0 +1,8 @@ +error: +v8plus,+v9 + --> $DIR/sparcv8plus.rs:34:1 + | +LL | compile_error!("+v8plus,+v9"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/abi/sysv64-zst.stderr b/tests/ui/abi/sysv64-zst.stderr index 8b0b84dfa06..8e1791e27d2 100644 --- a/tests/ui/abi/sysv64-zst.stderr +++ b/tests/ui/abi/sysv64-zst.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -36,7 +36,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/abi/win64-zst.rs b/tests/ui/abi/win64-zst.rs index cae32795e16..a2f7d19eb45 100644 --- a/tests/ui/abi/win64-zst.rs +++ b/tests/ui/abi/win64-zst.rs @@ -1,11 +1,24 @@ -//@ only-x86_64 -//@ revisions: other windows-gnu //@ normalize-stderr-test: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN" -//@[other] ignore-windows-gnu -//@[windows-gnu] only-windows-gnu +//@ only-x86_64 + +//@ revisions: x86_64-linux +//@[x86_64-linux] compile-flags: --target x86_64-unknown-linux-gnu +//@[x86_64-linux] needs-llvm-components: x86 -#![feature(rustc_attrs)] +//@ revisions: x86_64-windows-gnu +//@[x86_64-windows-gnu] compile-flags: --target x86_64-pc-windows-gnu +//@[x86_64-windows-gnu] needs-llvm-components: x86 + +//@ revisions: x86_64-windows-msvc +//@[x86_64-windows-msvc] compile-flags: --target x86_64-pc-windows-msvc +//@[x86_64-windows-msvc] needs-llvm-components: x86 + +#![feature(no_core, lang_items, rustc_attrs)] +#![no_core] #![crate_type = "lib"] +#[lang = "sized"] +trait Sized {} + #[rustc_abi(debug)] extern "win64" fn pass_zst(_: ()) {} //~ ERROR: fn_abi diff --git a/tests/ui/abi/win64-zst.other.stderr b/tests/ui/abi/win64-zst.x86_64-linux.stderr index 15db141cb57..76d90670eb1 100644 --- a/tests/ui/abi/win64-zst.other.stderr +++ b/tests/ui/abi/win64-zst.x86_64-linux.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -36,7 +36,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -58,7 +58,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: X86_64Win64, can_unwind: false, } - --> $DIR/win64-zst.rs:11:1 + --> $DIR/win64-zst.rs:24:1 | LL | extern "win64" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/win64-zst.windows-gnu.stderr b/tests/ui/abi/win64-zst.x86_64-windows-gnu.stderr index 7773e0aa2b5..7ee90e24744 100644 --- a/tests/ui/abi/win64-zst.windows-gnu.stderr +++ b/tests/ui/abi/win64-zst.x86_64-windows-gnu.stderr @@ -9,7 +9,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -47,7 +47,7 @@ error: fn_abi_of(pass_zst) = FnAbi { abi: $SOME_ALIGN, pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -69,7 +69,7 @@ error: fn_abi_of(pass_zst) = FnAbi { conv: X86_64Win64, can_unwind: false, } - --> $DIR/win64-zst.rs:11:1 + --> $DIR/win64-zst.rs:24:1 | LL | extern "win64" fn pass_zst(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/win64-zst.x86_64-windows-msvc.stderr b/tests/ui/abi/win64-zst.x86_64-windows-msvc.stderr new file mode 100644 index 00000000000..76d90670eb1 --- /dev/null +++ b/tests/ui/abi/win64-zst.x86_64-windows-msvc.stderr @@ -0,0 +1,67 @@ +error: fn_abi_of(pass_zst) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Memory { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Memory { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: X86_64Win64, + can_unwind: false, + } + --> $DIR/win64-zst.rs:24:1 + | +LL | extern "win64" fn pass_zst(_: ()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/array-slice-vec/vec-macro-with-comma-only.rs b/tests/ui/array-slice-vec/vec-macro-with-comma-only.rs index 574a53c58fe..0f99f6b1b1e 100644 --- a/tests/ui/array-slice-vec/vec-macro-with-comma-only.rs +++ b/tests/ui/array-slice-vec/vec-macro-with-comma-only.rs @@ -1,3 +1,3 @@ pub fn main() { - vec![,]; //~ ERROR no rules expected the token `,` + vec![,]; //~ ERROR no rules expected `,` } diff --git a/tests/ui/array-slice-vec/vec-macro-with-comma-only.stderr b/tests/ui/array-slice-vec/vec-macro-with-comma-only.stderr index b3f953af6d2..d76d493eca8 100644 --- a/tests/ui/array-slice-vec/vec-macro-with-comma-only.stderr +++ b/tests/ui/array-slice-vec/vec-macro-with-comma-only.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `,` +error: no rules expected `,` --> $DIR/vec-macro-with-comma-only.rs:2:10 | LL | vec![,]; diff --git a/tests/ui/asm/bad-arch.rs b/tests/ui/asm/bad-arch.rs deleted file mode 100644 index f84b9944b36..00000000000 --- a/tests/ui/asm/bad-arch.rs +++ /dev/null @@ -1,26 +0,0 @@ -//@ compile-flags: --target sparc-unknown-linux-gnu -//@ needs-llvm-components: sparc - -#![feature(no_core, lang_items, rustc_attrs)] -#![no_core] - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! global_asm { - () => {}; -} -#[lang = "sized"] -trait Sized {} - -fn main() { - unsafe { - asm!(""); - //~^ ERROR inline assembly is unsupported on this target - } -} - -global_asm!(""); -//~^ ERROR inline assembly is unsupported on this target diff --git a/tests/ui/asm/bad-arch.stderr b/tests/ui/asm/bad-arch.stderr deleted file mode 100644 index c6f726600eb..00000000000 --- a/tests/ui/asm/bad-arch.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0472]: inline assembly is unsupported on this target - --> $DIR/bad-arch.rs:20:9 - | -LL | asm!(""); - | ^^^^^^^^ - -error[E0472]: inline assembly is unsupported on this target - --> $DIR/bad-arch.rs:25:1 - | -LL | global_asm!(""); - | ^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0472`. diff --git a/tests/ui/asm/powerpc/bad-reg.aix64.stderr b/tests/ui/asm/powerpc/bad-reg.aix64.stderr new file mode 100644 index 00000000000..34105ceac04 --- /dev/null +++ b/tests/ui/asm/powerpc/bad-reg.aix64.stderr @@ -0,0 +1,264 @@ +error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:32:18 + | +LL | asm!("", out("sp") _); + | ^^^^^^^^^^^ + +error: invalid register `r2`: r2 is a system reserved register and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:34:18 + | +LL | asm!("", out("r2") _); + | ^^^^^^^^^^^ + +error: invalid register `r29`: r29 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", out("r29") _); + | ^^^^^^^^^^^^ + +error: invalid register `r30`: r30 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", out("r30") _); + | ^^^^^^^^^^^^ + +error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:42:18 + | +LL | asm!("", out("fp") _); + | ^^^^^^^^^^^ + +error: invalid register `lr`: the link register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:44:18 + | +LL | asm!("", out("lr") _); + | ^^^^^^^^^^^ + +error: invalid register `ctr`: the counter register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:46:18 + | +LL | asm!("", out("ctr") _); + | ^^^^^^^^^^^^ + +error: invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:48:18 + | +LL | asm!("", out("vrsave") _); + | ^^^^^^^^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:66:18 + | +LL | asm!("", in("cr") x); + | ^^^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:69:18 + | +LL | asm!("", out("cr") x); + | ^^^^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:72:26 + | +LL | asm!("/* {} */", in(cr) x); + | ^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:75:26 + | +LL | asm!("/* {} */", out(cr) _); + | ^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:79:18 + | +LL | asm!("", in("xer") x); + | ^^^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:82:18 + | +LL | asm!("", out("xer") x); + | ^^^^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:85:26 + | +LL | asm!("/* {} */", in(xer) x); + | ^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:88:26 + | +LL | asm!("/* {} */", out(xer) _); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:93:18 + | +LL | asm!("", in("v0") x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:96:18 + | +LL | asm!("", out("v0") x); + | ^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:99:26 + | +LL | asm!("/* {} */", in(vreg) x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:102:26 + | +LL | asm!("/* {} */", out(vreg) _); + | ^^^^^^^^^^^ + +error: register `cr0` conflicts with register `cr` + --> $DIR/bad-reg.rs:106:31 + | +LL | asm!("", out("cr") _, out("cr0") _); + | ----------- ^^^^^^^^^^^^ register `cr0` + | | + | register `cr` + +error: register `cr1` conflicts with register `cr` + --> $DIR/bad-reg.rs:108:31 + | +LL | asm!("", out("cr") _, out("cr1") _); + | ----------- ^^^^^^^^^^^^ register `cr1` + | | + | register `cr` + +error: register `cr2` conflicts with register `cr` + --> $DIR/bad-reg.rs:110:31 + | +LL | asm!("", out("cr") _, out("cr2") _); + | ----------- ^^^^^^^^^^^^ register `cr2` + | | + | register `cr` + +error: register `cr3` conflicts with register `cr` + --> $DIR/bad-reg.rs:112:31 + | +LL | asm!("", out("cr") _, out("cr3") _); + | ----------- ^^^^^^^^^^^^ register `cr3` + | | + | register `cr` + +error: register `cr4` conflicts with register `cr` + --> $DIR/bad-reg.rs:114:31 + | +LL | asm!("", out("cr") _, out("cr4") _); + | ----------- ^^^^^^^^^^^^ register `cr4` + | | + | register `cr` + +error: register `cr5` conflicts with register `cr` + --> $DIR/bad-reg.rs:116:31 + | +LL | asm!("", out("cr") _, out("cr5") _); + | ----------- ^^^^^^^^^^^^ register `cr5` + | | + | register `cr` + +error: register `cr6` conflicts with register `cr` + --> $DIR/bad-reg.rs:118:31 + | +LL | asm!("", out("cr") _, out("cr6") _); + | ----------- ^^^^^^^^^^^^ register `cr6` + | | + | register `cr` + +error: register `cr7` conflicts with register `cr` + --> $DIR/bad-reg.rs:120:31 + | +LL | asm!("", out("cr") _, out("cr7") _); + | ----------- ^^^^^^^^^^^^ register `cr7` + | | + | register `cr` + +error: cannot use register `r13`: r13 is a reserved register on this target + --> $DIR/bad-reg.rs:36:18 + | +LL | asm!("", out("r13") _); + | ^^^^^^^^^^^^ + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:66:27 + | +LL | asm!("", in("cr") x); + | ^ + | + = note: register class `cr` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:69:28 + | +LL | asm!("", out("cr") x); + | ^ + | + = note: register class `cr` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:72:33 + | +LL | asm!("/* {} */", in(cr) x); + | ^ + | + = note: register class `cr` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:79:28 + | +LL | asm!("", in("xer") x); + | ^ + | + = note: register class `xer` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:82:29 + | +LL | asm!("", out("xer") x); + | ^ + | + = note: register class `xer` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:85:34 + | +LL | asm!("/* {} */", in(xer) x); + | ^ + | + = note: register class `xer` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:93:27 + | +LL | asm!("", in("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:96:28 + | +LL | asm!("", out("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:99:35 + | +LL | asm!("/* {} */", in(vreg) x); + | ^ + | + = note: register class `vreg` supports these types: + +error: aborting due to 38 previous errors + diff --git a/tests/ui/asm/powerpc/bad-reg.powerpc.stderr b/tests/ui/asm/powerpc/bad-reg.powerpc.stderr new file mode 100644 index 00000000000..34105ceac04 --- /dev/null +++ b/tests/ui/asm/powerpc/bad-reg.powerpc.stderr @@ -0,0 +1,264 @@ +error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:32:18 + | +LL | asm!("", out("sp") _); + | ^^^^^^^^^^^ + +error: invalid register `r2`: r2 is a system reserved register and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:34:18 + | +LL | asm!("", out("r2") _); + | ^^^^^^^^^^^ + +error: invalid register `r29`: r29 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", out("r29") _); + | ^^^^^^^^^^^^ + +error: invalid register `r30`: r30 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", out("r30") _); + | ^^^^^^^^^^^^ + +error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:42:18 + | +LL | asm!("", out("fp") _); + | ^^^^^^^^^^^ + +error: invalid register `lr`: the link register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:44:18 + | +LL | asm!("", out("lr") _); + | ^^^^^^^^^^^ + +error: invalid register `ctr`: the counter register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:46:18 + | +LL | asm!("", out("ctr") _); + | ^^^^^^^^^^^^ + +error: invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:48:18 + | +LL | asm!("", out("vrsave") _); + | ^^^^^^^^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:66:18 + | +LL | asm!("", in("cr") x); + | ^^^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:69:18 + | +LL | asm!("", out("cr") x); + | ^^^^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:72:26 + | +LL | asm!("/* {} */", in(cr) x); + | ^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:75:26 + | +LL | asm!("/* {} */", out(cr) _); + | ^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:79:18 + | +LL | asm!("", in("xer") x); + | ^^^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:82:18 + | +LL | asm!("", out("xer") x); + | ^^^^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:85:26 + | +LL | asm!("/* {} */", in(xer) x); + | ^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:88:26 + | +LL | asm!("/* {} */", out(xer) _); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:93:18 + | +LL | asm!("", in("v0") x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:96:18 + | +LL | asm!("", out("v0") x); + | ^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:99:26 + | +LL | asm!("/* {} */", in(vreg) x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:102:26 + | +LL | asm!("/* {} */", out(vreg) _); + | ^^^^^^^^^^^ + +error: register `cr0` conflicts with register `cr` + --> $DIR/bad-reg.rs:106:31 + | +LL | asm!("", out("cr") _, out("cr0") _); + | ----------- ^^^^^^^^^^^^ register `cr0` + | | + | register `cr` + +error: register `cr1` conflicts with register `cr` + --> $DIR/bad-reg.rs:108:31 + | +LL | asm!("", out("cr") _, out("cr1") _); + | ----------- ^^^^^^^^^^^^ register `cr1` + | | + | register `cr` + +error: register `cr2` conflicts with register `cr` + --> $DIR/bad-reg.rs:110:31 + | +LL | asm!("", out("cr") _, out("cr2") _); + | ----------- ^^^^^^^^^^^^ register `cr2` + | | + | register `cr` + +error: register `cr3` conflicts with register `cr` + --> $DIR/bad-reg.rs:112:31 + | +LL | asm!("", out("cr") _, out("cr3") _); + | ----------- ^^^^^^^^^^^^ register `cr3` + | | + | register `cr` + +error: register `cr4` conflicts with register `cr` + --> $DIR/bad-reg.rs:114:31 + | +LL | asm!("", out("cr") _, out("cr4") _); + | ----------- ^^^^^^^^^^^^ register `cr4` + | | + | register `cr` + +error: register `cr5` conflicts with register `cr` + --> $DIR/bad-reg.rs:116:31 + | +LL | asm!("", out("cr") _, out("cr5") _); + | ----------- ^^^^^^^^^^^^ register `cr5` + | | + | register `cr` + +error: register `cr6` conflicts with register `cr` + --> $DIR/bad-reg.rs:118:31 + | +LL | asm!("", out("cr") _, out("cr6") _); + | ----------- ^^^^^^^^^^^^ register `cr6` + | | + | register `cr` + +error: register `cr7` conflicts with register `cr` + --> $DIR/bad-reg.rs:120:31 + | +LL | asm!("", out("cr") _, out("cr7") _); + | ----------- ^^^^^^^^^^^^ register `cr7` + | | + | register `cr` + +error: cannot use register `r13`: r13 is a reserved register on this target + --> $DIR/bad-reg.rs:36:18 + | +LL | asm!("", out("r13") _); + | ^^^^^^^^^^^^ + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:66:27 + | +LL | asm!("", in("cr") x); + | ^ + | + = note: register class `cr` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:69:28 + | +LL | asm!("", out("cr") x); + | ^ + | + = note: register class `cr` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:72:33 + | +LL | asm!("/* {} */", in(cr) x); + | ^ + | + = note: register class `cr` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:79:28 + | +LL | asm!("", in("xer") x); + | ^ + | + = note: register class `xer` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:82:29 + | +LL | asm!("", out("xer") x); + | ^ + | + = note: register class `xer` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:85:34 + | +LL | asm!("/* {} */", in(xer) x); + | ^ + | + = note: register class `xer` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:93:27 + | +LL | asm!("", in("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:96:28 + | +LL | asm!("", out("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:99:35 + | +LL | asm!("/* {} */", in(vreg) x); + | ^ + | + = note: register class `vreg` supports these types: + +error: aborting due to 38 previous errors + diff --git a/tests/ui/asm/powerpc/bad-reg.powerpc64.stderr b/tests/ui/asm/powerpc/bad-reg.powerpc64.stderr new file mode 100644 index 00000000000..34105ceac04 --- /dev/null +++ b/tests/ui/asm/powerpc/bad-reg.powerpc64.stderr @@ -0,0 +1,264 @@ +error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:32:18 + | +LL | asm!("", out("sp") _); + | ^^^^^^^^^^^ + +error: invalid register `r2`: r2 is a system reserved register and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:34:18 + | +LL | asm!("", out("r2") _); + | ^^^^^^^^^^^ + +error: invalid register `r29`: r29 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", out("r29") _); + | ^^^^^^^^^^^^ + +error: invalid register `r30`: r30 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", out("r30") _); + | ^^^^^^^^^^^^ + +error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:42:18 + | +LL | asm!("", out("fp") _); + | ^^^^^^^^^^^ + +error: invalid register `lr`: the link register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:44:18 + | +LL | asm!("", out("lr") _); + | ^^^^^^^^^^^ + +error: invalid register `ctr`: the counter register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:46:18 + | +LL | asm!("", out("ctr") _); + | ^^^^^^^^^^^^ + +error: invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:48:18 + | +LL | asm!("", out("vrsave") _); + | ^^^^^^^^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:66:18 + | +LL | asm!("", in("cr") x); + | ^^^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:69:18 + | +LL | asm!("", out("cr") x); + | ^^^^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:72:26 + | +LL | asm!("/* {} */", in(cr) x); + | ^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:75:26 + | +LL | asm!("/* {} */", out(cr) _); + | ^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:79:18 + | +LL | asm!("", in("xer") x); + | ^^^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:82:18 + | +LL | asm!("", out("xer") x); + | ^^^^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:85:26 + | +LL | asm!("/* {} */", in(xer) x); + | ^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:88:26 + | +LL | asm!("/* {} */", out(xer) _); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:93:18 + | +LL | asm!("", in("v0") x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:96:18 + | +LL | asm!("", out("v0") x); + | ^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:99:26 + | +LL | asm!("/* {} */", in(vreg) x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:102:26 + | +LL | asm!("/* {} */", out(vreg) _); + | ^^^^^^^^^^^ + +error: register `cr0` conflicts with register `cr` + --> $DIR/bad-reg.rs:106:31 + | +LL | asm!("", out("cr") _, out("cr0") _); + | ----------- ^^^^^^^^^^^^ register `cr0` + | | + | register `cr` + +error: register `cr1` conflicts with register `cr` + --> $DIR/bad-reg.rs:108:31 + | +LL | asm!("", out("cr") _, out("cr1") _); + | ----------- ^^^^^^^^^^^^ register `cr1` + | | + | register `cr` + +error: register `cr2` conflicts with register `cr` + --> $DIR/bad-reg.rs:110:31 + | +LL | asm!("", out("cr") _, out("cr2") _); + | ----------- ^^^^^^^^^^^^ register `cr2` + | | + | register `cr` + +error: register `cr3` conflicts with register `cr` + --> $DIR/bad-reg.rs:112:31 + | +LL | asm!("", out("cr") _, out("cr3") _); + | ----------- ^^^^^^^^^^^^ register `cr3` + | | + | register `cr` + +error: register `cr4` conflicts with register `cr` + --> $DIR/bad-reg.rs:114:31 + | +LL | asm!("", out("cr") _, out("cr4") _); + | ----------- ^^^^^^^^^^^^ register `cr4` + | | + | register `cr` + +error: register `cr5` conflicts with register `cr` + --> $DIR/bad-reg.rs:116:31 + | +LL | asm!("", out("cr") _, out("cr5") _); + | ----------- ^^^^^^^^^^^^ register `cr5` + | | + | register `cr` + +error: register `cr6` conflicts with register `cr` + --> $DIR/bad-reg.rs:118:31 + | +LL | asm!("", out("cr") _, out("cr6") _); + | ----------- ^^^^^^^^^^^^ register `cr6` + | | + | register `cr` + +error: register `cr7` conflicts with register `cr` + --> $DIR/bad-reg.rs:120:31 + | +LL | asm!("", out("cr") _, out("cr7") _); + | ----------- ^^^^^^^^^^^^ register `cr7` + | | + | register `cr` + +error: cannot use register `r13`: r13 is a reserved register on this target + --> $DIR/bad-reg.rs:36:18 + | +LL | asm!("", out("r13") _); + | ^^^^^^^^^^^^ + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:66:27 + | +LL | asm!("", in("cr") x); + | ^ + | + = note: register class `cr` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:69:28 + | +LL | asm!("", out("cr") x); + | ^ + | + = note: register class `cr` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:72:33 + | +LL | asm!("/* {} */", in(cr) x); + | ^ + | + = note: register class `cr` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:79:28 + | +LL | asm!("", in("xer") x); + | ^ + | + = note: register class `xer` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:82:29 + | +LL | asm!("", out("xer") x); + | ^ + | + = note: register class `xer` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:85:34 + | +LL | asm!("/* {} */", in(xer) x); + | ^ + | + = note: register class `xer` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:93:27 + | +LL | asm!("", in("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:96:28 + | +LL | asm!("", out("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:99:35 + | +LL | asm!("/* {} */", in(vreg) x); + | ^ + | + = note: register class `vreg` supports these types: + +error: aborting due to 38 previous errors + diff --git a/tests/ui/asm/powerpc/bad-reg.powerpc64le.stderr b/tests/ui/asm/powerpc/bad-reg.powerpc64le.stderr new file mode 100644 index 00000000000..34105ceac04 --- /dev/null +++ b/tests/ui/asm/powerpc/bad-reg.powerpc64le.stderr @@ -0,0 +1,264 @@ +error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:32:18 + | +LL | asm!("", out("sp") _); + | ^^^^^^^^^^^ + +error: invalid register `r2`: r2 is a system reserved register and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:34:18 + | +LL | asm!("", out("r2") _); + | ^^^^^^^^^^^ + +error: invalid register `r29`: r29 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", out("r29") _); + | ^^^^^^^^^^^^ + +error: invalid register `r30`: r30 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", out("r30") _); + | ^^^^^^^^^^^^ + +error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:42:18 + | +LL | asm!("", out("fp") _); + | ^^^^^^^^^^^ + +error: invalid register `lr`: the link register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:44:18 + | +LL | asm!("", out("lr") _); + | ^^^^^^^^^^^ + +error: invalid register `ctr`: the counter register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:46:18 + | +LL | asm!("", out("ctr") _); + | ^^^^^^^^^^^^ + +error: invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:48:18 + | +LL | asm!("", out("vrsave") _); + | ^^^^^^^^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:66:18 + | +LL | asm!("", in("cr") x); + | ^^^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:69:18 + | +LL | asm!("", out("cr") x); + | ^^^^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:72:26 + | +LL | asm!("/* {} */", in(cr) x); + | ^^^^^^^^ + +error: register class `cr` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:75:26 + | +LL | asm!("/* {} */", out(cr) _); + | ^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:79:18 + | +LL | asm!("", in("xer") x); + | ^^^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:82:18 + | +LL | asm!("", out("xer") x); + | ^^^^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:85:26 + | +LL | asm!("/* {} */", in(xer) x); + | ^^^^^^^^^ + +error: register class `xer` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:88:26 + | +LL | asm!("/* {} */", out(xer) _); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:93:18 + | +LL | asm!("", in("v0") x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:96:18 + | +LL | asm!("", out("v0") x); + | ^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:99:26 + | +LL | asm!("/* {} */", in(vreg) x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:102:26 + | +LL | asm!("/* {} */", out(vreg) _); + | ^^^^^^^^^^^ + +error: register `cr0` conflicts with register `cr` + --> $DIR/bad-reg.rs:106:31 + | +LL | asm!("", out("cr") _, out("cr0") _); + | ----------- ^^^^^^^^^^^^ register `cr0` + | | + | register `cr` + +error: register `cr1` conflicts with register `cr` + --> $DIR/bad-reg.rs:108:31 + | +LL | asm!("", out("cr") _, out("cr1") _); + | ----------- ^^^^^^^^^^^^ register `cr1` + | | + | register `cr` + +error: register `cr2` conflicts with register `cr` + --> $DIR/bad-reg.rs:110:31 + | +LL | asm!("", out("cr") _, out("cr2") _); + | ----------- ^^^^^^^^^^^^ register `cr2` + | | + | register `cr` + +error: register `cr3` conflicts with register `cr` + --> $DIR/bad-reg.rs:112:31 + | +LL | asm!("", out("cr") _, out("cr3") _); + | ----------- ^^^^^^^^^^^^ register `cr3` + | | + | register `cr` + +error: register `cr4` conflicts with register `cr` + --> $DIR/bad-reg.rs:114:31 + | +LL | asm!("", out("cr") _, out("cr4") _); + | ----------- ^^^^^^^^^^^^ register `cr4` + | | + | register `cr` + +error: register `cr5` conflicts with register `cr` + --> $DIR/bad-reg.rs:116:31 + | +LL | asm!("", out("cr") _, out("cr5") _); + | ----------- ^^^^^^^^^^^^ register `cr5` + | | + | register `cr` + +error: register `cr6` conflicts with register `cr` + --> $DIR/bad-reg.rs:118:31 + | +LL | asm!("", out("cr") _, out("cr6") _); + | ----------- ^^^^^^^^^^^^ register `cr6` + | | + | register `cr` + +error: register `cr7` conflicts with register `cr` + --> $DIR/bad-reg.rs:120:31 + | +LL | asm!("", out("cr") _, out("cr7") _); + | ----------- ^^^^^^^^^^^^ register `cr7` + | | + | register `cr` + +error: cannot use register `r13`: r13 is a reserved register on this target + --> $DIR/bad-reg.rs:36:18 + | +LL | asm!("", out("r13") _); + | ^^^^^^^^^^^^ + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:66:27 + | +LL | asm!("", in("cr") x); + | ^ + | + = note: register class `cr` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:69:28 + | +LL | asm!("", out("cr") x); + | ^ + | + = note: register class `cr` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:72:33 + | +LL | asm!("/* {} */", in(cr) x); + | ^ + | + = note: register class `cr` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:79:28 + | +LL | asm!("", in("xer") x); + | ^ + | + = note: register class `xer` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:82:29 + | +LL | asm!("", out("xer") x); + | ^ + | + = note: register class `xer` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:85:34 + | +LL | asm!("/* {} */", in(xer) x); + | ^ + | + = note: register class `xer` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:93:27 + | +LL | asm!("", in("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:96:28 + | +LL | asm!("", out("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:99:35 + | +LL | asm!("/* {} */", in(vreg) x); + | ^ + | + = note: register class `vreg` supports these types: + +error: aborting due to 38 previous errors + diff --git a/tests/ui/asm/powerpc/bad-reg.rs b/tests/ui/asm/powerpc/bad-reg.rs new file mode 100644 index 00000000000..5023ad51838 --- /dev/null +++ b/tests/ui/asm/powerpc/bad-reg.rs @@ -0,0 +1,124 @@ +//@ revisions: powerpc powerpc64 powerpc64le aix64 +//@[powerpc] compile-flags: --target powerpc-unknown-linux-gnu +//@[powerpc] needs-llvm-components: powerpc +//@[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu +//@[powerpc64] needs-llvm-components: powerpc +//@[powerpc64le] compile-flags: --target powerpc64le-unknown-linux-gnu +//@[powerpc64le] needs-llvm-components: powerpc +//@[aix64] compile-flags: --target powerpc64-ibm-aix +//@[aix64] needs-llvm-components: powerpc +//@ needs-asm-support + +#![crate_type = "rlib"] +#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] +#![no_core] + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +impl Copy for i32 {} + +#[rustc_builtin_macro] +macro_rules! asm { + () => {}; +} + +fn f() { + let mut x = 0; + unsafe { + // Unsupported registers + asm!("", out("sp") _); + //~^ ERROR invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + asm!("", out("r2") _); + //~^ ERROR invalid register `r2`: r2 is a system reserved register and cannot be used as an operand for inline asm + asm!("", out("r13") _); + //~^ ERROR cannot use register `r13`: r13 is a reserved register on this target + asm!("", out("r29") _); + //~^ ERROR invalid register `r29`: r29 is used internally by LLVM and cannot be used as an operand for inline asm + asm!("", out("r30") _); + //~^ ERROR invalid register `r30`: r30 is used internally by LLVM and cannot be used as an operand for inline asm + asm!("", out("fp") _); + //~^ ERROR invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + asm!("", out("lr") _); + //~^ ERROR invalid register `lr`: the link register cannot be used as an operand for inline asm + asm!("", out("ctr") _); + //~^ ERROR invalid register `ctr`: the counter register cannot be used as an operand for inline asm + asm!("", out("vrsave") _); + //~^ ERROR invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm + asm!("", out("v20") _); + asm!("", out("v21") _); + asm!("", out("v22") _); + asm!("", out("v23") _); + asm!("", out("v24") _); + asm!("", out("v25") _); + asm!("", out("v26") _); + asm!("", out("v27") _); + asm!("", out("v28") _); + asm!("", out("v29") _); + asm!("", out("v30") _); + asm!("", out("v31") _); + + // Clobber-only registers + // cr + asm!("", out("cr") _); // ok + asm!("", in("cr") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("", out("cr") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", in(cr) x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", out(cr) _); + //~^ ERROR can only be used as a clobber + // xer + asm!("", out("xer") _); // ok + asm!("", in("xer") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("", out("xer") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", in(xer) x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", out(xer) _); + //~^ ERROR can only be used as a clobber + // vreg + asm!("", out("v0") _); // ok + // FIXME: will be supported in the subsequent patch: https://github.com/rust-lang/rust/pull/131551 + asm!("", in("v0") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("", out("v0") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", in(vreg) x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", out(vreg) _); + //~^ ERROR can only be used as a clobber + + // Overlapping-only registers + asm!("", out("cr") _, out("cr0") _); + //~^ ERROR register `cr0` conflicts with register `cr` + asm!("", out("cr") _, out("cr1") _); + //~^ ERROR register `cr1` conflicts with register `cr` + asm!("", out("cr") _, out("cr2") _); + //~^ ERROR register `cr2` conflicts with register `cr` + asm!("", out("cr") _, out("cr3") _); + //~^ ERROR register `cr3` conflicts with register `cr` + asm!("", out("cr") _, out("cr4") _); + //~^ ERROR register `cr4` conflicts with register `cr` + asm!("", out("cr") _, out("cr5") _); + //~^ ERROR register `cr5` conflicts with register `cr` + asm!("", out("cr") _, out("cr6") _); + //~^ ERROR register `cr6` conflicts with register `cr` + asm!("", out("cr") _, out("cr7") _); + //~^ ERROR register `cr7` conflicts with register `cr` + asm!("", out("f0") _, out("v0") _); // ok + } +} diff --git a/tests/ui/asm/riscv/bad-reg.riscv32e.stderr b/tests/ui/asm/riscv/bad-reg.riscv32e.stderr new file mode 100644 index 00000000000..0ca566b7933 --- /dev/null +++ b/tests/ui/asm/riscv/bad-reg.riscv32e.stderr @@ -0,0 +1,212 @@ +error: invalid register `s1`: s1 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:34:18 + | +LL | asm!("", out("s1") _); + | ^^^^^^^^^^^ + +error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:36:18 + | +LL | asm!("", out("fp") _); + | ^^^^^^^^^^^ + +error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", out("sp") _); + | ^^^^^^^^^^^ + +error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", out("gp") _); + | ^^^^^^^^^^^ + +error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:42:18 + | +LL | asm!("", out("gp") _); + | ^^^^^^^^^^^ + +error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:44:18 + | +LL | asm!("", out("tp") _); + | ^^^^^^^^^^^ + +error: invalid register `zero`: the zero register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:46:18 + | +LL | asm!("", out("zero") _); + | ^^^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:97:18 + | +LL | asm!("", in("v0") x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:100:18 + | +LL | asm!("", out("v0") x); + | ^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:103:26 + | +LL | asm!("/* {} */", in(vreg) x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:106:26 + | +LL | asm!("/* {} */", out(vreg) _); + | ^^^^^^^^^^^ + +error: cannot use register `x16`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:49:18 + | +LL | asm!("", out("x16") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x17`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:51:18 + | +LL | asm!("", out("x17") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x18`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:53:18 + | +LL | asm!("", out("x18") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x19`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:55:18 + | +LL | asm!("", out("x19") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x20`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:57:18 + | +LL | asm!("", out("x20") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x21`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:59:18 + | +LL | asm!("", out("x21") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x22`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:61:18 + | +LL | asm!("", out("x22") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x23`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:63:18 + | +LL | asm!("", out("x23") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x24`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:65:18 + | +LL | asm!("", out("x24") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x25`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:67:18 + | +LL | asm!("", out("x25") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x26`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:69:18 + | +LL | asm!("", out("x26") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x27`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:71:18 + | +LL | asm!("", out("x27") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x28`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:73:18 + | +LL | asm!("", out("x28") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x29`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:75:18 + | +LL | asm!("", out("x29") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x30`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:77:18 + | +LL | asm!("", out("x30") _); + | ^^^^^^^^^^^^ + +error: cannot use register `x31`: register can't be used with the `e` target feature + --> $DIR/bad-reg.rs:79:18 + | +LL | asm!("", out("x31") _); + | ^^^^^^^^^^^^ + +error: register class `freg` requires at least one of the following target features: d, f + --> $DIR/bad-reg.rs:83:26 + | +LL | asm!("/* {} */", in(freg) f); + | ^^^^^^^^^^ + +error: register class `freg` requires at least one of the following target features: d, f + --> $DIR/bad-reg.rs:85:26 + | +LL | asm!("/* {} */", out(freg) _); + | ^^^^^^^^^^^ + +error: register class `freg` requires at least one of the following target features: d, f + --> $DIR/bad-reg.rs:87:26 + | +LL | asm!("/* {} */", in(freg) d); + | ^^^^^^^^^^ + +error: register class `freg` requires at least one of the following target features: d, f + --> $DIR/bad-reg.rs:90:26 + | +LL | asm!("/* {} */", out(freg) d); + | ^^^^^^^^^^^ + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:97:27 + | +LL | asm!("", in("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:100:28 + | +LL | asm!("", out("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:103:35 + | +LL | asm!("/* {} */", in(vreg) x); + | ^ + | + = note: register class `vreg` supports these types: + +error: aborting due to 34 previous errors + diff --git a/tests/ui/asm/riscv/bad-reg.riscv32gc.stderr b/tests/ui/asm/riscv/bad-reg.riscv32gc.stderr new file mode 100644 index 00000000000..81b72884a12 --- /dev/null +++ b/tests/ui/asm/riscv/bad-reg.riscv32gc.stderr @@ -0,0 +1,92 @@ +error: invalid register `s1`: s1 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:34:18 + | +LL | asm!("", out("s1") _); + | ^^^^^^^^^^^ + +error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:36:18 + | +LL | asm!("", out("fp") _); + | ^^^^^^^^^^^ + +error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", out("sp") _); + | ^^^^^^^^^^^ + +error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", out("gp") _); + | ^^^^^^^^^^^ + +error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:42:18 + | +LL | asm!("", out("gp") _); + | ^^^^^^^^^^^ + +error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:44:18 + | +LL | asm!("", out("tp") _); + | ^^^^^^^^^^^ + +error: invalid register `zero`: the zero register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:46:18 + | +LL | asm!("", out("zero") _); + | ^^^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:97:18 + | +LL | asm!("", in("v0") x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:100:18 + | +LL | asm!("", out("v0") x); + | ^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:103:26 + | +LL | asm!("/* {} */", in(vreg) x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:106:26 + | +LL | asm!("/* {} */", out(vreg) _); + | ^^^^^^^^^^^ + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:97:27 + | +LL | asm!("", in("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:100:28 + | +LL | asm!("", out("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:103:35 + | +LL | asm!("/* {} */", in(vreg) x); + | ^ + | + = note: register class `vreg` supports these types: + +error: aborting due to 14 previous errors + diff --git a/tests/ui/asm/riscv/bad-reg.riscv32i.stderr b/tests/ui/asm/riscv/bad-reg.riscv32i.stderr new file mode 100644 index 00000000000..b951ffb3982 --- /dev/null +++ b/tests/ui/asm/riscv/bad-reg.riscv32i.stderr @@ -0,0 +1,116 @@ +error: invalid register `s1`: s1 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:34:18 + | +LL | asm!("", out("s1") _); + | ^^^^^^^^^^^ + +error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:36:18 + | +LL | asm!("", out("fp") _); + | ^^^^^^^^^^^ + +error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", out("sp") _); + | ^^^^^^^^^^^ + +error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", out("gp") _); + | ^^^^^^^^^^^ + +error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:42:18 + | +LL | asm!("", out("gp") _); + | ^^^^^^^^^^^ + +error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:44:18 + | +LL | asm!("", out("tp") _); + | ^^^^^^^^^^^ + +error: invalid register `zero`: the zero register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:46:18 + | +LL | asm!("", out("zero") _); + | ^^^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:97:18 + | +LL | asm!("", in("v0") x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:100:18 + | +LL | asm!("", out("v0") x); + | ^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:103:26 + | +LL | asm!("/* {} */", in(vreg) x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:106:26 + | +LL | asm!("/* {} */", out(vreg) _); + | ^^^^^^^^^^^ + +error: register class `freg` requires at least one of the following target features: d, f + --> $DIR/bad-reg.rs:83:26 + | +LL | asm!("/* {} */", in(freg) f); + | ^^^^^^^^^^ + +error: register class `freg` requires at least one of the following target features: d, f + --> $DIR/bad-reg.rs:85:26 + | +LL | asm!("/* {} */", out(freg) _); + | ^^^^^^^^^^^ + +error: register class `freg` requires at least one of the following target features: d, f + --> $DIR/bad-reg.rs:87:26 + | +LL | asm!("/* {} */", in(freg) d); + | ^^^^^^^^^^ + +error: register class `freg` requires at least one of the following target features: d, f + --> $DIR/bad-reg.rs:90:26 + | +LL | asm!("/* {} */", out(freg) d); + | ^^^^^^^^^^^ + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:97:27 + | +LL | asm!("", in("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:100:28 + | +LL | asm!("", out("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:103:35 + | +LL | asm!("/* {} */", in(vreg) x); + | ^ + | + = note: register class `vreg` supports these types: + +error: aborting due to 18 previous errors + diff --git a/tests/ui/asm/riscv/bad-reg.riscv32imafc.stderr b/tests/ui/asm/riscv/bad-reg.riscv32imafc.stderr new file mode 100644 index 00000000000..aba4ecc1886 --- /dev/null +++ b/tests/ui/asm/riscv/bad-reg.riscv32imafc.stderr @@ -0,0 +1,108 @@ +error: invalid register `s1`: s1 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:34:18 + | +LL | asm!("", out("s1") _); + | ^^^^^^^^^^^ + +error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:36:18 + | +LL | asm!("", out("fp") _); + | ^^^^^^^^^^^ + +error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", out("sp") _); + | ^^^^^^^^^^^ + +error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", out("gp") _); + | ^^^^^^^^^^^ + +error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:42:18 + | +LL | asm!("", out("gp") _); + | ^^^^^^^^^^^ + +error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:44:18 + | +LL | asm!("", out("tp") _); + | ^^^^^^^^^^^ + +error: invalid register `zero`: the zero register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:46:18 + | +LL | asm!("", out("zero") _); + | ^^^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:97:18 + | +LL | asm!("", in("v0") x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:100:18 + | +LL | asm!("", out("v0") x); + | ^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:103:26 + | +LL | asm!("/* {} */", in(vreg) x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:106:26 + | +LL | asm!("/* {} */", out(vreg) _); + | ^^^^^^^^^^^ + +error: `d` target feature is not enabled + --> $DIR/bad-reg.rs:87:35 + | +LL | asm!("/* {} */", in(freg) d); + | ^ + | + = note: this is required to use type `f64` with register class `freg` + +error: `d` target feature is not enabled + --> $DIR/bad-reg.rs:90:36 + | +LL | asm!("/* {} */", out(freg) d); + | ^ + | + = note: this is required to use type `f64` with register class `freg` + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:97:27 + | +LL | asm!("", in("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:100:28 + | +LL | asm!("", out("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:103:35 + | +LL | asm!("/* {} */", in(vreg) x); + | ^ + | + = note: register class `vreg` supports these types: + +error: aborting due to 16 previous errors + diff --git a/tests/ui/asm/riscv/bad-reg.riscv64gc.stderr b/tests/ui/asm/riscv/bad-reg.riscv64gc.stderr new file mode 100644 index 00000000000..81b72884a12 --- /dev/null +++ b/tests/ui/asm/riscv/bad-reg.riscv64gc.stderr @@ -0,0 +1,92 @@ +error: invalid register `s1`: s1 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:34:18 + | +LL | asm!("", out("s1") _); + | ^^^^^^^^^^^ + +error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:36:18 + | +LL | asm!("", out("fp") _); + | ^^^^^^^^^^^ + +error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", out("sp") _); + | ^^^^^^^^^^^ + +error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", out("gp") _); + | ^^^^^^^^^^^ + +error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:42:18 + | +LL | asm!("", out("gp") _); + | ^^^^^^^^^^^ + +error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:44:18 + | +LL | asm!("", out("tp") _); + | ^^^^^^^^^^^ + +error: invalid register `zero`: the zero register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:46:18 + | +LL | asm!("", out("zero") _); + | ^^^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:97:18 + | +LL | asm!("", in("v0") x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:100:18 + | +LL | asm!("", out("v0") x); + | ^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:103:26 + | +LL | asm!("/* {} */", in(vreg) x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:106:26 + | +LL | asm!("/* {} */", out(vreg) _); + | ^^^^^^^^^^^ + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:97:27 + | +LL | asm!("", in("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:100:28 + | +LL | asm!("", out("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:103:35 + | +LL | asm!("/* {} */", in(vreg) x); + | ^ + | + = note: register class `vreg` supports these types: + +error: aborting due to 14 previous errors + diff --git a/tests/ui/asm/riscv/bad-reg.riscv64imac.stderr b/tests/ui/asm/riscv/bad-reg.riscv64imac.stderr new file mode 100644 index 00000000000..b951ffb3982 --- /dev/null +++ b/tests/ui/asm/riscv/bad-reg.riscv64imac.stderr @@ -0,0 +1,116 @@ +error: invalid register `s1`: s1 is used internally by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:34:18 + | +LL | asm!("", out("s1") _); + | ^^^^^^^^^^^ + +error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:36:18 + | +LL | asm!("", out("fp") _); + | ^^^^^^^^^^^ + +error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", out("sp") _); + | ^^^^^^^^^^^ + +error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", out("gp") _); + | ^^^^^^^^^^^ + +error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:42:18 + | +LL | asm!("", out("gp") _); + | ^^^^^^^^^^^ + +error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:44:18 + | +LL | asm!("", out("tp") _); + | ^^^^^^^^^^^ + +error: invalid register `zero`: the zero register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:46:18 + | +LL | asm!("", out("zero") _); + | ^^^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:97:18 + | +LL | asm!("", in("v0") x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:100:18 + | +LL | asm!("", out("v0") x); + | ^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:103:26 + | +LL | asm!("/* {} */", in(vreg) x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:106:26 + | +LL | asm!("/* {} */", out(vreg) _); + | ^^^^^^^^^^^ + +error: register class `freg` requires at least one of the following target features: d, f + --> $DIR/bad-reg.rs:83:26 + | +LL | asm!("/* {} */", in(freg) f); + | ^^^^^^^^^^ + +error: register class `freg` requires at least one of the following target features: d, f + --> $DIR/bad-reg.rs:85:26 + | +LL | asm!("/* {} */", out(freg) _); + | ^^^^^^^^^^^ + +error: register class `freg` requires at least one of the following target features: d, f + --> $DIR/bad-reg.rs:87:26 + | +LL | asm!("/* {} */", in(freg) d); + | ^^^^^^^^^^ + +error: register class `freg` requires at least one of the following target features: d, f + --> $DIR/bad-reg.rs:90:26 + | +LL | asm!("/* {} */", out(freg) d); + | ^^^^^^^^^^^ + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:97:27 + | +LL | asm!("", in("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:100:28 + | +LL | asm!("", out("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:103:35 + | +LL | asm!("/* {} */", in(vreg) x); + | ^ + | + = note: register class `vreg` supports these types: + +error: aborting due to 18 previous errors + diff --git a/tests/ui/asm/riscv/bad-reg.rs b/tests/ui/asm/riscv/bad-reg.rs new file mode 100644 index 00000000000..7bf25b6e0b5 --- /dev/null +++ b/tests/ui/asm/riscv/bad-reg.rs @@ -0,0 +1,109 @@ +//@ add-core-stubs +//@ needs-asm-support +//@ revisions: riscv32i riscv32imafc riscv32gc riscv32e riscv64imac riscv64gc +//@[riscv32i] compile-flags: --target riscv32i-unknown-none-elf +//@[riscv32i] needs-llvm-components: riscv +//@[riscv32imafc] compile-flags: --target riscv32imafc-unknown-none-elf +//@[riscv32imafc] needs-llvm-components: riscv +//@[riscv32gc] compile-flags: --target riscv32gc-unknown-linux-gnu +//@[riscv32gc] needs-llvm-components: riscv +//@[riscv32e] compile-flags: --target riscv32e-unknown-none-elf +//@[riscv32e] needs-llvm-components: riscv +//@[riscv64imac] compile-flags: --target riscv64imac-unknown-none-elf +//@[riscv64imac] needs-llvm-components: riscv +//@[riscv64gc] compile-flags: --target riscv64gc-unknown-linux-gnu +//@[riscv64gc] needs-llvm-components: riscv + +// Unlike riscv32e-registers.rs, this tests if the rustc can reject invalid registers +// usage in the asm! API (in, out, inout, etc.). + +#![crate_type = "lib"] +#![feature(no_core, rustc_attrs)] +#![feature(asm_experimental_arch)] +#![no_core] + +extern crate minicore; +use minicore::*; + +fn f() { + let mut x = 0; + let mut f = 0.0_f32; + let mut d = 0.0_f64; + unsafe { + // Unsupported registers + asm!("", out("s1") _); + //~^ ERROR invalid register `s1`: s1 is used internally by LLVM and cannot be used as an operand for inline asm + asm!("", out("fp") _); + //~^ ERROR invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + asm!("", out("sp") _); + //~^ ERROR invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + asm!("", out("gp") _); + //~^ ERROR invalid register `gp`: the global pointer cannot be used as an operand for inline asm + asm!("", out("gp") _); + //~^ ERROR invalid register `gp`: the global pointer cannot be used as an operand for inline asm + asm!("", out("tp") _); + //~^ ERROR invalid register `tp`: the thread pointer cannot be used as an operand for inline asm + asm!("", out("zero") _); + //~^ ERROR invalid register `zero`: the zero register cannot be used as an operand for inline asm + + asm!("", out("x16") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x17") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x18") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x19") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x20") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x21") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x22") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x23") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x24") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x25") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x26") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x27") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x28") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x29") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x30") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + asm!("", out("x31") _); + //[riscv32e]~^ ERROR register can't be used with the `e` target feature + + asm!("", out("f0") _); // ok + asm!("/* {} */", in(freg) f); + //[riscv32i,riscv32e,riscv64imac]~^ ERROR register class `freg` requires at least one of the following target features: d, f + asm!("/* {} */", out(freg) _); + //[riscv32i,riscv32e,riscv64imac]~^ ERROR register class `freg` requires at least one of the following target features: d, f + asm!("/* {} */", in(freg) d); + //[riscv32i,riscv32e,riscv64imac]~^ ERROR register class `freg` requires at least one of the following target features: d, f + //[riscv32imafc]~^^ ERROR `d` target feature is not enabled + asm!("/* {} */", out(freg) d); + //[riscv32i,riscv32e,riscv64imac]~^ ERROR register class `freg` requires at least one of the following target features: d, f + //[riscv32imafc]~^^ ERROR `d` target feature is not enabled + + // Clobber-only registers + // vreg + asm!("", out("v0") _); // ok + asm!("", in("v0") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("", out("v0") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", in(vreg) x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", out(vreg) _); + //~^ ERROR can only be used as a clobber + } +} diff --git a/tests/ui/abi/riscv32e-registers.riscv32e.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32e.stderr index e3894431eb4..e7a86805b26 100644 --- a/tests/ui/abi/riscv32e-registers.riscv32e.stderr +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32e.stderr @@ -1,5 +1,5 @@ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:43:11 + --> $DIR/riscv32e-registers.rs:46:11 | LL | asm!("li x16, 0"); | ^ @@ -11,7 +11,7 @@ LL | li x16, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:46:11 + --> $DIR/riscv32e-registers.rs:49:11 | LL | asm!("li x17, 0"); | ^ @@ -23,7 +23,7 @@ LL | li x17, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:49:11 + --> $DIR/riscv32e-registers.rs:52:11 | LL | asm!("li x18, 0"); | ^ @@ -35,7 +35,7 @@ LL | li x18, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:52:11 + --> $DIR/riscv32e-registers.rs:55:11 | LL | asm!("li x19, 0"); | ^ @@ -47,7 +47,7 @@ LL | li x19, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:55:11 + --> $DIR/riscv32e-registers.rs:58:11 | LL | asm!("li x20, 0"); | ^ @@ -59,7 +59,7 @@ LL | li x20, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:58:11 + --> $DIR/riscv32e-registers.rs:61:11 | LL | asm!("li x21, 0"); | ^ @@ -71,7 +71,7 @@ LL | li x21, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:61:11 + --> $DIR/riscv32e-registers.rs:64:11 | LL | asm!("li x22, 0"); | ^ @@ -83,7 +83,7 @@ LL | li x22, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:64:11 + --> $DIR/riscv32e-registers.rs:67:11 | LL | asm!("li x23, 0"); | ^ @@ -95,7 +95,7 @@ LL | li x23, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:67:11 + --> $DIR/riscv32e-registers.rs:70:11 | LL | asm!("li x24, 0"); | ^ @@ -107,7 +107,7 @@ LL | li x24, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:70:11 + --> $DIR/riscv32e-registers.rs:73:11 | LL | asm!("li x25, 0"); | ^ @@ -119,7 +119,7 @@ LL | li x25, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:73:11 + --> $DIR/riscv32e-registers.rs:76:11 | LL | asm!("li x26, 0"); | ^ @@ -131,7 +131,7 @@ LL | li x26, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:76:11 + --> $DIR/riscv32e-registers.rs:79:11 | LL | asm!("li x27, 0"); | ^ @@ -143,7 +143,7 @@ LL | li x27, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:79:11 + --> $DIR/riscv32e-registers.rs:82:11 | LL | asm!("li x28, 0"); | ^ @@ -155,7 +155,7 @@ LL | li x28, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:82:11 + --> $DIR/riscv32e-registers.rs:85:11 | LL | asm!("li x29, 0"); | ^ @@ -167,7 +167,7 @@ LL | li x29, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:85:11 + --> $DIR/riscv32e-registers.rs:88:11 | LL | asm!("li x30, 0"); | ^ @@ -179,7 +179,7 @@ LL | li x30, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:88:11 + --> $DIR/riscv32e-registers.rs:91:11 | LL | asm!("li x31, 0"); | ^ diff --git a/tests/ui/abi/riscv32e-registers.riscv32em.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32em.stderr index e3894431eb4..e7a86805b26 100644 --- a/tests/ui/abi/riscv32e-registers.riscv32em.stderr +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32em.stderr @@ -1,5 +1,5 @@ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:43:11 + --> $DIR/riscv32e-registers.rs:46:11 | LL | asm!("li x16, 0"); | ^ @@ -11,7 +11,7 @@ LL | li x16, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:46:11 + --> $DIR/riscv32e-registers.rs:49:11 | LL | asm!("li x17, 0"); | ^ @@ -23,7 +23,7 @@ LL | li x17, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:49:11 + --> $DIR/riscv32e-registers.rs:52:11 | LL | asm!("li x18, 0"); | ^ @@ -35,7 +35,7 @@ LL | li x18, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:52:11 + --> $DIR/riscv32e-registers.rs:55:11 | LL | asm!("li x19, 0"); | ^ @@ -47,7 +47,7 @@ LL | li x19, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:55:11 + --> $DIR/riscv32e-registers.rs:58:11 | LL | asm!("li x20, 0"); | ^ @@ -59,7 +59,7 @@ LL | li x20, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:58:11 + --> $DIR/riscv32e-registers.rs:61:11 | LL | asm!("li x21, 0"); | ^ @@ -71,7 +71,7 @@ LL | li x21, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:61:11 + --> $DIR/riscv32e-registers.rs:64:11 | LL | asm!("li x22, 0"); | ^ @@ -83,7 +83,7 @@ LL | li x22, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:64:11 + --> $DIR/riscv32e-registers.rs:67:11 | LL | asm!("li x23, 0"); | ^ @@ -95,7 +95,7 @@ LL | li x23, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:67:11 + --> $DIR/riscv32e-registers.rs:70:11 | LL | asm!("li x24, 0"); | ^ @@ -107,7 +107,7 @@ LL | li x24, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:70:11 + --> $DIR/riscv32e-registers.rs:73:11 | LL | asm!("li x25, 0"); | ^ @@ -119,7 +119,7 @@ LL | li x25, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:73:11 + --> $DIR/riscv32e-registers.rs:76:11 | LL | asm!("li x26, 0"); | ^ @@ -131,7 +131,7 @@ LL | li x26, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:76:11 + --> $DIR/riscv32e-registers.rs:79:11 | LL | asm!("li x27, 0"); | ^ @@ -143,7 +143,7 @@ LL | li x27, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:79:11 + --> $DIR/riscv32e-registers.rs:82:11 | LL | asm!("li x28, 0"); | ^ @@ -155,7 +155,7 @@ LL | li x28, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:82:11 + --> $DIR/riscv32e-registers.rs:85:11 | LL | asm!("li x29, 0"); | ^ @@ -167,7 +167,7 @@ LL | li x29, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:85:11 + --> $DIR/riscv32e-registers.rs:88:11 | LL | asm!("li x30, 0"); | ^ @@ -179,7 +179,7 @@ LL | li x30, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:88:11 + --> $DIR/riscv32e-registers.rs:91:11 | LL | asm!("li x31, 0"); | ^ diff --git a/tests/ui/abi/riscv32e-registers.riscv32emc.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32emc.stderr index e3894431eb4..e7a86805b26 100644 --- a/tests/ui/abi/riscv32e-registers.riscv32emc.stderr +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32emc.stderr @@ -1,5 +1,5 @@ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:43:11 + --> $DIR/riscv32e-registers.rs:46:11 | LL | asm!("li x16, 0"); | ^ @@ -11,7 +11,7 @@ LL | li x16, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:46:11 + --> $DIR/riscv32e-registers.rs:49:11 | LL | asm!("li x17, 0"); | ^ @@ -23,7 +23,7 @@ LL | li x17, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:49:11 + --> $DIR/riscv32e-registers.rs:52:11 | LL | asm!("li x18, 0"); | ^ @@ -35,7 +35,7 @@ LL | li x18, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:52:11 + --> $DIR/riscv32e-registers.rs:55:11 | LL | asm!("li x19, 0"); | ^ @@ -47,7 +47,7 @@ LL | li x19, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:55:11 + --> $DIR/riscv32e-registers.rs:58:11 | LL | asm!("li x20, 0"); | ^ @@ -59,7 +59,7 @@ LL | li x20, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:58:11 + --> $DIR/riscv32e-registers.rs:61:11 | LL | asm!("li x21, 0"); | ^ @@ -71,7 +71,7 @@ LL | li x21, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:61:11 + --> $DIR/riscv32e-registers.rs:64:11 | LL | asm!("li x22, 0"); | ^ @@ -83,7 +83,7 @@ LL | li x22, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:64:11 + --> $DIR/riscv32e-registers.rs:67:11 | LL | asm!("li x23, 0"); | ^ @@ -95,7 +95,7 @@ LL | li x23, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:67:11 + --> $DIR/riscv32e-registers.rs:70:11 | LL | asm!("li x24, 0"); | ^ @@ -107,7 +107,7 @@ LL | li x24, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:70:11 + --> $DIR/riscv32e-registers.rs:73:11 | LL | asm!("li x25, 0"); | ^ @@ -119,7 +119,7 @@ LL | li x25, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:73:11 + --> $DIR/riscv32e-registers.rs:76:11 | LL | asm!("li x26, 0"); | ^ @@ -131,7 +131,7 @@ LL | li x26, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:76:11 + --> $DIR/riscv32e-registers.rs:79:11 | LL | asm!("li x27, 0"); | ^ @@ -143,7 +143,7 @@ LL | li x27, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:79:11 + --> $DIR/riscv32e-registers.rs:82:11 | LL | asm!("li x28, 0"); | ^ @@ -155,7 +155,7 @@ LL | li x28, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:82:11 + --> $DIR/riscv32e-registers.rs:85:11 | LL | asm!("li x29, 0"); | ^ @@ -167,7 +167,7 @@ LL | li x29, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:85:11 + --> $DIR/riscv32e-registers.rs:88:11 | LL | asm!("li x30, 0"); | ^ @@ -179,7 +179,7 @@ LL | li x30, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:88:11 + --> $DIR/riscv32e-registers.rs:91:11 | LL | asm!("li x31, 0"); | ^ diff --git a/tests/ui/abi/riscv32e-registers.rs b/tests/ui/asm/riscv/riscv32e-registers.rs index 714b0ee4633..57b1e169a04 100644 --- a/tests/ui/abi/riscv32e-registers.rs +++ b/tests/ui/asm/riscv/riscv32e-registers.rs @@ -11,6 +11,9 @@ //@ [riscv32emc] needs-llvm-components: riscv //@ [riscv32emc] compile-flags: --target=riscv32emc-unknown-none-elf +// Unlike bad-reg.rs, this tests if the assembler can reject invalid registers +// usage in assembly code. + #![no_core] #![feature(no_core, lang_items, rustc_attrs)] diff --git a/tests/ui/asm/s390x/bad-reg.rs b/tests/ui/asm/s390x/bad-reg.rs new file mode 100644 index 00000000000..6de43fdfe5e --- /dev/null +++ b/tests/ui/asm/s390x/bad-reg.rs @@ -0,0 +1,128 @@ +//@ add-core-stubs +//@ needs-asm-support +//@ revisions: s390x +//@[s390x] compile-flags: --target s390x-unknown-linux-gnu +//@[s390x] needs-llvm-components: systemz + +#![crate_type = "rlib"] +#![feature(no_core, rustc_attrs)] +#![feature(asm_experimental_arch)] +#![no_core] + +extern crate minicore; +use minicore::*; + +fn f() { + let mut x = 0; + unsafe { + // Unsupported registers + asm!("", out("r11") _); + //~^ ERROR invalid register `r11`: The frame pointer cannot be used as an operand for inline asm + asm!("", out("r15") _); + //~^ ERROR invalid register `r15`: The stack pointer cannot be used as an operand for inline asm + asm!("", out("c0") _); + //~^ ERROR invalid register `c0`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c1") _); + //~^ ERROR invalid register `c1`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c2") _); + //~^ ERROR invalid register `c2`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c3") _); + //~^ ERROR invalid register `c3`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c4") _); + //~^ ERROR invalid register `c4`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c5") _); + //~^ ERROR invalid register `c5`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c6") _); + //~^ ERROR invalid register `c6`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c7") _); + //~^ ERROR invalid register `c7`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c8") _); + //~^ ERROR invalid register `c8`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c9") _); + //~^ ERROR invalid register `c9`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c10") _); + //~^ ERROR invalid register `c10`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c11") _); + //~^ ERROR invalid register `c11`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c12") _); + //~^ ERROR invalid register `c12`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c13") _); + //~^ ERROR invalid register `c13`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c14") _); + //~^ ERROR invalid register `c14`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("c15") _); + //~^ ERROR invalid register `c15`: control registers are reserved by the kernel and cannot be used as operands for inline asm + asm!("", out("a0") _); + //~^ ERROR invalid register `a0`: a0 and a1 are reserved for system use and cannot be used as operands for inline asm + asm!("", out("a1") _); + //~^ ERROR invalid register `a1`: a0 and a1 are reserved for system use and cannot be used as operands for inline asm + + // Clobber-only registers + // areg + asm!("", out("a2") _); // ok + asm!("", in("a2") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("", out("a2") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", in(areg) x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", out(areg) _); + //~^ ERROR can only be used as a clobber + + // vreg + asm!("", out("v0") _); // ok + // FIXME: will be supported in https://github.com/rust-lang/rust/pull/131664 + asm!("", in("v0") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("", out("v0") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", in(vreg) x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", out(vreg) _); + //~^ ERROR can only be used as a clobber + + // Overlapping registers + // vreg/freg + asm!("", out("v0") _, out("f0") _); + //~^ ERROR register `f0` conflicts with register `v0` + asm!("", out("v1") _, out("f1") _); + //~^ ERROR register `f1` conflicts with register `v1` + asm!("", out("v2") _, out("f2") _); + //~^ ERROR register `f2` conflicts with register `v2` + asm!("", out("v3") _, out("f3") _); + //~^ ERROR register `f3` conflicts with register `v3` + asm!("", out("v4") _, out("f4") _); + //~^ ERROR register `f4` conflicts with register `v4` + asm!("", out("v5") _, out("f5") _); + //~^ ERROR register `f5` conflicts with register `v5` + asm!("", out("v6") _, out("f6") _); + //~^ ERROR register `f6` conflicts with register `v6` + asm!("", out("v7") _, out("f7") _); + //~^ ERROR register `f7` conflicts with register `v7` + asm!("", out("v8") _, out("f8") _); + //~^ ERROR register `f8` conflicts with register `v8` + asm!("", out("v9") _, out("f9") _); + //~^ ERROR register `f9` conflicts with register `v9` + asm!("", out("v10") _, out("f10") _); + //~^ ERROR register `f10` conflicts with register `v10` + asm!("", out("v11") _, out("f11") _); + //~^ ERROR register `f11` conflicts with register `v11` + asm!("", out("v12") _, out("f12") _); + //~^ ERROR register `f12` conflicts with register `v12` + asm!("", out("v13") _, out("f13") _); + //~^ ERROR register `f13` conflicts with register `v13` + asm!("", out("v14") _, out("f14") _); + //~^ ERROR register `f14` conflicts with register `v14` + asm!("", out("v15") _, out("f15") _); + //~^ ERROR register `f15` conflicts with register `v15` + // no %f16 + asm!("", out("v16") _, out("f16") _); + //~^ ERROR invalid register `f16`: unknown register + } +} diff --git a/tests/ui/asm/s390x/bad-reg.s390x.stderr b/tests/ui/asm/s390x/bad-reg.s390x.stderr new file mode 100644 index 00000000000..460d7c15de1 --- /dev/null +++ b/tests/ui/asm/s390x/bad-reg.s390x.stderr @@ -0,0 +1,352 @@ +error: invalid register `r11`: The frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:19:18 + | +LL | asm!("", out("r11") _); + | ^^^^^^^^^^^^ + +error: invalid register `r15`: The stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:21:18 + | +LL | asm!("", out("r15") _); + | ^^^^^^^^^^^^ + +error: invalid register `c0`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:23:18 + | +LL | asm!("", out("c0") _); + | ^^^^^^^^^^^ + +error: invalid register `c1`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:25:18 + | +LL | asm!("", out("c1") _); + | ^^^^^^^^^^^ + +error: invalid register `c2`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:27:18 + | +LL | asm!("", out("c2") _); + | ^^^^^^^^^^^ + +error: invalid register `c3`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:29:18 + | +LL | asm!("", out("c3") _); + | ^^^^^^^^^^^ + +error: invalid register `c4`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:31:18 + | +LL | asm!("", out("c4") _); + | ^^^^^^^^^^^ + +error: invalid register `c5`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:33:18 + | +LL | asm!("", out("c5") _); + | ^^^^^^^^^^^ + +error: invalid register `c6`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:35:18 + | +LL | asm!("", out("c6") _); + | ^^^^^^^^^^^ + +error: invalid register `c7`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:37:18 + | +LL | asm!("", out("c7") _); + | ^^^^^^^^^^^ + +error: invalid register `c8`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:39:18 + | +LL | asm!("", out("c8") _); + | ^^^^^^^^^^^ + +error: invalid register `c9`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:41:18 + | +LL | asm!("", out("c9") _); + | ^^^^^^^^^^^ + +error: invalid register `c10`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:43:18 + | +LL | asm!("", out("c10") _); + | ^^^^^^^^^^^^ + +error: invalid register `c11`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:45:18 + | +LL | asm!("", out("c11") _); + | ^^^^^^^^^^^^ + +error: invalid register `c12`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:47:18 + | +LL | asm!("", out("c12") _); + | ^^^^^^^^^^^^ + +error: invalid register `c13`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:49:18 + | +LL | asm!("", out("c13") _); + | ^^^^^^^^^^^^ + +error: invalid register `c14`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:51:18 + | +LL | asm!("", out("c14") _); + | ^^^^^^^^^^^^ + +error: invalid register `c15`: control registers are reserved by the kernel and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:53:18 + | +LL | asm!("", out("c15") _); + | ^^^^^^^^^^^^ + +error: invalid register `a0`: a0 and a1 are reserved for system use and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:55:18 + | +LL | asm!("", out("a0") _); + | ^^^^^^^^^^^ + +error: invalid register `a1`: a0 and a1 are reserved for system use and cannot be used as operands for inline asm + --> $DIR/bad-reg.rs:57:18 + | +LL | asm!("", out("a1") _); + | ^^^^^^^^^^^ + +error: register class `areg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:63:18 + | +LL | asm!("", in("a2") x); + | ^^^^^^^^^^ + +error: register class `areg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:66:18 + | +LL | asm!("", out("a2") x); + | ^^^^^^^^^^^ + +error: register class `areg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:69:26 + | +LL | asm!("/* {} */", in(areg) x); + | ^^^^^^^^^^ + +error: register class `areg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:72:26 + | +LL | asm!("/* {} */", out(areg) _); + | ^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:78:18 + | +LL | asm!("", in("v0") x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:81:18 + | +LL | asm!("", out("v0") x); + | ^^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:84:26 + | +LL | asm!("/* {} */", in(vreg) x); + | ^^^^^^^^^^ + +error: register class `vreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:87:26 + | +LL | asm!("/* {} */", out(vreg) _); + | ^^^^^^^^^^^ + +error: register `f0` conflicts with register `v0` + --> $DIR/bad-reg.rs:92:31 + | +LL | asm!("", out("v0") _, out("f0") _); + | ----------- ^^^^^^^^^^^ register `f0` + | | + | register `v0` + +error: register `f1` conflicts with register `v1` + --> $DIR/bad-reg.rs:94:31 + | +LL | asm!("", out("v1") _, out("f1") _); + | ----------- ^^^^^^^^^^^ register `f1` + | | + | register `v1` + +error: register `f2` conflicts with register `v2` + --> $DIR/bad-reg.rs:96:31 + | +LL | asm!("", out("v2") _, out("f2") _); + | ----------- ^^^^^^^^^^^ register `f2` + | | + | register `v2` + +error: register `f3` conflicts with register `v3` + --> $DIR/bad-reg.rs:98:31 + | +LL | asm!("", out("v3") _, out("f3") _); + | ----------- ^^^^^^^^^^^ register `f3` + | | + | register `v3` + +error: register `f4` conflicts with register `v4` + --> $DIR/bad-reg.rs:100:31 + | +LL | asm!("", out("v4") _, out("f4") _); + | ----------- ^^^^^^^^^^^ register `f4` + | | + | register `v4` + +error: register `f5` conflicts with register `v5` + --> $DIR/bad-reg.rs:102:31 + | +LL | asm!("", out("v5") _, out("f5") _); + | ----------- ^^^^^^^^^^^ register `f5` + | | + | register `v5` + +error: register `f6` conflicts with register `v6` + --> $DIR/bad-reg.rs:104:31 + | +LL | asm!("", out("v6") _, out("f6") _); + | ----------- ^^^^^^^^^^^ register `f6` + | | + | register `v6` + +error: register `f7` conflicts with register `v7` + --> $DIR/bad-reg.rs:106:31 + | +LL | asm!("", out("v7") _, out("f7") _); + | ----------- ^^^^^^^^^^^ register `f7` + | | + | register `v7` + +error: register `f8` conflicts with register `v8` + --> $DIR/bad-reg.rs:108:31 + | +LL | asm!("", out("v8") _, out("f8") _); + | ----------- ^^^^^^^^^^^ register `f8` + | | + | register `v8` + +error: register `f9` conflicts with register `v9` + --> $DIR/bad-reg.rs:110:31 + | +LL | asm!("", out("v9") _, out("f9") _); + | ----------- ^^^^^^^^^^^ register `f9` + | | + | register `v9` + +error: register `f10` conflicts with register `v10` + --> $DIR/bad-reg.rs:112:32 + | +LL | asm!("", out("v10") _, out("f10") _); + | ------------ ^^^^^^^^^^^^ register `f10` + | | + | register `v10` + +error: register `f11` conflicts with register `v11` + --> $DIR/bad-reg.rs:114:32 + | +LL | asm!("", out("v11") _, out("f11") _); + | ------------ ^^^^^^^^^^^^ register `f11` + | | + | register `v11` + +error: register `f12` conflicts with register `v12` + --> $DIR/bad-reg.rs:116:32 + | +LL | asm!("", out("v12") _, out("f12") _); + | ------------ ^^^^^^^^^^^^ register `f12` + | | + | register `v12` + +error: register `f13` conflicts with register `v13` + --> $DIR/bad-reg.rs:118:32 + | +LL | asm!("", out("v13") _, out("f13") _); + | ------------ ^^^^^^^^^^^^ register `f13` + | | + | register `v13` + +error: register `f14` conflicts with register `v14` + --> $DIR/bad-reg.rs:120:32 + | +LL | asm!("", out("v14") _, out("f14") _); + | ------------ ^^^^^^^^^^^^ register `f14` + | | + | register `v14` + +error: register `f15` conflicts with register `v15` + --> $DIR/bad-reg.rs:122:32 + | +LL | asm!("", out("v15") _, out("f15") _); + | ------------ ^^^^^^^^^^^^ register `f15` + | | + | register `v15` + +error: invalid register `f16`: unknown register + --> $DIR/bad-reg.rs:125:32 + | +LL | asm!("", out("v16") _, out("f16") _); + | ^^^^^^^^^^^^ + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:63:27 + | +LL | asm!("", in("a2") x); + | ^ + | + = note: register class `areg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:66:28 + | +LL | asm!("", out("a2") x); + | ^ + | + = note: register class `areg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:69:35 + | +LL | asm!("/* {} */", in(areg) x); + | ^ + | + = note: register class `areg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:78:27 + | +LL | asm!("", in("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:81:28 + | +LL | asm!("", out("v0") x); + | ^ + | + = note: register class `vreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:84:35 + | +LL | asm!("/* {} */", in(vreg) x); + | ^ + | + = note: register class `vreg` supports these types: + +error: aborting due to 51 previous errors + diff --git a/tests/ui/asm/sparc/bad-reg.rs b/tests/ui/asm/sparc/bad-reg.rs new file mode 100644 index 00000000000..b824f5adf3a --- /dev/null +++ b/tests/ui/asm/sparc/bad-reg.rs @@ -0,0 +1,66 @@ +//@ revisions: sparc sparcv8plus sparc64 +//@[sparc] compile-flags: --target sparc-unknown-none-elf +//@[sparc] needs-llvm-components: sparc +//@[sparcv8plus] compile-flags: --target sparc-unknown-linux-gnu +//@[sparcv8plus] needs-llvm-components: sparc +//@[sparc64] compile-flags: --target sparc64-unknown-linux-gnu +//@[sparc64] needs-llvm-components: sparc +//@ needs-asm-support + +#![crate_type = "rlib"] +#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] +#![no_core] + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +impl Copy for i32 {} + +#[rustc_builtin_macro] +macro_rules! asm { + () => {}; +} + +fn f() { + let mut x = 0; + unsafe { + // Unsupported registers + asm!("", out("g0") _); + //~^ ERROR invalid register `g0`: g0 is always zero and cannot be used as an operand for inline asm + // FIXME: see FIXME in compiler/rustc_target/src/asm/sparc.rs. + asm!("", out("g1") _); + //~^ ERROR invalid register `g1`: reserved by LLVM and cannot be used as an operand for inline asm + asm!("", out("g2") _); + asm!("", out("g3") _); + asm!("", out("g4") _); + asm!("", out("g5") _); + //[sparc,sparcv8plus]~^ ERROR cannot use register `r5`: g5 is reserved for system on SPARC32 + asm!("", out("g6") _); + //~^ ERROR invalid register `g6`: reserved for system and cannot be used as an operand for inline asm + asm!("", out("g7") _); + //~^ ERROR invalid register `g7`: reserved for system and cannot be used as an operand for inline asm + asm!("", out("sp") _); + //~^ ERROR invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + asm!("", out("fp") _); + //~^ ERROR invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + asm!("", out("i7") _); + //~^ ERROR invalid register `i7`: the return address register cannot be used as an operand for inline asm + + // Clobber-only registers + // yreg + asm!("", out("y") _); // ok + asm!("", in("y") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("", out("y") x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", in(yreg) x); + //~^ ERROR can only be used as a clobber + //~| ERROR type `i32` cannot be used with this register class + asm!("/* {} */", out(yreg) _); + //~^ ERROR can only be used as a clobber + } +} diff --git a/tests/ui/asm/sparc/bad-reg.sparc.stderr b/tests/ui/asm/sparc/bad-reg.sparc.stderr new file mode 100644 index 00000000000..cb7558c0f43 --- /dev/null +++ b/tests/ui/asm/sparc/bad-reg.sparc.stderr @@ -0,0 +1,98 @@ +error: invalid register `g0`: g0 is always zero and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:30:18 + | +LL | asm!("", out("g0") _); + | ^^^^^^^^^^^ + +error: invalid register `g1`: reserved by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:33:18 + | +LL | asm!("", out("g1") _); + | ^^^^^^^^^^^ + +error: invalid register `g6`: reserved for system and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", out("g6") _); + | ^^^^^^^^^^^ + +error: invalid register `g7`: reserved for system and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:42:18 + | +LL | asm!("", out("g7") _); + | ^^^^^^^^^^^ + +error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:44:18 + | +LL | asm!("", out("sp") _); + | ^^^^^^^^^^^ + +error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:46:18 + | +LL | asm!("", out("fp") _); + | ^^^^^^^^^^^ + +error: invalid register `i7`: the return address register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:48:18 + | +LL | asm!("", out("i7") _); + | ^^^^^^^^^^^ + +error: register class `yreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:54:18 + | +LL | asm!("", in("y") x); + | ^^^^^^^^^ + +error: register class `yreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:57:18 + | +LL | asm!("", out("y") x); + | ^^^^^^^^^^ + +error: register class `yreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:60:26 + | +LL | asm!("/* {} */", in(yreg) x); + | ^^^^^^^^^^ + +error: register class `yreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:63:26 + | +LL | asm!("/* {} */", out(yreg) _); + | ^^^^^^^^^^^ + +error: cannot use register `r5`: g5 is reserved for system on SPARC32 + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", out("g5") _); + | ^^^^^^^^^^^ + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:54:26 + | +LL | asm!("", in("y") x); + | ^ + | + = note: register class `yreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:57:27 + | +LL | asm!("", out("y") x); + | ^ + | + = note: register class `yreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:60:35 + | +LL | asm!("/* {} */", in(yreg) x); + | ^ + | + = note: register class `yreg` supports these types: + +error: aborting due to 15 previous errors + diff --git a/tests/ui/asm/sparc/bad-reg.sparc64.stderr b/tests/ui/asm/sparc/bad-reg.sparc64.stderr new file mode 100644 index 00000000000..e5606ab3124 --- /dev/null +++ b/tests/ui/asm/sparc/bad-reg.sparc64.stderr @@ -0,0 +1,92 @@ +error: invalid register `g0`: g0 is always zero and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:30:18 + | +LL | asm!("", out("g0") _); + | ^^^^^^^^^^^ + +error: invalid register `g1`: reserved by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:33:18 + | +LL | asm!("", out("g1") _); + | ^^^^^^^^^^^ + +error: invalid register `g6`: reserved for system and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", out("g6") _); + | ^^^^^^^^^^^ + +error: invalid register `g7`: reserved for system and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:42:18 + | +LL | asm!("", out("g7") _); + | ^^^^^^^^^^^ + +error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:44:18 + | +LL | asm!("", out("sp") _); + | ^^^^^^^^^^^ + +error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:46:18 + | +LL | asm!("", out("fp") _); + | ^^^^^^^^^^^ + +error: invalid register `i7`: the return address register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:48:18 + | +LL | asm!("", out("i7") _); + | ^^^^^^^^^^^ + +error: register class `yreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:54:18 + | +LL | asm!("", in("y") x); + | ^^^^^^^^^ + +error: register class `yreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:57:18 + | +LL | asm!("", out("y") x); + | ^^^^^^^^^^ + +error: register class `yreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:60:26 + | +LL | asm!("/* {} */", in(yreg) x); + | ^^^^^^^^^^ + +error: register class `yreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:63:26 + | +LL | asm!("/* {} */", out(yreg) _); + | ^^^^^^^^^^^ + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:54:26 + | +LL | asm!("", in("y") x); + | ^ + | + = note: register class `yreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:57:27 + | +LL | asm!("", out("y") x); + | ^ + | + = note: register class `yreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:60:35 + | +LL | asm!("/* {} */", in(yreg) x); + | ^ + | + = note: register class `yreg` supports these types: + +error: aborting due to 14 previous errors + diff --git a/tests/ui/asm/sparc/bad-reg.sparcv8plus.stderr b/tests/ui/asm/sparc/bad-reg.sparcv8plus.stderr new file mode 100644 index 00000000000..cb7558c0f43 --- /dev/null +++ b/tests/ui/asm/sparc/bad-reg.sparcv8plus.stderr @@ -0,0 +1,98 @@ +error: invalid register `g0`: g0 is always zero and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:30:18 + | +LL | asm!("", out("g0") _); + | ^^^^^^^^^^^ + +error: invalid register `g1`: reserved by LLVM and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:33:18 + | +LL | asm!("", out("g1") _); + | ^^^^^^^^^^^ + +error: invalid register `g6`: reserved for system and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:40:18 + | +LL | asm!("", out("g6") _); + | ^^^^^^^^^^^ + +error: invalid register `g7`: reserved for system and cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:42:18 + | +LL | asm!("", out("g7") _); + | ^^^^^^^^^^^ + +error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:44:18 + | +LL | asm!("", out("sp") _); + | ^^^^^^^^^^^ + +error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:46:18 + | +LL | asm!("", out("fp") _); + | ^^^^^^^^^^^ + +error: invalid register `i7`: the return address register cannot be used as an operand for inline asm + --> $DIR/bad-reg.rs:48:18 + | +LL | asm!("", out("i7") _); + | ^^^^^^^^^^^ + +error: register class `yreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:54:18 + | +LL | asm!("", in("y") x); + | ^^^^^^^^^ + +error: register class `yreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:57:18 + | +LL | asm!("", out("y") x); + | ^^^^^^^^^^ + +error: register class `yreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:60:26 + | +LL | asm!("/* {} */", in(yreg) x); + | ^^^^^^^^^^ + +error: register class `yreg` can only be used as a clobber, not as an input or output + --> $DIR/bad-reg.rs:63:26 + | +LL | asm!("/* {} */", out(yreg) _); + | ^^^^^^^^^^^ + +error: cannot use register `r5`: g5 is reserved for system on SPARC32 + --> $DIR/bad-reg.rs:38:18 + | +LL | asm!("", out("g5") _); + | ^^^^^^^^^^^ + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:54:26 + | +LL | asm!("", in("y") x); + | ^ + | + = note: register class `yreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:57:27 + | +LL | asm!("", out("y") x); + | ^ + | + = note: register class `yreg` supports these types: + +error: type `i32` cannot be used with this register class + --> $DIR/bad-reg.rs:60:35 + | +LL | asm!("/* {} */", in(yreg) x); + | ^ + | + = note: register class `yreg` supports these types: + +error: aborting due to 15 previous errors + diff --git a/tests/ui/associated-consts/issue-58022.stderr b/tests/ui/associated-consts/issue-58022.stderr index 6ce995eaab7..82cbc9ed3b0 100644 --- a/tests/ui/associated-consts/issue-58022.stderr +++ b/tests/ui/associated-consts/issue-58022.stderr @@ -13,7 +13,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation LL | fn new(slice: &[u8; Self::SIZE]) -> Self { | ^^^^ doesn't have a size known at compile-time | - = help: within `Bar<[u8]>`, the trait `Sized` is not implemented for `[u8]`, which is required by `Bar<[u8]>: Sized` + = help: within `Bar<[u8]>`, the trait `Sized` is not implemented for `[u8]` note: required because it appears within the type `Bar<[u8]>` --> $DIR/issue-58022.rs:8:12 | diff --git a/tests/ui/associated-inherent-types/assoc-inherent-unstable.rs b/tests/ui/associated-inherent-types/assoc-inherent-unstable.rs index ddb9278bafa..91641489cc9 100644 --- a/tests/ui/associated-inherent-types/assoc-inherent-unstable.rs +++ b/tests/ui/associated-inherent-types/assoc-inherent-unstable.rs @@ -4,6 +4,6 @@ #![feature(inherent_associated_types)] #![allow(incomplete_features)] -type Data = aux::Owner::Data; //~ ERROR use of unstable library feature 'data' +type Data = aux::Owner::Data; //~ ERROR use of unstable library feature `data` fn main() {} diff --git a/tests/ui/associated-inherent-types/assoc-inherent-unstable.stderr b/tests/ui/associated-inherent-types/assoc-inherent-unstable.stderr index ab8cdb6f80a..132d566fecd 100644 --- a/tests/ui/associated-inherent-types/assoc-inherent-unstable.stderr +++ b/tests/ui/associated-inherent-types/assoc-inherent-unstable.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'data' +error[E0658]: use of unstable library feature `data` --> $DIR/assoc-inherent-unstable.rs:7:13 | LL | type Data = aux::Owner::Data; diff --git a/tests/ui/associated-type-bounds/implied-from-self-where-clause.rs b/tests/ui/associated-type-bounds/implied-from-self-where-clause.rs new file mode 100644 index 00000000000..38f55696914 --- /dev/null +++ b/tests/ui/associated-type-bounds/implied-from-self-where-clause.rs @@ -0,0 +1,21 @@ +// Make sure that, like associated type where clauses on traits, we gather item +// bounds for RPITITs from RTN where clauses. + +//@ check-pass + +#![feature(return_type_notation)] + +trait Foo +where + Self::method(..): Send, +{ + fn method() -> impl Sized; +} + +fn is_send(_: impl Send) {} + +fn test<T: Foo>() { + is_send(T::method()); +} + +fn main() {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr index 110d2a00583..0a31cc67533 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely LL | is_send(foo::<T>()); | ^^^^^^^^^^ future returned by `foo` is not `Send` | - = help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>> { <T as Foo>::method(..) }`, which is required by `impl Future<Output = Result<(), ()>>: Send` + = help: within `impl Future<Output = Result<(), ()>>`, the trait `Send` is not implemented for `impl Future<Output = Result<(), ()>> { <T as Foo>::method(..) }` note: future is not `Send` as it awaits another future which is not `Send` --> $DIR/basic.rs:12:5 | diff --git a/tests/crashes/131648.rs b/tests/ui/associated-type-bounds/return-type-notation/impl-trait-in-trait.rs index 68046ce2a1f..0d3e6f9c8e3 100644 --- a/tests/crashes/131648.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/impl-trait-in-trait.rs @@ -1,7 +1,8 @@ -//@ known-bug: #131648 #![feature(return_type_notation)] trait IntFactory { fn stream(self) -> impl IntFactory<stream(..): Send>; + //~^ ERROR cycle detected when resolving lifetimes for `IntFactory::stream` } + fn main() {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/impl-trait-in-trait.stderr b/tests/ui/associated-type-bounds/return-type-notation/impl-trait-in-trait.stderr new file mode 100644 index 00000000000..0ed54415b9e --- /dev/null +++ b/tests/ui/associated-type-bounds/return-type-notation/impl-trait-in-trait.stderr @@ -0,0 +1,27 @@ +error[E0391]: cycle detected when resolving lifetimes for `IntFactory::stream` + --> $DIR/impl-trait-in-trait.rs:4:5 + | +LL | fn stream(self) -> impl IntFactory<stream(..): Send>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: ...which requires computing function signature of `IntFactory::stream`... + --> $DIR/impl-trait-in-trait.rs:4:5 + | +LL | fn stream(self) -> impl IntFactory<stream(..): Send>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires looking up late bound vars inside `IntFactory::stream`... + --> $DIR/impl-trait-in-trait.rs:4:5 + | +LL | fn stream(self) -> impl IntFactory<stream(..): Send>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: ...which again requires resolving lifetimes for `IntFactory::stream`, completing the cycle +note: cycle used when listing captured lifetimes for opaque `IntFactory::stream::{opaque#0}` + --> $DIR/impl-trait-in-trait.rs:4:24 + | +LL | fn stream(self) -> impl IntFactory<stream(..): Send>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-unsatisfied.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-unsatisfied.stderr index 95810342d5a..90d0feb5217 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-unsatisfied.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/path-unsatisfied.stderr @@ -7,7 +7,7 @@ LL | fn method() -> impl Sized { LL | test::<DoesntWork>(); | ^^^^^^^^^^ `*mut ()` cannot be sent between threads safely | - = help: within `impl Sized`, the trait `Send` is not implemented for `*mut ()`, which is required by `impl Sized: Send` + = help: within `impl Sized`, the trait `Send` is not implemented for `*mut ()` note: required because it appears within the type `impl Sized` --> $DIR/path-unsatisfied.rs:9:20 | diff --git a/tests/ui/associated-types/defaults-suitability.current.stderr b/tests/ui/associated-types/defaults-suitability.current.stderr index 3cdeaa93a34..9c0ae59ae43 100644 --- a/tests/ui/associated-types/defaults-suitability.current.stderr +++ b/tests/ui/associated-types/defaults-suitability.current.stderr @@ -39,7 +39,7 @@ error[E0277]: the trait bound `T: Clone` is not satisfied --> $DIR/defaults-suitability.rs:31:23 | LL | type Bar: Clone = Vec<T>; - | ^^^^^^ the trait `Clone` is not implemented for `T`, which is required by `Vec<T>: Clone` + | ^^^^^^ the trait `Clone` is not implemented for `T` | = note: required for `Vec<T>` to implement `Clone` note: required by a bound in `Foo::Bar` @@ -88,7 +88,7 @@ error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: Clone` is not satisfied --> $DIR/defaults-suitability.rs:68:23 | LL | type Bar: Clone = Vec<Self::Baz>; - | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo2<T>>::Baz`, which is required by `Vec<<Self as Foo2<T>>::Baz>: Clone` + | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo2<T>>::Baz` | = note: required for `Vec<<Self as Foo2<T>>::Baz>` to implement `Clone` note: required by a bound in `Foo2::Bar` @@ -105,7 +105,7 @@ error[E0277]: the trait bound `<Self as Foo25<T>>::Baz: Clone` is not satisfied --> $DIR/defaults-suitability.rs:77:23 | LL | type Bar: Clone = Vec<Self::Baz>; - | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo25<T>>::Baz`, which is required by `Vec<<Self as Foo25<T>>::Baz>: Clone` + | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo25<T>>::Baz` | = note: required for `Vec<<Self as Foo25<T>>::Baz>` to implement `Clone` note: required by a bound in `Foo25::Bar` diff --git a/tests/ui/associated-types/defaults-suitability.next.stderr b/tests/ui/associated-types/defaults-suitability.next.stderr index 3cdeaa93a34..9c0ae59ae43 100644 --- a/tests/ui/associated-types/defaults-suitability.next.stderr +++ b/tests/ui/associated-types/defaults-suitability.next.stderr @@ -39,7 +39,7 @@ error[E0277]: the trait bound `T: Clone` is not satisfied --> $DIR/defaults-suitability.rs:31:23 | LL | type Bar: Clone = Vec<T>; - | ^^^^^^ the trait `Clone` is not implemented for `T`, which is required by `Vec<T>: Clone` + | ^^^^^^ the trait `Clone` is not implemented for `T` | = note: required for `Vec<T>` to implement `Clone` note: required by a bound in `Foo::Bar` @@ -88,7 +88,7 @@ error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: Clone` is not satisfied --> $DIR/defaults-suitability.rs:68:23 | LL | type Bar: Clone = Vec<Self::Baz>; - | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo2<T>>::Baz`, which is required by `Vec<<Self as Foo2<T>>::Baz>: Clone` + | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo2<T>>::Baz` | = note: required for `Vec<<Self as Foo2<T>>::Baz>` to implement `Clone` note: required by a bound in `Foo2::Bar` @@ -105,7 +105,7 @@ error[E0277]: the trait bound `<Self as Foo25<T>>::Baz: Clone` is not satisfied --> $DIR/defaults-suitability.rs:77:23 | LL | type Bar: Clone = Vec<Self::Baz>; - | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo25<T>>::Baz`, which is required by `Vec<<Self as Foo25<T>>::Baz>: Clone` + | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<Self as Foo25<T>>::Baz` | = note: required for `Vec<<Self as Foo25<T>>::Baz>` to implement `Clone` note: required by a bound in `Foo25::Bar` diff --git a/tests/ui/associated-types/hr-associated-type-bound-1.stderr b/tests/ui/associated-types/hr-associated-type-bound-1.stderr index 8830048ed4e..5b00e714194 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-1.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-1.rs:12:14 | LL | type U = str; - | ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <i32 as X<'b>>::U: Clone` + | ^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` note: required by a bound in `X` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr index ad6d3e17684..07d3afb74e4 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-1.rs:14:14 | LL | type V = str; - | ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <u8 as Y<'b, u8>>::V: Clone` + | ^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` note: required by a bound in `Y` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr index 6a5729e7784..74cc2083d26 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr @@ -18,7 +18,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-2.rs:17:14 | LL | type W = str; - | ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <u16 as Z<'b, u16>>::W: Clone` + | ^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` note: required by a bound in `Z` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr index 70e030f2d1c..58b82fc9306 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-3.rs:13:14 | LL | type U = str; - | ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <(T,) as X<'b, (T,)>>::U: Clone` + | ^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` note: required by a bound in `X` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr index cba12afd674..6d6373a1918 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-4.rs:13:14 | LL | type U = str; - | ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <(T,) as X<'b, T>>::U: Clone` + | ^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` note: required by a bound in `X` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr index ac96187749a..44c446c599f 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-5.rs:26:14 | LL | type U = str; - | ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <<Vec<T> as Cycle>::Next as X<'b, <Vec<T> as Cycle>::Next>>::U: Clone` + | ^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` note: required by a bound in `X` @@ -18,7 +18,7 @@ error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-5.rs:31:14 | LL | type U = str; - | ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <<Box<T> as Cycle>::Next as X<'b, <Box<T> as Cycle>::Next>>::U: Clone` + | ^^^ the trait `Clone` is not implemented for `str` | = help: the trait `Clone` is implemented for `String` note: required by a bound in `X` diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr index f1c8f83e30c..58f019704e7 100644 --- a/tests/ui/associated-types/issue-38821.stderr +++ b/tests/ui/associated-types/issue-38821.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:40:1 | LL | pub enum ColumnInsertValue<Col, Expr> where - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -26,7 +26,7 @@ LL | | Col: Column, ... | LL | | Default(Col), LL | | } - | |_^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | |_^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -44,7 +44,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:10 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -63,7 +63,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:10 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -83,7 +83,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:10 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -98,7 +98,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:10 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -114,7 +114,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:17 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -133,7 +133,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:17 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -153,7 +153,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:23 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -172,7 +172,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:23 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -192,7 +192,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:23 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -207,7 +207,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:23 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -223,7 +223,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:10 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -239,7 +239,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:10 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -255,7 +255,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:23 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -271,7 +271,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:23 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -287,7 +287,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:10 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 @@ -303,7 +303,7 @@ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not sat --> $DIR/issue-38821.rs:23:23 | LL | #[derive(Debug, Copy, Clone)] - | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType` | note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` --> $DIR/issue-38821.rs:9:18 diff --git a/tests/ui/associated-types/issue-43784-associated-type.stderr b/tests/ui/associated-types/issue-43784-associated-type.stderr index b2cbe8ee86e..529fc1f119a 100644 --- a/tests/ui/associated-types/issue-43784-associated-type.stderr +++ b/tests/ui/associated-types/issue-43784-associated-type.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/issue-43784-associated-type.rs:14:18 | LL | type Assoc = T; - | ^ the trait `Copy` is not implemented for `T`, which is required by `<T as Complete>::Assoc: Partial<T>` + | ^ the trait `Copy` is not implemented for `T` | note: required for `<T as Complete>::Assoc` to implement `Partial<T>` --> $DIR/issue-43784-associated-type.rs:1:11 diff --git a/tests/ui/associated-types/issue-65774-1.stderr b/tests/ui/associated-types/issue-65774-1.stderr index 9748a8fbbf4..9c77a25c432 100644 --- a/tests/ui/associated-types/issue-65774-1.stderr +++ b/tests/ui/associated-types/issue-65774-1.stderr @@ -15,7 +15,7 @@ error[E0277]: the trait bound `T: MyDisplay` is not satisfied --> $DIR/issue-65774-1.rs:44:76 | LL | let closure = |config: &mut <S as MPU>::MpuConfig| writer.my_write(&config); - | ^^^^^^^ the trait `MyDisplay` is not implemented for `T`, which is required by `&mut T: MyDisplay` + | ^^^^^^^ the trait `MyDisplay` is not implemented for `T` | = help: the trait `MyDisplay` is implemented for `&'a mut T` note: required for `&mut T` to implement `MyDisplay` diff --git a/tests/ui/associated-types/substs-ppaux.normal.stderr b/tests/ui/associated-types/substs-ppaux.normal.stderr index 8d3146be560..1ea8ab23556 100644 --- a/tests/ui/associated-types/substs-ppaux.normal.stderr +++ b/tests/ui/associated-types/substs-ppaux.normal.stderr @@ -80,7 +80,7 @@ error[E0277]: the trait bound `str: Foo<'_, '_, u8>` is not satisfied --> $DIR/substs-ppaux.rs:55:6 | LL | <str as Foo<u8>>::bar; - | ^^^ the trait `Sized` is not implemented for `str`, which is required by `str: Foo<'_, '_, u8>` + | ^^^ the trait `Sized` is not implemented for `str` | note: required for `str` to implement `Foo<'_, '_, u8>` --> $DIR/substs-ppaux.rs:15:20 diff --git a/tests/ui/associated-types/substs-ppaux.verbose.stderr b/tests/ui/associated-types/substs-ppaux.verbose.stderr index 0b5f449e576..05cd971c882 100644 --- a/tests/ui/associated-types/substs-ppaux.verbose.stderr +++ b/tests/ui/associated-types/substs-ppaux.verbose.stderr @@ -80,7 +80,7 @@ error[E0277]: the trait bound `str: Foo<'?0, '?1, u8>` is not satisfied --> $DIR/substs-ppaux.rs:55:6 | LL | <str as Foo<u8>>::bar; - | ^^^ the trait `Sized` is not implemented for `str`, which is required by `str: Foo<'?0, '?1, u8>` + | ^^^ the trait `Sized` is not implemented for `str` | note: required for `str` to implement `Foo<'?0, '?1, u8>` --> $DIR/substs-ppaux.rs:15:20 diff --git a/tests/ui/async-await/async-await-let-else.stderr b/tests/ui/async-await/async-await-let-else.stderr index 0952be2abe5..5883f34f87d 100644 --- a/tests/ui/async-await/async-await-let-else.stderr +++ b/tests/ui/async-await/async-await-let-else.stderr @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely LL | is_send(foo(Some(true))); | ^^^^^^^^^^^^^^^ future returned by `foo` is not `Send` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>` note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:8:15 | @@ -29,7 +29,7 @@ LL | is_send(foo2(Some(true))); | | | required by a bound introduced by this call | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>` note: required because it's used within this `async` fn body --> $DIR/async-await-let-else.rs:24:29 | @@ -60,7 +60,7 @@ error: future cannot be sent between threads safely LL | is_send(foo3(Some(true))); | ^^^^^^^^^^^^^^^^ future returned by `foo3` is not `Send` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>` note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:30:29 | @@ -80,7 +80,7 @@ error: future cannot be sent between threads safely LL | is_send(foo4(Some(true))); | ^^^^^^^^^^^^^^^^ future returned by `foo4` is not `Send` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>` note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:38:15 | diff --git a/tests/ui/async-await/async-closures/mangle.rs b/tests/ui/async-await/async-closures/mangle.rs index 632f1657436..a428905e40b 100644 --- a/tests/ui/async-await/async-closures/mangle.rs +++ b/tests/ui/async-await/async-closures/mangle.rs @@ -5,9 +5,6 @@ //@[v0] compile-flags: -Csymbol-mangling-version=v0 //@[legacy] compile-flags: -Csymbol-mangling-version=legacy -Zunstable-options -// FIXME(async_closures): When `fn_sig_for_fn_abi` is fixed, remove this. -//@ ignore-pass (test emits codegen-time warnings) - #![feature(async_closure, noop_waker)] extern crate block_on; diff --git a/tests/ui/async-await/async-closures/no-borrow-from-env.rs b/tests/ui/async-await/async-closures/no-borrow-from-env.rs index fe84aeeb32f..3f9d26b9713 100644 --- a/tests/ui/async-await/async-closures/no-borrow-from-env.rs +++ b/tests/ui/async-await/async-closures/no-borrow-from-env.rs @@ -38,7 +38,10 @@ fn through_field_and_ref<'a>(x: &S<'a>) { let c = async move || { println!("{}", *x.0); }; outlives::<'a>(c()); - // outlives::<'a>(call_once(c)); // FIXME(async_closures): Figure out why this fails + + // outlives::<'a>(call_once(c)); + // The above fails b/c the by-move coroutine of `c` captures `x` in its entirety. + // Since we have not asserted that the borrow for `&S<'a>` outlives `'a`, it'll fail. } fn main() {} diff --git a/tests/ui/async-await/async-closures/not-clone-closure.stderr b/tests/ui/async-await/async-closures/not-clone-closure.stderr index aea48a455c2..c2f963f9b92 100644 --- a/tests/ui/async-await/async-closures/not-clone-closure.stderr +++ b/tests/ui/async-await/async-closures/not-clone-closure.stderr @@ -2,8 +2,9 @@ error[E0277]: the trait bound `NotClonableUpvar: Clone` is not satisfied in `{as --> $DIR/not-clone-closure.rs:32:15 | LL | not_clone.clone(); - | ^^^^^ within `{async closure@$DIR/not-clone-closure.rs:29:21: 29:34}`, the trait `Clone` is not implemented for `NotClonableUpvar`, which is required by `{async closure@$DIR/not-clone-closure.rs:29:21: 29:34}: Clone` + | ^^^^^ unsatisfied trait bound | + = help: within `{async closure@$DIR/not-clone-closure.rs:29:21: 29:34}`, the trait `Clone` is not implemented for `NotClonableUpvar` note: required because it's used within this closure --> $DIR/not-clone-closure.rs:29:21 | diff --git a/tests/ui/async-await/async-closures/not-fn.rs b/tests/ui/async-await/async-closures/not-fn.rs index 5322a6d5d7a..5f2d047c3e9 100644 --- a/tests/ui/async-await/async-closures/not-fn.rs +++ b/tests/ui/async-await/async-closures/not-fn.rs @@ -9,7 +9,7 @@ fn main() { let mut x = 1; needs_fn(async || { - //~^ ERROR async closure does not implement `FnMut` because it captures state from its environment + //~^ ERROR async closure does not implement `FnMut` because it captures state from its environment x += 1; }); } diff --git a/tests/ui/async-await/async-closures/precise-captures.rs b/tests/ui/async-await/async-closures/precise-captures.rs index e82dd1dbaf0..c4c67df544f 100644 --- a/tests/ui/async-await/async-closures/precise-captures.rs +++ b/tests/ui/async-await/async-closures/precise-captures.rs @@ -126,7 +126,7 @@ async fn async_main() { { let mut s = S { a: 1, b: Drop("drop first"), c: Drop("untouched") }; let c = guidance!(async move || { - // s.a = 2; // FIXME(async_closures): Figure out why this fails + s.a = 2; drop(s.b); }); s.c.0 = "uncaptured"; @@ -141,7 +141,7 @@ async fn async_main() { { let mut s = S { a: 1, b: Drop("drop first"), c: Drop("untouched") }; let c = guidance!(async move || { - // s.a = 2; // FIXME(async_closures): Figure out why this fails + s.a = 2; drop(s.b); }); s.c.0 = "uncaptured"; diff --git a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.rs b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.rs index 18f16ca4b2d..be3f032b8ff 100644 --- a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.rs +++ b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.rs @@ -38,10 +38,12 @@ fn through_field_and_ref<'a>(x: &S<'a>) { let c = async || { println!("{}", *x.0); }; //~ ERROR `x` does not live long enough outlives::<'a>(c()); outlives::<'a>(call_once(c)); //~ ERROR explicit lifetime required in the type of `x` +} +fn through_field_and_ref_move<'a>(x: &S<'a>) { let c = async move || { println!("{}", *x.0); }; outlives::<'a>(c()); //~ ERROR `c` does not live long enough - // outlives::<'a>(call_once(c)); // FIXME(async_closures): Figure out why this fails + outlives::<'a>(call_once(c)); //~ ERROR explicit lifetime required in the type of `x` } fn main() {} diff --git a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr index 1df5abdbb18..a70aece2dea 100644 --- a/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr +++ b/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr @@ -100,7 +100,6 @@ LL | let c = async || { println!("{}", *x.0); }; LL | outlives::<'a>(c()); LL | outlives::<'a>(call_once(c)); | ------------ argument requires that `x` is borrowed for `'a` -... LL | } | - `x` dropped here while still borrowed @@ -114,11 +113,10 @@ LL | outlives::<'a>(call_once(c)); | ^^^^^^^^^^^^ lifetime `'a` required error[E0597]: `c` does not live long enough - --> $DIR/without-precise-captures-we-are-powerless.rs:43:20 + --> $DIR/without-precise-captures-we-are-powerless.rs:45:20 | -LL | fn through_field_and_ref<'a>(x: &S<'a>) { - | -- lifetime `'a` defined here -... +LL | fn through_field_and_ref_move<'a>(x: &S<'a>) { + | -- lifetime `'a` defined here LL | let c = async move || { println!("{}", *x.0); }; | - binding `c` declared here LL | outlives::<'a>(c()); @@ -126,11 +124,20 @@ LL | outlives::<'a>(c()); | | | borrowed value does not live long enough | argument requires that `c` is borrowed for `'a` -LL | // outlives::<'a>(call_once(c)); // FIXME(async_closures): Figure out why this fails +LL | outlives::<'a>(call_once(c)); LL | } | - `c` dropped here while still borrowed -error: aborting due to 9 previous errors +error[E0621]: explicit lifetime required in the type of `x` + --> $DIR/without-precise-captures-we-are-powerless.rs:46:20 + | +LL | fn through_field_and_ref_move<'a>(x: &S<'a>) { + | ------ help: add explicit lifetime `'a` to the type of `x`: `&'a S<'a>` +... +LL | outlives::<'a>(call_once(c)); + | ^^^^^^^^^^^^ lifetime `'a` required + +error: aborting due to 10 previous errors Some errors have detailed explanations: E0505, E0597, E0621. For more information about an error, try `rustc --explain E0505`. diff --git a/tests/ui/async-await/async-error-span.stderr b/tests/ui/async-await/async-error-span.stderr index 44f1583f4cc..37b5c329a7d 100644 --- a/tests/ui/async-await/async-error-span.stderr +++ b/tests/ui/async-await/async-error-span.stderr @@ -3,6 +3,9 @@ error[E0277]: `()` is not a future | LL | fn get_future() -> impl Future<Output = ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not a future +LL | +LL | panic!() + | -------- return type was inferred to be `_` here | = help: the trait `Future` is not implemented for `()` diff --git a/tests/ui/async-await/async-fn-nonsend.stderr b/tests/ui/async-await/async-fn-nonsend.stderr index 8b245281da9..0ced6c36f47 100644 --- a/tests/ui/async-await/async-fn-nonsend.stderr +++ b/tests/ui/async-await/async-fn-nonsend.stderr @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely LL | assert_send(non_send_temporary_in_match()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>` note: future is not `Send` as this value is used across an await --> $DIR/async-fn-nonsend.rs:33:26 | @@ -24,7 +24,7 @@ error: future cannot be sent between threads safely LL | assert_send(non_sync_with_method_call()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write` note: future is not `Send` as this value is used across an await --> $DIR/async-fn-nonsend.rs:46:15 | diff --git a/tests/ui/async-await/async-fn/edition-2015.rs b/tests/ui/async-await/async-fn/edition-2015.rs index 50448313b30..e38179758f6 100644 --- a/tests/ui/async-await/async-fn/edition-2015.rs +++ b/tests/ui/async-await/async-fn/edition-2015.rs @@ -3,7 +3,7 @@ fn foo(x: impl async Fn()) -> impl async Fn() { x } //~| ERROR `async` trait bounds are only allowed in Rust 2018 or later //~| ERROR async closures are unstable //~| ERROR async closures are unstable -//~| ERROR use of unstable library feature 'async_closure' -//~| ERROR use of unstable library feature 'async_closure' +//~| ERROR use of unstable library feature `async_closure` +//~| ERROR use of unstable library feature `async_closure` fn main() {} diff --git a/tests/ui/async-await/async-fn/edition-2015.stderr b/tests/ui/async-await/async-fn/edition-2015.stderr index 358bb3e112e..25101cb65df 100644 --- a/tests/ui/async-await/async-fn/edition-2015.stderr +++ b/tests/ui/async-await/async-fn/edition-2015.stderr @@ -38,7 +38,7 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x } = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = help: to use an async block, remove the `||`: `async {` -error[E0658]: use of unstable library feature 'async_closure' +error[E0658]: use of unstable library feature `async_closure` --> $DIR/edition-2015.rs:1:42 | LL | fn foo(x: impl async Fn()) -> impl async Fn() { x } @@ -48,7 +48,7 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x } = help: add `#![feature(async_closure)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'async_closure' +error[E0658]: use of unstable library feature `async_closure` --> $DIR/edition-2015.rs:1:22 | LL | fn foo(x: impl async Fn()) -> impl async Fn() { x } diff --git a/tests/ui/async-await/async-is-unwindsafe.stderr b/tests/ui/async-await/async-is-unwindsafe.stderr index 9c5e8f0252c..9323ce25b77 100644 --- a/tests/ui/async-await/async-is-unwindsafe.stderr +++ b/tests/ui/async-await/async-is-unwindsafe.stderr @@ -13,7 +13,7 @@ LL | | drop(cx_ref); LL | | }); | |______^ `&mut Context<'_>` may not be safely transferred across an unwind boundary | - = help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 12:24}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`, which is required by `{async block@$DIR/async-is-unwindsafe.rs:12:19: 12:24}: UnwindSafe` + = help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 12:24}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>` = note: `UnwindSafe` is implemented for `&Context<'_>`, but not for `&mut Context<'_>` note: future does not implement `UnwindSafe` as this value is used across an await --> $DIR/async-is-unwindsafe.rs:25:18 diff --git a/tests/ui/async-await/coroutine-not-future.rs b/tests/ui/async-await/coroutine-not-future.rs index 45227435507..de627333fe4 100644 --- a/tests/ui/async-await/coroutine-not-future.rs +++ b/tests/ui/async-await/coroutine-not-future.rs @@ -1,4 +1,5 @@ //@ edition:2018 +//@compile-flags: --diagnostic-width=300 #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] use std::future::Future; diff --git a/tests/ui/async-await/coroutine-not-future.stderr b/tests/ui/async-await/coroutine-not-future.stderr index 72921a72a95..b0f371f6706 100644 --- a/tests/ui/async-await/coroutine-not-future.stderr +++ b/tests/ui/async-await/coroutine-not-future.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied - --> $DIR/coroutine-not-future.rs:35:21 + --> $DIR/coroutine-not-future.rs:36:21 | LL | takes_coroutine(async_fn()); | --------------- ^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>` @@ -7,13 +7,13 @@ LL | takes_coroutine(async_fn()); | required by a bound introduced by this call | note: required by a bound in `takes_coroutine` - --> $DIR/coroutine-not-future.rs:19:39 + --> $DIR/coroutine-not-future.rs:20:39 | LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine` error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied - --> $DIR/coroutine-not-future.rs:37:21 + --> $DIR/coroutine-not-future.rs:38:21 | LL | takes_coroutine(returns_async_block()); | --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>` @@ -21,27 +21,27 @@ LL | takes_coroutine(returns_async_block()); | required by a bound introduced by this call | note: required by a bound in `takes_coroutine` - --> $DIR/coroutine-not-future.rs:19:39 + --> $DIR/coroutine-not-future.rs:20:39 | LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine` -error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:39:21: 39:26}: Coroutine<_>` is not satisfied - --> $DIR/coroutine-not-future.rs:39:21 +error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:40:21: 40:26}: Coroutine<_>` is not satisfied + --> $DIR/coroutine-not-future.rs:40:21 | LL | takes_coroutine(async {}); - | --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:39:21: 39:26}` + | --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:40:21: 40:26}` | | | required by a bound introduced by this call | note: required by a bound in `takes_coroutine` - --> $DIR/coroutine-not-future.rs:19:39 + --> $DIR/coroutine-not-future.rs:20:39 | LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine` error[E0277]: `impl Coroutine<Yield = (), Return = ()>` is not a future - --> $DIR/coroutine-not-future.rs:43:18 + --> $DIR/coroutine-not-future.rs:44:18 | LL | takes_future(returns_coroutine()); | ------------ ^^^^^^^^^^^^^^^^^^^ `impl Coroutine<Yield = (), Return = ()>` is not a future @@ -50,13 +50,13 @@ LL | takes_future(returns_coroutine()); | = help: the trait `Future` is not implemented for `impl Coroutine<Yield = (), Return = ()>` note: required by a bound in `takes_future` - --> $DIR/coroutine-not-future.rs:18:26 + --> $DIR/coroutine-not-future.rs:19:26 | LL | fn takes_future(_f: impl Future<Output = ()>) {} | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future` -error[E0277]: `{coroutine@$DIR/coroutine-not-future.rs:47:9: 47:14}` is not a future - --> $DIR/coroutine-not-future.rs:47:9 +error[E0277]: `{coroutine@$DIR/coroutine-not-future.rs:48:9: 48:14}` is not a future + --> $DIR/coroutine-not-future.rs:48:9 | LL | takes_future( | ------------ required by a bound introduced by this call @@ -65,11 +65,11 @@ LL | / |ctx| { LL | | LL | | ctx = yield (); LL | | }, - | |_________^ `{coroutine@$DIR/coroutine-not-future.rs:47:9: 47:14}` is not a future + | |_________^ `{coroutine@$DIR/coroutine-not-future.rs:48:9: 48:14}` is not a future | - = help: the trait `Future` is not implemented for `{coroutine@$DIR/coroutine-not-future.rs:47:9: 47:14}` + = help: the trait `Future` is not implemented for `{coroutine@$DIR/coroutine-not-future.rs:48:9: 48:14}` note: required by a bound in `takes_future` - --> $DIR/coroutine-not-future.rs:18:26 + --> $DIR/coroutine-not-future.rs:19:26 | LL | fn takes_future(_f: impl Future<Output = ()>) {} | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future` diff --git a/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr index eab5bea681c..8c9d06c79ca 100644 --- a/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr +++ b/tests/ui/async-await/debug-ice-attempted-to-add-with-overflow.stderr @@ -7,7 +7,7 @@ LL | [0usize; 0xffff_ffff_ffff_ffff].await; | |`[usize; usize::MAX]` is not a future | help: remove the `.await` | - = help: the trait `Future` is not implemented for `[usize; usize::MAX]`, which is required by `[usize; usize::MAX]: IntoFuture` + = help: the trait `Future` is not implemented for `[usize; usize::MAX]` = note: [usize; usize::MAX] must be a future or must implement `IntoFuture` to be awaited = note: required for `[usize; usize::MAX]` to implement `IntoFuture` diff --git a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr index 53cdc9b61d3..721e0106293 100644 --- a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr +++ b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr @@ -15,7 +15,7 @@ LL | None { value: (), ..Default::default() }.await; | |`Option<_>` is not a future | help: remove the `.await` | - = help: the trait `Future` is not implemented for `Option<_>`, which is required by `Option<_>: IntoFuture` + = help: the trait `Future` is not implemented for `Option<_>` = note: Option<_> must be a future or must implement `IntoFuture` to be awaited = note: required for `Option<_>` to implement `IntoFuture` diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.stderr index ce2cee6ed47..9fce4d61b3b 100644 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.stderr +++ b/tests/ui/async-await/drop-track-field-assign-nonsend.stderr @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely LL | assert_send(agent.handle()); | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>` note: future is not `Send` as this value is used across an await --> $DIR/drop-track-field-assign-nonsend.rs:20:39 | diff --git a/tests/ui/async-await/field-assign-nonsend.stderr b/tests/ui/async-await/field-assign-nonsend.stderr index 525a2cc78b4..418a0829c65 100644 --- a/tests/ui/async-await/field-assign-nonsend.stderr +++ b/tests/ui/async-await/field-assign-nonsend.stderr @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely LL | assert_send(agent.handle()); | ^^^^^^^^^^^^^^ future returned by `handle` is not `Send` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>` note: future is not `Send` as this value is used across an await --> $DIR/field-assign-nonsend.rs:20:39 | diff --git a/tests/ui/async-await/in-trait/missing-send-bound.stderr b/tests/ui/async-await/in-trait/missing-send-bound.stderr index 93f37a9a8e9..aeabb5931df 100644 --- a/tests/ui/async-await/in-trait/missing-send-bound.stderr +++ b/tests/ui/async-await/in-trait/missing-send-bound.stderr @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely LL | assert_is_send(test::<T>()); | ^^^^^^^^^^^ future returned by `test` is not `Send` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `impl Future<Output = ()>`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `impl Future<Output = ()>` note: future is not `Send` as it awaits another future which is not `Send` --> $DIR/missing-send-bound.rs:9:5 | diff --git a/tests/ui/async-await/issue-101715.stderr b/tests/ui/async-await/issue-101715.stderr index 3b429793b78..f6af15c00d6 100644 --- a/tests/ui/async-await/issue-101715.stderr +++ b/tests/ui/async-await/issue-101715.stderr @@ -7,7 +7,7 @@ LL | .await | |`()` is not a future | help: remove the `.await` | - = help: the trait `Future` is not implemented for `()`, which is required by `(): IntoFuture` + = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` diff --git a/tests/ui/async-await/issue-64130-1-sync.stderr b/tests/ui/async-await/issue-64130-1-sync.stderr index 15f49124f6f..5428d7ef71b 100644 --- a/tests/ui/async-await/issue-64130-1-sync.stderr +++ b/tests/ui/async-await/issue-64130-1-sync.stderr @@ -4,7 +4,7 @@ error: future cannot be shared between threads safely LL | is_sync(bar()); | ^^^^^ future returned by `bar` is not `Sync` | - = help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`, which is required by `impl Future<Output = ()>: Sync` + = help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo` note: future is not `Sync` as this value is used across an await --> $DIR/issue-64130-1-sync.rs:15:11 | diff --git a/tests/ui/async-await/issue-64130-2-send.stderr b/tests/ui/async-await/issue-64130-2-send.stderr index 67368314b1b..f05e954d2d7 100644 --- a/tests/ui/async-await/issue-64130-2-send.stderr +++ b/tests/ui/async-await/issue-64130-2-send.stderr @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely LL | is_send(bar()); | ^^^^^ future returned by `bar` is not `Send` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo` note: future is not `Send` as this value is used across an await --> $DIR/issue-64130-2-send.rs:15:11 | diff --git a/tests/ui/async-await/issue-64130-3-other.stderr b/tests/ui/async-await/issue-64130-3-other.stderr index e3a73920c92..3ac30bdc23e 100644 --- a/tests/ui/async-await/issue-64130-3-other.stderr +++ b/tests/ui/async-await/issue-64130-3-other.stderr @@ -5,7 +5,7 @@ LL | async fn bar() { | -------------- within this `impl Future<Output = ()>` ... LL | is_qux(bar()); - | ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`, which is required by `impl Future<Output = ()>: Qux` + | ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo` | note: future does not implement `Qux` as this value is used across an await --> $DIR/issue-64130-3-other.rs:18:11 diff --git a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr index bd890c83817..d28807e223b 100644 --- a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr +++ b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely LL | is_send(foo()); | ^^^^^ future returned by `foo` is not `Send` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, u32>`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, u32>` note: future is not `Send` as this value is used across an await --> $DIR/issue-64130-non-send-future-diags.rs:17:11 | diff --git a/tests/ui/async-await/issue-67252-unnamed-future.stderr b/tests/ui/async-await/issue-67252-unnamed-future.stderr index 2ed40284702..4ec6779dda8 100644 --- a/tests/ui/async-await/issue-67252-unnamed-future.stderr +++ b/tests/ui/async-await/issue-67252-unnamed-future.stderr @@ -8,7 +8,7 @@ LL | | let _a = a; LL | | }); | |______^ future created by async block is not `Send` | - = help: within `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 18:16}`, the trait `Send` is not implemented for `*mut ()`, which is required by `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 18:16}: Send` + = help: within `{async block@$DIR/issue-67252-unnamed-future.rs:18:11: 18:16}`, the trait `Send` is not implemented for `*mut ()` note: future is not `Send` as this value is used across an await --> $DIR/issue-67252-unnamed-future.rs:20:17 | diff --git a/tests/ui/async-await/issue-68112.stderr b/tests/ui/async-await/issue-68112.stderr index ca60079f3ef..f8889ebcca1 100644 --- a/tests/ui/async-await/issue-68112.stderr +++ b/tests/ui/async-await/issue-68112.stderr @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely LL | require_send(send_fut); | ^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | - = help: the trait `Sync` is not implemented for `RefCell<i32>`, which is required by `{async block@$DIR/issue-68112.rs:29:20: 29:25}: Send` + = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead note: future is not `Send` as it awaits another future which is not `Send` --> $DIR/issue-68112.rs:31:17 @@ -23,7 +23,7 @@ error: future cannot be sent between threads safely LL | require_send(send_fut); | ^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send` | - = help: the trait `Sync` is not implemented for `RefCell<i32>`, which is required by `{async block@$DIR/issue-68112.rs:39:20: 39:25}: Send` + = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead note: future is not `Send` as it awaits another future which is not `Send` --> $DIR/issue-68112.rs:40:17 @@ -42,7 +42,7 @@ error[E0277]: `RefCell<i32>` cannot be shared between threads safely LL | require_send(send_fut); | ^^^^^^^^^^^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely | - = help: the trait `Sync` is not implemented for `RefCell<i32>`, which is required by `{async block@$DIR/issue-68112.rs:57:20: 57:25}: Send` + = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead = note: required for `Arc<RefCell<i32>>` to implement `Send` note: required because it's used within this `async` fn body diff --git a/tests/ui/async-await/issue-70935-complex-spans.rs b/tests/ui/async-await/issue-70935-complex-spans.rs index a74bd9890ca..2851637ae78 100644 --- a/tests/ui/async-await/issue-70935-complex-spans.rs +++ b/tests/ui/async-await/issue-70935-complex-spans.rs @@ -14,8 +14,8 @@ async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> { fn foo(x: NotSync) -> impl Future + Send { //~^ ERROR `*mut ()` cannot be shared between threads safely - //~| ERROR `*mut ()` cannot be shared between threads safely async move { + //~^ ERROR `*mut ()` cannot be shared between threads safely baz(|| async { foo(x.clone()); }).await; diff --git a/tests/ui/async-await/issue-70935-complex-spans.stderr b/tests/ui/async-await/issue-70935-complex-spans.stderr index 1ca0b339c16..31d15c45921 100644 --- a/tests/ui/async-await/issue-70935-complex-spans.stderr +++ b/tests/ui/async-await/issue-70935-complex-spans.stderr @@ -1,10 +1,15 @@ error[E0277]: `*mut ()` cannot be shared between threads safely - --> $DIR/issue-70935-complex-spans.rs:15:23 + --> $DIR/issue-70935-complex-spans.rs:17:5 | -LL | fn foo(x: NotSync) -> impl Future + Send { - | ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely +LL | / async move { +LL | | +LL | | baz(|| async { +LL | | foo(x.clone()); +LL | | }).await; +LL | | } + | |_____^ `*mut ()` cannot be shared between threads safely | - = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`, which is required by `{async block@$DIR/issue-70935-complex-spans.rs:18:5: 18:15}: Send` + = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()` note: required because it appears within the type `PhantomData<*mut ()>` --> $SRC_DIR/core/src/marker.rs:LL:COL note: required because it appears within the type `NotSync` @@ -26,10 +31,15 @@ LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> { LL | | } | |_^ note: required because it's used within this `async` block - --> $DIR/issue-70935-complex-spans.rs:18:5 + --> $DIR/issue-70935-complex-spans.rs:17:5 | LL | async move { | ^^^^^^^^^^ +note: required by a bound in an opaque type + --> $DIR/issue-70935-complex-spans.rs:15:37 + | +LL | fn foo(x: NotSync) -> impl Future + Send { + | ^^^^ error[E0277]: `*mut ()` cannot be shared between threads safely --> $DIR/issue-70935-complex-spans.rs:15:23 @@ -37,7 +47,7 @@ error[E0277]: `*mut ()` cannot be shared between threads safely LL | fn foo(x: NotSync) -> impl Future + Send { | ^^^^^^^^^^^^^^^^^^ `*mut ()` cannot be shared between threads safely | - = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()`, which is required by `{async block@$DIR/issue-70935-complex-spans.rs:18:5: 18:15}: Send` + = help: within `NotSync`, the trait `Sync` is not implemented for `*mut ()` note: required because it appears within the type `PhantomData<*mut ()>` --> $SRC_DIR/core/src/marker.rs:LL:COL note: required because it appears within the type `NotSync` @@ -59,11 +69,10 @@ LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> { LL | | } | |_^ note: required because it's used within this `async` block - --> $DIR/issue-70935-complex-spans.rs:18:5 + --> $DIR/issue-70935-complex-spans.rs:17:5 | LL | async move { | ^^^^^^^^^^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/issue-71137.stderr b/tests/ui/async-await/issue-71137.stderr index 75d72e425f5..8739c22a310 100644 --- a/tests/ui/async-await/issue-71137.stderr +++ b/tests/ui/async-await/issue-71137.stderr @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely LL | fake_spawn(wrong_mutex()); | ^^^^^^^^^^^^^ future returned by `wrong_mutex` is not `Send` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, i32>`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, i32>` note: future is not `Send` as this value is used across an await --> $DIR/issue-71137.rs:14:26 | diff --git a/tests/ui/async-await/issue-72590-type-error-sized.stderr b/tests/ui/async-await/issue-72590-type-error-sized.stderr index 1b822234d80..778423578e1 100644 --- a/tests/ui/async-await/issue-72590-type-error-sized.stderr +++ b/tests/ui/async-await/issue-72590-type-error-sized.stderr @@ -16,7 +16,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t LL | async fn frob(self) {} | ^^^^ doesn't have a size known at compile-time | - = help: within `Foo`, the trait `Sized` is not implemented for `str`, which is required by `Foo: Sized` + = help: within `Foo`, the trait `Sized` is not implemented for `str` note: required because it appears within the type `Foo` --> $DIR/issue-72590-type-error-sized.rs:5:8 | diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr index 0c28aea44bb..c01237255b8 100644 --- a/tests/ui/async-await/issues/issue-67893.stderr +++ b/tests/ui/async-await/issues/issue-67893.stderr @@ -11,7 +11,7 @@ LL | g(issue_67893::run()) LL | pub async fn run() { | ------------------ within this `impl Future<Output = ()>` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>` note: required because it's used within this `async` fn body --> $DIR/auxiliary/issue_67893.rs:9:20 | diff --git a/tests/ui/async-await/partial-drop-partial-reinit.stderr b/tests/ui/async-await/partial-drop-partial-reinit.stderr index 0bd7d50b941..042ed18984e 100644 --- a/tests/ui/async-await/partial-drop-partial-reinit.stderr +++ b/tests/ui/async-await/partial-drop-partial-reinit.stderr @@ -9,7 +9,7 @@ LL | gimme_send(foo()); LL | async fn foo() { | -------------- within this `impl Future<Output = ()>` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend`, which is required by `impl Future<Output = ()>: Send` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend` = note: required because it appears within the type `(NotSend,)` note: required because it's used within this `async` fn body --> $DIR/partial-drop-partial-reinit.rs:27:16 diff --git a/tests/ui/async-await/pin-needed-to-poll-2.stderr b/tests/ui/async-await/pin-needed-to-poll-2.stderr index e22baabc25b..8eb671531e7 100644 --- a/tests/ui/async-await/pin-needed-to-poll-2.stderr +++ b/tests/ui/async-await/pin-needed-to-poll-2.stderr @@ -2,7 +2,7 @@ error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/pin-needed-to-poll-2.rs:43:18 | LL | Pin::new(&mut self.sleep).poll(cx) - | -------- ^^^^^^^^^^^^^^^ within `Sleep`, the trait `Unpin` is not implemented for `PhantomPinned`, which is required by `Sleep: Unpin` + | -------- ^^^^^^^^^^^^^^^ within `Sleep`, the trait `Unpin` is not implemented for `PhantomPinned` | | | required by a bound introduced by this call | diff --git a/tests/ui/async-await/unnecessary-await.stderr b/tests/ui/async-await/unnecessary-await.stderr index 8d819576532..620370a6113 100644 --- a/tests/ui/async-await/unnecessary-await.stderr +++ b/tests/ui/async-await/unnecessary-await.stderr @@ -6,7 +6,7 @@ LL | boo().await; | | | this call returns `()` | - = help: the trait `Future` is not implemented for `()`, which is required by `(): IntoFuture` + = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` help: remove the `.await` @@ -28,7 +28,7 @@ LL | e!().await; | |`()` is not a future | help: remove the `.await` | - = help: the trait `Future` is not implemented for `()`, which is required by `(): IntoFuture` + = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` @@ -44,7 +44,7 @@ LL | $expr.await LL | f!(()); | ------ in this macro invocation | - = help: the trait `Future` is not implemented for `()`, which is required by `(): IntoFuture` + = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -58,7 +58,7 @@ LL | for x in [] {}.await | |`()` is not a future | help: remove the `.await` | - = help: the trait `Future` is not implemented for `()`, which is required by `(): IntoFuture` + = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` diff --git a/tests/ui/auto-traits/issue-83857-ub.stderr b/tests/ui/auto-traits/issue-83857-ub.stderr index 20bfe7e36ca..7c437b7e6c8 100644 --- a/tests/ui/auto-traits/issue-83857-ub.stderr +++ b/tests/ui/auto-traits/issue-83857-ub.stderr @@ -4,7 +4,7 @@ error[E0277]: `Foo<T, U>` cannot be sent between threads safely LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo<T, U>` cannot be sent between threads safely | - = help: the trait `Send` is not implemented for `Foo<T, U>`, which is required by `Foo<T, U>: WithAssoc` + = help: the trait `Send` is not implemented for `Foo<T, U>` note: required for `Foo<T, U>` to implement `WithAssoc` --> $DIR/issue-83857-ub.rs:14:15 | @@ -29,7 +29,7 @@ LL | | LL | | } | |_^ `Foo<T, U>` cannot be sent between threads safely | - = help: the trait `Send` is not implemented for `Foo<T, U>`, which is required by `Foo<T, U>: WithAssoc` + = help: the trait `Send` is not implemented for `Foo<T, U>` note: required for `Foo<T, U>` to implement `WithAssoc` --> $DIR/issue-83857-ub.rs:14:15 | diff --git a/tests/ui/auto-traits/str-contains-slice-conceptually.stderr b/tests/ui/auto-traits/str-contains-slice-conceptually.stderr index ebd3a556e75..e1dae35be00 100644 --- a/tests/ui/auto-traits/str-contains-slice-conceptually.stderr +++ b/tests/ui/auto-traits/str-contains-slice-conceptually.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `[u8]: AutoTrait` is not satisfied in `str` --> $DIR/str-contains-slice-conceptually.rs:11:22 | LL | needs_auto_trait::<str>(); - | ^^^ within `str`, the trait `AutoTrait` is not implemented for `[u8]`, which is required by `str: AutoTrait` + | ^^^ within `str`, the trait `AutoTrait` is not implemented for `[u8]` | = note: `str` is considered to contain a `[u8]` slice for auto trait purposes note: required by a bound in `needs_auto_trait` diff --git a/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr b/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr index b7c97389912..aa5585a5371 100644 --- a/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr +++ b/tests/ui/auto-traits/typeck-default-trait-impl-constituent-types-2.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied in `(MyS2, MyS)` --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:17:18 | LL | is_mytrait::<(MyS2, MyS)>(); - | ^^^^^^^^^^^ within `(MyS2, MyS)`, the trait `MyTrait` is not implemented for `MyS2`, which is required by `(MyS2, MyS): MyTrait` + | ^^^^^^^^^^^ within `(MyS2, MyS)`, the trait `MyTrait` is not implemented for `MyS2` | = note: required because it appears within the type `(MyS2, MyS)` note: required by a bound in `is_mytrait` diff --git a/tests/ui/auto-traits/typeck-default-trait-impl-precedence.stderr b/tests/ui/auto-traits/typeck-default-trait-impl-precedence.stderr index 4773ac4ccf7..fca01b3f48d 100644 --- a/tests/ui/auto-traits/typeck-default-trait-impl-precedence.stderr +++ b/tests/ui/auto-traits/typeck-default-trait-impl-precedence.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `&'static u32: Defaulted` is not satisfied --> $DIR/typeck-default-trait-impl-precedence.rs:19:20 | LL | is_defaulted::<&'static u32>(); - | ^^^^^^^^^^^^ the trait `Signed` is not implemented for `u32`, which is required by `&'static u32: Defaulted` + | ^^^^^^^^^^^^ the trait `Signed` is not implemented for `u32` | note: required for `&'static u32` to implement `Defaulted` --> $DIR/typeck-default-trait-impl-precedence.rs:10:19 diff --git a/tests/ui/binop/binary-op-suggest-deref.stderr b/tests/ui/binop/binary-op-suggest-deref.stderr index 01852fbc633..440625d8ccb 100644 --- a/tests/ui/binop/binary-op-suggest-deref.stderr +++ b/tests/ui/binop/binary-op-suggest-deref.stderr @@ -27,7 +27,7 @@ error[E0277]: can't compare `&{integer}` with `{integer}` LL | _ = foo == &0; | ^^ no implementation for `&{integer} == {integer}` | - = help: the trait `PartialEq<{integer}>` is not implemented for `&{integer}`, which is required by `&&{integer}: PartialEq<&{integer}>` + = help: the trait `PartialEq<{integer}>` is not implemented for `&{integer}` = note: required for `&&{integer}` to implement `PartialEq<&{integer}>` help: consider dereferencing here | @@ -65,7 +65,7 @@ error[E0277]: can't compare `&&{integer}` with `{integer}` LL | _ = &&foo == &&0; | ^^ no implementation for `&&{integer} == {integer}` | - = help: the trait `PartialEq<{integer}>` is not implemented for `&&{integer}`, which is required by `&&&&{integer}: PartialEq<&&{integer}>` + = help: the trait `PartialEq<{integer}>` is not implemented for `&&{integer}` = note: required for `&&&{integer}` to implement `PartialEq<&{integer}>` = note: 1 redundant requirement hidden = note: required for `&&&&{integer}` to implement `PartialEq<&&{integer}>` @@ -119,7 +119,7 @@ error[E0277]: can't compare `{integer}` with `&{integer}` LL | _ = &0 == foo; | ^^ no implementation for `{integer} == &{integer}` | - = help: the trait `PartialEq<&{integer}>` is not implemented for `{integer}`, which is required by `&{integer}: PartialEq<&&{integer}>` + = help: the trait `PartialEq<&{integer}>` is not implemented for `{integer}` = note: required for `&{integer}` to implement `PartialEq<&&{integer}>` help: consider dereferencing here | @@ -157,7 +157,7 @@ error[E0277]: can't compare `{integer}` with `&&{integer}` LL | _ = &&0 == &&foo; | ^^ no implementation for `{integer} == &&{integer}` | - = help: the trait `PartialEq<&&{integer}>` is not implemented for `{integer}`, which is required by `&&{integer}: PartialEq<&&&&{integer}>` + = help: the trait `PartialEq<&&{integer}>` is not implemented for `{integer}` = note: required for `&{integer}` to implement `PartialEq<&&&{integer}>` = note: 1 redundant requirement hidden = note: required for `&&{integer}` to implement `PartialEq<&&&&{integer}>` @@ -173,7 +173,7 @@ error[E0277]: can't compare `Box<Box<{integer}>>` with `&&{integer}` LL | _ = &Box::new(Box::new(42)) == &foo; | ^^ no implementation for `Box<Box<{integer}>> == &&{integer}` | - = help: the trait `PartialEq<&&{integer}>` is not implemented for `Box<Box<{integer}>>`, which is required by `&Box<Box<{integer}>>: PartialEq<&&&{integer}>` + = help: the trait `PartialEq<&&{integer}>` is not implemented for `Box<Box<{integer}>>` = note: required for `&Box<Box<{integer}>>` to implement `PartialEq<&&&{integer}>` help: consider dereferencing both sides of the expression | @@ -187,7 +187,7 @@ error[E0277]: can't compare `Box<{integer}>` with `&&{integer}` LL | _ = &Box::new(42) == &foo; | ^^ no implementation for `Box<{integer}> == &&{integer}` | - = help: the trait `PartialEq<&&{integer}>` is not implemented for `Box<{integer}>`, which is required by `&Box<{integer}>: PartialEq<&&&{integer}>` + = help: the trait `PartialEq<&&{integer}>` is not implemented for `Box<{integer}>` = note: required for `&Box<{integer}>` to implement `PartialEq<&&&{integer}>` help: consider dereferencing both sides of the expression | @@ -201,7 +201,7 @@ error[E0277]: can't compare `Box<Box<Box<Box<{integer}>>>>` with `&&{integer}` LL | _ = &Box::new(Box::new(Box::new(Box::new(42)))) == &foo; | ^^ no implementation for `Box<Box<Box<Box<{integer}>>>> == &&{integer}` | - = help: the trait `PartialEq<&&{integer}>` is not implemented for `Box<Box<Box<Box<{integer}>>>>`, which is required by `&Box<Box<Box<Box<{integer}>>>>: PartialEq<&&&{integer}>` + = help: the trait `PartialEq<&&{integer}>` is not implemented for `Box<Box<Box<Box<{integer}>>>>` = note: required for `&Box<Box<Box<Box<{integer}>>>>` to implement `PartialEq<&&&{integer}>` help: consider dereferencing both sides of the expression | @@ -215,7 +215,7 @@ error[E0277]: can't compare `&&{integer}` with `Box<Box<Box<Box<{integer}>>>>` LL | _ = &foo == &Box::new(Box::new(Box::new(Box::new(42)))); | ^^ no implementation for `&&{integer} == Box<Box<Box<Box<{integer}>>>>` | - = help: the trait `PartialEq<Box<Box<Box<Box<{integer}>>>>>` is not implemented for `&&{integer}`, which is required by `&&&{integer}: PartialEq<&Box<Box<Box<Box<{integer}>>>>>` + = help: the trait `PartialEq<Box<Box<Box<Box<{integer}>>>>>` is not implemented for `&&{integer}` = note: required for `&&&{integer}` to implement `PartialEq<&Box<Box<Box<Box<{integer}>>>>>` help: consider dereferencing both sides of the expression | diff --git a/tests/ui/block-result/issue-22645.stderr b/tests/ui/block-result/issue-22645.stderr index 2a267ce792f..1064848f513 100644 --- a/tests/ui/block-result/issue-22645.stderr +++ b/tests/ui/block-result/issue-22645.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `{integer}: Scalar` is not satisfied --> $DIR/issue-22645.rs:15:5 | LL | b + 3 - | ^ the trait `Scalar` is not implemented for `{integer}`, which is required by `Bob: Add<_>` + | ^ the trait `Scalar` is not implemented for `{integer}` | = help: the trait `Scalar` is implemented for `f64` note: required for `Bob` to implement `Add<{integer}>` diff --git a/tests/ui/borrowck/issue-64453.rs b/tests/ui/borrowck/issue-64453.rs index 33d55be5812..5f1f35d6ca9 100644 --- a/tests/ui/borrowck/issue-64453.rs +++ b/tests/ui/borrowck/issue-64453.rs @@ -3,7 +3,6 @@ struct Value; static settings_dir: String = format!(""); //~^ ERROR cannot call non-const fn -//~| ERROR is not yet stable as a const fn from_string(_: String) -> Value { Value diff --git a/tests/ui/borrowck/issue-64453.stderr b/tests/ui/borrowck/issue-64453.stderr index e671817633b..98b05ead649 100644 --- a/tests/ui/borrowck/issue-64453.stderr +++ b/tests/ui/borrowck/issue-64453.stderr @@ -1,12 +1,3 @@ -error: `Arguments::<'a>::new_const` is not yet stable as a const fn - --> $DIR/issue-64453.rs:4:31 - | -LL | static settings_dir: String = format!(""); - | ^^^^^^^^^^^ - | - = help: add `#![feature(const_fmt_arguments_new)]` to the crate attributes to enable - = note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) - error[E0015]: cannot call non-const fn `format` in statics --> $DIR/issue-64453.rs:4:31 | @@ -18,7 +9,7 @@ LL | static settings_dir: String = format!(""); = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0507]: cannot move out of static item `settings_dir` - --> $DIR/issue-64453.rs:14:37 + --> $DIR/issue-64453.rs:13:37 | LL | let settings_data = from_string(settings_dir); | ^^^^^^^^^^^^ move occurs because `settings_dir` has type `String`, which does not implement the `Copy` trait @@ -28,7 +19,7 @@ help: consider cloning the value if the performance cost is acceptable LL | let settings_data = from_string(settings_dir.clone()); | ++++++++ -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors Some errors have detailed explanations: E0015, E0507. For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/box/alloc-unstable-fail.rs b/tests/ui/box/alloc-unstable-fail.rs index 9427571648c..e209af97d7f 100644 --- a/tests/ui/box/alloc-unstable-fail.rs +++ b/tests/ui/box/alloc-unstable-fail.rs @@ -2,5 +2,5 @@ use std::boxed::Box; fn main() { let _boxed: Box<u32, _> = Box::new(10); - //~^ ERROR use of unstable library feature 'allocator_api' + //~^ ERROR use of unstable library feature `allocator_api` } diff --git a/tests/ui/box/alloc-unstable-fail.stderr b/tests/ui/box/alloc-unstable-fail.stderr index 9e1e12a2b6a..6ce63a79966 100644 --- a/tests/ui/box/alloc-unstable-fail.stderr +++ b/tests/ui/box/alloc-unstable-fail.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'allocator_api' +error[E0658]: use of unstable library feature `allocator_api` --> $DIR/alloc-unstable-fail.rs:4:26 | LL | let _boxed: Box<u32, _> = Box::new(10); diff --git a/tests/ui/cast/unsized-union-ice.stderr b/tests/ui/cast/unsized-union-ice.stderr index 05f86457829..1c9450b8e18 100644 --- a/tests/ui/cast/unsized-union-ice.stderr +++ b/tests/ui/cast/unsized-union-ice.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation LL | val: std::mem::ManuallyDrop<[u8]>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `ManuallyDrop<[u8]>`, the trait `Sized` is not implemented for `[u8]`, which is required by `ManuallyDrop<[u8]>: Sized` + = help: within `ManuallyDrop<[u8]>`, the trait `Sized` is not implemented for `[u8]` note: required because it appears within the type `ManuallyDrop<[u8]>` --> $SRC_DIR/core/src/mem/manually_drop.rs:LL:COL = note: no field of a union may have a dynamically sized type diff --git a/tests/ui/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.stderr index c21016e9290..ab212dda015 100644 --- a/tests/ui/check-cfg/mix.stderr +++ b/tests/ui/check-cfg/mix.stderr @@ -251,7 +251,7 @@ warning: unexpected `cfg` condition value: `zebra` LL | cfg!(target_feature = "zebra"); | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, and `avx512vpopcntdq` and 245 more + = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, and `avx512vpopcntdq` and 250 more = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: 27 warnings emitted diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index da790bbd528..f51271dc3de 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -156,7 +156,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_env = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_env` are: ``, `gnu`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `psx`, `relibc`, `sgx`, and `uclibc` + = note: expected values for `target_env` are: ``, `gnu`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `p1`, `p2`, `relibc`, `sgx`, and `uclibc` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` @@ -174,7 +174,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_feature = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `avxifma`, `avxneconvert`, `avxvnni`, `avxvnniint16`, `avxvnniint8`, `backchain`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `crt-static`, `cssc`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `ecv`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `extended-const`, `f`, `f16c`, `f32mm`, `f64mm`, `faminmax`, `fcma`, `fdivdu`, `fhm`, `flagm`, `flagm2`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fp8`, `fp8dot2`, `fp8dot4`, `fp8fma`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frecipe`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `hbc`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lahfsahf`, `lasx`, `lbt`, `lor`, `lse`, `lse128`, `lse2`, `lsx`, `lut`, `lvz`, `lzcnt`, `m`, `mclass`, `mops`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `partword-atomics`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `prfchw`, `quadword-atomics`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rcpc3`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sha512`, `sign-ext`, `simd128`, `sm3`, `sm4`, `sme`, `sme-b16b16`, `sme-f16f16`, `sme-f64f64`, `sme-f8f16`, `sme-f8f32`, `sme-fa64`, `sme-i16i64`, `sme-lutv2`, `sme2`, `sme2p1`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `ssve-fp8dot2`, `ssve-fp8dot4`, `ssve-fp8fma`, `sve`, `sve-b16b16`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `sve2p1`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `unaligned-scalar-mem`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `v8.8a`, `v8.9a`, `v9.1a`, `v9.2a`, `v9.3a`, `v9.4a`, `v9.5a`, `v9a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vector`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `wfxt`, `xop`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zaamo`, `zabha`, `zalrsc`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, and `zkt` + = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `avxifma`, `avxneconvert`, `avxvnni`, `avxvnniint16`, `avxvnniint8`, `backchain`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `crt-static`, `cssc`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `ecv`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `extended-const`, `f`, `f16c`, `f32mm`, `f64mm`, `faminmax`, `fcma`, `fdivdu`, `fhm`, `flagm`, `flagm2`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fp8`, `fp8dot2`, `fp8dot4`, `fp8fma`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frecipe`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `hbc`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lahfsahf`, `lasx`, `lbt`, `leoncasa`, `lor`, `lse`, `lse128`, `lse2`, `lsx`, `lut`, `lvz`, `lzcnt`, `m`, `mclass`, `mops`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `partword-atomics`, `pauth-lr`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `prfchw`, `quadword-atomics`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rcpc3`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sha512`, `sign-ext`, `simd128`, `sm3`, `sm4`, `sme`, `sme-b16b16`, `sme-f16f16`, `sme-f64f64`, `sme-f8f16`, `sme-f8f32`, `sme-fa64`, `sme-i16i64`, `sme-lutv2`, `sme2`, `sme2p1`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `ssve-fp8dot2`, `ssve-fp8dot4`, `ssve-fp8fma`, `sve`, `sve-b16b16`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `sve2p1`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `unaligned-scalar-mem`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `v8.8a`, `v8.9a`, `v8plus`, `v9`, `v9.1a`, `v9.2a`, `v9.3a`, `v9.4a`, `v9.5a`, `v9a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vector`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `wfxt`, `wide-arithmetic`, `xop`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zaamo`, `zabha`, `zalrsc`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, and `zkt` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` @@ -210,7 +210,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` LL | target_os = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` + = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` @@ -294,7 +294,7 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` | | | help: there is a expected value with a similar name: `"linux"` | - = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` + = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `psx`, `redox`, `rtems`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: 30 warnings emitted diff --git a/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.rs b/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.rs index c194cea2e37..27b17a56f12 100644 --- a/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.rs +++ b/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.rs @@ -13,10 +13,10 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: m[0] += 10; - //~^ NOTE: Capturing m[] -> MutBorrow - //~| NOTE: Min Capture m[] -> MutBorrow + //~^ NOTE: Capturing m[] -> Mutable + //~| NOTE: Min Capture m[] -> Mutable m[1] += 40; - //~^ NOTE: Capturing m[] -> MutBorrow + //~^ NOTE: Capturing m[] -> Mutable }; c(); diff --git a/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr b/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr index d7582dcfcc7..3c4f2de73a4 100644 --- a/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr +++ b/tests/ui/closures/2229_closure_analysis/arrays-completely-captured.stderr @@ -20,12 +20,12 @@ LL | | LL | | }; | |_____^ | -note: Capturing m[] -> MutBorrow +note: Capturing m[] -> Mutable --> $DIR/arrays-completely-captured.rs:15:9 | LL | m[0] += 10; | ^ -note: Capturing m[] -> MutBorrow +note: Capturing m[] -> Mutable --> $DIR/arrays-completely-captured.rs:18:9 | LL | m[1] += 40; @@ -43,7 +43,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture m[] -> MutBorrow +note: Min Capture m[] -> Mutable --> $DIR/arrays-completely-captured.rs:15:9 | LL | m[0] += 10; diff --git a/tests/ui/closures/2229_closure_analysis/by_value.rs b/tests/ui/closures/2229_closure_analysis/by_value.rs index 3fa28a1c6e9..2c9202fd617 100644 --- a/tests/ui/closures/2229_closure_analysis/by_value.rs +++ b/tests/ui/closures/2229_closure_analysis/by_value.rs @@ -26,8 +26,8 @@ fn big_box() { //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ByValue //~| NOTE: Min Capture t[(0, 0)] -> ByValue println!("{} {:?}", t.1, p); - //~^ NOTE: Capturing t[(1, 0)] -> ImmBorrow - //~| NOTE: Min Capture t[(1, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(1, 0)] -> Immutable + //~| NOTE: Min Capture t[(1, 0)] -> Immutable }; c(); diff --git a/tests/ui/closures/2229_closure_analysis/by_value.stderr b/tests/ui/closures/2229_closure_analysis/by_value.stderr index 0dd9991cf84..f843b76d723 100644 --- a/tests/ui/closures/2229_closure_analysis/by_value.stderr +++ b/tests/ui/closures/2229_closure_analysis/by_value.stderr @@ -25,7 +25,7 @@ note: Capturing t[(0, 0),Deref,(0, 0)] -> ByValue | LL | let p = t.0.0; | ^^^^^ -note: Capturing t[(1, 0)] -> ImmBorrow +note: Capturing t[(1, 0)] -> Immutable --> $DIR/by_value.rs:28:29 | LL | println!("{} {:?}", t.1, p); @@ -48,7 +48,7 @@ note: Min Capture t[(0, 0)] -> ByValue | LL | let p = t.0.0; | ^^^^^ -note: Min Capture t[(1, 0)] -> ImmBorrow +note: Min Capture t[(1, 0)] -> Immutable --> $DIR/by_value.rs:28:29 | LL | println!("{} {:?}", t.1, p); diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-1.rs b/tests/ui/closures/2229_closure_analysis/capture-analysis-1.rs index fa1ddeb0176..0c42e66a2fa 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-1.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-1.rs @@ -20,15 +20,15 @@ fn main() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: println!("{:?}", p); - //~^ NOTE: Capturing p[] -> ImmBorrow - //~| NOTE: Min Capture p[] -> ImmBorrow + //~^ NOTE: Capturing p[] -> Immutable + //~| NOTE: Min Capture p[] -> Immutable println!("{:?}", p.x); - //~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing p[(0, 0)] -> Immutable println!("{:?}", q.x); - //~^ NOTE: Capturing q[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing q[(0, 0)] -> Immutable println!("{:?}", q); - //~^ NOTE: Capturing q[] -> ImmBorrow - //~| NOTE: Min Capture q[] -> ImmBorrow + //~^ NOTE: Capturing q[] -> Immutable + //~| NOTE: Min Capture q[] -> Immutable }; } diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-1.stderr b/tests/ui/closures/2229_closure_analysis/capture-analysis-1.stderr index d2409c9367c..64ae704bc90 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-1.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-1.stderr @@ -20,22 +20,22 @@ LL | | LL | | }; | |_____^ | -note: Capturing p[] -> ImmBorrow +note: Capturing p[] -> Immutable --> $DIR/capture-analysis-1.rs:22:26 | LL | println!("{:?}", p); | ^ -note: Capturing p[(0, 0)] -> ImmBorrow +note: Capturing p[(0, 0)] -> Immutable --> $DIR/capture-analysis-1.rs:25:26 | LL | println!("{:?}", p.x); | ^^^ -note: Capturing q[(0, 0)] -> ImmBorrow +note: Capturing q[(0, 0)] -> Immutable --> $DIR/capture-analysis-1.rs:28:26 | LL | println!("{:?}", q.x); | ^^^ -note: Capturing q[] -> ImmBorrow +note: Capturing q[] -> Immutable --> $DIR/capture-analysis-1.rs:30:26 | LL | println!("{:?}", q); @@ -53,12 +53,12 @@ LL | | LL | | }; | |_____^ | -note: Min Capture p[] -> ImmBorrow +note: Min Capture p[] -> Immutable --> $DIR/capture-analysis-1.rs:22:26 | LL | println!("{:?}", p); | ^ -note: Min Capture q[] -> ImmBorrow +note: Min Capture q[] -> Immutable --> $DIR/capture-analysis-1.rs:30:26 | LL | println!("{:?}", q); diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-2.rs b/tests/ui/closures/2229_closure_analysis/capture-analysis-2.rs index eb342b303f9..adb618d1771 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-2.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-2.rs @@ -22,7 +22,7 @@ fn main() { //~^ NOTE: Capturing p[(0, 0)] -> ByValue //~| NOTE: p[] captured as ByValue here println!("{:?}", p); - //~^ NOTE: Capturing p[] -> ImmBorrow + //~^ NOTE: Capturing p[] -> Immutable //~| NOTE: Min Capture p[] -> ByValue //~| NOTE: p[] used here }; diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-2.stderr b/tests/ui/closures/2229_closure_analysis/capture-analysis-2.stderr index 7049c708bb8..40c075f3cc8 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-2.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-2.stderr @@ -25,7 +25,7 @@ note: Capturing p[(0, 0)] -> ByValue | LL | let _x = p.x; | ^^^ -note: Capturing p[] -> ImmBorrow +note: Capturing p[] -> Immutable --> $DIR/capture-analysis-2.rs:24:26 | LL | println!("{:?}", p); diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-3.rs b/tests/ui/closures/2229_closure_analysis/capture-analysis-3.rs index e1476e415d9..0a21eaaaa12 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-3.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-3.rs @@ -27,7 +27,7 @@ fn main() { //~^ NOTE: Capturing a[(0, 0),(0, 0)] -> ByValue //~| NOTE: a[(0, 0)] captured as ByValue here println!("{:?}", a.b); - //~^ NOTE: Capturing a[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing a[(0, 0)] -> Immutable //~| NOTE: Min Capture a[(0, 0)] -> ByValue //~| NOTE: a[(0, 0)] used here }; diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-3.stderr b/tests/ui/closures/2229_closure_analysis/capture-analysis-3.stderr index 698b51a4fdb..a4689f2ea96 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-3.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-3.stderr @@ -25,7 +25,7 @@ note: Capturing a[(0, 0),(0, 0)] -> ByValue | LL | let _x = a.b.c; | ^^^^^ -note: Capturing a[(0, 0)] -> ImmBorrow +note: Capturing a[(0, 0)] -> Immutable --> $DIR/capture-analysis-3.rs:29:26 | LL | println!("{:?}", a.b); diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-4.rs b/tests/ui/closures/2229_closure_analysis/capture-analysis-4.rs index 6d53a0ac634..790dad0710b 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-4.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-4.rs @@ -27,6 +27,6 @@ fn main() { //~^ NOTE: Capturing a[(0, 0)] -> ByValue //~| NOTE: Min Capture a[(0, 0)] -> ByValue println!("{:?}", a.b.c); - //~^ NOTE: Capturing a[(0, 0),(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing a[(0, 0),(0, 0)] -> Immutable }; } diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-4.stderr b/tests/ui/closures/2229_closure_analysis/capture-analysis-4.stderr index 9cd0dcf720e..9d3004dbbb0 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-4.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-4.stderr @@ -25,7 +25,7 @@ note: Capturing a[(0, 0)] -> ByValue | LL | let _x = a.b; | ^^^ -note: Capturing a[(0, 0),(0, 0)] -> ImmBorrow +note: Capturing a[(0, 0),(0, 0)] -> Immutable --> $DIR/capture-analysis-4.rs:29:26 | LL | println!("{:?}", a.b.c); diff --git a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs index 68703333fa8..af12e0b259d 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs @@ -18,8 +18,8 @@ fn main() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: println!("{}", p.x); - //~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture p[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing p[(0, 0)] -> Immutable + //~| NOTE: Min Capture p[(0, 0)] -> Immutable }; // `c` should only capture `p.x`, therefore mutating `p.y` is allowed. diff --git a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr index 92a719d6098..48fbd682a5b 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.stderr @@ -20,7 +20,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing p[(0, 0)] -> ImmBorrow +note: Capturing p[(0, 0)] -> Immutable --> $DIR/capture-disjoint-field-struct.rs:20:24 | LL | println!("{}", p.x); @@ -38,7 +38,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture p[(0, 0)] -> ImmBorrow +note: Min Capture p[(0, 0)] -> Immutable --> $DIR/capture-disjoint-field-struct.rs:20:24 | LL | println!("{}", p.x); diff --git a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs index 0c006ffdd72..ccd26049264 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs @@ -13,8 +13,8 @@ fn main() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: println!("{}", t.0); - //~^ NOTE: Capturing t[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture t[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(0, 0)] -> Immutable + //~| NOTE: Min Capture t[(0, 0)] -> Immutable }; // `c` only captures t.0, therefore mutating t.1 is allowed. diff --git a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr index d5333bf71db..496511d6025 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.stderr @@ -20,7 +20,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(0, 0)] -> ImmBorrow +note: Capturing t[(0, 0)] -> Immutable --> $DIR/capture-disjoint-field-tuple.rs:15:24 | LL | println!("{}", t.0); @@ -38,7 +38,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture t[(0, 0)] -> ImmBorrow +note: Min Capture t[(0, 0)] -> Immutable --> $DIR/capture-disjoint-field-tuple.rs:15:24 | LL | println!("{}", t.0); diff --git a/tests/ui/closures/2229_closure_analysis/capture-enums.rs b/tests/ui/closures/2229_closure_analysis/capture-enums.rs index 6f973739e66..b1e21bd0f8d 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-enums.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-enums.rs @@ -21,14 +21,14 @@ fn multi_variant_enum() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: if let Info::Point(_, _, str) = point { - //~^ NOTE: Capturing point[] -> ImmBorrow + //~^ NOTE: Capturing point[] -> Immutable //~| NOTE: Capturing point[(2, 0)] -> ByValue //~| NOTE: Min Capture point[] -> ByValue println!("{}", str); } if let Info::Meta(_, v) = meta { - //~^ NOTE: Capturing meta[] -> ImmBorrow + //~^ NOTE: Capturing meta[] -> Immutable //~| NOTE: Capturing meta[(1, 1)] -> ByValue //~| NOTE: Min Capture meta[] -> ByValue println!("{:?}", v); diff --git a/tests/ui/closures/2229_closure_analysis/capture-enums.stderr b/tests/ui/closures/2229_closure_analysis/capture-enums.stderr index 8b258569d95..2d70b614858 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-enums.stderr +++ b/tests/ui/closures/2229_closure_analysis/capture-enums.stderr @@ -30,7 +30,7 @@ LL | | } LL | | }; | |_____^ | -note: Capturing point[] -> ImmBorrow +note: Capturing point[] -> Immutable --> $DIR/capture-enums.rs:23:41 | LL | if let Info::Point(_, _, str) = point { @@ -40,7 +40,7 @@ note: Capturing point[(2, 0)] -> ByValue | LL | if let Info::Point(_, _, str) = point { | ^^^^^ -note: Capturing meta[] -> ImmBorrow +note: Capturing meta[] -> Immutable --> $DIR/capture-enums.rs:30:35 | LL | if let Info::Meta(_, v) = meta { diff --git a/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.rs b/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.rs index 5143836ad6b..61b707605c2 100644 --- a/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.rs +++ b/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.rs @@ -39,13 +39,13 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let x = &p.a.p.x; - //~^ NOTE: Capturing p[(0, 0),(0, 0),(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing p[(0, 0),(0, 0),(0, 0)] -> Immutable p.b.q.y = 9; - //~^ NOTE: Capturing p[(1, 0),(1, 0),(1, 0)] -> MutBorrow - //~| NOTE: p[] captured as MutBorrow here + //~^ NOTE: Capturing p[(1, 0),(1, 0),(1, 0)] -> Mutable + //~| NOTE: p[] captured as Mutable here println!("{:?}", p); - //~^ NOTE: Capturing p[] -> ImmBorrow - //~| NOTE: Min Capture p[] -> MutBorrow + //~^ NOTE: Capturing p[] -> Immutable + //~| NOTE: Min Capture p[] -> Mutable //~| NOTE: p[] used here }; } diff --git a/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.stderr b/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.stderr index 55ba416dfd9..d118f7573a4 100644 --- a/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.stderr +++ b/tests/ui/closures/2229_closure_analysis/deep-multilevel-struct.stderr @@ -20,17 +20,17 @@ LL | | LL | | }; | |_____^ | -note: Capturing p[(0, 0),(0, 0),(0, 0)] -> ImmBorrow +note: Capturing p[(0, 0),(0, 0),(0, 0)] -> Immutable --> $DIR/deep-multilevel-struct.rs:41:18 | LL | let x = &p.a.p.x; | ^^^^^^^ -note: Capturing p[(1, 0),(1, 0),(1, 0)] -> MutBorrow +note: Capturing p[(1, 0),(1, 0),(1, 0)] -> Mutable --> $DIR/deep-multilevel-struct.rs:43:9 | LL | p.b.q.y = 9; | ^^^^^^^ -note: Capturing p[] -> ImmBorrow +note: Capturing p[] -> Immutable --> $DIR/deep-multilevel-struct.rs:46:26 | LL | println!("{:?}", p); @@ -48,11 +48,11 @@ LL | | LL | | }; | |_____^ | -note: Min Capture p[] -> MutBorrow +note: Min Capture p[] -> Mutable --> $DIR/deep-multilevel-struct.rs:43:9 | LL | p.b.q.y = 9; - | ^^^^^^^ p[] captured as MutBorrow here + | ^^^^^^^ p[] captured as Mutable here ... LL | println!("{:?}", p); | ^ p[] used here diff --git a/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.rs b/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.rs index 0cb0aeb824e..6c7eab1eeb7 100644 --- a/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.rs +++ b/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.rs @@ -13,13 +13,13 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let x = &t.0.0.0; - //~^ NOTE: Capturing t[(0, 0),(0, 0),(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(0, 0),(0, 0),(0, 0)] -> Immutable t.1.1.1 = 9; - //~^ NOTE: Capturing t[(1, 0),(1, 0),(1, 0)] -> MutBorrow - //~| NOTE: t[] captured as MutBorrow here + //~^ NOTE: Capturing t[(1, 0),(1, 0),(1, 0)] -> Mutable + //~| NOTE: t[] captured as Mutable here println!("{:?}", t); - //~^ NOTE: Min Capture t[] -> MutBorrow - //~| NOTE: Capturing t[] -> ImmBorrow + //~^ NOTE: Min Capture t[] -> Mutable + //~| NOTE: Capturing t[] -> Immutable //~| NOTE: t[] used here }; } diff --git a/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.stderr b/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.stderr index 5e45fe1ca8b..cc5f74613e4 100644 --- a/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.stderr +++ b/tests/ui/closures/2229_closure_analysis/deep-multilevel-tuple.stderr @@ -20,17 +20,17 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(0, 0),(0, 0),(0, 0)] -> ImmBorrow +note: Capturing t[(0, 0),(0, 0),(0, 0)] -> Immutable --> $DIR/deep-multilevel-tuple.rs:15:18 | LL | let x = &t.0.0.0; | ^^^^^^^ -note: Capturing t[(1, 0),(1, 0),(1, 0)] -> MutBorrow +note: Capturing t[(1, 0),(1, 0),(1, 0)] -> Mutable --> $DIR/deep-multilevel-tuple.rs:17:9 | LL | t.1.1.1 = 9; | ^^^^^^^ -note: Capturing t[] -> ImmBorrow +note: Capturing t[] -> Immutable --> $DIR/deep-multilevel-tuple.rs:20:26 | LL | println!("{:?}", t); @@ -48,11 +48,11 @@ LL | | LL | | }; | |_____^ | -note: Min Capture t[] -> MutBorrow +note: Min Capture t[] -> Mutable --> $DIR/deep-multilevel-tuple.rs:17:9 | LL | t.1.1.1 = 9; - | ^^^^^^^ t[] captured as MutBorrow here + | ^^^^^^^ t[] captured as Mutable here ... LL | println!("{:?}", t); | ^ t[] used here diff --git a/tests/ui/closures/2229_closure_analysis/destructure_patterns.rs b/tests/ui/closures/2229_closure_analysis/destructure_patterns.rs index 3106c478d00..68e8d66762d 100644 --- a/tests/ui/closures/2229_closure_analysis/destructure_patterns.rs +++ b/tests/ui/closures/2229_closure_analysis/destructure_patterns.rs @@ -44,9 +44,9 @@ fn structs() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let Point { x: ref mut x, y: _, id: moved_id } = p; - //~^ NOTE: Capturing p[(0, 0)] -> MutBorrow + //~^ NOTE: Capturing p[(0, 0)] -> Mutable //~| NOTE: Capturing p[(2, 0)] -> ByValue - //~| NOTE: Min Capture p[(0, 0)] -> MutBorrow + //~| NOTE: Min Capture p[(0, 0)] -> Mutable //~| NOTE: Min Capture p[(2, 0)] -> ByValue println!("{}, {}", x, moved_id); @@ -65,11 +65,11 @@ fn tuples() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let (ref mut x, ref ref_str, (moved_s, _)) = t; - //~^ NOTE: Capturing t[(0, 0)] -> MutBorrow - //~| NOTE: Capturing t[(1, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(0, 0)] -> Mutable + //~| NOTE: Capturing t[(1, 0)] -> Immutable //~| NOTE: Capturing t[(2, 0),(0, 0)] -> ByValue - //~| NOTE: Min Capture t[(0, 0)] -> MutBorrow - //~| NOTE: Min Capture t[(1, 0)] -> ImmBorrow + //~| NOTE: Min Capture t[(0, 0)] -> Mutable + //~| NOTE: Min Capture t[(1, 0)] -> Immutable //~| NOTE: Min Capture t[(2, 0),(0, 0)] -> ByValue println!("{}, {} {}", x, ref_str, moved_s); diff --git a/tests/ui/closures/2229_closure_analysis/destructure_patterns.stderr b/tests/ui/closures/2229_closure_analysis/destructure_patterns.stderr index 7fc85de499f..6f8295ac095 100644 --- a/tests/ui/closures/2229_closure_analysis/destructure_patterns.stderr +++ b/tests/ui/closures/2229_closure_analysis/destructure_patterns.stderr @@ -86,7 +86,7 @@ LL | | println!("{}, {}", x, moved_id); LL | | }; | |_____^ | -note: Capturing p[(0, 0)] -> MutBorrow +note: Capturing p[(0, 0)] -> Mutable --> $DIR/destructure_patterns.rs:46:58 | LL | let Point { x: ref mut x, y: _, id: moved_id } = p; @@ -109,7 +109,7 @@ LL | | println!("{}, {}", x, moved_id); LL | | }; | |_____^ | -note: Min Capture p[(0, 0)] -> MutBorrow +note: Min Capture p[(0, 0)] -> Mutable --> $DIR/destructure_patterns.rs:46:58 | LL | let Point { x: ref mut x, y: _, id: moved_id } = p; @@ -132,12 +132,12 @@ LL | | println!("{}, {} {}", x, ref_str, moved_s); LL | | }; | |_____^ | -note: Capturing t[(0, 0)] -> MutBorrow +note: Capturing t[(0, 0)] -> Mutable --> $DIR/destructure_patterns.rs:67:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; | ^ -note: Capturing t[(1, 0)] -> ImmBorrow +note: Capturing t[(1, 0)] -> Immutable --> $DIR/destructure_patterns.rs:67:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; @@ -160,12 +160,12 @@ LL | | println!("{}, {} {}", x, ref_str, moved_s); LL | | }; | |_____^ | -note: Min Capture t[(0, 0)] -> MutBorrow +note: Min Capture t[(0, 0)] -> Mutable --> $DIR/destructure_patterns.rs:67:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; | ^ -note: Min Capture t[(1, 0)] -> ImmBorrow +note: Min Capture t[(1, 0)] -> Immutable --> $DIR/destructure_patterns.rs:67:54 | LL | let (ref mut x, ref ref_str, (moved_s, _)) = t; diff --git a/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs b/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs index 059c248a3e8..7467c13b337 100644 --- a/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs +++ b/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.rs @@ -13,7 +13,7 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("This uses new capture analyysis to capture s={}", s); - //~^ NOTE: Capturing s[] -> ImmBorrow - //~| NOTE: Min Capture s[] -> ImmBorrow + //~^ NOTE: Capturing s[] -> Immutable + //~| NOTE: Min Capture s[] -> Immutable }; } diff --git a/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr b/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr index 4e76070dcf7..6dbe8c153c0 100644 --- a/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr +++ b/tests/ui/closures/2229_closure_analysis/feature-gate-capture_disjoint_fields.stderr @@ -20,7 +20,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing s[] -> ImmBorrow +note: Capturing s[] -> Immutable --> $DIR/feature-gate-capture_disjoint_fields.rs:15:69 | LL | println!("This uses new capture analyysis to capture s={}", s); @@ -38,7 +38,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture s[] -> ImmBorrow +note: Min Capture s[] -> Immutable --> $DIR/feature-gate-capture_disjoint_fields.rs:15:69 | LL | println!("This uses new capture analyysis to capture s={}", s); diff --git a/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.rs b/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.rs index 11ef92367ca..feef8cabb39 100644 --- a/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.rs +++ b/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.rs @@ -24,8 +24,8 @@ impl Data { |v| self.filter.allowed(*v), //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: - //~| NOTE: Capturing self[Deref,(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture self[Deref,(0, 0)] -> ImmBorrow + //~| NOTE: Capturing self[Deref,(0, 0)] -> Immutable + //~| NOTE: Min Capture self[Deref,(0, 0)] -> Immutable ); } } diff --git a/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr b/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr index 10e0d076b42..ffe7dd4d108 100644 --- a/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr +++ b/tests/ui/closures/2229_closure_analysis/filter-on-struct-member.stderr @@ -4,7 +4,7 @@ error: First Pass analysis includes: LL | |v| self.filter.allowed(*v), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: Capturing self[Deref,(0, 0)] -> ImmBorrow +note: Capturing self[Deref,(0, 0)] -> Immutable --> $DIR/filter-on-struct-member.rs:24:17 | LL | |v| self.filter.allowed(*v), @@ -16,7 +16,7 @@ error: Min Capture analysis includes: LL | |v| self.filter.allowed(*v), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: Min Capture self[Deref,(0, 0)] -> ImmBorrow +note: Min Capture self[Deref,(0, 0)] -> Immutable --> $DIR/filter-on-struct-member.rs:24:17 | LL | |v| self.filter.allowed(*v), diff --git a/tests/ui/closures/2229_closure_analysis/issue-87378.rs b/tests/ui/closures/2229_closure_analysis/issue-87378.rs index 0a771466e1e..9c89a4538be 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-87378.rs +++ b/tests/ui/closures/2229_closure_analysis/issue-87378.rs @@ -19,8 +19,8 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: unsafe { u.value } - //~^ NOTE: Capturing u[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture u[] -> ImmBorrow + //~^ NOTE: Capturing u[(0, 0)] -> Immutable + //~| NOTE: Min Capture u[] -> Immutable }; c(); diff --git a/tests/ui/closures/2229_closure_analysis/issue-87378.stderr b/tests/ui/closures/2229_closure_analysis/issue-87378.stderr index 19c0c59170b..3273e92d9d1 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-87378.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-87378.stderr @@ -20,7 +20,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing u[(0, 0)] -> ImmBorrow +note: Capturing u[(0, 0)] -> Immutable --> $DIR/issue-87378.rs:21:17 | LL | unsafe { u.value } @@ -38,7 +38,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture u[] -> ImmBorrow +note: Min Capture u[] -> Immutable --> $DIR/issue-87378.rs:21:17 | LL | unsafe { u.value } diff --git a/tests/ui/closures/2229_closure_analysis/issue-88476.rs b/tests/ui/closures/2229_closure_analysis/issue-88476.rs index 7f833839d56..45fe73b76e2 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-88476.rs +++ b/tests/ui/closures/2229_closure_analysis/issue-88476.rs @@ -24,7 +24,7 @@ pub fn test1() { //~| ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{:?}", f.0); - //~^ NOTE: Capturing f[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing f[(0, 0)] -> Immutable //~| NOTE: Min Capture f[] -> ByValue }; @@ -52,7 +52,7 @@ fn test2() { //~| ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", character.hp) - //~^ NOTE: Capturing character[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing character[(0, 0)] -> Immutable //~| NOTE: Min Capture character[(0, 0)] -> ByValue }; diff --git a/tests/ui/closures/2229_closure_analysis/issue-88476.stderr b/tests/ui/closures/2229_closure_analysis/issue-88476.stderr index d0201757157..1c0e254dbf7 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-88476.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-88476.stderr @@ -31,7 +31,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing f[(0, 0)] -> ImmBorrow +note: Capturing f[(0, 0)] -> Immutable --> $DIR/issue-88476.rs:26:26 | LL | println!("{:?}", f.0); @@ -69,7 +69,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing character[(0, 0)] -> ImmBorrow +note: Capturing character[(0, 0)] -> Immutable --> $DIR/issue-88476.rs:54:24 | LL | println!("{}", character.hp) diff --git a/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.rs b/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.rs index 8dd20fc2a74..9c7b70457d9 100644 --- a/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.rs +++ b/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.rs @@ -13,8 +13,8 @@ fn test_1_should_capture() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: match variant { - //~^ NOTE: Capturing variant[] -> ImmBorrow - //~| NOTE: Min Capture variant[] -> ImmBorrow + //~^ NOTE: Capturing variant[] -> Immutable + //~| NOTE: Min Capture variant[] -> Immutable Some(_) => {} _ => {} } @@ -64,9 +64,9 @@ fn test_6_should_capture_single_variant() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: match variant { - //~^ NOTE: Capturing variant[] -> ImmBorrow - //~| NOTE: Capturing variant[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture variant[] -> ImmBorrow + //~^ NOTE: Capturing variant[] -> Immutable + //~| NOTE: Capturing variant[(0, 0)] -> Immutable + //~| NOTE: Min Capture variant[] -> Immutable SingleVariant::Points(a) => { println!("{:?}", a); } @@ -131,8 +131,8 @@ fn test_5_should_capture_multi_variant() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: match variant { - //~^ NOTE: Capturing variant[] -> ImmBorrow - //~| NOTE: Min Capture variant[] -> ImmBorrow + //~^ NOTE: Capturing variant[] -> Immutable + //~| NOTE: Min Capture variant[] -> Immutable MVariant::A => {} _ => {} } @@ -149,8 +149,8 @@ fn test_7_should_capture_slice_len() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: match slice { - //~^ NOTE: Capturing slice[] -> ImmBorrow - //~| NOTE: Min Capture slice[] -> ImmBorrow + //~^ NOTE: Capturing slice[] -> Immutable + //~| NOTE: Min Capture slice[] -> Immutable [_,_,_] => {}, _ => {} } @@ -161,8 +161,8 @@ fn test_7_should_capture_slice_len() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: match slice { - //~^ NOTE: Capturing slice[] -> ImmBorrow - //~| NOTE: Min Capture slice[] -> ImmBorrow + //~^ NOTE: Capturing slice[] -> Immutable + //~| NOTE: Min Capture slice[] -> Immutable [] => {}, _ => {} } @@ -173,8 +173,8 @@ fn test_7_should_capture_slice_len() { //~^ First Pass analysis includes: //~| Min Capture analysis includes: match slice { - //~^ NOTE: Capturing slice[] -> ImmBorrow - //~| NOTE: Min Capture slice[] -> ImmBorrow + //~^ NOTE: Capturing slice[] -> Immutable + //~| NOTE: Min Capture slice[] -> Immutable [_, .. ,_] => {}, _ => {} } diff --git a/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.stderr b/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.stderr index c3c3f8b8477..7125bfa3101 100644 --- a/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.stderr @@ -10,7 +10,7 @@ LL | | } LL | | }; | |_____^ | -note: Capturing variant[] -> ImmBorrow +note: Capturing variant[] -> Immutable --> $DIR/patterns-capture-analysis.rs:15:15 | LL | match variant { @@ -28,7 +28,7 @@ LL | | } LL | | }; | |_____^ | -note: Min Capture variant[] -> ImmBorrow +note: Min Capture variant[] -> Immutable --> $DIR/patterns-capture-analysis.rs:15:15 | LL | match variant { @@ -68,12 +68,12 @@ LL | | } LL | | }; | |_____^ | -note: Capturing variant[] -> ImmBorrow +note: Capturing variant[] -> Immutable --> $DIR/patterns-capture-analysis.rs:66:15 | LL | match variant { | ^^^^^^^ -note: Capturing variant[(0, 0)] -> ImmBorrow +note: Capturing variant[(0, 0)] -> Immutable --> $DIR/patterns-capture-analysis.rs:66:15 | LL | match variant { @@ -91,7 +91,7 @@ LL | | } LL | | }; | |_____^ | -note: Min Capture variant[] -> ImmBorrow +note: Min Capture variant[] -> Immutable --> $DIR/patterns-capture-analysis.rs:66:15 | LL | match variant { @@ -142,7 +142,7 @@ LL | | } LL | | }; | |_____^ | -note: Capturing variant[] -> ImmBorrow +note: Capturing variant[] -> Immutable --> $DIR/patterns-capture-analysis.rs:133:15 | LL | match variant { @@ -160,7 +160,7 @@ LL | | } LL | | }; | |_____^ | -note: Min Capture variant[] -> ImmBorrow +note: Min Capture variant[] -> Immutable --> $DIR/patterns-capture-analysis.rs:133:15 | LL | match variant { @@ -178,7 +178,7 @@ LL | | } LL | | }; | |_____^ | -note: Capturing slice[] -> ImmBorrow +note: Capturing slice[] -> Immutable --> $DIR/patterns-capture-analysis.rs:151:15 | LL | match slice { @@ -196,7 +196,7 @@ LL | | } LL | | }; | |_____^ | -note: Min Capture slice[] -> ImmBorrow +note: Min Capture slice[] -> Immutable --> $DIR/patterns-capture-analysis.rs:151:15 | LL | match slice { @@ -214,7 +214,7 @@ LL | | } LL | | }; | |_____^ | -note: Capturing slice[] -> ImmBorrow +note: Capturing slice[] -> Immutable --> $DIR/patterns-capture-analysis.rs:163:15 | LL | match slice { @@ -232,7 +232,7 @@ LL | | } LL | | }; | |_____^ | -note: Min Capture slice[] -> ImmBorrow +note: Min Capture slice[] -> Immutable --> $DIR/patterns-capture-analysis.rs:163:15 | LL | match slice { @@ -250,7 +250,7 @@ LL | | } LL | | }; | |_____^ | -note: Capturing slice[] -> ImmBorrow +note: Capturing slice[] -> Immutable --> $DIR/patterns-capture-analysis.rs:175:15 | LL | match slice { @@ -268,7 +268,7 @@ LL | | } LL | | }; | |_____^ | -note: Min Capture slice[] -> ImmBorrow +note: Min Capture slice[] -> Immutable --> $DIR/patterns-capture-analysis.rs:175:15 | LL | match slice { diff --git a/tests/ui/closures/2229_closure_analysis/move_closure.rs b/tests/ui/closures/2229_closure_analysis/move_closure.rs index 3b7f036dfe7..b6690d06011 100644 --- a/tests/ui/closures/2229_closure_analysis/move_closure.rs +++ b/tests/ui/closures/2229_closure_analysis/move_closure.rs @@ -17,7 +17,7 @@ fn simple_move_closure() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: t.0.0 = "new S".into(); - //~^ NOTE: Capturing t[(0, 0),(0, 0)] -> MutBorrow + //~^ NOTE: Capturing t[(0, 0),(0, 0)] -> Mutable //~| NOTE: Min Capture t[(0, 0),(0, 0)] -> ByValue }; c(); @@ -36,7 +36,7 @@ fn simple_ref() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: *ref_s += 10; - //~^ NOTE: Capturing ref_s[Deref] -> MutBorrow + //~^ NOTE: Capturing ref_s[Deref] -> Mutable //~| NOTE: Min Capture ref_s[] -> ByValue }; c(); @@ -58,7 +58,7 @@ fn struct_contains_ref_to_another_struct_1() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: t.0.0 = "new s".into(); - //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> MutBorrow + //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> Mutable //~| NOTE: Min Capture t[(0, 0)] -> ByValue }; @@ -82,7 +82,7 @@ fn struct_contains_ref_to_another_struct_2() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let _t = t.0.0; - //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> Immutable //~| NOTE: Min Capture t[(0, 0)] -> ByValue }; @@ -127,7 +127,7 @@ fn truncate_box_derefs() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let _t = b.0; - //~^ NOTE: Capturing b[Deref,(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing b[Deref,(0, 0)] -> Immutable //~| NOTE: Min Capture b[] -> ByValue }; @@ -144,7 +144,7 @@ fn truncate_box_derefs() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", b.0); - //~^ NOTE: Capturing b[Deref,(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing b[Deref,(0, 0)] -> Immutable //~| NOTE: Min Capture b[] -> ByValue }; @@ -162,7 +162,7 @@ fn truncate_box_derefs() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", t.1.0); - //~^ NOTE: Capturing t[(1, 0),Deref,(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(1, 0),Deref,(0, 0)] -> Immutable //~| NOTE: Min Capture t[(1, 0)] -> ByValue }; } @@ -182,7 +182,7 @@ fn box_mut_1() { //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date //~| First Pass analysis includes: - //~| NOTE: Capturing box_p_foo[Deref,Deref,(0, 0)] -> MutBorrow + //~| NOTE: Capturing box_p_foo[Deref,Deref,(0, 0)] -> Mutable //~| Min Capture analysis includes: //~| NOTE: Min Capture box_p_foo[] -> ByValue } @@ -200,7 +200,7 @@ fn box_mut_2() { //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date //~| First Pass analysis includes: - //~| NOTE: Capturing p_foo[Deref,Deref,(0, 0)] -> MutBorrow + //~| NOTE: Capturing p_foo[Deref,Deref,(0, 0)] -> Mutable //~| Min Capture analysis includes: //~| NOTE: Min Capture p_foo[] -> ByValue } @@ -214,7 +214,7 @@ fn returned_closure_owns_copy_type_data() -> impl Fn() -> i32 { //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date //~| First Pass analysis includes: - //~| NOTE: Capturing x[] -> ImmBorrow + //~| NOTE: Capturing x[] -> Immutable //~| Min Capture analysis includes: //~| NOTE: Min Capture x[] -> ByValue diff --git a/tests/ui/closures/2229_closure_analysis/move_closure.stderr b/tests/ui/closures/2229_closure_analysis/move_closure.stderr index 7e9e3c5fed3..68754b8f7be 100644 --- a/tests/ui/closures/2229_closure_analysis/move_closure.stderr +++ b/tests/ui/closures/2229_closure_analysis/move_closure.stderr @@ -114,7 +114,7 @@ error: First Pass analysis includes: LL | let c = #[rustc_capture_analysis] move || x; | ^^^^^^^^^ | -note: Capturing x[] -> ImmBorrow +note: Capturing x[] -> Immutable --> $DIR/move_closure.rs:212:47 | LL | let c = #[rustc_capture_analysis] move || x; @@ -144,7 +144,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(0, 0),(0, 0)] -> MutBorrow +note: Capturing t[(0, 0),(0, 0)] -> Mutable --> $DIR/move_closure.rs:19:9 | LL | t.0.0 = "new S".into(); @@ -180,7 +180,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing ref_s[Deref] -> MutBorrow +note: Capturing ref_s[Deref] -> Mutable --> $DIR/move_closure.rs:38:9 | LL | *ref_s += 10; @@ -216,7 +216,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(0, 0),Deref,(0, 0)] -> MutBorrow +note: Capturing t[(0, 0),Deref,(0, 0)] -> Mutable --> $DIR/move_closure.rs:60:9 | LL | t.0.0 = "new s".into(); @@ -252,7 +252,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow +note: Capturing t[(0, 0),Deref,(0, 0)] -> Immutable --> $DIR/move_closure.rs:84:18 | LL | let _t = t.0.0; @@ -324,7 +324,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing b[Deref,(0, 0)] -> ImmBorrow +note: Capturing b[Deref,(0, 0)] -> Immutable --> $DIR/move_closure.rs:129:18 | LL | let _t = b.0; @@ -360,7 +360,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing b[Deref,(0, 0)] -> ImmBorrow +note: Capturing b[Deref,(0, 0)] -> Immutable --> $DIR/move_closure.rs:146:24 | LL | println!("{}", b.0); @@ -396,7 +396,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(1, 0),Deref,(0, 0)] -> ImmBorrow +note: Capturing t[(1, 0),Deref,(0, 0)] -> Immutable --> $DIR/move_closure.rs:164:24 | LL | println!("{}", t.1.0); @@ -426,7 +426,7 @@ error: First Pass analysis includes: LL | let c = #[rustc_capture_analysis] move || box_p_foo.x += 10; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: Capturing box_p_foo[Deref,Deref,(0, 0)] -> MutBorrow +note: Capturing box_p_foo[Deref,Deref,(0, 0)] -> Mutable --> $DIR/move_closure.rs:180:47 | LL | let c = #[rustc_capture_analysis] move || box_p_foo.x += 10; @@ -450,7 +450,7 @@ error: First Pass analysis includes: LL | let c = #[rustc_capture_analysis] move || p_foo.x += 10; | ^^^^^^^^^^^^^^^^^^^^^ | -note: Capturing p_foo[Deref,Deref,(0, 0)] -> MutBorrow +note: Capturing p_foo[Deref,Deref,(0, 0)] -> Mutable --> $DIR/move_closure.rs:198:47 | LL | let c = #[rustc_capture_analysis] move || p_foo.x += 10; diff --git a/tests/ui/closures/2229_closure_analysis/multilevel-path-1.rs b/tests/ui/closures/2229_closure_analysis/multilevel-path-1.rs index 2d7c26074cb..501aebe725a 100644 --- a/tests/ui/closures/2229_closure_analysis/multilevel-path-1.rs +++ b/tests/ui/closures/2229_closure_analysis/multilevel-path-1.rs @@ -27,8 +27,8 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let wp = &w.p; - //~^ NOTE: Capturing w[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture w[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing w[(0, 0)] -> Immutable + //~| NOTE: Min Capture w[(0, 0)] -> Immutable println!("{}", wp.x); }; diff --git a/tests/ui/closures/2229_closure_analysis/multilevel-path-1.stderr b/tests/ui/closures/2229_closure_analysis/multilevel-path-1.stderr index 118a7dacec6..000d929f07f 100644 --- a/tests/ui/closures/2229_closure_analysis/multilevel-path-1.stderr +++ b/tests/ui/closures/2229_closure_analysis/multilevel-path-1.stderr @@ -20,7 +20,7 @@ LL | | println!("{}", wp.x); LL | | }; | |_____^ | -note: Capturing w[(0, 0)] -> ImmBorrow +note: Capturing w[(0, 0)] -> Immutable --> $DIR/multilevel-path-1.rs:29:19 | LL | let wp = &w.p; @@ -38,7 +38,7 @@ LL | | println!("{}", wp.x); LL | | }; | |_____^ | -note: Min Capture w[(0, 0)] -> ImmBorrow +note: Min Capture w[(0, 0)] -> Immutable --> $DIR/multilevel-path-1.rs:29:19 | LL | let wp = &w.p; diff --git a/tests/ui/closures/2229_closure_analysis/multilevel-path-2.rs b/tests/ui/closures/2229_closure_analysis/multilevel-path-2.rs index bcf0ed35137..f73627d14da 100644 --- a/tests/ui/closures/2229_closure_analysis/multilevel-path-2.rs +++ b/tests/ui/closures/2229_closure_analysis/multilevel-path-2.rs @@ -22,8 +22,8 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", w.p.x); - //~^ NOTE: Capturing w[(0, 0),(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture w[(0, 0),(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing w[(0, 0),(0, 0)] -> Immutable + //~| NOTE: Min Capture w[(0, 0),(0, 0)] -> Immutable }; // `c` only captures `w.p.x`, therefore it's safe to mutate `w.p.y`. diff --git a/tests/ui/closures/2229_closure_analysis/multilevel-path-2.stderr b/tests/ui/closures/2229_closure_analysis/multilevel-path-2.stderr index a7112531d9a..97f53e490e8 100644 --- a/tests/ui/closures/2229_closure_analysis/multilevel-path-2.stderr +++ b/tests/ui/closures/2229_closure_analysis/multilevel-path-2.stderr @@ -20,7 +20,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing w[(0, 0),(0, 0)] -> ImmBorrow +note: Capturing w[(0, 0),(0, 0)] -> Immutable --> $DIR/multilevel-path-2.rs:24:24 | LL | println!("{}", w.p.x); @@ -38,7 +38,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture w[(0, 0),(0, 0)] -> ImmBorrow +note: Min Capture w[(0, 0),(0, 0)] -> Immutable --> $DIR/multilevel-path-2.rs:24:24 | LL | println!("{}", w.p.x); diff --git a/tests/ui/closures/2229_closure_analysis/nested-closure.rs b/tests/ui/closures/2229_closure_analysis/nested-closure.rs index c481b3d853b..54166d068cb 100644 --- a/tests/ui/closures/2229_closure_analysis/nested-closure.rs +++ b/tests/ui/closures/2229_closure_analysis/nested-closure.rs @@ -24,8 +24,8 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", p.x); - //~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture p[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing p[(0, 0)] -> Immutable + //~| NOTE: Min Capture p[(0, 0)] -> Immutable let incr = 10; let mut c2 = #[rustc_capture_analysis] //~^ ERROR: attributes on expressions are experimental @@ -34,15 +34,15 @@ fn main() { || p.y += incr; //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: - //~| NOTE: Capturing p[(1, 0)] -> MutBorrow - //~| NOTE: Capturing incr[] -> ImmBorrow - //~| NOTE: Min Capture p[(1, 0)] -> MutBorrow - //~| NOTE: Min Capture incr[] -> ImmBorrow - //~| NOTE: Capturing p[(1, 0)] -> MutBorrow - //~| NOTE: Min Capture p[(1, 0)] -> MutBorrow + //~| NOTE: Capturing p[(1, 0)] -> Mutable + //~| NOTE: Capturing incr[] -> Immutable + //~| NOTE: Min Capture p[(1, 0)] -> Mutable + //~| NOTE: Min Capture incr[] -> Immutable + //~| NOTE: Capturing p[(1, 0)] -> Mutable + //~| NOTE: Min Capture p[(1, 0)] -> Mutable c2(); println!("{}", p.y); - //~^ NOTE: Capturing p[(1, 0)] -> ImmBorrow + //~^ NOTE: Capturing p[(1, 0)] -> Immutable }; c1(); diff --git a/tests/ui/closures/2229_closure_analysis/nested-closure.stderr b/tests/ui/closures/2229_closure_analysis/nested-closure.stderr index 256bfd58597..03550cb2d35 100644 --- a/tests/ui/closures/2229_closure_analysis/nested-closure.stderr +++ b/tests/ui/closures/2229_closure_analysis/nested-closure.stderr @@ -24,12 +24,12 @@ error: First Pass analysis includes: LL | || p.y += incr; | ^^^^^^^^^^^^^^ | -note: Capturing p[(1, 0)] -> MutBorrow +note: Capturing p[(1, 0)] -> Mutable --> $DIR/nested-closure.rs:34:12 | LL | || p.y += incr; | ^^^ -note: Capturing incr[] -> ImmBorrow +note: Capturing incr[] -> Immutable --> $DIR/nested-closure.rs:34:19 | LL | || p.y += incr; @@ -41,12 +41,12 @@ error: Min Capture analysis includes: LL | || p.y += incr; | ^^^^^^^^^^^^^^ | -note: Min Capture p[(1, 0)] -> MutBorrow +note: Min Capture p[(1, 0)] -> Mutable --> $DIR/nested-closure.rs:34:12 | LL | || p.y += incr; | ^^^ -note: Min Capture incr[] -> ImmBorrow +note: Min Capture incr[] -> Immutable --> $DIR/nested-closure.rs:34:19 | LL | || p.y += incr; @@ -64,17 +64,17 @@ LL | | LL | | }; | |_____^ | -note: Capturing p[(0, 0)] -> ImmBorrow +note: Capturing p[(0, 0)] -> Immutable --> $DIR/nested-closure.rs:26:24 | LL | println!("{}", p.x); | ^^^ -note: Capturing p[(1, 0)] -> MutBorrow +note: Capturing p[(1, 0)] -> Mutable --> $DIR/nested-closure.rs:34:12 | LL | || p.y += incr; | ^^^ -note: Capturing p[(1, 0)] -> ImmBorrow +note: Capturing p[(1, 0)] -> Immutable --> $DIR/nested-closure.rs:44:24 | LL | println!("{}", p.y); @@ -92,12 +92,12 @@ LL | | LL | | }; | |_____^ | -note: Min Capture p[(0, 0)] -> ImmBorrow +note: Min Capture p[(0, 0)] -> Immutable --> $DIR/nested-closure.rs:26:24 | LL | println!("{}", p.x); | ^^^ -note: Min Capture p[(1, 0)] -> MutBorrow +note: Min Capture p[(1, 0)] -> Mutable --> $DIR/nested-closure.rs:34:12 | LL | || p.y += incr; diff --git a/tests/ui/closures/2229_closure_analysis/optimization/edge_case.rs b/tests/ui/closures/2229_closure_analysis/optimization/edge_case.rs index 8df0eeb0eb4..70c20cf5aef 100644 --- a/tests/ui/closures/2229_closure_analysis/optimization/edge_case.rs +++ b/tests/ui/closures/2229_closure_analysis/optimization/edge_case.rs @@ -23,8 +23,8 @@ fn foo<'a, 'b>(m: &'a MyStruct<'b>) -> impl FnMut() + 'static { //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date //~| ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: - //~| NOTE: Capturing m[Deref,(0, 0),Deref,(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture m[Deref,(0, 0),Deref] -> ImmBorrow + //~| NOTE: Capturing m[Deref,(0, 0),Deref,(0, 0)] -> Immutable + //~| NOTE: Min Capture m[Deref,(0, 0),Deref] -> Immutable c } diff --git a/tests/ui/closures/2229_closure_analysis/optimization/edge_case.stderr b/tests/ui/closures/2229_closure_analysis/optimization/edge_case.stderr index 99159ab58a2..86f7a6a6bca 100644 --- a/tests/ui/closures/2229_closure_analysis/optimization/edge_case.stderr +++ b/tests/ui/closures/2229_closure_analysis/optimization/edge_case.stderr @@ -14,7 +14,7 @@ error: First Pass analysis includes: LL | let c = #[rustc_capture_analysis] || drop(&m.a.0); | ^^^^^^^^^^^^^^^ | -note: Capturing m[Deref,(0, 0),Deref,(0, 0)] -> ImmBorrow +note: Capturing m[Deref,(0, 0),Deref,(0, 0)] -> Immutable --> $DIR/edge_case.rs:20:48 | LL | let c = #[rustc_capture_analysis] || drop(&m.a.0); @@ -26,7 +26,7 @@ error: Min Capture analysis includes: LL | let c = #[rustc_capture_analysis] || drop(&m.a.0); | ^^^^^^^^^^^^^^^ | -note: Min Capture m[Deref,(0, 0),Deref] -> ImmBorrow +note: Min Capture m[Deref,(0, 0),Deref] -> Immutable --> $DIR/edge_case.rs:20:48 | LL | let c = #[rustc_capture_analysis] || drop(&m.a.0); diff --git a/tests/ui/closures/2229_closure_analysis/path-with-array-access.rs b/tests/ui/closures/2229_closure_analysis/path-with-array-access.rs index 2d3db4fde72..ed740f3a167 100644 --- a/tests/ui/closures/2229_closure_analysis/path-with-array-access.rs +++ b/tests/ui/closures/2229_closure_analysis/path-with-array-access.rs @@ -28,7 +28,7 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", pent.points[5].x); - //~^ NOTE: Capturing pent[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture pent[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing pent[(0, 0)] -> Immutable + //~| NOTE: Min Capture pent[(0, 0)] -> Immutable }; } diff --git a/tests/ui/closures/2229_closure_analysis/path-with-array-access.stderr b/tests/ui/closures/2229_closure_analysis/path-with-array-access.stderr index 22bd13617c1..e82295f047b 100644 --- a/tests/ui/closures/2229_closure_analysis/path-with-array-access.stderr +++ b/tests/ui/closures/2229_closure_analysis/path-with-array-access.stderr @@ -20,7 +20,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing pent[(0, 0)] -> ImmBorrow +note: Capturing pent[(0, 0)] -> Immutable --> $DIR/path-with-array-access.rs:30:24 | LL | println!("{}", pent.points[5].x); @@ -38,7 +38,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture pent[(0, 0)] -> ImmBorrow +note: Min Capture pent[(0, 0)] -> Immutable --> $DIR/path-with-array-access.rs:30:24 | LL | println!("{}", pent.points[5].x); diff --git a/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.rs b/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.rs index c30eaf8fb1b..159be843edb 100644 --- a/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.rs +++ b/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.rs @@ -28,17 +28,17 @@ fn test_one() { //~^ ERROR: Min Capture analysis includes: //~| ERROR println!("{:?}", a.0); - //~^ NOTE: Min Capture a[(0, 0)] -> ImmBorrow + //~^ NOTE: Min Capture a[(0, 0)] -> Immutable //~| NOTE println!("{:?}", a.1); - //~^ NOTE: Min Capture a[(1, 0)] -> ImmBorrow + //~^ NOTE: Min Capture a[(1, 0)] -> Immutable //~| NOTE println!("{:?}", b.0); - //~^ NOTE: Min Capture b[(0, 0)] -> ImmBorrow + //~^ NOTE: Min Capture b[(0, 0)] -> Immutable //~| NOTE println!("{:?}", b.1); - //~^ NOTE: Min Capture b[(1, 0)] -> ImmBorrow + //~^ NOTE: Min Capture b[(1, 0)] -> Immutable //~| NOTE }; } @@ -55,17 +55,17 @@ fn test_two() { //~^ ERROR: Min Capture analysis includes: //~| ERROR println!("{:?}", a.1); - //~^ NOTE: Min Capture a[(1, 0)] -> ImmBorrow + //~^ NOTE: Min Capture a[(1, 0)] -> Immutable //~| NOTE println!("{:?}", a.0); - //~^ NOTE: Min Capture a[(0, 0)] -> ImmBorrow + //~^ NOTE: Min Capture a[(0, 0)] -> Immutable //~| NOTE println!("{:?}", b.1); - //~^ NOTE: Min Capture b[(1, 0)] -> ImmBorrow + //~^ NOTE: Min Capture b[(1, 0)] -> Immutable //~| NOTE println!("{:?}", b.0); - //~^ NOTE: Min Capture b[(0, 0)] -> ImmBorrow + //~^ NOTE: Min Capture b[(0, 0)] -> Immutable //~| NOTE }; } @@ -82,17 +82,17 @@ fn test_three() { //~^ ERROR: Min Capture analysis includes: //~| ERROR println!("{:?}", b.1); - //~^ NOTE: Min Capture b[(1, 0)] -> ImmBorrow + //~^ NOTE: Min Capture b[(1, 0)] -> Immutable //~| NOTE println!("{:?}", a.1); - //~^ NOTE: Min Capture a[(1, 0)] -> ImmBorrow + //~^ NOTE: Min Capture a[(1, 0)] -> Immutable //~| NOTE println!("{:?}", a.0); - //~^ NOTE: Min Capture a[(0, 0)] -> ImmBorrow + //~^ NOTE: Min Capture a[(0, 0)] -> Immutable //~| NOTE println!("{:?}", b.0); - //~^ NOTE: Min Capture b[(0, 0)] -> ImmBorrow + //~^ NOTE: Min Capture b[(0, 0)] -> Immutable //~| NOTE }; } diff --git a/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.stderr b/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.stderr index 82f770eafed..65a0a317ab6 100644 --- a/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.stderr +++ b/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.stderr @@ -40,22 +40,22 @@ LL | | LL | | }; | |_____^ | -note: Capturing a[(0, 0)] -> ImmBorrow +note: Capturing a[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:30:26 | LL | println!("{:?}", a.0); | ^^^ -note: Capturing a[(1, 0)] -> ImmBorrow +note: Capturing a[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:33:26 | LL | println!("{:?}", a.1); | ^^^ -note: Capturing b[(0, 0)] -> ImmBorrow +note: Capturing b[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:37:26 | LL | println!("{:?}", b.0); | ^^^ -note: Capturing b[(1, 0)] -> ImmBorrow +note: Capturing b[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:40:26 | LL | println!("{:?}", b.1); @@ -73,22 +73,22 @@ LL | | LL | | }; | |_____^ | -note: Min Capture a[(0, 0)] -> ImmBorrow +note: Min Capture a[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:30:26 | LL | println!("{:?}", a.0); | ^^^ -note: Min Capture a[(1, 0)] -> ImmBorrow +note: Min Capture a[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:33:26 | LL | println!("{:?}", a.1); | ^^^ -note: Min Capture b[(0, 0)] -> ImmBorrow +note: Min Capture b[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:37:26 | LL | println!("{:?}", b.0); | ^^^ -note: Min Capture b[(1, 0)] -> ImmBorrow +note: Min Capture b[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:40:26 | LL | println!("{:?}", b.1); @@ -106,22 +106,22 @@ LL | | LL | | }; | |_____^ | -note: Capturing a[(1, 0)] -> ImmBorrow +note: Capturing a[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:57:26 | LL | println!("{:?}", a.1); | ^^^ -note: Capturing a[(0, 0)] -> ImmBorrow +note: Capturing a[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:60:26 | LL | println!("{:?}", a.0); | ^^^ -note: Capturing b[(1, 0)] -> ImmBorrow +note: Capturing b[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:64:26 | LL | println!("{:?}", b.1); | ^^^ -note: Capturing b[(0, 0)] -> ImmBorrow +note: Capturing b[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:67:26 | LL | println!("{:?}", b.0); @@ -139,22 +139,22 @@ LL | | LL | | }; | |_____^ | -note: Min Capture a[(0, 0)] -> ImmBorrow +note: Min Capture a[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:60:26 | LL | println!("{:?}", a.0); | ^^^ -note: Min Capture a[(1, 0)] -> ImmBorrow +note: Min Capture a[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:57:26 | LL | println!("{:?}", a.1); | ^^^ -note: Min Capture b[(0, 0)] -> ImmBorrow +note: Min Capture b[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:67:26 | LL | println!("{:?}", b.0); | ^^^ -note: Min Capture b[(1, 0)] -> ImmBorrow +note: Min Capture b[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:64:26 | LL | println!("{:?}", b.1); @@ -172,22 +172,22 @@ LL | | LL | | }; | |_____^ | -note: Capturing b[(1, 0)] -> ImmBorrow +note: Capturing b[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:84:26 | LL | println!("{:?}", b.1); | ^^^ -note: Capturing a[(1, 0)] -> ImmBorrow +note: Capturing a[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:87:26 | LL | println!("{:?}", a.1); | ^^^ -note: Capturing a[(0, 0)] -> ImmBorrow +note: Capturing a[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:90:26 | LL | println!("{:?}", a.0); | ^^^ -note: Capturing b[(0, 0)] -> ImmBorrow +note: Capturing b[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:94:26 | LL | println!("{:?}", b.0); @@ -205,22 +205,22 @@ LL | | LL | | }; | |_____^ | -note: Min Capture b[(0, 0)] -> ImmBorrow +note: Min Capture b[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:94:26 | LL | println!("{:?}", b.0); | ^^^ -note: Min Capture b[(1, 0)] -> ImmBorrow +note: Min Capture b[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:84:26 | LL | println!("{:?}", b.1); | ^^^ -note: Min Capture a[(0, 0)] -> ImmBorrow +note: Min Capture a[(0, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:90:26 | LL | println!("{:?}", a.0); | ^^^ -note: Min Capture a[(1, 0)] -> ImmBorrow +note: Min Capture a[(1, 0)] -> Immutable --> $DIR/preserve_field_drop_order.rs:87:26 | LL | println!("{:?}", a.1); diff --git a/tests/ui/closures/2229_closure_analysis/repr_packed.rs b/tests/ui/closures/2229_closure_analysis/repr_packed.rs index 0dde2b12b87..2525af37eaa 100644 --- a/tests/ui/closures/2229_closure_analysis/repr_packed.rs +++ b/tests/ui/closures/2229_closure_analysis/repr_packed.rs @@ -19,10 +19,10 @@ fn test_alignment_not_affected() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let z1: &u8 = &foo.x; - //~^ NOTE: Capturing foo[] -> ImmBorrow + //~^ NOTE: Capturing foo[] -> Immutable let z2: &mut u8 = &mut foo.y; - //~^ NOTE: Capturing foo[] -> MutBorrow - //~| NOTE: Min Capture foo[] -> MutBorrow + //~^ NOTE: Capturing foo[] -> Mutable + //~| NOTE: Min Capture foo[] -> Mutable *z2 = 42; @@ -50,10 +50,10 @@ fn test_alignment_affected() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let z1: &String = &foo.x; - //~^ NOTE: Capturing foo[] -> ImmBorrow + //~^ NOTE: Capturing foo[] -> Immutable let z2: &mut u16 = &mut foo.y; - //~^ NOTE: Capturing foo[] -> MutBorrow - //~| NOTE: Min Capture foo[] -> MutBorrow + //~^ NOTE: Capturing foo[] -> Mutable + //~| NOTE: Min Capture foo[] -> Mutable *z2 = 42; @@ -86,7 +86,7 @@ fn test_truncation_when_ref_and_move() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{}", foo.x); - //~^ NOTE: Capturing foo[] -> ImmBorrow + //~^ NOTE: Capturing foo[] -> Immutable //~| NOTE: Min Capture foo[] -> ByValue //~| NOTE: foo[] used here let _z = foo.x; diff --git a/tests/ui/closures/2229_closure_analysis/repr_packed.stderr b/tests/ui/closures/2229_closure_analysis/repr_packed.stderr index 3bac41d60d5..d4b2f8bfeae 100644 --- a/tests/ui/closures/2229_closure_analysis/repr_packed.stderr +++ b/tests/ui/closures/2229_closure_analysis/repr_packed.stderr @@ -40,12 +40,12 @@ LL | | println!("({}, {})", z1, z2); LL | | }; | |_____^ | -note: Capturing foo[] -> ImmBorrow +note: Capturing foo[] -> Immutable --> $DIR/repr_packed.rs:21:24 | LL | let z1: &u8 = &foo.x; | ^^^^^ -note: Capturing foo[] -> MutBorrow +note: Capturing foo[] -> Mutable --> $DIR/repr_packed.rs:23:32 | LL | let z2: &mut u8 = &mut foo.y; @@ -63,7 +63,7 @@ LL | | println!("({}, {})", z1, z2); LL | | }; | |_____^ | -note: Min Capture foo[] -> MutBorrow +note: Min Capture foo[] -> Mutable --> $DIR/repr_packed.rs:23:32 | LL | let z2: &mut u8 = &mut foo.y; @@ -81,12 +81,12 @@ LL | | println!("({}, {})", z1, z2); LL | | }; | |_____^ | -note: Capturing foo[] -> ImmBorrow +note: Capturing foo[] -> Immutable --> $DIR/repr_packed.rs:52:28 | LL | let z1: &String = &foo.x; | ^^^^^ -note: Capturing foo[] -> MutBorrow +note: Capturing foo[] -> Mutable --> $DIR/repr_packed.rs:54:33 | LL | let z2: &mut u16 = &mut foo.y; @@ -104,7 +104,7 @@ LL | | println!("({}, {})", z1, z2); LL | | }; | |_____^ | -note: Min Capture foo[] -> MutBorrow +note: Min Capture foo[] -> Mutable --> $DIR/repr_packed.rs:54:33 | LL | let z2: &mut u16 = &mut foo.y; @@ -122,7 +122,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing foo[] -> ImmBorrow +note: Capturing foo[] -> Immutable --> $DIR/repr_packed.rs:88:24 | LL | println!("{}", foo.x); diff --git a/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs b/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs index 4b749a70577..38aa76999fb 100644 --- a/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs +++ b/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.rs @@ -16,7 +16,7 @@ fn main() { // // Requirements: // p.x -> MutBoorrow - // p -> ImmBorrow + // p -> Immutable // // Requirements met when p is captured via MutBorrow // @@ -28,11 +28,11 @@ fn main() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: p.x += 10; - //~^ NOTE: Capturing p[(0, 0)] -> MutBorrow - //~| NOTE: p[] captured as MutBorrow here + //~^ NOTE: Capturing p[(0, 0)] -> Mutable + //~| NOTE: p[] captured as Mutable here println!("{:?}", p); - //~^ NOTE: Capturing p[] -> ImmBorrow - //~| NOTE: Min Capture p[] -> MutBorrow + //~^ NOTE: Capturing p[] -> Immutable + //~| NOTE: Min Capture p[] -> Mutable //~| NOTE: p[] used here }; diff --git a/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr b/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr index 247dcbe94bc..a88bd01093a 100644 --- a/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr +++ b/tests/ui/closures/2229_closure_analysis/simple-struct-min-capture.stderr @@ -20,12 +20,12 @@ LL | | LL | | }; | |_____^ | -note: Capturing p[(0, 0)] -> MutBorrow +note: Capturing p[(0, 0)] -> Mutable --> $DIR/simple-struct-min-capture.rs:30:9 | LL | p.x += 10; | ^^^ -note: Capturing p[] -> ImmBorrow +note: Capturing p[] -> Immutable --> $DIR/simple-struct-min-capture.rs:33:26 | LL | println!("{:?}", p); @@ -43,11 +43,11 @@ LL | | LL | | }; | |_____^ | -note: Min Capture p[] -> MutBorrow +note: Min Capture p[] -> Mutable --> $DIR/simple-struct-min-capture.rs:30:9 | LL | p.x += 10; - | ^^^ p[] captured as MutBorrow here + | ^^^ p[] captured as Mutable here ... LL | println!("{:?}", p); | ^ p[] used here diff --git a/tests/ui/closures/2229_closure_analysis/unsafe_ptr.rs b/tests/ui/closures/2229_closure_analysis/unsafe_ptr.rs index 33d43c5f526..667f244f612 100644 --- a/tests/ui/closures/2229_closure_analysis/unsafe_ptr.rs +++ b/tests/ui/closures/2229_closure_analysis/unsafe_ptr.rs @@ -30,8 +30,8 @@ fn unsafe_imm() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: println!("{:?}", (*t.0).s); - //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture t[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> Immutable + //~| NOTE: Min Capture t[(0, 0)] -> Immutable }; c(); @@ -51,8 +51,8 @@ fn unsafe_mut() { //~^ ERROR: First Pass analysis includes: //~| ERROR: Min Capture analysis includes: let x = unsafe { &mut (*p).s }; - //~^ NOTE: Capturing p[Deref,(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture p[] -> ImmBorrow + //~^ NOTE: Capturing p[Deref,(0, 0)] -> Immutable + //~| NOTE: Min Capture p[] -> Immutable *x = "s".into(); }; c(); diff --git a/tests/ui/closures/2229_closure_analysis/unsafe_ptr.stderr b/tests/ui/closures/2229_closure_analysis/unsafe_ptr.stderr index 4f3de075054..54463c5277d 100644 --- a/tests/ui/closures/2229_closure_analysis/unsafe_ptr.stderr +++ b/tests/ui/closures/2229_closure_analysis/unsafe_ptr.stderr @@ -30,7 +30,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing t[(0, 0),Deref,(0, 0)] -> ImmBorrow +note: Capturing t[(0, 0),Deref,(0, 0)] -> Immutable --> $DIR/unsafe_ptr.rs:32:26 | LL | println!("{:?}", (*t.0).s); @@ -48,7 +48,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture t[(0, 0)] -> ImmBorrow +note: Min Capture t[(0, 0)] -> Immutable --> $DIR/unsafe_ptr.rs:32:26 | LL | println!("{:?}", (*t.0).s); @@ -66,7 +66,7 @@ LL | | *x = "s".into(); LL | | }; | |_____^ | -note: Capturing p[Deref,(0, 0)] -> ImmBorrow +note: Capturing p[Deref,(0, 0)] -> Immutable --> $DIR/unsafe_ptr.rs:53:31 | LL | let x = unsafe { &mut (*p).s }; @@ -84,7 +84,7 @@ LL | | *x = "s".into(); LL | | }; | |_____^ | -note: Min Capture p[] -> ImmBorrow +note: Min Capture p[] -> Immutable --> $DIR/unsafe_ptr.rs:53:31 | LL | let x = unsafe { &mut (*p).s }; diff --git a/tests/ui/closures/2229_closure_analysis/wild_patterns.rs b/tests/ui/closures/2229_closure_analysis/wild_patterns.rs index 9adf20c21d5..d220cfce9ce 100644 --- a/tests/ui/closures/2229_closure_analysis/wild_patterns.rs +++ b/tests/ui/closures/2229_closure_analysis/wild_patterns.rs @@ -28,8 +28,8 @@ fn wild_struct() { //~| ERROR: Min Capture analysis includes: // FIXME(arora-aman): Change `_x` to `_` let Point { x: _x, y: _ } = p; - //~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow - //~| NOTE: Min Capture p[(0, 0)] -> ImmBorrow + //~^ NOTE: Capturing p[(0, 0)] -> Immutable + //~| NOTE: Min Capture p[(0, 0)] -> Immutable }; c(); diff --git a/tests/ui/closures/2229_closure_analysis/wild_patterns.stderr b/tests/ui/closures/2229_closure_analysis/wild_patterns.stderr index 88b48aaaf8c..4d6d85649da 100644 --- a/tests/ui/closures/2229_closure_analysis/wild_patterns.stderr +++ b/tests/ui/closures/2229_closure_analysis/wild_patterns.stderr @@ -40,7 +40,7 @@ LL | | LL | | }; | |_____^ | -note: Capturing p[(0, 0)] -> ImmBorrow +note: Capturing p[(0, 0)] -> Immutable --> $DIR/wild_patterns.rs:30:37 | LL | let Point { x: _x, y: _ } = p; @@ -58,7 +58,7 @@ LL | | LL | | }; | |_____^ | -note: Min Capture p[(0, 0)] -> ImmBorrow +note: Min Capture p[(0, 0)] -> Immutable --> $DIR/wild_patterns.rs:30:37 | LL | let Point { x: _x, y: _ } = p; diff --git a/tests/ui/closures/closure-move-sync.stderr b/tests/ui/closures/closure-move-sync.stderr index 6cade0c09dd..2bb26b0c0b7 100644 --- a/tests/ui/closures/closure-move-sync.stderr +++ b/tests/ui/closures/closure-move-sync.stderr @@ -10,7 +10,7 @@ LL | | LL | | }); | |_____^ `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely | - = help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver<()>`, which is required by `{closure@$DIR/closure-move-sync.rs:6:27: 6:29}: Send` + = help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver<()>` = note: required for `&std::sync::mpsc::Receiver<()>` to implement `Send` note: required because it's used within this closure --> $DIR/closure-move-sync.rs:6:27 diff --git a/tests/ui/closures/closure-return-type-must-be-sized.stderr b/tests/ui/closures/closure-return-type-must-be-sized.stderr index 167d326e26e..04ae7343bbe 100644 --- a/tests/ui/closures/closure-return-type-must-be-sized.stderr +++ b/tests/ui/closures/closure-return-type-must-be-sized.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation LL | a::foo::<fn() -> dyn A>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()` + = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time @@ -13,7 +13,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation LL | a::bar::<fn() -> dyn A, _>(); | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()` + = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` note: required by a bound in `a::bar` --> $DIR/closure-return-type-must-be-sized.rs:14:19 @@ -27,7 +27,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation LL | a::baz::<fn() -> dyn A>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()` + = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time @@ -36,7 +36,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation LL | b::foo::<fn() -> dyn A>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()` + = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time @@ -45,7 +45,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation LL | b::bar::<fn() -> dyn A, _>(); | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: Fn()` + = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` note: required by a bound in `b::bar` --> $DIR/closure-return-type-must-be-sized.rs:28:19 @@ -59,7 +59,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation LL | b::baz::<fn() -> dyn A>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()` + = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time @@ -68,7 +68,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation LL | c::foo::<fn() -> dyn A>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()` + = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time @@ -77,7 +77,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation LL | c::bar::<fn() -> dyn A, _>(); | ^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnMut()` + = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` note: required by a bound in `c::bar` --> $DIR/closure-return-type-must-be-sized.rs:42:19 @@ -91,7 +91,7 @@ error[E0277]: the size for values of type `dyn A` cannot be known at compilation LL | c::baz::<fn() -> dyn A>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A`, which is required by `fn() -> dyn A: FnOnce()` + = help: within `fn() -> dyn A`, the trait `Sized` is not implemented for `dyn A` = note: required because it appears within the type `fn() -> dyn A` error: aborting due to 9 previous errors diff --git a/tests/ui/closures/coerce-unsafe-to-closure.stderr b/tests/ui/closures/coerce-unsafe-to-closure.stderr index 2538fc0361c..013b9009da4 100644 --- a/tests/ui/closures/coerce-unsafe-to-closure.stderr +++ b/tests/ui/closures/coerce-unsafe-to-closure.stderr @@ -1,4 +1,4 @@ -error[E0277]: expected a `FnOnce(&str)` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}` +error[E0277]: expected a `FnOnce(&str)` closure, found `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}` --> $DIR/coerce-unsafe-to-closure.rs:2:44 | LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute); @@ -6,7 +6,7 @@ LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute); | | | required by a bound introduced by this call | - = help: the trait `FnOnce(&str)` is not implemented for fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}` + = help: the trait `FnOnce(&str)` is not implemented for fn item `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}` = note: unsafe function cannot be called generically without an unsafe block note: required by a bound in `Option::<T>::map` --> $SRC_DIR/core/src/option.rs:LL:COL diff --git a/tests/ui/coherence/deep-bad-copy-reason.stderr b/tests/ui/coherence/deep-bad-copy-reason.stderr index fe5ae9b08b4..534f26c39c2 100644 --- a/tests/ui/coherence/deep-bad-copy-reason.stderr +++ b/tests/ui/coherence/deep-bad-copy-reason.stderr @@ -19,7 +19,7 @@ error[E0277]: the size for values of type `OpaqueListContents` cannot be known a LL | pub struct List<'tcx, T>(Interned<'tcx, ListS<T>>); | ^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `ListS<T>`, the trait `Sized` is not implemented for `OpaqueListContents`, which is required by `ListS<T>: Sized` + = help: within `ListS<T>`, the trait `Sized` is not implemented for `OpaqueListContents` note: required because it appears within the type `ListS<T>` --> $DIR/deep-bad-copy-reason.rs:7:12 | diff --git a/tests/ui/compiletest-self-test/minicore-smoke-test.rs b/tests/ui/compiletest-self-test/minicore-smoke-test.rs new file mode 100644 index 00000000000..ec879f2852e --- /dev/null +++ b/tests/ui/compiletest-self-test/minicore-smoke-test.rs @@ -0,0 +1,20 @@ +//! Basic smoke test for `minicore` test auxiliary. +//! +//! This test is duplicated between ui/codegen/assembly because they have different runtest +//! codepaths. + +//@ add-core-stubs +//@ check-pass +//@ compile-flags: --target=x86_64-unknown-linux-gnu +//@ needs-llvm-components: x86 + +#![crate_type = "lib"] +#![feature(no_core)] +#![no_std] +#![no_core] + +extern crate minicore; +use minicore::*; + +struct Meow; +impl Copy for Meow {} diff --git a/tests/ui/conditional-compilation/cfg_accessible-unstable.rs b/tests/ui/conditional-compilation/cfg_accessible-unstable.rs index e9247e67a2a..9ac98dbd6e7 100644 --- a/tests/ui/conditional-compilation/cfg_accessible-unstable.rs +++ b/tests/ui/conditional-compilation/cfg_accessible-unstable.rs @@ -1,2 +1,2 @@ -#[cfg_accessible(std)] //~ ERROR use of unstable library feature 'cfg_accessible' +#[cfg_accessible(std)] //~ ERROR use of unstable library feature `cfg_accessible` fn main() {} diff --git a/tests/ui/conditional-compilation/cfg_accessible-unstable.stderr b/tests/ui/conditional-compilation/cfg_accessible-unstable.stderr index 201f6a13f1f..c994f4e67ac 100644 --- a/tests/ui/conditional-compilation/cfg_accessible-unstable.stderr +++ b/tests/ui/conditional-compilation/cfg_accessible-unstable.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'cfg_accessible': `cfg_accessible` is not fully implemented +error[E0658]: use of unstable library feature `cfg_accessible`: `cfg_accessible` is not fully implemented --> $DIR/cfg_accessible-unstable.rs:1:3 | LL | #[cfg_accessible(std)] diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr index 694f5a5c1a9..4c8a5e46751 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr @@ -20,10 +20,11 @@ error[E0277]: `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` can't be used as --> $DIR/const_param_ty_bad.rs:8:11 | LL | check(|| {}); - | ----- ^^^^^ the trait `UnsizedConstParamTy` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` + | ----- ^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | + = help: the trait `UnsizedConstParamTy` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` note: required by a bound in `check` --> $DIR/const_param_ty_bad.rs:4:18 | diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr index 9852e181b9a..9220cd1f94e 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr @@ -2,7 +2,7 @@ error[E0277]: `NotParam` can't be used as a const parameter type --> $DIR/const_param_ty_bad_empty_array.rs:10:13 | LL | check::<[NotParam; 0]>(); - | ^^^^^^^^^^^^^ the trait `ConstParamTy_` is not implemented for `NotParam`, which is required by `[NotParam; 0]: ConstParamTy_` + | ^^^^^^^^^^^^^ the trait `ConstParamTy_` is not implemented for `NotParam` | = note: required for `[NotParam; 0]` to implement `ConstParamTy_` note: required by a bound in `check` diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr index e63ae582fd5..d01aaffe8ae 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr @@ -2,7 +2,7 @@ error[E0277]: `NotParam` can't be used as a const parameter type --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:10:13 | LL | check::<&NotParam>(); - | ^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `NotParam`, which is required by `&NotParam: UnsizedConstParamTy` + | ^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `NotParam` | = note: required for `&NotParam` to implement `UnsizedConstParamTy` note: required by a bound in `check` @@ -15,7 +15,7 @@ error[E0277]: `NotParam` can't be used as a const parameter type --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:11:13 | LL | check::<[NotParam]>(); - | ^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `NotParam`, which is required by `[NotParam]: UnsizedConstParamTy` + | ^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `NotParam` | = note: required for `[NotParam]` to implement `UnsizedConstParamTy` note: required by a bound in `check` @@ -28,7 +28,7 @@ error[E0277]: `NotParam` can't be used as a const parameter type --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:12:13 | LL | check::<[NotParam; 17]>(); - | ^^^^^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `NotParam`, which is required by `[NotParam; 17]: UnsizedConstParamTy` + | ^^^^^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `NotParam` | = note: required for `[NotParam; 17]` to implement `UnsizedConstParamTy` note: required by a bound in `check` diff --git a/tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr b/tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr index 1c30aa68e85..72f3fd9de90 100644 --- a/tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr +++ b/tests/ui/const-generics/adt_const_params/unsizing-wfcheck-issue-126272.stderr @@ -64,7 +64,7 @@ LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)] LL | nested: &'static Bar<dyn std::fmt::Debug>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: the trait `Sized` is not implemented for `(dyn Debug + 'static)`, which is required by `&&'static Bar<(dyn Debug + 'static)>: Debug` + = help: the trait `Sized` is not implemented for `(dyn Debug + 'static)` = help: the trait `Debug` is implemented for `Bar<T>` note: required for `Bar<(dyn Debug + 'static)>` to implement `Debug` --> $DIR/unsizing-wfcheck-issue-126272.rs:20:10 @@ -96,7 +96,7 @@ LL | #[derive(Debug, PartialEq, Eq, ConstParamTy)] | -- in this derive macro expansion ... LL | nested: &'static Bar<dyn std::fmt::Debug>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `dyn Debug`, which is required by `&'static Bar<dyn Debug>: Eq` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `dyn Debug` | = help: the trait `Eq` is implemented for `Bar<T>` note: required for `Bar<dyn Debug>` to implement `Eq` diff --git a/tests/ui/const-generics/associated-type-bound-fail.stderr b/tests/ui/const-generics/associated-type-bound-fail.stderr index 602a8927a85..e92aad7cec3 100644 --- a/tests/ui/const-generics/associated-type-bound-fail.stderr +++ b/tests/ui/const-generics/associated-type-bound-fail.stderr @@ -4,7 +4,8 @@ error[E0277]: the trait bound `u16: Bar<N>` is not satisfied LL | type Assoc = u16; | ^^^ the trait `Bar<N>` is not implemented for `u16` | - = help: the trait `Bar<3>` is implemented for `u16` + = help: the trait `Bar<N>` is not implemented for `u16` + but trait `Bar<3>` is implemented for it note: required by a bound in `Foo::Assoc` --> $DIR/associated-type-bound-fail.rs:4:17 | diff --git a/tests/ui/const-generics/const_trait_fn-issue-88433.rs b/tests/ui/const-generics/const_trait_fn-issue-88433.rs index 5e0ea6fc168..bc91fc1700e 100644 --- a/tests/ui/const-generics/const_trait_fn-issue-88433.rs +++ b/tests/ui/const-generics/const_trait_fn-issue-88433.rs @@ -1,8 +1,7 @@ //@ build-pass //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Func<T> { diff --git a/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr b/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr index 45be3126e3b..e36f645b263 100644 --- a/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr +++ b/tests/ui/const-generics/defaults/rp_impl_trait_fail.stderr @@ -18,7 +18,8 @@ LL | LL | 1_u32 | ----- return type was inferred to be `u32` here | - = help: the trait `Traitor<N, 2>` is implemented for `u32` + = help: the trait `Traitor<N, N>` is not implemented for `u32` + but trait `Traitor<N, 2>` is implemented for it error[E0277]: the trait bound `u64: Traitor` is not satisfied --> $DIR/rp_impl_trait_fail.rs:21:13 @@ -29,7 +30,8 @@ LL | LL | 1_u64 | ----- return type was inferred to be `u64` here | - = help: the trait `Traitor<1, 2>` is implemented for `u64` + = help: the trait `Traitor<1, 1>` is not implemented for `u64` + but trait `Traitor<1, 2>` is implemented for it error[E0284]: type annotations needed --> $DIR/rp_impl_trait_fail.rs:28:5 diff --git a/tests/ui/const-generics/defaults/trait_objects_fail.stderr b/tests/ui/const-generics/defaults/trait_objects_fail.stderr index 481d77728b9..2390dfeadb9 100644 --- a/tests/ui/const-generics/defaults/trait_objects_fail.stderr +++ b/tests/ui/const-generics/defaults/trait_objects_fail.stderr @@ -4,7 +4,8 @@ error[E0277]: the trait bound `u32: Trait` is not satisfied LL | foo(&10_u32); | ^^^^^^^ the trait `Trait` is not implemented for `u32` | - = help: the trait `Trait<2>` is implemented for `u32` + = help: the trait `Trait<12>` is not implemented for `u32` + but trait `Trait<2>` is implemented for it = note: required for the cast from `&u32` to `&dyn Trait` error[E0277]: the trait bound `bool: Traitor<_>` is not satisfied @@ -13,7 +14,8 @@ error[E0277]: the trait bound `bool: Traitor<_>` is not satisfied LL | bar(&true); | ^^^^^ the trait `Traitor<_>` is not implemented for `bool` | - = help: the trait `Traitor<2, 3>` is implemented for `bool` + = help: the trait `Traitor<_, _>` is not implemented for `bool` + but trait `Traitor<2, 3>` is implemented for it = note: required for the cast from `&bool` to `&dyn Traitor<_>` error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/defaults/wfness.stderr b/tests/ui/const-generics/defaults/wfness.stderr index bd9bfcd7dad..290a80bd32f 100644 --- a/tests/ui/const-generics/defaults/wfness.stderr +++ b/tests/ui/const-generics/defaults/wfness.stderr @@ -10,7 +10,8 @@ error[E0277]: the trait bound `(): Trait<2>` is not satisfied LL | (): Trait<N>; | ^^^^^^^^ the trait `Trait<2>` is not implemented for `()` | - = help: the trait `Trait<3>` is implemented for `()` + = help: the trait `Trait<2>` is not implemented for `()` + but trait `Trait<3>` is implemented for it error[E0277]: the trait bound `(): Trait<1>` is not satisfied --> $DIR/wfness.rs:18:13 @@ -18,7 +19,8 @@ error[E0277]: the trait bound `(): Trait<1>` is not satisfied LL | fn foo() -> DependentDefaultWfness { | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<1>` is not implemented for `()` | - = help: the trait `Trait<3>` is implemented for `()` + = help: the trait `Trait<1>` is not implemented for `()` + but trait `Trait<3>` is implemented for it note: required by a bound in `WhereClause` --> $DIR/wfness.rs:8:9 | diff --git a/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr b/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr index 4abe39eb598..6ff22ffa847 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-85848.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `(): _Contains<&C>` is not satisfied --> $DIR/issue-85848.rs:24:29 | LL | writes_to_specific_path(&cap); - | ----------------------- ^^^^ the trait `_Contains<&C>` is not implemented for `()`, which is required by `&C: Delegates<()>` + | ----------------------- ^^^^ the trait `_Contains<&C>` is not implemented for `()` | | | required by a bound introduced by this call | diff --git a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs index 818b5d6ca93..6c0ac639612 100644 --- a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs +++ b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs @@ -1,6 +1,6 @@ //@ known-bug: #110395 //@ compile-flags: -Znext-solver -#![feature(generic_const_exprs, adt_const_params, const_trait_impl, effects)] +#![feature(generic_const_exprs, adt_const_params, const_trait_impl)] #![allow(incomplete_features)] // test `N + N` unifies with explicit function calls for non-builtin-types diff --git a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr index bae8249845c..882fdf0b228 100644 --- a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr @@ -1,7 +1,7 @@ error: `-Znext-solver=globally` and `generic_const_exprs` are incompatible, using them at the same time is not allowed --> $DIR/unify-op-with-fn-call.rs:3:12 | -LL | #![feature(generic_const_exprs, adt_const_params, const_trait_impl, effects)] +LL | #![feature(generic_const_exprs, adt_const_params, const_trait_impl)] | ^^^^^^^^^^^^^^^^^^^ | = help: remove one of these features @@ -27,11 +27,13 @@ LL + #[derive(ConstParamTy)] LL | struct Foo(u8); | -error[E0284]: type annotations needed: cannot normalize `foo<N>::{constant#0}` - --> $DIR/unify-op-with-fn-call.rs:20:25 +error[E0015]: cannot call non-const operator in constants + --> $DIR/unify-op-with-fn-call.rs:20:39 | LL | fn foo<const N: Foo>(a: Evaluatable<{ N + N }>) { - | ^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `foo<N>::{constant#0}` + | ^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter --> $DIR/unify-op-with-fn-call.rs:20:17 @@ -63,11 +65,21 @@ error[E0284]: type annotations needed: cannot normalize `foo2<N>::{constant#0}` LL | fn foo2<const N: usize>(a: Evaluatable2<{ N + N }>) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `foo2<N>::{constant#0}` -error[E0284]: type annotations needed: cannot normalize `foo<N>::{constant#0}` - --> $DIR/unify-op-with-fn-call.rs:21:11 +error[E0015]: cannot call non-const fn `<Foo as Add>::add` in constants + --> $DIR/unify-op-with-fn-call.rs:21:13 | LL | bar::<{ std::ops::Add::add(N, N) }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `foo<N>::{constant#0}` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + +error[E0015]: cannot call non-const fn `<usize as Add>::add` in constants + --> $DIR/unify-op-with-fn-call.rs:30:14 + | +LL | bar2::<{ std::ops::Add::add(N, N) }>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants error[E0284]: type annotations needed: cannot normalize `foo2<N>::{constant#0}` --> $DIR/unify-op-with-fn-call.rs:30:12 @@ -75,7 +87,7 @@ error[E0284]: type annotations needed: cannot normalize `foo2<N>::{constant#0}` LL | bar2::<{ std::ops::Add::add(N, N) }>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `foo2<N>::{constant#0}` -error: aborting due to 9 previous errors +error: aborting due to 10 previous errors -Some errors have detailed explanations: E0284, E0741. -For more information about an error, try `rustc --explain E0284`. +Some errors have detailed explanations: E0015, E0284, E0741. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/const-generics/issue-93647.stderr b/tests/ui/const-generics/issue-93647.stderr index 81f50a1b517..38fb3d79459 100644 --- a/tests/ui/const-generics/issue-93647.stderr +++ b/tests/ui/const-generics/issue-93647.stderr @@ -6,10 +6,6 @@ LL | (||1usize)() | = note: closures need an RFC before allowed to be called in constants = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-67185-2.stderr b/tests/ui/const-generics/issues/issue-67185-2.stderr index 5cc3bb673bc..82813a24f99 100644 --- a/tests/ui/const-generics/issues/issue-67185-2.stderr +++ b/tests/ui/const-generics/issues/issue-67185-2.stderr @@ -32,7 +32,7 @@ error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied --> $DIR/issue-67185-2.rs:21:6 | LL | impl Foo for FooImpl {} - | ^^^ the trait `Bar` is not implemented for `[u16; 3]`, which is required by `<u8 as Baz>::Quaks: Bar` + | ^^^ the trait `Bar` is not implemented for `[u16; 3]` | = help: the following other types implement trait `Bar`: [[u16; 3]; 3] @@ -50,7 +50,7 @@ error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied --> $DIR/issue-67185-2.rs:21:6 | LL | impl Foo for FooImpl {} - | ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]`, which is required by `[<u8 as Baz>::Quaks; 2]: Bar` + | ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]` | = help: the following other types implement trait `Bar`: [[u16; 3]; 3] diff --git a/tests/ui/const-generics/issues/issue-88119.rs b/tests/ui/const-generics/issues/issue-88119.rs index 12cb7ee7f55..a49b2ab8b03 100644 --- a/tests/ui/const-generics/issues/issue-88119.rs +++ b/tests/ui/const-generics/issues/issue-88119.rs @@ -1,7 +1,7 @@ //@ known-bug: #110395 //@ compile-flags: -Znext-solver #![allow(incomplete_features)] -#![feature(const_trait_impl, effects, generic_const_exprs)] +#![feature(const_trait_impl, generic_const_exprs)] #[const_trait] trait ConstName { diff --git a/tests/ui/const-generics/issues/issue-88119.stderr b/tests/ui/const-generics/issues/issue-88119.stderr index a0ca33e38ef..370244fe8c9 100644 --- a/tests/ui/const-generics/issues/issue-88119.stderr +++ b/tests/ui/const-generics/issues/issue-88119.stderr @@ -1,8 +1,8 @@ error: `-Znext-solver=globally` and `generic_const_exprs` are incompatible, using them at the same time is not allowed - --> $DIR/issue-88119.rs:4:39 + --> $DIR/issue-88119.rs:4:30 | -LL | #![feature(const_trait_impl, effects, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ +LL | #![feature(const_trait_impl, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ | = help: remove one of these features diff --git a/tests/ui/const-generics/issues/issue-90318.stderr b/tests/ui/const-generics/issues/issue-90318.stderr index a534e8f8d44..9c7cb5ceb58 100644 --- a/tests/ui/const-generics/issues/issue-90318.stderr +++ b/tests/ui/const-generics/issues/issue-90318.stderr @@ -29,10 +29,6 @@ LL | If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/any.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: cannot call non-const operator in constants --> $DIR/issue-90318.rs:22:10 @@ -43,10 +39,6 @@ LL | If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/any.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 4 previous errors diff --git a/tests/ui/const-generics/kind_mismatch.stderr b/tests/ui/const-generics/kind_mismatch.stderr index 80968ebea68..e13bc6ee058 100644 --- a/tests/ui/const-generics/kind_mismatch.stderr +++ b/tests/ui/const-generics/kind_mismatch.stderr @@ -18,7 +18,7 @@ error[E0277]: the trait bound `KeyHolder<0>: SubsetExcept<_>` is not satisfied --> $DIR/kind_mismatch.rs:22:45 | LL | let map: KeyHolder<0> = remove_key::<_, _>(); - | ^ the trait `ContainsKey<0>` is not implemented for `KeyHolder<0>`, which is required by `KeyHolder<0>: SubsetExcept<_>` + | ^ the trait `ContainsKey<0>` is not implemented for `KeyHolder<0>` | note: required for `KeyHolder<0>` to implement `SubsetExcept<_>` --> $DIR/kind_mismatch.rs:15:28 diff --git a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr index 0184a059327..07e86aa17f2 100644 --- a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr +++ b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr @@ -4,7 +4,8 @@ error[E0277]: the trait bound `A<_>: Bar<_>` is not satisfied LL | let _ = A; | ^ the trait `Bar<_>` is not implemented for `A<_>` | - = help: the trait `Bar<_>` is implemented for `A<{ 6 + 1 }>` + = help: the trait `Bar<_>` is not implemented for `A<_>` + but it is implemented for `A<{ 6 + 1 }>` note: required by a bound in `A` --> $DIR/unused-substs-1.rs:9:11 | diff --git a/tests/ui/consts/auxiliary/closure-in-foreign-crate.rs b/tests/ui/consts/auxiliary/closure-in-foreign-crate.rs index a4dd3ee2e7e..8804772e282 100644 --- a/tests/ui/consts/auxiliary/closure-in-foreign-crate.rs +++ b/tests/ui/consts/auxiliary/closure-in-foreign-crate.rs @@ -1,7 +1,6 @@ //@ compile-flags: -Znext-solver #![crate_type = "lib"] -#![feature(const_closures, const_trait_impl, effects)] -#![allow(incomplete_features)] +#![feature(const_closures, const_trait_impl)] pub const fn test() { let cl = const || {}; diff --git a/tests/ui/consts/auxiliary/unstable_but_const_stable.rs b/tests/ui/consts/auxiliary/unstable_but_const_stable.rs deleted file mode 100644 index 88044b0272c..00000000000 --- a/tests/ui/consts/auxiliary/unstable_but_const_stable.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![feature(staged_api, rustc_attrs, intrinsics)] -#![stable(since="1.0.0", feature = "stable")] - -extern "rust-intrinsic" { - #[unstable(feature = "unstable", issue = "42")] - #[rustc_const_stable(feature = "stable", since = "1.0.0")] - #[rustc_nounwind] - pub fn write_bytes<T>(dst: *mut T, val: u8, count: usize); -} - -#[unstable(feature = "unstable", issue = "42")] -#[rustc_const_stable(feature = "stable", since = "1.0.0")] -pub const fn some_unstable_fn() {} diff --git a/tests/ui/consts/auxiliary/unstable_intrinsic.rs b/tests/ui/consts/auxiliary/unstable_intrinsic.rs new file mode 100644 index 00000000000..9e53a8feb5d --- /dev/null +++ b/tests/ui/consts/auxiliary/unstable_intrinsic.rs @@ -0,0 +1,13 @@ +#![feature(staged_api, rustc_attrs, intrinsics)] +#![stable(since="1.0.0", feature = "stable")] + +#[unstable(feature = "unstable", issue = "42")] +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +pub const unsafe fn size_of_val<T>(x: *const T) -> usize { 42 } + +#[unstable(feature = "unstable", issue = "42")] +#[rustc_const_unstable(feature = "unstable", issue = "42")] +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +pub const unsafe fn min_align_of_val<T>(x: *const T) -> usize { 42 } diff --git a/tests/ui/consts/closure-in-foreign-crate.rs b/tests/ui/consts/closure-in-foreign-crate.rs index 701cf091045..423cd582e5e 100644 --- a/tests/ui/consts/closure-in-foreign-crate.rs +++ b/tests/ui/consts/closure-in-foreign-crate.rs @@ -1,8 +1,8 @@ -//@ aux-build:closure-in-foreign-crate.rs +// FIXME(const_trait_impl) aux-build:closure-in-foreign-crate.rs //@ build-pass -extern crate closure_in_foreign_crate; +// FIXME(const_trait_impl) extern crate closure_in_foreign_crate; -const _: () = closure_in_foreign_crate::test(); +// FIXME(const_trait_impl) const _: () = closure_in_foreign_crate::test(); fn main() {} diff --git a/tests/ui/consts/const-block-const-bound.stderr b/tests/ui/consts/const-block-const-bound.stderr index 8cb91d78f6c..5e24959146b 100644 --- a/tests/ui/consts/const-block-const-bound.stderr +++ b/tests/ui/consts/const-block-const-bound.stderr @@ -1,14 +1,14 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-block-const-bound.rs:8:22 + --> $DIR/const-block-const-bound.rs:8:15 | LL | const fn f<T: ~const Destruct>(x: T) {} - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-block-const-bound.rs:8:22 + --> $DIR/const-block-const-bound.rs:8:15 | LL | const fn f<T: ~const Destruct>(x: T) {} - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr index 9dce29732ac..272c2f045e1 100644 --- a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr +++ b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Bar: Copy` is not satisfied --> $DIR/fn-call-in-non-const.rs:14:32 | LL | let _: [Option<Bar>; 2] = [no_copy(); 2]; - | ^^^^^^^^^ the trait `Copy` is not implemented for `Bar`, which is required by `Option<Bar>: Copy` + | ^^^^^^^^^ the trait `Copy` is not implemented for `Bar` | = note: required for `Option<Bar>` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array diff --git a/tests/ui/consts/const-blocks/migrate-fail.stderr b/tests/ui/consts/const-blocks/migrate-fail.stderr index 3887658f748..3c116026e58 100644 --- a/tests/ui/consts/const-blocks/migrate-fail.stderr +++ b/tests/ui/consts/const-blocks/migrate-fail.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Bar: Copy` is not satisfied --> $DIR/migrate-fail.rs:11:38 | LL | let arr: [Option<Bar>; 2] = [x; 2]; - | ^ the trait `Copy` is not implemented for `Bar`, which is required by `Option<Bar>: Copy` + | ^ the trait `Copy` is not implemented for `Bar` | = note: required for `Option<Bar>` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array @@ -18,7 +18,7 @@ error[E0277]: the trait bound `Bar: Copy` is not satisfied --> $DIR/migrate-fail.rs:17:38 | LL | let arr: [Option<Bar>; 2] = [x; 2]; - | ^ the trait `Copy` is not implemented for `Bar`, which is required by `Option<Bar>: Copy` + | ^ the trait `Copy` is not implemented for `Bar` | = note: required for `Option<Bar>` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array diff --git a/tests/ui/consts/const-blocks/nll-fail.stderr b/tests/ui/consts/const-blocks/nll-fail.stderr index a2ea833f650..ff2b62da668 100644 --- a/tests/ui/consts/const-blocks/nll-fail.stderr +++ b/tests/ui/consts/const-blocks/nll-fail.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Bar: Copy` is not satisfied --> $DIR/nll-fail.rs:11:38 | LL | let arr: [Option<Bar>; 2] = [x; 2]; - | ^ the trait `Copy` is not implemented for `Bar`, which is required by `Option<Bar>: Copy` + | ^ the trait `Copy` is not implemented for `Bar` | = note: required for `Option<Bar>` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array @@ -18,7 +18,7 @@ error[E0277]: the trait bound `Bar: Copy` is not satisfied --> $DIR/nll-fail.rs:17:38 | LL | let arr: [Option<Bar>; 2] = [x; 2]; - | ^ the trait `Copy` is not implemented for `Bar`, which is required by `Option<Bar>: Copy` + | ^ the trait `Copy` is not implemented for `Bar` | = note: required for `Option<Bar>` to implement `Copy` = note: the `Copy` trait is required because this value will be copied for each element of the array diff --git a/tests/ui/consts/const-blocks/trait-error.stderr b/tests/ui/consts/const-blocks/trait-error.stderr index 8f00f14dfb9..068720a53f6 100644 --- a/tests/ui/consts/const-blocks/trait-error.stderr +++ b/tests/ui/consts/const-blocks/trait-error.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `String: Copy` is not satisfied LL | [Foo(String::new()); 4]; | ^^^^^^^^^^^^^^^^^^ | | - | the trait `Copy` is not implemented for `String`, which is required by `Foo<String>: Copy` + | the trait `Copy` is not implemented for `String` | help: create an inline `const` block: `const { Foo(String::new()) }` | note: required for `Foo<String>` to implement `Copy` diff --git a/tests/ui/consts/const-compare-bytes-ub.rs b/tests/ui/consts/const-compare-bytes-ub.rs index 903ba15e622..9dafae1efd1 100644 --- a/tests/ui/consts/const-compare-bytes-ub.rs +++ b/tests/ui/consts/const-compare-bytes-ub.rs @@ -1,7 +1,6 @@ //@ check-fail #![feature(core_intrinsics)] -#![feature(const_intrinsic_compare_bytes)] use std::intrinsics::compare_bytes; use std::mem::MaybeUninit; diff --git a/tests/ui/consts/const-compare-bytes-ub.stderr b/tests/ui/consts/const-compare-bytes-ub.stderr index 7f83dee6409..9ef5c8ad43a 100644 --- a/tests/ui/consts/const-compare-bytes-ub.stderr +++ b/tests/ui/consts/const-compare-bytes-ub.stderr @@ -1,47 +1,47 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const-compare-bytes-ub.rs:10:9 + --> $DIR/const-compare-bytes-ub.rs:9:9 | LL | compare_bytes(0 as *const u8, 2 as *const u8, 1) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 1 byte of memory, but got a null pointer error[E0080]: evaluation of constant value failed - --> $DIR/const-compare-bytes-ub.rs:14:9 + --> $DIR/const-compare-bytes-ub.rs:13:9 | LL | compare_bytes(1 as *const u8, 0 as *const u8, 1) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 1 byte of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance) error[E0080]: evaluation of constant value failed - --> $DIR/const-compare-bytes-ub.rs:18:9 + --> $DIR/const-compare-bytes-ub.rs:17:9 | LL | compare_bytes(1 as *const u8, 2 as *const u8, 1) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 1 byte of memory, but got 0x1[noalloc] which is a dangling pointer (it has no provenance) error[E0080]: evaluation of constant value failed - --> $DIR/const-compare-bytes-ub.rs:22:9 + --> $DIR/const-compare-bytes-ub.rs:21:9 | LL | compare_bytes([1, 2, 3].as_ptr(), [1, 2, 3, 4].as_ptr(), 4) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0 which is only 3 bytes from the end of the allocation error[E0080]: evaluation of constant value failed - --> $DIR/const-compare-bytes-ub.rs:26:9 + --> $DIR/const-compare-bytes-ub.rs:25:9 | LL | compare_bytes([1, 2, 3, 4].as_ptr(), [1, 2, 3].as_ptr(), 4) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC1 which is only 3 bytes from the end of the allocation error[E0080]: evaluation of constant value failed - --> $DIR/const-compare-bytes-ub.rs:30:9 + --> $DIR/const-compare-bytes-ub.rs:29:9 | LL | compare_bytes(MaybeUninit::uninit().as_ptr(), [1].as_ptr(), 1) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC2[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory error[E0080]: evaluation of constant value failed - --> $DIR/const-compare-bytes-ub.rs:34:9 + --> $DIR/const-compare-bytes-ub.rs:33:9 | LL | compare_bytes([1].as_ptr(), MaybeUninit::uninit().as_ptr(), 1) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC3[0x0..0x1], but memory is uninitialized at [0x0..0x1], and this operation requires initialized memory error[E0080]: evaluation of constant value failed - --> $DIR/const-compare-bytes-ub.rs:38:9 + --> $DIR/const-compare-bytes-ub.rs:37:9 | LL | compare_bytes([&1].as_ptr().cast(), [&2].as_ptr().cast(), std::mem::size_of::<usize>()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer diff --git a/tests/ui/consts/const-compare-bytes.rs b/tests/ui/consts/const-compare-bytes.rs index 8596a2d9df9..cd5cdfd0400 100644 --- a/tests/ui/consts/const-compare-bytes.rs +++ b/tests/ui/consts/const-compare-bytes.rs @@ -1,7 +1,6 @@ //@ run-pass #![feature(core_intrinsics)] -#![feature(const_intrinsic_compare_bytes)] use std::intrinsics::compare_bytes; fn main() { diff --git a/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.rs b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.rs index 4b3cf70739c..6c93c0e63b6 100644 --- a/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.rs +++ b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.rs @@ -3,7 +3,7 @@ we're apparently really bad at it", issue = "none")] -#![feature(staged_api)] +#![feature(staged_api, foo)] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature="foo", issue = "none")] @@ -11,7 +11,7 @@ const fn foo() -> u32 { 42 } fn meh() -> u32 { 42 } -const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a const fn +const fn bar() -> u32 { foo() } //~ ERROR cannot use `#[feature(foo)]` fn a() { let _: &'static u32 = &foo(); //~ ERROR temporary value dropped while borrowed diff --git a/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr index 2e697b219c5..1de1c78faf6 100644 --- a/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr +++ b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr @@ -1,10 +1,20 @@ -error: `foo` is not yet stable as a const fn +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(foo)]` --> $DIR/dont_promote_unstable_const_fn.rs:14:25 | LL | const fn bar() -> u32 { foo() } | ^^^^^ | - = help: add `#![feature(foo)]` to the crate attributes to enable + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn bar() -> u32 { foo() } + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(foo)] +LL | const fn bar() -> u32 { foo() } + | error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn.rs:17:28 diff --git a/tests/ui/consts/const-eval/raw-pointer-ub.stderr b/tests/ui/consts/const-eval/raw-pointer-ub.stderr index 3426a768cb6..c3360c8b3e2 100644 --- a/tests/ui/consts/const-eval/raw-pointer-ub.stderr +++ b/tests/ui/consts/const-eval/raw-pointer-ub.stderr @@ -11,12 +11,12 @@ LL | *ptr = 0; | ^^^^^^^^ accessing memory based on pointer with alignment 1, but alignment 4 is required error[E0080]: evaluation of constant value failed - --> $SRC_DIR/core/src/intrinsics.rs:LL:COL + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL | = note: accessing memory with alignment 1, but alignment 4 is required | note: inside `copy_nonoverlapping::<u32>` - --> $SRC_DIR/core/src/intrinsics.rs:LL:COL + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL note: inside `std::ptr::const_ptr::<impl *const u32>::copy_to_nonoverlapping` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `MISALIGNED_COPY` diff --git a/tests/ui/consts/const-eval/simd/insert_extract.rs b/tests/ui/consts/const-eval/simd/insert_extract.rs index f4f25327aaf..e5873ea26e8 100644 --- a/tests/ui/consts/const-eval/simd/insert_extract.rs +++ b/tests/ui/consts/const-eval/simd/insert_extract.rs @@ -1,6 +1,6 @@ //@ run-pass #![feature(repr_simd)] -#![feature(intrinsics)] +#![feature(intrinsics, rustc_attrs)] #![feature(staged_api)] #![stable(feature = "foo", since = "1.3.37")] #![allow(non_camel_case_types)] @@ -10,11 +10,18 @@ #[repr(simd)] struct u16x2([u16; 2]); #[repr(simd)] struct f32x4([f32; 4]); -extern "rust-intrinsic" { - #[rustc_const_stable(feature = "foo", since = "1.3.37")] - fn simd_insert<T, U>(x: T, idx: u32, val: U) -> T; - #[rustc_const_stable(feature = "foo", since = "1.3.37")] - fn simd_extract<T, U>(x: T, idx: u32) -> U; +#[stable(feature = "foo", since = "1.3.37")] +#[rustc_const_stable(feature = "foo", since = "1.3.37")] +#[rustc_intrinsic] +const unsafe fn simd_insert<T, U>(_x: T, _idx: u32, _val: U) -> T { + unimplemented!() +} + +#[stable(feature = "foo", since = "1.3.37")] +#[rustc_const_stable(feature = "foo", since = "1.3.37")] +#[rustc_intrinsic] +const unsafe fn simd_extract<T, U>(_x: T, _idx: u32) -> U { + unimplemented!() } fn main() { diff --git a/tests/ui/consts/const-fn-error.stderr b/tests/ui/consts/const-fn-error.stderr index e886a0b4fe4..42a6f2704c9 100644 --- a/tests/ui/consts/const-fn-error.stderr +++ b/tests/ui/consts/const-fn-error.stderr @@ -22,10 +22,6 @@ LL | for i in 0..x { note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: cannot call non-const fn `<std::ops::Range<usize> as Iterator>::next` in constant functions --> $DIR/const-fn-error.rs:5:14 @@ -34,10 +30,6 @@ LL | for i in 0..x { | ^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 3 previous errors diff --git a/tests/ui/consts/const-fn-in-vec.stderr b/tests/ui/consts/const-fn-in-vec.stderr index 7c6b3bee940..b31e180fea2 100644 --- a/tests/ui/consts/const-fn-in-vec.stderr +++ b/tests/ui/consts/const-fn-in-vec.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `String: Copy` is not satisfied LL | static _MAYBE_STRINGS: [Option<String>; 5] = [None; 5]; | ^^^^ | | - | the trait `Copy` is not implemented for `String`, which is required by `Option<String>: Copy` + | the trait `Copy` is not implemented for `String` | help: create an inline `const` block: `const { None }` | = note: required for `Option<String>` to implement `Copy` @@ -27,7 +27,7 @@ error[E0277]: the trait bound `String: Copy` is not satisfied LL | let _maybe_strings: [Option<String>; 5] = [None; 5]; | ^^^^ | | - | the trait `Copy` is not implemented for `String`, which is required by `Option<String>: Copy` + | the trait `Copy` is not implemented for `String` | help: create an inline `const` block: `const { None }` | = note: required for `Option<String>` to implement `Copy` diff --git a/tests/ui/consts/const-for-feature-gate.stderr b/tests/ui/consts/const-for-feature-gate.stderr index 3344611a60c..6e099a3159d 100644 --- a/tests/ui/consts/const-for-feature-gate.stderr +++ b/tests/ui/consts/const-for-feature-gate.stderr @@ -17,10 +17,6 @@ LL | for _ in 0..5 {} note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants --> $DIR/const-for-feature-gate.rs:4:14 @@ -29,10 +25,6 @@ LL | for _ in 0..5 {} | ^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 3 previous errors diff --git a/tests/ui/consts/const-for.stderr b/tests/ui/consts/const-for.stderr index 2b817c2d20c..78336dc93e8 100644 --- a/tests/ui/consts/const-for.stderr +++ b/tests/ui/consts/const-for.stderr @@ -7,10 +7,6 @@ LL | for _ in 0..5 {} note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants --> $DIR/const-for.rs:4:14 @@ -19,10 +15,6 @@ LL | for _ in 0..5 {} | ^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 2 previous errors diff --git a/tests/ui/consts/const-ptr-is-null.stderr b/tests/ui/consts/const-ptr-is-null.stderr index 20e44a1401f..5fd35142818 100644 --- a/tests/ui/consts/const-ptr-is-null.stderr +++ b/tests/ui/consts/const-ptr-is-null.stderr @@ -3,7 +3,7 @@ error[E0080]: evaluation of constant value failed | = note: the evaluated program panicked at 'null-ness of this pointer cannot be determined in const context', $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -note: inside `std::ptr::const_ptr::<impl *const T>::is_null::const_impl` +note: inside `std::ptr::const_ptr::<impl *const T>::is_null::compiletime` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `std::ptr::const_ptr::<impl *const i32>::is_null` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL @@ -12,7 +12,7 @@ note: inside `MAYBE_NULL` | LL | assert!(!ptr.wrapping_sub(512).is_null()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-try-feature-gate.stderr b/tests/ui/consts/const-try-feature-gate.stderr index 0c4c16fc56a..dc1dabc2f4f 100644 --- a/tests/ui/consts/const-try-feature-gate.stderr +++ b/tests/ui/consts/const-try-feature-gate.stderr @@ -17,10 +17,6 @@ LL | Some(())?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/option.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: `?` cannot convert from residual of `Option<()>` in constant functions --> $DIR/const-try-feature-gate.rs:4:5 @@ -31,10 +27,6 @@ LL | Some(())?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/option.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 3 previous errors diff --git a/tests/ui/consts/const-try.rs b/tests/ui/consts/const-try.rs index 2862b6ffb17..d30b22accef 100644 --- a/tests/ui/consts/const-try.rs +++ b/tests/ui/consts/const-try.rs @@ -4,9 +4,8 @@ #![crate_type = "lib"] #![feature(try_trait_v2)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #![feature(const_try)] -#![allow(incomplete_features)] use std::ops::{ControlFlow, FromResidual, Try}; @@ -34,6 +33,8 @@ impl const Try for TryMe { const fn t() -> TryMe { TryMe?; + //~^ ERROR `?` cannot determine the branch of `TryMe` in constant functions + //~| ERROR `?` cannot convert from residual of `TryMe` in constant functions TryMe } diff --git a/tests/ui/consts/const-try.stderr b/tests/ui/consts/const-try.stderr index ba9da242107..1f4f814cb93 100644 --- a/tests/ui/consts/const-try.stderr +++ b/tests/ui/consts/const-try.stderr @@ -1,5 +1,5 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_trait]` - --> $DIR/const-try.rs:16:12 + --> $DIR/const-try.rs:15:12 | LL | impl const FromResidual<Error> for TryMe { | ^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | impl const FromResidual<Error> for TryMe { = note: adding a non-const method body in the future would be a breaking change error: const `impl` for trait `Try` which is not marked with `#[const_trait]` - --> $DIR/const-try.rs:23:12 + --> $DIR/const-try.rs:22:12 | LL | impl const Try for TryMe { | ^^^ @@ -16,5 +16,22 @@ LL | impl const Try for TryMe { = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change -error: aborting due to 2 previous errors +error[E0015]: `?` cannot determine the branch of `TryMe` in constant functions + --> $DIR/const-try.rs:35:5 + | +LL | TryMe?; + | ^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error[E0015]: `?` cannot convert from residual of `TryMe` in constant functions + --> $DIR/const-try.rs:35:5 + | +LL | TryMe?; + | ^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/const-unstable-intrinsic.rs b/tests/ui/consts/const-unstable-intrinsic.rs new file mode 100644 index 00000000000..56b552b6a3f --- /dev/null +++ b/tests/ui/consts/const-unstable-intrinsic.rs @@ -0,0 +1,64 @@ +//! Ensure that unstable intrinsics can actually not be called, +//! neither within a crate nor cross-crate. +//@ aux-build:unstable_intrinsic.rs +#![feature(staged_api, rustc_attrs, intrinsics)] +#![stable(since="1.0.0", feature = "stable")] +#![feature(local)] + +extern crate unstable_intrinsic; + +fn main() { + const_main(); +} + +const fn const_main() { + let x = 42; + unsafe { + unstable_intrinsic::size_of_val(&x); + //~^ERROR: unstable library feature `unstable` + //~|ERROR: cannot be (indirectly) exposed to stable + unstable_intrinsic::min_align_of_val(&x); + //~^ERROR: unstable library feature `unstable` + //~|ERROR: not yet stable as a const intrinsic + + size_of_val(&x); + //~^ERROR: cannot be (indirectly) exposed to stable + min_align_of_val(&x); + //~^ERROR: cannot use `#[feature(local)]` + } +} + +#[unstable(feature = "local", issue = "42")] +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +pub const unsafe fn size_of_val<T>(x: *const T) -> usize { 42 } + +#[unstable(feature = "local", issue = "42")] +#[rustc_const_unstable(feature = "local", issue = "42")] +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +pub const unsafe fn min_align_of_val<T>(x: *const T) -> usize { 42 } + +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] +#[inline] +pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) { + // Const stability attributes are not inherited from parent items. + #[rustc_intrinsic] + #[rustc_intrinsic_must_be_overridden] + const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) { + unimplemented!() + } + + unsafe { copy(src, dst, count) } + //~^ ERROR cannot be (indirectly) exposed to stable +} + +// Ensure that a fallback body is recursively-const-checked. +mod fallback { + #[rustc_intrinsic] + const unsafe fn copy<T>(src: *const T, _dst: *mut T, _count: usize) { + super::size_of_val(src); + //~^ ERROR cannot be (indirectly) exposed to stable + } +} diff --git a/tests/ui/consts/const-unstable-intrinsic.stderr b/tests/ui/consts/const-unstable-intrinsic.stderr new file mode 100644 index 00000000000..3e605f3d003 --- /dev/null +++ b/tests/ui/consts/const-unstable-intrinsic.stderr @@ -0,0 +1,80 @@ +error[E0658]: use of unstable library feature `unstable` + --> $DIR/const-unstable-intrinsic.rs:17:9 + | +LL | unstable_intrinsic::size_of_val(&x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #42 <https://github.com/rust-lang/rust/issues/42> for more information + = help: add `#![feature(unstable)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: use of unstable library feature `unstable` + --> $DIR/const-unstable-intrinsic.rs:20:9 + | +LL | unstable_intrinsic::min_align_of_val(&x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #42 <https://github.com/rust-lang/rust/issues/42> for more information + = help: add `#![feature(unstable)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: intrinsic `unstable_intrinsic::size_of_val` cannot be (indirectly) exposed to stable + --> $DIR/const-unstable-intrinsic.rs:17:9 + | +LL | unstable_intrinsic::size_of_val(&x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: mark the caller as `#[rustc_const_unstable]`, or mark the intrinsic `#[rustc_const_stable_intrinsic]` (but this requires team approval) + +error: `min_align_of_val` is not yet stable as a const intrinsic + --> $DIR/const-unstable-intrinsic.rs:20:9 + | +LL | unstable_intrinsic::min_align_of_val(&x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(unstable)]` to the crate attributes to enable + +error: intrinsic `size_of_val` cannot be (indirectly) exposed to stable + --> $DIR/const-unstable-intrinsic.rs:24:9 + | +LL | size_of_val(&x); + | ^^^^^^^^^^^^^^^ + | + = help: mark the caller as `#[rustc_const_unstable]`, or mark the intrinsic `#[rustc_const_stable_intrinsic]` (but this requires team approval) + +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(local)]` + --> $DIR/const-unstable-intrinsic.rs:26:9 + | +LL | min_align_of_val(&x); + | ^^^^^^^^^^^^^^^^^^^^ + | +help: if the function is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn const_main() { + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(local)] +LL | const fn const_main() { + | + +error: intrinsic `copy::copy` cannot be (indirectly) exposed to stable + --> $DIR/const-unstable-intrinsic.rs:53:14 + | +LL | unsafe { copy(src, dst, count) } + | ^^^^^^^^^^^^^^^^^^^^^ + | + = help: mark the caller as `#[rustc_const_unstable]`, or mark the intrinsic `#[rustc_const_stable_intrinsic]` (but this requires team approval) + +error: intrinsic `size_of_val` cannot be (indirectly) exposed to stable + --> $DIR/const-unstable-intrinsic.rs:61:9 + | +LL | super::size_of_val(src); + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: mark the caller as `#[rustc_const_unstable]`, or mark the intrinsic `#[rustc_const_stable_intrinsic]` (but this requires team approval) + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/consts/const_cmp_type_id.rs b/tests/ui/consts/const_cmp_type_id.rs index 77482007be4..e89b8d37787 100644 --- a/tests/ui/consts/const_cmp_type_id.rs +++ b/tests/ui/consts/const_cmp_type_id.rs @@ -1,17 +1,17 @@ -//@ check-pass //@ compile-flags: -Znext-solver -#![feature(const_type_id, const_trait_impl, effects)] -#![allow(incomplete_features)] +#![feature(const_type_id, const_trait_impl)] use std::any::TypeId; fn main() { const { - // FIXME(effects) this isn't supposed to pass (right now) but it did. - // revisit binops typeck please. assert!(TypeId::of::<u8>() == TypeId::of::<u8>()); + //~^ ERROR cannot call non-const operator in constants assert!(TypeId::of::<()>() != TypeId::of::<u8>()); + //~^ ERROR cannot call non-const operator in constants let _a = TypeId::of::<u8>() < TypeId::of::<u16>(); + //~^ ERROR cannot call non-const operator in constants // can't assert `_a` because it is not deterministic + // FIXME(const_trait_impl) make it pass } } diff --git a/tests/ui/consts/const_cmp_type_id.stderr b/tests/ui/consts/const_cmp_type_id.stderr new file mode 100644 index 00000000000..2e9a8024eae --- /dev/null +++ b/tests/ui/consts/const_cmp_type_id.stderr @@ -0,0 +1,34 @@ +error[E0015]: cannot call non-const operator in constants + --> $DIR/const_cmp_type_id.rs:8:17 + | +LL | assert!(TypeId::of::<u8>() == TypeId::of::<u8>()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: impl defined here, but it is not `const` + --> $SRC_DIR/core/src/any.rs:LL:COL + = 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_cmp_type_id.rs:10:17 + | +LL | assert!(TypeId::of::<()>() != TypeId::of::<u8>()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: impl defined here, but it is not `const` + --> $SRC_DIR/core/src/any.rs:LL:COL + = 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_cmp_type_id.rs:12:18 + | +LL | let _a = TypeId::of::<u8>() < TypeId::of::<u16>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: impl defined here, but it is not `const` + --> $SRC_DIR/core/src/any.rs:LL:COL + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/constifconst-call-in-const-position.rs b/tests/ui/consts/constifconst-call-in-const-position.rs index 757e35bbab2..80e47c2230f 100644 --- a/tests/ui/consts/constifconst-call-in-const-position.rs +++ b/tests/ui/consts/constifconst-call-in-const-position.rs @@ -1,6 +1,6 @@ //@ known-bug: #102498 -#![feature(const_trait_impl, effects, generic_const_exprs)] +#![feature(const_trait_impl, generic_const_exprs)] #![allow(incomplete_features)] #[const_trait] diff --git a/tests/ui/consts/constifconst-call-in-const-position.stderr b/tests/ui/consts/constifconst-call-in-const-position.stderr index 2195cab3f4d..6add83dc52c 100644 --- a/tests/ui/consts/constifconst-call-in-const-position.stderr +++ b/tests/ui/consts/constifconst-call-in-const-position.stderr @@ -1,14 +1,15 @@ -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - -error[E0080]: evaluation of `foo::<()>::{constant#0}` failed +error[E0277]: the trait bound `T: const Tr` is not satisfied --> $DIR/constifconst-call-in-const-position.rs:17:38 | LL | const fn foo<T: ~const Tr>() -> [u8; T::a()] { - | ^^^^^^ calling non-const function `<() as Tr>::a` + | ^^^^^^ + +error[E0277]: the trait bound `T: const Tr` is not satisfied + --> $DIR/constifconst-call-in-const-position.rs:18:9 + | +LL | [0; T::a()] + | ^^^^^^ error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0080`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/consts/control-flow/loop.stderr b/tests/ui/consts/control-flow/loop.stderr index 13d5d3e0b55..5e43c70e9df 100644 --- a/tests/ui/consts/control-flow/loop.stderr +++ b/tests/ui/consts/control-flow/loop.stderr @@ -35,10 +35,6 @@ LL | for i in 0..4 { note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants --> $DIR/loop.rs:53:14 @@ -47,10 +43,6 @@ LL | for i in 0..4 { | ^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: cannot convert `std::ops::Range<i32>` into an iterator in constants --> $DIR/loop.rs:59:14 @@ -61,10 +53,6 @@ LL | for i in 0..4 { note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants --> $DIR/loop.rs:59:14 @@ -73,10 +61,6 @@ LL | for i in 0..4 { | ^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 6 previous errors diff --git a/tests/ui/consts/control-flow/try.stderr b/tests/ui/consts/control-flow/try.stderr index e08f52369fa..5e2c77318e7 100644 --- a/tests/ui/consts/control-flow/try.stderr +++ b/tests/ui/consts/control-flow/try.stderr @@ -17,10 +17,6 @@ LL | x?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/option.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: `?` cannot convert from residual of `Option<i32>` in constant functions --> $DIR/try.rs:6:5 @@ -31,10 +27,6 @@ LL | x?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/option.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 3 previous errors diff --git a/tests/ui/consts/copy-intrinsic.rs b/tests/ui/consts/copy-intrinsic.rs index 805c03da546..08fbcc107e7 100644 --- a/tests/ui/consts/copy-intrinsic.rs +++ b/tests/ui/consts/copy-intrinsic.rs @@ -1,15 +1,21 @@ #![stable(feature = "dummy", since = "1.0.0")] // ignore-tidy-linelength -#![feature(intrinsics, staged_api)] +#![feature(intrinsics, staged_api, rustc_attrs)] use std::mem; -extern "rust-intrinsic" { - #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] - fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize); +#[stable(feature = "dummy", since = "1.0.0")] +#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] +#[rustc_intrinsic] +const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) { + unimplemented!() +} - #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] - fn copy<T>(src: *const T, dst: *mut T, count: usize); +#[stable(feature = "dummy", since = "1.0.0")] +#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] +#[rustc_intrinsic] +const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) { + unimplemented!() } const COPY_ZERO: () = unsafe { diff --git a/tests/ui/consts/copy-intrinsic.stderr b/tests/ui/consts/copy-intrinsic.stderr index da8139129c9..41af3a2cd2d 100644 --- a/tests/ui/consts/copy-intrinsic.stderr +++ b/tests/ui/consts/copy-intrinsic.stderr @@ -1,23 +1,23 @@ error[E0080]: evaluation of constant value failed - --> $DIR/copy-intrinsic.rs:28:5 + --> $DIR/copy-intrinsic.rs:34:5 | LL | copy_nonoverlapping(0x100 as *const i32, dangle, 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got 0x100[noalloc] which is a dangling pointer (it has no provenance) error[E0080]: evaluation of constant value failed - --> $DIR/copy-intrinsic.rs:37:5 + --> $DIR/copy-intrinsic.rs:43:5 | LL | copy_nonoverlapping(dangle, 0x100 as *mut i32, 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: expected a pointer to 4 bytes of memory, but got ALLOC0+0x28 which is at or beyond the end of the allocation of size 4 bytes error[E0080]: evaluation of constant value failed - --> $DIR/copy-intrinsic.rs:44:5 + --> $DIR/copy-intrinsic.rs:50:5 | LL | copy(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow computing total size of `copy` error[E0080]: evaluation of constant value failed - --> $DIR/copy-intrinsic.rs:50:5 + --> $DIR/copy-intrinsic.rs:56:5 | LL | copy_nonoverlapping(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflow computing total size of `copy_nonoverlapping` diff --git a/tests/ui/consts/fn_trait_refs.stderr b/tests/ui/consts/fn_trait_refs.stderr index 2b012432afd..a686bc23c0f 100644 --- a/tests/ui/consts/fn_trait_refs.stderr +++ b/tests/ui/consts/fn_trait_refs.stderr @@ -11,168 +11,168 @@ LL | #![feature(const_cmp)] | ^^^^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:13:15 + --> $DIR/fn_trait_refs.rs:13:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:13:31 + --> $DIR/fn_trait_refs.rs:13:24 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:13:15 + --> $DIR/fn_trait_refs.rs:13:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:13:15 + --> $DIR/fn_trait_refs.rs:13:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:13:31 + --> $DIR/fn_trait_refs.rs:13:24 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:20:15 + --> $DIR/fn_trait_refs.rs:20:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:20:34 + --> $DIR/fn_trait_refs.rs:20:27 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:20:15 + --> $DIR/fn_trait_refs.rs:20:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:20:15 + --> $DIR/fn_trait_refs.rs:20:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:20:34 + --> $DIR/fn_trait_refs.rs:20:27 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:27:15 + --> $DIR/fn_trait_refs.rs:27:8 | LL | T: ~const FnOnce<()>, - | ^^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:27:15 + --> $DIR/fn_trait_refs.rs:27:8 | LL | T: ~const FnOnce<()>, - | ^^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:27:15 + --> $DIR/fn_trait_refs.rs:27:8 | LL | T: ~const FnOnce<()>, - | ^^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:34:15 + --> $DIR/fn_trait_refs.rs:34:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:34:31 + --> $DIR/fn_trait_refs.rs:34:24 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:34:15 + --> $DIR/fn_trait_refs.rs:34:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:34:15 + --> $DIR/fn_trait_refs.rs:34:8 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:34:31 + --> $DIR/fn_trait_refs.rs:34:24 | LL | T: ~const Fn<()> + ~const Destruct, - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:48:15 + --> $DIR/fn_trait_refs.rs:48:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:48:34 + --> $DIR/fn_trait_refs.rs:48:27 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:48:15 + --> $DIR/fn_trait_refs.rs:48:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:48:15 + --> $DIR/fn_trait_refs.rs:48:8 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/fn_trait_refs.rs:48:34 + --> $DIR/fn_trait_refs.rs:48:27 | LL | T: ~const FnMut<()> + ~const Destruct, - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` @@ -183,10 +183,6 @@ LL | assert!(test_one == (1, 1, 1)); | ^^^^^^^^^^^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error[E0015]: cannot call non-const operator in constants --> $DIR/fn_trait_refs.rs:73:17 @@ -195,10 +191,6 @@ LL | assert!(test_two == (2, 2)); | ^^^^^^^^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error[E0015]: cannot call non-const closure in constant functions --> $DIR/fn_trait_refs.rs:15:5 @@ -211,10 +203,6 @@ help: consider further restricting this bound | LL | T: ~const Fn<()> + ~const Destruct + ~const Fn(), | +++++++++++++ -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error[E0493]: destructor of `T` cannot be evaluated at compile-time --> $DIR/fn_trait_refs.rs:11:23 @@ -236,10 +224,6 @@ help: consider further restricting this bound | LL | T: ~const FnMut<()> + ~const Destruct + ~const FnMut(), | ++++++++++++++++ -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error[E0493]: destructor of `T` cannot be evaluated at compile-time --> $DIR/fn_trait_refs.rs:18:27 @@ -261,10 +245,6 @@ help: consider further restricting this bound | LL | T: ~const FnOnce<()> + ~const FnOnce(), | +++++++++++++++++ -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error[E0493]: destructor of `T` cannot be evaluated at compile-time --> $DIR/fn_trait_refs.rs:32:21 diff --git a/tests/ui/consts/intrinsic_without_const_stab.rs b/tests/ui/consts/intrinsic_without_const_stab.rs deleted file mode 100644 index 40ec65d51be..00000000000 --- a/tests/ui/consts/intrinsic_without_const_stab.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(intrinsics, staged_api)] -#![stable(feature = "core", since = "1.6.0")] - -#[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] -#[inline] -pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) { - // Const stability attributes are not inherited from parent items. - extern "rust-intrinsic" { - fn copy<T>(src: *const T, dst: *mut T, count: usize); - } - - unsafe { copy(src, dst, count) } - //~^ ERROR cannot call non-const fn -} - -fn main() {} diff --git a/tests/ui/consts/intrinsic_without_const_stab_fail.rs b/tests/ui/consts/intrinsic_without_const_stab_fail.rs deleted file mode 100644 index 2b0745b3c11..00000000000 --- a/tests/ui/consts/intrinsic_without_const_stab_fail.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![feature(intrinsics, staged_api)] -#![stable(feature = "core", since = "1.6.0")] - -extern "rust-intrinsic" { - fn copy<T>(src: *const T, dst: *mut T, count: usize); -} - -#[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] -#[inline] -pub const unsafe fn stuff<T>(src: *const T, dst: *mut T, count: usize) { - unsafe { copy(src, dst, count) } //~ ERROR cannot call non-const fn -} - -fn main() {} diff --git a/tests/ui/consts/intrinsic_without_const_stab_fail.stderr b/tests/ui/consts/intrinsic_without_const_stab_fail.stderr deleted file mode 100644 index 8ade68eb2a9..00000000000 --- a/tests/ui/consts/intrinsic_without_const_stab_fail.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0015]: cannot call non-const fn `copy::<T>` in constant functions - --> $DIR/intrinsic_without_const_stab_fail.rs:12:14 - | -LL | unsafe { copy(src, dst, count) } - | ^^^^^^^^^^^^^^^^^^^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/invalid-inline-const-in-match-arm.stderr b/tests/ui/consts/invalid-inline-const-in-match-arm.stderr index 0e41053a29d..2e48837bdcd 100644 --- a/tests/ui/consts/invalid-inline-const-in-match-arm.stderr +++ b/tests/ui/consts/invalid-inline-const-in-match-arm.stderr @@ -6,10 +6,6 @@ LL | const { (|| {})() } => {} | = note: closures need an RFC before allowed to be called in constants = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: could not evaluate constant pattern --> $DIR/invalid-inline-const-in-match-arm.rs:5:9 diff --git a/tests/ui/consts/issue-28113.stderr b/tests/ui/consts/issue-28113.stderr index c2f53870173..401536c1353 100644 --- a/tests/ui/consts/issue-28113.stderr +++ b/tests/ui/consts/issue-28113.stderr @@ -6,10 +6,6 @@ LL | || -> u8 { 5 }() | = note: closures need an RFC before allowed to be called in constants = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 1 previous error diff --git a/tests/ui/consts/issue-56164.stderr b/tests/ui/consts/issue-56164.stderr index 6ec4ce0fbd7..de5a53c9ad2 100644 --- a/tests/ui/consts/issue-56164.stderr +++ b/tests/ui/consts/issue-56164.stderr @@ -6,10 +6,6 @@ LL | const fn foo() { (||{})() } | = note: closures need an RFC before allowed to be called in constant functions = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: function pointer calls are not allowed in constant functions --> $DIR/issue-56164.rs:5:5 diff --git a/tests/ui/consts/issue-68542-closure-in-array-len.stderr b/tests/ui/consts/issue-68542-closure-in-array-len.stderr index b414a6e0dba..9f323b2259f 100644 --- a/tests/ui/consts/issue-68542-closure-in-array-len.stderr +++ b/tests/ui/consts/issue-68542-closure-in-array-len.stderr @@ -6,10 +6,6 @@ LL | a: [(); (|| { 0 })()] | = note: closures need an RFC before allowed to be called in constants = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 1 previous error diff --git a/tests/ui/consts/issue-73976-monomorphic.stderr b/tests/ui/consts/issue-73976-monomorphic.stderr index 79dbed4bea8..ef754b23ff0 100644 --- a/tests/ui/consts/issue-73976-monomorphic.stderr +++ b/tests/ui/consts/issue-73976-monomorphic.stderr @@ -7,10 +7,6 @@ LL | GetTypeId::<T>::VALUE == GetTypeId::<usize>::VALUE note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/any.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 1 previous error diff --git a/tests/ui/consts/issue-90870.rs b/tests/ui/consts/issue-90870.rs index e1929c68c70..b62769a33f8 100644 --- a/tests/ui/consts/issue-90870.rs +++ b/tests/ui/consts/issue-90870.rs @@ -3,9 +3,6 @@ #![allow(dead_code)] const fn f(a: &u8, b: &u8) -> bool { -//~^ HELP: add `#![feature(const_trait_impl)]` -//~| HELP: add `#![feature(const_trait_impl)]` -//~| HELP: add `#![feature(const_trait_impl)]` a == b //~^ ERROR: cannot call non-const operator in constant functions [E0015] //~| HELP: consider dereferencing here diff --git a/tests/ui/consts/issue-90870.stderr b/tests/ui/consts/issue-90870.stderr index df88a0c95cc..ea987920d7d 100644 --- a/tests/ui/consts/issue-90870.stderr +++ b/tests/ui/consts/issue-90870.stderr @@ -1,5 +1,5 @@ error[E0015]: cannot call non-const operator in constant functions - --> $DIR/issue-90870.rs:9:5 + --> $DIR/issue-90870.rs:6:5 | LL | a == b | ^^^^^^ @@ -9,13 +9,9 @@ help: consider dereferencing here | LL | *a == *b | + + -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: cannot call non-const operator in constant functions - --> $DIR/issue-90870.rs:15:5 + --> $DIR/issue-90870.rs:12:5 | LL | a == b | ^^^^^^ @@ -25,13 +21,9 @@ help: consider dereferencing here | LL | ****a == ****b | ++++ ++++ -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: cannot call non-const operator in constant functions - --> $DIR/issue-90870.rs:22:12 + --> $DIR/issue-90870.rs:19:12 | LL | if l == r { | ^^^^^^ @@ -41,10 +33,6 @@ help: consider dereferencing here | LL | if *l == *r { | + + -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 3 previous errors diff --git a/tests/ui/consts/issue-94675.stderr b/tests/ui/consts/issue-94675.stderr index a85c5e10374..8cad13724f2 100644 --- a/tests/ui/consts/issue-94675.stderr +++ b/tests/ui/consts/issue-94675.stderr @@ -7,10 +7,6 @@ LL | self.bar[0] = baz.len(); note: impl defined here, but it is not `const` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 1 previous error diff --git a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs index 461499e942f..d6f07994e82 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs +++ b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs @@ -5,7 +5,7 @@ issue = "none")] #![feature(foo, foo2)] -#![feature(const_async_blocks, staged_api)] +#![feature(const_async_blocks, staged_api, rustc_attrs)] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature="foo", issue = "none")] @@ -14,33 +14,55 @@ const fn foo() -> u32 { 42 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.0.0")] // can't call non-min_const_fn -const fn bar() -> u32 { foo() } //~ ERROR not yet stable as a const fn +const fn bar() -> u32 { foo() } //~ ERROR cannot use `#[feature(foo)]` #[unstable(feature = "foo2", issue = "none")] +#[rustc_const_unstable(feature = "foo2", issue = "none")] const fn foo2() -> u32 { 42 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.0.0")] // can't call non-min_const_fn -const fn bar2() -> u32 { foo2() } //~ ERROR not yet stable as a const fn +const fn bar2() -> u32 { foo2() } //~ ERROR cannot use `#[feature(foo2)]` #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.0.0")] // conformity is required const fn bar3() -> u32 { let x = async { 13 }; - //~^ ERROR const-stable function cannot use `#[feature(const_async_blocks)]` + //~^ ERROR cannot use `#[feature(const_async_blocks)]` foo() - //~^ ERROR is not yet stable as a const fn + //~^ ERROR cannot use `#[feature(foo)]` } // check whether this function cannot be called even with the feature gate active #[unstable(feature = "foo2", issue = "none")] +#[rustc_const_unstable(feature = "foo2", issue = "none")] const fn foo2_gated() -> u32 { 42 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.0.0")] // can't call non-min_const_fn -const fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR not yet stable as a const fn +const fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR cannot use `#[feature(foo2)]` + +// Functions without any attribute are checked like stable functions, +// even if they are in a stable module. +mod stable { + #![stable(feature = "rust1", since = "1.0.0")] + + pub(crate) const fn bar2_gated_stable_indirect() -> u32 { super::foo2_gated() } //~ ERROR cannot use `#[feature(foo2)]` +} +// And same for const-unstable functions that are marked as "stable_indirect". +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_const_unstable(feature="foo", issue = "none")] +#[rustc_const_stable_indirect] +const fn stable_indirect() -> u32 { foo2_gated() } //~ ERROR cannot use `#[feature(foo2)]` + +// These functiuons *can* be called from fully stable functions. +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_const_stable(feature = "rust1", since = "1.0.0")] +const fn bar2_gated_exposed() -> u32 { + stable::bar2_gated_stable_indirect() + stable_indirect() +} fn main() {} diff --git a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr index fedc5a4809d..899cec07ac7 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr +++ b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr @@ -1,51 +1,127 @@ -error: `foo` is not yet stable as a const fn +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(foo)]` --> $DIR/min_const_fn_libstd_stability.rs:17:25 | LL | const fn bar() -> u32 { foo() } | ^^^^^ | - = help: const-stable functions can only call other const-stable functions + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn bar() -> u32 { foo() } + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(foo)] +LL | const fn bar() -> u32 { foo() } + | -error: `foo2` is not yet stable as a const fn - --> $DIR/min_const_fn_libstd_stability.rs:25:26 +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(foo2)]` + --> $DIR/min_const_fn_libstd_stability.rs:26:26 | LL | const fn bar2() -> u32 { foo2() } | ^^^^^^ | - = help: const-stable functions can only call other const-stable functions + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn bar2() -> u32 { foo2() } + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(foo2)] +LL | const fn bar2() -> u32 { foo2() } + | -error: const-stable function cannot use `#[feature(const_async_blocks)]` - --> $DIR/min_const_fn_libstd_stability.rs:31:13 +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_async_blocks)]` + --> $DIR/min_const_fn_libstd_stability.rs:32:13 | LL | let x = async { 13 }; | ^^^^^^^^^^^^ | -help: if the function is not (yet) meant to be stable, make this function unstably const +help: if the function is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) | LL + #[rustc_const_unstable(feature = "...", issue = "...")] LL | const fn bar3() -> u32 { | -help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (but requires team approval) +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) | LL + #[rustc_allow_const_fn_unstable(const_async_blocks)] LL | const fn bar3() -> u32 { | -error: `foo` is not yet stable as a const fn - --> $DIR/min_const_fn_libstd_stability.rs:33:5 +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(foo)]` + --> $DIR/min_const_fn_libstd_stability.rs:34:5 | LL | foo() | ^^^^^ | - = help: const-stable functions can only call other const-stable functions + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn bar3() -> u32 { + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(foo)] +LL | const fn bar3() -> u32 { + | -error: `foo2_gated` is not yet stable as a const fn - --> $DIR/min_const_fn_libstd_stability.rs:44:32 +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(foo2)]` + --> $DIR/min_const_fn_libstd_stability.rs:46:32 | LL | const fn bar2_gated() -> u32 { foo2_gated() } | ^^^^^^^^^^^^ | - = help: const-stable functions can only call other const-stable functions + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn bar2_gated() -> u32 { foo2_gated() } + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(foo2)] +LL | const fn bar2_gated() -> u32 { foo2_gated() } + | + +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(foo2)]` + --> $DIR/min_const_fn_libstd_stability.rs:53:63 + | +LL | pub(crate) const fn bar2_gated_stable_indirect() -> u32 { super::foo2_gated() } + | ^^^^^^^^^^^^^^^^^^^ + | + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | pub(crate) const fn bar2_gated_stable_indirect() -> u32 { super::foo2_gated() } + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(foo2)] +LL | pub(crate) const fn bar2_gated_stable_indirect() -> u32 { super::foo2_gated() } + | + +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(foo2)]` + --> $DIR/min_const_fn_libstd_stability.rs:59:37 + | +LL | const fn stable_indirect() -> u32 { foo2_gated() } + | ^^^^^^^^^^^^ + | + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn stable_indirect() -> u32 { foo2_gated() } + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(foo2)] +LL | const fn stable_indirect() -> u32 { foo2_gated() } + | -error: aborting due to 5 previous errors +error: aborting due to 7 previous errors diff --git a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs index 274b4444799..3e82b9ff924 100644 --- a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs +++ b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs @@ -13,24 +13,26 @@ const unsafe fn foo() -> u32 { 42 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.0.0")] // can't call non-min_const_fn -const unsafe fn bar() -> u32 { unsafe { foo() } } //~ ERROR not yet stable as a const fn +const unsafe fn bar() -> u32 { unsafe { foo() } } //~ ERROR cannot use `#[feature(foo)]` #[unstable(feature = "foo2", issue = "none")] +#[rustc_const_unstable(feature = "foo2", issue = "none")] const unsafe fn foo2() -> u32 { 42 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.0.0")] // can't call non-min_const_fn -const unsafe fn bar2() -> u32 { unsafe { foo2() } } //~ ERROR not yet stable as a const fn +const unsafe fn bar2() -> u32 { unsafe { foo2() } } //~ ERROR cannot use `#[feature(foo2)]` // check whether this function cannot be called even with the feature gate active #[unstable(feature = "foo2", issue = "none")] +#[rustc_const_unstable(feature = "foo2", issue = "none")] const unsafe fn foo2_gated() -> u32 { 42 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.0.0")] // can't call non-min_const_fn const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } } -//~^ ERROR not yet stable as a const fn +//~^ ERROR cannot use `#[feature(foo2)]` fn main() {} diff --git a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr index 353b117efbc..442a079020f 100644 --- a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr +++ b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr @@ -1,26 +1,56 @@ -error: `foo` is not yet stable as a const fn +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(foo)]` --> $DIR/min_const_unsafe_fn_libstd_stability.rs:16:41 | LL | const unsafe fn bar() -> u32 { unsafe { foo() } } | ^^^^^ | - = help: const-stable functions can only call other const-stable functions + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const unsafe fn bar() -> u32 { unsafe { foo() } } + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(foo)] +LL | const unsafe fn bar() -> u32 { unsafe { foo() } } + | -error: `foo2` is not yet stable as a const fn - --> $DIR/min_const_unsafe_fn_libstd_stability.rs:24:42 +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(foo2)]` + --> $DIR/min_const_unsafe_fn_libstd_stability.rs:25:42 | LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } } | ^^^^^^ | - = help: const-stable functions can only call other const-stable functions + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } } + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(foo2)] +LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } } + | -error: `foo2_gated` is not yet stable as a const fn - --> $DIR/min_const_unsafe_fn_libstd_stability.rs:33:48 +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(foo2)]` + --> $DIR/min_const_unsafe_fn_libstd_stability.rs:35:48 | LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } } | ^^^^^^^^^^^^ | - = help: const-stable functions can only call other const-stable functions + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } } + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(foo2)] +LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } } + | error: aborting due to 3 previous errors diff --git a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.rs b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.rs index 94b62071362..cc7eaa51a6f 100644 --- a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.rs +++ b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.rs @@ -13,23 +13,25 @@ const fn foo() -> u32 { 42 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.0.0")] // can't call non-min_const_fn -const unsafe fn bar() -> u32 { foo() } //~ ERROR not yet stable as a const fn +const unsafe fn bar() -> u32 { foo() } //~ ERROR cannot use `#[feature(foo)]` #[unstable(feature = "foo2", issue = "none")] +#[rustc_const_unstable(feature="foo2", issue = "none")] const fn foo2() -> u32 { 42 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.0.0")] // can't call non-min_const_fn -const unsafe fn bar2() -> u32 { foo2() } //~ ERROR not yet stable as a const fn +const unsafe fn bar2() -> u32 { foo2() } //~ ERROR cannot use `#[feature(foo2)]` // check whether this function cannot be called even with the feature gate active #[unstable(feature = "foo2", issue = "none")] +#[rustc_const_unstable(feature="foo2", issue = "none")] const fn foo2_gated() -> u32 { 42 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.0.0")] // can't call non-min_const_fn -const unsafe fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR not yet stable as a const fn +const unsafe fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR cannot use `#[feature(foo2)]` fn main() {} diff --git a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr index e90ba9b912f..ff37cba7b9a 100644 --- a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr +++ b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr @@ -1,26 +1,56 @@ -error: `foo` is not yet stable as a const fn +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(foo)]` --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:16:32 | LL | const unsafe fn bar() -> u32 { foo() } | ^^^^^ | - = help: const-stable functions can only call other const-stable functions + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const unsafe fn bar() -> u32 { foo() } + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(foo)] +LL | const unsafe fn bar() -> u32 { foo() } + | -error: `foo2` is not yet stable as a const fn - --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:24:33 +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(foo2)]` + --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:25:33 | LL | const unsafe fn bar2() -> u32 { foo2() } | ^^^^^^ | - = help: const-stable functions can only call other const-stable functions + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const unsafe fn bar2() -> u32 { foo2() } + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(foo2)] +LL | const unsafe fn bar2() -> u32 { foo2() } + | -error: `foo2_gated` is not yet stable as a const fn - --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:33:39 +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(foo2)]` + --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:35:39 | LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() } | ^^^^^^^^^^^^ | - = help: const-stable functions can only call other const-stable functions + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() } + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(foo2)] +LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() } + | error: aborting due to 3 previous errors diff --git a/tests/ui/consts/promote-not.rs b/tests/ui/consts/promote-not.rs index 80912937f31..207baccd6ab 100644 --- a/tests/ui/consts/promote-not.rs +++ b/tests/ui/consts/promote-not.rs @@ -23,7 +23,7 @@ pub const fn promote_cal(b: bool) -> i32 { 13 } -// We do not promote union field accesses in `fn. +// We do not promote union field accesses in `fn`. union U { x: i32, y: i32 } pub const fn promote_union() { let _x: &'static i32 = &unsafe { U { x: 0 }.x }; //~ ERROR temporary value dropped while borrowed diff --git a/tests/ui/consts/rustc-const-stability-require-const.rs b/tests/ui/consts/rustc-const-stability-require-const.rs index 4fb259b335c..6cc3f0f0da1 100644 --- a/tests/ui/consts/rustc-const-stability-require-const.rs +++ b/tests/ui/consts/rustc-const-stability-require-const.rs @@ -1,16 +1,16 @@ #![crate_type = "lib"] -#![feature(staged_api)] +#![feature(staged_api, rustc_attrs)] #![stable(feature = "foo", since = "1.0.0")] #[stable(feature = "foo", since = "1.0.0")] #[rustc_const_unstable(feature = "const_foo", issue = "none")] pub fn foo() {} -//~^ ERROR attributes `#[rustc_const_unstable]` and `#[rustc_const_stable]` require the function or method to be `const` +//~^ ERROR require the function or method to be `const` #[stable(feature = "bar", since = "1.0.0")] #[rustc_const_stable(feature = "const_bar", since = "1.0.0")] pub fn bar() {} -//~^ ERROR attributes `#[rustc_const_unstable]` and `#[rustc_const_stable]` require the function or method to be `const` +//~^ ERROR require the function or method to be `const` #[stable(feature = "potato", since = "1.0.0")] pub struct Potato; @@ -19,23 +19,23 @@ impl Potato { #[stable(feature = "salad", since = "1.0.0")] #[rustc_const_unstable(feature = "const_salad", issue = "none")] pub fn salad(&self) -> &'static str { "mmmmmm" } - //~^ ERROR attributes `#[rustc_const_unstable]` and `#[rustc_const_stable]` require the function or method to be `const` + //~^ ERROR require the function or method to be `const` #[stable(feature = "roasted", since = "1.0.0")] #[rustc_const_unstable(feature = "const_roasted", issue = "none")] pub fn roasted(&self) -> &'static str { "mmmmmmmmmm" } - //~^ ERROR attributes `#[rustc_const_unstable]` and `#[rustc_const_stable]` require the function or method to be `const` + //~^ ERROR require the function or method to be `const` } #[stable(feature = "bar", since = "1.0.0")] #[rustc_const_stable(feature = "const_bar", since = "1.0.0")] pub extern "C" fn bar_c() {} -//~^ ERROR attributes `#[rustc_const_unstable]` and `#[rustc_const_stable]` require the function or method to be `const` +//~^ ERROR require the function or method to be `const` #[stable(feature = "foo", since = "1.0.0")] #[rustc_const_unstable(feature = "const_foo", issue = "none")] pub extern "C" fn foo_c() {} -//~^ ERROR attributes `#[rustc_const_unstable]` and `#[rustc_const_stable]` require the function or method to be `const` +//~^ ERROR require the function or method to be `const` #[stable(feature = "foobar", since = "1.0.0")] @@ -45,3 +45,20 @@ pub const fn foobar() {} #[stable(feature = "barfoo", since = "1.0.0")] #[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")] pub const fn barfoo() {} + +// `rustc_const_stable` also requires the function to be stable. + +#[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")] +const fn barfoo_unmarked() {} +//~^ ERROR can only be applied to functions that are declared `#[stable]` + +#[unstable(feature = "unstable", issue = "none")] +#[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")] +pub const fn barfoo_unstable() {} +//~^ ERROR can only be applied to functions that are declared `#[stable]` + +// `#[rustc_const_stable_indirect]` also requires a const fn +#[rustc_const_stable_indirect] +#[unstable(feature = "unstable", issue = "none")] +pub fn not_a_const_fn() {} +//~^ ERROR require the function or method to be `const` diff --git a/tests/ui/consts/rustc-const-stability-require-const.stderr b/tests/ui/consts/rustc-const-stability-require-const.stderr index 1027b9311b7..d9a7d37cbcd 100644 --- a/tests/ui/consts/rustc-const-stability-require-const.stderr +++ b/tests/ui/consts/rustc-const-stability-require-const.stderr @@ -1,8 +1,6 @@ -error: attributes `#[rustc_const_unstable]` and `#[rustc_const_stable]` require the function or method to be `const` +error: attributes `#[rustc_const_unstable]`, `#[rustc_const_stable]` and `#[rustc_const_stable_indirect]` require the function or method to be `const` --> $DIR/rustc-const-stability-require-const.rs:7:1 | -LL | #[rustc_const_unstable(feature = "const_foo", issue = "none")] - | -------------------------------------------------------------- attribute specified here LL | pub fn foo() {} | ^^^^^^^^^^^^ | @@ -12,11 +10,9 @@ help: make the function or method const LL | pub fn foo() {} | ^^^^^^^^^^^^ -error: attributes `#[rustc_const_unstable]` and `#[rustc_const_stable]` require the function or method to be `const` +error: attributes `#[rustc_const_unstable]`, `#[rustc_const_stable]` and `#[rustc_const_stable_indirect]` require the function or method to be `const` --> $DIR/rustc-const-stability-require-const.rs:12:1 | -LL | #[rustc_const_stable(feature = "const_bar", since = "1.0.0")] - | ------------------------------------------------------------- attribute specified here LL | pub fn bar() {} | ^^^^^^^^^^^^ | @@ -26,11 +22,9 @@ help: make the function or method const LL | pub fn bar() {} | ^^^^^^^^^^^^ -error: attributes `#[rustc_const_unstable]` and `#[rustc_const_stable]` require the function or method to be `const` +error: attributes `#[rustc_const_unstable]`, `#[rustc_const_stable]` and `#[rustc_const_stable_indirect]` require the function or method to be `const` --> $DIR/rustc-const-stability-require-const.rs:21:5 | -LL | #[rustc_const_unstable(feature = "const_salad", issue = "none")] - | ---------------------------------------------------------------- attribute specified here LL | pub fn salad(&self) -> &'static str { "mmmmmm" } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -40,11 +34,9 @@ help: make the function or method const LL | pub fn salad(&self) -> &'static str { "mmmmmm" } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: attributes `#[rustc_const_unstable]` and `#[rustc_const_stable]` require the function or method to be `const` +error: attributes `#[rustc_const_unstable]`, `#[rustc_const_stable]` and `#[rustc_const_stable_indirect]` require the function or method to be `const` --> $DIR/rustc-const-stability-require-const.rs:26:5 | -LL | #[rustc_const_unstable(feature = "const_roasted", issue = "none")] - | ------------------------------------------------------------------ attribute specified here LL | pub fn roasted(&self) -> &'static str { "mmmmmmmmmm" } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -54,11 +46,9 @@ help: make the function or method const LL | pub fn roasted(&self) -> &'static str { "mmmmmmmmmm" } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: attributes `#[rustc_const_unstable]` and `#[rustc_const_stable]` require the function or method to be `const` +error: attributes `#[rustc_const_unstable]`, `#[rustc_const_stable]` and `#[rustc_const_stable_indirect]` require the function or method to be `const` --> $DIR/rustc-const-stability-require-const.rs:32:1 | -LL | #[rustc_const_stable(feature = "const_bar", since = "1.0.0")] - | ------------------------------------------------------------- attribute specified here LL | pub extern "C" fn bar_c() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -68,11 +58,9 @@ help: make the function or method const LL | pub extern "C" fn bar_c() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: attributes `#[rustc_const_unstable]` and `#[rustc_const_stable]` require the function or method to be `const` +error: attributes `#[rustc_const_unstable]`, `#[rustc_const_stable]` and `#[rustc_const_stable_indirect]` require the function or method to be `const` --> $DIR/rustc-const-stability-require-const.rs:37:1 | -LL | #[rustc_const_unstable(feature = "const_foo", issue = "none")] - | -------------------------------------------------------------- attribute specified here LL | pub extern "C" fn foo_c() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -82,5 +70,33 @@ help: make the function or method const LL | pub extern "C" fn foo_c() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 6 previous errors +error: attribute `#[rustc_const_stable]` can only be applied to functions that are declared `#[stable]` + --> $DIR/rustc-const-stability-require-const.rs:52:1 + | +LL | #[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")] + | ---------------------------------------------------------------- attribute specified here +LL | const fn barfoo_unmarked() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: attribute `#[rustc_const_stable]` can only be applied to functions that are declared `#[stable]` + --> $DIR/rustc-const-stability-require-const.rs:57:1 + | +LL | #[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")] + | ---------------------------------------------------------------- attribute specified here +LL | pub const fn barfoo_unstable() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: attributes `#[rustc_const_unstable]`, `#[rustc_const_stable]` and `#[rustc_const_stable_indirect]` require the function or method to be `const` + --> $DIR/rustc-const-stability-require-const.rs:63:1 + | +LL | pub fn not_a_const_fn() {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +help: make the function or method const + --> $DIR/rustc-const-stability-require-const.rs:63:1 + | +LL | pub fn not_a_const_fn() {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 9 previous errors diff --git a/tests/ui/consts/rustc-impl-const-stability.rs b/tests/ui/consts/rustc-impl-const-stability.rs index af3262ca575..0df8482bec1 100644 --- a/tests/ui/consts/rustc-impl-const-stability.rs +++ b/tests/ui/consts/rustc-impl-const-stability.rs @@ -2,8 +2,7 @@ //@ known-bug: #110395 #![crate_type = "lib"] -#![feature(staged_api, const_trait_impl, effects)] -#![allow(incomplete_features)] +#![feature(staged_api, const_trait_impl)] #![stable(feature = "foo", since = "1.0.0")] #[stable(feature = "potato", since = "1.27.0")] diff --git a/tests/ui/consts/rustc-impl-const-stability.stderr b/tests/ui/consts/rustc-impl-const-stability.stderr index 4a534b3ca14..4a58b5c8603 100644 --- a/tests/ui/consts/rustc-impl-const-stability.stderr +++ b/tests/ui/consts/rustc-impl-const-stability.stderr @@ -1,5 +1,5 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait]` - --> $DIR/rustc-impl-const-stability.rs:16:12 + --> $DIR/rustc-impl-const-stability.rs:15:12 | LL | impl const Default for Data { | ^^^^^^^ diff --git a/tests/ui/consts/try-operator.stderr b/tests/ui/consts/try-operator.stderr index 2c8b4c7fcd9..40d96ed3a10 100644 --- a/tests/ui/consts/try-operator.stderr +++ b/tests/ui/consts/try-operator.stderr @@ -13,10 +13,6 @@ LL | Err(())?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/result.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error[E0015]: `?` cannot convert from residual of `Result<bool, ()>` in constant functions --> $DIR/try-operator.rs:10:9 @@ -27,10 +23,6 @@ LL | Err(())?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/result.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error[E0015]: `?` cannot determine the branch of `Option<()>` in constant functions --> $DIR/try-operator.rs:18:9 @@ -41,10 +33,6 @@ LL | None?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/option.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error[E0015]: `?` cannot convert from residual of `Option<()>` in constant functions --> $DIR/try-operator.rs:18:9 @@ -55,10 +43,6 @@ LL | None?; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/option.rs:LL:COL = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 5 previous errors diff --git a/tests/ui/consts/unstable-const-fn-in-libcore.stderr b/tests/ui/consts/unstable-const-fn-in-libcore.stderr index 59476f98603..2bdec1bf41b 100644 --- a/tests/ui/consts/unstable-const-fn-in-libcore.stderr +++ b/tests/ui/consts/unstable-const-fn-in-libcore.stderr @@ -1,14 +1,14 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/unstable-const-fn-in-libcore.rs:19:39 + --> $DIR/unstable-const-fn-in-libcore.rs:19:32 | LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T { - | ^^^^^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/unstable-const-fn-in-libcore.rs:19:39 + --> $DIR/unstable-const-fn-in-libcore.rs:19:32 | LL | const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T { - | ^^^^^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` @@ -23,10 +23,6 @@ help: consider further restricting this bound | LL | const fn unwrap_or_else<F: ~const FnOnce() -> T + ~const FnOnce()>(self, f: F) -> T { | +++++++++++++++++ -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error[E0493]: destructor of `F` cannot be evaluated at compile-time --> $DIR/unstable-const-fn-in-libcore.rs:19:60 diff --git a/tests/ui/consts/unstable-const-stable.rs b/tests/ui/consts/unstable-const-stable.rs deleted file mode 100644 index f69e8d0efe5..00000000000 --- a/tests/ui/consts/unstable-const-stable.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ aux-build:unstable_but_const_stable.rs - -extern crate unstable_but_const_stable; -use unstable_but_const_stable::*; - -fn main() { - some_unstable_fn(); //~ERROR use of unstable library feature - unsafe { write_bytes(4 as *mut u8, 0, 0) }; //~ERROR use of unstable library feature -} - -const fn const_main() { - some_unstable_fn(); //~ERROR use of unstable library feature - unsafe { write_bytes(4 as *mut u8, 0, 0) }; //~ERROR use of unstable library feature -} diff --git a/tests/ui/consts/unstable-const-stable.stderr b/tests/ui/consts/unstable-const-stable.stderr deleted file mode 100644 index c4ffbbb60db..00000000000 --- a/tests/ui/consts/unstable-const-stable.stderr +++ /dev/null @@ -1,43 +0,0 @@ -error[E0658]: use of unstable library feature 'unstable' - --> $DIR/unstable-const-stable.rs:7:5 - | -LL | some_unstable_fn(); - | ^^^^^^^^^^^^^^^^ - | - = note: see issue #42 <https://github.com/rust-lang/rust/issues/42> for more information - = help: add `#![feature(unstable)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: use of unstable library feature 'unstable' - --> $DIR/unstable-const-stable.rs:8:14 - | -LL | unsafe { write_bytes(4 as *mut u8, 0, 0) }; - | ^^^^^^^^^^^ - | - = note: see issue #42 <https://github.com/rust-lang/rust/issues/42> for more information - = help: add `#![feature(unstable)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: use of unstable library feature 'unstable' - --> $DIR/unstable-const-stable.rs:12:5 - | -LL | some_unstable_fn(); - | ^^^^^^^^^^^^^^^^ - | - = note: see issue #42 <https://github.com/rust-lang/rust/issues/42> for more information - = help: add `#![feature(unstable)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: use of unstable library feature 'unstable' - --> $DIR/unstable-const-stable.rs:13:14 - | -LL | unsafe { write_bytes(4 as *mut u8, 0, 0) }; - | ^^^^^^^^^^^ - | - = note: see issue #42 <https://github.com/rust-lang/rust/issues/42> for more information - = help: add `#![feature(unstable)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/consts/zst_no_llvm_alloc.rs b/tests/ui/consts/zst_no_llvm_alloc.rs index 48ef11e2b58..1e92e3bbd4c 100644 --- a/tests/ui/consts/zst_no_llvm_alloc.rs +++ b/tests/ui/consts/zst_no_llvm_alloc.rs @@ -17,8 +17,11 @@ fn main() { // The exact addresses returned by these library functions are not necessarily stable guarantees // but for now we assert that we're still matching. - assert_eq!(<Vec<i32>>::new().as_ptr(), <&[i32]>::default().as_ptr()); - assert_eq!(<Box<[i32]>>::default().as_ptr(), (&[]).as_ptr()); + #[allow(dangling_pointers_from_temporaries)] + { + assert_eq!(<Vec<i32>>::new().as_ptr(), <&[i32]>::default().as_ptr()); + assert_eq!(<Box<[i32]>>::default().as_ptr(), (&[]).as_ptr()); + }; // statics must have a unique address (see https://github.com/rust-lang/rust/issues/18297, not // clear whether this is a stable guarantee) diff --git a/tests/ui/coroutine/arg-count-mismatch-on-unit-input.stderr b/tests/ui/coroutine/arg-count-mismatch-on-unit-input.stderr index c7d6507fd79..839299f1c94 100644 --- a/tests/ui/coroutine/arg-count-mismatch-on-unit-input.stderr +++ b/tests/ui/coroutine/arg-count-mismatch-on-unit-input.stderr @@ -5,7 +5,10 @@ LL | fn foo() -> impl Coroutine<u8> { | ^^^^^^^^^^^^^^^^^^ expected due to this ... LL | |_: ()| {} - | ------- found signature defined here + | ---------- + | | + | found signature defined here + | return type was inferred to be `{coroutine@$DIR/arg-count-mismatch-on-unit-input.rs:8:5: 8:12}` here | = note: expected coroutine signature `fn(u8) -> _` found coroutine signature `fn(()) -> _` diff --git a/tests/ui/coroutine/clone-impl-async.rs b/tests/ui/coroutine/clone-impl-async.rs index d7ba1143b5c..2794b167aa2 100644 --- a/tests/ui/coroutine/clone-impl-async.rs +++ b/tests/ui/coroutine/clone-impl-async.rs @@ -1,4 +1,5 @@ //@ edition:2021 +//@compile-flags: --diagnostic-width=300 // gate-test-coroutine_clone // Verifies that feature(coroutine_clone) doesn't allow async blocks to be cloned/copied. diff --git a/tests/ui/coroutine/clone-impl-async.stderr b/tests/ui/coroutine/clone-impl-async.stderr index b5074911aa9..62bcce2fbcb 100644 --- a/tests/ui/coroutine/clone-impl-async.stderr +++ b/tests/ui/coroutine/clone-impl-async.stderr @@ -1,89 +1,89 @@ -error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:12:27: 12:32}: Copy` is not satisfied - --> $DIR/clone-impl-async.rs:17:16 +error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:18:16 | LL | check_copy(&inner_non_clone); - | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:12:27: 12:32}` + | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}` | | | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:69:18 + --> $DIR/clone-impl-async.rs:70:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:12:27: 12:32}: Clone` is not satisfied - --> $DIR/clone-impl-async.rs:19:17 +error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:20:17 | LL | check_clone(&inner_non_clone); - | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:12:27: 12:32}` + | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:13:27: 13:32}` | | | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:70:19 + --> $DIR/clone-impl-async.rs:71:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` -error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:23:27: 23:37}: Copy` is not satisfied - --> $DIR/clone-impl-async.rs:26:16 +error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:27:16 | LL | check_copy(&outer_non_clone); - | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:23:27: 23:37}` + | ---------- ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}` | | | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:69:18 + --> $DIR/clone-impl-async.rs:70:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:23:27: 23:37}: Clone` is not satisfied - --> $DIR/clone-impl-async.rs:28:17 +error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:29:17 | LL | check_clone(&outer_non_clone); - | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:23:27: 23:37}` + | ----------- ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:24:27: 24:37}` | | | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:70:19 + --> $DIR/clone-impl-async.rs:71:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` -error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:31:28: 31:38}: Copy` is not satisfied - --> $DIR/clone-impl-async.rs:32:16 +error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}: Copy` is not satisfied + --> $DIR/clone-impl-async.rs:33:16 | LL | check_copy(&maybe_copy_clone); - | ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:31:28: 31:38}` + | ---------- ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}` | | | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:69:18 + --> $DIR/clone-impl-async.rs:70:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:31:28: 31:38}: Clone` is not satisfied - --> $DIR/clone-impl-async.rs:34:17 +error[E0277]: the trait bound `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}: Clone` is not satisfied + --> $DIR/clone-impl-async.rs:35:17 | LL | check_clone(&maybe_copy_clone); - | ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:31:28: 31:38}` + | ----------- ^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `{async block@$DIR/clone-impl-async.rs:32:28: 32:38}` | | | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:70:19 + --> $DIR/clone-impl-async.rs:71:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied - --> $DIR/clone-impl-async.rs:38:16 + --> $DIR/clone-impl-async.rs:39:16 | LL | check_copy(&inner_non_clone_fn); | ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>` @@ -91,13 +91,13 @@ LL | check_copy(&inner_non_clone_fn); | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:69:18 + --> $DIR/clone-impl-async.rs:70:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied - --> $DIR/clone-impl-async.rs:40:17 + --> $DIR/clone-impl-async.rs:41:17 | LL | check_clone(&inner_non_clone_fn); | ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>` @@ -105,13 +105,13 @@ LL | check_clone(&inner_non_clone_fn); | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:70:19 + --> $DIR/clone-impl-async.rs:71:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied - --> $DIR/clone-impl-async.rs:44:16 + --> $DIR/clone-impl-async.rs:45:16 | LL | check_copy(&outer_non_clone_fn); | ---------- ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>` @@ -119,13 +119,13 @@ LL | check_copy(&outer_non_clone_fn); | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:69:18 + --> $DIR/clone-impl-async.rs:70:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied - --> $DIR/clone-impl-async.rs:46:17 + --> $DIR/clone-impl-async.rs:47:17 | LL | check_clone(&outer_non_clone_fn); | ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>` @@ -133,13 +133,13 @@ LL | check_clone(&outer_non_clone_fn); | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:70:19 + --> $DIR/clone-impl-async.rs:71:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` error[E0277]: the trait bound `impl Future<Output = ()>: Copy` is not satisfied - --> $DIR/clone-impl-async.rs:50:16 + --> $DIR/clone-impl-async.rs:51:16 | LL | check_copy(&maybe_copy_clone_fn); | ---------- ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `impl Future<Output = ()>` @@ -147,13 +147,13 @@ LL | check_copy(&maybe_copy_clone_fn); | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-async.rs:69:18 + --> $DIR/clone-impl-async.rs:70:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` error[E0277]: the trait bound `impl Future<Output = ()>: Clone` is not satisfied - --> $DIR/clone-impl-async.rs:52:17 + --> $DIR/clone-impl-async.rs:53:17 | LL | check_clone(&maybe_copy_clone_fn); | ----------- ^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `impl Future<Output = ()>` @@ -161,7 +161,7 @@ LL | check_clone(&maybe_copy_clone_fn); | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-async.rs:70:19 + --> $DIR/clone-impl-async.rs:71:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` diff --git a/tests/ui/coroutine/clone-impl-static.rs b/tests/ui/coroutine/clone-impl-static.rs index 56d1ccac703..62d4392e30c 100644 --- a/tests/ui/coroutine/clone-impl-static.rs +++ b/tests/ui/coroutine/clone-impl-static.rs @@ -1,3 +1,4 @@ +//@compile-flags: --diagnostic-width=300 // gate-test-coroutine_clone // Verifies that static coroutines cannot be cloned/copied. diff --git a/tests/ui/coroutine/clone-impl-static.stderr b/tests/ui/coroutine/clone-impl-static.stderr index 43920326d5d..bf16b166960 100644 --- a/tests/ui/coroutine/clone-impl-static.stderr +++ b/tests/ui/coroutine/clone-impl-static.stderr @@ -1,27 +1,27 @@ -error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:8:5: 8:19}: Copy` is not satisfied - --> $DIR/clone-impl-static.rs:11:16 +error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:9:5: 9:19}: Copy` is not satisfied + --> $DIR/clone-impl-static.rs:12:16 | LL | check_copy(&gen); - | ---------- ^^^^ the trait `Copy` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:8:5: 8:19}` + | ---------- ^^^^ the trait `Copy` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:9:5: 9:19}` | | | required by a bound introduced by this call | note: required by a bound in `check_copy` - --> $DIR/clone-impl-static.rs:17:18 + --> $DIR/clone-impl-static.rs:18:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:8:5: 8:19}: Clone` is not satisfied - --> $DIR/clone-impl-static.rs:13:17 +error[E0277]: the trait bound `{static coroutine@$DIR/clone-impl-static.rs:9:5: 9:19}: Clone` is not satisfied + --> $DIR/clone-impl-static.rs:14:17 | LL | check_clone(&gen); - | ----------- ^^^^ the trait `Clone` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:8:5: 8:19}` + | ----------- ^^^^ the trait `Clone` is not implemented for `{static coroutine@$DIR/clone-impl-static.rs:9:5: 9:19}` | | | required by a bound introduced by this call | note: required by a bound in `check_clone` - --> $DIR/clone-impl-static.rs:18:19 + --> $DIR/clone-impl-static.rs:19:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` diff --git a/tests/ui/coroutine/clone-impl.rs b/tests/ui/coroutine/clone-impl.rs index 94420e56a22..b07fad18aee 100644 --- a/tests/ui/coroutine/clone-impl.rs +++ b/tests/ui/coroutine/clone-impl.rs @@ -1,6 +1,7 @@ // gate-test-coroutine_clone // Verifies that non-static coroutines can be cloned/copied if all their upvars and locals held // across awaits can be cloned/copied. +//@compile-flags: --diagnostic-width=300 #![feature(coroutines, coroutine_clone, stmt_expr_attributes)] diff --git a/tests/ui/coroutine/clone-impl.stderr b/tests/ui/coroutine/clone-impl.stderr index 5330d3bbd39..ed933fe784e 100644 --- a/tests/ui/coroutine/clone-impl.stderr +++ b/tests/ui/coroutine/clone-impl.stderr @@ -1,76 +1,76 @@ -error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}` - --> $DIR/clone-impl.rs:49:5 +error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}` + --> $DIR/clone-impl.rs:50:5 | LL | move || { - | ------- within this `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}` ... LL | check_copy(&gen_clone_0); - | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}`, the trait `Copy` is not implemented for `Vec<u32>`, which is required by `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}: Copy` + | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`, the trait `Copy` is not implemented for `Vec<u32>` | note: captured value does not implement `Copy` - --> $DIR/clone-impl.rs:47:14 + --> $DIR/clone-impl.rs:48:14 | LL | drop(clonable_0); | ^^^^^^^^^^ has type `Vec<u32>` which does not implement `Copy` note: required by a bound in `check_copy` - --> $DIR/clone-impl.rs:89:18 + --> $DIR/clone-impl.rs:90:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}` - --> $DIR/clone-impl.rs:49:5 +error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}` + --> $DIR/clone-impl.rs:50:5 | LL | move || { - | ------- within this `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}` ... LL | check_copy(&gen_clone_0); - | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}`, the trait `Copy` is not implemented for `Vec<char>`, which is required by `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}: Copy` + | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`, the trait `Copy` is not implemented for `Vec<char>` | note: coroutine does not implement `Copy` as this value is used across a yield - --> $DIR/clone-impl.rs:45:9 + --> $DIR/clone-impl.rs:46:9 | LL | let v = vec!['a']; | - has type `Vec<char>` which does not implement `Copy` LL | yield; | ^^^^^ yield occurs here, with `v` maybe used later note: required by a bound in `check_copy` - --> $DIR/clone-impl.rs:89:18 + --> $DIR/clone-impl.rs:90:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}` - --> $DIR/clone-impl.rs:70:5 +error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}` + --> $DIR/clone-impl.rs:71:5 | LL | move || { - | ------- within this `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}` ... LL | check_copy(&gen_clone_1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}`, the trait `Copy` is not implemented for `Vec<u32>`, which is required by `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}: Copy` + | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`, the trait `Copy` is not implemented for `Vec<u32>` | note: captured value does not implement `Copy` - --> $DIR/clone-impl.rs:68:14 + --> $DIR/clone-impl.rs:69:14 | LL | drop(clonable_1); | ^^^^^^^^^^ has type `Vec<u32>` which does not implement `Copy` note: required by a bound in `check_copy` - --> $DIR/clone-impl.rs:89:18 + --> $DIR/clone-impl.rs:90:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}` - --> $DIR/clone-impl.rs:70:5 +error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}` + --> $DIR/clone-impl.rs:71:5 | LL | move || { - | ------- within this `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}` ... LL | check_copy(&gen_clone_1); - | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}`, the trait `Copy` is not implemented for `Vec<char>`, which is required by `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}: Copy` + | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`, the trait `Copy` is not implemented for `Vec<char>` | note: coroutine does not implement `Copy` as this value is used across a yield - --> $DIR/clone-impl.rs:64:9 + --> $DIR/clone-impl.rs:65:9 | LL | let v = vec!['a']; | - has type `Vec<char>` which does not implement `Copy` @@ -78,27 +78,27 @@ LL | let v = vec!['a']; LL | yield; | ^^^^^ yield occurs here, with `v` maybe used later note: required by a bound in `check_copy` - --> $DIR/clone-impl.rs:89:18 + --> $DIR/clone-impl.rs:90:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` -error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}` - --> $DIR/clone-impl.rs:83:5 +error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}` + --> $DIR/clone-impl.rs:84:5 | LL | move || { - | ------- within this `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}` ... LL | check_copy(&gen_non_clone); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}`, the trait `Copy` is not implemented for `NonClone`, which is required by `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}: Copy` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`, the trait `Copy` is not implemented for `NonClone` | note: captured value does not implement `Copy` - --> $DIR/clone-impl.rs:81:14 + --> $DIR/clone-impl.rs:82:14 | LL | drop(non_clonable); | ^^^^^^^^^^^^ has type `NonClone` which does not implement `Copy` note: required by a bound in `check_copy` - --> $DIR/clone-impl.rs:89:18 + --> $DIR/clone-impl.rs:90:18 | LL | fn check_copy<T: Copy>(_x: &T) {} | ^^^^ required by this bound in `check_copy` @@ -108,22 +108,22 @@ LL + #[derive(Copy)] LL | struct NonClone; | -error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}` - --> $DIR/clone-impl.rs:85:5 +error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}` + --> $DIR/clone-impl.rs:86:5 | LL | move || { - | ------- within this `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}` + | ------- within this `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}` ... LL | check_clone(&gen_non_clone); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}`, the trait `Clone` is not implemented for `NonClone`, which is required by `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}: Clone` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`, the trait `Clone` is not implemented for `NonClone` | note: captured value does not implement `Clone` - --> $DIR/clone-impl.rs:81:14 + --> $DIR/clone-impl.rs:82:14 | LL | drop(non_clonable); | ^^^^^^^^^^^^ has type `NonClone` which does not implement `Clone` note: required by a bound in `check_clone` - --> $DIR/clone-impl.rs:90:19 + --> $DIR/clone-impl.rs:91:19 | LL | fn check_clone<T: Clone>(_x: &T) {} | ^^^^^ required by this bound in `check_clone` diff --git a/tests/ui/coroutine/drop-tracking-parent-expression.stderr b/tests/ui/coroutine/drop-tracking-parent-expression.stderr index 5f8d8495e4f..51fc20070bf 100644 --- a/tests/ui/coroutine/drop-tracking-parent-expression.stderr +++ b/tests/ui/coroutine/drop-tracking-parent-expression.stderr @@ -13,7 +13,7 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:34: 17:41}`, the trait `Send` is not implemented for `derived_drop::Client`, which is required by `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:34: 17:41}: Send` + = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:34: 17:41}`, the trait `Send` is not implemented for `derived_drop::Client` note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:21:22 | @@ -53,7 +53,7 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:34: 17:41}`, the trait `Send` is not implemented for `significant_drop::Client`, which is required by `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:34: 17:41}: Send` + = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:34: 17:41}`, the trait `Send` is not implemented for `significant_drop::Client` note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:21:22 | @@ -93,7 +93,7 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:34: 17:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client`, which is required by `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:34: 17:41}: Send` + = help: within `{coroutine@$DIR/drop-tracking-parent-expression.rs:17:34: 17:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-tracking-parent-expression.rs:21:22 | diff --git a/tests/ui/coroutine/drop-yield-twice.stderr b/tests/ui/coroutine/drop-yield-twice.stderr index 362c6e943ad..c5da35d9736 100644 --- a/tests/ui/coroutine/drop-yield-twice.stderr +++ b/tests/ui/coroutine/drop-yield-twice.stderr @@ -9,7 +9,7 @@ LL | | yield; LL | | }) | |______^ coroutine is not `Send` | - = help: within `{coroutine@$DIR/drop-yield-twice.rs:7:30: 7:32}`, the trait `Send` is not implemented for `Foo`, which is required by `{coroutine@$DIR/drop-yield-twice.rs:7:30: 7:32}: Send` + = help: within `{coroutine@$DIR/drop-yield-twice.rs:7:30: 7:32}`, the trait `Send` is not implemented for `Foo` note: coroutine is not `Send` as this value is used across a yield --> $DIR/drop-yield-twice.rs:9:9 | diff --git a/tests/ui/coroutine/gen_block_is_coro.rs b/tests/ui/coroutine/gen_block_is_coro.rs index 970646ac470..c98e1e60388 100644 --- a/tests/ui/coroutine/gen_block_is_coro.rs +++ b/tests/ui/coroutine/gen_block_is_coro.rs @@ -1,4 +1,4 @@ -//@compile-flags: --edition 2024 -Zunstable-options +//@compile-flags: --edition 2024 -Zunstable-options --diagnostic-width=300 #![feature(coroutines, coroutine_trait, gen_blocks)] use std::ops::Coroutine; diff --git a/tests/ui/coroutine/gen_block_is_coro.stderr b/tests/ui/coroutine/gen_block_is_coro.stderr index afcdce1d58d..083e738f3ec 100644 --- a/tests/ui/coroutine/gen_block_is_coro.stderr +++ b/tests/ui/coroutine/gen_block_is_coro.stderr @@ -3,18 +3,24 @@ error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}: C | LL | fn foo() -> impl Coroutine<Yield = u32, Return = ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}` +LL | gen { yield 42 } + | ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}` here error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:8}: Coroutine` is not satisfied --> $DIR/gen_block_is_coro.rs:10:13 | LL | fn bar() -> impl Coroutine<Yield = i64, Return = ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:8}` +LL | gen { yield 42 } + | ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:11:5: 11:8}` here error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:8}: Coroutine` is not satisfied --> $DIR/gen_block_is_coro.rs:14:13 | LL | fn baz() -> impl Coroutine<Yield = i32, Return = ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:8}` +LL | gen { yield 42 } + | ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:15:5: 15:8}` here error: aborting due to 3 previous errors diff --git a/tests/ui/coroutine/gen_block_is_no_future.stderr b/tests/ui/coroutine/gen_block_is_no_future.stderr index bf0985a76a2..43e18dbc2a9 100644 --- a/tests/ui/coroutine/gen_block_is_no_future.stderr +++ b/tests/ui/coroutine/gen_block_is_no_future.stderr @@ -3,6 +3,8 @@ error[E0277]: `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}` is not a fut | LL | fn foo() -> impl std::future::Future { | ^^^^^^^^^^^^^^^^^^^^^^^^ `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}` is not a future +LL | gen { yield 42 } + | ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}` here | = help: the trait `Future` is not implemented for `{gen block@$DIR/gen_block_is_no_future.rs:5:5: 5:8}` diff --git a/tests/ui/coroutine/issue-105084.rs b/tests/ui/coroutine/issue-105084.rs index 4e40bc127d7..0f6168ec58b 100644 --- a/tests/ui/coroutine/issue-105084.rs +++ b/tests/ui/coroutine/issue-105084.rs @@ -1,3 +1,4 @@ +//@compile-flags: --diagnostic-width=300 #![feature(coroutines)] #![feature(coroutine_clone)] #![feature(coroutine_trait)] diff --git a/tests/ui/coroutine/issue-105084.stderr b/tests/ui/coroutine/issue-105084.stderr index 6b1701f0c2a..073f1fbea4c 100644 --- a/tests/ui/coroutine/issue-105084.stderr +++ b/tests/ui/coroutine/issue-105084.stderr @@ -1,8 +1,8 @@ error[E0382]: borrow of moved value: `g` - --> $DIR/issue-105084.rs:38:14 + --> $DIR/issue-105084.rs:39:14 | LL | let mut g = #[coroutine] - | ----- move occurs because `g` has type `{coroutine@$DIR/issue-105084.rs:15:5: 15:7}`, which does not implement the `Copy` trait + | ----- move occurs because `g` has type `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`, which does not implement the `Copy` trait ... LL | let mut h = copy(g); | - value moved here @@ -11,7 +11,7 @@ LL | Pin::new(&mut g).resume(()); | ^^^^^^ value borrowed here after move | note: consider changing this parameter type in function `copy` to borrow instead if owning the value isn't necessary - --> $DIR/issue-105084.rs:9:21 + --> $DIR/issue-105084.rs:10:21 | LL | fn copy<T: Copy>(x: T) -> T { | ---- ^ this parameter takes ownership of the value @@ -22,17 +22,17 @@ help: consider cloning the value if the performance cost is acceptable LL | let mut h = copy(g.clone()); | ++++++++ -error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{coroutine@$DIR/issue-105084.rs:15:5: 15:7}` - --> $DIR/issue-105084.rs:32:17 +error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}` + --> $DIR/issue-105084.rs:33:17 | LL | || { - | -- within this `{coroutine@$DIR/issue-105084.rs:15:5: 15:7}` + | -- within this `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}` ... LL | let mut h = copy(g); - | ^^^^^^^ within `{coroutine@$DIR/issue-105084.rs:15:5: 15:7}`, the trait `Copy` is not implemented for `Box<(i32, ())>`, which is required by `{coroutine@$DIR/issue-105084.rs:15:5: 15:7}: Copy` + | ^^^^^^^ within `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`, the trait `Copy` is not implemented for `Box<(i32, ())>` | note: coroutine does not implement `Copy` as this value is used across a yield - --> $DIR/issue-105084.rs:22:22 + --> $DIR/issue-105084.rs:23:22 | LL | Box::new((5, yield)); | -------------^^^^^-- @@ -40,7 +40,7 @@ LL | Box::new((5, yield)); | | yield occurs here, with `Box::new((5, yield))` maybe used later | has type `Box<(i32, ())>` which does not implement `Copy` note: required by a bound in `copy` - --> $DIR/issue-105084.rs:9:12 + --> $DIR/issue-105084.rs:10:12 | LL | fn copy<T: Copy>(x: T) -> T { | ^^^^ required by this bound in `copy` diff --git a/tests/ui/coroutine/issue-68112.stderr b/tests/ui/coroutine/issue-68112.stderr index bcfcb5ec6e6..124537b971e 100644 --- a/tests/ui/coroutine/issue-68112.stderr +++ b/tests/ui/coroutine/issue-68112.stderr @@ -4,7 +4,7 @@ error: coroutine cannot be sent between threads safely LL | require_send(send_gen); | ^^^^^^^^^^^^^^^^^^^^^^ coroutine is not `Send` | - = help: the trait `Sync` is not implemented for `RefCell<i32>`, which is required by `{coroutine@$DIR/issue-68112.rs:33:33: 33:35}: Send` + = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead note: coroutine is not `Send` as this value is used across a yield --> $DIR/issue-68112.rs:36:9 @@ -26,7 +26,7 @@ error[E0277]: `RefCell<i32>` cannot be shared between threads safely LL | require_send(send_gen); | ^^^^^^^^^^^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely | - = help: the trait `Sync` is not implemented for `RefCell<i32>`, which is required by `{coroutine@$DIR/issue-68112.rs:60:33: 60:35}: Send` + = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead = note: required for `Arc<RefCell<i32>>` to implement `Send` note: required because it's used within this coroutine diff --git a/tests/ui/coroutine/issue-88653.rs b/tests/ui/coroutine/issue-88653.rs index 3afd12a2093..b5936c7960d 100644 --- a/tests/ui/coroutine/issue-88653.rs +++ b/tests/ui/coroutine/issue-88653.rs @@ -14,6 +14,7 @@ fn foo(bar: bool) -> impl Coroutine<(bool,)> { #[coroutine] |bar| { //~^ NOTE: found signature defined here + //~| NOTE: return type was inferred to be if bar { yield bar; } diff --git a/tests/ui/coroutine/issue-88653.stderr b/tests/ui/coroutine/issue-88653.stderr index 8a23ad17b8b..ef0cc11dde8 100644 --- a/tests/ui/coroutine/issue-88653.stderr +++ b/tests/ui/coroutine/issue-88653.stderr @@ -1,11 +1,21 @@ error[E0631]: type mismatch in coroutine arguments --> $DIR/issue-88653.rs:8:22 | -LL | fn foo(bar: bool) -> impl Coroutine<(bool,)> { - | ^^^^^^^^^^^^^^^^^^^^^^^ expected due to this +LL | fn foo(bar: bool) -> impl Coroutine<(bool,)> { + | ^^^^^^^^^^^^^^^^^^^^^^^ expected due to this ... -LL | |bar| { - | ----- found signature defined here +LL | |bar| { + | ----- + | | + | _____found signature defined here + | | +LL | | +LL | | +LL | | if bar { +LL | | yield bar; +LL | | } +LL | | } + | |_____- return type was inferred to be `{coroutine@$DIR/issue-88653.rs:15:5: 15:10}` here | = note: expected coroutine signature `fn((bool,)) -> _` found coroutine signature `fn(bool) -> _` diff --git a/tests/ui/coroutine/not-send-sync.stderr b/tests/ui/coroutine/not-send-sync.stderr index 0f9cbdec130..c6d2ac0a557 100644 --- a/tests/ui/coroutine/not-send-sync.stderr +++ b/tests/ui/coroutine/not-send-sync.stderr @@ -9,7 +9,7 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Sync` | - = help: within `{coroutine@$DIR/not-send-sync.rs:14:30: 14:32}`, the trait `Sync` is not implemented for `NotSync`, which is required by `{coroutine@$DIR/not-send-sync.rs:14:30: 14:32}: Sync` + = help: within `{coroutine@$DIR/not-send-sync.rs:14:30: 14:32}`, the trait `Sync` is not implemented for `NotSync` note: coroutine is not `Sync` as this value is used across a yield --> $DIR/not-send-sync.rs:17:9 | @@ -34,7 +34,7 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Send` | - = help: within `{coroutine@$DIR/not-send-sync.rs:21:30: 21:32}`, the trait `Send` is not implemented for `NotSend`, which is required by `{coroutine@$DIR/not-send-sync.rs:21:30: 21:32}: Send` + = help: within `{coroutine@$DIR/not-send-sync.rs:21:30: 21:32}`, the trait `Send` is not implemented for `NotSend` note: coroutine is not `Send` as this value is used across a yield --> $DIR/not-send-sync.rs:24:9 | diff --git a/tests/ui/coroutine/parent-expression.stderr b/tests/ui/coroutine/parent-expression.stderr index 2d817f1bfd9..770ffda7a26 100644 --- a/tests/ui/coroutine/parent-expression.stderr +++ b/tests/ui/coroutine/parent-expression.stderr @@ -13,7 +13,7 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/parent-expression.rs:17:34: 17:41}`, the trait `Send` is not implemented for `derived_drop::Client`, which is required by `{coroutine@$DIR/parent-expression.rs:17:34: 17:41}: Send` + = help: within `{coroutine@$DIR/parent-expression.rs:17:34: 17:41}`, the trait `Send` is not implemented for `derived_drop::Client` note: coroutine is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:21:22 | @@ -53,7 +53,7 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/parent-expression.rs:17:34: 17:41}`, the trait `Send` is not implemented for `significant_drop::Client`, which is required by `{coroutine@$DIR/parent-expression.rs:17:34: 17:41}: Send` + = help: within `{coroutine@$DIR/parent-expression.rs:17:34: 17:41}`, the trait `Send` is not implemented for `significant_drop::Client` note: coroutine is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:21:22 | @@ -93,7 +93,7 @@ LL | | }; LL | | ); | |_____- in this macro invocation | - = help: within `{coroutine@$DIR/parent-expression.rs:17:34: 17:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client`, which is required by `{coroutine@$DIR/parent-expression.rs:17:34: 17:41}: Send` + = help: within `{coroutine@$DIR/parent-expression.rs:17:34: 17:41}`, the trait `Send` is not implemented for `insignificant_dtor::Client` note: coroutine is not `Send` as this value is used across a yield --> $DIR/parent-expression.rs:21:22 | diff --git a/tests/ui/coroutine/print/coroutine-print-verbose-1.stderr b/tests/ui/coroutine/print/coroutine-print-verbose-1.stderr index daf88fc1f23..410189b9ab6 100644 --- a/tests/ui/coroutine/print/coroutine-print-verbose-1.stderr +++ b/tests/ui/coroutine/print/coroutine-print-verbose-1.stderr @@ -4,7 +4,7 @@ error: coroutine cannot be sent between threads safely LL | require_send(send_gen); | ^^^^^^^^^^^^^^^^^^^^^^ coroutine is not `Send` | - = help: the trait `Sync` is not implemented for `RefCell<i32>`, which is required by `{test1::{closure#0} upvar_tys=() witness={test1::{closure#0}}}: Send` + = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead note: coroutine is not `Send` as this value is used across a yield --> $DIR/coroutine-print-verbose-1.rs:35:9 @@ -25,7 +25,7 @@ error[E0277]: `RefCell<i32>` cannot be shared between threads safely LL | require_send(send_gen); | ^^^^^^^^^^^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely | - = help: the trait `Sync` is not implemented for `RefCell<i32>`, which is required by `{test2::{closure#0} upvar_tys=() witness={test2::{closure#0}}}: Send` + = help: the trait `Sync` is not implemented for `RefCell<i32>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead = note: required for `Arc<RefCell<i32>>` to implement `Send` note: required because it's used within this coroutine diff --git a/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr b/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr index 0de53d9e1d7..2ab9d35f05a 100644 --- a/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr +++ b/tests/ui/coroutine/print/coroutine-print-verbose-2.stderr @@ -9,7 +9,7 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Sync` | - = help: within `{main::{closure#0} upvar_tys=() witness={main::{closure#0}}}`, the trait `Sync` is not implemented for `NotSync`, which is required by `{main::{closure#0} upvar_tys=() witness={main::{closure#0}}}: Sync` + = help: within `{main::{closure#0} upvar_tys=() witness={main::{closure#0}}}`, the trait `Sync` is not implemented for `NotSync` note: coroutine is not `Sync` as this value is used across a yield --> $DIR/coroutine-print-verbose-2.rs:20:9 | @@ -34,7 +34,7 @@ LL | | drop(a); LL | | }); | |______^ coroutine is not `Send` | - = help: within `{main::{closure#1} upvar_tys=() witness={main::{closure#1}}}`, the trait `Send` is not implemented for `NotSend`, which is required by `{main::{closure#1} upvar_tys=() witness={main::{closure#1}}}: Send` + = help: within `{main::{closure#1} upvar_tys=() witness={main::{closure#1}}}`, the trait `Send` is not implemented for `NotSend` note: coroutine is not `Send` as this value is used across a yield --> $DIR/coroutine-print-verbose-2.rs:27:9 | diff --git a/tests/ui/coroutine/ref-upvar-not-send.stderr b/tests/ui/coroutine/ref-upvar-not-send.stderr index 4c7deab3f4c..892b5d261c2 100644 --- a/tests/ui/coroutine/ref-upvar-not-send.stderr +++ b/tests/ui/coroutine/ref-upvar-not-send.stderr @@ -10,7 +10,7 @@ LL | | let _x = x; LL | | }); | |_____^ coroutine is not `Send` | - = help: the trait `Sync` is not implemented for `*mut ()`, which is required by `{coroutine@$DIR/ref-upvar-not-send.rs:15:30: 15:37}: Send` + = help: the trait `Sync` is not implemented for `*mut ()` note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync` --> $DIR/ref-upvar-not-send.rs:19:18 | @@ -34,7 +34,7 @@ LL | | let _y = y; LL | | }); | |_____^ coroutine is not `Send` | - = help: within `{coroutine@$DIR/ref-upvar-not-send.rs:23:30: 23:37}`, the trait `Send` is not implemented for `*mut ()`, which is required by `{coroutine@$DIR/ref-upvar-not-send.rs:23:30: 23:37}: Send` + = help: within `{coroutine@$DIR/ref-upvar-not-send.rs:23:30: 23:37}`, the trait `Send` is not implemented for `*mut ()` note: captured value is not `Send` because `&mut` references cannot be sent unless their referent is `Send` --> $DIR/ref-upvar-not-send.rs:27:18 | diff --git a/tests/ui/coroutine/resume-arg-outlives-2.rs b/tests/ui/coroutine/resume-arg-outlives-2.rs new file mode 100644 index 00000000000..387b143ea27 --- /dev/null +++ b/tests/ui/coroutine/resume-arg-outlives-2.rs @@ -0,0 +1,34 @@ +// Regression test for 132104 + +#![feature(coroutine_trait, coroutines)] + +use std::ops::Coroutine; +use std::{thread, time}; + +fn demo<'not_static>(s: &'not_static str) -> thread::JoinHandle<()> { + let mut generator = Box::pin({ + #[coroutine] + move |_ctx| { + let ctx: &'not_static str = yield; + yield; + dbg!(ctx); + } + }); + + // exploit: + generator.as_mut().resume(""); + generator.as_mut().resume(s); // <- generator hoards it as `let ctx`. + //~^ ERROR borrowed data escapes outside of function + thread::spawn(move || { + thread::sleep(time::Duration::from_millis(200)); + generator.as_mut().resume(""); // <- resumes from the last `yield`, running `dbg!(ctx)`. + }) +} + +fn main() { + let local = String::from("..."); + let thread = demo(&local); + drop(local); + let _unrelated = String::from("UAF"); + thread.join().unwrap(); +} diff --git a/tests/ui/coroutine/resume-arg-outlives-2.stderr b/tests/ui/coroutine/resume-arg-outlives-2.stderr new file mode 100644 index 00000000000..3d630d7e7e4 --- /dev/null +++ b/tests/ui/coroutine/resume-arg-outlives-2.stderr @@ -0,0 +1,17 @@ +error[E0521]: borrowed data escapes outside of function + --> $DIR/resume-arg-outlives-2.rs:20:5 + | +LL | fn demo<'not_static>(s: &'not_static str) -> thread::JoinHandle<()> { + | ----------- - `s` is a reference that is only valid in the function body + | | + | lifetime `'not_static` defined here +... +LL | generator.as_mut().resume(s); // <- generator hoards it as `let ctx`. + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | `s` escapes the function body here + | argument requires that `'not_static` must outlive `'static` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0521`. diff --git a/tests/ui/coroutine/resume-arg-outlives.rs b/tests/ui/coroutine/resume-arg-outlives.rs new file mode 100644 index 00000000000..258be28e063 --- /dev/null +++ b/tests/ui/coroutine/resume-arg-outlives.rs @@ -0,0 +1,27 @@ +// Regression test for 132104 + +#![feature(coroutine_trait, coroutines)] + +use std::ops::Coroutine; +use std::pin::Pin; + +fn demo<'not_static>(s: &'not_static str) -> Pin<Box<impl Coroutine<&'not_static str> + 'static>> { + let mut generator = Box::pin({ + #[coroutine] + move |ctx: &'not_static str| { + yield; + dbg!(ctx); + } + }); + generator.as_mut().resume(s); + generator + //~^ ERROR lifetime may not live long enough +} + +fn main() { + let local = String::from("..."); + let mut coro = demo(&local); + drop(local); + let _unrelated = String::from("UAF"); + coro.as_mut().resume(""); +} diff --git a/tests/ui/coroutine/resume-arg-outlives.stderr b/tests/ui/coroutine/resume-arg-outlives.stderr new file mode 100644 index 00000000000..2a6337b4945 --- /dev/null +++ b/tests/ui/coroutine/resume-arg-outlives.stderr @@ -0,0 +1,20 @@ +error: lifetime may not live long enough + --> $DIR/resume-arg-outlives.rs:17:5 + | +LL | fn demo<'not_static>(s: &'not_static str) -> Pin<Box<impl Coroutine<&'not_static str> + 'static>> { + | ----------- lifetime `'not_static` defined here +... +LL | generator + | ^^^^^^^^^ returning this value requires that `'not_static` must outlive `'static` + | +help: consider changing `impl Coroutine<&'not_static str> + 'static`'s explicit `'static` bound to the lifetime of argument `s` + | +LL | fn demo<'not_static>(s: &'not_static str) -> Pin<Box<impl Coroutine<&'not_static str> + 'not_static>> { + | ~~~~~~~~~~~ +help: alternatively, add an explicit `'static` bound to this reference + | +LL | fn demo<'not_static>(s: &'static str) -> Pin<Box<impl Coroutine<&'not_static str> + 'static>> { + | ~~~~~~~~~~~~ + +error: aborting due to 1 previous error + diff --git a/tests/ui/coroutine/static-not-unpin.current.stderr b/tests/ui/coroutine/static-not-unpin.current.stderr index 7d6260ac569..19a6e72ccf1 100644 --- a/tests/ui/coroutine/static-not-unpin.current.stderr +++ b/tests/ui/coroutine/static-not-unpin.current.stderr @@ -1,15 +1,15 @@ -error[E0277]: `{static coroutine@$DIR/static-not-unpin.rs:15:5: 15:14}` cannot be unpinned - --> $DIR/static-not-unpin.rs:18:18 +error[E0277]: `{static coroutine@$DIR/static-not-unpin.rs:16:5: 16:14}` cannot be unpinned + --> $DIR/static-not-unpin.rs:19:18 | LL | assert_unpin(coroutine); - | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/static-not-unpin.rs:15:5: 15:14}` + | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/static-not-unpin.rs:16:5: 16:14}` | | | required by a bound introduced by this call | = note: consider using the `pin!` macro consider using `Box::pin` if you need to access the pinned value outside of the current scope note: required by a bound in `assert_unpin` - --> $DIR/static-not-unpin.rs:11:20 + --> $DIR/static-not-unpin.rs:12:20 | LL | fn assert_unpin<T: Unpin>(_: T) {} | ^^^^^ required by this bound in `assert_unpin` diff --git a/tests/ui/coroutine/static-not-unpin.next.stderr b/tests/ui/coroutine/static-not-unpin.next.stderr index 7d6260ac569..19a6e72ccf1 100644 --- a/tests/ui/coroutine/static-not-unpin.next.stderr +++ b/tests/ui/coroutine/static-not-unpin.next.stderr @@ -1,15 +1,15 @@ -error[E0277]: `{static coroutine@$DIR/static-not-unpin.rs:15:5: 15:14}` cannot be unpinned - --> $DIR/static-not-unpin.rs:18:18 +error[E0277]: `{static coroutine@$DIR/static-not-unpin.rs:16:5: 16:14}` cannot be unpinned + --> $DIR/static-not-unpin.rs:19:18 | LL | assert_unpin(coroutine); - | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/static-not-unpin.rs:15:5: 15:14}` + | ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/static-not-unpin.rs:16:5: 16:14}` | | | required by a bound introduced by this call | = note: consider using the `pin!` macro consider using `Box::pin` if you need to access the pinned value outside of the current scope note: required by a bound in `assert_unpin` - --> $DIR/static-not-unpin.rs:11:20 + --> $DIR/static-not-unpin.rs:12:20 | LL | fn assert_unpin<T: Unpin>(_: T) {} | ^^^^^ required by this bound in `assert_unpin` diff --git a/tests/ui/coroutine/static-not-unpin.rs b/tests/ui/coroutine/static-not-unpin.rs index 54148368b13..b66a248654e 100644 --- a/tests/ui/coroutine/static-not-unpin.rs +++ b/tests/ui/coroutine/static-not-unpin.rs @@ -1,6 +1,7 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) -//@[next] compile-flags: -Znext-solver +//@[next] compile-flags: -Znext-solver --diagnostic-width=300 +//@[current] compile-flags: --diagnostic-width=300 #![feature(coroutines, stmt_expr_attributes)] diff --git a/tests/ui/coroutine/unresolved-ct-var.stderr b/tests/ui/coroutine/unresolved-ct-var.stderr index 8b87bac05ac..da2ec272f9f 100644 --- a/tests/ui/coroutine/unresolved-ct-var.stderr +++ b/tests/ui/coroutine/unresolved-ct-var.stderr @@ -8,7 +8,7 @@ LL | let s = std::array::from_fn(|_| ()).await; | | help: remove the `.await` | this call returns `[(); _]` | - = help: the trait `Future` is not implemented for `[(); _]`, which is required by `[(); _]: IntoFuture` + = help: the trait `Future` is not implemented for `[(); _]` = note: [(); _] must be a future or must implement `IntoFuture` to be awaited = note: required for `[(); _]` to implement `IntoFuture` diff --git a/tests/ui/coroutine/yield-outside-coroutine-issue-78653.stderr b/tests/ui/coroutine/yield-outside-coroutine-issue-78653.stderr index 921e8d5d47a..b288e581d88 100644 --- a/tests/ui/coroutine/yield-outside-coroutine-issue-78653.stderr +++ b/tests/ui/coroutine/yield-outside-coroutine-issue-78653.stderr @@ -21,7 +21,7 @@ error[E0277]: `{integer}` is not an iterator LL | yield || for i in 0 { } | ^ `{integer}` is not an iterator | - = help: the trait `Iterator` is not implemented for `{integer}`, which is required by `{integer}: IntoIterator` + = help: the trait `Iterator` is not implemented for `{integer}` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `{integer}` to implement `IntoIterator` diff --git a/tests/ui/delegation/unsupported.rs b/tests/ui/delegation/unsupported.rs index 56296db85a3..b35af76da3e 100644 --- a/tests/ui/delegation/unsupported.rs +++ b/tests/ui/delegation/unsupported.rs @@ -1,6 +1,5 @@ #![feature(const_trait_impl)] #![feature(c_variadic)] -#![feature(effects)] #![feature(fn_delegation)] #![allow(incomplete_features)] diff --git a/tests/ui/delegation/unsupported.stderr b/tests/ui/delegation/unsupported.stderr index 1c79a603503..9391763dca2 100644 --- a/tests/ui/delegation/unsupported.stderr +++ b/tests/ui/delegation/unsupported.stderr @@ -1,29 +1,24 @@ -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - -error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:26:5: 26:24>::{synthetic#0}` - --> $DIR/unsupported.rs:27:25 +error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:25:5: 25:24>::{synthetic#0}` + --> $DIR/unsupported.rs:26:25 | LL | reuse to_reuse::opaque_ret; | ^^^^^^^^^^ | note: ...which requires comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process... - --> $DIR/unsupported.rs:27:25 + --> $DIR/unsupported.rs:26:25 | LL | reuse to_reuse::opaque_ret; | ^^^^^^^^^^ - = note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:26:5: 26:24>::{synthetic#0}`, completing the cycle -note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:26:5: 26:24>` is well-formed - --> $DIR/unsupported.rs:26:5 + = note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:25:5: 25:24>::{synthetic#0}`, completing the cycle +note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:25:5: 25:24>` is well-formed + --> $DIR/unsupported.rs:25:5 | LL | impl ToReuse for u8 { | ^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information warning: this function depends on never type fallback being `()` - --> $DIR/unsupported.rs:14:9 + --> $DIR/unsupported.rs:13:9 | LL | pub fn opaque_ret() -> impl Trait { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -32,14 +27,14 @@ LL | pub fn opaque_ret() -> impl Trait { unimplemented!() } = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the types explicitly note: in edition 2024, the requirement `!: opaque::Trait` will fail - --> $DIR/unsupported.rs:14:32 + --> $DIR/unsupported.rs:13:32 | LL | pub fn opaque_ret() -> impl Trait { unimplemented!() } | ^^^^^^^^^^ = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default warning: this function depends on never type fallback being `()` - --> $DIR/unsupported.rs:20:9 + --> $DIR/unsupported.rs:19:9 | LL | fn opaque_ret() -> impl Trait { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -48,32 +43,32 @@ LL | fn opaque_ret() -> impl Trait { unimplemented!() } = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the types explicitly note: in edition 2024, the requirement `!: opaque::Trait` will fail - --> $DIR/unsupported.rs:20:28 + --> $DIR/unsupported.rs:19:28 | LL | fn opaque_ret() -> impl Trait { unimplemented!() } | ^^^^^^^^^^ -error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:29:5: 29:25>::{synthetic#0}` - --> $DIR/unsupported.rs:30:24 +error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:28:5: 28:25>::{synthetic#0}` + --> $DIR/unsupported.rs:29:24 | LL | reuse ToReuse::opaque_ret; | ^^^^^^^^^^ | note: ...which requires comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process... - --> $DIR/unsupported.rs:30:24 + --> $DIR/unsupported.rs:29:24 | LL | reuse ToReuse::opaque_ret; | ^^^^^^^^^^ - = note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:29:5: 29:25>::{synthetic#0}`, completing the cycle -note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:29:5: 29:25>` is well-formed - --> $DIR/unsupported.rs:29:5 + = note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:28:5: 28:25>::{synthetic#0}`, completing the cycle +note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:28:5: 28:25>` is well-formed + --> $DIR/unsupported.rs:28:5 | LL | impl ToReuse for u16 { | ^^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: recursive delegation is not supported yet - --> $DIR/unsupported.rs:43:22 + --> $DIR/unsupported.rs:42:22 | LL | pub reuse to_reuse2::foo; | --- callee defined here @@ -82,14 +77,14 @@ LL | reuse to_reuse1::foo; | ^^^ error[E0283]: type annotations needed - --> $DIR/unsupported.rs:53:18 + --> $DIR/unsupported.rs:52:18 | LL | reuse Trait::foo; | ^^^ cannot infer type | = note: cannot satisfy `_: effects::Trait` -error: aborting due to 5 previous errors; 2 warnings emitted +error: aborting due to 4 previous errors; 2 warnings emitted Some errors have detailed explanations: E0283, E0391. For more information about an error, try `rustc --explain E0283`. diff --git a/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr index b10805ac8f0..3f6c39bf939 100644 --- a/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr +++ b/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr @@ -7,7 +7,7 @@ LL | #[derive(Debug)] LL | x: Error | ^^^^^^^^ `Error` cannot be formatted using `{:?}` | - = help: the trait `Debug` is not implemented for `Error`, which is required by `&Error: Debug` + = help: the trait `Debug` is not implemented for `Error` = note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Debug)]` diff --git a/tests/ui/derives/derives-span-Debug-enum.stderr b/tests/ui/derives/derives-span-Debug-enum.stderr index 03297443901..eaeffaeb849 100644 --- a/tests/ui/derives/derives-span-Debug-enum.stderr +++ b/tests/ui/derives/derives-span-Debug-enum.stderr @@ -7,7 +7,7 @@ LL | #[derive(Debug)] LL | Error | ^^^^^ `Error` cannot be formatted using `{:?}` | - = help: the trait `Debug` is not implemented for `Error`, which is required by `&Error: Debug` + = help: the trait `Debug` is not implemented for `Error` = note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Debug)]` diff --git a/tests/ui/derives/derives-span-Debug-struct.stderr b/tests/ui/derives/derives-span-Debug-struct.stderr index 369c0b56ac4..4a725e260de 100644 --- a/tests/ui/derives/derives-span-Debug-struct.stderr +++ b/tests/ui/derives/derives-span-Debug-struct.stderr @@ -7,7 +7,7 @@ LL | struct Struct { LL | x: Error | ^^^^^^^^ `Error` cannot be formatted using `{:?}` | - = help: the trait `Debug` is not implemented for `Error`, which is required by `&Error: Debug` + = help: the trait `Debug` is not implemented for `Error` = note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Debug)]` diff --git a/tests/ui/derives/derives-span-Debug-tuple-struct.stderr b/tests/ui/derives/derives-span-Debug-tuple-struct.stderr index abfef9ef354..2f816e1c85b 100644 --- a/tests/ui/derives/derives-span-Debug-tuple-struct.stderr +++ b/tests/ui/derives/derives-span-Debug-tuple-struct.stderr @@ -7,7 +7,7 @@ LL | struct Struct( LL | Error | ^^^^^ `Error` cannot be formatted using `{:?}` | - = help: the trait `Debug` is not implemented for `Error`, which is required by `&Error: Debug` + = help: the trait `Debug` is not implemented for `Error` = note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Debug)]` diff --git a/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.rs b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.rs new file mode 100644 index 00000000000..c4fb620fea4 --- /dev/null +++ b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.rs @@ -0,0 +1,11 @@ +// Duplicate implementations of Copy/Clone should not trigger +// borrow check warnings +// See #131083 + +#[derive(Copy, Clone)] +#[derive(Copy, Clone)] +//~^ ERROR conflicting implementations of trait `Clone` for type `E` +//~| ERROR conflicting implementations of trait `Copy` for type `E` +enum E {} + +fn main() {} diff --git a/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr new file mode 100644 index 00000000000..f8e1db33f53 --- /dev/null +++ b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr @@ -0,0 +1,23 @@ +error[E0119]: conflicting implementations of trait `Copy` for type `E` + --> $DIR/duplicate-derive-copy-clone-diagnostics.rs:6:10 + | +LL | #[derive(Copy, Clone)] + | ---- first implementation here +LL | #[derive(Copy, Clone)] + | ^^^^ conflicting implementation for `E` + | + = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0119]: conflicting implementations of trait `Clone` for type `E` + --> $DIR/duplicate-derive-copy-clone-diagnostics.rs:6:16 + | +LL | #[derive(Copy, Clone)] + | ----- first implementation here +LL | #[derive(Copy, Clone)] + | ^^^^^ conflicting implementation for `E` + | + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/derives/rustc-decodable-issue-123156.stderr b/tests/ui/derives/rustc-decodable-issue-123156.stderr index ee7b33d59bb..93a993b90d8 100644 --- a/tests/ui/derives/rustc-decodable-issue-123156.stderr +++ b/tests/ui/derives/rustc-decodable-issue-123156.stderr @@ -1,5 +1,5 @@ Future incompatibility report: Future breakage diagnostic: -warning: use of unstable library feature 'rustc_encodable_decodable': derive macro for `rustc-serialize`; should not be used in new code +warning: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code --> $DIR/rustc-decodable-issue-123156.rs:10:10 | LL | #[derive(RustcDecodable)] diff --git a/tests/ui/deriving/auxiliary/another-proc-macro.rs b/tests/ui/deriving/auxiliary/another-proc-macro.rs index a05175c9de9..c992cde4066 100644 --- a/tests/ui/deriving/auxiliary/another-proc-macro.rs +++ b/tests/ui/deriving/auxiliary/another-proc-macro.rs @@ -6,7 +6,7 @@ extern crate proc_macro; -use proc_macro::{quote, TokenStream}; +use proc_macro::{TokenStream, quote}; #[proc_macro_derive(AnotherMacro, attributes(pointee))] pub fn derive(_input: TokenStream) -> TokenStream { diff --git a/tests/ui/deriving/built-in-proc-macro-scope.rs b/tests/ui/deriving/built-in-proc-macro-scope.rs index 41c95f63b13..6c473aefc5b 100644 --- a/tests/ui/deriving/built-in-proc-macro-scope.rs +++ b/tests/ui/deriving/built-in-proc-macro-scope.rs @@ -2,14 +2,14 @@ //@ aux-build: another-proc-macro.rs //@ compile-flags: -Zunpretty=expanded -#![feature(derive_smart_pointer)] +#![feature(derive_coerce_pointee)] #[macro_use] extern crate another_proc_macro; -use another_proc_macro::{pointee, AnotherMacro}; +use another_proc_macro::{AnotherMacro, pointee}; -#[derive(core::marker::SmartPointer)] +#[derive(core::marker::CoercePointee)] #[repr(transparent)] pub struct Ptr<'a, #[pointee] T: ?Sized> { data: &'a mut T, diff --git a/tests/ui/deriving/built-in-proc-macro-scope.stdout b/tests/ui/deriving/built-in-proc-macro-scope.stdout index c649b7a9a57..07767dc229f 100644 --- a/tests/ui/deriving/built-in-proc-macro-scope.stdout +++ b/tests/ui/deriving/built-in-proc-macro-scope.stdout @@ -4,7 +4,7 @@ //@ aux-build: another-proc-macro.rs //@ compile-flags: -Zunpretty=expanded -#![feature(derive_smart_pointer)] +#![feature(derive_coerce_pointee)] #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] @@ -13,7 +13,7 @@ extern crate std; #[macro_use] extern crate another_proc_macro; -use another_proc_macro::{pointee, AnotherMacro}; +use another_proc_macro::{AnotherMacro, pointee}; #[repr(transparent)] pub struct Ptr<'a, #[pointee] T: ?Sized> { diff --git a/tests/ui/deriving/smart-pointer-bounds-issue-127647.rs b/tests/ui/deriving/coerce-pointee-bounds-issue-127647.rs index 4cae1b32896..a1aabf1cb52 100644 --- a/tests/ui/deriving/smart-pointer-bounds-issue-127647.rs +++ b/tests/ui/deriving/coerce-pointee-bounds-issue-127647.rs @@ -1,8 +1,8 @@ //@ check-pass -#![feature(derive_smart_pointer)] +#![feature(derive_coerce_pointee)] -#[derive(core::marker::SmartPointer)] +#[derive(core::marker::CoercePointee)] #[repr(transparent)] pub struct Ptr<'a, #[pointee] T: OnDrop + ?Sized, X> { data: &'a mut T, @@ -13,7 +13,7 @@ pub trait OnDrop { fn on_drop(&mut self); } -#[derive(core::marker::SmartPointer)] +#[derive(core::marker::CoercePointee)] #[repr(transparent)] pub struct Ptr2<'a, #[pointee] T: ?Sized, X> where @@ -25,7 +25,7 @@ where pub trait MyTrait<T: ?Sized> {} -#[derive(core::marker::SmartPointer)] +#[derive(core::marker::CoercePointee)] #[repr(transparent)] pub struct Ptr3<'a, #[pointee] T: ?Sized, X> where @@ -35,14 +35,14 @@ where x: core::marker::PhantomData<X>, } -#[derive(core::marker::SmartPointer)] +#[derive(core::marker::CoercePointee)] #[repr(transparent)] pub struct Ptr4<'a, #[pointee] T: MyTrait<T> + ?Sized, X> { data: &'a mut T, x: core::marker::PhantomData<X>, } -#[derive(core::marker::SmartPointer)] +#[derive(core::marker::CoercePointee)] #[repr(transparent)] pub struct Ptr5<'a, #[pointee] T: ?Sized, X> where @@ -56,7 +56,7 @@ where pub struct Ptr5Companion<T: ?Sized>(core::marker::PhantomData<T>); pub struct Ptr5Companion2; -#[derive(core::marker::SmartPointer)] +#[derive(core::marker::CoercePointee)] #[repr(transparent)] pub struct Ptr6<'a, #[pointee] T: ?Sized, X: MyTrait<T> = (), const PARAM: usize = 0> { data: &'a mut T, @@ -65,7 +65,7 @@ pub struct Ptr6<'a, #[pointee] T: ?Sized, X: MyTrait<T> = (), const PARAM: usize // a reduced example from https://lore.kernel.org/all/20240402-linked-list-v1-1-b1c59ba7ae3b@google.com/ #[repr(transparent)] -#[derive(core::marker::SmartPointer)] +#[derive(core::marker::CoercePointee)] pub struct ListArc<#[pointee] T, const ID: u64 = 0> where T: ListArcSafe<ID> + ?Sized, diff --git a/tests/ui/deriving/deriving-smart-pointer-expanded.rs b/tests/ui/deriving/deriving-coerce-pointee-expanded.rs index e48ad3dd4bc..94be7031fb7 100644 --- a/tests/ui/deriving/deriving-smart-pointer-expanded.rs +++ b/tests/ui/deriving/deriving-coerce-pointee-expanded.rs @@ -1,17 +1,17 @@ //@ check-pass //@ compile-flags: -Zunpretty=expanded -#![feature(derive_smart_pointer)] -use std::marker::SmartPointer; +#![feature(derive_coerce_pointee)] +use std::marker::CoercePointee; pub trait MyTrait<T: ?Sized> {} -#[derive(SmartPointer)] +#[derive(CoercePointee)] #[repr(transparent)] struct MyPointer<'a, #[pointee] T: ?Sized> { ptr: &'a T, } -#[derive(core::marker::SmartPointer)] +#[derive(core::marker::CoercePointee)] #[repr(transparent)] pub struct MyPointer2<'a, Y, Z: MyTrait<T>, #[pointee] T: ?Sized + MyTrait<T>, X: MyTrait<T> = ()> where @@ -21,7 +21,7 @@ where x: core::marker::PhantomData<X>, } -#[derive(SmartPointer)] +#[derive(CoercePointee)] #[repr(transparent)] struct MyPointerWithoutPointee<'a, T: ?Sized> { ptr: &'a T, diff --git a/tests/ui/deriving/deriving-smart-pointer-expanded.stdout b/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout index 68ef17f2b05..d6eaca5cba1 100644 --- a/tests/ui/deriving/deriving-smart-pointer-expanded.stdout +++ b/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout @@ -2,12 +2,12 @@ #![no_std] //@ check-pass //@ compile-flags: -Zunpretty=expanded -#![feature(derive_smart_pointer)] +#![feature(derive_coerce_pointee)] #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; -use std::marker::SmartPointer; +use std::marker::CoercePointee; pub trait MyTrait<T: ?Sized> {} diff --git a/tests/ui/deriving/deriving-smart-pointer-neg.rs b/tests/ui/deriving/deriving-coerce-pointee-neg.rs index 41d3039236f..deef35cdf70 100644 --- a/tests/ui/deriving/deriving-smart-pointer-neg.rs +++ b/tests/ui/deriving/deriving-coerce-pointee-neg.rs @@ -1,115 +1,131 @@ -#![feature(derive_smart_pointer, arbitrary_self_types)] +#![feature(derive_coerce_pointee, arbitrary_self_types)] extern crate core; -use std::marker::SmartPointer; +use std::marker::CoercePointee; -#[derive(SmartPointer)] -//~^ ERROR: `SmartPointer` can only be derived on `struct`s with `#[repr(transparent)]` +#[derive(CoercePointee)] +//~^ ERROR: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` enum NotStruct<'a, T: ?Sized> { Variant(&'a T), } -#[derive(SmartPointer)] -//~^ ERROR: `SmartPointer` can only be derived on `struct`s with at least one field +#[derive(CoercePointee)] +//~^ ERROR: `CoercePointee` can only be derived on `struct`s with at least one field #[repr(transparent)] struct NoField<'a, #[pointee] T: ?Sized> {} //~^ ERROR: lifetime parameter `'a` is never used //~| ERROR: type parameter `T` is never used -#[derive(SmartPointer)] -//~^ ERROR: `SmartPointer` can only be derived on `struct`s with at least one field +#[derive(CoercePointee)] +//~^ ERROR: `CoercePointee` can only be derived on `struct`s with at least one field #[repr(transparent)] struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); //~^ ERROR: lifetime parameter `'a` is never used //~| ERROR: type parameter `T` is never used -#[derive(SmartPointer)] -//~^ ERROR: `SmartPointer` can only be derived on `struct`s that are generic over at least one type +#[derive(CoercePointee)] +//~^ ERROR: `CoercePointee` can only be derived on `struct`s that are generic over at least one type #[repr(transparent)] struct NoGeneric<'a>(&'a u8); -#[derive(SmartPointer)] -//~^ ERROR: exactly one generic type parameter must be marked as #[pointee] to derive SmartPointer traits +#[derive(CoercePointee)] +//~^ ERROR: exactly one generic type parameter must be marked as #[pointee] to derive CoercePointee traits #[repr(transparent)] struct AmbiguousPointee<'a, T1: ?Sized, T2: ?Sized> { a: (&'a T1, &'a T2), } -#[derive(SmartPointer)] +#[derive(CoercePointee)] #[repr(transparent)] struct TooManyPointees<'a, #[pointee] A: ?Sized, #[pointee] B: ?Sized>((&'a A, &'a B)); -//~^ ERROR: only one type parameter can be marked as `#[pointee]` when deriving SmartPointer traits +//~^ ERROR: only one type parameter can be marked as `#[pointee]` when deriving CoercePointee traits -#[derive(SmartPointer)] -//~^ ERROR: `SmartPointer` can only be derived on `struct`s with `#[repr(transparent)]` +#[derive(CoercePointee)] +//~^ ERROR: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` struct NotTransparent<'a, #[pointee] T: ?Sized> { ptr: &'a T, } -#[derive(SmartPointer)] +#[derive(CoercePointee)] #[repr(transparent)] struct NoMaybeSized<'a, #[pointee] T> { - //~^ ERROR: `derive(SmartPointer)` requires T to be marked `?Sized` + //~^ ERROR: `derive(CoercePointee)` requires T to be marked `?Sized` ptr: &'a T, } -#[derive(SmartPointer)] +#[derive(CoercePointee)] #[repr(transparent)] struct PointeeOnField<'a, #[pointee] T: ?Sized> { #[pointee] //~^ ERROR: the `#[pointee]` attribute may only be used on generic parameters - ptr: &'a T + ptr: &'a T, } -#[derive(SmartPointer)] +#[derive(CoercePointee)] #[repr(transparent)] -struct PointeeInTypeConstBlock<'a, T: ?Sized = [u32; const { struct UhOh<#[pointee] T>(T); 10 }]> { - //~^ ERROR: the `#[pointee]` attribute may only be used on generic parameters +struct PointeeInTypeConstBlock< + 'a, + T: ?Sized = [u32; const { + struct UhOh<#[pointee] T>(T); + //~^ ERROR: the `#[pointee]` attribute may only be used on generic parameters + 10 + }], +> { ptr: &'a T, } -#[derive(SmartPointer)] +#[derive(CoercePointee)] #[repr(transparent)] struct PointeeInConstConstBlock< 'a, T: ?Sized, - const V: u32 = { struct UhOh<#[pointee] T>(T); 10 }> - //~^ ERROR: the `#[pointee]` attribute may only be used on generic parameters -{ + const V: u32 = { + struct UhOh<#[pointee] T>(T); + //~^ ERROR: the `#[pointee]` attribute may only be used on generic parameters + 10 + }, +> { ptr: &'a T, } -#[derive(SmartPointer)] +#[derive(CoercePointee)] #[repr(transparent)] struct PointeeInAnotherTypeConstBlock<'a, #[pointee] T: ?Sized> { - ptr: PointeeInConstConstBlock<'a, T, { struct UhOh<#[pointee] T>(T); 0 }> - //~^ ERROR: the `#[pointee]` attribute may only be used on generic parameters + ptr: PointeeInConstConstBlock< + 'a, + T, + { + struct UhOh<#[pointee] T>(T); + //~^ ERROR: the `#[pointee]` attribute may only be used on generic parameters + 0 + }, + >, } // However, reordering attributes should work nevertheless. #[repr(transparent)] -#[derive(SmartPointer)] -struct ThisIsAPossibleSmartPointer<'a, #[pointee] T: ?Sized> { +#[derive(CoercePointee)] +struct ThisIsAPossibleCoercePointee<'a, #[pointee] T: ?Sized> { ptr: &'a T, } // Also, these paths to Sized should work -#[derive(SmartPointer)] +#[derive(CoercePointee)] #[repr(transparent)] struct StdSized<'a, #[pointee] T: ?std::marker::Sized> { ptr: &'a T, } -#[derive(SmartPointer)] +#[derive(CoercePointee)] #[repr(transparent)] struct CoreSized<'a, #[pointee] T: ?core::marker::Sized> { ptr: &'a T, } -#[derive(SmartPointer)] +#[derive(CoercePointee)] #[repr(transparent)] struct GlobalStdSized<'a, #[pointee] T: ?::std::marker::Sized> { ptr: &'a T, } -#[derive(SmartPointer)] +#[derive(CoercePointee)] #[repr(transparent)] struct GlobalCoreSized<'a, #[pointee] T: ?::core::marker::Sized> { ptr: &'a T, diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr new file mode 100644 index 00000000000..e590d636d0e --- /dev/null +++ b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr @@ -0,0 +1,119 @@ +error: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` + --> $DIR/deriving-coerce-pointee-neg.rs:6:10 + | +LL | #[derive(CoercePointee)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: `CoercePointee` can only be derived on `struct`s with at least one field + --> $DIR/deriving-coerce-pointee-neg.rs:12:10 + | +LL | #[derive(CoercePointee)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: `CoercePointee` can only be derived on `struct`s with at least one field + --> $DIR/deriving-coerce-pointee-neg.rs:19:10 + | +LL | #[derive(CoercePointee)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: `CoercePointee` can only be derived on `struct`s that are generic over at least one type + --> $DIR/deriving-coerce-pointee-neg.rs:26:10 + | +LL | #[derive(CoercePointee)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: exactly one generic type parameter must be marked as #[pointee] to derive CoercePointee traits + --> $DIR/deriving-coerce-pointee-neg.rs:31:10 + | +LL | #[derive(CoercePointee)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: only one type parameter can be marked as `#[pointee]` when deriving CoercePointee traits + --> $DIR/deriving-coerce-pointee-neg.rs:40:39 + | +LL | struct TooManyPointees<'a, #[pointee] A: ?Sized, #[pointee] B: ?Sized>((&'a A, &'a B)); + | ^ ^ + +error: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` + --> $DIR/deriving-coerce-pointee-neg.rs:43:10 + | +LL | #[derive(CoercePointee)] + | ^^^^^^^^^^^^^ + | + = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: `derive(CoercePointee)` requires T to be marked `?Sized` + --> $DIR/deriving-coerce-pointee-neg.rs:51:36 + | +LL | struct NoMaybeSized<'a, #[pointee] T> { + | ^ + +error: the `#[pointee]` attribute may only be used on generic parameters + --> $DIR/deriving-coerce-pointee-neg.rs:59:5 + | +LL | #[pointee] + | ^^^^^^^^^^ + +error: the `#[pointee]` attribute may only be used on generic parameters + --> $DIR/deriving-coerce-pointee-neg.rs:69:33 + | +LL | struct UhOh<#[pointee] T>(T); + | ^^^^^^^^^^ + +error: the `#[pointee]` attribute may only be used on generic parameters + --> $DIR/deriving-coerce-pointee-neg.rs:83:21 + | +LL | struct UhOh<#[pointee] T>(T); + | ^^^^^^^^^^ + +error: the `#[pointee]` attribute may only be used on generic parameters + --> $DIR/deriving-coerce-pointee-neg.rs:98:25 + | +LL | struct UhOh<#[pointee] T>(T); + | ^^^^^^^^^^ + +error[E0392]: lifetime parameter `'a` is never used + --> $DIR/deriving-coerce-pointee-neg.rs:15:16 + | +LL | struct NoField<'a, #[pointee] T: ?Sized> {} + | ^^ unused lifetime parameter + | + = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` + +error[E0392]: type parameter `T` is never used + --> $DIR/deriving-coerce-pointee-neg.rs:15:31 + | +LL | struct NoField<'a, #[pointee] T: ?Sized> {} + | ^ unused type parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + +error[E0392]: lifetime parameter `'a` is never used + --> $DIR/deriving-coerce-pointee-neg.rs:22:20 + | +LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); + | ^^ unused lifetime parameter + | + = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` + +error[E0392]: type parameter `T` is never used + --> $DIR/deriving-coerce-pointee-neg.rs:22:35 + | +LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); + | ^ unused type parameter + | + = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` + +error: aborting due to 16 previous errors + +For more information about this error, try `rustc --explain E0392`. diff --git a/tests/ui/deriving/deriving-smart-pointer.rs b/tests/ui/deriving/deriving-coerce-pointee.rs index d34a502da68..26762e4d0fa 100644 --- a/tests/ui/deriving/deriving-smart-pointer.rs +++ b/tests/ui/deriving/deriving-coerce-pointee.rs @@ -1,9 +1,9 @@ //@ run-pass -#![feature(derive_smart_pointer, arbitrary_self_types)] +#![feature(derive_coerce_pointee, arbitrary_self_types)] -use std::marker::SmartPointer; +use std::marker::CoercePointee; -#[derive(SmartPointer)] +#[derive(CoercePointee)] #[repr(transparent)] struct MyPointer<'a, #[pointee] T: ?Sized> { ptr: &'a T, diff --git a/tests/ui/deriving/deriving-smart-pointer-neg.stderr b/tests/ui/deriving/deriving-smart-pointer-neg.stderr deleted file mode 100644 index 9ab117698c7..00000000000 --- a/tests/ui/deriving/deriving-smart-pointer-neg.stderr +++ /dev/null @@ -1,119 +0,0 @@ -error: `SmartPointer` can only be derived on `struct`s with `#[repr(transparent)]` - --> $DIR/deriving-smart-pointer-neg.rs:6:10 - | -LL | #[derive(SmartPointer)] - | ^^^^^^^^^^^^ - | - = note: this error originates in the derive macro `SmartPointer` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: `SmartPointer` can only be derived on `struct`s with at least one field - --> $DIR/deriving-smart-pointer-neg.rs:12:10 - | -LL | #[derive(SmartPointer)] - | ^^^^^^^^^^^^ - | - = note: this error originates in the derive macro `SmartPointer` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: `SmartPointer` can only be derived on `struct`s with at least one field - --> $DIR/deriving-smart-pointer-neg.rs:19:10 - | -LL | #[derive(SmartPointer)] - | ^^^^^^^^^^^^ - | - = note: this error originates in the derive macro `SmartPointer` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: `SmartPointer` can only be derived on `struct`s that are generic over at least one type - --> $DIR/deriving-smart-pointer-neg.rs:26:10 - | -LL | #[derive(SmartPointer)] - | ^^^^^^^^^^^^ - | - = note: this error originates in the derive macro `SmartPointer` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: exactly one generic type parameter must be marked as #[pointee] to derive SmartPointer traits - --> $DIR/deriving-smart-pointer-neg.rs:31:10 - | -LL | #[derive(SmartPointer)] - | ^^^^^^^^^^^^ - | - = note: this error originates in the derive macro `SmartPointer` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: only one type parameter can be marked as `#[pointee]` when deriving SmartPointer traits - --> $DIR/deriving-smart-pointer-neg.rs:40:39 - | -LL | struct TooManyPointees<'a, #[pointee] A: ?Sized, #[pointee] B: ?Sized>((&'a A, &'a B)); - | ^ ^ - -error: `SmartPointer` can only be derived on `struct`s with `#[repr(transparent)]` - --> $DIR/deriving-smart-pointer-neg.rs:43:10 - | -LL | #[derive(SmartPointer)] - | ^^^^^^^^^^^^ - | - = note: this error originates in the derive macro `SmartPointer` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: `derive(SmartPointer)` requires T to be marked `?Sized` - --> $DIR/deriving-smart-pointer-neg.rs:51:36 - | -LL | struct NoMaybeSized<'a, #[pointee] T> { - | ^ - -error: the `#[pointee]` attribute may only be used on generic parameters - --> $DIR/deriving-smart-pointer-neg.rs:59:5 - | -LL | #[pointee] - | ^^^^^^^^^^ - -error: the `#[pointee]` attribute may only be used on generic parameters - --> $DIR/deriving-smart-pointer-neg.rs:66:74 - | -LL | struct PointeeInTypeConstBlock<'a, T: ?Sized = [u32; const { struct UhOh<#[pointee] T>(T); 10 }]> { - | ^^^^^^^^^^ - -error: the `#[pointee]` attribute may only be used on generic parameters - --> $DIR/deriving-smart-pointer-neg.rs:76:34 - | -LL | const V: u32 = { struct UhOh<#[pointee] T>(T); 10 }> - | ^^^^^^^^^^ - -error: the `#[pointee]` attribute may only be used on generic parameters - --> $DIR/deriving-smart-pointer-neg.rs:85:56 - | -LL | ptr: PointeeInConstConstBlock<'a, T, { struct UhOh<#[pointee] T>(T); 0 }> - | ^^^^^^^^^^ - -error[E0392]: lifetime parameter `'a` is never used - --> $DIR/deriving-smart-pointer-neg.rs:15:16 - | -LL | struct NoField<'a, #[pointee] T: ?Sized> {} - | ^^ unused lifetime parameter - | - = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` - -error[E0392]: type parameter `T` is never used - --> $DIR/deriving-smart-pointer-neg.rs:15:31 - | -LL | struct NoField<'a, #[pointee] T: ?Sized> {} - | ^ unused type parameter - | - = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` - -error[E0392]: lifetime parameter `'a` is never used - --> $DIR/deriving-smart-pointer-neg.rs:22:20 - | -LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); - | ^^ unused lifetime parameter - | - = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` - -error[E0392]: type parameter `T` is never used - --> $DIR/deriving-smart-pointer-neg.rs:22:35 - | -LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); - | ^ unused type parameter - | - = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` - -error: aborting due to 16 previous errors - -For more information about this error, try `rustc --explain E0392`. diff --git a/tests/ui/deriving/issue-103157.stderr b/tests/ui/deriving/issue-103157.stderr index 612a7aff225..9754b0289c0 100644 --- a/tests/ui/deriving/issue-103157.stderr +++ b/tests/ui/deriving/issue-103157.stderr @@ -5,7 +5,7 @@ LL | #[derive(PartialEq, Eq)] | -- in this derive macro expansion ... LL | Float(Option<f64>), - | ^^^^^^^^^^^ the trait `Eq` is not implemented for `f64`, which is required by `Option<f64>: Eq` + | ^^^^^^^^^^^ the trait `Eq` is not implemented for `f64` | = help: the following other types implement trait `Eq`: i128 diff --git a/tests/ui/deriving/proc-macro-attribute-mixing.rs b/tests/ui/deriving/proc-macro-attribute-mixing.rs index 489665ebeb5..80a0d068ce7 100644 --- a/tests/ui/deriving/proc-macro-attribute-mixing.rs +++ b/tests/ui/deriving/proc-macro-attribute-mixing.rs @@ -1,5 +1,5 @@ // This test certify that we can mix attribute macros from Rust and external proc-macros. -// For instance, `#[derive(Default)]` uses `#[default]` and `#[derive(SmartPointer)]` uses +// For instance, `#[derive(Default)]` uses `#[default]` and `#[derive(CoercePointee)]` uses // `#[pointee]`. // The scoping rule should allow the use of the said two attributes when external proc-macros // are in scope. @@ -8,7 +8,7 @@ //@ aux-build: another-proc-macro.rs //@ compile-flags: -Zunpretty=expanded -#![feature(derive_smart_pointer)] +#![feature(derive_coerce_pointee)] #[macro_use] extern crate another_proc_macro; diff --git a/tests/ui/deriving/proc-macro-attribute-mixing.stdout b/tests/ui/deriving/proc-macro-attribute-mixing.stdout index f314f6efbe2..03128c6c957 100644 --- a/tests/ui/deriving/proc-macro-attribute-mixing.stdout +++ b/tests/ui/deriving/proc-macro-attribute-mixing.stdout @@ -1,7 +1,7 @@ #![feature(prelude_import)] #![no_std] // This test certify that we can mix attribute macros from Rust and external proc-macros. -// For instance, `#[derive(Default)]` uses `#[default]` and `#[derive(SmartPointer)]` uses +// For instance, `#[derive(Default)]` uses `#[default]` and `#[derive(CoercePointee)]` uses // `#[pointee]`. // The scoping rule should allow the use of the said two attributes when external proc-macros // are in scope. @@ -10,7 +10,7 @@ //@ aux-build: another-proc-macro.rs //@ compile-flags: -Zunpretty=expanded -#![feature(derive_smart_pointer)] +#![feature(derive_coerce_pointee)] #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] diff --git a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr index 57851ed417e..4c4f0663eeb 100644 --- a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr +++ b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr @@ -41,6 +41,10 @@ LL | Struct { a, b } = Struct { a: 1, b: 2 }; | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | Struct { a, b: _ } = Struct { a: 1, b: 2 }; + | ~~~~~~~~ +help: or always ignore missing fields here + | LL | Struct { a, .. } = Struct { a: 1, b: 2 }; | ~~~~~~ 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 41f222e46a7..5d0c1826411 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 @@ -4,7 +4,8 @@ error[E0277]: the trait bound `&str: AsExpression<Integer>` is not satisfied LL | SelectInt.check("bar"); | ^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str` | - = help: the trait `AsExpression<Text>` is implemented for `&str` + = help: the trait `AsExpression<Integer>` is not implemented for `&str` + but trait `AsExpression<Text>` is implemented for it = help: for that trait implementation, expected `Text`, found `Integer` error: aborting due to 1 previous error 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 8c01b61191e..1e1eae852f9 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 @@ -22,7 +22,8 @@ error[E0277]: the trait bound `&str: AsExpression<Integer>` is not satisfied LL | SelectInt.check("bar"); | ^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str` | - = help: the trait `AsExpression<Text>` is implemented for `&str` + = help: the trait `AsExpression<Integer>` is not implemented for `&str` + but trait `AsExpression<Text>` is implemented for it = help: for that trait implementation, expected `Text`, found `Integer` error[E0271]: type mismatch resolving `<SelectInt as Expression>::SqlType == Text` 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 index e56af28f3fb..be17476524a 100644 --- 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 @@ -15,6 +15,10 @@ note: required by a bound in `check` | 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 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 629fc59361d..ca9a6ebc1c4 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 @@ -12,6 +12,10 @@ note: required by a bound in `check` | 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 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 629fc59361d..ca9a6ebc1c4 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 @@ -12,6 +12,10 @@ note: required by a bound in `check` | 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 diff --git a/tests/ui/drop/drop_order.rs b/tests/ui/drop/drop_order.rs index 29b68d666fc..7a999c7c330 100644 --- a/tests/ui/drop/drop_order.rs +++ b/tests/ui/drop/drop_order.rs @@ -4,8 +4,8 @@ //@ [edition2021] edition: 2021 //@ [edition2024] compile-flags: -Z unstable-options //@ [edition2024] edition: 2024 + #![feature(let_chains)] -#![cfg_attr(edition2024, feature(if_let_rescope))] use std::cell::RefCell; use std::convert::TryInto; diff --git a/tests/ui/drop/drop_order_if_let_rescope.rs b/tests/ui/drop/drop_order_if_let_rescope.rs index ae9f381820e..cea84bbaa2b 100644 --- a/tests/ui/drop/drop_order_if_let_rescope.rs +++ b/tests/ui/drop/drop_order_if_let_rescope.rs @@ -3,7 +3,6 @@ //@ compile-flags: -Z validate-mir -Zunstable-options #![feature(let_chains)] -#![feature(if_let_rescope)] use std::cell::RefCell; use std::convert::TryInto; diff --git a/tests/ui/drop/if-let-rescope-borrowck-suggestions.rs b/tests/ui/drop/if-let-rescope-borrowck-suggestions.rs index 2476f7cf258..e055c20d777 100644 --- a/tests/ui/drop/if-let-rescope-borrowck-suggestions.rs +++ b/tests/ui/drop/if-let-rescope-borrowck-suggestions.rs @@ -1,7 +1,6 @@ //@ edition: 2024 //@ compile-flags: -Z validate-mir -Zunstable-options -#![feature(if_let_rescope)] #![deny(if_let_rescope)] struct Droppy; diff --git a/tests/ui/drop/if-let-rescope-borrowck-suggestions.stderr b/tests/ui/drop/if-let-rescope-borrowck-suggestions.stderr index 0c6f1ea28d2..3c87e196af6 100644 --- a/tests/ui/drop/if-let-rescope-borrowck-suggestions.stderr +++ b/tests/ui/drop/if-let-rescope-borrowck-suggestions.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/if-let-rescope-borrowck-suggestions.rs:22:39 + --> $DIR/if-let-rescope-borrowck-suggestions.rs:21:39 | LL | do_something(if let Some(value) = Droppy.get_ref() { value } else { &0 }); | ^^^^^^ - temporary value is freed at the end of this statement @@ -7,7 +7,7 @@ LL | do_something(if let Some(value) = Droppy.get_ref() { value } else { &0 | creates a temporary value which is freed while still in use | note: lifetimes for temporaries generated in `if let`s have been shortened in Edition 2024 so that they are dropped here instead - --> $DIR/if-let-rescope-borrowck-suggestions.rs:22:64 + --> $DIR/if-let-rescope-borrowck-suggestions.rs:21:64 | LL | do_something(if let Some(value) = Droppy.get_ref() { value } else { &0 }); | ^ @@ -22,7 +22,7 @@ LL | do_something({ match Droppy.get_ref() { Some(value) => { value } _ => | ~~~~~~~ ++++++++++++++++ ~~~~ ++ error[E0716]: temporary value dropped while borrowed - --> $DIR/if-let-rescope-borrowck-suggestions.rs:24:39 + --> $DIR/if-let-rescope-borrowck-suggestions.rs:23:39 | LL | do_something(if let Some(value) = Droppy.get_ref() { | ^^^^^^ creates a temporary value which is freed while still in use @@ -31,7 +31,7 @@ LL | } else if let Some(value) = Droppy.get_ref() { | - temporary value is freed at the end of this statement | note: lifetimes for temporaries generated in `if let`s have been shortened in Edition 2024 so that they are dropped here instead - --> $DIR/if-let-rescope-borrowck-suggestions.rs:27:5 + --> $DIR/if-let-rescope-borrowck-suggestions.rs:26:5 | LL | } else if let Some(value) = Droppy.get_ref() { | ^ @@ -53,7 +53,7 @@ LL ~ }}}); | error[E0716]: temporary value dropped while borrowed - --> $DIR/if-let-rescope-borrowck-suggestions.rs:27:33 + --> $DIR/if-let-rescope-borrowck-suggestions.rs:26:33 | LL | } else if let Some(value) = Droppy.get_ref() { | ^^^^^^ creates a temporary value which is freed while still in use @@ -62,7 +62,7 @@ LL | } else { | - temporary value is freed at the end of this statement | note: lifetimes for temporaries generated in `if let`s have been shortened in Edition 2024 so that they are dropped here instead - --> $DIR/if-let-rescope-borrowck-suggestions.rs:30:5 + --> $DIR/if-let-rescope-borrowck-suggestions.rs:29:5 | LL | } else { | ^ diff --git a/tests/ui/drop/lint-if-let-rescope-gated.with_feature_gate.stderr b/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr index 48b7f3e11a6..48b7f3e11a6 100644 --- a/tests/ui/drop/lint-if-let-rescope-gated.with_feature_gate.stderr +++ b/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr diff --git a/tests/ui/drop/lint-if-let-rescope-gated.rs b/tests/ui/drop/lint-if-let-rescope-gated.rs index cef5de5a8fe..ba0246573b4 100644 --- a/tests/ui/drop/lint-if-let-rescope-gated.rs +++ b/tests/ui/drop/lint-if-let-rescope-gated.rs @@ -1,13 +1,13 @@ // This test checks that the lint `if_let_rescope` only actions -// when the feature gate is enabled. -// Edition 2021 is used here because the lint should work especially -// when edition migration towards 2024 is run. +// when Edition 2021 or prior is targeted here because the lint should work especially +// when edition migration towards 2024 is executed. -//@ revisions: with_feature_gate without_feature_gate -//@ [without_feature_gate] check-pass -//@ edition: 2021 +//@ revisions: edition2021 edition2024 +//@ [edition2021] edition: 2021 +//@ [edition2024] edition: 2024 +//@ [edition2024] compile-flags: -Zunstable-options +//@ [edition2024] check-pass -#![cfg_attr(with_feature_gate, feature(if_let_rescope))] #![deny(if_let_rescope)] #![allow(irrefutable_let_patterns)] @@ -25,10 +25,10 @@ impl Droppy { fn main() { if let Some(_value) = Droppy.get() { - //[with_feature_gate]~^ ERROR: `if let` assigns a shorter lifetime since Edition 2024 - //[with_feature_gate]~| HELP: a `match` with a single arm can preserve the drop order up to Edition 2021 - //[with_feature_gate]~| WARN: this changes meaning in Rust 2024 + //[edition2021]~^ ERROR: `if let` assigns a shorter lifetime since Edition 2024 + //[edition2021]~| HELP: a `match` with a single arm can preserve the drop order up to Edition 2021 + //[edition2021]~| WARN: this changes meaning in Rust 2024 } else { - //[with_feature_gate]~^ HELP: the value is now dropped here in Edition 2024 + //[edition2021]~^ HELP: the value is now dropped here in Edition 2024 } } diff --git a/tests/ui/drop/lint-if-let-rescope-with-macro.rs b/tests/ui/drop/lint-if-let-rescope-with-macro.rs index 282b3320d30..e7aeb81f4d1 100644 --- a/tests/ui/drop/lint-if-let-rescope-with-macro.rs +++ b/tests/ui/drop/lint-if-let-rescope-with-macro.rs @@ -4,7 +4,6 @@ //@ edition:2021 //@ compile-flags: -Z unstable-options -#![feature(if_let_rescope)] #![deny(if_let_rescope)] #![allow(irrefutable_let_patterns)] diff --git a/tests/ui/drop/lint-if-let-rescope-with-macro.stderr b/tests/ui/drop/lint-if-let-rescope-with-macro.stderr index 5fd0c61d17a..de6cf6e8500 100644 --- a/tests/ui/drop/lint-if-let-rescope-with-macro.stderr +++ b/tests/ui/drop/lint-if-let-rescope-with-macro.stderr @@ -1,5 +1,5 @@ error: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/lint-if-let-rescope-with-macro.rs:13:12 + --> $DIR/lint-if-let-rescope-with-macro.rs:12:12 | LL | if let $p = $e { $($conseq)* } else { $($alt)* } | ^^^ @@ -16,7 +16,7 @@ LL | | }; = warning: this changes meaning in Rust 2024 = note: for more information, see issue #124085 <https://github.com/rust-lang/rust/issues/124085> help: the value is now dropped here in Edition 2024 - --> $DIR/lint-if-let-rescope-with-macro.rs:13:38 + --> $DIR/lint-if-let-rescope-with-macro.rs:12:38 | LL | if let $p = $e { $($conseq)* } else { $($alt)* } | ^ @@ -29,7 +29,7 @@ LL | | {} LL | | }; | |_____- in this macro invocation note: the lint level is defined here - --> $DIR/lint-if-let-rescope-with-macro.rs:8:9 + --> $DIR/lint-if-let-rescope-with-macro.rs:7:9 | LL | #![deny(if_let_rescope)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/drop/lint-if-let-rescope.fixed b/tests/ui/drop/lint-if-let-rescope.fixed index 199068d0fd2..fec2e3b2ae7 100644 --- a/tests/ui/drop/lint-if-let-rescope.fixed +++ b/tests/ui/drop/lint-if-let-rescope.fixed @@ -1,7 +1,7 @@ //@ run-rustfix #![deny(if_let_rescope)] -#![feature(if_let_rescope, stmt_expr_attributes)] +#![feature(stmt_expr_attributes)] #![allow(irrefutable_let_patterns, unused_parens)] fn droppy() -> Droppy { diff --git a/tests/ui/drop/lint-if-let-rescope.rs b/tests/ui/drop/lint-if-let-rescope.rs index 4c043c0266c..ee184695b97 100644 --- a/tests/ui/drop/lint-if-let-rescope.rs +++ b/tests/ui/drop/lint-if-let-rescope.rs @@ -1,7 +1,7 @@ //@ run-rustfix #![deny(if_let_rescope)] -#![feature(if_let_rescope, stmt_expr_attributes)] +#![feature(stmt_expr_attributes)] #![allow(irrefutable_let_patterns, unused_parens)] fn droppy() -> Droppy { diff --git a/tests/ui/dropck/const_drop_is_valid.rs b/tests/ui/dropck/const_drop_is_valid.rs index 0441b6ed067..26ef2d61deb 100644 --- a/tests/ui/dropck/const_drop_is_valid.rs +++ b/tests/ui/dropck/const_drop_is_valid.rs @@ -1,6 +1,3 @@ -#![feature(effects)] -//~^ WARN: the feature `effects` is incomplete - struct A(); impl const Drop for A {} diff --git a/tests/ui/dropck/const_drop_is_valid.stderr b/tests/ui/dropck/const_drop_is_valid.stderr index f15b7ba946d..5837e1623a1 100644 --- a/tests/ui/dropck/const_drop_is_valid.stderr +++ b/tests/ui/dropck/const_drop_is_valid.stderr @@ -1,5 +1,5 @@ error[E0658]: const trait impls are experimental - --> $DIR/const_drop_is_valid.rs:6:6 + --> $DIR/const_drop_is_valid.rs:3:6 | LL | impl const Drop for A {} | ^^^^^ @@ -8,22 +8,8 @@ LL | impl const Drop for A {} = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const_drop_is_valid.rs:1:12 - | -LL | #![feature(effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error: const `impl` for trait `Drop` which is not marked with `#[const_trait]` - --> $DIR/const_drop_is_valid.rs:6:12 + --> $DIR/const_drop_is_valid.rs:3:12 | LL | impl const Drop for A {} | ^^^^ @@ -32,14 +18,14 @@ LL | impl const Drop for A {} = note: adding a non-const method body in the future would be a breaking change error[E0046]: not all trait items implemented, missing: `drop` - --> $DIR/const_drop_is_valid.rs:6:1 + --> $DIR/const_drop_is_valid.rs:3:1 | LL | impl const Drop for A {} | ^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation | = help: implement the missing item: `fn drop(&mut self) { todo!() }` -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 3 previous errors Some errors have detailed explanations: E0046, E0658. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/dropck/dropck_no_diverge_on_nonregular_1.rs b/tests/ui/dropck/dropck_no_diverge_on_nonregular_1.rs index 43c1c775978..17b76b6c832 100644 --- a/tests/ui/dropck/dropck_no_diverge_on_nonregular_1.rs +++ b/tests/ui/dropck/dropck_no_diverge_on_nonregular_1.rs @@ -21,6 +21,6 @@ enum FingerTree<T:'static> { } fn main() { - let ft = //~ ERROR overflow while adding drop-check rules for FingerTree + let ft = //~ ERROR overflow while adding drop-check rules for `FingerTree FingerTree::Single(1); } diff --git a/tests/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr b/tests/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr index 8f4d301b5ca..9360f4a98e9 100644 --- a/tests/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr +++ b/tests/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr @@ -1,10 +1,10 @@ -error[E0320]: overflow while adding drop-check rules for FingerTree<i32> +error[E0320]: overflow while adding drop-check rules for `FingerTree<i32>` --> $DIR/dropck_no_diverge_on_nonregular_1.rs:24:9 | LL | let ft = | ^^ | - = note: overflowed on FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<i32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + = note: overflowed on `FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<i32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` error: aborting due to 1 previous error diff --git a/tests/ui/dropck/dropck_no_diverge_on_nonregular_2.rs b/tests/ui/dropck/dropck_no_diverge_on_nonregular_2.rs index edd07652e53..d731ab09e7e 100644 --- a/tests/ui/dropck/dropck_no_diverge_on_nonregular_2.rs +++ b/tests/ui/dropck/dropck_no_diverge_on_nonregular_2.rs @@ -20,6 +20,6 @@ enum FingerTree<T:'static> { } fn main() { - let ft = //~ ERROR overflow while adding drop-check rules for FingerTree + let ft = //~ ERROR overflow while adding drop-check rules for `FingerTree FingerTree::Single(1); } diff --git a/tests/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr b/tests/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr index 4ef7aa61db7..88162989dee 100644 --- a/tests/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr +++ b/tests/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr @@ -1,10 +1,10 @@ -error[E0320]: overflow while adding drop-check rules for FingerTree<i32> +error[E0320]: overflow while adding drop-check rules for `FingerTree<i32>` --> $DIR/dropck_no_diverge_on_nonregular_2.rs:23:9 | LL | let ft = | ^^ | - = note: overflowed on FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<i32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + = note: overflowed on `FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<i32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` error: aborting due to 1 previous error diff --git a/tests/ui/dropck/dropck_no_diverge_on_nonregular_3.rs b/tests/ui/dropck/dropck_no_diverge_on_nonregular_3.rs index af7402ca4a1..d318bdcde92 100644 --- a/tests/ui/dropck/dropck_no_diverge_on_nonregular_3.rs +++ b/tests/ui/dropck/dropck_no_diverge_on_nonregular_3.rs @@ -29,7 +29,7 @@ enum Wrapper<T:'static> { } fn main() { - let w = //~ ERROR overflow while adding drop-check rules for Option + let w = //~ ERROR overflow while adding drop-check rules for `Option Some(Wrapper::Simple::<u32>); - //~^ ERROR overflow while adding drop-check rules for Wrapper + //~^ ERROR overflow while adding drop-check rules for `Wrapper } diff --git a/tests/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr b/tests/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr index deaf116b647..54cf20a3520 100644 --- a/tests/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr +++ b/tests/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr @@ -1,18 +1,18 @@ -error[E0320]: overflow while adding drop-check rules for Option<Wrapper<u32>> +error[E0320]: overflow while adding drop-check rules for `Option<Wrapper<u32>>` --> $DIR/dropck_no_diverge_on_nonregular_3.rs:32:9 | LL | let w = | ^ | - = note: overflowed on FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<u32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + = note: overflowed on `FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<u32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` -error[E0320]: overflow while adding drop-check rules for Wrapper<u32> +error[E0320]: overflow while adding drop-check rules for `Wrapper<u32>` --> $DIR/dropck_no_diverge_on_nonregular_3.rs:33:14 | LL | Some(Wrapper::Simple::<u32>); | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: overflowed on FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<u32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + = note: overflowed on `FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<u32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` error: aborting due to 2 previous errors diff --git a/tests/ui/dst/dst-bad-deep-2.stderr b/tests/ui/dst/dst-bad-deep-2.stderr index 554e81bee10..c7e9854340f 100644 --- a/tests/ui/dst/dst-bad-deep-2.stderr +++ b/tests/ui/dst/dst-bad-deep-2.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `[isize]` cannot be known at compilati LL | let h: &(([isize],),) = &(*g,); | ^^^^^ doesn't have a size known at compile-time | - = help: within `(([isize],),)`, the trait `Sized` is not implemented for `[isize]`, which is required by `(([isize],),): Sized` + = help: within `(([isize],),)`, the trait `Sized` is not implemented for `[isize]` = note: required because it appears within the type `([isize],)` = note: required because it appears within the type `(([isize],),)` = note: tuples must have a statically known size to be initialized diff --git a/tests/ui/dst/dst-bad-deep.stderr b/tests/ui/dst/dst-bad-deep.stderr index 4f180e593f8..1b0f9738ab0 100644 --- a/tests/ui/dst/dst-bad-deep.stderr +++ b/tests/ui/dst/dst-bad-deep.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `[isize]` cannot be known at compilati LL | let h: &Fat<Fat<[isize]>> = &Fat { ptr: *g }; | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `Fat<Fat<[isize]>>`, the trait `Sized` is not implemented for `[isize]`, which is required by `Fat<Fat<[isize]>>: Sized` + = help: within `Fat<Fat<[isize]>>`, the trait `Sized` is not implemented for `[isize]` note: required because it appears within the type `Fat<[isize]>` --> $DIR/dst-bad-deep.rs:6:8 | diff --git a/tests/ui/editions/edition-keywords-2015-2015-parsing.rs b/tests/ui/editions/edition-keywords-2015-2015-parsing.rs index 07104bdf217..4751d280467 100644 --- a/tests/ui/editions/edition-keywords-2015-2015-parsing.rs +++ b/tests/ui/editions/edition-keywords-2015-2015-parsing.rs @@ -13,8 +13,8 @@ pub fn check_async() { let mut r#async = 1; // OK r#async = consumes_async!(async); // OK - r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` - r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` + r#async = consumes_async!(r#async); //~ ERROR no rules expected `r#async` + r#async = consumes_async_raw!(async); //~ ERROR no rules expected `async` r#async = consumes_async_raw!(r#async); // OK if passes_ident!(async) == 1 {} // OK diff --git a/tests/ui/editions/edition-keywords-2015-2015-parsing.stderr b/tests/ui/editions/edition-keywords-2015-2015-parsing.stderr index 39944622d07..2519a9fded2 100644 --- a/tests/ui/editions/edition-keywords-2015-2015-parsing.stderr +++ b/tests/ui/editions/edition-keywords-2015-2015-parsing.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `r#async` +error: no rules expected `r#async` --> $DIR/edition-keywords-2015-2015-parsing.rs:16:31 | LL | r#async = consumes_async!(r#async); @@ -10,7 +10,7 @@ note: while trying to match `async` LL | (async) => (1) | ^^^^^ -error: no rules expected the token `async` +error: no rules expected `async` --> $DIR/edition-keywords-2015-2015-parsing.rs:17:35 | LL | r#async = consumes_async_raw!(async); diff --git a/tests/ui/editions/edition-keywords-2015-2018-parsing.rs b/tests/ui/editions/edition-keywords-2015-2018-parsing.rs index 3c294f95cd2..4404ea26fb3 100644 --- a/tests/ui/editions/edition-keywords-2015-2018-parsing.rs +++ b/tests/ui/editions/edition-keywords-2015-2018-parsing.rs @@ -13,8 +13,8 @@ pub fn check_async() { let mut r#async = 1; // OK r#async = consumes_async!(async); // OK - r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` - r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` + r#async = consumes_async!(r#async); //~ ERROR no rules expected `r#async` + r#async = consumes_async_raw!(async); //~ ERROR no rules expected `async` r#async = consumes_async_raw!(r#async); // OK if passes_ident!(async) == 1 {} // OK diff --git a/tests/ui/editions/edition-keywords-2015-2018-parsing.stderr b/tests/ui/editions/edition-keywords-2015-2018-parsing.stderr index fa83908e666..0c0e5738415 100644 --- a/tests/ui/editions/edition-keywords-2015-2018-parsing.stderr +++ b/tests/ui/editions/edition-keywords-2015-2018-parsing.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `r#async` +error: no rules expected `r#async` --> $DIR/edition-keywords-2015-2018-parsing.rs:16:31 | LL | r#async = consumes_async!(r#async); @@ -10,7 +10,7 @@ note: while trying to match `async` LL | (async) => (1) | ^^^^^ -error: no rules expected the token `async` +error: no rules expected `async` --> $DIR/edition-keywords-2015-2018-parsing.rs:17:35 | LL | r#async = consumes_async_raw!(async); diff --git a/tests/ui/editions/edition-keywords-2018-2015-parsing.rs b/tests/ui/editions/edition-keywords-2018-2015-parsing.rs index 59184543274..c346be50856 100644 --- a/tests/ui/editions/edition-keywords-2018-2015-parsing.rs +++ b/tests/ui/editions/edition-keywords-2018-2015-parsing.rs @@ -17,8 +17,8 @@ pub fn check_async() { let mut r#async = 1; // OK r#async = consumes_async!(async); // OK - r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` - r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` + r#async = consumes_async!(r#async); //~ ERROR no rules expected `r#async` + r#async = consumes_async_raw!(async); //~ ERROR no rules expected keyword `async` r#async = consumes_async_raw!(r#async); // OK if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved diff --git a/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr b/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr index 42db75f6659..aed5837abea 100644 --- a/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr +++ b/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr @@ -20,19 +20,19 @@ help: escape `async` to use it as an identifier LL | module::r#async(); | ++ -error: no rules expected the token `r#async` +error: no rules expected `r#async` --> $DIR/edition-keywords-2018-2015-parsing.rs:20:31 | LL | r#async = consumes_async!(r#async); | ^^^^^^^ no rules expected this token in macro call | -note: while trying to match `async` +note: while trying to match keyword `async` --> $DIR/auxiliary/edition-kw-macro-2015.rs:17:6 | LL | (async) => (1) | ^^^^^ -error: no rules expected the token `async` +error: no rules expected keyword `async` --> $DIR/edition-keywords-2018-2015-parsing.rs:21:35 | LL | r#async = consumes_async_raw!(async); diff --git a/tests/ui/editions/edition-keywords-2018-2018-parsing.rs b/tests/ui/editions/edition-keywords-2018-2018-parsing.rs index 4975246fa94..b75b68b3feb 100644 --- a/tests/ui/editions/edition-keywords-2018-2018-parsing.rs +++ b/tests/ui/editions/edition-keywords-2018-2018-parsing.rs @@ -24,8 +24,8 @@ pub fn check_async() { let mut r#async = 1; // OK r#async = consumes_async!(async); // OK - r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` - r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` + r#async = consumes_async!(r#async); //~ ERROR no rules expected `r#async` + r#async = consumes_async_raw!(async); //~ ERROR no rules expected keyword `async` r#async = consumes_async_raw!(r#async); // OK if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved diff --git a/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr index 4bbe1597233..6503e9cc73c 100644 --- a/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr +++ b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr @@ -20,19 +20,19 @@ help: escape `async` to use it as an identifier LL | module::r#async(); | ++ -error: no rules expected the token `r#async` +error: no rules expected `r#async` --> $DIR/edition-keywords-2018-2018-parsing.rs:27:31 | LL | r#async = consumes_async!(r#async); | ^^^^^^^ no rules expected this token in macro call | -note: while trying to match `async` +note: while trying to match keyword `async` --> $DIR/auxiliary/edition-kw-macro-2018.rs:17:6 | LL | (async) => (1) | ^^^^^ -error: no rules expected the token `async` +error: no rules expected keyword `async` --> $DIR/edition-keywords-2018-2018-parsing.rs:28:35 | LL | r#async = consumes_async_raw!(async); diff --git a/tests/ui/editions/never-type-fallback-breaking.e2021.stderr b/tests/ui/editions/never-type-fallback-breaking.e2021.stderr index 134fd098b7e..79eee2a3def 100644 --- a/tests/ui/editions/never-type-fallback-breaking.e2021.stderr +++ b/tests/ui/editions/never-type-fallback-breaking.e2021.stderr @@ -13,6 +13,10 @@ note: in edition 2024, the requirement `!: Default` will fail LL | true => Default::default(), | ^^^^^^^^^^^^^^^^^^ = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default +help: use `()` annotations to avoid fallback changes + | +LL | let x: () = match true { + | ++++ warning: this function depends on never type fallback being `()` --> $DIR/never-type-fallback-breaking.rs:27:1 @@ -28,6 +32,10 @@ note: in edition 2024, the requirement `!: Default` will fail | LL | deserialize()?; | ^^^^^^^^^^^^^ +help: use `()` annotations to avoid fallback changes + | +LL | deserialize::<()>()?; + | ++++++ warning: 2 warnings emitted diff --git a/tests/ui/enum/assoc-fn-call-on-variant.rs b/tests/ui/enum/assoc-fn-call-on-variant.rs new file mode 100644 index 00000000000..7fa8eb2da41 --- /dev/null +++ b/tests/ui/enum/assoc-fn-call-on-variant.rs @@ -0,0 +1,15 @@ +#[derive(Default)] +enum E { + A {}, + B {}, + #[default] + C, +} + +impl E { + fn f() {} +} + +fn main() { + E::A::f(); //~ ERROR failed to resolve: `A` is a variant, not a module +} diff --git a/tests/ui/enum/assoc-fn-call-on-variant.stderr b/tests/ui/enum/assoc-fn-call-on-variant.stderr new file mode 100644 index 00000000000..47fc630c923 --- /dev/null +++ b/tests/ui/enum/assoc-fn-call-on-variant.stderr @@ -0,0 +1,14 @@ +error[E0433]: failed to resolve: `A` is a variant, not a module + --> $DIR/assoc-fn-call-on-variant.rs:14:8 + | +LL | E::A::f(); + | ^ `A` is a variant, not a module + | +help: there is an enum variant `E::A`; try using the variant's enum + | +LL | E::f(); + | ~ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/error-codes/E0027.stderr b/tests/ui/error-codes/E0027.stderr index 9ae97e4a994..7bbafcf0a27 100644 --- a/tests/ui/error-codes/E0027.stderr +++ b/tests/ui/error-codes/E0027.stderr @@ -10,6 +10,10 @@ LL | Dog { age: x, name } => {} | ~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | Dog { age: x, name: _ } => {} + | ~~~~~~~~~~~ +help: or always ignore missing fields here + | LL | Dog { age: x, .. } => {} | ~~~~~~ @@ -25,6 +29,10 @@ LL | Dog { name: x, age } => {} | ~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | Dog { name: x, age: _ } => {} + | ~~~~~~~~~~ +help: or always ignore missing fields here + | LL | Dog { name: x, .. } => {} | ~~~~~~ @@ -40,6 +48,10 @@ LL | Dog { name: x, age } => {} | ~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | Dog { name: x, age: _ } => {} + | ~~~~~~~~~~ +help: or always ignore missing fields here + | LL | Dog { name: x, .. } => {} | ~~~~~~ @@ -55,6 +67,10 @@ LL | Dog { name, age } => {} | ~~~~~~~~~~~~~ help: if you don't care about these missing fields, you can explicitly ignore them | +LL | Dog { name: _, age: _ } => {} + | ~~~~~~~~~~~~~~~~~~~ +help: or always ignore missing fields here + | LL | Dog { .. } => {} | ~~~~~~ diff --git a/tests/ui/error-codes/E0094.rs b/tests/ui/error-codes/E0094.rs index 97ebcff99dc..da59d3decac 100644 --- a/tests/ui/error-codes/E0094.rs +++ b/tests/ui/error-codes/E0094.rs @@ -1,9 +1,10 @@ -#![feature(intrinsics, rustc_attrs)] +#![feature(intrinsics)] -extern "rust-intrinsic" { - #[rustc_safe_intrinsic] - fn size_of<T, U>() -> usize; //~ ERROR E0094 +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +fn size_of<T, U>() -> usize { + //~^ ERROR E0094 + loop {} } -fn main() { -} +fn main() {} diff --git a/tests/ui/error-codes/E0094.stderr b/tests/ui/error-codes/E0094.stderr index 1bad5bd950e..e45cc0ea063 100644 --- a/tests/ui/error-codes/E0094.stderr +++ b/tests/ui/error-codes/E0094.stderr @@ -1,8 +1,8 @@ error[E0094]: intrinsic has wrong number of type parameters: found 2, expected 1 - --> $DIR/E0094.rs:5:15 + --> $DIR/E0094.rs:5:11 | -LL | fn size_of<T, U>() -> usize; - | ^^^^^^ expected 1 type parameter +LL | fn size_of<T, U>() -> usize { + | ^^^^^^ expected 1 type parameter error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0277-2.stderr b/tests/ui/error-codes/E0277-2.stderr index f4e18e3bb53..9a262f75590 100644 --- a/tests/ui/error-codes/E0277-2.stderr +++ b/tests/ui/error-codes/E0277-2.stderr @@ -4,7 +4,7 @@ error[E0277]: `*const u8` cannot be sent between threads safely LL | is_send::<Foo>(); | ^^^ `*const u8` cannot be sent between threads safely | - = help: within `Foo`, the trait `Send` is not implemented for `*const u8`, which is required by `Foo: Send` + = help: within `Foo`, the trait `Send` is not implemented for `*const u8` note: required because it appears within the type `Baz` --> $DIR/E0277-2.rs:9:8 | diff --git a/tests/ui/error-codes/E0277.stderr b/tests/ui/error-codes/E0277.stderr index 52ada36574e..a9ae8971df4 100644 --- a/tests/ui/error-codes/E0277.stderr +++ b/tests/ui/error-codes/E0277.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation LL | fn f(p: Path) { } | ^^^^ doesn't have a size known at compile-time | - = help: within `Path`, the trait `Sized` is not implemented for `[u8]`, which is required by `Path: Sized` + = help: within `Path`, the trait `Sized` is not implemented for `[u8]` note: required because it appears within the type `Path` --> $SRC_DIR/std/src/path.rs:LL:COL = help: unsized fn params are gated as an unstable feature diff --git a/tests/ui/error-codes/E0308.rs b/tests/ui/error-codes/E0308.rs index dd9e0b284ea..f8f93d49a8e 100644 --- a/tests/ui/error-codes/E0308.rs +++ b/tests/ui/error-codes/E0308.rs @@ -1,10 +1,11 @@ #![feature(intrinsics)] #![feature(rustc_attrs)] -extern "rust-intrinsic" { - #[rustc_safe_intrinsic] - fn size_of<T>(); //~ ERROR E0308 +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +fn size_of<T>() { + //~^ ERROR E0308 + loop {} } -fn main() { -} +fn main() {} diff --git a/tests/ui/error-codes/E0308.stderr b/tests/ui/error-codes/E0308.stderr index 709b3119276..77e5c06e06a 100644 --- a/tests/ui/error-codes/E0308.stderr +++ b/tests/ui/error-codes/E0308.stderr @@ -1,11 +1,11 @@ error[E0308]: intrinsic has wrong type - --> $DIR/E0308.rs:6:20 + --> $DIR/E0308.rs:6:16 | -LL | fn size_of<T>(); - | ^ expected `usize`, found `()` +LL | fn size_of<T>() { + | ^ expected `usize`, found `()` | - = note: expected signature `extern "rust-intrinsic" fn() -> usize` - found signature `extern "rust-intrinsic" fn() -> ()` + = note: expected signature `fn() -> usize` + found signature `fn() -> ()` error: aborting due to 1 previous error diff --git a/tests/ui/error-festival.stderr b/tests/ui/error-festival.stderr index 26393352b2b..f71fa7e685c 100644 --- a/tests/ui/error-festival.stderr +++ b/tests/ui/error-festival.stderr @@ -2,7 +2,16 @@ error[E0425]: cannot find value `y` in this scope --> $DIR/error-festival.rs:14:5 | LL | y = 2; - | ^ help: a local variable with a similar name exists: `x` + | ^ + | +help: a local variable with a similar name exists + | +LL | x = 2; + | ~ +help: you might have meant to introduce a new binding + | +LL | let y = 2; + | +++ error[E0603]: constant `FOO` is private --> $DIR/error-festival.rs:22:10 diff --git a/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr b/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr index bd4e9348227..9228a047e87 100644 --- a/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr +++ b/tests/ui/errors/trait-bound-error-spans/blame-trait-error.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error.rs:53:46 | LL | want(Wrapper { value: Burrito { filling: q } }); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<Burrito<Q>>: T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -38,7 +38,7 @@ LL | want(Some(())); | | | required by a bound introduced by this call | - = help: the trait `Iterator` is not implemented for `()`, which is required by `Option<()>: T1` + = help: the trait `Iterator` is not implemented for `()` = help: the trait `T1` is implemented for `Option<It>` note: required for `Option<()>` to implement `T1` --> $DIR/blame-trait-error.rs:21:20 @@ -109,7 +109,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error.rs:65:45 | LL | want(&ExampleTuple::ExampleTupleVariant(q)); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `&ExampleTuple<Q>: T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -134,7 +134,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error.rs:68:31 | LL | want(&ExampleTupleVariant(q)); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `&ExampleTuple<Q>: T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -159,7 +159,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error.rs:71:50 | LL | want(&ExampleOtherTuple::ExampleTupleVariant(q)); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `&ExampleTuple<Q>: T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -184,7 +184,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error.rs:74:44 | LL | want(&ExampleDifferentTupleVariantName(q)); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `&ExampleTuple<Q>: T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -209,7 +209,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error.rs:77:45 | LL | want(&ExampleYetAnotherTupleVariantName(q)); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `&ExampleTuple<Q>: T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -234,7 +234,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error.rs:80:56 | LL | want(&ExampleStruct::ExampleStructVariant { field: q }); - | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q`, which is required by `&ExampleStruct<Q>: T1` + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` | note: required for `ExampleStruct<Q>` to implement `T1` --> $DIR/blame-trait-error.rs:45:9 @@ -257,7 +257,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error.rs:83:41 | LL | want(&ExampleStructVariant { field: q }); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `&ExampleStruct<Q>: T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -282,7 +282,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error.rs:86:61 | LL | want(&ExampleOtherStruct::ExampleStructVariant { field: q }); - | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q`, which is required by `&ExampleStruct<Q>: T1` + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` | note: required for `ExampleStruct<Q>` to implement `T1` --> $DIR/blame-trait-error.rs:45:9 @@ -305,7 +305,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error.rs:89:54 | LL | want(&ExampleDifferentStructVariantName { field: q }); - | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q`, which is required by `&ExampleStruct<Q>: T1` + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` | note: required for `ExampleStruct<Q>` to implement `T1` --> $DIR/blame-trait-error.rs:45:9 @@ -328,7 +328,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error.rs:92:55 | LL | want(&ExampleYetAnotherStructVariantName { field: q }); - | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q`, which is required by `&ExampleStruct<Q>: T1` + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` | note: required for `ExampleStruct<Q>` to implement `T1` --> $DIR/blame-trait-error.rs:45:9 @@ -351,7 +351,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error.rs:95:38 | LL | want(&ExampleActuallyTupleStruct(q, 0)); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `&ExampleActuallyTupleStruct<Q>: T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -376,7 +376,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error.rs:98:43 | LL | want(&ExampleActuallyTupleStructOther(q, 0)); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `&ExampleActuallyTupleStruct<Q>: T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | diff --git a/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr b/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr index a2df6843f43..b6a24e12bcc 100644 --- a/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr +++ b/tests/ui/errors/traits/blame-trait-error-spans-on-exprs.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error-spans-on-exprs.rs:81:60 | LL | want(Wrapper { value: Burrito { spicy: false, filling: q } }); - | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<Burrito<Q>>: T1` + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` | note: required for `Burrito<Q>` to implement `T2` --> $DIR/blame-trait-error-spans-on-exprs.rs:22:13 @@ -32,7 +32,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error-spans-on-exprs.rs:85:84 | LL | want(Wrapper { value: BurritoKinds::SmallBurrito { spicy: true, small_filling: q } }); - | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<BurritoKinds<Q>>: T1` + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` | note: required for `BurritoKinds<Q>` to implement `T2` --> $DIR/blame-trait-error-spans-on-exprs.rs:32:13 @@ -62,7 +62,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error-spans-on-exprs.rs:89:39 | LL | want(Wrapper { value: Taco(false, q) }); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<Taco<Q>>: T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -94,7 +94,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error-spans-on-exprs.rs:93:53 | LL | want(Wrapper { value: TacoKinds::OneTaco(false, q) }); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<TacoKinds<Q>>: T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -126,7 +126,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error-spans-on-exprs.rs:97:74 | LL | want(Wrapper { value: GenericBurrito { spiciness: NotSpicy, filling: q } }); - | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<GenericBurrito<NotSpicy, Q>>: T1` + | ---- required by a bound introduced by this call ^ the trait `T3` is not implemented for `Q` | note: required for `GenericBurrito<NotSpicy, Q>` to implement `T2` --> $DIR/blame-trait-error-spans-on-exprs.rs:47:16 @@ -156,7 +156,7 @@ error[E0277]: the trait bound `Q: T2` is not satisfied --> $DIR/blame-trait-error-spans-on-exprs.rs:101:14 | LL | want((3, q)); - | ---- ^ the trait `T2` is not implemented for `Q`, which is required by `({integer}, Q): T1` + | ---- ^ the trait `T2` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -181,7 +181,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error-spans-on-exprs.rs:105:31 | LL | want(Wrapper { value: (3, q) }); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<({integer}, Q)>: T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -213,7 +213,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error-spans-on-exprs.rs:109:15 | LL | want(((3, q), 5)); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `(({integer}, Q), {integer}): T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -245,7 +245,7 @@ error[E0277]: the trait bound `Q: T1` is not satisfied --> $DIR/blame-trait-error-spans-on-exprs.rs:112:49 | LL | want(DoubleWrapper { item: Wrapper { value: q } }); - | ---- ^ the trait `T1` is not implemented for `Q`, which is required by `DoubleWrapper<Q>: T1` + | ---- ^ the trait `T1` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -270,7 +270,7 @@ error[E0277]: the trait bound `Q: T1` is not satisfied --> $DIR/blame-trait-error-spans-on-exprs.rs:115:88 | LL | want(DoubleWrapper { item: Wrapper { value: DoubleWrapper { item: Wrapper { value: q } } } }); - | ---- required by a bound introduced by this call ^ the trait `T1` is not implemented for `Q`, which is required by `DoubleWrapper<DoubleWrapper<Q>>: T1` + | ---- required by a bound introduced by this call ^ the trait `T1` is not implemented for `Q` | note: required for `DoubleWrapper<Q>` to implement `T1` --> $DIR/blame-trait-error-spans-on-exprs.rs:72:13 @@ -295,7 +295,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error-spans-on-exprs.rs:119:27 | LL | want(Wrapper { value: AliasBurrito { spiciness: q, filling: q } }); - | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `T3` is not implemented for `Q`, which is required by `Wrapper<GenericBurrito<Q, Q>>: T1` + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -327,7 +327,7 @@ error[E0277]: the trait bound `Q: T1` is not satisfied --> $DIR/blame-trait-error-spans-on-exprs.rs:122:35 | LL | want(Two { a: Two { a: (), b: q }, b: () }); - | ---- ^ the trait `T1` is not implemented for `Q`, which is required by `Two<Two<(), Q>, ()>: T1` + | ---- ^ the trait `T1` is not implemented for `Q` | | | required by a bound introduced by this call | @@ -354,7 +354,7 @@ error[E0277]: the trait bound `Q: T1` is not satisfied LL | want( | ---- required by a bound introduced by this call LL | Two { a: Two { a: (), b: Two { a: Two { a: (), b: q }, b: () } }, b: () }, - | ^ the trait `T1` is not implemented for `Q`, which is required by `Two<Two<(), Two<Two<(), Q>, ()>>, ()>: T1` + | ^ the trait `T1` is not implemented for `Q` | note: required for `Two<Two<(), Q>, ()>` to implement `T1` --> $DIR/blame-trait-error-spans-on-exprs.rs:66:19 @@ -379,7 +379,7 @@ error[E0277]: the trait bound `Q: T3` is not satisfied --> $DIR/blame-trait-error-spans-on-exprs.rs:133:44 | LL | want(&Burrito { spicy: false, filling: q }); - | ---- ^ the trait `T3` is not implemented for `Q`, which is required by `&Burrito<Q>: T1` + | ---- ^ the trait `T3` is not implemented for `Q` | | | required by a bound introduced by this call | diff --git a/tests/ui/explore-issue-38412.rs b/tests/ui/explore-issue-38412.rs index 836cb98b5b3..e1295a96ba5 100644 --- a/tests/ui/explore-issue-38412.rs +++ b/tests/ui/explore-issue-38412.rs @@ -18,7 +18,7 @@ fn main() { let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } = Record::new(); - //~^^ ERROR use of unstable library feature 'unstable_undeclared' + //~^^ ERROR use of unstable library feature `unstable_undeclared` let r = Record::new(); let t = Tuple::new(); diff --git a/tests/ui/explore-issue-38412.stderr b/tests/ui/explore-issue-38412.stderr index a45ec688855..884184ec16e 100644 --- a/tests/ui/explore-issue-38412.stderr +++ b/tests/ui/explore-issue-38412.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_undeclared' +error[E0658]: use of unstable library feature `unstable_undeclared` --> $DIR/explore-issue-38412.rs:19:63 | LL | let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } = @@ -8,7 +8,7 @@ LL | let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_un = help: add `#![feature(unstable_undeclared)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_undeclared' +error[E0658]: use of unstable library feature `unstable_undeclared` --> $DIR/explore-issue-38412.rs:28:5 | LL | r.a_unstable_undeclared_pub; @@ -36,7 +36,7 @@ error[E0616]: field `d_priv` of struct `Record` is private LL | r.d_priv; | ^^^^^^ private field -error[E0658]: use of unstable library feature 'unstable_undeclared' +error[E0658]: use of unstable library feature `unstable_undeclared` --> $DIR/explore-issue-38412.rs:35:5 | LL | t.2; @@ -64,7 +64,7 @@ error[E0616]: field `5` of struct `pub_and_stability::Tuple` is private LL | t.5; | ^ private field -error[E0658]: use of unstable library feature 'unstable_undeclared' +error[E0658]: use of unstable library feature `unstable_undeclared` --> $DIR/explore-issue-38412.rs:42:7 | LL | r.unstable_undeclared_trait_method(); @@ -74,7 +74,7 @@ LL | r.unstable_undeclared_trait_method(); = help: add `#![feature(unstable_undeclared)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_undeclared' +error[E0658]: use of unstable library feature `unstable_undeclared` --> $DIR/explore-issue-38412.rs:46:7 | LL | r.unstable_undeclared(); @@ -117,7 +117,7 @@ LL | r.private(); LL | fn private(&self) -> i32 { self.d_priv } | ------------------------ private method defined here -error[E0658]: use of unstable library feature 'unstable_undeclared' +error[E0658]: use of unstable library feature `unstable_undeclared` --> $DIR/explore-issue-38412.rs:55:7 | LL | t.unstable_undeclared_trait_method(); @@ -127,7 +127,7 @@ LL | t.unstable_undeclared_trait_method(); = help: add `#![feature(unstable_undeclared)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_undeclared' +error[E0658]: use of unstable library feature `unstable_undeclared` --> $DIR/explore-issue-38412.rs:59:7 | LL | t.unstable_undeclared(); diff --git a/tests/ui/extern/extern-types-unsized.stderr b/tests/ui/extern/extern-types-unsized.stderr index 7428e6a60b5..a587d4dda55 100644 --- a/tests/ui/extern/extern-types-unsized.stderr +++ b/tests/ui/extern/extern-types-unsized.stderr @@ -21,7 +21,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim LL | assert_sized::<Foo>(); | ^^^ doesn't have a size known at compile-time | - = help: within `Foo`, the trait `Sized` is not implemented for `A`, which is required by `Foo: Sized` + = help: within `Foo`, the trait `Sized` is not implemented for `A` note: required because it appears within the type `Foo` --> $DIR/extern-types-unsized.rs:9:8 | @@ -43,7 +43,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim LL | assert_sized::<Bar<A>>(); | ^^^^^^ doesn't have a size known at compile-time | - = help: within `Bar<A>`, the trait `Sized` is not implemented for `A`, which is required by `Bar<A>: Sized` + = help: within `Bar<A>`, the trait `Sized` is not implemented for `A` note: required because it appears within the type `Bar<A>` --> $DIR/extern-types-unsized.rs:14:8 | @@ -65,7 +65,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim LL | assert_sized::<Bar<Bar<A>>>(); | ^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `Bar<Bar<A>>`, the trait `Sized` is not implemented for `A`, which is required by `Bar<Bar<A>>: Sized` + = help: within `Bar<Bar<A>>`, the trait `Sized` is not implemented for `A` note: required because it appears within the type `Bar<A>` --> $DIR/extern-types-unsized.rs:14:8 | diff --git a/tests/ui/extern/extern-with-type-bounds.rs b/tests/ui/extern/extern-with-type-bounds.rs index 99e9801fd40..3fbddfc99a6 100644 --- a/tests/ui/extern/extern-with-type-bounds.rs +++ b/tests/ui/extern/extern-with-type-bounds.rs @@ -1,18 +1,17 @@ #![feature(intrinsics, rustc_attrs)] -extern "rust-intrinsic" { - // Real example from libcore - #[rustc_safe_intrinsic] - fn type_id<T: ?Sized + 'static>() -> u64; +// Intrinsics are the only (?) extern blocks supporting generics. +// Once intrinsics have to be declared via `#[rustc_intrinsic]`, +// the entire support for generics in extern fn can probably be removed. +extern "rust-intrinsic" { // Silent bounds made explicit to make sure they are actually // resolved. fn transmute<T: Sized, U: Sized>(val: T) -> U; // Bounds aren't checked right now, so this should work // even though it's incorrect. - #[rustc_safe_intrinsic] - fn size_of<T: Clone>() -> usize; + fn size_of_val<T: Clone>(x: *const T) -> usize; // Unresolved bounds should still error. fn align_of<T: NoSuchTrait>() -> usize; diff --git a/tests/ui/extern/extern-with-type-bounds.stderr b/tests/ui/extern/extern-with-type-bounds.stderr index 42448d9e924..893947e831f 100644 --- a/tests/ui/extern/extern-with-type-bounds.stderr +++ b/tests/ui/extern/extern-with-type-bounds.stderr @@ -1,5 +1,5 @@ error[E0405]: cannot find trait `NoSuchTrait` in this scope - --> $DIR/extern-with-type-bounds.rs:18:20 + --> $DIR/extern-with-type-bounds.rs:17:20 | LL | fn align_of<T: NoSuchTrait>() -> usize; | ^^^^^^^^^^^ not found in this scope diff --git a/tests/ui/fail-simple.rs b/tests/ui/fail-simple.rs index cd81a5d0a0f..55e547ee72b 100644 --- a/tests/ui/fail-simple.rs +++ b/tests/ui/fail-simple.rs @@ -1,3 +1,3 @@ fn main() { - panic!(@); //~ ERROR no rules expected the token `@` + panic!(@); //~ ERROR no rules expected `@` } diff --git a/tests/ui/fail-simple.stderr b/tests/ui/fail-simple.stderr index 39fec3e2517..50c350b3ef5 100644 --- a/tests/ui/fail-simple.stderr +++ b/tests/ui/fail-simple.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `@` +error: no rules expected `@` --> $DIR/fail-simple.rs:2:12 | LL | panic!(@); diff --git a/tests/ui/feature-gates/bench.rs b/tests/ui/feature-gates/bench.rs index 2ce1d50fbb0..12e646f7a32 100644 --- a/tests/ui/feature-gates/bench.rs +++ b/tests/ui/feature-gates/bench.rs @@ -1,9 +1,9 @@ //@ edition:2018 -#[bench] //~ ERROR use of unstable library feature 'test' +#[bench] //~ ERROR use of unstable library feature `test` //~| WARN this was previously accepted fn bench() {} -use bench as _; //~ ERROR use of unstable library feature 'test' +use bench as _; //~ ERROR use of unstable library feature `test` //~| WARN this was previously accepted fn main() {} diff --git a/tests/ui/feature-gates/bench.stderr b/tests/ui/feature-gates/bench.stderr index df935560fd6..de78e863012 100644 --- a/tests/ui/feature-gates/bench.stderr +++ b/tests/ui/feature-gates/bench.stderr @@ -1,4 +1,4 @@ -error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable +error: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable --> $DIR/bench.rs:3:3 | LL | #[bench] @@ -8,7 +8,7 @@ LL | #[bench] = note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266> = note: `#[deny(soft_unstable)]` on by default -error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable +error: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable --> $DIR/bench.rs:7:5 | LL | use bench as _; @@ -20,7 +20,7 @@ LL | use bench as _; error: aborting due to 2 previous errors Future incompatibility report: Future breakage diagnostic: -error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable +error: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable --> $DIR/bench.rs:3:3 | LL | #[bench] @@ -31,7 +31,7 @@ LL | #[bench] = note: `#[deny(soft_unstable)]` on by default Future breakage diagnostic: -error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable +error: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable --> $DIR/bench.rs:7:5 | LL | use bench as _; diff --git a/tests/ui/feature-gates/feature-gate-alloc-error-handler.rs b/tests/ui/feature-gates/feature-gate-alloc-error-handler.rs index 2d099e24db8..a2a4b3f19d9 100644 --- a/tests/ui/feature-gates/feature-gate-alloc-error-handler.rs +++ b/tests/ui/feature-gates/feature-gate-alloc-error-handler.rs @@ -5,7 +5,7 @@ use core::alloc::Layout; -#[alloc_error_handler] //~ ERROR use of unstable library feature 'alloc_error_handler' +#[alloc_error_handler] //~ ERROR use of unstable library feature `alloc_error_handler` fn oom(info: Layout) -> ! { loop {} } diff --git a/tests/ui/feature-gates/feature-gate-alloc-error-handler.stderr b/tests/ui/feature-gates/feature-gate-alloc-error-handler.stderr index 2ebd7cd9b02..ae41ee55d3d 100644 --- a/tests/ui/feature-gates/feature-gate-alloc-error-handler.stderr +++ b/tests/ui/feature-gates/feature-gate-alloc-error-handler.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'alloc_error_handler' +error[E0658]: use of unstable library feature `alloc_error_handler` --> $DIR/feature-gate-alloc-error-handler.rs:8:3 | LL | #[alloc_error_handler] diff --git a/tests/ui/feature-gates/feature-gate-autodiff-use.has_support.stderr b/tests/ui/feature-gates/feature-gate-autodiff-use.has_support.stderr index 36a017dd53c..15ef257fbd8 100644 --- a/tests/ui/feature-gates/feature-gate-autodiff-use.has_support.stderr +++ b/tests/ui/feature-gates/feature-gate-autodiff-use.has_support.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'autodiff' +error[E0658]: use of unstable library feature `autodiff` --> $DIR/feature-gate-autodiff-use.rs:13:3 | LL | #[autodiff(dfoo, Reverse)] @@ -8,7 +8,7 @@ LL | #[autodiff(dfoo, Reverse)] = help: add `#![feature(autodiff)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'autodiff' +error[E0658]: use of unstable library feature `autodiff` --> $DIR/feature-gate-autodiff-use.rs:9:5 | LL | use std::autodiff::autodiff; diff --git a/tests/ui/feature-gates/feature-gate-autodiff-use.no_support.stderr b/tests/ui/feature-gates/feature-gate-autodiff-use.no_support.stderr index 4b767f824c8..f59e4955452 100644 --- a/tests/ui/feature-gates/feature-gate-autodiff-use.no_support.stderr +++ b/tests/ui/feature-gates/feature-gate-autodiff-use.no_support.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'autodiff' +error[E0658]: use of unstable library feature `autodiff` --> $DIR/feature-gate-autodiff-use.rs:13:3 | LL | #[autodiff(dfoo, Reverse)] @@ -14,7 +14,7 @@ error: this rustc version does not support autodiff LL | #[autodiff(dfoo, Reverse)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0658]: use of unstable library feature 'autodiff' +error[E0658]: use of unstable library feature `autodiff` --> $DIR/feature-gate-autodiff-use.rs:9:5 | LL | use std::autodiff::autodiff; diff --git a/tests/ui/feature-gates/feature-gate-autodiff-use.rs b/tests/ui/feature-gates/feature-gate-autodiff-use.rs index 2276a79d6e2..602e830b0b2 100644 --- a/tests/ui/feature-gates/feature-gate-autodiff-use.rs +++ b/tests/ui/feature-gates/feature-gate-autodiff-use.rs @@ -7,11 +7,11 @@ #![crate_type = "lib"] use std::autodiff::autodiff; -//[has_support]~^ ERROR use of unstable library feature 'autodiff' -//[no_support]~^^ ERROR use of unstable library feature 'autodiff' +//[has_support]~^ ERROR use of unstable library feature `autodiff` +//[no_support]~^^ ERROR use of unstable library feature `autodiff` #[autodiff(dfoo, Reverse)] -//[has_support]~^ ERROR use of unstable library feature 'autodiff' [E0658] -//[no_support]~^^ ERROR use of unstable library feature 'autodiff' [E0658] +//[has_support]~^ ERROR use of unstable library feature `autodiff` [E0658] +//[no_support]~^^ ERROR use of unstable library feature `autodiff` [E0658] //[no_support]~| ERROR this rustc version does not support autodiff fn foo() {} diff --git a/tests/ui/feature-gates/feature-gate-concat_bytes.rs b/tests/ui/feature-gates/feature-gate-concat_bytes.rs index 07d63cb11e0..abdaa725784 100644 --- a/tests/ui/feature-gates/feature-gate-concat_bytes.rs +++ b/tests/ui/feature-gates/feature-gate-concat_bytes.rs @@ -1,4 +1,4 @@ fn main() { - let a = concat_bytes!(b'A', b"BC"); //~ ERROR use of unstable library feature 'concat_bytes' + let a = concat_bytes!(b'A', b"BC"); //~ ERROR use of unstable library feature `concat_bytes` assert_eq!(a, &[65, 66, 67]); } diff --git a/tests/ui/feature-gates/feature-gate-concat_bytes.stderr b/tests/ui/feature-gates/feature-gate-concat_bytes.stderr index ed9692d3693..4f75e143e9a 100644 --- a/tests/ui/feature-gates/feature-gate-concat_bytes.stderr +++ b/tests/ui/feature-gates/feature-gate-concat_bytes.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'concat_bytes' +error[E0658]: use of unstable library feature `concat_bytes` --> $DIR/feature-gate-concat_bytes.rs:2:13 | LL | let a = concat_bytes!(b'A', b"BC"); diff --git a/tests/ui/feature-gates/feature-gate-concat_idents.stderr b/tests/ui/feature-gates/feature-gate-concat_idents.stderr index eaaef0f2539..d0f4fe62d04 100644 --- a/tests/ui/feature-gates/feature-gate-concat_idents.stderr +++ b/tests/ui/feature-gates/feature-gate-concat_idents.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'concat_idents': `concat_idents` is not stable enough for use and is subject to change +error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change --> $DIR/feature-gate-concat_idents.rs:5:13 | LL | let a = concat_idents!(X, Y_1); @@ -8,7 +8,7 @@ LL | let a = concat_idents!(X, Y_1); = help: add `#![feature(concat_idents)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'concat_idents': `concat_idents` is not stable enough for use and is subject to change +error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change --> $DIR/feature-gate-concat_idents.rs:6:13 | LL | let b = concat_idents!(X, Y_2); diff --git a/tests/ui/feature-gates/feature-gate-concat_idents2.stderr b/tests/ui/feature-gates/feature-gate-concat_idents2.stderr index 2fe786ff406..2052813ea4a 100644 --- a/tests/ui/feature-gates/feature-gate-concat_idents2.stderr +++ b/tests/ui/feature-gates/feature-gate-concat_idents2.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'concat_idents': `concat_idents` is not stable enough for use and is subject to change +error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change --> $DIR/feature-gate-concat_idents2.rs:2:5 | LL | concat_idents!(a, b); diff --git a/tests/ui/feature-gates/feature-gate-concat_idents3.stderr b/tests/ui/feature-gates/feature-gate-concat_idents3.stderr index a7daa1f949f..b186601d0ed 100644 --- a/tests/ui/feature-gates/feature-gate-concat_idents3.stderr +++ b/tests/ui/feature-gates/feature-gate-concat_idents3.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'concat_idents': `concat_idents` is not stable enough for use and is subject to change +error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change --> $DIR/feature-gate-concat_idents3.rs:5:20 | LL | assert_eq!(10, concat_idents!(X, Y_1)); @@ -8,7 +8,7 @@ LL | assert_eq!(10, concat_idents!(X, Y_1)); = help: add `#![feature(concat_idents)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'concat_idents': `concat_idents` is not stable enough for use and is subject to change +error[E0658]: use of unstable library feature `concat_idents`: `concat_idents` is not stable enough for use and is subject to change --> $DIR/feature-gate-concat_idents3.rs:6:20 | LL | assert_eq!(20, concat_idents!(X, Y_2)); diff --git a/tests/ui/feature-gates/feature-gate-custom_mir.stderr b/tests/ui/feature-gates/feature-gate-custom_mir.stderr index 118eab144bf..eeceb0355ee 100644 --- a/tests/ui/feature-gates/feature-gate-custom_mir.stderr +++ b/tests/ui/feature-gates/feature-gate-custom_mir.stderr @@ -7,7 +7,7 @@ LL | #[custom_mir(dialect = "built")] = help: add `#![feature(custom_mir)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'custom_mir': MIR is an implementation detail and extremely unstable +error[E0658]: use of unstable library feature `custom_mir`: MIR is an implementation detail and extremely unstable --> $DIR/feature-gate-custom_mir.rs:4:5 | LL | use core::intrinsics::mir::*; @@ -16,7 +16,7 @@ LL | use core::intrinsics::mir::*; = help: add `#![feature(custom_mir)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'custom_mir': MIR is an implementation detail and extremely unstable +error[E0658]: use of unstable library feature `custom_mir`: MIR is an implementation detail and extremely unstable --> $DIR/feature-gate-custom_mir.rs:10:13 | LL | Return() diff --git a/tests/ui/feature-gates/feature-gate-custom_test_frameworks.stderr b/tests/ui/feature-gates/feature-gate-custom_test_frameworks.stderr index 016be980d4d..7744759be57 100644 --- a/tests/ui/feature-gates/feature-gate-custom_test_frameworks.stderr +++ b/tests/ui/feature-gates/feature-gate-custom_test_frameworks.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'custom_test_frameworks': custom test frameworks are an unstable feature +error[E0658]: use of unstable library feature `custom_test_frameworks`: custom test frameworks are an unstable feature --> $DIR/feature-gate-custom_test_frameworks.rs:3:3 | LL | #[test_case] diff --git a/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.rs b/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.rs new file mode 100644 index 00000000000..d730849dcf6 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.rs @@ -0,0 +1,9 @@ +use std::marker::CoercePointee; //~ ERROR use of unstable library feature `derive_coerce_pointee` + +#[derive(CoercePointee)] //~ ERROR use of unstable library feature `derive_coerce_pointee` +#[repr(transparent)] +struct MyPointer<'a, #[pointee] T: ?Sized> { + ptr: &'a T, +} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.stderr b/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.stderr new file mode 100644 index 00000000000..19babe149d9 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-derive-coerce-pointee.stderr @@ -0,0 +1,23 @@ +error[E0658]: use of unstable library feature `derive_coerce_pointee` + --> $DIR/feature-gate-derive-coerce-pointee.rs:3:10 + | +LL | #[derive(CoercePointee)] + | ^^^^^^^^^^^^^ + | + = note: see issue #123430 <https://github.com/rust-lang/rust/issues/123430> for more information + = help: add `#![feature(derive_coerce_pointee)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: use of unstable library feature `derive_coerce_pointee` + --> $DIR/feature-gate-derive-coerce-pointee.rs:1:5 + | +LL | use std::marker::CoercePointee; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #123430 <https://github.com/rust-lang/rust/issues/123430> for more information + = help: add `#![feature(derive_coerce_pointee)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-derive-smart-pointer.rs b/tests/ui/feature-gates/feature-gate-derive-smart-pointer.rs deleted file mode 100644 index 7b4764ee768..00000000000 --- a/tests/ui/feature-gates/feature-gate-derive-smart-pointer.rs +++ /dev/null @@ -1,9 +0,0 @@ -use std::marker::SmartPointer; //~ ERROR use of unstable library feature 'derive_smart_pointer' - -#[derive(SmartPointer)] //~ ERROR use of unstable library feature 'derive_smart_pointer' -#[repr(transparent)] -struct MyPointer<'a, #[pointee] T: ?Sized> { - ptr: &'a T, -} - -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-derive-smart-pointer.stderr b/tests/ui/feature-gates/feature-gate-derive-smart-pointer.stderr deleted file mode 100644 index ea4d1271b7c..00000000000 --- a/tests/ui/feature-gates/feature-gate-derive-smart-pointer.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0658]: use of unstable library feature 'derive_smart_pointer' - --> $DIR/feature-gate-derive-smart-pointer.rs:3:10 - | -LL | #[derive(SmartPointer)] - | ^^^^^^^^^^^^ - | - = note: see issue #123430 <https://github.com/rust-lang/rust/issues/123430> for more information - = help: add `#![feature(derive_smart_pointer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: use of unstable library feature 'derive_smart_pointer' - --> $DIR/feature-gate-derive-smart-pointer.rs:1:5 - | -LL | use std::marker::SmartPointer; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #123430 <https://github.com/rust-lang/rust/issues/123430> for more information - = help: add `#![feature(derive_smart_pointer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-format_args_nl.stderr b/tests/ui/feature-gates/feature-gate-format_args_nl.stderr index f72d34d9b0b..c7e8f8c686f 100644 --- a/tests/ui/feature-gates/feature-gate-format_args_nl.stderr +++ b/tests/ui/feature-gates/feature-gate-format_args_nl.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'format_args_nl': `format_args_nl` is only for internal language use and is subject to change +error[E0658]: use of unstable library feature `format_args_nl`: `format_args_nl` is only for internal language use and is subject to change --> $DIR/feature-gate-format_args_nl.rs:2:5 | LL | format_args_nl!(""); diff --git a/tests/ui/feature-gates/feature-gate-if-let-rescope.rs b/tests/ui/feature-gates/feature-gate-if-let-rescope.rs deleted file mode 100644 index bd1efd4fb7c..00000000000 --- a/tests/ui/feature-gates/feature-gate-if-let-rescope.rs +++ /dev/null @@ -1,27 +0,0 @@ -// This test shows the code that could have been accepted by enabling #![feature(if_let_rescope)] - -struct A; -struct B<'a, T>(&'a mut T); - -impl A { - fn f(&mut self) -> Option<B<'_, Self>> { - Some(B(self)) - } -} - -impl<'a, T> Drop for B<'a, T> { - fn drop(&mut self) { - // this is needed to keep NLL's hands off and to ensure - // the inner mutable borrow stays alive - } -} - -fn main() { - let mut a = A; - if let None = a.f().as_ref() { - unreachable!() - } else { - a.f().unwrap(); - //~^ ERROR cannot borrow `a` as mutable more than once at a time - }; -} diff --git a/tests/ui/feature-gates/feature-gate-if-let-rescope.stderr b/tests/ui/feature-gates/feature-gate-if-let-rescope.stderr deleted file mode 100644 index ff1846ae0b1..00000000000 --- a/tests/ui/feature-gates/feature-gate-if-let-rescope.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0499]: cannot borrow `a` as mutable more than once at a time - --> $DIR/feature-gate-if-let-rescope.rs:24:9 - | -LL | if let None = a.f().as_ref() { - | ----- - | | - | first mutable borrow occurs here - | a temporary with access to the first borrow is created here ... -... -LL | a.f().unwrap(); - | ^ second mutable borrow occurs here -LL | -LL | }; - | - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option<B<'_, A>>` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0499`. diff --git a/tests/ui/feature-gates/feature-gate-log_syntax.stderr b/tests/ui/feature-gates/feature-gate-log_syntax.stderr index 0eba231a287..78152b50e89 100644 --- a/tests/ui/feature-gates/feature-gate-log_syntax.stderr +++ b/tests/ui/feature-gates/feature-gate-log_syntax.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'log_syntax': `log_syntax!` is not stable enough for use and is subject to change +error[E0658]: use of unstable library feature `log_syntax`: `log_syntax!` is not stable enough for use and is subject to change --> $DIR/feature-gate-log_syntax.rs:2:5 | LL | log_syntax!() diff --git a/tests/ui/feature-gates/feature-gate-log_syntax2.stderr b/tests/ui/feature-gates/feature-gate-log_syntax2.stderr index e1f92dd60a3..8875de2281b 100644 --- a/tests/ui/feature-gates/feature-gate-log_syntax2.stderr +++ b/tests/ui/feature-gates/feature-gate-log_syntax2.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'log_syntax': `log_syntax!` is not stable enough for use and is subject to change +error[E0658]: use of unstable library feature `log_syntax`: `log_syntax!` is not stable enough for use and is subject to change --> $DIR/feature-gate-log_syntax2.rs:2:22 | LL | println!("{:?}", log_syntax!()); diff --git a/tests/ui/feature-gates/feature-gate-naked_functions.rs b/tests/ui/feature-gates/feature-gate-naked_functions.rs index 5fe0bbdc774..abb55b9a557 100644 --- a/tests/ui/feature-gates/feature-gate-naked_functions.rs +++ b/tests/ui/feature-gates/feature-gate-naked_functions.rs @@ -1,13 +1,13 @@ //@ needs-asm-support use std::arch::naked_asm; -//~^ ERROR use of unstable library feature 'naked_functions' +//~^ ERROR use of unstable library feature `naked_functions` #[naked] //~^ the `#[naked]` attribute is an experimental feature extern "C" fn naked() { naked_asm!("") - //~^ ERROR use of unstable library feature 'naked_functions' + //~^ ERROR use of unstable library feature `naked_functions` //~| ERROR: requires unsafe } @@ -15,7 +15,7 @@ extern "C" fn naked() { //~^ the `#[naked]` attribute is an experimental feature extern "C" fn naked_2() -> isize { naked_asm!("") - //~^ ERROR use of unstable library feature 'naked_functions' + //~^ ERROR use of unstable library feature `naked_functions` //~| ERROR: requires unsafe } diff --git a/tests/ui/feature-gates/feature-gate-naked_functions.stderr b/tests/ui/feature-gates/feature-gate-naked_functions.stderr index 709234eb023..9bfb9275bb2 100644 --- a/tests/ui/feature-gates/feature-gate-naked_functions.stderr +++ b/tests/ui/feature-gates/feature-gate-naked_functions.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'naked_functions' +error[E0658]: use of unstable library feature `naked_functions` --> $DIR/feature-gate-naked_functions.rs:9:5 | LL | naked_asm!("") @@ -8,7 +8,7 @@ LL | naked_asm!("") = help: add `#![feature(naked_functions)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'naked_functions' +error[E0658]: use of unstable library feature `naked_functions` --> $DIR/feature-gate-naked_functions.rs:17:5 | LL | naked_asm!("") @@ -38,7 +38,7 @@ LL | #[naked] = help: add `#![feature(naked_functions)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'naked_functions' +error[E0658]: use of unstable library feature `naked_functions` --> $DIR/feature-gate-naked_functions.rs:3:5 | LL | use std::arch::naked_asm; diff --git a/tests/ui/feature-gates/feature-gate-offset-of-slice.stderr b/tests/ui/feature-gates/feature-gate-offset-of-slice.stderr index 5cf34a897f4..ae8d50344d5 100644 --- a/tests/ui/feature-gates/feature-gate-offset-of-slice.stderr +++ b/tests/ui/feature-gates/feature-gate-offset-of-slice.stderr @@ -13,7 +13,7 @@ error[E0277]: the size for values of type `[i32]` cannot be known at compilation LL | offset_of!(T, y); | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `S`, the trait `Sized` is not implemented for `[i32]`, which is required by `S: Sized` + = help: within `S`, the trait `Sized` is not implemented for `[i32]` note: required because it appears within the type `S` --> $DIR/feature-gate-offset-of-slice.rs:3:8 | diff --git a/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.rs b/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.rs index 13f8fd5fe22..71caf43806d 100644 --- a/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.rs +++ b/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.rs @@ -5,11 +5,11 @@ extern crate rustc_serialize; //~ERROR can't find crate for `rustc_serialize` #[derive( RustcEncodable, - //~^ ERROR use of unstable library feature 'rustc_encodable_decodable' + //~^ ERROR use of unstable library feature `rustc_encodable_decodable` //~^^ WARNING this was previously accepted by the compiler //~^^^ WARNING use of deprecated macro `RustcEncodable` RustcDecodable, - //~^ ERROR use of unstable library feature 'rustc_encodable_decodable' + //~^ ERROR use of unstable library feature `rustc_encodable_decodable` //~^^ WARNING this was previously accepted by the compiler //~^^^ WARNING use of deprecated macro `RustcDecodable` )] diff --git a/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.stderr b/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.stderr index 02b74dacf4d..b949dbb9da2 100644 --- a/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.stderr +++ b/tests/ui/feature-gates/feature-gate-rustc_encodable_decodable.stderr @@ -6,7 +6,7 @@ LL | extern crate rustc_serialize; | = help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview` -error: use of unstable library feature 'rustc_encodable_decodable': derive macro for `rustc-serialize`; should not be used in new code +error: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code --> $DIR/feature-gate-rustc_encodable_decodable.rs:7:5 | LL | RustcEncodable, @@ -24,7 +24,7 @@ LL | RustcEncodable, | = note: `#[warn(deprecated)]` on by default -error: use of unstable library feature 'rustc_encodable_decodable': derive macro for `rustc-serialize`; should not be used in new code +error: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code --> $DIR/feature-gate-rustc_encodable_decodable.rs:11:5 | LL | RustcDecodable, @@ -43,7 +43,7 @@ error: aborting due to 3 previous errors; 2 warnings emitted For more information about this error, try `rustc --explain E0463`. Future incompatibility report: Future breakage diagnostic: -error: use of unstable library feature 'rustc_encodable_decodable': derive macro for `rustc-serialize`; should not be used in new code +error: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code --> $DIR/feature-gate-rustc_encodable_decodable.rs:7:5 | LL | RustcEncodable, @@ -54,7 +54,7 @@ LL | RustcEncodable, = note: `#[deny(soft_unstable)]` on by default Future breakage diagnostic: -error: use of unstable library feature 'rustc_encodable_decodable': derive macro for `rustc-serialize`; should not be used in new code +error: use of unstable library feature `rustc_encodable_decodable`: derive macro for `rustc-serialize`; should not be used in new code --> $DIR/feature-gate-rustc_encodable_decodable.rs:11:5 | LL | RustcDecodable, diff --git a/tests/ui/feature-gates/feature-gate-trace_macros.stderr b/tests/ui/feature-gates/feature-gate-trace_macros.stderr index 68d3f75e995..4c6cfce7d3d 100644 --- a/tests/ui/feature-gates/feature-gate-trace_macros.stderr +++ b/tests/ui/feature-gates/feature-gate-trace_macros.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'trace_macros': `trace_macros` is not stable enough for use and is subject to change +error[E0658]: use of unstable library feature `trace_macros`: `trace_macros` is not stable enough for use and is subject to change --> $DIR/feature-gate-trace_macros.rs:2:5 | LL | trace_macros!(true); diff --git a/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr b/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr index 0ee2d93fb26..7d9c5b81651 100644 --- a/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr +++ b/tests/ui/feature-gates/feature-gate-trivial_bounds.stderr @@ -120,7 +120,7 @@ error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at LL | fn unsized_local() where Dst<dyn A>: Sized { | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `Dst<(dyn A + 'static)>`, the trait `Sized` is not implemented for `(dyn A + 'static)`, which is required by `Dst<(dyn A + 'static)>: Sized` + = help: within `Dst<(dyn A + 'static)>`, the trait `Sized` is not implemented for `(dyn A + 'static)` note: required because it appears within the type `Dst<(dyn A + 'static)>` --> $DIR/feature-gate-trivial_bounds.rs:48:8 | diff --git a/tests/ui/feature-gates/feature-gate-type_ascription.rs b/tests/ui/feature-gates/feature-gate-type_ascription.rs index 5c3f0e37df6..ef3923b6ff2 100644 --- a/tests/ui/feature-gates/feature-gate-type_ascription.rs +++ b/tests/ui/feature-gates/feature-gate-type_ascription.rs @@ -1,5 +1,5 @@ // Type ascription is unstable fn main() { - let a = type_ascribe!(10, u8); //~ ERROR use of unstable library feature 'type_ascription': placeholder syntax for type ascription + let a = type_ascribe!(10, u8); //~ ERROR use of unstable library feature `type_ascription`: placeholder syntax for type ascription } diff --git a/tests/ui/feature-gates/feature-gate-type_ascription.stderr b/tests/ui/feature-gates/feature-gate-type_ascription.stderr index 88da58d07e1..f59e6435c8e 100644 --- a/tests/ui/feature-gates/feature-gate-type_ascription.stderr +++ b/tests/ui/feature-gates/feature-gate-type_ascription.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'type_ascription': placeholder syntax for type ascription +error[E0658]: use of unstable library feature `type_ascription`: placeholder syntax for type ascription --> $DIR/feature-gate-type_ascription.rs:4:13 | LL | let a = type_ascribe!(10, u8); diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs b/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs index 42f7c5f0fba..bc5b48741b0 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs @@ -1,9 +1,9 @@ #![allow(dead_code)] fn foo<F: Fn()>(mut f: F) { - f.call(()); //~ ERROR use of unstable library feature 'fn_traits' - f.call_mut(()); //~ ERROR use of unstable library feature 'fn_traits' - f.call_once(()); //~ ERROR use of unstable library feature 'fn_traits' + f.call(()); //~ ERROR use of unstable library feature `fn_traits` + f.call_mut(()); //~ ERROR use of unstable library feature `fn_traits` + f.call_once(()); //~ ERROR use of unstable library feature `fn_traits` } fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr index 0ef732d391b..6a5f0c8e6a6 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'fn_traits' +error[E0658]: use of unstable library feature `fn_traits` --> $DIR/feature-gate-unboxed-closures-method-calls.rs:4:7 | LL | f.call(()); @@ -8,7 +8,7 @@ LL | f.call(()); = help: add `#![feature(fn_traits)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'fn_traits' +error[E0658]: use of unstable library feature `fn_traits` --> $DIR/feature-gate-unboxed-closures-method-calls.rs:5:7 | LL | f.call_mut(()); @@ -18,7 +18,7 @@ LL | f.call_mut(()); = help: add `#![feature(fn_traits)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'fn_traits' +error[E0658]: use of unstable library feature `fn_traits` --> $DIR/feature-gate-unboxed-closures-method-calls.rs:6:7 | LL | f.call_once(()); diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs b/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs index 25c90492eb8..137e7d71e91 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs @@ -1,9 +1,9 @@ #![allow(dead_code)] fn foo<F: Fn()>(mut f: F) { - Fn::call(&f, ()); //~ ERROR use of unstable library feature 'fn_traits' - FnMut::call_mut(&mut f, ()); //~ ERROR use of unstable library feature 'fn_traits' - FnOnce::call_once(f, ()); //~ ERROR use of unstable library feature 'fn_traits' + Fn::call(&f, ()); //~ ERROR use of unstable library feature `fn_traits` + FnMut::call_mut(&mut f, ()); //~ ERROR use of unstable library feature `fn_traits` + FnOnce::call_once(f, ()); //~ ERROR use of unstable library feature `fn_traits` } fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr index f4d75fc6a86..90695fa4c46 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'fn_traits' +error[E0658]: use of unstable library feature `fn_traits` --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:4:5 | LL | Fn::call(&f, ()); @@ -8,7 +8,7 @@ LL | Fn::call(&f, ()); = help: add `#![feature(fn_traits)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'fn_traits' +error[E0658]: use of unstable library feature `fn_traits` --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:5:5 | LL | FnMut::call_mut(&mut f, ()); @@ -18,7 +18,7 @@ LL | FnMut::call_mut(&mut f, ()); = help: add `#![feature(fn_traits)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'fn_traits' +error[E0658]: use of unstable library feature `fn_traits` --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:6:5 | LL | FnOnce::call_once(f, ()); diff --git a/tests/ui/feature-gates/issue-49983-see-issue-0.stderr b/tests/ui/feature-gates/issue-49983-see-issue-0.stderr index 8f090c9eef9..29a2845852e 100644 --- a/tests/ui/feature-gates/issue-49983-see-issue-0.stderr +++ b/tests/ui/feature-gates/issue-49983-see-issue-0.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'ptr_internals': use `NonNull` instead and consider `PhantomData<T>` (if you also use `#[may_dangle]`), `Send`, and/or `Sync` +error[E0658]: use of unstable library feature `ptr_internals`: use `NonNull` instead and consider `PhantomData<T>` (if you also use `#[may_dangle]`), `Send`, and/or `Sync` --> $DIR/issue-49983-see-issue-0.rs:4:30 | LL | #[allow(unused_imports)] use core::ptr::Unique; diff --git a/tests/ui/feature-gates/rustc-private.rs b/tests/ui/feature-gates/rustc-private.rs index aa44f790c8a..2605f595b6c 100644 --- a/tests/ui/feature-gates/rustc-private.rs +++ b/tests/ui/feature-gates/rustc-private.rs @@ -1,5 +1,5 @@ // gate-test-rustc_private -extern crate cfg_if; //~ ERROR use of unstable library feature 'rustc_private' +extern crate cfg_if; //~ ERROR use of unstable library feature `rustc_private` fn main() {} diff --git a/tests/ui/feature-gates/rustc-private.stderr b/tests/ui/feature-gates/rustc-private.stderr index 96cc98619fd..74594c712f2 100644 --- a/tests/ui/feature-gates/rustc-private.stderr +++ b/tests/ui/feature-gates/rustc-private.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? +error[E0658]: use of unstable library feature `rustc_private`: this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? --> $DIR/rustc-private.rs:3:1 | LL | extern crate cfg_if; diff --git a/tests/ui/feature-gates/trace_macros-gate.stderr b/tests/ui/feature-gates/trace_macros-gate.stderr index 1313a0e8ae2..6ca9d1573d9 100644 --- a/tests/ui/feature-gates/trace_macros-gate.stderr +++ b/tests/ui/feature-gates/trace_macros-gate.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'trace_macros': `trace_macros` is not stable enough for use and is subject to change +error[E0658]: use of unstable library feature `trace_macros`: `trace_macros` is not stable enough for use and is subject to change --> $DIR/trace_macros-gate.rs:4:5 | LL | trace_macros!(); @@ -14,7 +14,7 @@ error: trace_macros! accepts only `true` or `false` LL | trace_macros!(); | ^^^^^^^^^^^^^^^ -error[E0658]: use of unstable library feature 'trace_macros': `trace_macros` is not stable enough for use and is subject to change +error[E0658]: use of unstable library feature `trace_macros`: `trace_macros` is not stable enough for use and is subject to change --> $DIR/trace_macros-gate.rs:6:5 | LL | trace_macros!(true); @@ -24,7 +24,7 @@ LL | trace_macros!(true); = help: add `#![feature(trace_macros)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'trace_macros': `trace_macros` is not stable enough for use and is subject to change +error[E0658]: use of unstable library feature `trace_macros`: `trace_macros` is not stable enough for use and is subject to change --> $DIR/trace_macros-gate.rs:7:5 | LL | trace_macros!(false); @@ -34,7 +34,7 @@ LL | trace_macros!(false); = help: add `#![feature(trace_macros)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'trace_macros': `trace_macros` is not stable enough for use and is subject to change +error[E0658]: use of unstable library feature `trace_macros`: `trace_macros` is not stable enough for use and is subject to change --> $DIR/trace_macros-gate.rs:10:26 | LL | ($x: ident) => { trace_macros!($x) } diff --git a/tests/ui/feature-gates/unstable-attribute-rejects-already-stable-features.stderr b/tests/ui/feature-gates/unstable-attribute-rejects-already-stable-features.stderr index 319056a9c88..d599523c727 100644 --- a/tests/ui/feature-gates/unstable-attribute-rejects-already-stable-features.stderr +++ b/tests/ui/feature-gates/unstable-attribute-rejects-already-stable-features.stderr @@ -1,31 +1,31 @@ error: can't mark as unstable using an already stable feature - --> $DIR/unstable-attribute-rejects-already-stable-features.rs:6:1 + --> $DIR/unstable-attribute-rejects-already-stable-features.rs:7:1 | -LL | #[unstable(feature = "arbitrary_enum_discriminant", issue = "42")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this feature is already stable LL | #[rustc_const_unstable(feature = "arbitrary_enum_discriminant", issue = "42")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this feature is already stable LL | const fn my_fun() {} | -------------------- the stability attribute annotates this item | help: consider removing the attribute - --> $DIR/unstable-attribute-rejects-already-stable-features.rs:6:1 + --> $DIR/unstable-attribute-rejects-already-stable-features.rs:7:1 | -LL | #[unstable(feature = "arbitrary_enum_discriminant", issue = "42")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_const_unstable(feature = "arbitrary_enum_discriminant", issue = "42")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: can't mark as unstable using an already stable feature - --> $DIR/unstable-attribute-rejects-already-stable-features.rs:7:1 + --> $DIR/unstable-attribute-rejects-already-stable-features.rs:6:1 | +LL | #[unstable(feature = "arbitrary_enum_discriminant", issue = "42")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this feature is already stable LL | #[rustc_const_unstable(feature = "arbitrary_enum_discriminant", issue = "42")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this feature is already stable LL | const fn my_fun() {} | -------------------- the stability attribute annotates this item | help: consider removing the attribute - --> $DIR/unstable-attribute-rejects-already-stable-features.rs:7:1 + --> $DIR/unstable-attribute-rejects-already-stable-features.rs:6:1 | -LL | #[rustc_const_unstable(feature = "arbitrary_enum_discriminant", issue = "42")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[unstable(feature = "arbitrary_enum_discriminant", issue = "42")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/fmt/ifmt-unimpl.stderr b/tests/ui/fmt/ifmt-unimpl.stderr index f83e7c87728..b8d4425a4a7 100644 --- a/tests/ui/fmt/ifmt-unimpl.stderr +++ b/tests/ui/fmt/ifmt-unimpl.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `str: UpperHex` is not satisfied --> $DIR/ifmt-unimpl.rs:2:21 | LL | format!("{:X}", "3"); - | ---- ^^^ the trait `UpperHex` is not implemented for `str`, which is required by `&str: UpperHex` + | ---- ^^^ the trait `UpperHex` is not implemented for `str` | | | required by a bound introduced by this call | diff --git a/tests/ui/for/for-c-in-str.stderr b/tests/ui/for/for-c-in-str.stderr index 2544df64629..475cf8c8874 100644 --- a/tests/ui/for/for-c-in-str.stderr +++ b/tests/ui/for/for-c-in-str.stderr @@ -4,7 +4,7 @@ error[E0277]: `&str` is not an iterator LL | for c in "asdf" { | ^^^^^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()` | - = help: the trait `Iterator` is not implemented for `&str`, which is required by `&str: IntoIterator` + = help: the trait `Iterator` is not implemented for `&str` = note: required for `&str` to implement `IntoIterator` error: aborting due to 1 previous error diff --git a/tests/ui/for/for-loop-bogosity.stderr b/tests/ui/for/for-loop-bogosity.stderr index 143e4a4efd1..194a2fa08ce 100644 --- a/tests/ui/for/for-loop-bogosity.stderr +++ b/tests/ui/for/for-loop-bogosity.stderr @@ -4,7 +4,7 @@ error[E0277]: `MyStruct` is not an iterator LL | for x in bogus { | ^^^^^ `MyStruct` is not an iterator | - = help: the trait `Iterator` is not implemented for `MyStruct`, which is required by `MyStruct: IntoIterator` + = help: the trait `Iterator` is not implemented for `MyStruct` = note: required for `MyStruct` to implement `IntoIterator` error: aborting due to 1 previous error diff --git a/tests/ui/function-pointer/unsized-ret.stderr b/tests/ui/function-pointer/unsized-ret.stderr index 81d603f4b20..66116273ff4 100644 --- a/tests/ui/function-pointer/unsized-ret.stderr +++ b/tests/ui/function-pointer/unsized-ret.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t LL | foo::<fn() -> str, _>(None, ()); | ^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `fn() -> str`, the trait `Sized` is not implemented for `str`, which is required by `fn() -> str: Fn<_>` + = help: within `fn() -> str`, the trait `Sized` is not implemented for `str` = note: required because it appears within the type `fn() -> str` note: required by a bound in `foo` --> $DIR/unsized-ret.rs:5:11 @@ -18,7 +18,7 @@ error[E0277]: the size for values of type `(dyn std::fmt::Display + 'a)` cannot LL | foo::<for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a), _>(None, (&(),)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)`, the trait `for<'a> Sized` is not implemented for `(dyn std::fmt::Display + 'a)`, which is required by `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a): Fn<_>` + = help: within `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)`, the trait `for<'a> Sized` is not implemented for `(dyn std::fmt::Display + 'a)` = note: required because it appears within the type `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)` note: required by a bound in `foo` --> $DIR/unsized-ret.rs:5:11 diff --git a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.current.stderr b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.current.stderr index c5c4f2c4d23..8779bab593a 100644 --- a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.current.stderr +++ b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.current.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `<Self as Foo>::Bar<()>: Eq<i32>` is not satisfied --> $DIR/assume-gat-normalization-for-nested-goals.rs:9:30 | LL | type Bar<T>: Baz<Self> = i32; - | ^^^ the trait `Eq<i32>` is not implemented for `<Self as Foo>::Bar<()>`, which is required by `i32: Baz<Self>` + | ^^^ the trait `Eq<i32>` is not implemented for `<Self as Foo>::Bar<()>` | note: required for `i32` to implement `Baz<Self>` --> $DIR/assume-gat-normalization-for-nested-goals.rs:16:23 diff --git a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.next.stderr b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.next.stderr index c5c4f2c4d23..8779bab593a 100644 --- a/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.next.stderr +++ b/tests/ui/generic-associated-types/assume-gat-normalization-for-nested-goals.next.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `<Self as Foo>::Bar<()>: Eq<i32>` is not satisfied --> $DIR/assume-gat-normalization-for-nested-goals.rs:9:30 | LL | type Bar<T>: Baz<Self> = i32; - | ^^^ the trait `Eq<i32>` is not implemented for `<Self as Foo>::Bar<()>`, which is required by `i32: Baz<Self>` + | ^^^ the trait `Eq<i32>` is not implemented for `<Self as Foo>::Bar<()>` | note: required for `i32` to implement `Baz<Self>` --> $DIR/assume-gat-normalization-for-nested-goals.rs:16:23 diff --git a/tests/ui/generic-associated-types/impl_bounds.stderr b/tests/ui/generic-associated-types/impl_bounds.stderr index c3b119e2144..261070d1db4 100644 --- a/tests/ui/generic-associated-types/impl_bounds.stderr +++ b/tests/ui/generic-associated-types/impl_bounds.stderr @@ -25,7 +25,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/impl_bounds.rs:18:33 | LL | type C = String where Self: Copy; - | ^^^^ the trait `Copy` is not implemented for `T`, which is required by `Fooy<T>: Copy` + | ^^^^ the trait `Copy` is not implemented for `T` | note: required for `Fooy<T>` to implement `Copy` --> $DIR/impl_bounds.rs:10:10 @@ -50,7 +50,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/impl_bounds.rs:20:24 | LL | fn d() where Self: Copy {} - | ^^^^ the trait `Copy` is not implemented for `T`, which is required by `Fooy<T>: Copy` + | ^^^^ the trait `Copy` is not implemented for `T` | note: required for `Fooy<T>` to implement `Copy` --> $DIR/impl_bounds.rs:10:10 diff --git a/tests/ui/generic-associated-types/issue-101020.stderr b/tests/ui/generic-associated-types/issue-101020.stderr index 7faab4e5274..9c3753c2d18 100644 --- a/tests/ui/generic-associated-types/issue-101020.stderr +++ b/tests/ui/generic-associated-types/issue-101020.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `for<'a> &'a mut (): Foo<&'a mut ()>` is not satis --> $DIR/issue-101020.rs:31:22 | LL | (&mut EmptyIter).consume(()); - | ^^^^^^^ the trait `for<'a> Foo<&'a mut ()>` is not implemented for `&'a mut ()`, which is required by `for<'a> &'a mut (): FuncInput<'a, &'a mut ()>` + | ^^^^^^^ the trait `for<'a> Foo<&'a mut ()>` is not implemented for `&'a mut ()` | help: this trait has no implementations, consider adding one --> $DIR/issue-101020.rs:28:1 diff --git a/tests/ui/generic-associated-types/issue-74824.current.stderr b/tests/ui/generic-associated-types/issue-74824.current.stderr index b06c7f127ac..231136612a0 100644 --- a/tests/ui/generic-associated-types/issue-74824.current.stderr +++ b/tests/ui/generic-associated-types/issue-74824.current.stderr @@ -14,7 +14,7 @@ error[E0277]: the trait bound `T: Clone` is not satisfied --> $DIR/issue-74824.rs:10:26 | LL | type Copy<T>: Copy = Box<T>; - | ^^^^^^ the trait `Clone` is not implemented for `T`, which is required by `<Self as UnsafeCopy>::Copy<T>: Copy` + | ^^^^^^ the trait `Clone` is not implemented for `T` | = note: required for `Box<T>` to implement `Clone` = note: required for `<Self as UnsafeCopy>::Copy<T>` to implement `Copy` diff --git a/tests/ui/generic-associated-types/issue-74824.next.stderr b/tests/ui/generic-associated-types/issue-74824.next.stderr index b06c7f127ac..231136612a0 100644 --- a/tests/ui/generic-associated-types/issue-74824.next.stderr +++ b/tests/ui/generic-associated-types/issue-74824.next.stderr @@ -14,7 +14,7 @@ error[E0277]: the trait bound `T: Clone` is not satisfied --> $DIR/issue-74824.rs:10:26 | LL | type Copy<T>: Copy = Box<T>; - | ^^^^^^ the trait `Clone` is not implemented for `T`, which is required by `<Self as UnsafeCopy>::Copy<T>: Copy` + | ^^^^^^ the trait `Clone` is not implemented for `T` | = note: required for `Box<T>` to implement `Clone` = note: required for `<Self as UnsafeCopy>::Copy<T>` to implement `Copy` diff --git a/tests/ui/generic-const-items/const-trait-impl.rs b/tests/ui/generic-const-items/const-trait-impl.rs index 51209121bd9..e11d346b712 100644 --- a/tests/ui/generic-const-items/const-trait-impl.rs +++ b/tests/ui/generic-const-items/const-trait-impl.rs @@ -2,7 +2,7 @@ //@ compile-flags: -Znext-solver // Test that we can call methods from const trait impls inside of generic const items. -#![feature(generic_const_items, const_trait_impl, effects)] +#![feature(generic_const_items, const_trait_impl)] #![allow(incomplete_features)] #![crate_type = "lib"] diff --git a/tests/ui/generic-const-items/unsatisfied-bounds.stderr b/tests/ui/generic-const-items/unsatisfied-bounds.stderr index 14894cef770..de252b816e5 100644 --- a/tests/ui/generic-const-items/unsatisfied-bounds.stderr +++ b/tests/ui/generic-const-items/unsatisfied-bounds.stderr @@ -16,7 +16,8 @@ error[E0277]: the trait bound `Infallible: From<()>` is not satisfied LL | let () = K::<()>; | ^^ the trait `From<()>` is not implemented for `Infallible` | - = help: the trait `From<!>` is implemented for `Infallible` + = help: the trait `From<()>` is not implemented for `Infallible` + but trait `From<!>` is implemented for it = help: for that trait implementation, expected `!`, found `()` note: required by a bound in `K` --> $DIR/unsatisfied-bounds.rs:12:17 @@ -48,7 +49,8 @@ error[E0277]: the trait bound `Infallible: From<()>` is not satisfied LL | let _ = <() as Trait<&'static str>>::B::<()>; | ^^ the trait `From<()>` is not implemented for `Infallible` | - = help: the trait `From<!>` is implemented for `Infallible` + = help: the trait `From<()>` is not implemented for `Infallible` + but trait `From<!>` is implemented for it = help: for that trait implementation, expected `!`, found `()` note: required by a bound in `Trait::B` --> $DIR/unsatisfied-bounds.rs:21:21 diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr index 761fd9045a1..7fe803550bd 100644 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied --> $DIR/issue-89118.rs:19:8 | LL | C: StackContext, - | ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`, which is required by `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>` + | ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` | help: this trait has no implementations, consider adding one --> $DIR/issue-89118.rs:1:1 @@ -29,7 +29,7 @@ error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied --> $DIR/issue-89118.rs:29:9 | LL | impl<C> EthernetWorker<C> {} - | ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`, which is required by `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>` + | ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` | help: this trait has no implementations, consider adding one --> $DIR/issue-89118.rs:1:1 @@ -56,7 +56,7 @@ error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied --> $DIR/issue-89118.rs:22:20 | LL | type Handler = Ctx<C::Dispatcher>; - | ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`, which is required by `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>` + | ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()` | help: this trait has no implementations, consider adding one --> $DIR/issue-89118.rs:1:1 diff --git a/tests/ui/impl-trait/auto-trait-leak2.stderr b/tests/ui/impl-trait/auto-trait-leak2.stderr index 1fcde0372fc..52fa28145d6 100644 --- a/tests/ui/impl-trait/auto-trait-leak2.stderr +++ b/tests/ui/impl-trait/auto-trait-leak2.stderr @@ -9,7 +9,7 @@ LL | send(before()); | | | required by a bound introduced by this call | - = help: within `impl Fn(i32)`, the trait `Send` is not implemented for `Rc<Cell<i32>>`, which is required by `impl Fn(i32): Send` + = help: within `impl Fn(i32)`, the trait `Send` is not implemented for `Rc<Cell<i32>>` note: required because it's used within this closure --> $DIR/auto-trait-leak2.rs:10:5 | @@ -37,7 +37,7 @@ LL | send(after()); LL | fn after() -> impl Fn(i32) { | ------------ within this `impl Fn(i32)` | - = help: within `impl Fn(i32)`, the trait `Send` is not implemented for `Rc<Cell<i32>>`, which is required by `impl Fn(i32): Send` + = help: within `impl Fn(i32)`, the trait `Send` is not implemented for `Rc<Cell<i32>>` note: required because it's used within this closure --> $DIR/auto-trait-leak2.rs:38:5 | diff --git a/tests/crashes/126850.rs b/tests/ui/impl-trait/closure-in-type.rs index 0ddc24c8bb1..1e06e6e21fd 100644 --- a/tests/crashes/126850.rs +++ b/tests/ui/impl-trait/closure-in-type.rs @@ -1,4 +1,5 @@ -//@ known-bug: rust-lang/rust#126850 +//@ check-pass + fn bug<T>() -> impl Iterator< Item = [(); { |found: &String| Some(false); diff --git a/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.rs b/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.rs new file mode 100644 index 00000000000..f1c196a154d --- /dev/null +++ b/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.rs @@ -0,0 +1,20 @@ +//@ only-linux +//@ compile-flags: --error-format=human --color=always +//@ error-pattern: the trait bound + +trait Foo<T>: Bar<T> {} + +trait Bar<T> {} + +struct Struct; + +impl<T, K> Foo<K> for T where T: Bar<K> +{} + +impl<'a> Bar<()> for Struct {} + +fn foo() -> impl Foo<i32> { + Struct +} + +fn main() {} diff --git a/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg b/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg new file mode 100644 index 00000000000..1a79a9d7efa --- /dev/null +++ b/tests/ui/impl-trait/diagnostics/highlight-difference-between-expected-trait-and-found-trait.svg @@ -0,0 +1,68 @@ +<svg width="1104px" height="398px" xmlns="http://www.w3.org/2000/svg"> + <style> + .fg { fill: #AAAAAA } + .bg { background: #000000 } + .fg-ansi256-009 { fill: #FF5555 } + .fg-ansi256-010 { fill: #55FF55 } + .fg-ansi256-012 { fill: #5555FF } + .fg-magenta { fill: #AA00AA } + .container { + padding: 0 10px; + line-height: 18px; + } + .bold { font-weight: bold; } + tspan { + font: 14px SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace; + white-space: pre; + line-height: 18px; + } + </style> + + <rect width="100%" height="100%" y="0" rx="4.5" class="bg" /> + + <text xml:space="preserve" class="container fg"> + <tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0277]</tspan><tspan class="bold">: the trait bound `Struct: Foo<i32>` is not satisfied</tspan> +</tspan> + <tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/highlight-difference-between-expected-trait-and-found-trait.rs:16:13</tspan> +</tspan> + <tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> +</tspan> + <tspan x="10px" y="82px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> fn foo() -> impl Foo<i32> {</tspan> +</tspan> + <tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">^^^^^^^^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-009 bold">the trait `Bar<i32>` is not implemented for `Struct`</tspan> +</tspan> + <tspan x="10px" y="118px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> Struct</tspan> +</tspan> + <tspan x="10px" y="136px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">return type was inferred to be `Struct` here</tspan> +</tspan> + <tspan x="10px" y="154px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> +</tspan> + <tspan x="10px" y="172px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">help</tspan><tspan>: the trait `Bar<</tspan><tspan class="fg-magenta bold">i32</tspan><tspan>>` </tspan><tspan class="fg-magenta bold">is not</tspan><tspan> implemented for `Struct`</tspan> +</tspan> + <tspan x="10px" y="190px"><tspan> but trait `Bar<</tspan><tspan class="fg-magenta bold">()</tspan><tspan>>` </tspan><tspan class="fg-magenta bold">is</tspan><tspan> implemented for it</tspan> +</tspan> + <tspan x="10px" y="208px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">= </tspan><tspan class="bold">help</tspan><tspan>: for that trait implementation, expected `</tspan><tspan class="fg-magenta bold">()</tspan><tspan>`, found `</tspan><tspan class="fg-magenta bold">i32</tspan><tspan>`</tspan> +</tspan> + <tspan x="10px" y="226px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: required for `Struct` to implement `Foo<i32>`</tspan> +</tspan> + <tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--> </tspan><tspan>$DIR/highlight-difference-between-expected-trait-and-found-trait.rs:11:12</tspan> +</tspan> + <tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan> +</tspan> + <tspan x="10px" y="280px"><tspan class="fg-ansi256-012 bold">LL</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> impl<T, K> Foo<K> for T where T: Bar<K></tspan> +</tspan> + <tspan x="10px" y="298px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^^^^^^</tspan><tspan> </tspan><tspan class="fg-ansi256-010 bold">^</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">------</tspan><tspan> </tspan><tspan class="fg-ansi256-012 bold">unsatisfied trait bound introduced here</tspan> +</tspan> + <tspan x="10px" y="316px"> +</tspan> + <tspan x="10px" y="334px"><tspan class="fg-ansi256-009 bold">error</tspan><tspan class="bold">: aborting due to 1 previous error</tspan> +</tspan> + <tspan x="10px" y="352px"> +</tspan> + <tspan x="10px" y="370px"><tspan class="bold">For more information about this error, try `rustc --explain E0277`.</tspan> +</tspan> + <tspan x="10px" y="388px"> +</tspan> + </text> + +</svg> diff --git a/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr b/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr index 9c546659564..8716088ccbd 100644 --- a/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr +++ b/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr @@ -16,7 +16,7 @@ LL | fn fuz() -> (usize, Trait) { (42, Struct) } | | | doesn't have a size known at compile-time | - = help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)`, which is required by `(usize, (dyn Trait + 'static)): Sized` + = help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)` = note: required because it appears within the type `(usize, (dyn Trait + 'static))` = note: the return type of a function must have a statically known size @@ -38,7 +38,7 @@ LL | fn bar() -> (usize, dyn Trait) { (42, Struct) } | | | doesn't have a size known at compile-time | - = help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)`, which is required by `(usize, (dyn Trait + 'static)): Sized` + = help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)` = note: required because it appears within the type `(usize, (dyn Trait + 'static))` = note: the return type of a function must have a statically known size diff --git a/tests/ui/impl-trait/impl_trait_projections.rs b/tests/ui/impl-trait/impl_trait_projections.rs index 365ac85e2f6..2c277aee06d 100644 --- a/tests/ui/impl-trait/impl_trait_projections.rs +++ b/tests/ui/impl-trait/impl_trait_projections.rs @@ -10,30 +10,27 @@ fn path_parametrized_type_is_allowed() -> option::Option<impl Debug> { } fn projection_is_disallowed(x: impl Iterator) -> <impl Iterator>::Item { -//~^ ERROR `impl Trait` is not allowed in path parameters -//~| ERROR `impl Trait` is not allowed in path parameters +//~^ ERROR `impl Trait` is not allowed in paths x.next().unwrap() } fn projection_with_named_trait_is_disallowed(mut x: impl Iterator) -> <impl Iterator as Iterator>::Item -//~^ ERROR `impl Trait` is not allowed in path parameters +//~^ ERROR `impl Trait` is not allowed in paths { x.next().unwrap() } fn projection_with_named_trait_inside_path_is_disallowed() -> <::std::ops::Range<impl Debug> as Iterator>::Item -//~^ ERROR `impl Trait` is not allowed in path parameters -//~| ERROR `impl Debug: Step` is not satisfied +//~^ ERROR `impl Trait` is not allowed in paths { - //~^ ERROR `impl Debug: Step` is not satisfied (1i32..100).next().unwrap() } fn projection_from_impl_trait_inside_dyn_trait_is_disallowed() -> <dyn Iterator<Item = impl Debug> as Iterator>::Item -//~^ ERROR `impl Trait` is not allowed in path parameters +//~^ ERROR `impl Trait` is not allowed in paths { panic!() } diff --git a/tests/ui/impl-trait/impl_trait_projections.stderr b/tests/ui/impl-trait/impl_trait_projections.stderr index d62e3ac4183..5e0b80fcd59 100644 --- a/tests/ui/impl-trait/impl_trait_projections.stderr +++ b/tests/ui/impl-trait/impl_trait_projections.stderr @@ -1,73 +1,35 @@ -error[E0667]: `impl Trait` is not allowed in path parameters +error[E0562]: `impl Trait` is not allowed in paths --> $DIR/impl_trait_projections.rs:12:51 | LL | fn projection_is_disallowed(x: impl Iterator) -> <impl Iterator>::Item { | ^^^^^^^^^^^^^ + | + = note: `impl Trait` is only allowed in arguments and return types of functions and methods -error[E0667]: `impl Trait` is not allowed in path parameters - --> $DIR/impl_trait_projections.rs:19:9 +error[E0562]: `impl Trait` is not allowed in paths + --> $DIR/impl_trait_projections.rs:18:9 | LL | -> <impl Iterator as Iterator>::Item | ^^^^^^^^^^^^^ + | + = note: `impl Trait` is only allowed in arguments and return types of functions and methods -error[E0667]: `impl Trait` is not allowed in path parameters - --> $DIR/impl_trait_projections.rs:26:27 +error[E0562]: `impl Trait` is not allowed in paths + --> $DIR/impl_trait_projections.rs:25:27 | LL | -> <::std::ops::Range<impl Debug> as Iterator>::Item | ^^^^^^^^^^ + | + = note: `impl Trait` is only allowed in arguments and return types of functions and methods -error[E0667]: `impl Trait` is not allowed in path parameters - --> $DIR/impl_trait_projections.rs:35:29 +error[E0562]: `impl Trait` is not allowed in paths + --> $DIR/impl_trait_projections.rs:32:29 | LL | -> <dyn Iterator<Item = impl Debug> as Iterator>::Item | ^^^^^^^^^^ - -error[E0667]: `impl Trait` is not allowed in path parameters - --> $DIR/impl_trait_projections.rs:12:51 - | -LL | fn projection_is_disallowed(x: impl Iterator) -> <impl Iterator>::Item { - | ^^^^^^^^^^^^^ - -error[E0277]: the trait bound `impl Debug: Step` is not satisfied - --> $DIR/impl_trait_projections.rs:26:8 - | -LL | -> <::std::ops::Range<impl Debug> as Iterator>::Item - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Step` is not implemented for `impl Debug`, which is required by `std::ops::Range<impl Debug>: Iterator` - | - = help: the following other types implement trait `Step`: - Char - Ipv4Addr - Ipv6Addr - char - i128 - i16 - i32 - i64 - and 8 others - = note: required for `std::ops::Range<impl Debug>` to implement `Iterator` - -error[E0277]: the trait bound `impl Debug: Step` is not satisfied - --> $DIR/impl_trait_projections.rs:29:1 - | -LL | / { -LL | | -LL | | (1i32..100).next().unwrap() -LL | | } - | |_^ the trait `Step` is not implemented for `impl Debug`, which is required by `std::ops::Range<impl Debug>: Iterator` | - = help: the following other types implement trait `Step`: - Char - Ipv4Addr - Ipv6Addr - char - i128 - i16 - i32 - i64 - and 8 others - = note: required for `std::ops::Range<impl Debug>` to implement `Iterator` + = note: `impl Trait` is only allowed in arguments and return types of functions and methods -error: aborting due to 7 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0277, E0667. -For more information about an error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0562`. diff --git a/tests/ui/impl-trait/in-trait/bad-projection-from-opaque.rs b/tests/ui/impl-trait/in-trait/bad-projection-from-opaque.rs new file mode 100644 index 00000000000..c2c22cd1abf --- /dev/null +++ b/tests/ui/impl-trait/in-trait/bad-projection-from-opaque.rs @@ -0,0 +1,22 @@ +// issue: rust-lang/rust#126725 + +trait Foo { + fn foo<'a>() -> <&'a impl Sized as Bar>::Output; + //~^ ERROR `impl Trait` is not allowed in paths +} + +trait Bar { + type Output; +} + +impl<'a> Bar for &'a () { + type Output = &'a i32; +} + +impl Foo for () { + fn foo<'a>() -> <&'a Self as Bar>::Output { + &0 + } +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/bad-projection-from-opaque.stderr b/tests/ui/impl-trait/in-trait/bad-projection-from-opaque.stderr new file mode 100644 index 00000000000..bea7ccd1a18 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/bad-projection-from-opaque.stderr @@ -0,0 +1,11 @@ +error[E0562]: `impl Trait` is not allowed in paths + --> $DIR/bad-projection-from-opaque.rs:4:26 + | +LL | fn foo<'a>() -> <&'a impl Sized as Bar>::Output; + | ^^^^^^^^^^ + | + = note: `impl Trait` is only allowed in arguments and return types of functions and methods + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0562`. diff --git a/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr b/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr index 058517f0014..38c7a9ea16e 100644 --- a/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr +++ b/tests/ui/impl-trait/in-trait/false-positive-predicate-entailment-error.current.stderr @@ -8,7 +8,7 @@ LL | | ... | LL | | where LL | | F: Callback<Self::CallbackArg>, - | |_______________________________________^ the trait `MyFn<i32>` is not implemented for `F`, which is required by `F: Callback<i32>` + | |_______________________________________^ the trait `MyFn<i32>` is not implemented for `F` | note: required for `F` to implement `Callback<i32>` --> $DIR/false-positive-predicate-entailment-error.rs:14:21 @@ -26,7 +26,7 @@ error[E0277]: the trait bound `F: MyFn<i32>` is not satisfied --> $DIR/false-positive-predicate-entailment-error.rs:36:30 | LL | fn autobatch<F>(self) -> impl Trait - | ^^^^^^^^^^ the trait `MyFn<i32>` is not implemented for `F`, which is required by `F: Callback<i32>` + | ^^^^^^^^^^ the trait `MyFn<i32>` is not implemented for `F` | note: required for `F` to implement `Callback<i32>` --> $DIR/false-positive-predicate-entailment-error.rs:14:21 @@ -58,7 +58,7 @@ LL | | ... | LL | | where LL | | F: Callback<Self::CallbackArg>, - | |_______________________________________^ the trait `MyFn<i32>` is not implemented for `F`, which is required by `F: Callback<i32>` + | |_______________________________________^ the trait `MyFn<i32>` is not implemented for `F` | note: required for `F` to implement `Callback<i32>` --> $DIR/false-positive-predicate-entailment-error.rs:14:21 @@ -77,7 +77,7 @@ error[E0277]: the trait bound `F: MyFn<i32>` is not satisfied --> $DIR/false-positive-predicate-entailment-error.rs:36:30 | LL | fn autobatch<F>(self) -> impl Trait - | ^^^^^^^^^^ the trait `MyFn<i32>` is not implemented for `F`, which is required by `F: Callback<i32>` + | ^^^^^^^^^^ the trait `MyFn<i32>` is not implemented for `F` | note: required for `F` to implement `Callback<i32>` --> $DIR/false-positive-predicate-entailment-error.rs:14:21 @@ -91,7 +91,7 @@ error[E0277]: the trait bound `F: Callback<i32>` is not satisfied --> $DIR/false-positive-predicate-entailment-error.rs:27:12 | LL | F: Callback<Self::CallbackArg>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyFn<i32>` is not implemented for `F`, which is required by `F: Callback<i32>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyFn<i32>` is not implemented for `F` | note: required for `F` to implement `Callback<i32>` --> $DIR/false-positive-predicate-entailment-error.rs:14:21 @@ -111,7 +111,7 @@ LL | | ... | LL | | where LL | | F: Callback<Self::CallbackArg>, - | |_______________________________________^ the trait `MyFn<i32>` is not implemented for `F`, which is required by `F: Callback<i32>` + | |_______________________________________^ the trait `MyFn<i32>` is not implemented for `F` | note: required for `F` to implement `Callback<i32>` --> $DIR/false-positive-predicate-entailment-error.rs:14:21 diff --git a/tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.rs b/tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.rs new file mode 100644 index 00000000000..83466535e13 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/late-bound-in-object-assocty.rs @@ -0,0 +1,13 @@ +// Test for issue #132429 +//@compile-flags: -Zunstable-options --edition=2024 +//@check-pass + +use std::future::Future; + +trait Test { + fn foo<'a>(&'a self) -> Box<dyn Future<Output = impl IntoIterator<Item = u32>>> { + Box::new(async { [] }) + } +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr index 768224e4c51..663c9a7f2ae 100644 --- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr +++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr @@ -32,7 +32,8 @@ LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> { LL | self | ---- return type was inferred to be `Bar` here | - = help: the trait `Foo<char>` is implemented for `Bar` + = help: the trait `Foo<u8>` is not implemented for `Bar` + but trait `Foo<char>` is implemented for it = help: for that trait implementation, expected `char`, found `u8` error: aborting due to 3 previous errors diff --git a/tests/ui/impl-trait/in-trait/return-type-notation.rs b/tests/ui/impl-trait/in-trait/return-type-notation.rs new file mode 100644 index 00000000000..3945eb9bdee --- /dev/null +++ b/tests/ui/impl-trait/in-trait/return-type-notation.rs @@ -0,0 +1,9 @@ +#![allow(incomplete_features)] +#![feature(return_type_notation)] + +trait IntFactory { + fn stream(&self) -> impl IntFactory<stream(..): IntFactory<stream(..): Send> + Send>; + //~^ ERROR cycle detected when resolving lifetimes for `IntFactory::stream` +} + +pub fn main() {} diff --git a/tests/ui/impl-trait/in-trait/return-type-notation.stderr b/tests/ui/impl-trait/in-trait/return-type-notation.stderr new file mode 100644 index 00000000000..d9fd780cdff --- /dev/null +++ b/tests/ui/impl-trait/in-trait/return-type-notation.stderr @@ -0,0 +1,27 @@ +error[E0391]: cycle detected when resolving lifetimes for `IntFactory::stream` + --> $DIR/return-type-notation.rs:5:5 + | +LL | fn stream(&self) -> impl IntFactory<stream(..): IntFactory<stream(..): Send> + Send>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: ...which requires computing function signature of `IntFactory::stream`... + --> $DIR/return-type-notation.rs:5:5 + | +LL | fn stream(&self) -> impl IntFactory<stream(..): IntFactory<stream(..): Send> + Send>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires looking up late bound vars inside `IntFactory::stream`... + --> $DIR/return-type-notation.rs:5:5 + | +LL | fn stream(&self) -> impl IntFactory<stream(..): IntFactory<stream(..): Send> + Send>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: ...which again requires resolving lifetimes for `IntFactory::stream`, completing the cycle +note: cycle used when listing captured lifetimes for opaque `IntFactory::stream::{opaque#0}` + --> $DIR/return-type-notation.rs:5:25 + | +LL | fn stream(&self) -> impl IntFactory<stream(..): IntFactory<stream(..): Send> + Send>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/impl-trait/in-trait/shorthand-projection-in-rpitit-bound.rs b/tests/ui/impl-trait/in-trait/shorthand-projection-in-rpitit-bound.rs new file mode 100644 index 00000000000..102b53f4957 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/shorthand-projection-in-rpitit-bound.rs @@ -0,0 +1,13 @@ +//@ check-pass + +// Ensure that we can resolve a shorthand projection in an item bound in an RPITIT. + +pub trait Bar { + type Foo; +} + +pub trait Baz { + fn boom<X: Bar>() -> impl Bar<Foo = X::Foo>; +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/variance.rs b/tests/ui/impl-trait/in-trait/variance.rs index 19905c608e3..cd2f43fca9a 100644 --- a/tests/ui/impl-trait/in-trait/variance.rs +++ b/tests/ui/impl-trait/in-trait/variance.rs @@ -4,7 +4,7 @@ trait Foo<'i> { fn implicit_capture_early<'a: 'a>() -> impl Sized {} - //~^ [Self: o, 'i: o, 'a: *, 'a: o, 'i: o] + //~^ [Self: o, 'i: o, 'a: *, 'i: o, 'a: o] fn explicit_capture_early<'a: 'a>() -> impl Sized + use<'i, 'a, Self> {} //~^ [Self: o, 'i: o, 'a: *, 'i: o, 'a: o] @@ -13,12 +13,12 @@ trait Foo<'i> { //~^ [Self: o, 'i: o, 'a: *, 'i: o] fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {} - //~^ [Self: o, 'i: o, 'a: o, 'i: o] + //~^ [Self: o, 'i: o, 'i: o, 'a: o] fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + use<'i, 'a, Self> {} //~^ [Self: o, 'i: o, 'i: o, 'a: o] - fn not_cpatured_late<'a>(_: &'a ()) -> impl Sized + use<'i, Self> {} + fn not_captured_late<'a>(_: &'a ()) -> impl Sized + use<'i, Self> {} //~^ [Self: o, 'i: o, 'i: o] } diff --git a/tests/ui/impl-trait/in-trait/variance.stderr b/tests/ui/impl-trait/in-trait/variance.stderr index f65174e1c35..d45cca982e9 100644 --- a/tests/ui/impl-trait/in-trait/variance.stderr +++ b/tests/ui/impl-trait/in-trait/variance.stderr @@ -1,4 +1,4 @@ -error: [Self: o, 'i: o, 'a: *, 'a: o, 'i: o] +error: [Self: o, 'i: o, 'a: *, 'i: o, 'a: o] --> $DIR/variance.rs:6:44 | LL | fn implicit_capture_early<'a: 'a>() -> impl Sized {} @@ -16,7 +16,7 @@ error: [Self: o, 'i: o, 'a: *, 'i: o] LL | fn not_captured_early<'a: 'a>() -> impl Sized + use<'i, Self> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [Self: o, 'i: o, 'a: o, 'i: o] +error: [Self: o, 'i: o, 'i: o, 'a: o] --> $DIR/variance.rs:15:48 | LL | fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {} @@ -31,7 +31,7 @@ LL | fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + use<'i, 'a, Sel error: [Self: o, 'i: o, 'i: o] --> $DIR/variance.rs:21:44 | -LL | fn not_cpatured_late<'a>(_: &'a ()) -> impl Sized + use<'i, Self> {} +LL | fn not_captured_late<'a>(_: &'a ()) -> impl Sized + use<'i, Self> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/tests/ui/impl-trait/issue-55872-1.stderr b/tests/ui/impl-trait/issue-55872-1.stderr index 0c86824e622..2ccca0b562c 100644 --- a/tests/ui/impl-trait/issue-55872-1.stderr +++ b/tests/ui/impl-trait/issue-55872-1.stderr @@ -11,7 +11,10 @@ error[E0277]: the trait bound `S: Copy` is not satisfied in `(S, T)` --> $DIR/issue-55872-1.rs:12:29 | LL | fn foo<T: Default>() -> Self::E { - | ^^^^^^^ within `(S, T)`, the trait `Copy` is not implemented for `S`, which is required by `(S, T): Copy` + | ^^^^^^^ within `(S, T)`, the trait `Copy` is not implemented for `S` +... +LL | (S::default(), T::default()) + | ---------------------------- return type was inferred to be `(S, T)` here | = note: required because it appears within the type `(S, T)` help: consider further restricting this bound @@ -23,7 +26,10 @@ error[E0277]: the trait bound `T: Copy` is not satisfied in `(S, T)` --> $DIR/issue-55872-1.rs:12:29 | LL | fn foo<T: Default>() -> Self::E { - | ^^^^^^^ within `(S, T)`, the trait `Copy` is not implemented for `T`, which is required by `(S, T): Copy` + | ^^^^^^^ within `(S, T)`, the trait `Copy` is not implemented for `T` +... +LL | (S::default(), T::default()) + | ---------------------------- return type was inferred to be `(S, T)` here | = note: required because it appears within the type `(S, T)` help: consider further restricting this bound diff --git a/tests/ui/impl-trait/issue-55872-3.rs b/tests/ui/impl-trait/issue-55872-3.rs index 3f931027d9a..50b9eb3ce0e 100644 --- a/tests/ui/impl-trait/issue-55872-3.rs +++ b/tests/ui/impl-trait/issue-55872-3.rs @@ -1,4 +1,5 @@ //@ edition:2018 +//@compile-flags: --diagnostic-width=300 #![feature(impl_trait_in_assoc_type)] diff --git a/tests/ui/impl-trait/issue-55872-3.stderr b/tests/ui/impl-trait/issue-55872-3.stderr index f892da2a535..827155d48b8 100644 --- a/tests/ui/impl-trait/issue-55872-3.stderr +++ b/tests/ui/impl-trait/issue-55872-3.stderr @@ -1,8 +1,11 @@ -error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:15:9: 15:14}: Copy` is not satisfied - --> $DIR/issue-55872-3.rs:13:20 +error[E0277]: the trait bound `{async block@$DIR/issue-55872-3.rs:16:9: 16:14}: Copy` is not satisfied + --> $DIR/issue-55872-3.rs:14:20 | LL | fn foo<T>() -> Self::E { - | ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:15:9: 15:14}` + | ^^^^^^^ the trait `Copy` is not implemented for `{async block@$DIR/issue-55872-3.rs:16:9: 16:14}` +LL | +LL | async {} + | -------- return type was inferred to be `{async block@$DIR/issue-55872-3.rs:16:9: 16:14}` here error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/issues/issue-57979-impl-trait-in-path.rs b/tests/ui/impl-trait/issues/issue-57979-impl-trait-in-path.rs index c5ecd1caae1..9466668b1dc 100644 --- a/tests/ui/impl-trait/issues/issue-57979-impl-trait-in-path.rs +++ b/tests/ui/impl-trait/issues/issue-57979-impl-trait-in-path.rs @@ -6,7 +6,7 @@ pub trait Bar { } pub trait Quux<T> { type Assoc; } pub fn demo(_: impl Quux<(), Assoc=<() as Quux<impl Bar>>::Assoc>) { } -//~^ ERROR `impl Trait` is not allowed in path parameters +//~^ ERROR `impl Trait` is not allowed in paths impl<T> Quux<T> for () { type Assoc = u32; } fn main() { } diff --git a/tests/ui/impl-trait/issues/issue-57979-impl-trait-in-path.stderr b/tests/ui/impl-trait/issues/issue-57979-impl-trait-in-path.stderr index 55f47785f0e..25547dfa66f 100644 --- a/tests/ui/impl-trait/issues/issue-57979-impl-trait-in-path.stderr +++ b/tests/ui/impl-trait/issues/issue-57979-impl-trait-in-path.stderr @@ -1,9 +1,11 @@ -error[E0667]: `impl Trait` is not allowed in path parameters +error[E0562]: `impl Trait` is not allowed in paths --> $DIR/issue-57979-impl-trait-in-path.rs:8:48 | LL | pub fn demo(_: impl Quux<(), Assoc=<() as Quux<impl Bar>>::Assoc>) { } | ^^^^^^^^ + | + = note: `impl Trait` is only allowed in arguments and return types of functions and methods error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0667`. +For more information about this error, try `rustc --explain E0562`. diff --git a/tests/ui/impl-trait/issues/issue-62742.stderr b/tests/ui/impl-trait/issues/issue-62742.stderr index 94822e41ccd..98d17b02536 100644 --- a/tests/ui/impl-trait/issues/issue-62742.stderr +++ b/tests/ui/impl-trait/issues/issue-62742.stderr @@ -29,7 +29,8 @@ error[E0277]: the trait bound `RawImpl<_>: Raw<_>` is not satisfied LL | WrongImpl::foo(0i32); | ^^^^^^^^^ the trait `Raw<_>` is not implemented for `RawImpl<_>` | - = help: the trait `Raw<[_]>` is implemented for `RawImpl<_>` + = help: the trait `Raw<_>` is not implemented for `RawImpl<_>` + but trait `Raw<[_]>` is implemented for it note: required by a bound in `SafeImpl` --> $DIR/issue-62742.rs:33:35 | @@ -67,7 +68,8 @@ error[E0277]: the trait bound `RawImpl<()>: Raw<()>` is not satisfied LL | WrongImpl::<()>::foo(0i32); | ^^^^^^^^^^^^^^^ the trait `Raw<()>` is not implemented for `RawImpl<()>` | - = help: the trait `Raw<[()]>` is implemented for `RawImpl<()>` + = help: the trait `Raw<()>` is not implemented for `RawImpl<()>` + but trait `Raw<[()]>` is implemented for it = help: for that trait implementation, expected `[()]`, found `()` note: required by a bound in `SafeImpl` --> $DIR/issue-62742.rs:33:35 diff --git a/tests/ui/impl-trait/nested-rpit-hrtb.stderr b/tests/ui/impl-trait/nested-rpit-hrtb.stderr index d98de650d0d..2e95ef370c7 100644 --- a/tests/ui/impl-trait/nested-rpit-hrtb.stderr +++ b/tests/ui/impl-trait/nested-rpit-hrtb.stderr @@ -83,7 +83,8 @@ error[E0277]: the trait bound `for<'a> &'a (): Qux<'b>` is not satisfied LL | fn one_hrtb_mention_fn_trait_param_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Qux<'b>> {} | ^^^^^^^^^^^^ the trait `for<'a> Qux<'b>` is not implemented for `&'a ()` | - = help: the trait `Qux<'_>` is implemented for `()` + = help: the trait `Qux<'b>` is not implemented for `&'a ()` + but trait `Qux<'_>` is implemented for `()` = help: for that trait implementation, expected `()`, found `&'a ()` error: implementation of `Bar` is not general enough @@ -101,7 +102,8 @@ error[E0277]: the trait bound `for<'a, 'b> &'a (): Qux<'b>` is not satisfied LL | fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Qux<'b>> {} | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Qux<'b>` is not implemented for `&'a ()` | - = help: the trait `Qux<'_>` is implemented for `()` + = help: the trait `Qux<'b>` is not implemented for `&'a ()` + but trait `Qux<'_>` is implemented for `()` = help: for that trait implementation, expected `()`, found `&'a ()` error: aborting due to 9 previous errors diff --git a/tests/ui/impl-trait/nested_impl_trait.stderr b/tests/ui/impl-trait/nested_impl_trait.stderr index 83d1347aff4..d01c5961e81 100644 --- a/tests/ui/impl-trait/nested_impl_trait.stderr +++ b/tests/ui/impl-trait/nested_impl_trait.stderr @@ -46,7 +46,9 @@ error[E0277]: the trait bound `impl Debug: From<impl Into<u32>>` is not satisfie --> $DIR/nested_impl_trait.rs:6:46 | LL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x } - | ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Debug`, which is required by `impl Into<u32>: Into<impl Debug>` + | ^^^^^^^^^^^^^^^^^^^^^ - return type was inferred to be `impl Into<u32>` here + | | + | the trait `From<impl Into<u32>>` is not implemented for `impl Debug` | = help: the trait `Into<U>` is implemented for `T` = note: required for `impl Into<u32>` to implement `Into<impl Debug>` @@ -55,7 +57,9 @@ error[E0277]: the trait bound `impl Debug: From<impl Into<u32>>` is not satisfie --> $DIR/nested_impl_trait.rs:19:34 | LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x } - | ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Debug`, which is required by `impl Into<u32>: Into<impl Debug>` + | ^^^^^^^^^^^^^^^^^^^^^ - return type was inferred to be `impl Into<u32>` here + | | + | the trait `From<impl Into<u32>>` is not implemented for `impl Debug` | = help: the trait `Into<U>` is implemented for `T` = note: required for `impl Into<u32>` to implement `Into<impl Debug>` diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr index f1e6207ed81..f9142664f1b 100644 --- a/tests/ui/impl-trait/normalize-tait-in-const.stderr +++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr @@ -1,28 +1,28 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/normalize-tait-in-const.rs:26:42 + --> $DIR/normalize-tait-in-const.rs:26:35 | LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/normalize-tait-in-const.rs:26:69 + --> $DIR/normalize-tait-in-const.rs:26:62 | LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/normalize-tait-in-const.rs:26:42 + --> $DIR/normalize-tait-in-const.rs:26:35 | LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/normalize-tait-in-const.rs:26:69 + --> $DIR/normalize-tait-in-const.rs:26:62 | LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) { - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` @@ -37,10 +37,6 @@ help: consider further restricting this bound | LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct + ~const Fn(&foo::Alias<'_>)>(fun: F) { | ++++++++++++++++++++++++++++ -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error[E0493]: destructor of `F` cannot be evaluated at compile-time --> $DIR/normalize-tait-in-const.rs:26:79 diff --git a/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr index 5ade6a69d4b..6866f3f5350 100644 --- a/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr +++ b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr @@ -3,6 +3,9 @@ error[E0283]: type annotations needed | LL | fn run() -> Foo<impl Future<Output = ()>> { | ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type +LL | +LL | loop {} + | ------- return type was inferred to be `!` here | = note: cannot satisfy `_: Future` diff --git a/tests/ui/impl-trait/precise-capturing/auxiliary/foreign.rs b/tests/ui/impl-trait/precise-capturing/auxiliary/foreign.rs new file mode 100644 index 00000000000..49015bc48ba --- /dev/null +++ b/tests/ui/impl-trait/precise-capturing/auxiliary/foreign.rs @@ -0,0 +1,6 @@ +//@ edition: 2024 +//@ compile-flags: -Zunstable-options + +use std::fmt::Display; + +pub fn hello(x: &Vec<i32>) -> impl Display { 0 } diff --git a/tests/ui/impl-trait/precise-capturing/bound-modifiers.rs b/tests/ui/impl-trait/precise-capturing/bound-modifiers.rs index 47695814668..46121308fa0 100644 --- a/tests/ui/impl-trait/precise-capturing/bound-modifiers.rs +++ b/tests/ui/impl-trait/precise-capturing/bound-modifiers.rs @@ -3,8 +3,6 @@ fn polarity() -> impl Sized + ?use<> {} //~^ ERROR expected identifier, found keyword `use` //~| ERROR cannot find trait `r#use` in this scope -//~| WARN relaxing a default bound only does something for `?Sized` -//~| WARN relaxing a default bound only does something for `?Sized` fn asyncness() -> impl Sized + async use<> {} //~^ ERROR expected identifier, found keyword `use` diff --git a/tests/ui/impl-trait/precise-capturing/bound-modifiers.stderr b/tests/ui/impl-trait/precise-capturing/bound-modifiers.stderr index aaebfe2a86e..16e7470debf 100644 --- a/tests/ui/impl-trait/precise-capturing/bound-modifiers.stderr +++ b/tests/ui/impl-trait/precise-capturing/bound-modifiers.stderr @@ -5,19 +5,19 @@ LL | fn polarity() -> impl Sized + ?use<> {} | ^^^ expected identifier, found keyword error: expected identifier, found keyword `use` - --> $DIR/bound-modifiers.rs:9:38 + --> $DIR/bound-modifiers.rs:7:38 | LL | fn asyncness() -> impl Sized + async use<> {} | ^^^ expected identifier, found keyword error: expected identifier, found keyword `use` - --> $DIR/bound-modifiers.rs:14:38 + --> $DIR/bound-modifiers.rs:12:38 | LL | fn constness() -> impl Sized + const use<> {} | ^^^ expected identifier, found keyword error: expected identifier, found keyword `use` - --> $DIR/bound-modifiers.rs:19:37 + --> $DIR/bound-modifiers.rs:17:37 | LL | fn binder() -> impl Sized + for<'a> use<> {} | ^^^ expected identifier, found keyword @@ -29,25 +29,25 @@ LL | fn polarity() -> impl Sized + ?use<> {} | ^^^ not found in this scope error[E0405]: cannot find trait `r#use` in this scope - --> $DIR/bound-modifiers.rs:9:38 + --> $DIR/bound-modifiers.rs:7:38 | LL | fn asyncness() -> impl Sized + async use<> {} | ^^^ not found in this scope error[E0405]: cannot find trait `r#use` in this scope - --> $DIR/bound-modifiers.rs:14:38 + --> $DIR/bound-modifiers.rs:12:38 | LL | fn constness() -> impl Sized + const use<> {} | ^^^ not found in this scope error[E0405]: cannot find trait `r#use` in this scope - --> $DIR/bound-modifiers.rs:19:37 + --> $DIR/bound-modifiers.rs:17:37 | LL | fn binder() -> impl Sized + for<'a> use<> {} | ^^^ not found in this scope error[E0658]: async closures are unstable - --> $DIR/bound-modifiers.rs:9:32 + --> $DIR/bound-modifiers.rs:7:32 | LL | fn asyncness() -> impl Sized + async use<> {} | ^^^^^ @@ -58,7 +58,7 @@ LL | fn asyncness() -> impl Sized + async use<> {} = help: to use an async block, remove the `||`: `async {` error[E0658]: const trait impls are experimental - --> $DIR/bound-modifiers.rs:14:32 + --> $DIR/bound-modifiers.rs:12:32 | LL | fn constness() -> impl Sized + const use<> {} | ^^^^^ @@ -67,21 +67,7 @@ LL | fn constness() -> impl Sized + const use<> {} = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default - --> $DIR/bound-modifiers.rs:3:31 - | -LL | fn polarity() -> impl Sized + ?use<> {} - | ^^^^^^ - -warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default - --> $DIR/bound-modifiers.rs:3:31 - | -LL | fn polarity() -> impl Sized + ?use<> {} - | ^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 10 previous errors; 2 warnings emitted +error: aborting due to 10 previous errors Some errors have detailed explanations: E0405, E0658. For more information about an error, try `rustc --explain E0405`. diff --git a/tests/ui/impl-trait/precise-capturing/foreign-2021.rs b/tests/ui/impl-trait/precise-capturing/foreign-2021.rs new file mode 100644 index 00000000000..aee412ff7f1 --- /dev/null +++ b/tests/ui/impl-trait/precise-capturing/foreign-2021.rs @@ -0,0 +1,15 @@ +//@ aux-build: foreign.rs + +extern crate foreign; + +fn main() { + let mut x = vec![]; + let h = foreign::hello(&x); + //~^ NOTE this call may capture more lifetimes than intended + //~| NOTE immutable borrow occurs here + x.push(0); + //~^ ERROR cannot borrow `x` as mutable + //~| NOTE mutable borrow occurs here + println!("{h}"); + //~^ NOTE immutable borrow later used here +} diff --git a/tests/ui/impl-trait/precise-capturing/foreign-2021.stderr b/tests/ui/impl-trait/precise-capturing/foreign-2021.stderr new file mode 100644 index 00000000000..2a17ef72912 --- /dev/null +++ b/tests/ui/impl-trait/precise-capturing/foreign-2021.stderr @@ -0,0 +1,26 @@ +error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable + --> $DIR/foreign-2021.rs:10:5 + | +LL | let h = foreign::hello(&x); + | -- immutable borrow occurs here +... +LL | x.push(0); + | ^^^^^^^^^ mutable borrow occurs here +... +LL | println!("{h}"); + | --- immutable borrow later used here + | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules + --> $DIR/foreign-2021.rs:7:13 + | +LL | let h = foreign::hello(&x); + | ^^^^^^^^^^^^^^^^^^ +help: if you can modify this crate, add a precise capturing bound to avoid overcapturing: `+ use<>` + --> $DIR/auxiliary/foreign.rs:6:31 + | +LL | pub fn hello(x: &Vec<i32>) -> impl Display { 0 } + | ^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0502`. diff --git a/tests/ui/impl-trait/precise-capturing/migration-note.rs b/tests/ui/impl-trait/precise-capturing/migration-note.rs new file mode 100644 index 00000000000..a5bade4ddc5 --- /dev/null +++ b/tests/ui/impl-trait/precise-capturing/migration-note.rs @@ -0,0 +1,190 @@ +//@ edition: 2024 +//@ compile-flags: -Zunstable-options + +use std::fmt::Display; + +fn display_len<T>(x: &Vec<T>) -> impl Display { + //~^ NOTE in this expansion of desugaring of `impl Trait` + //~| NOTE in this expansion of desugaring of `impl Trait` + //~| NOTE in this expansion of desugaring of `impl Trait` + //~| NOTE in this expansion of desugaring of `impl Trait` + //~| NOTE in this expansion of desugaring of `impl Trait` + x.len() +} + +fn conflicting_borrow() { + let mut x = vec![]; + let a = display_len(&x); + //~^ NOTE this call may capture more lifetimes than intended + //~| NOTE immutable borrow occurs here + x.push(1); + //~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable + //~| NOTE mutable borrow occurs here + println!("{a}"); + //~^ NOTE immutable borrow later used here +} + +fn needs_static() { + let x = vec![1]; + //~^ NOTE binding `x` declared here + let a = display_len(&x); + //~^ ERROR `x` does not live long enough + //~| NOTE this call may capture more lifetimes than intended + //~| NOTE argument requires that `x` is borrowed for `'static` + //~| NOTE borrowed value does not live long enoug + + fn needs_static(_: impl Sized + 'static) {} + needs_static(a); +} +//~^ NOTE `x` dropped here while still borrowed + +fn is_moved() { + let x = vec![1]; + //~^ NOTE binding `x` declared here + let a = display_len(&x); + //~^ NOTE this call may capture more lifetimes than intended + //~| NOTE borrow of `x` occurs here + + fn mv(_: impl Sized) {} + mv(x); + //~^ ERROR cannot move out of `x` because it is borrowed + //~| NOTE move out of `x` occurs here +} +//~^ NOTE borrow might be used here, when `a` is dropped + +fn display_len_mut<T>(x: &mut Vec<T>) -> impl Display { + //~^ NOTE in this expansion of desugaring of `impl Trait` + //~| NOTE in this expansion of desugaring of `impl Trait` + //~| NOTE in this expansion of desugaring of `impl Trait` + x.len() +} + +fn conflicting_borrow_mut() { + let mut x = vec![]; + let a = display_len_mut(&mut x); + //~^ NOTE this call may capture more lifetimes than intended + //~| NOTE first mutable borrow occurs here + x.push(1); + //~^ ERROR cannot borrow `x` as mutable more than once + //~| NOTE second mutable borrow occurs here + println!("{a}"); + //~^ NOTE first borrow later used here +} + +fn needs_static_mut() { + let mut x = vec![1]; + //~^ NOTE binding `x` declared here + let a = display_len_mut(&mut x); + //~^ ERROR `x` does not live long enough + //~| NOTE this call may capture more lifetimes than intended + //~| NOTE argument requires that `x` is borrowed for `'static` + //~| NOTE borrowed value does not live long enough + + fn needs_static(_: impl Sized + 'static) {} + needs_static(a); +} +//~^ NOTE `x` dropped here while still borrowed + +fn is_move_mut() { + let mut x = vec![1]; + //~^ NOTE binding `x` declared here + let a = display_len_mut(&mut x); + //~^ NOTE this call may capture more lifetimes than intended + //~| NOTE borrow of `x` occurs here + + fn mv(_: impl Sized) {} + mv(x); + //~^ ERROR cannot move out of `x` because it is borrowed + //~| NOTE move out of `x` occurs here +} +//~^ NOTE borrow might be used here, when `a` is dropped + +struct S { f: i32 } + +fn display_field<T: Copy + Display>(t: &T) -> impl Display { + //~^ NOTE in this expansion of desugaring of `impl Trait` + //~| NOTE in this expansion of desugaring of `impl Trait` + //~| NOTE in this expansion of desugaring of `impl Trait` + *t +} + +fn conflicting_borrow_field() { + let mut s = S { f: 0 }; + let a = display_field(&s.f); + //~^ NOTE this call may capture more lifetimes than intended + //~| NOTE `s.f` is borrowed here + s.f = 1; + //~^ ERROR cannot assign to `s.f` because it is borrowed + //~| NOTE `s.f` is assigned to here but it was already borrowed + println!("{a}"); + //~^ NOTE borrow later used here +} + +fn display_field_mut<T: Copy + Display>(t: &mut T) -> impl Display { + *t +} + +fn conflicting_borrow_field_mut() { + let mut s = S { f: 0 }; + let a = display_field(&mut s.f); + //~^ NOTE this call may capture more lifetimes than intended + //~| NOTE `s.f` is borrowed here + s.f = 1; + //~^ ERROR cannot assign to `s.f` because it is borrowed + //~| NOTE `s.f` is assigned to here but it was already borrowed + println!("{a}"); + //~^ NOTE borrow later used here +} + +fn field_move() { + let mut s = S { f: 0 }; + let a = display_field(&mut s.f); + //~^ NOTE this call may capture more lifetimes than intended + //~| NOTE `s.f` is borrowed here + s.f; + //~^ ERROR cannot use `s.f` because it was mutably borrowed + //~| NOTE use of borrowed `s.f` + println!("{a}"); + //~^ NOTE borrow later used here +} + +struct Z { + f: Vec<i32>, +} + +fn live_long() { + let x; + { + let z = Z { f: vec![1] }; + //~^ NOTE binding `z` declared here + x = display_len(&z.f); + //~^ ERROR `z.f` does not live long enough + //~| NOTE this call may capture more lifetimes than intended + //~| NOTE values in a scope are dropped in the opposite order they are defined + //~| NOTE borrowed value does not live long enough + } + //~^ NOTE `z.f` dropped here while still borrowed +} +//~^ NOTE borrow might be used here, when `x` is dropped + +fn temp() { + let x = { let x = display_len(&mut vec![0]); x }; + //~^ ERROR temporary value dropped while borrowed + //~| NOTE this call may capture more lifetimes than intended + //~| NOTE consider using a `let` binding to create a longer lived value + //~| NOTE borrow later used here + //~| NOTE temporary value is freed at the end of this statement +} + +// FIXME: This doesn't display a useful Rust 2024 suggestion :( +fn returned() -> impl Sized { + let x = vec![0]; + //~^ NOTE binding `x` declared here + display_len(&x) + //~^ ERROR `x` does not live long enough + //~| NOTE borrowed value does not live long enough + //~| NOTE argument requires that `x` is borrowed for `'static` +} +//~^ NOTE `x` dropped here while still borrowed + +fn main() {} diff --git a/tests/ui/impl-trait/precise-capturing/migration-note.stderr b/tests/ui/impl-trait/precise-capturing/migration-note.stderr new file mode 100644 index 00000000000..3ac47ed1bcd --- /dev/null +++ b/tests/ui/impl-trait/precise-capturing/migration-note.stderr @@ -0,0 +1,284 @@ +error[E0597]: `x` does not live long enough + --> $DIR/migration-note.rs:183:17 + | +LL | let x = vec![0]; + | - binding `x` declared here +LL | +LL | display_len(&x) + | ------------^^- + | | | + | | borrowed value does not live long enough + | argument requires that `x` is borrowed for `'static` +... +LL | } + | - `x` dropped here while still borrowed + +error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable + --> $DIR/migration-note.rs:20:5 + | +LL | let a = display_len(&x); + | -- immutable borrow occurs here +... +LL | x.push(1); + | ^^^^^^^^^ mutable borrow occurs here +... +LL | println!("{a}"); + | --- immutable borrow later used here + | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules + --> $DIR/migration-note.rs:17:13 + | +LL | let a = display_len(&x); + | ^^^^^^^^^^^^^^^ +help: add a precise capturing bound to avoid overcapturing + | +LL | fn display_len<T>(x: &Vec<T>) -> impl Display + use<T> { + | ++++++++ + +error[E0597]: `x` does not live long enough + --> $DIR/migration-note.rs:30:25 + | +LL | let x = vec![1]; + | - binding `x` declared here +LL | +LL | let a = display_len(&x); + | ------------^^- + | | | + | | borrowed value does not live long enough + | argument requires that `x` is borrowed for `'static` +... +LL | } + | - `x` dropped here while still borrowed + | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules + --> $DIR/migration-note.rs:30:13 + | +LL | let a = display_len(&x); + | ^^^^^^^^^^^^^^^ +help: add a precise capturing bound to avoid overcapturing + | +LL | fn display_len<T>(x: &Vec<T>) -> impl Display + use<T> { + | ++++++++ + +error[E0505]: cannot move out of `x` because it is borrowed + --> $DIR/migration-note.rs:49:8 + | +LL | let x = vec![1]; + | - binding `x` declared here +LL | +LL | let a = display_len(&x); + | -- borrow of `x` occurs here +... +LL | mv(x); + | ^ move out of `x` occurs here +... +LL | } + | - borrow might be used here, when `a` is dropped and runs the destructor for type `impl std::fmt::Display` + | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules + --> $DIR/migration-note.rs:44:13 + | +LL | let a = display_len(&x); + | ^^^^^^^^^^^^^^^ +help: add a precise capturing bound to avoid overcapturing + | +LL | fn display_len<T>(x: &Vec<T>) -> impl Display + use<T> { + | ++++++++ +help: consider cloning the value if the performance cost is acceptable + | +LL | let a = display_len(&x.clone()); + | ++++++++ + +error[E0499]: cannot borrow `x` as mutable more than once at a time + --> $DIR/migration-note.rs:67:5 + | +LL | let a = display_len_mut(&mut x); + | ------ first mutable borrow occurs here +... +LL | x.push(1); + | ^ second mutable borrow occurs here +... +LL | println!("{a}"); + | --- first borrow later used here + | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules + --> $DIR/migration-note.rs:64:13 + | +LL | let a = display_len_mut(&mut x); + | ^^^^^^^^^^^^^^^^^^^^^^^ +help: add a precise capturing bound to avoid overcapturing + | +LL | fn display_len_mut<T>(x: &mut Vec<T>) -> impl Display + use<T> { + | ++++++++ + +error[E0597]: `x` does not live long enough + --> $DIR/migration-note.rs:77:29 + | +LL | let mut x = vec![1]; + | ----- binding `x` declared here +LL | +LL | let a = display_len_mut(&mut x); + | ----------------^^^^^^- + | | | + | | borrowed value does not live long enough + | argument requires that `x` is borrowed for `'static` +... +LL | } + | - `x` dropped here while still borrowed + | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules + --> $DIR/migration-note.rs:77:13 + | +LL | let a = display_len_mut(&mut x); + | ^^^^^^^^^^^^^^^^^^^^^^^ +help: add a precise capturing bound to avoid overcapturing + | +LL | fn display_len_mut<T>(x: &mut Vec<T>) -> impl Display + use<T> { + | ++++++++ + +error[E0505]: cannot move out of `x` because it is borrowed + --> $DIR/migration-note.rs:96:8 + | +LL | let mut x = vec![1]; + | ----- binding `x` declared here +LL | +LL | let a = display_len_mut(&mut x); + | ------ borrow of `x` occurs here +... +LL | mv(x); + | ^ move out of `x` occurs here +... +LL | } + | - borrow might be used here, when `a` is dropped and runs the destructor for type `impl std::fmt::Display` + | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules + --> $DIR/migration-note.rs:91:13 + | +LL | let a = display_len_mut(&mut x); + | ^^^^^^^^^^^^^^^^^^^^^^^ +help: add a precise capturing bound to avoid overcapturing + | +LL | fn display_len_mut<T>(x: &mut Vec<T>) -> impl Display + use<T> { + | ++++++++ +help: consider cloning the value if the performance cost is acceptable + | +LL | let a = display_len_mut(&mut x.clone()); + | ++++++++ + +error[E0506]: cannot assign to `s.f` because it is borrowed + --> $DIR/migration-note.rs:116:5 + | +LL | let a = display_field(&s.f); + | ---- `s.f` is borrowed here +... +LL | s.f = 1; + | ^^^^^^^ `s.f` is assigned to here but it was already borrowed +... +LL | println!("{a}"); + | --- borrow later used here + | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules + --> $DIR/migration-note.rs:113:13 + | +LL | let a = display_field(&s.f); + | ^^^^^^^^^^^^^^^^^^^ +help: add a precise capturing bound to avoid overcapturing + | +LL | fn display_field<T: Copy + Display>(t: &T) -> impl Display + use<T> { + | ++++++++ + +error[E0506]: cannot assign to `s.f` because it is borrowed + --> $DIR/migration-note.rs:132:5 + | +LL | let a = display_field(&mut s.f); + | -------- `s.f` is borrowed here +... +LL | s.f = 1; + | ^^^^^^^ `s.f` is assigned to here but it was already borrowed +... +LL | println!("{a}"); + | --- borrow later used here + | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules + --> $DIR/migration-note.rs:129:13 + | +LL | let a = display_field(&mut s.f); + | ^^^^^^^^^^^^^^^^^^^^^^^ +help: add a precise capturing bound to avoid overcapturing + | +LL | fn display_field<T: Copy + Display>(t: &T) -> impl Display + use<T> { + | ++++++++ + +error[E0503]: cannot use `s.f` because it was mutably borrowed + --> $DIR/migration-note.rs:144:5 + | +LL | let a = display_field(&mut s.f); + | -------- `s.f` is borrowed here +... +LL | s.f; + | ^^^ use of borrowed `s.f` +... +LL | println!("{a}"); + | --- borrow later used here + | +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules + --> $DIR/migration-note.rs:141:13 + | +LL | let a = display_field(&mut s.f); + | ^^^^^^^^^^^^^^^^^^^^^^^ +help: add a precise capturing bound to avoid overcapturing + | +LL | fn display_field<T: Copy + Display>(t: &T) -> impl Display + use<T> { + | ++++++++ + +error[E0597]: `z.f` does not live long enough + --> $DIR/migration-note.rs:160:25 + | +LL | let z = Z { f: vec![1] }; + | - binding `z` declared here +LL | +LL | x = display_len(&z.f); + | ^^^^ borrowed value does not live long enough +... +LL | } + | - `z.f` dropped here while still borrowed +LL | +LL | } + | - borrow might be used here, when `x` is dropped and runs the destructor for type `impl std::fmt::Display` + | + = note: values in a scope are dropped in the opposite order they are defined +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules + --> $DIR/migration-note.rs:160:13 + | +LL | x = display_len(&z.f); + | ^^^^^^^^^^^^^^^^^ +help: add a precise capturing bound to avoid overcapturing + | +LL | fn display_len<T>(x: &Vec<T>) -> impl Display + use<T> { + | ++++++++ + +error[E0716]: temporary value dropped while borrowed + --> $DIR/migration-note.rs:171:40 + | +LL | let x = { let x = display_len(&mut vec![0]); x }; + | ^^^^^^^ - - borrow later used here + | | | + | | temporary value is freed at the end of this statement + | creates a temporary value which is freed while still in use + | + = note: consider using a `let` binding to create a longer lived value +note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules + --> $DIR/migration-note.rs:171:23 + | +LL | let x = { let x = display_len(&mut vec![0]); x }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) +help: add a precise capturing bound to avoid overcapturing + | +LL | fn display_len<T>(x: &Vec<T>) -> impl Display + use<T> { + | ++++++++ + +error: aborting due to 12 previous errors + +Some errors have detailed explanations: E0499, E0502, E0503, E0505, E0506, E0597, E0716. +For more information about an error, try `rustc --explain E0499`. diff --git a/tests/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr b/tests/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr index fa71adc6380..96e18f1f1cb 100644 --- a/tests/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr +++ b/tests/ui/impl-trait/projection-mismatch-in-impl-where-clause.stderr @@ -3,6 +3,9 @@ error[E0271]: type mismatch resolving `<() as Super>::Assoc == ()` | LL | fn test() -> impl Test { | ^^^^^^^^^ type mismatch resolving `<() as Super>::Assoc == ()` +LL | +LL | () + | -- return type was inferred to be `()` here | note: expected this to be `()` --> $DIR/projection-mismatch-in-impl-where-clause.rs:6:18 diff --git a/tests/ui/imports/issue-37887.stderr b/tests/ui/imports/issue-37887.stderr index 02c2c803262..cc191a17c29 100644 --- a/tests/ui/imports/issue-37887.stderr +++ b/tests/ui/imports/issue-37887.stderr @@ -9,7 +9,7 @@ help: consider importing the `test` crate LL + extern crate test; | -error[E0658]: use of unstable library feature 'test' +error[E0658]: use of unstable library feature `test` --> $DIR/issue-37887.rs:2:5 | LL | extern crate test; diff --git a/tests/ui/imports/resolve-other-libc.rs b/tests/ui/imports/resolve-other-libc.rs index d848f8260aa..e23083276ce 100644 --- a/tests/ui/imports/resolve-other-libc.rs +++ b/tests/ui/imports/resolve-other-libc.rs @@ -6,7 +6,7 @@ // indicates that `libc` was wrongly resolved to `libc` shipped with the // compiler: // -// error[E0658]: use of unstable library feature 'rustc_private': \ +// error[E0658]: use of unstable library feature `rustc_private`: \ // this crate is being loaded from the sysroot // extern crate libc; //~ ERROR: extern location for libc does not exist: test.rlib diff --git a/tests/ui/indexing/index-help.stderr b/tests/ui/indexing/index-help.stderr index 1291bf2a461..1974e13eabc 100644 --- a/tests/ui/indexing/index-help.stderr +++ b/tests/ui/indexing/index-help.stderr @@ -4,8 +4,8 @@ error[E0277]: the type `[{integer}]` cannot be indexed by `i32` LL | x[0i32]; | ^^^^ slice indices are of type `usize` or ranges of `usize` | - = help: the trait `SliceIndex<[{integer}]>` is not implemented for `i32`, which is required by `Vec<{integer}>: Index<_>` - = help: the trait `SliceIndex<[{integer}]>` is implemented for `usize` + = help: the trait `SliceIndex<[{integer}]>` is not implemented for `i32` + but it is implemented for `usize` = help: for that trait implementation, expected `usize`, found `i32` = note: required for `Vec<{integer}>` to implement `Index<i32>` diff --git a/tests/ui/indexing/indexing-requires-a-uint.stderr b/tests/ui/indexing/indexing-requires-a-uint.stderr index 38e7881dcc6..5c60a30946d 100644 --- a/tests/ui/indexing/indexing-requires-a-uint.stderr +++ b/tests/ui/indexing/indexing-requires-a-uint.stderr @@ -4,8 +4,8 @@ error[E0277]: the type `[{integer}]` cannot be indexed by `u8` LL | [0][0u8]; | ^^^ slice indices are of type `usize` or ranges of `usize` | - = help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8`, which is required by `[{integer}; 1]: Index<_>` - = help: the trait `SliceIndex<[{integer}]>` is implemented for `usize` + = help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8` + but it is implemented for `usize` = help: for that trait implementation, expected `usize`, found `u8` = note: required for `[{integer}]` to implement `Index<u8>` = note: 1 redundant requirement hidden diff --git a/tests/ui/indexing/point-at-index-for-obligation-failure.stderr b/tests/ui/indexing/point-at-index-for-obligation-failure.stderr index df4d7cc0683..0752231356c 100644 --- a/tests/ui/indexing/point-at-index-for-obligation-failure.stderr +++ b/tests/ui/indexing/point-at-index-for-obligation-failure.stderr @@ -2,9 +2,10 @@ error[E0277]: the trait bound `String: Borrow<&str>` is not satisfied --> $DIR/point-at-index-for-obligation-failure.rs:5:9 | LL | &s - | ^^ the trait `Borrow<&str>` is not implemented for `String`, which is required by `HashMap<String, String>: Index<&_>` + | ^^ the trait `Borrow<&str>` is not implemented for `String` | - = help: the trait `Borrow<str>` is implemented for `String` + = help: the trait `Borrow<&_>` is not implemented for `String` + but trait `Borrow<_>` is implemented for it = help: for that trait implementation, expected `str`, found `&str` = note: required for `HashMap<String, String>` to implement `Index<&&str>` diff --git a/tests/ui/inference/inference_unstable_forced.stderr b/tests/ui/inference/inference_unstable_forced.stderr index 26eaddd2707..e3b5b292cd4 100644 --- a/tests/ui/inference/inference_unstable_forced.stderr +++ b/tests/ui/inference/inference_unstable_forced.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'ipu_flatten' +error[E0658]: use of unstable library feature `ipu_flatten` --> $DIR/inference_unstable_forced.rs:11:20 | LL | assert_eq!('x'.ipu_flatten(), 0); diff --git a/tests/ui/integral-indexing.stderr b/tests/ui/integral-indexing.stderr index ad2c3af424b..e7a45c2c88d 100644 --- a/tests/ui/integral-indexing.stderr +++ b/tests/ui/integral-indexing.stderr @@ -4,8 +4,8 @@ error[E0277]: the type `[isize]` cannot be indexed by `u8` LL | v[3u8]; | ^^^ slice indices are of type `usize` or ranges of `usize` | - = help: the trait `SliceIndex<[isize]>` is not implemented for `u8`, which is required by `Vec<isize>: Index<_>` - = help: the trait `SliceIndex<[isize]>` is implemented for `usize` + = help: the trait `SliceIndex<[isize]>` is not implemented for `u8` + but it is implemented for `usize` = help: for that trait implementation, expected `usize`, found `u8` = note: required for `Vec<isize>` to implement `Index<u8>` @@ -15,8 +15,8 @@ error[E0277]: the type `[isize]` cannot be indexed by `i8` LL | v[3i8]; | ^^^ slice indices are of type `usize` or ranges of `usize` | - = help: the trait `SliceIndex<[isize]>` is not implemented for `i8`, which is required by `Vec<isize>: Index<_>` - = help: the trait `SliceIndex<[isize]>` is implemented for `usize` + = help: the trait `SliceIndex<[isize]>` is not implemented for `i8` + but it is implemented for `usize` = help: for that trait implementation, expected `usize`, found `i8` = note: required for `Vec<isize>` to implement `Index<i8>` @@ -26,8 +26,8 @@ error[E0277]: the type `[isize]` cannot be indexed by `u32` LL | v[3u32]; | ^^^^ slice indices are of type `usize` or ranges of `usize` | - = help: the trait `SliceIndex<[isize]>` is not implemented for `u32`, which is required by `Vec<isize>: Index<_>` - = help: the trait `SliceIndex<[isize]>` is implemented for `usize` + = help: the trait `SliceIndex<[isize]>` is not implemented for `u32` + but it is implemented for `usize` = help: for that trait implementation, expected `usize`, found `u32` = note: required for `Vec<isize>` to implement `Index<u32>` @@ -37,8 +37,8 @@ error[E0277]: the type `[isize]` cannot be indexed by `i32` LL | v[3i32]; | ^^^^ slice indices are of type `usize` or ranges of `usize` | - = help: the trait `SliceIndex<[isize]>` is not implemented for `i32`, which is required by `Vec<isize>: Index<_>` - = help: the trait `SliceIndex<[isize]>` is implemented for `usize` + = help: the trait `SliceIndex<[isize]>` is not implemented for `i32` + but it is implemented for `usize` = help: for that trait implementation, expected `usize`, found `i32` = note: required for `Vec<isize>` to implement `Index<i32>` @@ -48,8 +48,8 @@ error[E0277]: the type `[u8]` cannot be indexed by `u8` LL | s.as_bytes()[3u8]; | ^^^ slice indices are of type `usize` or ranges of `usize` | - = help: the trait `SliceIndex<[u8]>` is not implemented for `u8`, which is required by `[u8]: Index<_>` - = help: the trait `SliceIndex<[u8]>` is implemented for `usize` + = help: the trait `SliceIndex<[u8]>` is not implemented for `u8` + but it is implemented for `usize` = help: for that trait implementation, expected `usize`, found `u8` = note: required for `[u8]` to implement `Index<u8>` @@ -59,8 +59,8 @@ error[E0277]: the type `[u8]` cannot be indexed by `i8` LL | s.as_bytes()[3i8]; | ^^^ slice indices are of type `usize` or ranges of `usize` | - = help: the trait `SliceIndex<[u8]>` is not implemented for `i8`, which is required by `[u8]: Index<_>` - = help: the trait `SliceIndex<[u8]>` is implemented for `usize` + = help: the trait `SliceIndex<[u8]>` is not implemented for `i8` + but it is implemented for `usize` = help: for that trait implementation, expected `usize`, found `i8` = note: required for `[u8]` to implement `Index<i8>` @@ -70,8 +70,8 @@ error[E0277]: the type `[u8]` cannot be indexed by `u32` LL | s.as_bytes()[3u32]; | ^^^^ slice indices are of type `usize` or ranges of `usize` | - = help: the trait `SliceIndex<[u8]>` is not implemented for `u32`, which is required by `[u8]: Index<_>` - = help: the trait `SliceIndex<[u8]>` is implemented for `usize` + = help: the trait `SliceIndex<[u8]>` is not implemented for `u32` + but it is implemented for `usize` = help: for that trait implementation, expected `usize`, found `u32` = note: required for `[u8]` to implement `Index<u32>` @@ -81,8 +81,8 @@ error[E0277]: the type `[u8]` cannot be indexed by `i32` LL | s.as_bytes()[3i32]; | ^^^^ slice indices are of type `usize` or ranges of `usize` | - = help: the trait `SliceIndex<[u8]>` is not implemented for `i32`, which is required by `[u8]: Index<_>` - = help: the trait `SliceIndex<[u8]>` is implemented for `usize` + = help: the trait `SliceIndex<[u8]>` is not implemented for `i32` + but it is implemented for `usize` = help: for that trait implementation, expected `usize`, found `i32` = note: required for `[u8]` to implement `Index<i32>` diff --git a/tests/ui/interior-mutability/interior-mutability.stderr b/tests/ui/interior-mutability/interior-mutability.stderr index 29b250c1b07..cfc64445bf3 100644 --- a/tests/ui/interior-mutability/interior-mutability.stderr +++ b/tests/ui/interior-mutability/interior-mutability.stderr @@ -6,7 +6,7 @@ LL | catch_unwind(|| { x.set(23); }); | | | required by a bound introduced by this call | - = help: within `Cell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>`, which is required by `{closure@$DIR/interior-mutability.rs:5:18: 5:20}: UnwindSafe` + = help: within `Cell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` note: required because it appears within the type `Cell<i32>` --> $SRC_DIR/core/src/cell.rs:LL:COL = note: required for `&Cell<i32>` to implement `UnwindSafe` diff --git a/tests/ui/internal/internal-unstable-noallow.rs b/tests/ui/internal/internal-unstable-noallow.rs index 9d925c86122..57ddb93d880 100644 --- a/tests/ui/internal/internal-unstable-noallow.rs +++ b/tests/ui/internal/internal-unstable-noallow.rs @@ -4,10 +4,10 @@ // the // ~ form. //@ aux-build:internal_unstable.rs -//@ error-pattern:use of unstable library feature 'function' -//@ error-pattern:use of unstable library feature 'struct_field' -//@ error-pattern:use of unstable library feature 'method' -//@ error-pattern:use of unstable library feature 'struct2_field' +//@ error-pattern:use of unstable library feature `function` +//@ error-pattern:use of unstable library feature `struct_field` +//@ error-pattern:use of unstable library feature `method` +//@ error-pattern:use of unstable library feature `struct2_field` #[macro_use] extern crate internal_unstable; diff --git a/tests/ui/internal/internal-unstable-noallow.stderr b/tests/ui/internal/internal-unstable-noallow.stderr index b39456b1cae..22f42abbd11 100644 --- a/tests/ui/internal/internal-unstable-noallow.stderr +++ b/tests/ui/internal/internal-unstable-noallow.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'function' +error[E0658]: use of unstable library feature `function` --> $DIR/internal-unstable-noallow.rs:16:5 | LL | call_unstable_noallow!(); @@ -8,7 +8,7 @@ LL | call_unstable_noallow!(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: this error originates in the macro `call_unstable_noallow` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0658]: use of unstable library feature 'struct_field' +error[E0658]: use of unstable library feature `struct_field` --> $DIR/internal-unstable-noallow.rs:18:5 | LL | construct_unstable_noallow!(0); @@ -18,7 +18,7 @@ LL | construct_unstable_noallow!(0); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: this error originates in the macro `construct_unstable_noallow` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0658]: use of unstable library feature 'method' +error[E0658]: use of unstable library feature `method` --> $DIR/internal-unstable-noallow.rs:20:35 | LL | |x: internal_unstable::Foo| { call_method_noallow!(x) }; @@ -28,7 +28,7 @@ LL | |x: internal_unstable::Foo| { call_method_noallow!(x) }; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: this error originates in the macro `call_method_noallow` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0658]: use of unstable library feature 'struct2_field' +error[E0658]: use of unstable library feature `struct2_field` --> $DIR/internal-unstable-noallow.rs:22:35 | LL | |x: internal_unstable::Bar| { access_field_noallow!(x) }; diff --git a/tests/ui/internal/internal-unstable-thread-local.stderr b/tests/ui/internal/internal-unstable-thread-local.stderr index 58c7b3f67eb..c0510b39e50 100644 --- a/tests/ui/internal/internal-unstable-thread-local.stderr +++ b/tests/ui/internal/internal-unstable-thread-local.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'function' +error[E0658]: use of unstable library feature `function` --> $DIR/internal-unstable-thread-local.rs:9:32 | LL | thread_local!(static BAR: () = internal_unstable::unstable()); diff --git a/tests/ui/internal/internal-unstable.stderr b/tests/ui/internal/internal-unstable.stderr index 78b9109d1c2..ea74175f09b 100644 --- a/tests/ui/internal/internal-unstable.stderr +++ b/tests/ui/internal/internal-unstable.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'function' +error[E0658]: use of unstable library feature `function` --> $DIR/internal-unstable.rs:48:25 | LL | pass_through_allow!(internal_unstable::unstable()); @@ -7,7 +7,7 @@ LL | pass_through_allow!(internal_unstable::unstable()); = help: add `#![feature(function)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'function' +error[E0658]: use of unstable library feature `function` --> $DIR/internal-unstable.rs:50:27 | LL | pass_through_noallow!(internal_unstable::unstable()); @@ -16,7 +16,7 @@ LL | pass_through_noallow!(internal_unstable::unstable()); = help: add `#![feature(function)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'function' +error[E0658]: use of unstable library feature `function` --> $DIR/internal-unstable.rs:54:22 | LL | println!("{:?}", internal_unstable::unstable()); @@ -25,7 +25,7 @@ LL | println!("{:?}", internal_unstable::unstable()); = help: add `#![feature(function)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'function' +error[E0658]: use of unstable library feature `function` --> $DIR/internal-unstable.rs:56:10 | LL | bar!(internal_unstable::unstable()); @@ -34,7 +34,7 @@ LL | bar!(internal_unstable::unstable()); = help: add `#![feature(function)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'function' +error[E0658]: use of unstable library feature `function` --> $DIR/internal-unstable.rs:18:9 | LL | internal_unstable::unstable(); diff --git a/tests/ui/intrinsics/always-gets-overridden.rs b/tests/ui/intrinsics/always-gets-overridden.rs index ad2c2be4daa..2fb64f96d83 100644 --- a/tests/ui/intrinsics/always-gets-overridden.rs +++ b/tests/ui/intrinsics/always-gets-overridden.rs @@ -1,6 +1,6 @@ //! Check that `vtable_size` gets overridden by llvm backend even if there is no //! `rustc_intrinsic_must_be_overridden` attribute on this usage. -#![feature(rustc_attrs)] +#![feature(intrinsics)] //@run-pass #[rustc_intrinsic] diff --git a/tests/ui/intrinsics/const-eval-select-bad.stderr b/tests/ui/intrinsics/const-eval-select-bad.stderr index 50092edda4f..e317ed23ab1 100644 --- a/tests/ui/intrinsics/const-eval-select-bad.stderr +++ b/tests/ui/intrinsics/const-eval-select-bad.stderr @@ -27,7 +27,7 @@ LL | const_eval_select((), 42, 0xDEADBEEF); = help: the trait `FnOnce()` is not implemented for `{integer}` = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `const_eval_select` - --> $SRC_DIR/core/src/intrinsics.rs:LL:COL + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL error[E0277]: expected a `FnOnce()` closure, found `{integer}` --> $DIR/const-eval-select-bad.rs:10:31 @@ -40,7 +40,7 @@ LL | const_eval_select((), 42, 0xDEADBEEF); = help: the trait `FnOnce()` is not implemented for `{integer}` = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `const_eval_select` - --> $SRC_DIR/core/src/intrinsics.rs:LL:COL + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL error: this argument must be a function item --> $DIR/const-eval-select-bad.rs:10:27 @@ -69,7 +69,7 @@ LL | const_eval_select((1,), foo, bar); | required by a bound introduced by this call | note: required by a bound in `const_eval_select` - --> $SRC_DIR/core/src/intrinsics.rs:LL:COL + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL error[E0631]: type mismatch in function arguments --> $DIR/const-eval-select-bad.rs:37:32 @@ -85,7 +85,7 @@ LL | const_eval_select((true,), foo, baz); = note: expected function signature `fn(bool) -> _` found function signature `fn(i32) -> _` note: required by a bound in `const_eval_select` - --> $SRC_DIR/core/src/intrinsics.rs:LL:COL + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL help: consider wrapping the function in a closure | LL | const_eval_select((true,), |arg0: bool| foo(/* i32 */), baz); diff --git a/tests/ui/intrinsics/const-eval-select-stability.rs b/tests/ui/intrinsics/const-eval-select-stability.rs index 575bc0cadda..25cbadaa22d 100644 --- a/tests/ui/intrinsics/const-eval-select-stability.rs +++ b/tests/ui/intrinsics/const-eval-select-stability.rs @@ -15,7 +15,7 @@ const fn nothing(){} #[rustc_const_stable(since = "1.0", feature = "const_hey")] pub const fn hey() { const_eval_select((), nothing, log); - //~^ ERROR `const_eval_select` is not yet stable as a const fn + //~^ ERROR cannot use `#[feature(const_eval_select)]` } fn main() {} diff --git a/tests/ui/intrinsics/const-eval-select-stability.stderr b/tests/ui/intrinsics/const-eval-select-stability.stderr index 335b9877aa0..5f443b1d4ff 100644 --- a/tests/ui/intrinsics/const-eval-select-stability.stderr +++ b/tests/ui/intrinsics/const-eval-select-stability.stderr @@ -1,10 +1,19 @@ -error: `const_eval_select` is not yet stable as a const fn +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_eval_select)]` --> $DIR/const-eval-select-stability.rs:17:5 | LL | const_eval_select((), nothing, log); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: const-stable functions can only call other const-stable functions +help: if the function is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | pub const fn hey() { + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(const_eval_select)] +LL | pub const fn hey() { + | error: aborting due to 1 previous error diff --git a/tests/ui/intrinsics/feature-gate-safe-intrinsic.rs b/tests/ui/intrinsics/feature-gate-safe-intrinsic.rs deleted file mode 100644 index ffaa4d771d9..00000000000 --- a/tests/ui/intrinsics/feature-gate-safe-intrinsic.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[rustc_safe_intrinsic] -//~^ ERROR the `#[rustc_safe_intrinsic]` attribute is used internally to mark intrinsics as safe -//~| ERROR attribute should be applied to intrinsic functions -fn safe() {} - -fn main() {} diff --git a/tests/ui/intrinsics/feature-gate-safe-intrinsic.stderr b/tests/ui/intrinsics/feature-gate-safe-intrinsic.stderr deleted file mode 100644 index e49880e9bb8..00000000000 --- a/tests/ui/intrinsics/feature-gate-safe-intrinsic.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0658]: the `#[rustc_safe_intrinsic]` attribute is used internally to mark intrinsics as safe - --> $DIR/feature-gate-safe-intrinsic.rs:1:1 - | -LL | #[rustc_safe_intrinsic] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: attribute should be applied to intrinsic functions - --> $DIR/feature-gate-safe-intrinsic.rs:1:1 - | -LL | #[rustc_safe_intrinsic] - | ^^^^^^^^^^^^^^^^^^^^^^^ -... -LL | fn safe() {} - | ------------ not an intrinsic function - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/intrinsics/intrinsic-alignment.rs b/tests/ui/intrinsics/intrinsic-alignment.rs index 4cb05f6a8df..ab99aa5fd03 100644 --- a/tests/ui/intrinsics/intrinsic-alignment.rs +++ b/tests/ui/intrinsics/intrinsic-alignment.rs @@ -1,14 +1,8 @@ //@ run-pass -#![feature(intrinsics, rustc_attrs)] +#![feature(core_intrinsics, rustc_attrs)] -mod rusti { - extern "rust-intrinsic" { - pub fn pref_align_of<T>() -> usize; - #[rustc_safe_intrinsic] - pub fn min_align_of<T>() -> usize; - } -} +use std::intrinsics as rusti; #[cfg(any( target_os = "android", diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs index 99f98c3f27a..76b6a8c8395 100644 --- a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs +++ b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs @@ -1,5 +1,4 @@ #![feature(core_intrinsics)] -#![feature(const_intrinsic_raw_eq)] const RAW_EQ_PADDING: bool = unsafe { std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16)) diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr index bedfc8283ea..b8fdfe7bef3 100644 --- a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr +++ b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr @@ -1,11 +1,11 @@ error[E0080]: evaluation of constant value failed - --> $DIR/intrinsic-raw_eq-const-bad.rs:5:5 + --> $DIR/intrinsic-raw_eq-const-bad.rs:4:5 | LL | std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC0[0x0..0x4], but memory is uninitialized at [0x1..0x2], and this operation requires initialized memory error[E0080]: evaluation of constant value failed - --> $DIR/intrinsic-raw_eq-const-bad.rs:11:5 + --> $DIR/intrinsic-raw_eq-const-bad.rs:10:5 | LL | std::intrinsics::raw_eq(&(&0), &(&1)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into integer @@ -14,7 +14,7 @@ LL | std::intrinsics::raw_eq(&(&0), &(&1)) = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: evaluation of constant value failed - --> $DIR/intrinsic-raw_eq-const-bad.rs:19:5 + --> $DIR/intrinsic-raw_eq-const-bad.rs:18:5 | LL | std::intrinsics::raw_eq(aref, aref) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ accessing memory with alignment 1, but alignment 4 is required diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const.rs b/tests/ui/intrinsics/intrinsic-raw_eq-const.rs index 47b4e20dfbb..b37def85bb7 100644 --- a/tests/ui/intrinsics/intrinsic-raw_eq-const.rs +++ b/tests/ui/intrinsics/intrinsic-raw_eq-const.rs @@ -1,7 +1,6 @@ //@ run-pass #![feature(core_intrinsics)] -#![feature(const_intrinsic_raw_eq)] pub fn main() { use std::intrinsics::raw_eq; diff --git a/tests/ui/intrinsics/intrinsics-integer.rs b/tests/ui/intrinsics/intrinsics-integer.rs index 7dbc4b8b7ce..8eb03924feb 100644 --- a/tests/ui/intrinsics/intrinsics-integer.rs +++ b/tests/ui/intrinsics/intrinsics-integer.rs @@ -1,24 +1,8 @@ //@ run-pass -#![feature(intrinsics)] -#![feature(rustc_attrs)] - -mod rusti { - extern "rust-intrinsic" { - #[rustc_safe_intrinsic] - pub fn ctpop<T>(x: T) -> u32; - #[rustc_safe_intrinsic] - pub fn ctlz<T>(x: T) -> u32; - pub fn ctlz_nonzero<T>(x: T) -> u32; - #[rustc_safe_intrinsic] - pub fn cttz<T>(x: T) -> u32; - pub fn cttz_nonzero<T>(x: T) -> u32; - #[rustc_safe_intrinsic] - pub fn bswap<T>(x: T) -> T; - #[rustc_safe_intrinsic] - pub fn bitreverse<T>(x: T) -> T; - } -} +#![feature(core_intrinsics)] + +use std::intrinsics as rusti; pub fn main() { use rusti::*; diff --git a/tests/ui/intrinsics/not-overridden.rs b/tests/ui/intrinsics/not-overridden.rs index e1f1bbe0951..16f8e9bcf6a 100644 --- a/tests/ui/intrinsics/not-overridden.rs +++ b/tests/ui/intrinsics/not-overridden.rs @@ -1,6 +1,6 @@ //! Check that intrinsics that do not get overridden, but are marked as such, //! cause an error instead of silently invoking the body. -#![feature(rustc_attrs)] +#![feature(intrinsics)] //@ build-fail //@ failure-status:101 //@ normalize-stderr-test: ".*note: .*\n\n" -> "" diff --git a/tests/ui/intrinsics/reify-intrinsic.stderr b/tests/ui/intrinsics/reify-intrinsic.stderr index 21b7bf4e1cb..7af17147f28 100644 --- a/tests/ui/intrinsics/reify-intrinsic.stderr +++ b/tests/ui/intrinsics/reify-intrinsic.stderr @@ -7,9 +7,9 @@ LL | let _: unsafe extern "rust-intrinsic" fn(isize) -> usize = std::mem::tr | expected due to this | = note: expected fn pointer `unsafe extern "rust-intrinsic" fn(isize) -> usize` - found fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}` + found fn item `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}` -error[E0606]: casting `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}` as `unsafe extern "rust-intrinsic" fn(isize) -> usize` is invalid +error[E0606]: casting `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}` as `unsafe extern "rust-intrinsic" fn(isize) -> usize` is invalid --> $DIR/reify-intrinsic.rs:11:13 | LL | let _ = std::mem::transmute as unsafe extern "rust-intrinsic" fn(isize) -> usize; diff --git a/tests/ui/intrinsics/safe-intrinsic-mismatch.effects.stderr b/tests/ui/intrinsics/safe-intrinsic-mismatch.effects.stderr deleted file mode 100644 index 55983a445a4..00000000000 --- a/tests/ui/intrinsics/safe-intrinsic-mismatch.effects.stderr +++ /dev/null @@ -1,52 +0,0 @@ -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - -error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of` - --> $DIR/safe-intrinsic-mismatch.rs:11:5 - | -LL | fn size_of<T>() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of` - --> $DIR/safe-intrinsic-mismatch.rs:11:5 - | -LL | fn size_of<T>() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `assume` - --> $DIR/safe-intrinsic-mismatch.rs:16:1 - | -LL | const fn assume(_b: bool) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0308]: intrinsic has wrong type - --> $DIR/safe-intrinsic-mismatch.rs:16:16 - | -LL | const fn assume(_b: bool) {} - | ^ expected unsafe fn, found safe fn - | - = note: expected signature `unsafe fn(_)` - found signature `fn(_)` - -error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `const_deallocate` - --> $DIR/safe-intrinsic-mismatch.rs:20:1 - | -LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0308]: intrinsic has wrong type - --> $DIR/safe-intrinsic-mismatch.rs:20:26 - | -LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} - | ^ expected unsafe fn, found safe fn - | - = note: expected signature `unsafe fn(_, _, _)` - found signature `fn(_, _, _)` - -error: aborting due to 7 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/intrinsics/safe-intrinsic-mismatch.rs b/tests/ui/intrinsics/safe-intrinsic-mismatch.rs index af563e996c1..915a23b5905 100644 --- a/tests/ui/intrinsics/safe-intrinsic-mismatch.rs +++ b/tests/ui/intrinsics/safe-intrinsic-mismatch.rs @@ -1,11 +1,5 @@ -//@ revisions: stock effects #![feature(intrinsics)] #![feature(rustc_attrs)] -// as effects insert a const generic param to const intrinsics, -// check here that it doesn't report a const param mismatch either -// enabling or disabling effects. -#![cfg_attr(effects, feature(effects))] -#![allow(incomplete_features)] extern "rust-intrinsic" { fn size_of<T>() -> usize; //~ ERROR intrinsic safety mismatch @@ -24,7 +18,6 @@ const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} mod foo { #[rustc_intrinsic] unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} - // FIXME(effects) ~^ ERROR wrong number of const parameters } fn main() {} diff --git a/tests/ui/intrinsics/safe-intrinsic-mismatch.stock.stderr b/tests/ui/intrinsics/safe-intrinsic-mismatch.stderr index c59e357b275..aa4f294232d 100644 --- a/tests/ui/intrinsics/safe-intrinsic-mismatch.stock.stderr +++ b/tests/ui/intrinsics/safe-intrinsic-mismatch.stderr @@ -1,11 +1,11 @@ error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of` - --> $DIR/safe-intrinsic-mismatch.rs:11:5 + --> $DIR/safe-intrinsic-mismatch.rs:5:5 | LL | fn size_of<T>() -> usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of` - --> $DIR/safe-intrinsic-mismatch.rs:11:5 + --> $DIR/safe-intrinsic-mismatch.rs:5:5 | LL | fn size_of<T>() -> usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,13 +13,13 @@ LL | fn size_of<T>() -> usize; = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `assume` - --> $DIR/safe-intrinsic-mismatch.rs:16:1 + --> $DIR/safe-intrinsic-mismatch.rs:10:1 | LL | const fn assume(_b: bool) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: intrinsic has wrong type - --> $DIR/safe-intrinsic-mismatch.rs:16:16 + --> $DIR/safe-intrinsic-mismatch.rs:10:16 | LL | const fn assume(_b: bool) {} | ^ expected unsafe fn, found safe fn @@ -28,13 +28,13 @@ LL | const fn assume(_b: bool) {} found signature `fn(_)` error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `const_deallocate` - --> $DIR/safe-intrinsic-mismatch.rs:20:1 + --> $DIR/safe-intrinsic-mismatch.rs:14:1 | LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: intrinsic has wrong type - --> $DIR/safe-intrinsic-mismatch.rs:20:26 + --> $DIR/safe-intrinsic-mismatch.rs:14:26 | LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} | ^ expected unsafe fn, found safe fn diff --git a/tests/ui/intrinsics/unchecked_math_unstable.stderr b/tests/ui/intrinsics/unchecked_math_unstable.stderr index c2a116b6200..b284567f8af 100644 --- a/tests/ui/intrinsics/unchecked_math_unstable.stderr +++ b/tests/ui/intrinsics/unchecked_math_unstable.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library +error[E0658]: use of unstable library feature `core_intrinsics`: intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library --> $DIR/unchecked_math_unstable.rs:4:19 | LL | let add = std::intrinsics::unchecked_add(x, y); @@ -7,7 +7,7 @@ LL | let add = std::intrinsics::unchecked_add(x, y); = help: add `#![feature(core_intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library +error[E0658]: use of unstable library feature `core_intrinsics`: intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library --> $DIR/unchecked_math_unstable.rs:5:19 | LL | let sub = std::intrinsics::unchecked_sub(x, y); @@ -16,7 +16,7 @@ LL | let sub = std::intrinsics::unchecked_sub(x, y); = help: add `#![feature(core_intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library +error[E0658]: use of unstable library feature `core_intrinsics`: intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library --> $DIR/unchecked_math_unstable.rs:6:19 | LL | let mul = std::intrinsics::unchecked_mul(x, y); diff --git a/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.BADFLAGS.stderr b/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.BADFLAGS.stderr index d0e8d4719d3..dae08119dbc 100644 --- a/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.BADFLAGS.stderr +++ b/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.BADFLAGS.stderr @@ -1,2 +1,2 @@ -error: incorrect value `leaf` for unstable option `branch-protection` - a `,` separated combination of `bti`, `b-key`, `pac-ret`, or `leaf` was expected +error: incorrect value `leaf` for unstable option `branch-protection` - a `,` separated combination of `bti`, `pac-ret`, followed by a combination of `pc`, `b-key`, or `leaf` was expected diff --git a/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.BADFLAGSPC.stderr b/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.BADFLAGSPC.stderr new file mode 100644 index 00000000000..13f79e94674 --- /dev/null +++ b/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.BADFLAGSPC.stderr @@ -0,0 +1,2 @@ +error: incorrect value `pc` for unstable option `branch-protection` - a `,` separated combination of `bti`, `pac-ret`, followed by a combination of `pc`, `b-key`, or `leaf` was expected + diff --git a/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.rs b/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.rs index c0a4bcac11b..b4025080034 100644 --- a/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.rs +++ b/tests/ui/invalid-compile-flags/branch-protection-missing-pac-ret.rs @@ -1,7 +1,10 @@ -//@ revisions: BADFLAGS BADTARGET +//@ revisions: BADFLAGS BADFLAGSPC BADTARGET //@ [BADFLAGS] compile-flags: --target=aarch64-unknown-linux-gnu -Zbranch-protection=leaf //@ [BADFLAGS] check-fail //@ [BADFLAGS] needs-llvm-components: aarch64 +//@ [BADFLAGSPC] compile-flags: --target=aarch64-unknown-linux-gnu -Zbranch-protection=pc +//@ [BADFLAGSPC] check-fail +//@ [BADFLAGSPC] needs-llvm-components: aarch64 //@ [BADTARGET] compile-flags: --target=x86_64-unknown-linux-gnu -Zbranch-protection=bti //@ [BADTARGET] check-fail //@ [BADTARGET] needs-llvm-components: x86 @@ -10,5 +13,5 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } +#[lang = "sized"] +trait Sized {} diff --git a/tests/ui/invalid-compile-flags/print.stderr b/tests/ui/invalid-compile-flags/print.stderr index 70b4a394dd0..df0c3977dc8 100644 --- a/tests/ui/invalid-compile-flags/print.stderr +++ b/tests/ui/invalid-compile-flags/print.stderr @@ -1,4 +1,4 @@ error: unknown print request: `yyyy` | - = help: valid print requests are: `all-target-specs-json`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `deployment-target`, `file-names`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `tls-models` + = help: valid print requests are: `all-target-specs-json`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `tls-models` diff --git a/tests/ui/issues/issue-21763.stderr b/tests/ui/issues/issue-21763.stderr index aa4938a0c0b..135b705eeef 100644 --- a/tests/ui/issues/issue-21763.stderr +++ b/tests/ui/issues/issue-21763.stderr @@ -4,7 +4,7 @@ error[E0277]: `Rc<()>` cannot be sent between threads safely LL | foo::<HashMap<Rc<()>, Rc<()>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^ `Rc<()>` cannot be sent between threads safely | - = help: within `(Rc<()>, Rc<()>)`, the trait `Send` is not implemented for `Rc<()>`, which is required by `HashMap<Rc<()>, Rc<()>>: Send` + = help: within `(Rc<()>, Rc<()>)`, the trait `Send` is not implemented for `Rc<()>` = note: required because it appears within the type `(Rc<()>, Rc<()>)` = note: required for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` to implement `Send` note: required because it appears within the type `hashbrown::map::HashMap<Rc<()>, Rc<()>, RandomState>` diff --git a/tests/ui/issues/issue-22872.stderr b/tests/ui/issues/issue-22872.stderr index 03e5393da48..6ff710b1133 100644 --- a/tests/ui/issues/issue-22872.stderr +++ b/tests/ui/issues/issue-22872.stderr @@ -4,7 +4,7 @@ error[E0277]: `<P as Process<'_>>::Item` is not an iterator LL | let _: Box<dyn for<'b> Wrap<'b>> = Box::new(Wrapper(process)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `<P as Process<'_>>::Item` is not an iterator | - = help: the trait `Iterator` is not implemented for `<P as Process<'_>>::Item`, which is required by `for<'b> Wrapper<P>: Wrap<'b>` + = help: the trait `Iterator` is not implemented for `<P as Process<'_>>::Item` note: required for `Wrapper<P>` to implement `for<'b> Wrap<'b>` --> $DIR/issue-22872.rs:7:13 | diff --git a/tests/ui/issues/issue-22874.stderr b/tests/ui/issues/issue-22874.stderr index 29ddf9756ff..7d5b601ed49 100644 --- a/tests/ui/issues/issue-22874.stderr +++ b/tests/ui/issues/issue-22874.stderr @@ -13,7 +13,7 @@ error[E0277]: the size for values of type `[String]` cannot be known at compilat LL | &table.rows[0] | ^^^^^^^^^^ doesn't have a size known at compile-time | - = help: the trait `Sized` is not implemented for `[String]`, which is required by `[_]: Index<_>` + = help: the trait `Sized` is not implemented for `[String]` = note: required for `[[String]]` to implement `Index<_>` error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-25901.stderr b/tests/ui/issues/issue-25901.stderr index 3fedfd96417..bcbc805908f 100644 --- a/tests/ui/issues/issue-25901.stderr +++ b/tests/ui/issues/issue-25901.stderr @@ -17,10 +17,6 @@ LL | impl Deref for A { | ^^^^^^^^^^^^^^^^ = note: calls in statics are limited to constant functions, tuple structs and tuple variants = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)` -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-34334.stderr b/tests/ui/issues/issue-34334.stderr index e14629f5f3a..6562ccfdcd2 100644 --- a/tests/ui/issues/issue-34334.stderr +++ b/tests/ui/issues/issue-34334.stderr @@ -18,7 +18,7 @@ LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_rece | ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>` | = help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>` - = help: the trait `FromIterator<(u32, _, _)>` is implemented for `Vec<(u32, _, _)>` + but trait `FromIterator<(u32, _, _)>` is implemented for it = help: for that trait implementation, expected `(u32, _, _)`, found `()` note: the method call chain might not have had the expected associated types --> $DIR/issue-34334.rs:5:43 diff --git a/tests/ui/issues/issue-37534.rs b/tests/ui/issues/issue-37534.rs index 40f7186db09..dff89d3888d 100644 --- a/tests/ui/issues/issue-37534.rs +++ b/tests/ui/issues/issue-37534.rs @@ -1,6 +1,5 @@ struct Foo<T: ?Hash> {} //~^ ERROR expected trait, found derive macro `Hash` -//~^^ ERROR parameter `T` is never used -//~^^^ WARN relaxing a default bound only does something for `?Sized` +//~| WARN relaxing a default bound only does something for `?Sized` fn main() {} diff --git a/tests/ui/issues/issue-37534.stderr b/tests/ui/issues/issue-37534.stderr index a687e733d3d..8747bd5ac6f 100644 --- a/tests/ui/issues/issue-37534.stderr +++ b/tests/ui/issues/issue-37534.stderr @@ -15,15 +15,6 @@ warning: relaxing a default bound only does something for `?Sized`; all other tr LL | struct Foo<T: ?Hash> {} | ^^^^^ -error[E0392]: type parameter `T` is never used - --> $DIR/issue-37534.rs:1:12 - | -LL | struct Foo<T: ?Hash> {} - | ^ unused type parameter - | - = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` - -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 1 previous error; 1 warning emitted -Some errors have detailed explanations: E0392, E0404. -For more information about an error, try `rustc --explain E0392`. +For more information about this error, try `rustc --explain E0404`. diff --git a/tests/ui/issues/issue-40827.stderr b/tests/ui/issues/issue-40827.stderr index 44ae90cbc0f..7f5c578ae4f 100644 --- a/tests/ui/issues/issue-40827.stderr +++ b/tests/ui/issues/issue-40827.stderr @@ -6,7 +6,7 @@ LL | f(Foo(Arc::new(Bar::B(None)))); | | | required by a bound introduced by this call | - = help: within `Bar`, the trait `Sync` is not implemented for `Rc<Foo>`, which is required by `Foo: Send` + = help: within `Bar`, the trait `Sync` is not implemented for `Rc<Foo>` note: required because it appears within the type `Bar` --> $DIR/issue-40827.rs:6:6 | @@ -32,7 +32,7 @@ LL | f(Foo(Arc::new(Bar::B(None)))); | | | required by a bound introduced by this call | - = help: within `Bar`, the trait `Send` is not implemented for `Rc<Foo>`, which is required by `Foo: Send` + = help: within `Bar`, the trait `Send` is not implemented for `Rc<Foo>` note: required because it appears within the type `Bar` --> $DIR/issue-40827.rs:6:6 | diff --git a/tests/ui/issues/issue-45801.stderr b/tests/ui/issues/issue-45801.stderr index 5a10c429564..940c1865fa3 100644 --- a/tests/ui/issues/issue-45801.stderr +++ b/tests/ui/issues/issue-45801.stderr @@ -4,7 +4,8 @@ error[E0277]: the trait bound `Params: Plugin<i32>` is not satisfied LL | req.get_ref::<Params>(); | ^^^^^^^ the trait `Plugin<i32>` is not implemented for `Params` | - = help: the trait `Plugin<Foo>` is implemented for `Params` + = help: the trait `Plugin<i32>` is not implemented for `Params` + but trait `Plugin<Foo>` is implemented for it = help: for that trait implementation, expected `Foo`, found `i32` error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-52489.rs b/tests/ui/issues/issue-52489.rs index 95a3d43105c..c1e1cb41c76 100644 --- a/tests/ui/issues/issue-52489.rs +++ b/tests/ui/issues/issue-52489.rs @@ -3,6 +3,6 @@ //@ compile-flags:--extern issue_52489 use issue_52489; -//~^ ERROR use of unstable library feature 'issue_52489_unstable' +//~^ ERROR use of unstable library feature `issue_52489_unstable` fn main() {} diff --git a/tests/ui/issues/issue-52489.stderr b/tests/ui/issues/issue-52489.stderr index fa88725bceb..8e5b87b7f0f 100644 --- a/tests/ui/issues/issue-52489.stderr +++ b/tests/ui/issues/issue-52489.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'issue_52489_unstable' +error[E0658]: use of unstable library feature `issue_52489_unstable` --> $DIR/issue-52489.rs:5:5 | LL | use issue_52489; diff --git a/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr b/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr index 128288e28f5..d2852093725 100644 --- a/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr +++ b/tests/ui/issues/issue-66923-show-error-for-correct-call.stderr @@ -4,8 +4,8 @@ error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over e LL | let x2: Vec<f64> = x1.into_iter().collect(); | ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>` | - = help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>` - = help: the trait `FromIterator<f64>` is implemented for `Vec<f64>` + = help: the trait `FromIterator<&_>` is not implemented for `Vec<f64>` + but trait `FromIterator<_>` is implemented for it = help: for that trait implementation, expected `f64`, found `&f64` note: the method call chain might not have had the expected associated types --> $DIR/issue-66923-show-error-for-correct-call.rs:8:27 @@ -25,8 +25,8 @@ LL | let x3 = x1.into_iter().collect::<Vec<f64>>(); | | | required by a bound introduced by this call | - = help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>` - = help: the trait `FromIterator<f64>` is implemented for `Vec<f64>` + = help: the trait `FromIterator<&_>` is not implemented for `Vec<f64>` + but trait `FromIterator<_>` is implemented for it = help: for that trait implementation, expected `f64`, found `&f64` note: the method call chain might not have had the expected associated types --> $DIR/issue-66923-show-error-for-correct-call.rs:12:17 diff --git a/tests/ui/issues/issue-7364.stderr b/tests/ui/issues/issue-7364.stderr index d5b6dde1f10..65ec1d75053 100644 --- a/tests/ui/issues/issue-7364.stderr +++ b/tests/ui/issues/issue-7364.stderr @@ -4,7 +4,7 @@ error[E0277]: `RefCell<isize>` cannot be shared between threads safely LL | static boxed: Box<RefCell<isize>> = Box::new(RefCell::new(0)); | ^^^^^^^^^^^^^^^^^^^ `RefCell<isize>` cannot be shared between threads safely | - = help: the trait `Sync` is not implemented for `RefCell<isize>`, which is required by `Box<RefCell<isize>>: Sync` + = help: the trait `Sync` is not implemented for `RefCell<isize>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead = note: required for `Unique<RefCell<isize>>` to implement `Sync` note: required because it appears within the type `Box<RefCell<isize>>` diff --git a/tests/ui/iterators/float_iterator_hint.stderr b/tests/ui/iterators/float_iterator_hint.stderr index 29319b9400f..c3cb00c3c68 100644 --- a/tests/ui/iterators/float_iterator_hint.stderr +++ b/tests/ui/iterators/float_iterator_hint.stderr @@ -4,7 +4,7 @@ error[E0277]: `{float}` is not an iterator LL | for i in 0.2 { | ^^^ `{float}` is not an iterator | - = help: the trait `Iterator` is not implemented for `{float}`, which is required by `{float}: IntoIterator` + = help: the trait `Iterator` is not implemented for `{float}` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `{float}` to implement `IntoIterator` diff --git a/tests/ui/iterators/integral.stderr b/tests/ui/iterators/integral.stderr index 74bbe28d6b7..c142fec8da0 100644 --- a/tests/ui/iterators/integral.stderr +++ b/tests/ui/iterators/integral.stderr @@ -4,7 +4,7 @@ error[E0277]: `{integer}` is not an iterator LL | for _ in 42 {} | ^^ `{integer}` is not an iterator | - = help: the trait `Iterator` is not implemented for `{integer}`, which is required by `{integer}: IntoIterator` + = help: the trait `Iterator` is not implemented for `{integer}` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `{integer}` to implement `IntoIterator` @@ -14,7 +14,7 @@ error[E0277]: `u8` is not an iterator LL | for _ in 42 as u8 {} | ^^^^^^^^ `u8` is not an iterator | - = help: the trait `Iterator` is not implemented for `u8`, which is required by `u8: IntoIterator` + = help: the trait `Iterator` is not implemented for `u8` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `u8` to implement `IntoIterator` @@ -24,7 +24,7 @@ error[E0277]: `i8` is not an iterator LL | for _ in 42 as i8 {} | ^^^^^^^^ `i8` is not an iterator | - = help: the trait `Iterator` is not implemented for `i8`, which is required by `i8: IntoIterator` + = help: the trait `Iterator` is not implemented for `i8` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `i8` to implement `IntoIterator` @@ -34,7 +34,7 @@ error[E0277]: `u16` is not an iterator LL | for _ in 42 as u16 {} | ^^^^^^^^^ `u16` is not an iterator | - = help: the trait `Iterator` is not implemented for `u16`, which is required by `u16: IntoIterator` + = help: the trait `Iterator` is not implemented for `u16` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `u16` to implement `IntoIterator` @@ -44,7 +44,7 @@ error[E0277]: `i16` is not an iterator LL | for _ in 42 as i16 {} | ^^^^^^^^^ `i16` is not an iterator | - = help: the trait `Iterator` is not implemented for `i16`, which is required by `i16: IntoIterator` + = help: the trait `Iterator` is not implemented for `i16` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `i16` to implement `IntoIterator` @@ -54,7 +54,7 @@ error[E0277]: `u32` is not an iterator LL | for _ in 42 as u32 {} | ^^^^^^^^^ `u32` is not an iterator | - = help: the trait `Iterator` is not implemented for `u32`, which is required by `u32: IntoIterator` + = help: the trait `Iterator` is not implemented for `u32` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `u32` to implement `IntoIterator` @@ -64,7 +64,7 @@ error[E0277]: `i32` is not an iterator LL | for _ in 42 as i32 {} | ^^^^^^^^^ `i32` is not an iterator | - = help: the trait `Iterator` is not implemented for `i32`, which is required by `i32: IntoIterator` + = help: the trait `Iterator` is not implemented for `i32` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `i32` to implement `IntoIterator` @@ -74,7 +74,7 @@ error[E0277]: `u64` is not an iterator LL | for _ in 42 as u64 {} | ^^^^^^^^^ `u64` is not an iterator | - = help: the trait `Iterator` is not implemented for `u64`, which is required by `u64: IntoIterator` + = help: the trait `Iterator` is not implemented for `u64` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `u64` to implement `IntoIterator` @@ -84,7 +84,7 @@ error[E0277]: `i64` is not an iterator LL | for _ in 42 as i64 {} | ^^^^^^^^^ `i64` is not an iterator | - = help: the trait `Iterator` is not implemented for `i64`, which is required by `i64: IntoIterator` + = help: the trait `Iterator` is not implemented for `i64` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `i64` to implement `IntoIterator` @@ -94,7 +94,7 @@ error[E0277]: `usize` is not an iterator LL | for _ in 42 as usize {} | ^^^^^^^^^^^ `usize` is not an iterator | - = help: the trait `Iterator` is not implemented for `usize`, which is required by `usize: IntoIterator` + = help: the trait `Iterator` is not implemented for `usize` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `usize` to implement `IntoIterator` @@ -104,7 +104,7 @@ error[E0277]: `isize` is not an iterator LL | for _ in 42 as isize {} | ^^^^^^^^^^^ `isize` is not an iterator | - = help: the trait `Iterator` is not implemented for `isize`, which is required by `isize: IntoIterator` + = help: the trait `Iterator` is not implemented for `isize` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `isize` to implement `IntoIterator` @@ -114,7 +114,7 @@ error[E0277]: `{float}` is not an iterator LL | for _ in 42.0 {} | ^^^^ `{float}` is not an iterator | - = help: the trait `Iterator` is not implemented for `{float}`, which is required by `{float}: IntoIterator` + = help: the trait `Iterator` is not implemented for `{float}` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = note: required for `{float}` to implement `IntoIterator` diff --git a/tests/ui/iterators/invalid-iterator-chain-fixable.stderr b/tests/ui/iterators/invalid-iterator-chain-fixable.stderr index 3d3bbab8819..09439fe8fbd 100644 --- a/tests/ui/iterators/invalid-iterator-chain-fixable.stderr +++ b/tests/ui/iterators/invalid-iterator-chain-fixable.stderr @@ -6,8 +6,8 @@ LL | let i = i.map(|x| x.clone()); LL | i.collect() | ^^^^^^^ value of type `Vec<X>` cannot be built from `std::iter::Iterator<Item=&X>` | - = help: the trait `FromIterator<&X>` is not implemented for `Vec<X>` - = help: the trait `FromIterator<X>` is implemented for `Vec<X>` + = help: the trait `FromIterator<&_>` is not implemented for `Vec<X>` + but trait `FromIterator<_>` is implemented for it = help: for that trait implementation, expected `X`, found `&X` note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain-fixable.rs:5:26 @@ -124,7 +124,7 @@ LL | let g: Vec<i32> = f.collect(); | ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>` | = help: the trait `FromIterator<()>` is not implemented for `Vec<i32>` - = help: the trait `FromIterator<i32>` is implemented for `Vec<i32>` + but trait `FromIterator<i32>` is implemented for it = help: for that trait implementation, expected `i32`, found `()` note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain-fixable.rs:32:15 diff --git a/tests/ui/iterators/invalid-iterator-chain.stderr b/tests/ui/iterators/invalid-iterator-chain.stderr index bc35fcd489d..b810e06d0f7 100644 --- a/tests/ui/iterators/invalid-iterator-chain.stderr +++ b/tests/ui/iterators/invalid-iterator-chain.stderr @@ -6,8 +6,8 @@ LL | let i = i.map(|x| x.clone()); LL | i.collect() | ^^^^^^^ value of type `Vec<X>` cannot be built from `std::iter::Iterator<Item=&X>` | - = help: the trait `FromIterator<&X>` is not implemented for `Vec<X>` - = help: the trait `FromIterator<X>` is implemented for `Vec<X>` + = help: the trait `FromIterator<&_>` is not implemented for `Vec<X>` + but trait `FromIterator<_>` is implemented for it = help: for that trait implementation, expected `X`, found `&X` note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain.rs:4:26 @@ -181,7 +181,7 @@ LL | let g: Vec<i32> = f.collect(); | ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>` | = help: the trait `FromIterator<()>` is not implemented for `Vec<i32>` - = help: the trait `FromIterator<i32>` is implemented for `Vec<i32>` + but trait `FromIterator<i32>` is implemented for it = help: for that trait implementation, expected `i32`, found `()` note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain.rs:44:15 diff --git a/tests/ui/iterators/issue-28098.stderr b/tests/ui/iterators/issue-28098.stderr index 3cb1b2f7270..a724f03ad4a 100644 --- a/tests/ui/iterators/issue-28098.stderr +++ b/tests/ui/iterators/issue-28098.stderr @@ -14,7 +14,7 @@ error[E0277]: `bool` is not an iterator LL | for _ in false {} | ^^^^^ `bool` is not an iterator | - = help: the trait `Iterator` is not implemented for `bool`, which is required by `bool: IntoIterator` + = help: the trait `Iterator` is not implemented for `bool` = note: required for `bool` to implement `IntoIterator` error[E0277]: `()` is not an iterator @@ -61,7 +61,7 @@ error[E0277]: `bool` is not an iterator LL | for _ in false {} | ^^^^^ `bool` is not an iterator | - = help: the trait `Iterator` is not implemented for `bool`, which is required by `bool: IntoIterator` + = help: the trait `Iterator` is not implemented for `bool` = note: required for `bool` to implement `IntoIterator` error[E0277]: `()` is not an iterator diff --git a/tests/ui/iterators/iterator-does-not-need-into-iter.rs b/tests/ui/iterators/iterator-does-not-need-into-iter.rs new file mode 100644 index 00000000000..29196449e30 --- /dev/null +++ b/tests/ui/iterators/iterator-does-not-need-into-iter.rs @@ -0,0 +1,18 @@ +//! regression test for #127511: don't suggest `.into_iter()` on iterators + +trait Missing {} +trait HasMethod { + fn foo(self); +} +impl<T: Iterator + Missing> HasMethod for T { + fn foo(self) {} +} + +fn get_iter() -> impl Iterator { + core::iter::once(()) +} + +fn main() { + get_iter().foo(); + //~^ ERROR the method `foo` exists for opaque type `impl Iterator`, but its trait bounds were not satisfied [E0599] +} diff --git a/tests/ui/iterators/iterator-does-not-need-into-iter.stderr b/tests/ui/iterators/iterator-does-not-need-into-iter.stderr new file mode 100644 index 00000000000..3d3861e959f --- /dev/null +++ b/tests/ui/iterators/iterator-does-not-need-into-iter.stderr @@ -0,0 +1,28 @@ +error[E0599]: the method `foo` exists for opaque type `impl Iterator`, but its trait bounds were not satisfied + --> $DIR/iterator-does-not-need-into-iter.rs:16:16 + | +LL | get_iter().foo(); + | ^^^ method cannot be called on `impl Iterator` due to unsatisfied trait bounds + | +note: the following trait bounds were not satisfied: + `&impl Iterator: Iterator` + `&impl Iterator: Missing` + `&mut impl Iterator: Missing` + `impl Iterator: Missing` + --> $DIR/iterator-does-not-need-into-iter.rs:7:9 + | +LL | impl<T: Iterator + Missing> HasMethod for T { + | ^^^^^^^^ ^^^^^^^ --------- - + | | | + | | unsatisfied trait bound introduced here + | unsatisfied trait bound introduced here + = help: items from traits can only be used if the trait is implemented and in scope +note: `HasMethod` defines an item `foo`, perhaps you need to implement it + --> $DIR/iterator-does-not-need-into-iter.rs:4:1 + | +LL | trait HasMethod { + | ^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/iterators/ranges.stderr b/tests/ui/iterators/ranges.stderr index a5d43ecbb63..b9fbcd5304b 100644 --- a/tests/ui/iterators/ranges.stderr +++ b/tests/ui/iterators/ranges.stderr @@ -4,7 +4,7 @@ error[E0277]: `RangeTo<{integer}>` is not an iterator LL | for _ in ..10 {} | ^^^^ if you meant to iterate until a value, add a starting value | - = help: the trait `Iterator` is not implemented for `RangeTo<{integer}>`, which is required by `RangeTo<{integer}>: IntoIterator` + = help: the trait `Iterator` is not implemented for `RangeTo<{integer}>` = note: `..end` is a `RangeTo`, which cannot be iterated on; you might have meant to have a bounded `Range`: `0..end` = note: required for `RangeTo<{integer}>` to implement `IntoIterator` @@ -14,7 +14,7 @@ error[E0277]: `RangeToInclusive<{integer}>` is not an iterator LL | for _ in ..=10 {} | ^^^^^ if you meant to iterate until a value (including it), add a starting value | - = help: the trait `Iterator` is not implemented for `RangeToInclusive<{integer}>`, which is required by `RangeToInclusive<{integer}>: IntoIterator` + = help: the trait `Iterator` is not implemented for `RangeToInclusive<{integer}>` = note: `..=end` is a `RangeToInclusive`, which cannot be iterated on; you might have meant to have a bounded `RangeInclusive`: `0..=end` = note: required for `RangeToInclusive<{integer}>` to implement `IntoIterator` diff --git a/tests/ui/iterators/string.stderr b/tests/ui/iterators/string.stderr index 29f560677c0..ddfe0169b84 100644 --- a/tests/ui/iterators/string.stderr +++ b/tests/ui/iterators/string.stderr @@ -4,7 +4,7 @@ error[E0277]: `String` is not an iterator LL | for _ in "".to_owned() {} | ^^^^^^^^^^^^^ `String` is not an iterator; try calling `.chars()` or `.bytes()` | - = help: the trait `Iterator` is not implemented for `String`, which is required by `String: IntoIterator` + = help: the trait `Iterator` is not implemented for `String` = note: required for `String` to implement `IntoIterator` error[E0277]: `&str` is not an iterator @@ -13,7 +13,7 @@ error[E0277]: `&str` is not an iterator LL | for _ in "" {} | ^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()` | - = help: the trait `Iterator` is not implemented for `&str`, which is required by `&str: IntoIterator` + = help: the trait `Iterator` is not implemented for `&str` = note: required for `&str` to implement `IntoIterator` error: aborting due to 2 previous errors diff --git a/tests/ui/json/json-bom-plus-crlf-multifile.rs b/tests/ui/json/json-bom-plus-crlf-multifile.rs index ae608770aae..79c4b2430e1 100644 --- a/tests/ui/json/json-bom-plus-crlf-multifile.rs +++ b/tests/ui/json/json-bom-plus-crlf-multifile.rs @@ -1,6 +1,8 @@ // (This line has BOM so it's ignored by compiletest for directives) // //@ compile-flags: --json=diagnostic-short --error-format=json +//@ reference: input.byte-order-mark +//@ reference: input.crlf // ignore-tidy-cr #[path = "json-bom-plus-crlf-multifile-aux.rs"] diff --git a/tests/ui/json/json-bom-plus-crlf.rs b/tests/ui/json/json-bom-plus-crlf.rs index 4a309128199..9e250c256eb 100644 --- a/tests/ui/json/json-bom-plus-crlf.rs +++ b/tests/ui/json/json-bom-plus-crlf.rs @@ -1,6 +1,8 @@ // (This line has BOM so it's ignored by compiletest for directives) // //@ compile-flags: --json=diagnostic-short --error-format=json +//@ reference: input.byte-order-mark +//@ reference: input.crlf // ignore-tidy-cr // For easier verifying, the byte offsets in this file should match those diff --git a/tests/ui/json/json-bom-plus-crlf.stderr b/tests/ui/json/json-bom-plus-crlf.stderr index cd1e3665b3e..fee70431bdf 100644 --- a/tests/ui/json/json-bom-plus-crlf.stderr +++ b/tests/ui/json/json-bom-plus-crlf.stderr @@ -24,7 +24,7 @@ This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":607,"byte_end":608,"line_start":16,"line_end":16,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":598,"byte_end":604,"line_start":16,"line_end":16,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":608,"byte_end":608,"line_start":16,"line_end":16,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:16:22: error[E0308]: mismatched types: expected `String`, found integer +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":672,"byte_end":673,"line_start":18,"line_end":18,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":663,"byte_end":669,"line_start":18,"line_end":18,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":673,"byte_end":673,"line_start":18,"line_end":18,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1; // Error in the middle of line.","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:18:22: error[E0308]: mismatched types: expected `String`, found integer "} {"$message_type":"diagnostic","message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. @@ -52,7 +52,7 @@ This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":667,"byte_end":668,"line_start":18,"line_end":18,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":658,"byte_end":664,"line_start":18,"line_end":18,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":668,"byte_end":668,"line_start":18,"line_end":18,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:18:22: error[E0308]: mismatched types: expected `String`, found integer +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":732,"byte_end":733,"line_start":20,"line_end":20,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":723,"byte_end":729,"line_start":20,"line_end":20,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":733,"byte_end":733,"line_start":20,"line_end":20,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:20:22: error[E0308]: mismatched types: expected `String`, found integer "} {"$message_type":"diagnostic","message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. @@ -80,7 +80,7 @@ This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":731,"byte_end":732,"line_start":22,"line_end":22,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":721,"byte_end":727,"line_start":21,"line_end":21,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":732,"byte_end":732,"line_start":22,"line_end":22,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:22:1: error[E0308]: mismatched types: expected `String`, found integer +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":796,"byte_end":797,"line_start":24,"line_end":24,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":786,"byte_end":792,"line_start":23,"line_end":23,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":797,"byte_end":797,"line_start":24,"line_end":24,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:24:1: error[E0308]: mismatched types: expected `String`, found integer "} {"$message_type":"diagnostic","message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type. @@ -108,7 +108,7 @@ This error occurs when an expression was used in a place where the compiler expected an expression of a different type. It can occur in several cases, the most common being when calling a function and passing an argument which has a different type than the matching type in the function declaration. -"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":787,"byte_end":795,"line_start":24,"line_end":25,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":778,"byte_end":784,"line_start":24,"line_end":24,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf.rs:24:22: error[E0308]: mismatched types: expected `String`, found `()` +"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":852,"byte_end":860,"line_start":26,"line_end":27,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":843,"byte_end":849,"line_start":26,"line_end":26,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf.rs:26:22: error[E0308]: mismatched types: expected `String`, found `()` "} {"$message_type":"diagnostic","message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors "} diff --git a/tests/ui/kindck/kindck-impl-type-params-2.stderr b/tests/ui/kindck/kindck-impl-type-params-2.stderr index a7d169d3ac4..38dc94f9104 100644 --- a/tests/ui/kindck/kindck-impl-type-params-2.stderr +++ b/tests/ui/kindck/kindck-impl-type-params-2.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied --> $DIR/kindck-impl-type-params-2.rs:13:16 | LL | take_param(&x); - | ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>`, which is required by `Box<{integer}>: Foo` + | ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>` | | | required by a bound introduced by this call | diff --git a/tests/ui/kindck/kindck-impl-type-params.stderr b/tests/ui/kindck/kindck-impl-type-params.stderr index 5892596dc6a..da9a8e5532c 100644 --- a/tests/ui/kindck/kindck-impl-type-params.stderr +++ b/tests/ui/kindck/kindck-impl-type-params.stderr @@ -21,7 +21,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:16:13 | LL | let a = &t as &dyn Gettable<T>; - | ^^ the trait `Copy` is not implemented for `T`, which is required by `S<T>: Gettable<T>` + | ^^ the trait `Copy` is not implemented for `T` | note: required for `S<T>` to implement `Gettable<T>` --> $DIR/kindck-impl-type-params.rs:12:32 @@ -59,7 +59,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:23:31 | LL | let a: &dyn Gettable<T> = &t; - | ^^ the trait `Copy` is not implemented for `T`, which is required by `S<T>: Gettable<T>` + | ^^ the trait `Copy` is not implemented for `T` | note: required for `S<T>` to implement `Gettable<T>` --> $DIR/kindck-impl-type-params.rs:12:32 @@ -78,7 +78,7 @@ error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:36:13 | LL | let a = t as Box<dyn Gettable<String>>; - | ^ the trait `Copy` is not implemented for `String`, which is required by `S<String>: Gettable<String>` + | ^ the trait `Copy` is not implemented for `String` | = help: the trait `Gettable<T>` is implemented for `S<T>` note: required for `S<String>` to implement `Gettable<String>` @@ -94,7 +94,7 @@ error[E0277]: the trait bound `Foo: Copy` is not satisfied --> $DIR/kindck-impl-type-params.rs:44:37 | LL | let a: Box<dyn Gettable<Foo>> = t; - | ^ the trait `Copy` is not implemented for `Foo`, which is required by `S<Foo>: Gettable<Foo>` + | ^ the trait `Copy` is not implemented for `Foo` | = help: the trait `Gettable<T>` is implemented for `S<T>` note: required for `S<Foo>` to implement `Gettable<Foo>` diff --git a/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr b/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr index e797ca01f4b..c392879db3e 100644 --- a/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr +++ b/tests/ui/kindck/kindck-inherited-copy-bound.curr.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied --> $DIR/kindck-inherited-copy-bound.rs:21:16 | LL | take_param(&x); - | ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>`, which is required by `Box<{integer}>: Foo` + | ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>` | | | required by a bound introduced by this call | diff --git a/tests/ui/kindck/kindck-inherited-copy-bound.dyn_compatible_for_dispatch.stderr b/tests/ui/kindck/kindck-inherited-copy-bound.dyn_compatible_for_dispatch.stderr index b4424f4750e..34dcad13af3 100644 --- a/tests/ui/kindck/kindck-inherited-copy-bound.dyn_compatible_for_dispatch.stderr +++ b/tests/ui/kindck/kindck-inherited-copy-bound.dyn_compatible_for_dispatch.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied --> $DIR/kindck-inherited-copy-bound.rs:21:16 | LL | take_param(&x); - | ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>`, which is required by `Box<{integer}>: Foo` + | ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>` | | | required by a bound introduced by this call | diff --git a/tests/ui/kindck/kindck-nonsendable-1.stderr b/tests/ui/kindck/kindck-nonsendable-1.stderr index 8cc931bc48e..8bb784d1d49 100644 --- a/tests/ui/kindck/kindck-nonsendable-1.stderr +++ b/tests/ui/kindck/kindck-nonsendable-1.stderr @@ -8,7 +8,7 @@ LL | bar(move|| foo(x)); | | within this `{closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15}` | required by a bound introduced by this call | - = help: within `{closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15}`, the trait `Send` is not implemented for `Rc<usize>`, which is required by `{closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15}: Send` + = help: within `{closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15}`, the trait `Send` is not implemented for `Rc<usize>` note: required because it's used within this closure --> $DIR/kindck-nonsendable-1.rs:9:9 | diff --git a/tests/ui/kindck/kindck-send-object.stderr b/tests/ui/kindck/kindck-send-object.stderr index 7d0c711abc4..0e2ff1730c8 100644 --- a/tests/ui/kindck/kindck-send-object.stderr +++ b/tests/ui/kindck/kindck-send-object.stderr @@ -4,7 +4,7 @@ error[E0277]: `&'static (dyn Dummy + 'static)` cannot be sent between threads sa LL | assert_send::<&'static (dyn Dummy + 'static)>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'static (dyn Dummy + 'static)` cannot be sent between threads safely | - = help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)`, which is required by `&'static (dyn Dummy + 'static): Send` + = help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)` = note: required for `&'static (dyn Dummy + 'static)` to implement `Send` note: required by a bound in `assert_send` --> $DIR/kindck-send-object.rs:5:18 @@ -18,7 +18,7 @@ error[E0277]: `dyn Dummy` cannot be sent between threads safely LL | assert_send::<Box<dyn Dummy>>(); | ^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | - = help: the trait `Send` is not implemented for `dyn Dummy`, which is required by `Box<dyn Dummy>: Send` + = help: the trait `Send` is not implemented for `dyn Dummy` = note: required for `Unique<dyn Dummy>` to implement `Send` note: required because it appears within the type `Box<dyn Dummy>` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL diff --git a/tests/ui/kindck/kindck-send-object1.stderr b/tests/ui/kindck/kindck-send-object1.stderr index 7f39dab2086..e3ff2eb9ff4 100644 --- a/tests/ui/kindck/kindck-send-object1.stderr +++ b/tests/ui/kindck/kindck-send-object1.stderr @@ -4,7 +4,7 @@ error[E0277]: `&'a (dyn Dummy + 'a)` cannot be sent between threads safely LL | assert_send::<&'a dyn Dummy>(); | ^^^^^^^^^^^^^ `&'a (dyn Dummy + 'a)` cannot be sent between threads safely | - = help: the trait `Sync` is not implemented for `(dyn Dummy + 'a)`, which is required by `&'a (dyn Dummy + 'a): Send` + = help: the trait `Sync` is not implemented for `(dyn Dummy + 'a)` = note: required for `&'a (dyn Dummy + 'a)` to implement `Send` note: required by a bound in `assert_send` --> $DIR/kindck-send-object1.rs:5:18 @@ -18,7 +18,7 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely LL | assert_send::<Box<dyn Dummy + 'a>>(); | ^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely | - = help: the trait `Send` is not implemented for `(dyn Dummy + 'a)`, which is required by `Box<(dyn Dummy + 'a)>: Send` + = help: the trait `Send` is not implemented for `(dyn Dummy + 'a)` = note: required for `Unique<(dyn Dummy + 'a)>` to implement `Send` note: required because it appears within the type `Box<(dyn Dummy + 'a)>` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL diff --git a/tests/ui/kindck/kindck-send-object2.stderr b/tests/ui/kindck/kindck-send-object2.stderr index a481a132cce..8898bf5b3fa 100644 --- a/tests/ui/kindck/kindck-send-object2.stderr +++ b/tests/ui/kindck/kindck-send-object2.stderr @@ -4,7 +4,7 @@ error[E0277]: `&'static (dyn Dummy + 'static)` cannot be sent between threads sa LL | assert_send::<&'static dyn Dummy>(); | ^^^^^^^^^^^^^^^^^^ `&'static (dyn Dummy + 'static)` cannot be sent between threads safely | - = help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)`, which is required by `&'static (dyn Dummy + 'static): Send` + = help: the trait `Sync` is not implemented for `(dyn Dummy + 'static)` = note: required for `&'static (dyn Dummy + 'static)` to implement `Send` note: required by a bound in `assert_send` --> $DIR/kindck-send-object2.rs:3:18 @@ -18,7 +18,7 @@ error[E0277]: `dyn Dummy` cannot be sent between threads safely LL | assert_send::<Box<dyn Dummy>>(); | ^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | - = help: the trait `Send` is not implemented for `dyn Dummy`, which is required by `Box<dyn Dummy>: Send` + = help: the trait `Send` is not implemented for `dyn Dummy` = note: required for `Unique<dyn Dummy>` to implement `Send` note: required because it appears within the type `Box<dyn Dummy>` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL diff --git a/tests/ui/kindck/kindck-send-owned.stderr b/tests/ui/kindck/kindck-send-owned.stderr index 4bc0212089b..860a9391bbb 100644 --- a/tests/ui/kindck/kindck-send-owned.stderr +++ b/tests/ui/kindck/kindck-send-owned.stderr @@ -4,7 +4,7 @@ error[E0277]: `*mut u8` cannot be sent between threads safely LL | assert_send::<Box<*mut u8>>(); | ^^^^^^^^^^^^ `*mut u8` cannot be sent between threads safely | - = help: the trait `Send` is not implemented for `*mut u8`, which is required by `Box<*mut u8>: Send` + = help: the trait `Send` is not implemented for `*mut u8` = note: required for `Unique<*mut u8>` to implement `Send` note: required because it appears within the type `Box<*mut u8>` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr index c9715a8e146..bd31665dac1 100644 --- a/tests/ui/layout/debug.stderr +++ b/tests/ui/layout/debug.stderr @@ -10,7 +10,7 @@ error: layout_of(E) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -48,7 +48,7 @@ error: layout_of(E) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -150,7 +150,7 @@ error: layout_of(U) = Layout { abi: Align(4 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Union( @@ -337,7 +337,7 @@ error: layout_of(V) = Layout { abi: Align(2 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Union( @@ -361,7 +361,7 @@ error: layout_of(W) = Layout { abi: Align(2 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Union( @@ -385,7 +385,7 @@ error: layout_of(Y) = Layout { abi: Align(2 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Union( @@ -409,7 +409,7 @@ error: layout_of(P1) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Union( @@ -433,7 +433,7 @@ error: layout_of(P2) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Union( @@ -457,7 +457,7 @@ error: layout_of(P3) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Union( @@ -481,7 +481,7 @@ error: layout_of(P4) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Union( diff --git a/tests/ui/layout/enum-scalar-pair-int-ptr.rs b/tests/ui/layout/enum-scalar-pair-int-ptr.rs index 885cc3e37df..ebb3fdb1514 100644 --- a/tests/ui/layout/enum-scalar-pair-int-ptr.rs +++ b/tests/ui/layout/enum-scalar-pair-int-ptr.rs @@ -18,7 +18,7 @@ enum ScalarPairPointerWithInt { //~ERROR: abi: ScalarPair // of a different size. (Assumes that no target has 8 bit pointers, which // feels pretty safe.) #[rustc_layout(abi)] -enum NotScalarPairPointerWithSmallerInt { //~ERROR: abi: Aggregate +enum NotScalarPairPointerWithSmallerInt { //~ERROR: abi: Memory A(u8), B(Box<()>), } diff --git a/tests/ui/layout/enum-scalar-pair-int-ptr.stderr b/tests/ui/layout/enum-scalar-pair-int-ptr.stderr index b25eda628cd..357c8182ebd 100644 --- a/tests/ui/layout/enum-scalar-pair-int-ptr.stderr +++ b/tests/ui/layout/enum-scalar-pair-int-ptr.stderr @@ -4,7 +4,7 @@ error: abi: ScalarPair(Initialized { value: Int(I?, false), valid_range: $VALID_ LL | enum ScalarPairPointerWithInt { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: abi: Aggregate { sized: true } +error: abi: Memory { sized: true } --> $DIR/enum-scalar-pair-int-ptr.rs:21:1 | LL | enum NotScalarPairPointerWithSmallerInt { diff --git a/tests/ui/layout/hexagon-enum.stderr b/tests/ui/layout/hexagon-enum.stderr index a2ad4a1ab58..59fe667923f 100644 --- a/tests/ui/layout/hexagon-enum.stderr +++ b/tests/ui/layout/hexagon-enum.stderr @@ -48,7 +48,7 @@ error: layout_of(A) = Layout { abi: Align(1 bytes), pref: Align(1 bytes), }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -122,7 +122,7 @@ error: layout_of(B) = Layout { abi: Align(1 bytes), pref: Align(1 bytes), }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -196,7 +196,7 @@ error: layout_of(C) = Layout { abi: Align(2 bytes), pref: Align(2 bytes), }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -270,7 +270,7 @@ error: layout_of(P) = Layout { abi: Align(4 bytes), pref: Align(4 bytes), }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -344,7 +344,7 @@ error: layout_of(T) = Layout { abi: Align(4 bytes), pref: Align(4 bytes), }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr index d3ba1a295b1..ca041fb539b 100644 --- a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr +++ b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr @@ -90,7 +90,7 @@ error: layout_of(MissingPayloadField) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -489,7 +489,7 @@ error: layout_of(NicheFirst) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -509,7 +509,7 @@ error: layout_of(NicheFirst) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -641,7 +641,7 @@ error: layout_of(NicheSecond) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -661,7 +661,7 @@ error: layout_of(NicheSecond) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/layout/issue-96185-overaligned-enum.stderr b/tests/ui/layout/issue-96185-overaligned-enum.stderr index c539eb453d9..bc40a2aa482 100644 --- a/tests/ui/layout/issue-96185-overaligned-enum.stderr +++ b/tests/ui/layout/issue-96185-overaligned-enum.stderr @@ -4,7 +4,7 @@ error: layout_of(Aligned1) = Layout { abi: Align(8 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -42,7 +42,7 @@ error: layout_of(Aligned1) = Layout { abi: Align(8 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -64,7 +64,7 @@ error: layout_of(Aligned1) = Layout { abi: Align(8 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -142,7 +142,7 @@ error: layout_of(Aligned2) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -164,7 +164,7 @@ error: layout_of(Aligned2) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/layout/post-mono-layout-cycle-2.rs b/tests/ui/layout/post-mono-layout-cycle-2.rs index 356f1e777c7..e9a5292fbbd 100644 --- a/tests/ui/layout/post-mono-layout-cycle-2.rs +++ b/tests/ui/layout/post-mono-layout-cycle-2.rs @@ -45,7 +45,6 @@ where T: Blah, { async fn ice(&mut self) { - //~^ ERROR a cycle occurred during layout computation let arr: [(); 0] = []; self.t.iter(arr.into_iter()).await; } diff --git a/tests/ui/layout/post-mono-layout-cycle-2.stderr b/tests/ui/layout/post-mono-layout-cycle-2.stderr index ad01c2694fa..2e8d237844e 100644 --- a/tests/ui/layout/post-mono-layout-cycle-2.stderr +++ b/tests/ui/layout/post-mono-layout-cycle-2.stderr @@ -12,12 +12,12 @@ LL | Blah::iter(self, iterator).await | = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future -error: a cycle occurred during layout computation - --> $DIR/post-mono-layout-cycle-2.rs:47:5 +note: the above error was encountered while instantiating `fn Wrap::<()>::ice` + --> $DIR/post-mono-layout-cycle-2.rs:56:9 | -LL | async fn ice(&mut self) { - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | t.ice(); + | ^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0733`. diff --git a/tests/ui/layout/post-mono-layout-cycle.rs b/tests/ui/layout/post-mono-layout-cycle.rs index 8d136190c00..6753c01267e 100644 --- a/tests/ui/layout/post-mono-layout-cycle.rs +++ b/tests/ui/layout/post-mono-layout-cycle.rs @@ -14,7 +14,6 @@ struct Wrapper<T: Trait> { } fn abi<T: Trait>(_: Option<Wrapper<T>>) {} -//~^ ERROR a cycle occurred during layout computation fn indirect<T: Trait>() { abi::<T>(None); diff --git a/tests/ui/layout/post-mono-layout-cycle.stderr b/tests/ui/layout/post-mono-layout-cycle.stderr index 47f7f30b1cb..7f246b3d409 100644 --- a/tests/ui/layout/post-mono-layout-cycle.stderr +++ b/tests/ui/layout/post-mono-layout-cycle.stderr @@ -5,12 +5,12 @@ error[E0391]: cycle detected when computing layout of `Wrapper<()>` = note: cycle used when computing layout of `core::option::Option<Wrapper<()>>` = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: a cycle occurred during layout computation - --> $DIR/post-mono-layout-cycle.rs:16:1 +note: the above error was encountered while instantiating `fn abi::<()>` + --> $DIR/post-mono-layout-cycle.rs:19:5 | -LL | fn abi<T: Trait>(_: Option<Wrapper<T>>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | abi::<T>(None); + | ^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr b/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr index cceaddf7803..206a6801065 100644 --- a/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr +++ b/tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.stderr @@ -71,6 +71,10 @@ LL | cachedcoso.call_once(1); | note: required by a bound in `call_once` --> $SRC_DIR/core/src/ops/function.rs:LL:COL +help: use a unary tuple instead + | +LL | cachedcoso.call_once((1,)); + | + ++ error: aborting due to 6 previous errors diff --git a/tests/ui/layout/struct.rs b/tests/ui/layout/struct.rs index d072d123b0d..309624e667c 100644 --- a/tests/ui/layout/struct.rs +++ b/tests/ui/layout/struct.rs @@ -6,7 +6,7 @@ #![crate_type = "lib"] #[rustc_layout(abi)] -struct AlignedZstPreventsScalar(i16, [i32; 0]); //~ERROR: abi: Aggregate +struct AlignedZstPreventsScalar(i16, [i32; 0]); //~ERROR: abi: Memory #[rustc_layout(abi)] struct AlignedZstButStillScalar(i32, [i16; 0]); //~ERROR: abi: Scalar diff --git a/tests/ui/layout/struct.stderr b/tests/ui/layout/struct.stderr index b61c9a99cce..7bc9af61ed4 100644 --- a/tests/ui/layout/struct.stderr +++ b/tests/ui/layout/struct.stderr @@ -1,4 +1,4 @@ -error: abi: Aggregate { sized: true } +error: abi: Memory { sized: true } --> $DIR/struct.rs:9:1 | LL | struct AlignedZstPreventsScalar(i16, [i32; 0]); diff --git a/tests/ui/layout/thaw-transmute-invalid-enum.rs b/tests/ui/layout/thaw-transmute-invalid-enum.rs index 835dcc04996..a7c2e1a86de 100644 --- a/tests/ui/layout/thaw-transmute-invalid-enum.rs +++ b/tests/ui/layout/thaw-transmute-invalid-enum.rs @@ -2,13 +2,13 @@ mod assert { use std::mem::{Assume, TransmuteFrom}; - //~^ ERROR: use of unstable library feature 'transmutability' - //~| ERROR: use of unstable library feature 'transmutability' + //~^ ERROR: use of unstable library feature `transmutability` + //~| ERROR: use of unstable library feature `transmutability` pub fn is_transmutable<Src, Dst>() where Dst: TransmuteFrom<Src>, - //~^ ERROR: use of unstable library feature 'transmutability' + //~^ ERROR: use of unstable library feature `transmutability` { } } diff --git a/tests/ui/layout/thaw-transmute-invalid-enum.stderr b/tests/ui/layout/thaw-transmute-invalid-enum.stderr index e6a5399c66b..d12fc4694e0 100644 --- a/tests/ui/layout/thaw-transmute-invalid-enum.stderr +++ b/tests/ui/layout/thaw-transmute-invalid-enum.stderr @@ -20,7 +20,7 @@ LL | | V = 0xFF, LL | | } | |_- not a struct or union -error[E0658]: use of unstable library feature 'transmutability' +error[E0658]: use of unstable library feature `transmutability` --> $DIR/thaw-transmute-invalid-enum.rs:4:20 | LL | use std::mem::{Assume, TransmuteFrom}; @@ -30,7 +30,7 @@ LL | use std::mem::{Assume, TransmuteFrom}; = help: add `#![feature(transmutability)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'transmutability' +error[E0658]: use of unstable library feature `transmutability` --> $DIR/thaw-transmute-invalid-enum.rs:4:28 | LL | use std::mem::{Assume, TransmuteFrom}; @@ -40,7 +40,7 @@ LL | use std::mem::{Assume, TransmuteFrom}; = help: add `#![feature(transmutability)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'transmutability' +error[E0658]: use of unstable library feature `transmutability` --> $DIR/thaw-transmute-invalid-enum.rs:10:14 | LL | Dst: TransmuteFrom<Src>, diff --git a/tests/ui/layout/thumb-enum.stderr b/tests/ui/layout/thumb-enum.stderr index 6f6ab498206..bf043af586b 100644 --- a/tests/ui/layout/thumb-enum.stderr +++ b/tests/ui/layout/thumb-enum.stderr @@ -48,7 +48,7 @@ error: layout_of(A) = Layout { abi: Align(1 bytes), pref: Align(4 bytes), }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -122,7 +122,7 @@ error: layout_of(B) = Layout { abi: Align(1 bytes), pref: Align(4 bytes), }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -196,7 +196,7 @@ error: layout_of(C) = Layout { abi: Align(2 bytes), pref: Align(4 bytes), }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -270,7 +270,7 @@ error: layout_of(P) = Layout { abi: Align(4 bytes), pref: Align(4 bytes), }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -344,7 +344,7 @@ error: layout_of(T) = Layout { abi: Align(4 bytes), pref: Align(4 bytes), }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr index ee34cfdfb0d..d61408098df 100644 --- a/tests/ui/layout/zero-sized-array-enum-niche.stderr +++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr @@ -4,7 +4,7 @@ error: layout_of(Result<[u32; 0], bool>) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -42,7 +42,7 @@ error: layout_of(Result<[u32; 0], bool>) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -66,7 +66,7 @@ error: layout_of(Result<[u32; 0], bool>) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -109,7 +109,7 @@ error: layout_of(MultipleAlignments) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -147,7 +147,7 @@ error: layout_of(MultipleAlignments) = Layout { abi: Align(2 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -171,7 +171,7 @@ error: layout_of(MultipleAlignments) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -195,7 +195,7 @@ error: layout_of(MultipleAlignments) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -238,7 +238,7 @@ error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -276,7 +276,7 @@ error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -300,7 +300,7 @@ error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -343,7 +343,7 @@ error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -385,7 +385,7 @@ error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout { abi: Align(4 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -409,7 +409,7 @@ error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout { abi: Align(1 bytes), pref: $PREF_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs b/tests/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs index b355997a4b3..ee193a58ce1 100644 --- a/tests/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs +++ b/tests/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs @@ -1,4 +1,5 @@ //@ run-pass +//@ reference: input.crlf // ignore-tidy-cr // ignore-tidy-cr (repeated again because of tidy bug) // license is ignored because tidy can't handle the CRLF here properly. diff --git a/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr b/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr index 1664466df3c..f26d6b8d0be 100644 --- a/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr +++ b/tests/ui/lifetimes/lifetime-elision-return-type-trait.stderr @@ -3,6 +3,9 @@ error[E0277]: the trait bound `Result<(), _>: Future` is not satisfied | LL | fn foo() -> impl Future<Item=(), Error=Box<dyn Error>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Future` is not implemented for `Result<(), _>` +LL | +LL | Ok(()) + | ------ return type was inferred to be `Result<(), _>` here | help: this trait has no implementations, consider adding one --> $DIR/lifetime-elision-return-type-trait.rs:1:1 diff --git a/tests/ui/lifetimes/raw/immediately-followed-by-lt.rs b/tests/ui/lifetimes/raw/immediately-followed-by-lt.rs new file mode 100644 index 00000000000..fe2b6de7bb3 --- /dev/null +++ b/tests/ui/lifetimes/raw/immediately-followed-by-lt.rs @@ -0,0 +1,14 @@ +//@ edition: 2021 + +// Make sure we reject the case where a raw lifetime is immediately followed by another +// lifetime. This reserves a modest amount of space for changing lexing to, for example, +// delay rejection of overlong char literals like `'r#long'id`. + +macro_rules! w { + ($($tt:tt)*) => {} +} + +w!('r#long'id); +//~^ ERROR character literal may only contain one codepoint + +fn main() {} diff --git a/tests/ui/lifetimes/raw/immediately-followed-by-lt.stderr b/tests/ui/lifetimes/raw/immediately-followed-by-lt.stderr new file mode 100644 index 00000000000..1caeec84b22 --- /dev/null +++ b/tests/ui/lifetimes/raw/immediately-followed-by-lt.stderr @@ -0,0 +1,13 @@ +error: character literal may only contain one codepoint + --> $DIR/immediately-followed-by-lt.rs:11:4 + | +LL | w!('r#long'id); + | ^^^^^^^^ + | +help: if you meant to write a string literal, use double quotes + | +LL | w!("r#long"id); + | ~ ~ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lifetimes/raw/raw-lt-invalid-raw-id.rs b/tests/ui/lifetimes/raw/raw-lt-invalid-raw-id.rs new file mode 100644 index 00000000000..882fad925f3 --- /dev/null +++ b/tests/ui/lifetimes/raw/raw-lt-invalid-raw-id.rs @@ -0,0 +1,20 @@ +//@ edition: 2021 + +// Reject raw lifetimes with identifier parts that wouldn't be valid raw identifiers. + +macro_rules! w { + ($tt:tt) => {}; +} + +w!('r#_); +//~^ ERROR `_` cannot be a raw lifetime +w!('r#self); +//~^ ERROR `self` cannot be a raw lifetime +w!('r#super); +//~^ ERROR `super` cannot be a raw lifetime +w!('r#Self); +//~^ ERROR `Self` cannot be a raw lifetime +w!('r#crate); +//~^ ERROR `crate` cannot be a raw lifetime + +fn main() {} diff --git a/tests/ui/lifetimes/raw/raw-lt-invalid-raw-id.stderr b/tests/ui/lifetimes/raw/raw-lt-invalid-raw-id.stderr new file mode 100644 index 00000000000..4cbb89b7a55 --- /dev/null +++ b/tests/ui/lifetimes/raw/raw-lt-invalid-raw-id.stderr @@ -0,0 +1,32 @@ +error: `_` cannot be a raw lifetime + --> $DIR/raw-lt-invalid-raw-id.rs:9:4 + | +LL | w!('r#_); + | ^^^^ + +error: `self` cannot be a raw lifetime + --> $DIR/raw-lt-invalid-raw-id.rs:11:4 + | +LL | w!('r#self); + | ^^^^^^^ + +error: `super` cannot be a raw lifetime + --> $DIR/raw-lt-invalid-raw-id.rs:13:4 + | +LL | w!('r#super); + | ^^^^^^^^ + +error: `Self` cannot be a raw lifetime + --> $DIR/raw-lt-invalid-raw-id.rs:15:4 + | +LL | w!('r#Self); + | ^^^^^^^ + +error: `crate` cannot be a raw lifetime + --> $DIR/raw-lt-invalid-raw-id.rs:17:4 + | +LL | w!('r#crate); + | ^^^^^^^^ + +error: aborting due to 5 previous errors + diff --git a/tests/ui/linkage-attr/framework.omit.stderr b/tests/ui/linkage-attr/framework.omit.stderr deleted file mode 100644 index 23e017cb012..00000000000 --- a/tests/ui/linkage-attr/framework.omit.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: linking with `LINKER` failed: exit status: 1 - | - ld: Undefined symbols: - _CFRunLoopGetTypeID, referenced from: - clang: error: linker command failed with exit code 1 (use -v to see invocation) - - -error: aborting due to 1 previous error diff --git a/tests/ui/linkage-attr/framework.rs b/tests/ui/linkage-attr/framework.rs deleted file mode 100644 index 08f4394db21..00000000000 --- a/tests/ui/linkage-attr/framework.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Check that linking frameworks on Apple platforms works. -//@ only-apple -//@ revisions: omit link weak both -//@ [omit]build-fail -//@ [link]run-pass -//@ [weak]run-pass -//@ [both]run-pass - -// The linker's exact error output changes between Xcode versions, depends on -// linker invocation details, and the linker sometimes outputs more warnings. -//@ compare-output-lines-by-subset -//@ normalize-stderr-test: "linking with `.*` failed" -> "linking with `LINKER` failed" -//@ normalize-stderr-test: "Undefined symbols for architecture .*" -> "ld: Undefined symbols:" -//@ normalize-stderr-test: "._CFRunLoopGetTypeID.," -> "_CFRunLoopGetTypeID," - -#![cfg_attr(any(weak, both), feature(link_arg_attribute))] - -#[cfg_attr(any(link, both), link(name = "CoreFoundation", kind = "framework"))] -#[cfg_attr( - any(weak, both), - link(name = "-weak_framework", kind = "link-arg", modifiers = "+verbatim"), - link(name = "CoreFoundation", kind = "link-arg", modifiers = "+verbatim") -)] -extern "C" { - fn CFRunLoopGetTypeID() -> core::ffi::c_ulong; -} - -pub fn main() { - unsafe { - CFRunLoopGetTypeID(); - } -} diff --git a/tests/ui/lint/cli-lint-override.forbid_warn.stderr b/tests/ui/lint/cli-lint-override.forbid_warn.stderr index d8c75c33b0c..169be997b48 100644 --- a/tests/ui/lint/cli-lint-override.forbid_warn.stderr +++ b/tests/ui/lint/cli-lint-override.forbid_warn.stderr @@ -2,9 +2,8 @@ error: extern declarations without an explicit ABI are deprecated --> $DIR/cli-lint-override.rs:12:1 | LL | extern fn foo() {} - | ^^^^^^^^^^^^^^^ ABI should be specified here + | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` | - = help: the default ABI is C = note: requested on the command line with `-F missing-abi` error: aborting due to 1 previous error diff --git a/tests/ui/lint/cli-lint-override.force_warn_deny.stderr b/tests/ui/lint/cli-lint-override.force_warn_deny.stderr index 779c24c93f2..574f2ca66a4 100644 --- a/tests/ui/lint/cli-lint-override.force_warn_deny.stderr +++ b/tests/ui/lint/cli-lint-override.force_warn_deny.stderr @@ -2,9 +2,8 @@ warning: extern declarations without an explicit ABI are deprecated --> $DIR/cli-lint-override.rs:12:1 | LL | extern fn foo() {} - | ^^^^^^^^^^^^^^^ ABI should be specified here + | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` | - = help: the default ABI is C = note: requested on the command line with `--force-warn missing-abi` warning: 1 warning emitted diff --git a/tests/ui/lint/cli-lint-override.warn_deny.stderr b/tests/ui/lint/cli-lint-override.warn_deny.stderr index 1ba42e9ce32..bfec37ada95 100644 --- a/tests/ui/lint/cli-lint-override.warn_deny.stderr +++ b/tests/ui/lint/cli-lint-override.warn_deny.stderr @@ -2,9 +2,8 @@ error: extern declarations without an explicit ABI are deprecated --> $DIR/cli-lint-override.rs:12:1 | LL | extern fn foo() {} - | ^^^^^^^^^^^^^^^ ABI should be specified here + | ^^^^^^ help: explicitly specify the C ABI: `extern "C"` | - = help: the default ABI is C = note: requested on the command line with `-D missing-abi` error: aborting due to 1 previous error diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/allow.rs b/tests/ui/lint/dangling-pointers-from-temporaries/allow.rs new file mode 100644 index 00000000000..d892ebdf606 --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/allow.rs @@ -0,0 +1,23 @@ +#![allow(dangling_pointers_from_temporaries)] + +fn main() { + dbg!(String::new().as_ptr()); + // ^ no error + + #[deny(dangling_pointers_from_temporaries)] + { + dbg!(String::new().as_ptr()); + //~^ ERROR a dangling pointer will be produced because the temporary `String` will be dropped + } + S.foo() +} + +struct S; + +impl S { + #[warn(dangling_pointers_from_temporaries)] + fn foo(self) { + dbg!(String::new().as_ptr()); + //~^ WARNING a dangling pointer will be produced because the temporary `String` will be dropped + } +} diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/allow.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/allow.stderr new file mode 100644 index 00000000000..fd434eacf3d --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/allow.stderr @@ -0,0 +1,34 @@ +error: a dangling pointer will be produced because the temporary `String` will be dropped + --> $DIR/allow.rs:9:28 + | +LL | dbg!(String::new().as_ptr()); + | ------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> +note: the lint level is defined here + --> $DIR/allow.rs:7:12 + | +LL | #[deny(dangling_pointers_from_temporaries)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: a dangling pointer will be produced because the temporary `String` will be dropped + --> $DIR/allow.rs:20:28 + | +LL | dbg!(String::new().as_ptr()); + | ------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> +note: the lint level is defined here + --> $DIR/allow.rs:18:12 + | +LL | #[warn(dangling_pointers_from_temporaries)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error; 1 warning emitted + diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/calls.rs b/tests/ui/lint/dangling-pointers-from-temporaries/calls.rs new file mode 100644 index 00000000000..b376582a886 --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/calls.rs @@ -0,0 +1,52 @@ +#![deny(dangling_pointers_from_temporaries)] + +use std::ffi::{c_char, CString}; + +fn cstring() -> CString { + CString::new("hello").unwrap() +} + +fn consume(ptr: *const c_char) { + let c = unsafe { ptr.read() }; + dbg!(c); +} + +// None of these should trigger the lint. +fn ok() { + consume(cstring().as_ptr()); + consume({ cstring() }.as_ptr()); + consume({ cstring().as_ptr() }); + consume(cstring().as_ptr().cast()); + consume({ cstring() }.as_ptr().cast()); + consume({ cstring().as_ptr() }.cast()); +} + +// All of these should trigger the lint. +fn not_ok() { + { + let ptr = cstring().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `CString` will be dropped + consume(ptr); + } + consume({ + let ptr = cstring().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `CString` will be dropped + ptr + }); + consume({ + let s = cstring(); + s.as_ptr() + //^ FIXME: should error + }); + let _ptr: *const u8 = cstring().as_ptr().cast(); + //~^ ERROR a dangling pointer will be produced because the temporary `CString` will be dropped + let _ptr: *const u8 = { cstring() }.as_ptr().cast(); + //~^ ERROR a dangling pointer will be produced because the temporary `CString` will be dropped + let _ptr: *const u8 = { cstring().as_ptr() }.cast(); + //~^ ERROR a dangling pointer will be produced because the temporary `CString` will be dropped +} + +fn main() { + ok(); + not_ok(); +} diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/calls.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/calls.stderr new file mode 100644 index 00000000000..d1615b76d82 --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/calls.stderr @@ -0,0 +1,62 @@ +error: a dangling pointer will be produced because the temporary `CString` will be dropped + --> $DIR/calls.rs:27:29 + | +LL | let ptr = cstring().as_ptr(); + | --------- ^^^^^^ this pointer will immediately be invalid + | | + | this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> +note: the lint level is defined here + --> $DIR/calls.rs:1:9 + | +LL | #![deny(dangling_pointers_from_temporaries)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: a dangling pointer will be produced because the temporary `CString` will be dropped + --> $DIR/calls.rs:32:29 + | +LL | let ptr = cstring().as_ptr(); + | --------- ^^^^^^ this pointer will immediately be invalid + | | + | this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `CString` will be dropped + --> $DIR/calls.rs:41:37 + | +LL | let _ptr: *const u8 = cstring().as_ptr().cast(); + | --------- ^^^^^^ this pointer will immediately be invalid + | | + | this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `CString` will be dropped + --> $DIR/calls.rs:43:41 + | +LL | let _ptr: *const u8 = { cstring() }.as_ptr().cast(); + | ------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `CString` will be dropped + --> $DIR/calls.rs:45:39 + | +LL | let _ptr: *const u8 = { cstring().as_ptr() }.cast(); + | --------- ^^^^^^ this pointer will immediately be invalid + | | + | this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: aborting due to 5 previous errors + diff --git a/tests/ui/lint/lint-temporary-cstring-as-param.rs b/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-param.rs index 9f5805367e4..fb6ed363272 100644 --- a/tests/ui/lint/lint-temporary-cstring-as-param.rs +++ b/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-param.rs @@ -1,4 +1,7 @@ +//@ check-pass + #![deny(temporary_cstring_as_ptr)] +//~^ WARNING lint `temporary_cstring_as_ptr` has been renamed to `dangling_pointers_from_temporaries` use std::ffi::CString; use std::os::raw::c_char; @@ -7,5 +10,4 @@ fn some_function(data: *const c_char) {} fn main() { some_function(CString::new("").unwrap().as_ptr()); - //~^ ERROR getting the inner pointer of a temporary `CString` } diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-param.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-param.stderr new file mode 100644 index 00000000000..dd54b4971dd --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-param.stderr @@ -0,0 +1,10 @@ +warning: lint `temporary_cstring_as_ptr` has been renamed to `dangling_pointers_from_temporaries` + --> $DIR/cstring-as-param.rs:3:9 + | +LL | #![deny(temporary_cstring_as_ptr)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `dangling_pointers_from_temporaries` + | + = note: `#[warn(renamed_and_removed_lints)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/lint/lint-temporary-cstring-as-ptr.rs b/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-ptr.rs index fab792f1284..a98378794ab 100644 --- a/tests/ui/lint/lint-temporary-cstring-as-ptr.rs +++ b/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-ptr.rs @@ -1,17 +1,18 @@ // this program is not technically incorrect, but is an obscure enough style to be worth linting #![deny(temporary_cstring_as_ptr)] +//~^ WARNING lint `temporary_cstring_as_ptr` has been renamed to `dangling_pointers_from_temporaries` use std::ffi::CString; macro_rules! mymacro { () => { let s = CString::new("some text").unwrap().as_ptr(); - //~^ ERROR getting the inner pointer of a temporary `CString` + //~^ ERROR a dangling pointer will be produced because the temporary `CString` will be dropped } } fn main() { let s = CString::new("some text").unwrap().as_ptr(); - //~^ ERROR getting the inner pointer of a temporary `CString` + //~^ ERROR a dangling pointer will be produced because the temporary `CString` will be dropped mymacro!(); } diff --git a/tests/ui/lint/lint-temporary-cstring-as-ptr.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-ptr.stderr index 4e5c8aa0693..5289fbb8723 100644 --- a/tests/ui/lint/lint-temporary-cstring-as-ptr.stderr +++ b/tests/ui/lint/dangling-pointers-from-temporaries/cstring-as-ptr.stderr @@ -1,24 +1,32 @@ -error: getting the inner pointer of a temporary `CString` - --> $DIR/lint-temporary-cstring-as-ptr.rs:14:48 +warning: lint `temporary_cstring_as_ptr` has been renamed to `dangling_pointers_from_temporaries` + --> $DIR/cstring-as-ptr.rs:2:9 + | +LL | #![deny(temporary_cstring_as_ptr)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `dangling_pointers_from_temporaries` + | + = note: `#[warn(renamed_and_removed_lints)]` on by default + +error: a dangling pointer will be produced because the temporary `CString` will be dropped + --> $DIR/cstring-as-ptr.rs:15:48 | LL | let s = CString::new("some text").unwrap().as_ptr(); - | ---------------------------------- ^^^^^^ this pointer will be invalid + | ---------------------------------- ^^^^^^ this pointer will immediately be invalid | | | this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime | = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned - = help: for more information, see https://doc.rust-lang.org/reference/destructors.html + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> note: the lint level is defined here - --> $DIR/lint-temporary-cstring-as-ptr.rs:2:9 + --> $DIR/cstring-as-ptr.rs:2:9 | LL | #![deny(temporary_cstring_as_ptr)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: getting the inner pointer of a temporary `CString` - --> $DIR/lint-temporary-cstring-as-ptr.rs:8:52 +error: a dangling pointer will be produced because the temporary `CString` will be dropped + --> $DIR/cstring-as-ptr.rs:9:52 | LL | let s = CString::new("some text").unwrap().as_ptr(); - | ---------------------------------- ^^^^^^ this pointer will be invalid + | ---------------------------------- ^^^^^^ this pointer will immediately be invalid | | | this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime ... @@ -26,8 +34,8 @@ LL | mymacro!(); | ---------- in this macro invocation | = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned - = help: for more information, see https://doc.rust-lang.org/reference/destructors.html + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> = note: this error originates in the macro `mymacro` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 2 previous errors +error: aborting due to 2 previous errors; 1 warning emitted diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/emacs.rs b/tests/ui/lint/dangling-pointers-from-temporaries/emacs.rs new file mode 100644 index 00000000000..b9b7bd3ade1 --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/emacs.rs @@ -0,0 +1,19 @@ +//@ check-pass + +#![deny(dangling_pointers_from_temporaries)] + +// The original code example comes from bindgen-produced code for emacs. +// Hence the name of the test. +// https://github.com/rust-lang/rust/pull/128985#issuecomment-2338951363 + +use std::ffi::{c_char, CString}; + +fn read(ptr: *const c_char) -> c_char { + unsafe { ptr.read() } +} + +fn main() { + let fnptr: Option<fn(ptr: *const c_char) -> c_char> = Some(read); + let x = fnptr.unwrap()(CString::new("foo").unwrap().as_ptr()); + assert_eq!(x as u8, b'f'); +} diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/example-from-issue123613.rs b/tests/ui/lint/dangling-pointers-from-temporaries/example-from-issue123613.rs new file mode 100644 index 00000000000..0fb07a3f3bc --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/example-from-issue123613.rs @@ -0,0 +1,13 @@ +#![deny(dangling_pointers_from_temporaries)] + +const MAX_PATH: usize = 260; +fn main() { + let str1 = String::with_capacity(MAX_PATH).as_mut_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `String` will be dropped + let str2 = String::from("TotototototototototototototototototoT").as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `String` will be dropped + unsafe { + std::ptr::copy_nonoverlapping(str2, str1, 30); + println!("{:?}", String::from_raw_parts(str1, 30, 30)); + } +} diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/example-from-issue123613.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/example-from-issue123613.stderr new file mode 100644 index 00000000000..0de794f6ae2 --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/example-from-issue123613.stderr @@ -0,0 +1,29 @@ +error: a dangling pointer will be produced because the temporary `String` will be dropped + --> $DIR/example-from-issue123613.rs:5:48 + | +LL | let str1 = String::with_capacity(MAX_PATH).as_mut_ptr(); + | ------------------------------- ^^^^^^^^^^ this pointer will immediately be invalid + | | + | this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_mut_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> +note: the lint level is defined here + --> $DIR/example-from-issue123613.rs:1:9 + | +LL | #![deny(dangling_pointers_from_temporaries)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: a dangling pointer will be produced because the temporary `String` will be dropped + --> $DIR/example-from-issue123613.rs:7:70 + | +LL | let str2 = String::from("TotototototototototototototototototoT").as_ptr(); + | ----------------------------------------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/ext.rs b/tests/ui/lint/dangling-pointers-from-temporaries/ext.rs new file mode 100644 index 00000000000..a5e84d36090 --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/ext.rs @@ -0,0 +1,32 @@ +#![deny(dangling_pointers_from_temporaries)] + +use std::fmt::Debug; + +trait Ext1 { + fn dbg(self) -> Self + where + Self: Sized + Debug, + { + dbg!(&self); + self + } +} + +impl<T> Ext1 for *const T {} + +trait Ext2 { + fn foo(self); +} + +impl Ext2 for *const u32 { + fn foo(self) { + dbg!(unsafe { self.read() }); + } +} + +fn main() { + let _ptr1 = Vec::<u32>::new().as_ptr().dbg(); + //~^ ERROR a dangling pointer will be produced because the temporary `Vec<u32>` will be dropped + let _ptr2 = vec![0].as_ptr().foo(); + //~^ ERROR a dangling pointer will be produced because the temporary `Vec<u32>` will be dropped +} diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/ext.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/ext.stderr new file mode 100644 index 00000000000..5d401c89c0c --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/ext.stderr @@ -0,0 +1,29 @@ +error: a dangling pointer will be produced because the temporary `Vec<u32>` will be dropped + --> $DIR/ext.rs:28:35 + | +LL | let _ptr1 = Vec::<u32>::new().as_ptr().dbg(); + | ----------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Vec<u32>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<u32>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> +note: the lint level is defined here + --> $DIR/ext.rs:1:9 + | +LL | #![deny(dangling_pointers_from_temporaries)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: a dangling pointer will be produced because the temporary `Vec<u32>` will be dropped + --> $DIR/ext.rs:30:25 + | +LL | let _ptr2 = vec![0].as_ptr().foo(); + | ------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Vec<u32>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<u32>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/methods.rs b/tests/ui/lint/dangling-pointers-from-temporaries/methods.rs new file mode 100644 index 00000000000..26019b376d3 --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/methods.rs @@ -0,0 +1,8 @@ +#![deny(dangling_pointers_from_temporaries)] + +fn main() { + vec![0u8].as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Vec<u8>` will be dropped + vec![0u8].as_mut_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Vec<u8>` will be dropped +} diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/methods.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/methods.stderr new file mode 100644 index 00000000000..11c052c158e --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/methods.stderr @@ -0,0 +1,29 @@ +error: a dangling pointer will be produced because the temporary `Vec<u8>` will be dropped + --> $DIR/methods.rs:4:15 + | +LL | vec![0u8].as_ptr(); + | --------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Vec<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> +note: the lint level is defined here + --> $DIR/methods.rs:1:9 + | +LL | #![deny(dangling_pointers_from_temporaries)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: a dangling pointer will be produced because the temporary `Vec<u8>` will be dropped + --> $DIR/methods.rs:6:15 + | +LL | vec![0u8].as_mut_ptr(); + | --------- ^^^^^^^^^^ this pointer will immediately be invalid + | | + | this `Vec<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_mut_ptr` the `Vec<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: aborting due to 2 previous errors + diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/temporaries.rs b/tests/ui/lint/dangling-pointers-from-temporaries/temporaries.rs new file mode 100644 index 00000000000..1f216586ae8 --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/temporaries.rs @@ -0,0 +1,136 @@ +#![allow(unused)] +#![deny(dangling_pointers_from_temporaries)] + +fn string() -> String { + "hello".into() +} + +struct Wrapper(String); + +fn main() { + // ConstBlock + const { String::new() }.as_ptr(); + + // Array + { + [string()].as_ptr(); // False negative + [true].as_ptr(); + } + + // Call + string().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `String` will be dropped + + // MethodCall + "hello".to_string().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `String` will be dropped + + // Tup + // impossible + + // Binary + (string() + "hello").as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `String` will be dropped + + // Path + { + let x = string(); + x.as_ptr(); + } + + // Unary + { + let x = string(); + let x: &String = &x; + (*x).as_ptr(); + (&[0u8]).as_ptr(); + (&string()).as_ptr(); // False negative + (*&string()).as_ptr(); // False negative + } + + // Lit + "hello".as_ptr(); + + // Cast + // impossible + + // Type + // impossible + + // DropTemps + // impossible + + // Let + // impossible + + // If + { + (if true { String::new() } else { "hello".into() }).as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `String` will be dropped + } + + // Loop + { + (loop { + break String::new(); + }) + .as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `String` will be dropped + } + + // Match + { + match string() { + s => s, + } + .as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `String` will be dropped + } + + // Closure + // impossible + + // Block + { string() }.as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `String` will be dropped + + // Assign, AssignOp + // impossible + + // Field + { + Wrapper(string()).0.as_ptr(); // False negative + let x = Wrapper(string()); + x.0.as_ptr(); + } + + // Index + { + vec![string()][0].as_ptr(); // False negative + let x = vec![string()]; + x[0].as_ptr(); + } + + // AddrOf, InlineAsm, OffsetOf + // impossible + + // Break, Continue, Ret + // are ! + + // Become, Yield + // unstable, are ! + + // Repeat + [0u8; 100].as_ptr(); + [const { String::new() }; 100].as_ptr(); + + // Struct + // Cannot test this without access to private fields of the linted types. + + // Err + // impossible + + // Macro + vec![0u8].as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Vec<u8>` will be dropped +} diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/temporaries.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/temporaries.stderr new file mode 100644 index 00000000000..d2e9ac8c4e9 --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/temporaries.stderr @@ -0,0 +1,99 @@ +error: a dangling pointer will be produced because the temporary `String` will be dropped + --> $DIR/temporaries.rs:21:14 + | +LL | string().as_ptr(); + | -------- ^^^^^^ this pointer will immediately be invalid + | | + | this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> +note: the lint level is defined here + --> $DIR/temporaries.rs:2:9 + | +LL | #![deny(dangling_pointers_from_temporaries)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: a dangling pointer will be produced because the temporary `String` will be dropped + --> $DIR/temporaries.rs:25:25 + | +LL | "hello".to_string().as_ptr(); + | ------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `String` will be dropped + --> $DIR/temporaries.rs:32:26 + | +LL | (string() + "hello").as_ptr(); + | -------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `String` will be dropped + --> $DIR/temporaries.rs:68:61 + | +LL | (if true { String::new() } else { "hello".into() }).as_ptr(); + | --------------------------------------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `String` will be dropped + --> $DIR/temporaries.rs:77:10 + | +LL | / (loop { +LL | | break String::new(); +LL | | }) + | |__________- this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime +LL | .as_ptr(); + | ^^^^^^ this pointer will immediately be invalid + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `String` will be dropped + --> $DIR/temporaries.rs:86:10 + | +LL | / match string() { +LL | | s => s, +LL | | } + | |_________- this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime +LL | .as_ptr(); + | ^^^^^^ this pointer will immediately be invalid + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `String` will be dropped + --> $DIR/temporaries.rs:94:18 + | +LL | { string() }.as_ptr(); + | ------------ ^^^^^^ this pointer will immediately be invalid + | | + | this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `Vec<u8>` will be dropped + --> $DIR/temporaries.rs:134:15 + | +LL | vec![0u8].as_ptr(); + | --------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Vec<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: aborting due to 8 previous errors + diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/types.rs b/tests/ui/lint/dangling-pointers-from-temporaries/types.rs new file mode 100644 index 00000000000..2b515d3e6d5 --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/types.rs @@ -0,0 +1,52 @@ +#![deny(dangling_pointers_from_temporaries)] + +use std::cell::Cell; +use std::ffi::{CStr, CString}; +use std::mem::MaybeUninit; + +struct AsPtrFake; + +impl AsPtrFake { + fn as_ptr(&self) -> *const () { + std::ptr::null() + } +} + +fn declval<T>() -> T { + loop {} +} + +fn main() { + declval::<CString>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `CString` will be dropped + declval::<String>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `String` will be dropped + declval::<Vec<u8>>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Vec<u8>` will be dropped + declval::<Box<CString>>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Box<CString>` will be dropped + declval::<Box<[u8]>>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Box<[u8]>` will be dropped + declval::<Box<str>>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Box<str>` will be dropped + declval::<Box<CStr>>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Box<CStr>` will be dropped + declval::<[u8; 10]>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `[u8; 10]` will be dropped + declval::<Box<[u8; 10]>>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Box<[u8; 10]>` will be dropped + declval::<Box<Vec<u8>>>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Box<Vec<u8>>` will be dropped + declval::<Box<String>>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Box<String>` will be dropped + declval::<Box<Box<Box<Box<[u8]>>>>>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Box<Box<Box<Box<[u8]>>>>` will be dropped + declval::<Cell<u8>>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Cell<u8>` will be dropped + declval::<MaybeUninit<u8>>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `MaybeUninit<u8>` will be dropped + declval::<Vec<AsPtrFake>>().as_ptr(); + //~^ ERROR a dangling pointer will be produced because the temporary `Vec<AsPtrFake>` will be dropped + declval::<Box<AsPtrFake>>().as_ptr(); + declval::<AsPtrFake>().as_ptr(); +} diff --git a/tests/ui/lint/dangling-pointers-from-temporaries/types.stderr b/tests/ui/lint/dangling-pointers-from-temporaries/types.stderr new file mode 100644 index 00000000000..c582a4c6540 --- /dev/null +++ b/tests/ui/lint/dangling-pointers-from-temporaries/types.stderr @@ -0,0 +1,172 @@ +error: a dangling pointer will be produced because the temporary `CString` will be dropped + --> $DIR/types.rs:20:26 + | +LL | declval::<CString>().as_ptr(); + | -------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> +note: the lint level is defined here + --> $DIR/types.rs:1:9 + | +LL | #![deny(dangling_pointers_from_temporaries)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: a dangling pointer will be produced because the temporary `String` will be dropped + --> $DIR/types.rs:22:25 + | +LL | declval::<String>().as_ptr(); + | ------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `String` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `String` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `Vec<u8>` will be dropped + --> $DIR/types.rs:24:26 + | +LL | declval::<Vec<u8>>().as_ptr(); + | -------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Vec<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `Box<CString>` will be dropped + --> $DIR/types.rs:26:31 + | +LL | declval::<Box<CString>>().as_ptr(); + | ------------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Box<CString>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Box<CString>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `Box<[u8]>` will be dropped + --> $DIR/types.rs:28:28 + | +LL | declval::<Box<[u8]>>().as_ptr(); + | ---------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Box<[u8]>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Box<[u8]>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `Box<str>` will be dropped + --> $DIR/types.rs:30:27 + | +LL | declval::<Box<str>>().as_ptr(); + | --------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Box<str>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Box<str>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `Box<CStr>` will be dropped + --> $DIR/types.rs:32:28 + | +LL | declval::<Box<CStr>>().as_ptr(); + | ---------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Box<CStr>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Box<CStr>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `[u8; 10]` will be dropped + --> $DIR/types.rs:34:27 + | +LL | declval::<[u8; 10]>().as_ptr(); + | --------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `[u8; 10]` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `[u8; 10]` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `Box<[u8; 10]>` will be dropped + --> $DIR/types.rs:36:32 + | +LL | declval::<Box<[u8; 10]>>().as_ptr(); + | -------------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Box<[u8; 10]>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Box<[u8; 10]>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `Box<Vec<u8>>` will be dropped + --> $DIR/types.rs:38:31 + | +LL | declval::<Box<Vec<u8>>>().as_ptr(); + | ------------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Box<Vec<u8>>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Box<Vec<u8>>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `Box<String>` will be dropped + --> $DIR/types.rs:40:30 + | +LL | declval::<Box<String>>().as_ptr(); + | ------------------------ ^^^^^^ this pointer will immediately be invalid + | | + | this `Box<String>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Box<String>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `Box<Box<Box<Box<[u8]>>>>` will be dropped + --> $DIR/types.rs:42:43 + | +LL | declval::<Box<Box<Box<Box<[u8]>>>>>().as_ptr(); + | ------------------------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Box<Box<Box<Box<[u8]>>>>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Box<Box<Box<Box<[u8]>>>>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `Cell<u8>` will be dropped + --> $DIR/types.rs:44:27 + | +LL | declval::<Cell<u8>>().as_ptr(); + | --------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Cell<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Cell<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `MaybeUninit<u8>` will be dropped + --> $DIR/types.rs:46:34 + | +LL | declval::<MaybeUninit<u8>>().as_ptr(); + | ---------------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `MaybeUninit<u8>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `MaybeUninit<u8>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: a dangling pointer will be produced because the temporary `Vec<AsPtrFake>` will be dropped + --> $DIR/types.rs:48:33 + | +LL | declval::<Vec<AsPtrFake>>().as_ptr(); + | --------------------------- ^^^^^^ this pointer will immediately be invalid + | | + | this `Vec<AsPtrFake>` is deallocated at the end of the statement, bind it to a variable to extend its lifetime + | + = note: pointers do not have a lifetime; when calling `as_ptr` the `Vec<AsPtrFake>` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see <https://doc.rust-lang.org/reference/destructors.html> + +error: aborting due to 15 previous errors + diff --git a/tests/ui/lint/expansion-time.rs b/tests/ui/lint/expansion-time.rs index 1e1f8f9e1b6..d0f26a87385 100644 --- a/tests/ui/lint/expansion-time.rs +++ b/tests/ui/lint/expansion-time.rs @@ -11,7 +11,7 @@ macro_rules! m { ($i) => {} } //~ WARN missing fragment specifier #[warn(soft_unstable)] mod benches { - #[bench] //~ WARN use of unstable library feature 'test' + #[bench] //~ WARN use of unstable library feature `test` //~| WARN this was previously accepted fn foo() {} } diff --git a/tests/ui/lint/expansion-time.stderr b/tests/ui/lint/expansion-time.stderr index e490ae91a48..f65627c2c08 100644 --- a/tests/ui/lint/expansion-time.stderr +++ b/tests/ui/lint/expansion-time.stderr @@ -26,7 +26,7 @@ note: the lint level is defined here LL | #[warn(missing_fragment_specifier)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable +warning: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable --> $DIR/expansion-time.rs:14:7 | LL | #[bench] @@ -70,7 +70,7 @@ LL | #[warn(missing_fragment_specifier)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Future breakage diagnostic: -warning: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable +warning: use of unstable library feature `test`: `bench` is a part of custom test frameworks which are unstable --> $DIR/expansion-time.rs:14:7 | LL | #[bench] diff --git a/tests/ui/lint/invalid-nan-comparison-suggestion.fixed b/tests/ui/lint/invalid-nan-comparison-suggestion.fixed index 46b2d4e9c3f..2d88c274080 100644 --- a/tests/ui/lint/invalid-nan-comparison-suggestion.fixed +++ b/tests/ui/lint/invalid-nan-comparison-suggestion.fixed @@ -1,7 +1,15 @@ //@ check-pass //@ run-rustfix +#![feature(f16, f128)] + fn main() { + let x = 5f16; + let _ = x.is_nan(); + //~^ WARN incorrect NaN comparison + let _ = !x.is_nan(); + //~^ WARN incorrect NaN comparison + let x = 5f32; let _ = x.is_nan(); //~^ WARN incorrect NaN comparison @@ -14,6 +22,12 @@ fn main() { let _ = !x.is_nan(); //~^ WARN incorrect NaN comparison + let x = 5f128; + let _ = x.is_nan(); + //~^ WARN incorrect NaN comparison + let _ = !x.is_nan(); + //~^ WARN incorrect NaN comparison + let b = &2.3f32; if !b.is_nan() {} //~^ WARN incorrect NaN comparison diff --git a/tests/ui/lint/invalid-nan-comparison-suggestion.rs b/tests/ui/lint/invalid-nan-comparison-suggestion.rs index 558b433d794..91753447869 100644 --- a/tests/ui/lint/invalid-nan-comparison-suggestion.rs +++ b/tests/ui/lint/invalid-nan-comparison-suggestion.rs @@ -1,7 +1,15 @@ //@ check-pass //@ run-rustfix +#![feature(f16, f128)] + fn main() { + let x = 5f16; + let _ = x == f16::NAN; + //~^ WARN incorrect NaN comparison + let _ = x != f16::NAN; + //~^ WARN incorrect NaN comparison + let x = 5f32; let _ = x == f32::NAN; //~^ WARN incorrect NaN comparison @@ -14,6 +22,12 @@ fn main() { let _ = x != f64::NAN; //~^ WARN incorrect NaN comparison + let x = 5f128; + let _ = x == f128::NAN; + //~^ WARN incorrect NaN comparison + let _ = x != f128::NAN; + //~^ WARN incorrect NaN comparison + let b = &2.3f32; if b != &f32::NAN {} //~^ WARN incorrect NaN comparison diff --git a/tests/ui/lint/invalid-nan-comparison-suggestion.stderr b/tests/ui/lint/invalid-nan-comparison-suggestion.stderr index c310341de07..9d07d3f9240 100644 --- a/tests/ui/lint/invalid-nan-comparison-suggestion.stderr +++ b/tests/ui/lint/invalid-nan-comparison-suggestion.stderr @@ -1,18 +1,42 @@ warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison-suggestion.rs:6:13 + --> $DIR/invalid-nan-comparison-suggestion.rs:8:13 | -LL | let _ = x == f32::NAN; +LL | let _ = x == f16::NAN; | ^^^^^^^^^^^^^ | = note: `#[warn(invalid_nan_comparisons)]` on by default help: use `f32::is_nan()` or `f64::is_nan()` instead | +LL - let _ = x == f16::NAN; +LL + let _ = x.is_nan(); + | + +warning: incorrect NaN comparison, NaN cannot be directly compared to itself + --> $DIR/invalid-nan-comparison-suggestion.rs:10:13 + | +LL | let _ = x != f16::NAN; + | ^^^^^^^^^^^^^ + | +help: use `f32::is_nan()` or `f64::is_nan()` instead + | +LL - let _ = x != f16::NAN; +LL + let _ = !x.is_nan(); + | + +warning: incorrect NaN comparison, NaN cannot be directly compared to itself + --> $DIR/invalid-nan-comparison-suggestion.rs:14:13 + | +LL | let _ = x == f32::NAN; + | ^^^^^^^^^^^^^ + | +help: use `f32::is_nan()` or `f64::is_nan()` instead + | LL - let _ = x == f32::NAN; LL + let _ = x.is_nan(); | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison-suggestion.rs:8:13 + --> $DIR/invalid-nan-comparison-suggestion.rs:16:13 | LL | let _ = x != f32::NAN; | ^^^^^^^^^^^^^ @@ -24,7 +48,7 @@ LL + let _ = !x.is_nan(); | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison-suggestion.rs:12:13 + --> $DIR/invalid-nan-comparison-suggestion.rs:20:13 | LL | let _ = x == f64::NAN; | ^^^^^^^^^^^^^ @@ -36,7 +60,7 @@ LL + let _ = x.is_nan(); | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison-suggestion.rs:14:13 + --> $DIR/invalid-nan-comparison-suggestion.rs:22:13 | LL | let _ = x != f64::NAN; | ^^^^^^^^^^^^^ @@ -48,7 +72,31 @@ LL + let _ = !x.is_nan(); | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison-suggestion.rs:18:8 + --> $DIR/invalid-nan-comparison-suggestion.rs:26:13 + | +LL | let _ = x == f128::NAN; + | ^^^^^^^^^^^^^^ + | +help: use `f32::is_nan()` or `f64::is_nan()` instead + | +LL - let _ = x == f128::NAN; +LL + let _ = x.is_nan(); + | + +warning: incorrect NaN comparison, NaN cannot be directly compared to itself + --> $DIR/invalid-nan-comparison-suggestion.rs:28:13 + | +LL | let _ = x != f128::NAN; + | ^^^^^^^^^^^^^^ + | +help: use `f32::is_nan()` or `f64::is_nan()` instead + | +LL - let _ = x != f128::NAN; +LL + let _ = !x.is_nan(); + | + +warning: incorrect NaN comparison, NaN cannot be directly compared to itself + --> $DIR/invalid-nan-comparison-suggestion.rs:32:8 | LL | if b != &f32::NAN {} | ^^^^^^^^^^^^^^ @@ -60,7 +108,7 @@ LL + if !b.is_nan() {} | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison-suggestion.rs:22:8 + --> $DIR/invalid-nan-comparison-suggestion.rs:36:8 | LL | if b != { &f32::NAN } {} | ^^^^^^^^^^^^^^^^^^ @@ -72,7 +120,7 @@ LL + if !b.is_nan() {} | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison-suggestion.rs:26:9 + --> $DIR/invalid-nan-comparison-suggestion.rs:40:9 | LL | / b != { LL | | @@ -87,7 +135,7 @@ LL + !b.is_nan(); | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison-suggestion.rs:35:13 + --> $DIR/invalid-nan-comparison-suggestion.rs:49:13 | LL | let _ = nan!() == number!(); | ^^^^^^^^^^^^^^^^^^^ @@ -99,7 +147,7 @@ LL + let _ = number!().is_nan(); | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison-suggestion.rs:37:13 + --> $DIR/invalid-nan-comparison-suggestion.rs:51:13 | LL | let _ = number!() != nan!(); | ^^^^^^^^^^^^^^^^^^^ @@ -110,5 +158,5 @@ LL - let _ = number!() != nan!(); LL + let _ = !number!().is_nan(); | -warning: 9 warnings emitted +warning: 13 warnings emitted diff --git a/tests/ui/lint/invalid-nan-comparison.rs b/tests/ui/lint/invalid-nan-comparison.rs index 202a5e27e8e..1a2c8a7c5a0 100644 --- a/tests/ui/lint/invalid-nan-comparison.rs +++ b/tests/ui/lint/invalid-nan-comparison.rs @@ -1,13 +1,38 @@ //@ check-pass +#![feature(f16, f128)] + fn main() { + f16(); f32(); f64(); + f128(); } const TEST: bool = 5f32 == f32::NAN; //~^ WARN incorrect NaN comparison +fn f16() { + macro_rules! number { () => { 5f16 }; } + let x = number!(); + x == f16::NAN; + //~^ WARN incorrect NaN comparison + x != f16::NAN; + //~^ WARN incorrect NaN comparison + x < f16::NAN; + //~^ WARN incorrect NaN comparison + x > f16::NAN; + //~^ WARN incorrect NaN comparison + x <= f16::NAN; + //~^ WARN incorrect NaN comparison + x >= f16::NAN; + //~^ WARN incorrect NaN comparison + number!() == f16::NAN; + //~^ WARN incorrect NaN comparison + f16::NAN != number!(); + //~^ WARN incorrect NaN comparison +} + fn f32() { macro_rules! number { () => { 5f32 }; } let x = number!(); @@ -49,3 +74,24 @@ fn f64() { f64::NAN != number!(); //~^ WARN incorrect NaN comparison } + +fn f128() { + macro_rules! number { () => { 5f128 }; } + let x = number!(); + x == f128::NAN; + //~^ WARN incorrect NaN comparison + x != f128::NAN; + //~^ WARN incorrect NaN comparison + x < f128::NAN; + //~^ WARN incorrect NaN comparison + x > f128::NAN; + //~^ WARN incorrect NaN comparison + x <= f128::NAN; + //~^ WARN incorrect NaN comparison + x >= f128::NAN; + //~^ WARN incorrect NaN comparison + number!() == f128::NAN; + //~^ WARN incorrect NaN comparison + f128::NAN != number!(); + //~^ WARN incorrect NaN comparison +} diff --git a/tests/ui/lint/invalid-nan-comparison.stderr b/tests/ui/lint/invalid-nan-comparison.stderr index 054c06d38b3..486d2a9636c 100644 --- a/tests/ui/lint/invalid-nan-comparison.stderr +++ b/tests/ui/lint/invalid-nan-comparison.stderr @@ -1,5 +1,5 @@ warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison.rs:8:20 + --> $DIR/invalid-nan-comparison.rs:12:20 | LL | const TEST: bool = 5f32 == f32::NAN; | ^^^^^^^^^^^^^^^^ @@ -12,7 +12,79 @@ LL + const TEST: bool = 5f32.is_nan(); | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison.rs:14:5 + --> $DIR/invalid-nan-comparison.rs:18:5 + | +LL | x == f16::NAN; + | ^^^^^^^^^^^^^ + | +help: use `f32::is_nan()` or `f64::is_nan()` instead + | +LL - x == f16::NAN; +LL + x.is_nan(); + | + +warning: incorrect NaN comparison, NaN cannot be directly compared to itself + --> $DIR/invalid-nan-comparison.rs:20:5 + | +LL | x != f16::NAN; + | ^^^^^^^^^^^^^ + | +help: use `f32::is_nan()` or `f64::is_nan()` instead + | +LL - x != f16::NAN; +LL + !x.is_nan(); + | + +warning: incorrect NaN comparison, NaN is not orderable + --> $DIR/invalid-nan-comparison.rs:22:5 + | +LL | x < f16::NAN; + | ^^^^^^^^^^^^ + +warning: incorrect NaN comparison, NaN is not orderable + --> $DIR/invalid-nan-comparison.rs:24:5 + | +LL | x > f16::NAN; + | ^^^^^^^^^^^^ + +warning: incorrect NaN comparison, NaN is not orderable + --> $DIR/invalid-nan-comparison.rs:26:5 + | +LL | x <= f16::NAN; + | ^^^^^^^^^^^^^ + +warning: incorrect NaN comparison, NaN is not orderable + --> $DIR/invalid-nan-comparison.rs:28:5 + | +LL | x >= f16::NAN; + | ^^^^^^^^^^^^^ + +warning: incorrect NaN comparison, NaN cannot be directly compared to itself + --> $DIR/invalid-nan-comparison.rs:30:5 + | +LL | number!() == f16::NAN; + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use `f32::is_nan()` or `f64::is_nan()` instead + | +LL - number!() == f16::NAN; +LL + number!().is_nan(); + | + +warning: incorrect NaN comparison, NaN cannot be directly compared to itself + --> $DIR/invalid-nan-comparison.rs:32:5 + | +LL | f16::NAN != number!(); + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use `f32::is_nan()` or `f64::is_nan()` instead + | +LL - f16::NAN != number!(); +LL + !number!().is_nan(); + | + +warning: incorrect NaN comparison, NaN cannot be directly compared to itself + --> $DIR/invalid-nan-comparison.rs:39:5 | LL | x == f32::NAN; | ^^^^^^^^^^^^^ @@ -24,7 +96,7 @@ LL + x.is_nan(); | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison.rs:16:5 + --> $DIR/invalid-nan-comparison.rs:41:5 | LL | x != f32::NAN; | ^^^^^^^^^^^^^ @@ -36,31 +108,31 @@ LL + !x.is_nan(); | warning: incorrect NaN comparison, NaN is not orderable - --> $DIR/invalid-nan-comparison.rs:18:5 + --> $DIR/invalid-nan-comparison.rs:43:5 | LL | x < f32::NAN; | ^^^^^^^^^^^^ warning: incorrect NaN comparison, NaN is not orderable - --> $DIR/invalid-nan-comparison.rs:20:5 + --> $DIR/invalid-nan-comparison.rs:45:5 | LL | x > f32::NAN; | ^^^^^^^^^^^^ warning: incorrect NaN comparison, NaN is not orderable - --> $DIR/invalid-nan-comparison.rs:22:5 + --> $DIR/invalid-nan-comparison.rs:47:5 | LL | x <= f32::NAN; | ^^^^^^^^^^^^^ warning: incorrect NaN comparison, NaN is not orderable - --> $DIR/invalid-nan-comparison.rs:24:5 + --> $DIR/invalid-nan-comparison.rs:49:5 | LL | x >= f32::NAN; | ^^^^^^^^^^^^^ warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison.rs:26:5 + --> $DIR/invalid-nan-comparison.rs:51:5 | LL | number!() == f32::NAN; | ^^^^^^^^^^^^^^^^^^^^^ @@ -72,7 +144,7 @@ LL + number!().is_nan(); | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison.rs:28:5 + --> $DIR/invalid-nan-comparison.rs:53:5 | LL | f32::NAN != number!(); | ^^^^^^^^^^^^^^^^^^^^^ @@ -84,7 +156,7 @@ LL + !number!().is_nan(); | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison.rs:35:5 + --> $DIR/invalid-nan-comparison.rs:60:5 | LL | x == f64::NAN; | ^^^^^^^^^^^^^ @@ -96,7 +168,7 @@ LL + x.is_nan(); | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison.rs:37:5 + --> $DIR/invalid-nan-comparison.rs:62:5 | LL | x != f64::NAN; | ^^^^^^^^^^^^^ @@ -108,31 +180,31 @@ LL + !x.is_nan(); | warning: incorrect NaN comparison, NaN is not orderable - --> $DIR/invalid-nan-comparison.rs:39:5 + --> $DIR/invalid-nan-comparison.rs:64:5 | LL | x < f64::NAN; | ^^^^^^^^^^^^ warning: incorrect NaN comparison, NaN is not orderable - --> $DIR/invalid-nan-comparison.rs:41:5 + --> $DIR/invalid-nan-comparison.rs:66:5 | LL | x > f64::NAN; | ^^^^^^^^^^^^ warning: incorrect NaN comparison, NaN is not orderable - --> $DIR/invalid-nan-comparison.rs:43:5 + --> $DIR/invalid-nan-comparison.rs:68:5 | LL | x <= f64::NAN; | ^^^^^^^^^^^^^ warning: incorrect NaN comparison, NaN is not orderable - --> $DIR/invalid-nan-comparison.rs:45:5 + --> $DIR/invalid-nan-comparison.rs:70:5 | LL | x >= f64::NAN; | ^^^^^^^^^^^^^ warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison.rs:47:5 + --> $DIR/invalid-nan-comparison.rs:72:5 | LL | number!() == f64::NAN; | ^^^^^^^^^^^^^^^^^^^^^ @@ -144,7 +216,7 @@ LL + number!().is_nan(); | warning: incorrect NaN comparison, NaN cannot be directly compared to itself - --> $DIR/invalid-nan-comparison.rs:49:5 + --> $DIR/invalid-nan-comparison.rs:74:5 | LL | f64::NAN != number!(); | ^^^^^^^^^^^^^^^^^^^^^ @@ -155,5 +227,77 @@ LL - f64::NAN != number!(); LL + !number!().is_nan(); | -warning: 17 warnings emitted +warning: incorrect NaN comparison, NaN cannot be directly compared to itself + --> $DIR/invalid-nan-comparison.rs:81:5 + | +LL | x == f128::NAN; + | ^^^^^^^^^^^^^^ + | +help: use `f32::is_nan()` or `f64::is_nan()` instead + | +LL - x == f128::NAN; +LL + x.is_nan(); + | + +warning: incorrect NaN comparison, NaN cannot be directly compared to itself + --> $DIR/invalid-nan-comparison.rs:83:5 + | +LL | x != f128::NAN; + | ^^^^^^^^^^^^^^ + | +help: use `f32::is_nan()` or `f64::is_nan()` instead + | +LL - x != f128::NAN; +LL + !x.is_nan(); + | + +warning: incorrect NaN comparison, NaN is not orderable + --> $DIR/invalid-nan-comparison.rs:85:5 + | +LL | x < f128::NAN; + | ^^^^^^^^^^^^^ + +warning: incorrect NaN comparison, NaN is not orderable + --> $DIR/invalid-nan-comparison.rs:87:5 + | +LL | x > f128::NAN; + | ^^^^^^^^^^^^^ + +warning: incorrect NaN comparison, NaN is not orderable + --> $DIR/invalid-nan-comparison.rs:89:5 + | +LL | x <= f128::NAN; + | ^^^^^^^^^^^^^^ + +warning: incorrect NaN comparison, NaN is not orderable + --> $DIR/invalid-nan-comparison.rs:91:5 + | +LL | x >= f128::NAN; + | ^^^^^^^^^^^^^^ + +warning: incorrect NaN comparison, NaN cannot be directly compared to itself + --> $DIR/invalid-nan-comparison.rs:93:5 + | +LL | number!() == f128::NAN; + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `f32::is_nan()` or `f64::is_nan()` instead + | +LL - number!() == f128::NAN; +LL + number!().is_nan(); + | + +warning: incorrect NaN comparison, NaN cannot be directly compared to itself + --> $DIR/invalid-nan-comparison.rs:95:5 + | +LL | f128::NAN != number!(); + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: use `f32::is_nan()` or `f64::is_nan()` instead + | +LL - f128::NAN != number!(); +LL + !number!().is_nan(); + | + +warning: 33 warnings emitted diff --git a/tests/ui/lint/issue-106991.stderr b/tests/ui/lint/issue-106991.stderr index 9b4fab68102..0441a6377d0 100644 --- a/tests/ui/lint/issue-106991.stderr +++ b/tests/ui/lint/issue-106991.stderr @@ -3,6 +3,9 @@ error[E0271]: expected `foo` to be a fn item that returns `i32`, but it returns | LL | fn bar() -> impl Iterator<Item = i32> { | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `()` +... +LL | x.iter_mut().map(foo) + | --------------------- return type was inferred to be `Map<std::slice::IterMut<'_, Vec<u8>>, for<'a> fn(&'a mut Vec<u8>) {foo}>` here | = note: required for `Map<std::slice::IterMut<'_, Vec<u8>>, for<'a> fn(&'a mut Vec<u8>) {foo}>` to implement `Iterator` diff --git a/tests/ui/lint/keyword-idents/auxiliary/multi_file_submod.rs b/tests/ui/lint/keyword-idents/auxiliary/multi_file_submod.rs new file mode 100644 index 00000000000..08d6733d3e2 --- /dev/null +++ b/tests/ui/lint/keyword-idents/auxiliary/multi_file_submod.rs @@ -0,0 +1,10 @@ +// Submodule file used by test `../multi-file.rs`. + +// Keywords reserved from Rust 2018: +fn async() {} +fn await() {} +fn try() {} +fn dyn() {} + +// Keywords reserved from Rust 2024: +fn gen() {} diff --git a/tests/ui/lint/keyword-idents/multi-file.rs b/tests/ui/lint/keyword-idents/multi-file.rs new file mode 100644 index 00000000000..703e13f9ef6 --- /dev/null +++ b/tests/ui/lint/keyword-idents/multi-file.rs @@ -0,0 +1,14 @@ +#![deny(keyword_idents)] // Should affect the submodule, but doesn't. +//@ edition: 2015 +//@ known-bug: #132218 +//@ check-pass (known bug; should be check-fail) + +// Because `keyword_idents_2018` and `keyword_idents_2024` are pre-expansion +// lints, configuring them via lint attributes doesn't propagate to submodules +// in other files. +// <https://github.com/rust-lang/rust/issues/132218> + +#[path = "./auxiliary/multi_file_submod.rs"] +mod multi_file_submod; + +fn main() {} diff --git a/tests/ui/lint/lint-output-format.stderr b/tests/ui/lint/lint-output-format.stderr index c399b6cdbc2..23a36eb4c87 100644 --- a/tests/ui/lint/lint-output-format.stderr +++ b/tests/ui/lint/lint-output-format.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-output-format.rs:6:1 | LL | extern crate lint_output_format; @@ -7,7 +7,7 @@ LL | extern crate lint_output_format; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-output-format.rs:7:26 | LL | use lint_output_format::{foo, bar}; @@ -16,7 +16,7 @@ LL | use lint_output_format::{foo, bar}; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-output-format.rs:7:31 | LL | use lint_output_format::{foo, bar}; @@ -25,7 +25,7 @@ LL | use lint_output_format::{foo, bar}; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-output-format.rs:12:14 | LL | let _y = bar(); diff --git a/tests/ui/lint/lint-stability-2.rs b/tests/ui/lint/lint-stability-2.rs index 644b12670a6..50e84a6f4a7 100644 --- a/tests/ui/lint/lint-stability-2.rs +++ b/tests/ui/lint/lint-stability-2.rs @@ -66,15 +66,15 @@ mod cross_crate { <Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature foo.method_unstable_text(); - //~^ ERROR use of unstable library feature 'unstable_test_feature': text + //~^ ERROR use of unstable library feature `unstable_test_feature`: text Foo::method_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'unstable_test_feature': text + //~^ ERROR use of unstable library feature `unstable_test_feature`: text <Foo>::method_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'unstable_test_feature': text + //~^ ERROR use of unstable library feature `unstable_test_feature`: text foo.trait_unstable_text(); - //~^ ERROR use of unstable library feature 'unstable_test_feature': text + //~^ ERROR use of unstable library feature `unstable_test_feature`: text <Foo>::trait_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'unstable_test_feature': text + //~^ ERROR use of unstable library feature `unstable_test_feature`: text stable(); foo.method_stable(); @@ -139,9 +139,9 @@ mod cross_crate { foo.trait_unstable(); //~ ERROR use of unstable library feature <Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature foo.trait_unstable_text(); - //~^ ERROR use of unstable library feature 'unstable_test_feature': text + //~^ ERROR use of unstable library feature `unstable_test_feature`: text <Foo>::trait_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'unstable_test_feature': text + //~^ ERROR use of unstable library feature `unstable_test_feature`: text foo.trait_stable(); Trait::trait_stable(&foo); <Foo>::trait_stable(&foo); @@ -157,7 +157,7 @@ mod cross_crate { //~^ ERROR use of unstable library feature foo.trait_unstable(); //~ ERROR use of unstable library feature foo.trait_unstable_text(); - //~^ ERROR use of unstable library feature 'unstable_test_feature': text + //~^ ERROR use of unstable library feature `unstable_test_feature`: text foo.trait_stable(); } diff --git a/tests/ui/lint/lint-stability-2.stderr b/tests/ui/lint/lint-stability-2.stderr index 20d49780a91..b3357bfe232 100644 --- a/tests/ui/lint/lint-stability-2.stderr +++ b/tests/ui/lint/lint-stability-2.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:40:13 | LL | foo.method_deprecated_unstable(); @@ -7,7 +7,7 @@ LL | foo.method_deprecated_unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:42:9 | LL | Foo::method_deprecated_unstable(&foo); @@ -16,7 +16,7 @@ LL | Foo::method_deprecated_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:44:9 | LL | <Foo>::method_deprecated_unstable(&foo); @@ -25,7 +25,7 @@ LL | <Foo>::method_deprecated_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:46:13 | LL | foo.trait_deprecated_unstable(); @@ -34,7 +34,7 @@ LL | foo.trait_deprecated_unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:48:9 | LL | <Foo>::trait_deprecated_unstable(&foo); @@ -43,7 +43,7 @@ LL | <Foo>::trait_deprecated_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:51:13 | LL | foo.method_deprecated_unstable_text(); @@ -52,7 +52,7 @@ LL | foo.method_deprecated_unstable_text(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:53:9 | LL | Foo::method_deprecated_unstable_text(&foo); @@ -61,7 +61,7 @@ LL | Foo::method_deprecated_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:55:9 | LL | <Foo>::method_deprecated_unstable_text(&foo); @@ -70,7 +70,7 @@ LL | <Foo>::method_deprecated_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:57:13 | LL | foo.trait_deprecated_unstable_text(); @@ -79,7 +79,7 @@ LL | foo.trait_deprecated_unstable_text(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:59:9 | LL | <Foo>::trait_deprecated_unstable_text(&foo); @@ -88,7 +88,7 @@ LL | <Foo>::trait_deprecated_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:62:13 | LL | foo.method_unstable(); @@ -97,7 +97,7 @@ LL | foo.method_unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:63:9 | LL | Foo::method_unstable(&foo); @@ -106,7 +106,7 @@ LL | Foo::method_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:64:9 | LL | <Foo>::method_unstable(&foo); @@ -115,7 +115,7 @@ LL | <Foo>::method_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:65:13 | LL | foo.trait_unstable(); @@ -124,7 +124,7 @@ LL | foo.trait_unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:66:9 | LL | <Foo>::trait_unstable(&foo); @@ -133,7 +133,7 @@ LL | <Foo>::trait_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/lint-stability-2.rs:68:13 | LL | foo.method_unstable_text(); @@ -142,7 +142,7 @@ LL | foo.method_unstable_text(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/lint-stability-2.rs:70:9 | LL | Foo::method_unstable_text(&foo); @@ -151,7 +151,7 @@ LL | Foo::method_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/lint-stability-2.rs:72:9 | LL | <Foo>::method_unstable_text(&foo); @@ -160,7 +160,7 @@ LL | <Foo>::method_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/lint-stability-2.rs:74:13 | LL | foo.trait_unstable_text(); @@ -169,7 +169,7 @@ LL | foo.trait_unstable_text(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/lint-stability-2.rs:76:9 | LL | <Foo>::trait_unstable_text(&foo); @@ -178,7 +178,7 @@ LL | <Foo>::trait_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:131:13 | LL | foo.trait_deprecated_unstable(); @@ -187,7 +187,7 @@ LL | foo.trait_deprecated_unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:133:9 | LL | <Foo>::trait_deprecated_unstable(&foo); @@ -196,7 +196,7 @@ LL | <Foo>::trait_deprecated_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:135:13 | LL | foo.trait_deprecated_unstable_text(); @@ -205,7 +205,7 @@ LL | foo.trait_deprecated_unstable_text(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:137:9 | LL | <Foo>::trait_deprecated_unstable_text(&foo); @@ -214,7 +214,7 @@ LL | <Foo>::trait_deprecated_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:139:13 | LL | foo.trait_unstable(); @@ -223,7 +223,7 @@ LL | foo.trait_unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:140:9 | LL | <Foo>::trait_unstable(&foo); @@ -232,7 +232,7 @@ LL | <Foo>::trait_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/lint-stability-2.rs:141:13 | LL | foo.trait_unstable_text(); @@ -241,7 +241,7 @@ LL | foo.trait_unstable_text(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/lint-stability-2.rs:143:9 | LL | <Foo>::trait_unstable_text(&foo); @@ -250,7 +250,7 @@ LL | <Foo>::trait_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:154:13 | LL | foo.trait_deprecated_unstable(); @@ -259,7 +259,7 @@ LL | foo.trait_deprecated_unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:156:13 | LL | foo.trait_deprecated_unstable_text(); @@ -268,7 +268,7 @@ LL | foo.trait_deprecated_unstable_text(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-2.rs:158:13 | LL | foo.trait_unstable(); @@ -277,7 +277,7 @@ LL | foo.trait_unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/lint-stability-2.rs:159:13 | LL | foo.trait_unstable_text(); diff --git a/tests/ui/lint/lint-stability-fields.stderr b/tests/ui/lint/lint-stability-fields.stderr index 9dffe94c12e..9cd3753cc3b 100644 --- a/tests/ui/lint/lint-stability-fields.stderr +++ b/tests/ui/lint/lint-stability-fields.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:56:17 | LL | let x = Unstable { @@ -7,7 +7,7 @@ LL | let x = Unstable { = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:66:13 | LL | let Unstable { @@ -16,7 +16,7 @@ LL | let Unstable { = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:72:13 | LL | let Unstable @@ -25,7 +25,7 @@ LL | let Unstable = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:77:17 | LL | let x = reexport::Unstable2(1, 2, 3); @@ -34,7 +34,7 @@ LL | let x = reexport::Unstable2(1, 2, 3); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:79:17 | LL | let x = Unstable2(1, 2, 3); @@ -43,7 +43,7 @@ LL | let x = Unstable2(1, 2, 3); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:85:13 | LL | let Unstable2 @@ -52,7 +52,7 @@ LL | let Unstable2 = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:90:13 | LL | let Unstable2 @@ -61,7 +61,7 @@ LL | let Unstable2 = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:95:17 | LL | let x = Deprecated { @@ -70,7 +70,7 @@ LL | let x = Deprecated { = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:105:13 | LL | let Deprecated { @@ -79,7 +79,7 @@ LL | let Deprecated { = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:111:13 | LL | let Deprecated @@ -88,7 +88,7 @@ LL | let Deprecated = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:115:17 | LL | let x = Deprecated2(1, 2, 3); @@ -97,7 +97,7 @@ LL | let x = Deprecated2(1, 2, 3); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:121:13 | LL | let Deprecated2 @@ -106,7 +106,7 @@ LL | let Deprecated2 = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:126:13 | LL | let Deprecated2 @@ -115,7 +115,7 @@ LL | let Deprecated2 = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:21:13 | LL | override1: 2, @@ -124,7 +124,7 @@ LL | override1: 2, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:22:13 | LL | override2: 3, @@ -133,7 +133,7 @@ LL | override2: 3, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:27:17 | LL | let _ = x.override1; @@ -142,7 +142,7 @@ LL | let _ = x.override1; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:28:17 | LL | let _ = x.override2; @@ -151,7 +151,7 @@ LL | let _ = x.override2; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:33:13 | LL | override1: _, @@ -160,7 +160,7 @@ LL | override1: _, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:34:13 | LL | override2: _, @@ -169,7 +169,7 @@ LL | override2: _, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:43:17 | LL | let _ = x.1; @@ -178,7 +178,7 @@ LL | let _ = x.1; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:44:17 | LL | let _ = x.2; @@ -187,7 +187,7 @@ LL | let _ = x.2; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:48:20 | LL | _, @@ -196,7 +196,7 @@ LL | _, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:49:20 | LL | _, @@ -205,7 +205,7 @@ LL | _, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:57:13 | LL | inherit: 1, @@ -214,7 +214,7 @@ LL | inherit: 1, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:59:13 | LL | override2: 3, @@ -223,7 +223,7 @@ LL | override2: 3, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:62:17 | LL | let _ = x.inherit; @@ -232,7 +232,7 @@ LL | let _ = x.inherit; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:64:17 | LL | let _ = x.override2; @@ -241,7 +241,7 @@ LL | let _ = x.override2; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:67:13 | LL | inherit: _, @@ -250,7 +250,7 @@ LL | inherit: _, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:69:13 | LL | override2: _ @@ -259,7 +259,7 @@ LL | override2: _ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:81:17 | LL | let _ = x.0; @@ -268,7 +268,7 @@ LL | let _ = x.0; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:83:17 | LL | let _ = x.2; @@ -277,7 +277,7 @@ LL | let _ = x.2; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:86:14 | LL | (_, @@ -286,7 +286,7 @@ LL | (_, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:88:14 | LL | _) @@ -295,7 +295,7 @@ LL | _) = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:96:13 | LL | inherit: 1, @@ -304,7 +304,7 @@ LL | inherit: 1, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:98:13 | LL | override2: 3, @@ -313,7 +313,7 @@ LL | override2: 3, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:101:17 | LL | let _ = x.inherit; @@ -322,7 +322,7 @@ LL | let _ = x.inherit; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:103:17 | LL | let _ = x.override2; @@ -331,7 +331,7 @@ LL | let _ = x.override2; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:106:13 | LL | inherit: _, @@ -340,7 +340,7 @@ LL | inherit: _, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:108:13 | LL | override2: _ @@ -349,7 +349,7 @@ LL | override2: _ = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:117:17 | LL | let _ = x.0; @@ -358,7 +358,7 @@ LL | let _ = x.0; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:119:17 | LL | let _ = x.2; @@ -367,7 +367,7 @@ LL | let _ = x.2; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:122:14 | LL | (_, @@ -376,7 +376,7 @@ LL | (_, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability-fields.rs:124:14 | LL | _) diff --git a/tests/ui/lint/lint-stability.rs b/tests/ui/lint/lint-stability.rs index eaf9796df6a..f080b5e4bbe 100644 --- a/tests/ui/lint/lint-stability.rs +++ b/tests/ui/lint/lint-stability.rs @@ -61,11 +61,11 @@ mod cross_crate { <Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature unstable_text(); - //~^ ERROR use of unstable library feature 'unstable_test_feature': text + //~^ ERROR use of unstable library feature `unstable_test_feature`: text Trait::trait_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'unstable_test_feature': text + //~^ ERROR use of unstable library feature `unstable_test_feature`: text <Foo as Trait>::trait_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'unstable_test_feature': text + //~^ ERROR use of unstable library feature `unstable_test_feature`: text stable(); foo.method_stable(); @@ -152,9 +152,9 @@ mod cross_crate { Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature <Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature Trait::trait_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'unstable_test_feature': text + //~^ ERROR use of unstable library feature `unstable_test_feature`: text <Foo as Trait>::trait_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'unstable_test_feature': text + //~^ ERROR use of unstable library feature `unstable_test_feature`: text foo.trait_stable(); Trait::trait_stable(&foo); <Foo>::trait_stable(&foo); diff --git a/tests/ui/lint/lint-stability.stderr b/tests/ui/lint/lint-stability.stderr index af5816d4564..a22fce70a4a 100644 --- a/tests/ui/lint/lint-stability.stderr +++ b/tests/ui/lint/lint-stability.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:17:5 | LL | extern crate stability_cfg2; @@ -7,7 +7,7 @@ LL | extern crate stability_cfg2; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:45:9 | LL | deprecated_unstable(); @@ -16,7 +16,7 @@ LL | deprecated_unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:47:9 | LL | Trait::trait_deprecated_unstable(&foo); @@ -25,7 +25,7 @@ LL | Trait::trait_deprecated_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:49:9 | LL | <Foo as Trait>::trait_deprecated_unstable(&foo); @@ -34,7 +34,7 @@ LL | <Foo as Trait>::trait_deprecated_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:52:9 | LL | deprecated_unstable_text(); @@ -43,7 +43,7 @@ LL | deprecated_unstable_text(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:54:9 | LL | Trait::trait_deprecated_unstable_text(&foo); @@ -52,7 +52,7 @@ LL | Trait::trait_deprecated_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:56:9 | LL | <Foo as Trait>::trait_deprecated_unstable_text(&foo); @@ -61,7 +61,7 @@ LL | <Foo as Trait>::trait_deprecated_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:59:9 | LL | unstable(); @@ -70,7 +70,7 @@ LL | unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:60:9 | LL | Trait::trait_unstable(&foo); @@ -79,7 +79,7 @@ LL | Trait::trait_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:61:9 | LL | <Foo as Trait>::trait_unstable(&foo); @@ -88,7 +88,7 @@ LL | <Foo as Trait>::trait_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/lint-stability.rs:63:9 | LL | unstable_text(); @@ -97,7 +97,7 @@ LL | unstable_text(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/lint-stability.rs:65:9 | LL | Trait::trait_unstable_text(&foo); @@ -106,7 +106,7 @@ LL | Trait::trait_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/lint-stability.rs:67:9 | LL | <Foo as Trait>::trait_unstable_text(&foo); @@ -115,7 +115,7 @@ LL | <Foo as Trait>::trait_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:99:17 | LL | let _ = DeprecatedUnstableStruct { @@ -124,7 +124,7 @@ LL | let _ = DeprecatedUnstableStruct { = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:103:17 | LL | let _ = UnstableStruct { i: 0 }; @@ -133,7 +133,7 @@ LL | let _ = UnstableStruct { i: 0 }; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:107:17 | LL | let _ = DeprecatedUnstableUnitStruct; @@ -142,7 +142,7 @@ LL | let _ = DeprecatedUnstableUnitStruct; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:109:17 | LL | let _ = UnstableUnitStruct; @@ -151,7 +151,7 @@ LL | let _ = UnstableUnitStruct; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:113:17 | LL | let _ = Enum::DeprecatedUnstableVariant; @@ -160,7 +160,7 @@ LL | let _ = Enum::DeprecatedUnstableVariant; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:115:17 | LL | let _ = Enum::UnstableVariant; @@ -169,7 +169,7 @@ LL | let _ = Enum::UnstableVariant; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:119:17 | LL | let _ = DeprecatedUnstableTupleStruct (1); @@ -178,7 +178,7 @@ LL | let _ = DeprecatedUnstableTupleStruct (1); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:121:17 | LL | let _ = UnstableTupleStruct (1); @@ -187,7 +187,7 @@ LL | let _ = UnstableTupleStruct (1); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:130:25 | LL | macro_test_arg!(deprecated_unstable_text()); @@ -196,7 +196,7 @@ LL | macro_test_arg!(deprecated_unstable_text()); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:144:9 | LL | Trait::trait_deprecated_unstable(&foo); @@ -205,7 +205,7 @@ LL | Trait::trait_deprecated_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:146:9 | LL | <Foo as Trait>::trait_deprecated_unstable(&foo); @@ -214,7 +214,7 @@ LL | <Foo as Trait>::trait_deprecated_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:148:9 | LL | Trait::trait_deprecated_unstable_text(&foo); @@ -223,7 +223,7 @@ LL | Trait::trait_deprecated_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:150:9 | LL | <Foo as Trait>::trait_deprecated_unstable_text(&foo); @@ -232,7 +232,7 @@ LL | <Foo as Trait>::trait_deprecated_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:152:9 | LL | Trait::trait_unstable(&foo); @@ -241,7 +241,7 @@ LL | Trait::trait_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:153:9 | LL | <Foo as Trait>::trait_unstable(&foo); @@ -250,7 +250,7 @@ LL | <Foo as Trait>::trait_unstable(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/lint-stability.rs:154:9 | LL | Trait::trait_unstable_text(&foo); @@ -259,7 +259,7 @@ LL | Trait::trait_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/lint-stability.rs:156:9 | LL | <Foo as Trait>::trait_unstable_text(&foo); @@ -268,7 +268,7 @@ LL | <Foo as Trait>::trait_unstable_text(&foo); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:172:10 | LL | impl UnstableTrait for S { } @@ -277,7 +277,7 @@ LL | impl UnstableTrait for S { } = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:174:24 | LL | trait LocalTrait : UnstableTrait { } @@ -286,7 +286,7 @@ LL | trait LocalTrait : UnstableTrait { } = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:179:9 | LL | fn trait_unstable(&self) {} @@ -295,7 +295,7 @@ LL | fn trait_unstable(&self) {} = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:184:5 | LL | extern crate inherited_stability; @@ -304,7 +304,7 @@ LL | extern crate inherited_stability; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:185:9 | LL | use self::inherited_stability::*; @@ -313,7 +313,7 @@ LL | use self::inherited_stability::*; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:188:9 | LL | unstable(); @@ -322,7 +322,7 @@ LL | unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:191:9 | LL | stable_mod::unstable(); @@ -331,7 +331,7 @@ LL | stable_mod::unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:194:9 | LL | unstable_mod::deprecated(); @@ -340,7 +340,7 @@ LL | unstable_mod::deprecated(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:195:9 | LL | unstable_mod::unstable(); @@ -349,7 +349,7 @@ LL | unstable_mod::unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:197:17 | LL | let _ = Unstable::UnstableVariant; @@ -358,7 +358,7 @@ LL | let _ = Unstable::UnstableVariant; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:198:17 | LL | let _ = Unstable::StableVariant; @@ -367,7 +367,7 @@ LL | let _ = Unstable::StableVariant; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:88:48 | LL | struct S1<T: TraitWithAssociatedTypes>(T::TypeUnstable); @@ -376,7 +376,7 @@ LL | struct S1<T: TraitWithAssociatedTypes>(T::TypeUnstable); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/lint-stability.rs:92:13 | LL | TypeUnstable = u8, diff --git a/tests/ui/lint/lint-temporary-cstring-as-param.stderr b/tests/ui/lint/lint-temporary-cstring-as-param.stderr deleted file mode 100644 index 7aa21f2560c..00000000000 --- a/tests/ui/lint/lint-temporary-cstring-as-param.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: getting the inner pointer of a temporary `CString` - --> $DIR/lint-temporary-cstring-as-param.rs:9:45 - | -LL | some_function(CString::new("").unwrap().as_ptr()); - | ------------------------- ^^^^^^ this pointer will be invalid - | | - | this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime - | - = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned - = help: for more information, see https://doc.rust-lang.org/reference/destructors.html -note: the lint level is defined here - --> $DIR/lint-temporary-cstring-as-param.rs:1:9 - | -LL | #![deny(temporary_cstring_as_ptr)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/lint/non-local-defs/convoluted-locals-132427.rs b/tests/ui/lint/non-local-defs/convoluted-locals-132427.rs new file mode 100644 index 00000000000..5732e048ae3 --- /dev/null +++ b/tests/ui/lint/non-local-defs/convoluted-locals-132427.rs @@ -0,0 +1,64 @@ +// Regression tests for https://github.com/rust-lang/rust/issues/132427 + +//@ check-pass + +// original +mod auth { + const _: () = { + pub enum ArbitraryContext {} + + const _: () = { + impl ArbitraryContext {} + }; + }; +} + +mod z { + pub enum ArbitraryContext {} + + const _: () = { + const _: () = { + impl ArbitraryContext {} + }; + }; +} + +const _: () = { + mod auth { + const _: () = { + pub enum ArbitraryContext {} + + const _: () = { + impl ArbitraryContext {} + }; + }; + } +}; + +mod a { + mod b { + const _: () = { + pub enum ArbitraryContext {} + + const _: () = { + impl ArbitraryContext {} + }; + }; + } +} + +mod foo { + const _: () = { + mod auth { + const _: () = { + pub enum ArbitraryContext {} + + const _: () = { + impl ArbitraryContext {} + }; + }; + } + }; +} + +fn main() {} diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.cdylib_.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.cdylib_.stderr index 140d72b9742..1192b690e29 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.cdylib_.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.cdylib_.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:29:18 + --> $DIR/lint-non-snake-case-crate.rs:36:18 | LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate.rs:31:9 + --> $DIR/lint-non-snake-case-crate.rs:38:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.dylib_.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.dylib_.stderr index 140d72b9742..1192b690e29 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.dylib_.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.dylib_.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:29:18 + --> $DIR/lint-non-snake-case-crate.rs:36:18 | LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate.rs:31:9 + --> $DIR/lint-non-snake-case-crate.rs:38:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.lib_.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.lib_.stderr index 140d72b9742..1192b690e29 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.lib_.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.lib_.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:29:18 + --> $DIR/lint-non-snake-case-crate.rs:36:18 | LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate.rs:31:9 + --> $DIR/lint-non-snake-case-crate.rs:38:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.proc_macro_.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.proc_macro_.stderr index 140d72b9742..1192b690e29 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.proc_macro_.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.proc_macro_.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:29:18 + --> $DIR/lint-non-snake-case-crate.rs:36:18 | LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate.rs:31:9 + --> $DIR/lint-non-snake-case-crate.rs:38:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rlib_.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rlib_.stderr index 140d72b9742..1192b690e29 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rlib_.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rlib_.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:29:18 + --> $DIR/lint-non-snake-case-crate.rs:36:18 | LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate.rs:31:9 + --> $DIR/lint-non-snake-case-crate.rs:38:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs index 097b246c165..6f701cd27c6 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs @@ -10,10 +10,17 @@ // But should fire on non-binary crates. -//@[cdylib_] ignore-musl (dylibs are not supported) -//@[dylib_] ignore-musl (dylibs are not supported) -//@[dylib_] ignore-wasm (dylib is not supported) -//@[proc_macro_] ignore-wasm (dylib is not supported) +// FIXME(#132309): dylib crate type is not supported on wasm; we need a proper +// supports-crate-type directive. Also, needs-dynamic-linking should rule out +// musl since it supports neither dylibs nor cdylibs. +//@[dylib_] ignore-wasm +//@[dylib_] ignore-musl +//@[cdylib_] ignore-musl + +//@[dylib_] needs-dynamic-linking +//@[cdylib_] needs-dynamic-linking +//@[proc_macro_] force-host +//@[proc_macro_] no-prefer-dynamic //@[cdylib_] compile-flags: --crate-type=cdylib //@[dylib_] compile-flags: --crate-type=dylib diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.staticlib_.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.staticlib_.stderr index 140d72b9742..1192b690e29 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.staticlib_.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.staticlib_.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:29:18 + --> $DIR/lint-non-snake-case-crate.rs:36:18 | LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate.rs:31:9 + --> $DIR/lint-non-snake-case-crate.rs:38:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/macros/assert-trailing-junk.with-generic-asset.stderr b/tests/ui/macros/assert-trailing-junk.with-generic-asset.stderr index 1e73320e439..7582c8e8659 100644 --- a/tests/ui/macros/assert-trailing-junk.with-generic-asset.stderr +++ b/tests/ui/macros/assert-trailing-junk.with-generic-asset.stderr @@ -10,7 +10,7 @@ error: expected one of `,`, `.`, `?`, or an operator, found `some` LL | assert!(true some extra junk); | ^^^^ expected one of `,`, `.`, `?`, or an operator -error: no rules expected the token `blah` +error: no rules expected `blah` --> $DIR/assert-trailing-junk.rs:15:30 | LL | assert!(true, "whatever" blah); @@ -28,7 +28,7 @@ LL | assert!(true "whatever" blah); | | | help: try adding a comma -error: no rules expected the token `blah` +error: no rules expected `blah` --> $DIR/assert-trailing-junk.rs:18:29 | LL | assert!(true "whatever" blah); diff --git a/tests/ui/macros/assert-trailing-junk.without-generic-asset.stderr b/tests/ui/macros/assert-trailing-junk.without-generic-asset.stderr index 1e73320e439..7582c8e8659 100644 --- a/tests/ui/macros/assert-trailing-junk.without-generic-asset.stderr +++ b/tests/ui/macros/assert-trailing-junk.without-generic-asset.stderr @@ -10,7 +10,7 @@ error: expected one of `,`, `.`, `?`, or an operator, found `some` LL | assert!(true some extra junk); | ^^^^ expected one of `,`, `.`, `?`, or an operator -error: no rules expected the token `blah` +error: no rules expected `blah` --> $DIR/assert-trailing-junk.rs:15:30 | LL | assert!(true, "whatever" blah); @@ -28,7 +28,7 @@ LL | assert!(true "whatever" blah); | | | help: try adding a comma -error: no rules expected the token `blah` +error: no rules expected `blah` --> $DIR/assert-trailing-junk.rs:18:29 | LL | assert!(true "whatever" blah); diff --git a/tests/ui/macros/best-failure.rs b/tests/ui/macros/best-failure.rs index bbdd465d5ec..1b73066c874 100644 --- a/tests/ui/macros/best-failure.rs +++ b/tests/ui/macros/best-failure.rs @@ -2,7 +2,7 @@ macro_rules! number { (neg false, $self:ident) => { $self }; ($signed:tt => $ty:ty;) => { number!(neg $signed, $self); - //~^ ERROR no rules expected the token `$` + //~^ ERROR no rules expected `$` }; } diff --git a/tests/ui/macros/best-failure.stderr b/tests/ui/macros/best-failure.stderr index c5f8b9abc19..914ff7fd820 100644 --- a/tests/ui/macros/best-failure.stderr +++ b/tests/ui/macros/best-failure.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `$` +error: no rules expected `$` --> $DIR/best-failure.rs:4:30 | LL | macro_rules! number { diff --git a/tests/ui/macros/expr_2021_inline_const.edi2021.stderr b/tests/ui/macros/expr_2021_inline_const.edi2021.stderr index 22d662aaaf2..bf7eb3888b3 100644 --- a/tests/ui/macros/expr_2021_inline_const.edi2021.stderr +++ b/tests/ui/macros/expr_2021_inline_const.edi2021.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `const` +error: no rules expected keyword `const` --> $DIR/expr_2021_inline_const.rs:23:12 | LL | macro_rules! m2021 { @@ -13,7 +13,7 @@ note: while trying to match meta-variable `$e:expr_2021` LL | ($e:expr_2021) => { | ^^^^^^^^^^^^ -error: no rules expected the token `const` +error: no rules expected keyword `const` --> $DIR/expr_2021_inline_const.rs:24:12 | LL | macro_rules! m2024 { diff --git a/tests/ui/macros/expr_2021_inline_const.edi2024.stderr b/tests/ui/macros/expr_2021_inline_const.edi2024.stderr index 2555e4f757a..1028ddc4267 100644 --- a/tests/ui/macros/expr_2021_inline_const.edi2024.stderr +++ b/tests/ui/macros/expr_2021_inline_const.edi2024.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `const` +error: no rules expected keyword `const` --> $DIR/expr_2021_inline_const.rs:23:12 | LL | macro_rules! m2021 { diff --git a/tests/ui/macros/expr_2021_inline_const.rs b/tests/ui/macros/expr_2021_inline_const.rs index 39a542fe4d9..312256f1879 100644 --- a/tests/ui/macros/expr_2021_inline_const.rs +++ b/tests/ui/macros/expr_2021_inline_const.rs @@ -20,8 +20,8 @@ macro_rules! test { } fn main() { - m2021!(const { 1 }); //~ ERROR: no rules expected the token `const` - m2024!(const { 1 }); //[edi2021]~ ERROR: no rules expected the token `const` + m2021!(const { 1 }); //~ ERROR: no rules expected keyword `const` + m2024!(const { 1 }); //[edi2021]~ ERROR: no rules expected keyword `const` test!(expr); } diff --git a/tests/ui/macros/expr_2024_underscore_expr.edi2021.stderr b/tests/ui/macros/expr_2024_underscore_expr.edi2021.stderr index 34df20a69ef..7b3ca54bb71 100644 --- a/tests/ui/macros/expr_2024_underscore_expr.edi2021.stderr +++ b/tests/ui/macros/expr_2024_underscore_expr.edi2021.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `_` +error: no rules expected reserved identifier `_` --> $DIR/expr_2024_underscore_expr.rs:19:12 | LL | macro_rules! m2021 { @@ -13,7 +13,7 @@ note: while trying to match meta-variable `$e:expr_2021` LL | ($e:expr_2021) => { | ^^^^^^^^^^^^ -error: no rules expected the token `_` +error: no rules expected reserved identifier `_` --> $DIR/expr_2024_underscore_expr.rs:20:12 | LL | macro_rules! m2024 { diff --git a/tests/ui/macros/expr_2024_underscore_expr.edi2024.stderr b/tests/ui/macros/expr_2024_underscore_expr.edi2024.stderr index 372c5d8637c..59104dafa18 100644 --- a/tests/ui/macros/expr_2024_underscore_expr.edi2024.stderr +++ b/tests/ui/macros/expr_2024_underscore_expr.edi2024.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `_` +error: no rules expected reserved identifier `_` --> $DIR/expr_2024_underscore_expr.rs:19:12 | LL | macro_rules! m2021 { diff --git a/tests/ui/macros/expr_2024_underscore_expr.rs b/tests/ui/macros/expr_2024_underscore_expr.rs index 86e31374506..6f8ec139109 100644 --- a/tests/ui/macros/expr_2024_underscore_expr.rs +++ b/tests/ui/macros/expr_2024_underscore_expr.rs @@ -16,6 +16,6 @@ macro_rules! m2024 { } fn main() { - m2021!(_); //~ ERROR: no rules expected the token `_` - m2024!(_); //[edi2021]~ ERROR: no rules expected the token `_` + m2021!(_); //~ ERROR: no rules expected reserved identifier `_` + m2024!(_); //[edi2021]~ ERROR: no rules expected reserved identifier `_` } diff --git a/tests/ui/macros/issue-118786.rs b/tests/ui/macros/issue-118786.rs index a41372e4ea8..a73b737fe07 100644 --- a/tests/ui/macros/issue-118786.rs +++ b/tests/ui/macros/issue-118786.rs @@ -5,7 +5,7 @@ macro_rules! make_macro { ($macro_name:tt) => { macro_rules! $macro_name { - //~^ ERROR macro expansion ignores token `{` and any following + //~^ ERROR macro expansion ignores `{` and any tokens following //~| ERROR cannot find macro `macro_rules` in this scope //~| put a macro name here () => {} diff --git a/tests/ui/macros/issue-118786.stderr b/tests/ui/macros/issue-118786.stderr index 256b742ee16..7fa5c2b83dd 100644 --- a/tests/ui/macros/issue-118786.stderr +++ b/tests/ui/macros/issue-118786.stderr @@ -13,7 +13,7 @@ help: add a semicolon LL | macro_rules! $macro_name; { | + -error: macro expansion ignores token `{` and any following +error: macro expansion ignores `{` and any tokens following --> $DIR/issue-118786.rs:7:34 | LL | macro_rules! $macro_name { diff --git a/tests/ui/macros/issue-30007.rs b/tests/ui/macros/issue-30007.rs index 918a821bae9..e36e47a3e7c 100644 --- a/tests/ui/macros/issue-30007.rs +++ b/tests/ui/macros/issue-30007.rs @@ -1,5 +1,5 @@ macro_rules! t { - () => ( String ; ); //~ ERROR macro expansion ignores token `;` + () => ( String ; ); //~ ERROR macro expansion ignores `;` } fn main() { diff --git a/tests/ui/macros/issue-30007.stderr b/tests/ui/macros/issue-30007.stderr index f303221cf8a..129733ed69a 100644 --- a/tests/ui/macros/issue-30007.stderr +++ b/tests/ui/macros/issue-30007.stderr @@ -1,4 +1,4 @@ -error: macro expansion ignores token `;` and any following +error: macro expansion ignores `;` and any tokens following --> $DIR/issue-30007.rs:2:20 | LL | () => ( String ; ); diff --git a/tests/ui/macros/issue-54441.rs b/tests/ui/macros/issue-54441.rs index b24d7e1f6be..37ab4e63647 100644 --- a/tests/ui/macros/issue-54441.rs +++ b/tests/ui/macros/issue-54441.rs @@ -1,6 +1,6 @@ macro_rules! m { () => { - let //~ ERROR macro expansion ignores token `let` and any following + let //~ ERROR macro expansion ignores keyword `let` and any tokens following }; } diff --git a/tests/ui/macros/issue-54441.stderr b/tests/ui/macros/issue-54441.stderr index fb2c103139b..f5f8b8ca2b2 100644 --- a/tests/ui/macros/issue-54441.stderr +++ b/tests/ui/macros/issue-54441.stderr @@ -1,4 +1,4 @@ -error: macro expansion ignores token `let` and any following +error: macro expansion ignores keyword `let` and any tokens following --> $DIR/issue-54441.rs:3:9 | LL | let diff --git a/tests/ui/macros/macro-at-most-once-rep-2015.rs b/tests/ui/macros/macro-at-most-once-rep-2015.rs index 8f2531a25ae..08967b82531 100644 --- a/tests/ui/macros/macro-at-most-once-rep-2015.rs +++ b/tests/ui/macros/macro-at-most-once-rep-2015.rs @@ -22,21 +22,21 @@ macro_rules! barstar { pub fn main() { foo!(); foo!(a); - foo!(a?); //~ ERROR no rules expected the token `?` - foo!(a?a); //~ ERROR no rules expected the token `?` - foo!(a?a?a); //~ ERROR no rules expected the token `?` + foo!(a?); //~ ERROR no rules expected `?` + foo!(a?a); //~ ERROR no rules expected `?` + foo!(a?a?a); //~ ERROR no rules expected `?` barplus!(); //~ERROR unexpected end of macro invocation barplus!(a); //~ERROR unexpected end of macro invocation - barplus!(a?); //~ ERROR no rules expected the token `?` - barplus!(a?a); //~ ERROR no rules expected the token `?` + barplus!(a?); //~ ERROR no rules expected `?` + barplus!(a?a); //~ ERROR no rules expected `?` barplus!(a+); barplus!(+); barstar!(); //~ERROR unexpected end of macro invocation barstar!(a); //~ERROR unexpected end of macro invocation - barstar!(a?); //~ ERROR no rules expected the token `?` - barstar!(a?a); //~ ERROR no rules expected the token `?` + barstar!(a?); //~ ERROR no rules expected `?` + barstar!(a?a); //~ ERROR no rules expected `?` barstar!(a*); barstar!(*); } diff --git a/tests/ui/macros/macro-at-most-once-rep-2015.stderr b/tests/ui/macros/macro-at-most-once-rep-2015.stderr index 7c45b85bc8d..7f161cdc8d0 100644 --- a/tests/ui/macros/macro-at-most-once-rep-2015.stderr +++ b/tests/ui/macros/macro-at-most-once-rep-2015.stderr @@ -4,7 +4,7 @@ error: the `?` macro repetition operator does not take a separator LL | ($(a),?) => {}; | ^ -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2015.rs:25:11 | LL | macro_rules! foo { @@ -15,7 +15,7 @@ LL | foo!(a?); | = note: while trying to match sequence end -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2015.rs:26:11 | LL | macro_rules! foo { @@ -26,7 +26,7 @@ LL | foo!(a?a); | = note: while trying to match sequence end -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2015.rs:27:11 | LL | macro_rules! foo { @@ -67,7 +67,7 @@ note: while trying to match `+` LL | ($(a)?+) => {}; // ok. matches "a+" and "+" | ^ -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2015.rs:31:15 | LL | macro_rules! barplus { @@ -82,7 +82,7 @@ note: while trying to match `+` LL | ($(a)?+) => {}; // ok. matches "a+" and "+" | ^ -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2015.rs:32:15 | LL | macro_rules! barplus { @@ -127,7 +127,7 @@ note: while trying to match `*` LL | ($(a)?*) => {}; // ok. matches "a*" and "*" | ^ -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2015.rs:38:15 | LL | macro_rules! barstar { @@ -142,7 +142,7 @@ note: while trying to match `*` LL | ($(a)?*) => {}; // ok. matches "a*" and "*" | ^ -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2015.rs:39:15 | LL | macro_rules! barstar { diff --git a/tests/ui/macros/macro-at-most-once-rep-2018.rs b/tests/ui/macros/macro-at-most-once-rep-2018.rs index 7f43055ded6..98fbb2ad207 100644 --- a/tests/ui/macros/macro-at-most-once-rep-2018.rs +++ b/tests/ui/macros/macro-at-most-once-rep-2018.rs @@ -22,21 +22,21 @@ macro_rules! barstar { pub fn main() { foo!(); foo!(a); - foo!(a?); //~ ERROR no rules expected the token `?` - foo!(a?a); //~ ERROR no rules expected the token `?` - foo!(a?a?a); //~ ERROR no rules expected the token `?` + foo!(a?); //~ ERROR no rules expected `?` + foo!(a?a); //~ ERROR no rules expected `?` + foo!(a?a?a); //~ ERROR no rules expected `?` barplus!(); //~ERROR unexpected end of macro invocation barplus!(a); //~ERROR unexpected end of macro invocation - barplus!(a?); //~ ERROR no rules expected the token `?` - barplus!(a?a); //~ ERROR no rules expected the token `?` + barplus!(a?); //~ ERROR no rules expected `?` + barplus!(a?a); //~ ERROR no rules expected `?` barplus!(a+); barplus!(+); barstar!(); //~ERROR unexpected end of macro invocation barstar!(a); //~ERROR unexpected end of macro invocation - barstar!(a?); //~ ERROR no rules expected the token `?` - barstar!(a?a); //~ ERROR no rules expected the token `?` + barstar!(a?); //~ ERROR no rules expected `?` + barstar!(a?a); //~ ERROR no rules expected `?` barstar!(a*); barstar!(*); } diff --git a/tests/ui/macros/macro-at-most-once-rep-2018.stderr b/tests/ui/macros/macro-at-most-once-rep-2018.stderr index 696520b2826..f165a199b10 100644 --- a/tests/ui/macros/macro-at-most-once-rep-2018.stderr +++ b/tests/ui/macros/macro-at-most-once-rep-2018.stderr @@ -4,7 +4,7 @@ error: the `?` macro repetition operator does not take a separator LL | ($(a),?) => {}; | ^ -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2018.rs:25:11 | LL | macro_rules! foo { @@ -15,7 +15,7 @@ LL | foo!(a?); | = note: while trying to match sequence end -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2018.rs:26:11 | LL | macro_rules! foo { @@ -26,7 +26,7 @@ LL | foo!(a?a); | = note: while trying to match sequence end -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2018.rs:27:11 | LL | macro_rules! foo { @@ -67,7 +67,7 @@ note: while trying to match `+` LL | ($(a)?+) => {}; // ok. matches "a+" and "+" | ^ -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2018.rs:31:15 | LL | macro_rules! barplus { @@ -82,7 +82,7 @@ note: while trying to match `+` LL | ($(a)?+) => {}; // ok. matches "a+" and "+" | ^ -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2018.rs:32:15 | LL | macro_rules! barplus { @@ -127,7 +127,7 @@ note: while trying to match `*` LL | ($(a)?*) => {}; // ok. matches "a*" and "*" | ^ -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2018.rs:38:15 | LL | macro_rules! barstar { @@ -142,7 +142,7 @@ note: while trying to match `*` LL | ($(a)?*) => {}; // ok. matches "a*" and "*" | ^ -error: no rules expected the token `?` +error: no rules expected `?` --> $DIR/macro-at-most-once-rep-2018.rs:39:15 | LL | macro_rules! barstar { diff --git a/tests/ui/macros/macro-context.rs b/tests/ui/macros/macro-context.rs index d09fdf118e6..a31470263a0 100644 --- a/tests/ui/macros/macro-context.rs +++ b/tests/ui/macros/macro-context.rs @@ -1,9 +1,9 @@ // (typeof used because it's surprisingly hard to find an unparsed token after a stmt) macro_rules! m { () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` - //~| ERROR macro expansion ignores token `typeof` - //~| ERROR macro expansion ignores token `;` - //~| ERROR macro expansion ignores token `;` + //~| ERROR macro expansion ignores reserved keyword `typeof` + //~| ERROR macro expansion ignores `;` + //~| ERROR macro expansion ignores `;` //~| ERROR cannot find type `i` in this scope //~| ERROR cannot find value `i` in this scope //~| WARN trailing semicolon in macro diff --git a/tests/ui/macros/macro-context.stderr b/tests/ui/macros/macro-context.stderr index 7785f415946..4820a43f00c 100644 --- a/tests/ui/macros/macro-context.stderr +++ b/tests/ui/macros/macro-context.stderr @@ -1,4 +1,4 @@ -error: macro expansion ignores token `;` and any following +error: macro expansion ignores `;` and any tokens following --> $DIR/macro-context.rs:3:15 | LL | () => ( i ; typeof ); @@ -9,7 +9,7 @@ LL | let a: m!(); | = note: the usage of `m!` is likely invalid in type context -error: macro expansion ignores token `typeof` and any following +error: macro expansion ignores reserved keyword `typeof` and any tokens following --> $DIR/macro-context.rs:3:17 | LL | () => ( i ; typeof ); @@ -20,7 +20,7 @@ LL | let i = m!(); | = note: the usage of `m!` is likely invalid in expression context -error: macro expansion ignores token `;` and any following +error: macro expansion ignores `;` and any tokens following --> $DIR/macro-context.rs:3:15 | LL | () => ( i ; typeof ); diff --git a/tests/ui/macros/macro-in-expression-context.fixed b/tests/ui/macros/macro-in-expression-context.fixed index f4d04ca37bf..7c830707ffd 100644 --- a/tests/ui/macros/macro-in-expression-context.fixed +++ b/tests/ui/macros/macro-in-expression-context.fixed @@ -11,7 +11,7 @@ macro_rules! foo { //~| NOTE `#[warn(semicolon_in_expressions_from_macros)]` on by default assert_eq!("B", "B"); } - //~^^ ERROR macro expansion ignores token `assert_eq` and any following + //~^^ ERROR macro expansion ignores `assert_eq` and any tokens following //~| NOTE the usage of `foo!` is likely invalid in expression context } diff --git a/tests/ui/macros/macro-in-expression-context.rs b/tests/ui/macros/macro-in-expression-context.rs index 8921a056377..da95017aa5f 100644 --- a/tests/ui/macros/macro-in-expression-context.rs +++ b/tests/ui/macros/macro-in-expression-context.rs @@ -11,7 +11,7 @@ macro_rules! foo { //~| NOTE `#[warn(semicolon_in_expressions_from_macros)]` on by default assert_eq!("B", "B"); } - //~^^ ERROR macro expansion ignores token `assert_eq` and any following + //~^^ ERROR macro expansion ignores `assert_eq` and any tokens following //~| NOTE the usage of `foo!` is likely invalid in expression context } diff --git a/tests/ui/macros/macro-in-expression-context.stderr b/tests/ui/macros/macro-in-expression-context.stderr index 2eee63f307a..43419f2678c 100644 --- a/tests/ui/macros/macro-in-expression-context.stderr +++ b/tests/ui/macros/macro-in-expression-context.stderr @@ -1,4 +1,4 @@ -error: macro expansion ignores token `assert_eq` and any following +error: macro expansion ignores `assert_eq` and any tokens following --> $DIR/macro-in-expression-context.rs:12:9 | LL | assert_eq!("B", "B"); diff --git a/tests/ui/macros/macro-non-lifetime.rs b/tests/ui/macros/macro-non-lifetime.rs index 26e1f2afa91..3defffd2960 100644 --- a/tests/ui/macros/macro-non-lifetime.rs +++ b/tests/ui/macros/macro-non-lifetime.rs @@ -4,5 +4,5 @@ macro_rules! m { ($x:lifetime) => { } } fn main() { m!(a); - //~^ ERROR no rules expected the token `a` + //~^ ERROR no rules expected `a` } diff --git a/tests/ui/macros/macro-non-lifetime.stderr b/tests/ui/macros/macro-non-lifetime.stderr index 9ff3d741c01..35040a2229b 100644 --- a/tests/ui/macros/macro-non-lifetime.stderr +++ b/tests/ui/macros/macro-non-lifetime.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `a` +error: no rules expected `a` --> $DIR/macro-non-lifetime.rs:6:8 | LL | macro_rules! m { ($x:lifetime) => { } } diff --git a/tests/ui/macros/macro-stability.rs b/tests/ui/macros/macro-stability.rs index a909b14f47b..cd419d51354 100644 --- a/tests/ui/macros/macro-stability.rs +++ b/tests/ui/macros/macro-stability.rs @@ -19,10 +19,10 @@ macro local_unstable_modern() {} macro_rules! local_deprecated{ () => () } fn main() { - local_unstable!(); //~ ERROR use of unstable library feature 'local_unstable' - local_unstable_modern!(); //~ ERROR use of unstable library feature 'local_unstable' - unstable_macro!(); //~ ERROR use of unstable library feature 'unstable_macros' - // unstable_macro_modern!(); // ERROR use of unstable library feature 'unstable_macros' + local_unstable!(); //~ ERROR use of unstable library feature `local_unstable` + local_unstable_modern!(); //~ ERROR use of unstable library feature `local_unstable` + unstable_macro!(); //~ ERROR use of unstable library feature `unstable_macros` + // unstable_macro_modern!(); // ERROR use of unstable library feature `unstable_macros` deprecated_macro!(); //~^ WARN use of deprecated macro `deprecated_macro`: deprecation note diff --git a/tests/ui/macros/macro-stability.stderr b/tests/ui/macros/macro-stability.stderr index 21b6cef5c9c..fd8f029b4c4 100644 --- a/tests/ui/macros/macro-stability.stderr +++ b/tests/ui/macros/macro-stability.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'local_unstable' +error[E0658]: use of unstable library feature `local_unstable` --> $DIR/macro-stability.rs:22:5 | LL | local_unstable!(); @@ -7,7 +7,7 @@ LL | local_unstable!(); = help: add `#![feature(local_unstable)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'local_unstable' +error[E0658]: use of unstable library feature `local_unstable` --> $DIR/macro-stability.rs:23:5 | LL | local_unstable_modern!(); @@ -16,7 +16,7 @@ LL | local_unstable_modern!(); = help: add `#![feature(local_unstable)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_macros' +error[E0658]: use of unstable library feature `unstable_macros` --> $DIR/macro-stability.rs:24:5 | LL | unstable_macro!(); diff --git a/tests/ui/macros/missing-comma.rs b/tests/ui/macros/missing-comma.rs index 92f8a779505..64cfb0db31a 100644 --- a/tests/ui/macros/missing-comma.rs +++ b/tests/ui/macros/missing-comma.rs @@ -19,16 +19,16 @@ fn main() { println!("{}" a); //~^ ERROR expected `,`, found `a` foo!(a b); - //~^ ERROR no rules expected the token `b` + //~^ ERROR no rules expected `b` foo!(a, b, c, d e); - //~^ ERROR no rules expected the token `e` + //~^ ERROR no rules expected `e` foo!(a, b, c d, e); - //~^ ERROR no rules expected the token `d` + //~^ ERROR no rules expected `d` foo!(a, b, c d e); - //~^ ERROR no rules expected the token `d` + //~^ ERROR no rules expected `d` bar!(Level::Error, ); //~^ ERROR unexpected end of macro invocation check!(<str as Debug>::fmt, "fmt"); check!(<str as Debug>::fmt, "fmt",); - //~^ ERROR no rules expected the token `,` + //~^ ERROR no rules expected `,` } diff --git a/tests/ui/macros/missing-comma.stderr b/tests/ui/macros/missing-comma.stderr index 81877a29ed8..9913ba34919 100644 --- a/tests/ui/macros/missing-comma.stderr +++ b/tests/ui/macros/missing-comma.stderr @@ -4,7 +4,7 @@ error: expected `,`, found `a` LL | println!("{}" a); | ^ expected `,` -error: no rules expected the token `b` +error: no rules expected `b` --> $DIR/missing-comma.rs:21:12 | LL | macro_rules! foo { @@ -21,7 +21,7 @@ note: while trying to match meta-variable `$a:ident` LL | ($a:ident) => (); | ^^^^^^^^ -error: no rules expected the token `e` +error: no rules expected `e` --> $DIR/missing-comma.rs:23:21 | LL | macro_rules! foo { @@ -38,7 +38,7 @@ note: while trying to match meta-variable `$d:ident` LL | ($a:ident, $b:ident, $c:ident, $d:ident) => (); | ^^^^^^^^ -error: no rules expected the token `d` +error: no rules expected `d` --> $DIR/missing-comma.rs:25:18 | LL | macro_rules! foo { @@ -55,7 +55,7 @@ note: while trying to match meta-variable `$c:ident` LL | ($a:ident, $b:ident, $c:ident) => (); | ^^^^^^^^ -error: no rules expected the token `d` +error: no rules expected `d` --> $DIR/missing-comma.rs:27:18 | LL | macro_rules! foo { @@ -85,7 +85,7 @@ note: while trying to match meta-variable `$arg:tt` LL | ($lvl:expr, $($arg:tt)+) => {} | ^^^^^^^ -error: no rules expected the token `,` +error: no rules expected `,` --> $DIR/missing-comma.rs:32:38 | LL | macro_rules! check { diff --git a/tests/ui/macros/nonterminal-matching.rs b/tests/ui/macros/nonterminal-matching.rs index 5f0d6b2f90e..a655b665103 100644 --- a/tests/ui/macros/nonterminal-matching.rs +++ b/tests/ui/macros/nonterminal-matching.rs @@ -16,7 +16,7 @@ macro complex_nonterminal($nt_item: item) { struct S; } - n!(a $nt_item b); //~ ERROR no rules expected the token `enum E {}` + n!(a $nt_item b); //~ ERROR no rules expected item `enum E {}` } simple_nonterminal!(a, 'a, (x, y, z)); // OK @@ -29,10 +29,10 @@ macro_rules! foo { (ident $x:ident) => { bar!(ident $x); }; (lifetime $x:lifetime) => { bar!(lifetime $x); }; (tt $x:tt) => { bar!(tt $x); }; - (expr $x:expr) => { bar!(expr $x); }; //~ ERROR: no rules expected the token `3` - (literal $x:literal) => { bar!(literal $x); }; //~ ERROR: no rules expected the token `4` - (path $x:path) => { bar!(path $x); }; //~ ERROR: no rules expected the token `a::b::c` - (stmt $x:stmt) => { bar!(stmt $x); }; //~ ERROR: no rules expected the token `let abc = 0` + (expr $x:expr) => { bar!(expr $x); }; //~ ERROR: no rules expected expression `3` + (literal $x:literal) => { bar!(literal $x); }; //~ ERROR: no rules expected literal `4` + (path $x:path) => { bar!(path $x); }; //~ ERROR: no rules expected path `a::b::c` + (stmt $x:stmt) => { bar!(stmt $x); }; //~ ERROR: no rules expected statement `let abc = 0` } macro_rules! bar { diff --git a/tests/ui/macros/nonterminal-matching.stderr b/tests/ui/macros/nonterminal-matching.stderr index 3ee88b5f52e..e283dfcb8fd 100644 --- a/tests/ui/macros/nonterminal-matching.stderr +++ b/tests/ui/macros/nonterminal-matching.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `enum E {}` +error: no rules expected item `enum E {}` --> $DIR/nonterminal-matching.rs:19:10 | LL | macro n(a $nt_item b) { @@ -10,7 +10,7 @@ LL | n!(a $nt_item b); LL | complex_nonterminal!(enum E {}); | ------------------------------- in this macro invocation | -note: while trying to match `enum E {}` +note: while trying to match item `enum E {}` --> $DIR/nonterminal-matching.rs:15:15 | LL | macro n(a $nt_item b) { @@ -23,7 +23,7 @@ LL | complex_nonterminal!(enum E {}); = help: try using `:tt` instead in the macro definition = note: this error originates in the macro `complex_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info) -error: no rules expected the token `3` +error: no rules expected expression `3` --> $DIR/nonterminal-matching.rs:32:35 | LL | (expr $x:expr) => { bar!(expr $x); }; @@ -45,7 +45,7 @@ LL | (expr 3) => {}; = help: try using `:tt` instead in the macro definition = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) -error: no rules expected the token `4` +error: no rules expected literal `4` --> $DIR/nonterminal-matching.rs:33:44 | LL | (literal $x:literal) => { bar!(literal $x); }; @@ -67,7 +67,7 @@ LL | (literal 4) => {}; = help: try using `:tt` instead in the macro definition = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) -error: no rules expected the token `a::b::c` +error: no rules expected path `a::b::c` --> $DIR/nonterminal-matching.rs:34:35 | LL | (path $x:path) => { bar!(path $x); }; @@ -89,7 +89,7 @@ LL | (path a::b::c) => {}; = help: try using `:tt` instead in the macro definition = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) -error: no rules expected the token `let abc = 0` +error: no rules expected statement `let abc = 0` --> $DIR/nonterminal-matching.rs:35:35 | LL | (stmt $x:stmt) => { bar!(stmt $x); }; @@ -101,7 +101,7 @@ LL | macro_rules! bar { LL | foo!(stmt let abc = 0); | ---------------------- in this macro invocation | -note: while trying to match `let` +note: while trying to match keyword `let` --> $DIR/nonterminal-matching.rs:45:11 | LL | (stmt let abc = 0) => {}; diff --git a/tests/ui/macros/not-utf8.rs b/tests/ui/macros/not-utf8.rs index 3c433a4e27c..8100d65a9f8 100644 --- a/tests/ui/macros/not-utf8.rs +++ b/tests/ui/macros/not-utf8.rs @@ -1,4 +1,6 @@ //@ error-pattern: did not contain valid UTF-8 +//@ reference: input.encoding.utf8 +//@ reference: input.encoding.invalid fn foo() { include!("not-utf8.bin") diff --git a/tests/ui/macros/not-utf8.stderr b/tests/ui/macros/not-utf8.stderr index bf4704285c0..0d587cab5f3 100644 --- a/tests/ui/macros/not-utf8.stderr +++ b/tests/ui/macros/not-utf8.stderr @@ -1,5 +1,5 @@ error: couldn't read $DIR/not-utf8.bin: stream did not contain valid UTF-8 - --> $DIR/not-utf8.rs:4:5 + --> $DIR/not-utf8.rs:6:5 | LL | include!("not-utf8.bin") | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/macros/syntax-error-recovery.rs b/tests/ui/macros/syntax-error-recovery.rs index f6178c137db..016e4def284 100644 --- a/tests/ui/macros/syntax-error-recovery.rs +++ b/tests/ui/macros/syntax-error-recovery.rs @@ -10,7 +10,7 @@ macro_rules! values { }; } //~^^^^^ ERROR expected one of `(`, `,`, `=`, `{`, or `}`, found type `(String)` -//~| ERROR macro expansion ignores token `(String)` and any following +//~| ERROR macro expansion ignores type `(String)` and any tokens following values!(STRING(1) as (String) => cfg(test),); //~^ ERROR expected one of `!` or `::`, found `<eof>` diff --git a/tests/ui/macros/syntax-error-recovery.stderr b/tests/ui/macros/syntax-error-recovery.stderr index 6218bf43a1e..3cfbd8ce82b 100644 --- a/tests/ui/macros/syntax-error-recovery.stderr +++ b/tests/ui/macros/syntax-error-recovery.stderr @@ -10,7 +10,7 @@ LL | values!(STRING(1) as (String) => cfg(test),); = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` = note: this error originates in the macro `values` (in Nightly builds, run with -Z macro-backtrace for more info) -error: macro expansion ignores token `(String)` and any following +error: macro expansion ignores type `(String)` and any tokens following --> $DIR/syntax-error-recovery.rs:7:26 | LL | $token $($inner)? = $value, diff --git a/tests/ui/macros/trace_faulty_macros.stderr b/tests/ui/macros/trace_faulty_macros.stderr index 66d7b76bb07..10ad3faab16 100644 --- a/tests/ui/macros/trace_faulty_macros.stderr +++ b/tests/ui/macros/trace_faulty_macros.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `bcd` +error: no rules expected `bcd` --> $DIR/trace_faulty_macros.rs:7:26 | LL | macro_rules! my_faulty_macro { diff --git a/tests/ui/mir/clone-canonicalization-miscompile-132353.rs b/tests/ui/mir/clone-canonicalization-miscompile-132353.rs new file mode 100644 index 00000000000..ba740c10f90 --- /dev/null +++ b/tests/ui/mir/clone-canonicalization-miscompile-132353.rs @@ -0,0 +1,25 @@ +//! The mir-opt added in <https://github.com/rust-lang/rust/pull/128299> unfortunately seems to lead +//! to a miscompile (reported in <https://github.com/rust-lang/rust/issues/132353>, minimization +//! reproduced in this test file). +//@ revisions: release debug +// Note: it's not strictly cargo's release profile, but any non-zero opt-level was sufficient to +// reproduce the miscompile. +//@[release] compile-flags: -C opt-level=1 +//@[debug] compile-flags: -C opt-level=0 +//@ run-pass + +fn pop_min(mut score2head: Vec<Option<usize>>) -> Option<usize> { + loop { + if let Some(col) = score2head[0] { + score2head[0] = None; + return Some(col); + } + } +} + +fn main() { + let min = pop_min(vec![Some(1)]); + println!("min: {:?}", min); + // panic happened on 1.83.0 beta in release mode but not debug mode. + let _ = min.unwrap(); +} diff --git a/tests/ui/mir/mir_let_chains_drop_order.rs b/tests/ui/mir/mir_let_chains_drop_order.rs index daf0a62fc85..92199625207 100644 --- a/tests/ui/mir/mir_let_chains_drop_order.rs +++ b/tests/ui/mir/mir_let_chains_drop_order.rs @@ -8,7 +8,6 @@ // See `mir_drop_order.rs` for more information #![feature(let_chains)] -#![cfg_attr(edition2024, feature(if_let_rescope))] #![allow(irrefutable_let_patterns)] use std::cell::RefCell; diff --git a/tests/ui/mismatched_types/similar_paths_primitive.rs b/tests/ui/mismatched_types/similar_paths_primitive.rs index 8f5b7cce469..98890a15d98 100644 --- a/tests/ui/mismatched_types/similar_paths_primitive.rs +++ b/tests/ui/mismatched_types/similar_paths_primitive.rs @@ -1,10 +1,14 @@ #![allow(non_camel_case_types)] struct bool; +struct str; fn foo(_: bool) {} +fn bar(_: &str) {} fn main() { foo(true); //~^ ERROR mismatched types [E0308] + bar("hello"); + //~^ ERROR mismatched types [E0308] } diff --git a/tests/ui/mismatched_types/similar_paths_primitive.stderr b/tests/ui/mismatched_types/similar_paths_primitive.stderr index c9881891319..0530bf5863e 100644 --- a/tests/ui/mismatched_types/similar_paths_primitive.stderr +++ b/tests/ui/mismatched_types/similar_paths_primitive.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/similar_paths_primitive.rs:8:9 + --> $DIR/similar_paths_primitive.rs:10:9 | LL | foo(true); | --- ^^^^ expected `bool`, found a different `bool` @@ -14,11 +14,32 @@ note: `bool` is defined in the current crate LL | struct bool; | ^^^^^^^^^^^ note: function defined here - --> $DIR/similar_paths_primitive.rs:5:4 + --> $DIR/similar_paths_primitive.rs:6:4 | LL | fn foo(_: bool) {} | ^^^ ------- -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/similar_paths_primitive.rs:12:9 + | +LL | bar("hello"); + | --- ^^^^^^^ expected `str`, found a different `str` + | | + | arguments to this function are incorrect + | + = note: str and `str` have similar names, but are actually distinct types + = note: str is a primitive defined by the language +note: `str` is defined in the current crate + --> $DIR/similar_paths_primitive.rs:4:1 + | +LL | struct str; + | ^^^^^^^^^^ +note: function defined here + --> $DIR/similar_paths_primitive.rs:7:4 + | +LL | fn bar(_: &str) {} + | ^^^ ------- + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/modules/issue-107649.stderr b/tests/ui/modules/issue-107649.stderr index d5405c6576a..0d203c1aacb 100644 --- a/tests/ui/modules/issue-107649.stderr +++ b/tests/ui/modules/issue-107649.stderr @@ -4,7 +4,7 @@ error[E0277]: `Dummy` doesn't implement `Debug` 105 | dbg!(lib::Dummy); | ^^^^^^^^^^^^^^^^ `Dummy` cannot be formatted using `{:?}` | - = help: the trait `Debug` is not implemented for `Dummy`, which is required by `&Dummy: Debug` + = help: the trait `Debug` is not implemented for `Dummy` = note: add `#[derive(Debug)]` to `Dummy` or manually `impl Debug for Dummy` = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Dummy` with `#[derive(Debug)]` diff --git a/tests/ui/mut/mutable-enum-indirect.stderr b/tests/ui/mut/mutable-enum-indirect.stderr index d7af327df5a..0b7783b3318 100644 --- a/tests/ui/mut/mutable-enum-indirect.stderr +++ b/tests/ui/mut/mutable-enum-indirect.stderr @@ -6,7 +6,7 @@ LL | bar(&x); | | | required by a bound introduced by this call | - = help: within `&Foo`, the trait `Sync` is not implemented for `NoSync`, which is required by `&Foo: Sync` + = help: within `&Foo`, the trait `Sync` is not implemented for `NoSync` note: required because it appears within the type `Foo` --> $DIR/mutable-enum-indirect.rs:11:6 | diff --git a/tests/ui/never_type/defaulted-never-note.nofallback.stderr b/tests/ui/never_type/defaulted-never-note.nofallback.stderr index d88615186dd..6bc4501b6a3 100644 --- a/tests/ui/never_type/defaulted-never-note.nofallback.stderr +++ b/tests/ui/never_type/defaulted-never-note.nofallback.stderr @@ -13,6 +13,10 @@ note: in edition 2024, the requirement `!: ImplementedForUnitButNotNever` will f LL | foo(_x); | ^^ = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default +help: use `()` annotations to avoid fallback changes + | +LL | let _x: () = return; + | ++++ warning: 1 warning emitted diff --git a/tests/ui/never_type/dependency-on-fallback-to-unit.stderr b/tests/ui/never_type/dependency-on-fallback-to-unit.stderr index ec49137ba79..79f47bb5fbc 100644 --- a/tests/ui/never_type/dependency-on-fallback-to-unit.stderr +++ b/tests/ui/never_type/dependency-on-fallback-to-unit.stderr @@ -13,6 +13,10 @@ note: in edition 2024, the requirement `!: Default` will fail LL | false => <_>::default(), | ^ = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default +help: use `()` annotations to avoid fallback changes + | +LL | false => <()>::default(), + | ~~ warning: this function depends on never type fallback being `()` --> $DIR/dependency-on-fallback-to-unit.rs:19:1 @@ -28,6 +32,10 @@ note: in edition 2024, the requirement `!: Default` will fail | LL | deserialize()?; | ^^^^^^^^^^^^^ +help: use `()` annotations to avoid fallback changes + | +LL | deserialize::<()>()?; + | ++++++ warning: 2 warnings emitted diff --git a/tests/ui/never_type/diverging-fallback-control-flow.nofallback.stderr b/tests/ui/never_type/diverging-fallback-control-flow.nofallback.stderr index 2a3c5edc218..d40d1da76f9 100644 --- a/tests/ui/never_type/diverging-fallback-control-flow.nofallback.stderr +++ b/tests/ui/never_type/diverging-fallback-control-flow.nofallback.stderr @@ -13,6 +13,10 @@ note: in edition 2024, the requirement `!: UnitDefault` will fail LL | x = UnitDefault::default(); | ^^^^^^^^^^^^^^^^^^^^^^ = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default +help: use `()` annotations to avoid fallback changes + | +LL | let x: (); + | ++++ warning: this function depends on never type fallback being `()` --> $DIR/diverging-fallback-control-flow.rs:42:1 @@ -28,6 +32,10 @@ note: in edition 2024, the requirement `!: UnitDefault` will fail | LL | x = UnitDefault::default(); | ^^^^^^^^^^^^^^^^^^^^^^ +help: use `()` annotations to avoid fallback changes + | +LL | let x: (); + | ++++ warning: 2 warnings emitted diff --git a/tests/ui/never_type/diverging-fallback-no-leak.nofallback.stderr b/tests/ui/never_type/diverging-fallback-no-leak.nofallback.stderr index 11245cc7aab..d11c21d9573 100644 --- a/tests/ui/never_type/diverging-fallback-no-leak.nofallback.stderr +++ b/tests/ui/never_type/diverging-fallback-no-leak.nofallback.stderr @@ -13,6 +13,10 @@ note: in edition 2024, the requirement `!: Test` will fail LL | unconstrained_arg(return); | ^^^^^^ = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default +help: use `()` annotations to avoid fallback changes + | +LL | unconstrained_arg::<()>(return); + | ++++++ warning: 1 warning emitted diff --git a/tests/ui/never_type/diverging-fallback-unconstrained-return.nofallback.stderr b/tests/ui/never_type/diverging-fallback-unconstrained-return.nofallback.stderr index b485c94df4d..30a5e60a758 100644 --- a/tests/ui/never_type/diverging-fallback-unconstrained-return.nofallback.stderr +++ b/tests/ui/never_type/diverging-fallback-unconstrained-return.nofallback.stderr @@ -13,6 +13,10 @@ note: in edition 2024, the requirement `!: UnitReturn` will fail LL | let _ = if true { unconstrained_return() } else { panic!() }; | ^^^^^^^^^^^^^^^^^^^^^^ = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default +help: use `()` annotations to avoid fallback changes + | +LL | let _: () = if true { unconstrained_return() } else { panic!() }; + | ++++ warning: 1 warning emitted diff --git a/tests/ui/never_type/fallback-closure-ret.nofallback.stderr b/tests/ui/never_type/fallback-closure-ret.nofallback.stderr index 3fb5536dee7..fb0166dd9e0 100644 --- a/tests/ui/never_type/fallback-closure-ret.nofallback.stderr +++ b/tests/ui/never_type/fallback-closure-ret.nofallback.stderr @@ -13,6 +13,10 @@ note: in edition 2024, the requirement `!: Bar` will fail LL | foo(|| panic!()); | ^^^^^^^^^^^^^^^^ = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default +help: use `()` annotations to avoid fallback changes + | +LL | foo::<(), _>(|| panic!()); + | +++++++++ warning: 1 warning emitted diff --git a/tests/ui/never_type/from_infer_breaking_with_unit_fallback.unit.stderr b/tests/ui/never_type/from_infer_breaking_with_unit_fallback.unit.stderr index 3b8913ccf45..9eacab9a0b7 100644 --- a/tests/ui/never_type/from_infer_breaking_with_unit_fallback.unit.stderr +++ b/tests/ui/never_type/from_infer_breaking_with_unit_fallback.unit.stderr @@ -4,7 +4,8 @@ error[E0277]: the trait bound `E: From<()>` is not satisfied LL | <E as From<_>>::from(never); // Should the inference fail? | ^ the trait `From<()>` is not implemented for `E` | - = help: the trait `From<!>` is implemented for `E` + = help: the trait `From<()>` is not implemented for `E` + but trait `From<!>` is implemented for it = help: for that trait implementation, expected `!`, found `()` error: aborting due to 1 previous error diff --git a/tests/ui/never_type/impl_trait_fallback2.stderr b/tests/ui/never_type/impl_trait_fallback2.stderr index 78cc83bdbfa..4c32dce465b 100644 --- a/tests/ui/never_type/impl_trait_fallback2.stderr +++ b/tests/ui/never_type/impl_trait_fallback2.stderr @@ -3,6 +3,9 @@ error[E0277]: the trait bound `(): T` is not satisfied | LL | fn should_ret_unit() -> impl T { | ^^^^^^ the trait `T` is not implemented for `()` +LL | +LL | panic!() + | -------- return type was inferred to be `_` here | = help: the trait `T` is implemented for `i32` @@ -11,6 +14,9 @@ error[E0277]: the trait bound `(): T` is not satisfied | LL | fn a() -> Foo { | ^^^ the trait `T` is not implemented for `()` +LL | +LL | panic!() + | -------- return type was inferred to be `_` here | = help: the trait `T` is implemented for `i32` diff --git a/tests/ui/never_type/impl_trait_fallback3.stderr b/tests/ui/never_type/impl_trait_fallback3.stderr index e2246eea17c..fde8d0896dd 100644 --- a/tests/ui/never_type/impl_trait_fallback3.stderr +++ b/tests/ui/never_type/impl_trait_fallback3.stderr @@ -3,6 +3,9 @@ error[E0277]: the trait bound `(): T` is not satisfied | LL | fn a() -> Foo { | ^^^ the trait `T` is not implemented for `()` +... +LL | panic!() + | -------- return type was inferred to be `_` here | help: this trait has no implementations, consider adding one --> $DIR/impl_trait_fallback3.rs:5:1 diff --git a/tests/ui/never_type/impl_trait_fallback4.stderr b/tests/ui/never_type/impl_trait_fallback4.stderr index 8f6b5cfea68..c4fc949373a 100644 --- a/tests/ui/never_type/impl_trait_fallback4.stderr +++ b/tests/ui/never_type/impl_trait_fallback4.stderr @@ -3,6 +3,9 @@ error[E0277]: the trait bound `(): T` is not satisfied | LL | fn foo() -> impl T { | ^^^^^^ the trait `T` is not implemented for `()` +LL | +LL | panic!() + | -------- return type was inferred to be `_` here | help: this trait has no implementations, consider adding one --> $DIR/impl_trait_fallback4.rs:3:1 diff --git a/tests/ui/never_type/issue-52443.stderr b/tests/ui/never_type/issue-52443.stderr index adcff6637b0..2207ceb5033 100644 --- a/tests/ui/never_type/issue-52443.stderr +++ b/tests/ui/never_type/issue-52443.stderr @@ -50,10 +50,6 @@ LL | [(); { for _ in 0usize.. {}; 0}]; note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: cannot call non-const fn `<RangeFrom<usize> as Iterator>::next` in constants --> $DIR/issue-52443.rs:9:21 @@ -62,10 +58,6 @@ LL | [(); { for _ in 0usize.. {}; 0}]; | ^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 5 previous errors; 1 warning emitted diff --git a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr index a75039b8237..6a48a7b9b47 100644 --- a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr +++ b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr @@ -8,6 +8,10 @@ LL | unsafe { mem::zeroed() } = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default +help: use `()` annotations to avoid fallback changes + | +LL | unsafe { mem::zeroed::<()>() } + | ++++++ warning: never type fallback affects this call to an `unsafe` function --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:30:13 @@ -18,6 +22,10 @@ LL | core::mem::transmute(Zst) = warning: this will change its meaning in a future release! = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly +help: use `()` annotations to avoid fallback changes + | +LL | core::mem::transmute::<_, ()>(Zst) + | +++++++++ warning: never type fallback affects this union access --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:47:18 @@ -38,6 +46,10 @@ LL | unsafe { *ptr::from_ref(&()).cast() } = warning: this will change its meaning in a future release! = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly +help: use `()` annotations to avoid fallback changes + | +LL | unsafe { *ptr::from_ref(&()).cast::<()>() } + | ++++++ warning: never type fallback affects this call to an `unsafe` function --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:79:18 @@ -48,6 +60,10 @@ LL | unsafe { internally_create(x) } = warning: this will change its meaning in a future release! = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly +help: use `()` annotations to avoid fallback changes + | +LL | unsafe { internally_create::<()>(x) } + | ++++++ warning: never type fallback affects this call to an `unsafe` function --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:97:18 @@ -58,6 +74,10 @@ LL | unsafe { zeroed() } = warning: this will change its meaning in a future release! = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly +help: use `()` annotations to avoid fallback changes + | +LL | let zeroed = mem::zeroed::<()>; + | ++++++ warning: never type fallback affects this `unsafe` function --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:92:22 @@ -68,6 +88,10 @@ LL | let zeroed = mem::zeroed; = warning: this will change its meaning in a future release! = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly +help: use `()` annotations to avoid fallback changes + | +LL | let zeroed = mem::zeroed::<()>; + | ++++++ warning: never type fallback affects this `unsafe` function --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:115:17 @@ -78,6 +102,10 @@ LL | let f = internally_create; = warning: this will change its meaning in a future release! = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly +help: use `()` annotations to avoid fallback changes + | +LL | let f = internally_create::<()>; + | ++++++ warning: never type fallback affects this call to an `unsafe` method --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:140:13 @@ -102,6 +130,10 @@ LL | msg_send!(); = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly = note: this warning originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use `()` annotations to avoid fallback changes + | +LL | match send_message::<() /* ?0 */>() { + | ~~ warning: 10 warnings emitted diff --git a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr index 4138e9f8c86..844cd62c267 100644 --- a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr +++ b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr @@ -8,6 +8,10 @@ LL | unsafe { mem::zeroed() } = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default +help: use `()` annotations to avoid fallback changes + | +LL | unsafe { mem::zeroed::<()>() } + | ++++++ error: never type fallback affects this call to an `unsafe` function --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:30:13 @@ -18,6 +22,10 @@ LL | core::mem::transmute(Zst) = warning: this will change its meaning in a future release! = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly +help: use `()` annotations to avoid fallback changes + | +LL | core::mem::transmute::<_, ()>(Zst) + | +++++++++ error: never type fallback affects this union access --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:47:18 @@ -38,6 +46,10 @@ LL | unsafe { *ptr::from_ref(&()).cast() } = warning: this will change its meaning in a future release! = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly +help: use `()` annotations to avoid fallback changes + | +LL | unsafe { *ptr::from_ref(&()).cast::<()>() } + | ++++++ error: never type fallback affects this call to an `unsafe` function --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:79:18 @@ -48,6 +60,10 @@ LL | unsafe { internally_create(x) } = warning: this will change its meaning in a future release! = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly +help: use `()` annotations to avoid fallback changes + | +LL | unsafe { internally_create::<()>(x) } + | ++++++ error: never type fallback affects this call to an `unsafe` function --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:97:18 @@ -58,6 +74,10 @@ LL | unsafe { zeroed() } = warning: this will change its meaning in a future release! = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly +help: use `()` annotations to avoid fallback changes + | +LL | let zeroed = mem::zeroed::<()>; + | ++++++ error: never type fallback affects this `unsafe` function --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:92:22 @@ -68,6 +88,10 @@ LL | let zeroed = mem::zeroed; = warning: this will change its meaning in a future release! = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly +help: use `()` annotations to avoid fallback changes + | +LL | let zeroed = mem::zeroed::<()>; + | ++++++ error: never type fallback affects this `unsafe` function --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:115:17 @@ -78,6 +102,10 @@ LL | let f = internally_create; = warning: this will change its meaning in a future release! = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly +help: use `()` annotations to avoid fallback changes + | +LL | let f = internally_create::<()>; + | ++++++ error: never type fallback affects this call to an `unsafe` method --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:140:13 @@ -102,6 +130,10 @@ LL | msg_send!(); = note: for more information, see issue #123748 <https://github.com/rust-lang/rust/issues/123748> = help: specify the type explicitly = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use `()` annotations to avoid fallback changes + | +LL | match send_message::<() /* ?0 */>() { + | ~~ warning: the type `!` does not permit zero-initialization --> $DIR/lint-never-type-fallback-flowing-into-unsafe.rs:13:18 diff --git a/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr b/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr index f5249814c78..d6234c8e7e1 100644 --- a/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr +++ b/tests/ui/never_type/never-value-fallback-issue-66757.nofallback.stderr @@ -4,7 +4,8 @@ error[E0277]: the trait bound `E: From<()>` is not satisfied LL | <E as From<_>>::from(never); | ^ the trait `From<()>` is not implemented for `E` | - = help: the trait `From<!>` is implemented for `E` + = help: the trait `From<()>` is not implemented for `E` + but trait `From<!>` is implemented for it = help: for that trait implementation, expected `!`, found `()` error: aborting due to 1 previous error diff --git a/tests/ui/never_type/suggestion-ice-132517.rs b/tests/ui/never_type/suggestion-ice-132517.rs new file mode 100644 index 00000000000..c1730d06f6b --- /dev/null +++ b/tests/ui/never_type/suggestion-ice-132517.rs @@ -0,0 +1,4 @@ +fn main() { + x::<_>(|_| panic!()) + //~^ ERROR cannot find function `x` in this scope +} diff --git a/tests/ui/never_type/suggestion-ice-132517.stderr b/tests/ui/never_type/suggestion-ice-132517.stderr new file mode 100644 index 00000000000..4f280a0e4f1 --- /dev/null +++ b/tests/ui/never_type/suggestion-ice-132517.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find function `x` in this scope + --> $DIR/suggestion-ice-132517.rs:2:5 + | +LL | x::<_>(|_| panic!()) + | ^ not found in this scope + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/nll/issue-54556-niconii.edition2021.stderr b/tests/ui/nll/issue-54556-niconii.edition2021.stderr index 31a03abbc98..abee09ed950 100644 --- a/tests/ui/nll/issue-54556-niconii.edition2021.stderr +++ b/tests/ui/nll/issue-54556-niconii.edition2021.stderr @@ -1,5 +1,5 @@ error[E0597]: `counter` does not live long enough - --> $DIR/issue-54556-niconii.rs:30:20 + --> $DIR/issue-54556-niconii.rs:28:20 | LL | let counter = Mutex; | ------- binding `counter` declared here diff --git a/tests/ui/nll/issue-54556-niconii.rs b/tests/ui/nll/issue-54556-niconii.rs index 1a7ad17cc84..f01e0523cbf 100644 --- a/tests/ui/nll/issue-54556-niconii.rs +++ b/tests/ui/nll/issue-54556-niconii.rs @@ -12,8 +12,6 @@ //@ [edition2024] compile-flags: -Z unstable-options //@ [edition2024] check-pass -#![cfg_attr(edition2024, feature(if_let_rescope))] - struct Mutex; struct MutexGuard<'a>(&'a Mutex); diff --git a/tests/ui/no-send-res-ports.stderr b/tests/ui/no-send-res-ports.stderr index c71d8ecba37..9c30261e5cb 100644 --- a/tests/ui/no-send-res-ports.stderr +++ b/tests/ui/no-send-res-ports.stderr @@ -13,7 +13,7 @@ LL | | println!("{:?}", y); LL | | }); | |_____^ `Rc<()>` cannot be sent between threads safely | - = help: within `{closure@$DIR/no-send-res-ports.rs:25:19: 25:25}`, the trait `Send` is not implemented for `Rc<()>`, which is required by `{closure@$DIR/no-send-res-ports.rs:25:19: 25:25}: Send` + = help: within `{closure@$DIR/no-send-res-ports.rs:25:19: 25:25}`, the trait `Send` is not implemented for `Rc<()>` note: required because it appears within the type `Port<()>` --> $DIR/no-send-res-ports.rs:5:8 | diff --git a/tests/ui/no_send-enum.stderr b/tests/ui/no_send-enum.stderr index e24f79c7dd6..3b66c7db545 100644 --- a/tests/ui/no_send-enum.stderr +++ b/tests/ui/no_send-enum.stderr @@ -6,7 +6,7 @@ LL | bar(x); | | | required by a bound introduced by this call | - = help: within `Foo`, the trait `Send` is not implemented for `NoSend`, which is required by `Foo: Send` + = help: within `Foo`, the trait `Send` is not implemented for `NoSend` note: required because it appears within the type `Foo` --> $DIR/no_send-enum.rs:8:6 | diff --git a/tests/ui/no_share-enum.stderr b/tests/ui/no_share-enum.stderr index 5b6c8bf0b4f..89939216d5b 100644 --- a/tests/ui/no_share-enum.stderr +++ b/tests/ui/no_share-enum.stderr @@ -6,7 +6,7 @@ LL | bar(x); | | | required by a bound introduced by this call | - = help: within `Foo`, the trait `Sync` is not implemented for `NoSync`, which is required by `Foo: Sync` + = help: within `Foo`, the trait `Sync` is not implemented for `NoSync` note: required because it appears within the type `Foo` --> $DIR/no_share-enum.rs:8:6 | diff --git a/tests/ui/not-clone-closure.rs b/tests/ui/not-clone-closure.rs index 25635bc8331..976e3b9e81c 100644 --- a/tests/ui/not-clone-closure.rs +++ b/tests/ui/not-clone-closure.rs @@ -1,3 +1,4 @@ +//@compile-flags: --diagnostic-width=300 // Check that closures do not implement `Clone` if their environment is not `Clone`. struct S(i32); diff --git a/tests/ui/not-clone-closure.stderr b/tests/ui/not-clone-closure.stderr index 9b557b15582..0c95a99d0c0 100644 --- a/tests/ui/not-clone-closure.stderr +++ b/tests/ui/not-clone-closure.stderr @@ -1,14 +1,14 @@ -error[E0277]: the trait bound `S: Clone` is not satisfied in `{closure@$DIR/not-clone-closure.rs:7:17: 7:24}` - --> $DIR/not-clone-closure.rs:11:23 +error[E0277]: the trait bound `S: Clone` is not satisfied in `{closure@$DIR/not-clone-closure.rs:8:17: 8:24}` + --> $DIR/not-clone-closure.rs:12:23 | LL | let hello = move || { - | ------- within this `{closure@$DIR/not-clone-closure.rs:7:17: 7:24}` + | ------- within this `{closure@$DIR/not-clone-closure.rs:8:17: 8:24}` ... LL | let hello = hello.clone(); - | ^^^^^ within `{closure@$DIR/not-clone-closure.rs:7:17: 7:24}`, the trait `Clone` is not implemented for `S`, which is required by `{closure@$DIR/not-clone-closure.rs:7:17: 7:24}: Clone` + | ^^^^^ within `{closure@$DIR/not-clone-closure.rs:8:17: 8:24}`, the trait `Clone` is not implemented for `S` | note: required because it's used within this closure - --> $DIR/not-clone-closure.rs:7:17 + --> $DIR/not-clone-closure.rs:8:17 | LL | let hello = move || { | ^^^^^^^ diff --git a/tests/ui/not-panic/not-panic-safe-2.stderr b/tests/ui/not-panic/not-panic-safe-2.stderr index 8c4cf9c98ed..0c399f15a25 100644 --- a/tests/ui/not-panic/not-panic-safe-2.stderr +++ b/tests/ui/not-panic/not-panic-safe-2.stderr @@ -4,7 +4,7 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a r LL | assert::<Rc<RefCell<i32>>>(); | ^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | - = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>`, which is required by `Rc<RefCell<i32>>: UnwindSafe` + = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` note: required because it appears within the type `RefCell<i32>` --> $SRC_DIR/core/src/cell.rs:LL:COL = note: required for `Rc<RefCell<i32>>` to implement `UnwindSafe` @@ -20,7 +20,7 @@ error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a LL | assert::<Rc<RefCell<i32>>>(); | ^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | - = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>`, which is required by `Rc<RefCell<i32>>: UnwindSafe` + = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>` note: required because it appears within the type `Cell<isize>` --> $SRC_DIR/core/src/cell.rs:LL:COL note: required because it appears within the type `RefCell<i32>` diff --git a/tests/ui/not-panic/not-panic-safe-3.stderr b/tests/ui/not-panic/not-panic-safe-3.stderr index 2373ada63f6..53028d6a337 100644 --- a/tests/ui/not-panic/not-panic-safe-3.stderr +++ b/tests/ui/not-panic/not-panic-safe-3.stderr @@ -4,7 +4,7 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a r LL | assert::<Arc<RefCell<i32>>>(); | ^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | - = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>`, which is required by `Arc<RefCell<i32>>: UnwindSafe` + = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` note: required because it appears within the type `RefCell<i32>` --> $SRC_DIR/core/src/cell.rs:LL:COL = note: required for `Arc<RefCell<i32>>` to implement `UnwindSafe` @@ -20,7 +20,7 @@ error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a LL | assert::<Arc<RefCell<i32>>>(); | ^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | - = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>`, which is required by `Arc<RefCell<i32>>: UnwindSafe` + = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>` note: required because it appears within the type `Cell<isize>` --> $SRC_DIR/core/src/cell.rs:LL:COL note: required because it appears within the type `RefCell<i32>` diff --git a/tests/ui/not-panic/not-panic-safe-4.stderr b/tests/ui/not-panic/not-panic-safe-4.stderr index d77cac8f272..b1361cfd87e 100644 --- a/tests/ui/not-panic/not-panic-safe-4.stderr +++ b/tests/ui/not-panic/not-panic-safe-4.stderr @@ -4,7 +4,7 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a r LL | assert::<&RefCell<i32>>(); | ^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | - = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>`, which is required by `&RefCell<i32>: UnwindSafe` + = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` note: required because it appears within the type `RefCell<i32>` --> $SRC_DIR/core/src/cell.rs:LL:COL = note: required for `&RefCell<i32>` to implement `UnwindSafe` @@ -25,7 +25,7 @@ error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a LL | assert::<&RefCell<i32>>(); | ^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | - = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>`, which is required by `&RefCell<i32>: UnwindSafe` + = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>` note: required because it appears within the type `Cell<isize>` --> $SRC_DIR/core/src/cell.rs:LL:COL note: required because it appears within the type `RefCell<i32>` diff --git a/tests/ui/not-panic/not-panic-safe-5.stderr b/tests/ui/not-panic/not-panic-safe-5.stderr index 0de9a2cc0cd..fbbd81d6d4c 100644 --- a/tests/ui/not-panic/not-panic-safe-5.stderr +++ b/tests/ui/not-panic/not-panic-safe-5.stderr @@ -4,7 +4,7 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a r LL | assert::<*const UnsafeCell<i32>>(); | ^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | - = help: the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>`, which is required by `*const UnsafeCell<i32>: UnwindSafe` + = help: the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = note: required for `*const UnsafeCell<i32>` to implement `UnwindSafe` note: required by a bound in `assert` --> $DIR/not-panic-safe-5.rs:6:14 diff --git a/tests/ui/not-panic/not-panic-safe-6.stderr b/tests/ui/not-panic/not-panic-safe-6.stderr index 7714a577f8a..47f28257409 100644 --- a/tests/ui/not-panic/not-panic-safe-6.stderr +++ b/tests/ui/not-panic/not-panic-safe-6.stderr @@ -4,7 +4,7 @@ error[E0277]: the type `UnsafeCell<i32>` may contain interior mutability and a r LL | assert::<*mut RefCell<i32>>(); | ^^^^^^^^^^^^^^^^^ `UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | - = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>`, which is required by `*mut RefCell<i32>: UnwindSafe` + = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` note: required because it appears within the type `RefCell<i32>` --> $SRC_DIR/core/src/cell.rs:LL:COL = note: required for `*mut RefCell<i32>` to implement `UnwindSafe` @@ -20,7 +20,7 @@ error[E0277]: the type `UnsafeCell<isize>` may contain interior mutability and a LL | assert::<*mut RefCell<i32>>(); | ^^^^^^^^^^^^^^^^^ `UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | - = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>`, which is required by `*mut RefCell<i32>: UnwindSafe` + = help: within `RefCell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<isize>` note: required because it appears within the type `Cell<isize>` --> $SRC_DIR/core/src/cell.rs:LL:COL note: required because it appears within the type `RefCell<i32>` diff --git a/tests/ui/offset-of/offset-of-arg-count.rs b/tests/ui/offset-of/offset-of-arg-count.rs index c86e61a61a7..f4c8b91d7da 100644 --- a/tests/ui/offset-of/offset-of-arg-count.rs +++ b/tests/ui/offset-of/offset-of-arg-count.rs @@ -3,7 +3,7 @@ use std::mem::offset_of; fn main() { offset_of!(NotEnoughArguments); //~ ERROR unexpected end of macro invocation offset_of!(NotEnoughArgumentsWithAComma, ); //~ ERROR unexpected end of macro invocation - offset_of!(Container, field, too many arguments); //~ ERROR no rules expected the token `too` + offset_of!(Container, field, too many arguments); //~ ERROR no rules expected `too` offset_of!(S, f); // compiles fine offset_of!(S, f,); // also compiles fine offset_of!(S, f.); //~ ERROR unexpected token: `)` diff --git a/tests/ui/offset-of/offset-of-arg-count.stderr b/tests/ui/offset-of/offset-of-arg-count.stderr index 4cb24b3d034..0772bb18e0c 100644 --- a/tests/ui/offset-of/offset-of-arg-count.stderr +++ b/tests/ui/offset-of/offset-of-arg-count.stderr @@ -16,7 +16,7 @@ LL | offset_of!(NotEnoughArgumentsWithAComma, ); note: while trying to match meta-variable `$fields:expr` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL -error: no rules expected the token `too` +error: no rules expected `too` --> $DIR/offset-of-arg-count.rs:6:34 | LL | offset_of!(Container, field, too many arguments); diff --git a/tests/ui/offset-of/offset-of-dst-field.stderr b/tests/ui/offset-of/offset-of-dst-field.stderr index bcfe796897e..714bf7a0266 100644 --- a/tests/ui/offset-of/offset-of-dst-field.stderr +++ b/tests/ui/offset-of/offset-of-dst-field.stderr @@ -58,7 +58,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation LL | offset_of!(Delta<Alpha>, z); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `Alpha`, the trait `Sized` is not implemented for `[u8]`, which is required by `Alpha: Sized` + = help: within `Alpha`, the trait `Sized` is not implemented for `[u8]` note: required because it appears within the type `Alpha` --> $DIR/offset-of-dst-field.rs:5:8 | diff --git a/tests/ui/offset-of/offset-of-tuple.stderr b/tests/ui/offset-of/offset-of-tuple.stderr index dd20859e04e..38ce49c9179 100644 --- a/tests/ui/offset-of/offset-of-tuple.stderr +++ b/tests/ui/offset-of/offset-of-tuple.stderr @@ -76,7 +76,7 @@ error: suffixes on a tuple index are invalid LL | offset_of!((u8, u8), 1_u8); | ^^^^ invalid suffix `u8` -error: no rules expected the token `+` +error: no rules expected `+` --> $DIR/offset-of-tuple.rs:11:26 | LL | offset_of!((u8, u8), +1); diff --git a/tests/ui/offset-of/offset-of-unstable.stderr b/tests/ui/offset-of/offset-of-unstable.stderr index 44ccad3ff39..d249e1b176d 100644 --- a/tests/ui/offset-of/offset-of-unstable.stderr +++ b/tests/ui/offset-of/offset-of-unstable.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/offset-of-unstable.rs:12:9 | LL | Unstable, @@ -7,7 +7,7 @@ LL | Unstable, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/offset-of-unstable.rs:21:9 | LL | UnstableWithStableFieldType, @@ -16,7 +16,7 @@ LL | UnstableWithStableFieldType, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/offset-of-unstable.rs:26:9 | LL | UnstableWithStableFieldType, @@ -25,7 +25,7 @@ LL | UnstableWithStableFieldType, = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/offset-of-unstable.rs:10:5 | LL | / offset_of!( @@ -39,7 +39,7 @@ LL | | ); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/offset-of-unstable.rs:16:5 | LL | offset_of!(StableWithUnstableField, unstable); @@ -49,7 +49,7 @@ LL | offset_of!(StableWithUnstableField, unstable); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/offset-of-unstable.rs:18:5 | LL | offset_of!(StableWithUnstableFieldType, stable.unstable); @@ -59,7 +59,7 @@ LL | offset_of!(StableWithUnstableFieldType, stable.unstable); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/offset-of-unstable.rs:19:5 | LL | / offset_of!( @@ -73,7 +73,7 @@ LL | | ); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/offset-of-unstable.rs:24:5 | LL | / offset_of!( diff --git a/tests/ui/on-unimplemented/impl-substs.stderr b/tests/ui/on-unimplemented/impl-substs.stderr index e2ba2474d6c..b85d45eba5b 100644 --- a/tests/ui/on-unimplemented/impl-substs.stderr +++ b/tests/ui/on-unimplemented/impl-substs.stderr @@ -7,7 +7,7 @@ LL | Foo::<usize>::foo((1i32, 1i32, 1i32)); | required by a bound introduced by this call | = help: the trait `Foo<usize>` is not implemented for `(i32, i32, i32)` - = help: the trait `Foo<i32>` is implemented for `(i32, i32, i32)` + but trait `Foo<i32>` is implemented for it = help: for that trait implementation, expected `i32`, found `usize` error: aborting due to 1 previous error diff --git a/tests/ui/on-unimplemented/on-impl.stderr b/tests/ui/on-unimplemented/on-impl.stderr index c7d2a78af6c..5e7e2c4ea77 100644 --- a/tests/ui/on-unimplemented/on-impl.stderr +++ b/tests/ui/on-unimplemented/on-impl.stderr @@ -7,7 +7,7 @@ LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32); | required by a bound introduced by this call | = help: the trait `Index<u32>` is not implemented for `[i32]` - = help: the trait `Index<usize>` is implemented for `[i32]` + but trait `Index<usize>` is implemented for it = help: for that trait implementation, expected `usize`, found `u32` error[E0277]: the trait bound `[i32]: Index<u32>` is not satisfied @@ -17,7 +17,7 @@ LL | Index::<u32>::index(&[1, 2, 3] as &[i32], 2u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice | = help: the trait `Index<u32>` is not implemented for `[i32]` - = help: the trait `Index<usize>` is implemented for `[i32]` + but trait `Index<usize>` is implemented for it = help: for that trait implementation, expected `usize`, found `u32` error: aborting due to 2 previous errors diff --git a/tests/ui/on-unimplemented/slice-index.stderr b/tests/ui/on-unimplemented/slice-index.stderr index 0f8d105abef..0a9ebe3f088 100644 --- a/tests/ui/on-unimplemented/slice-index.stderr +++ b/tests/ui/on-unimplemented/slice-index.stderr @@ -4,8 +4,8 @@ error[E0277]: the type `[i32]` cannot be indexed by `i32` LL | x[1i32]; | ^^^^ slice indices are of type `usize` or ranges of `usize` | - = help: the trait `SliceIndex<[i32]>` is not implemented for `i32`, which is required by `[i32]: Index<_>` - = help: the trait `SliceIndex<[i32]>` is implemented for `usize` + = help: the trait `SliceIndex<[i32]>` is not implemented for `i32` + but it is implemented for `usize` = help: for that trait implementation, expected `usize`, found `i32` = note: required for `[i32]` to implement `Index<i32>` @@ -15,7 +15,7 @@ error[E0277]: the type `[i32]` cannot be indexed by `RangeTo<i32>` LL | x[..1i32]; | ^^^^^^ slice indices are of type `usize` or ranges of `usize` | - = help: the trait `SliceIndex<[i32]>` is not implemented for `RangeTo<i32>`, which is required by `[i32]: Index<_>` + = help: the trait `SliceIndex<[i32]>` is not implemented for `RangeTo<i32>` = help: the following other types implement trait `SliceIndex<T>`: `RangeTo<usize>` implements `SliceIndex<[T]>` `RangeTo<usize>` implements `SliceIndex<str>` diff --git a/tests/ui/on-unimplemented/suggest_tuple_wrap.rs b/tests/ui/on-unimplemented/suggest_tuple_wrap.rs new file mode 100644 index 00000000000..010a47aef62 --- /dev/null +++ b/tests/ui/on-unimplemented/suggest_tuple_wrap.rs @@ -0,0 +1,19 @@ +pub trait Argument {} +impl Argument for u8 {} +impl Argument for i8 {} +impl Argument for String {} +impl Argument for &str {} + +pub trait TupleArgs {} +impl<A: Argument> TupleArgs for (A,) {} +impl<A: Argument, B: Argument> TupleArgs for (A, B) {} +impl<A: Argument, B: Argument, C: Argument> TupleArgs for (A, B, C) {} + +fn convert_into_tuple(_x: impl TupleArgs) {} + +fn main() { + convert_into_tuple(42_u8); + //~^ ERROR E0277 + //~| HELP the following other types implement trait `TupleArgs` + //~| HELP use a unary tuple instead +} diff --git a/tests/ui/on-unimplemented/suggest_tuple_wrap.stderr b/tests/ui/on-unimplemented/suggest_tuple_wrap.stderr new file mode 100644 index 00000000000..93dd43aafd9 --- /dev/null +++ b/tests/ui/on-unimplemented/suggest_tuple_wrap.stderr @@ -0,0 +1,25 @@ +error[E0277]: the trait bound `u8: TupleArgs` is not satisfied + --> $DIR/suggest_tuple_wrap.rs:15:24 + | +LL | convert_into_tuple(42_u8); + | ------------------ ^^^^^ the trait `TupleArgs` is not implemented for `u8` + | | + | required by a bound introduced by this call + | + = help: the following other types implement trait `TupleArgs`: + (A, B) + (A, B, C) + (A,) +note: required by a bound in `convert_into_tuple` + --> $DIR/suggest_tuple_wrap.rs:12:32 + | +LL | fn convert_into_tuple(_x: impl TupleArgs) {} + | ^^^^^^^^^ required by this bound in `convert_into_tuple` +help: use a unary tuple instead + | +LL | convert_into_tuple((42_u8,)); + | + ++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.rs b/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.rs new file mode 100644 index 00000000000..e0036d30187 --- /dev/null +++ b/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.rs @@ -0,0 +1,26 @@ +struct Tuple; + +impl From<(u8,)> for Tuple { + fn from(_: (u8,)) -> Self { + todo!() + } +} +impl From<(u8, u8)> for Tuple { + fn from(_: (u8, u8)) -> Self { + todo!() + } +} +impl From<(u8, u8, u8)> for Tuple { + fn from(_: (u8, u8, u8)) -> Self { + todo!() + } +} + +fn convert_into_tuple(_x: impl Into<Tuple>) {} + +fn main() { + convert_into_tuple(42_u8); + //~^ ERROR E0277 + //~| HELP use a unary tuple instead + //~| HELP the following other types implement trait `From<T>` +} diff --git a/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.stderr b/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.stderr new file mode 100644 index 00000000000..6ee08d2cd1b --- /dev/null +++ b/tests/ui/on-unimplemented/suggest_tuple_wrap_root_obligation.stderr @@ -0,0 +1,26 @@ +error[E0277]: the trait bound `Tuple: From<u8>` is not satisfied + --> $DIR/suggest_tuple_wrap_root_obligation.rs:22:24 + | +LL | convert_into_tuple(42_u8); + | ------------------ ^^^^^ the trait `From<u8>` is not implemented for `Tuple` + | | + | required by a bound introduced by this call + | + = help: the following other types implement trait `From<T>`: + `Tuple` implements `From<(u8, u8)>` + `Tuple` implements `From<(u8, u8, u8)>` + `Tuple` implements `From<(u8,)>` + = note: required for `u8` to implement `Into<Tuple>` +note: required by a bound in `convert_into_tuple` + --> $DIR/suggest_tuple_wrap_root_obligation.rs:19:32 + | +LL | fn convert_into_tuple(_x: impl Into<Tuple>) {} + | ^^^^^^^^^^^ required by this bound in `convert_into_tuple` +help: use a unary tuple instead + | +LL | convert_into_tuple((42_u8,)); + | + ++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/or-patterns/or-patterns-syntactic-fail-2018.rs b/tests/ui/or-patterns/or-patterns-syntactic-fail-2018.rs index 7a94c96b79d..fb227bf0e91 100644 --- a/tests/ui/or-patterns/or-patterns-syntactic-fail-2018.rs +++ b/tests/ui/or-patterns/or-patterns-syntactic-fail-2018.rs @@ -9,5 +9,5 @@ macro_rules! accept_pat { ($p:pat) => {}; } -accept_pat!(p | q); //~ ERROR no rules expected the token `|` -accept_pat!(|p| q); //~ ERROR no rules expected the token `|` +accept_pat!(p | q); //~ ERROR no rules expected `|` +accept_pat!(|p| q); //~ ERROR no rules expected `|` diff --git a/tests/ui/or-patterns/or-patterns-syntactic-fail-2018.stderr b/tests/ui/or-patterns/or-patterns-syntactic-fail-2018.stderr index acc2099bbc6..47dac84ee49 100644 --- a/tests/ui/or-patterns/or-patterns-syntactic-fail-2018.stderr +++ b/tests/ui/or-patterns/or-patterns-syntactic-fail-2018.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `|` +error: no rules expected `|` --> $DIR/or-patterns-syntactic-fail-2018.rs:12:15 | LL | macro_rules! accept_pat { @@ -13,7 +13,7 @@ note: while trying to match meta-variable `$p:pat` LL | ($p:pat) => {}; | ^^^^^^ -error: no rules expected the token `|` +error: no rules expected `|` --> $DIR/or-patterns-syntactic-fail-2018.rs:13:13 | LL | macro_rules! accept_pat { diff --git a/tests/ui/overloaded/overloaded-calls-nontuple.stderr b/tests/ui/overloaded/overloaded-calls-nontuple.stderr index 45a84fc4d7b..22598f3a390 100644 --- a/tests/ui/overloaded/overloaded-calls-nontuple.stderr +++ b/tests/ui/overloaded/overloaded-calls-nontuple.stderr @@ -38,6 +38,10 @@ LL | self.call_mut(z) | note: required by a bound in `call_mut` --> $SRC_DIR/core/src/ops/function.rs:LL:COL +help: use a unary tuple instead + | +LL | self.call_mut((z,)) + | + ++ error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit --> $DIR/overloaded-calls-nontuple.rs:29:10 diff --git a/tests/ui/parser/impls-nested-within-fns-semantic-1.rs b/tests/ui/parser/impls-nested-within-fns-semantic-1.rs index 92823b05af8..f06d19d7f5e 100644 --- a/tests/ui/parser/impls-nested-within-fns-semantic-1.rs +++ b/tests/ui/parser/impls-nested-within-fns-semantic-1.rs @@ -2,8 +2,7 @@ //@ check-pass //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Trait { diff --git a/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr b/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr index 66b57c772d5..e34371be3d2 100644 --- a/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr +++ b/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr @@ -353,10 +353,6 @@ LL | static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]); | = note: calls in statics are limited to constant functions, tuple structs and tuple variants = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)` -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 40 previous errors diff --git a/tests/ui/parser/macro/macro-doc-comments-1.rs b/tests/ui/parser/macro/macro-doc-comments-1.rs index 8d8103bb1e0..1aaa993e072 100644 --- a/tests/ui/parser/macro/macro-doc-comments-1.rs +++ b/tests/ui/parser/macro/macro-doc-comments-1.rs @@ -4,6 +4,6 @@ macro_rules! outer { outer! { //! Inner -} //~^ ERROR no rules expected the token `!` +} //~^ ERROR no rules expected `!` fn main() { } diff --git a/tests/ui/parser/macro/macro-doc-comments-1.stderr b/tests/ui/parser/macro/macro-doc-comments-1.stderr index 9d2d1bc0072..6b7e758980c 100644 --- a/tests/ui/parser/macro/macro-doc-comments-1.stderr +++ b/tests/ui/parser/macro/macro-doc-comments-1.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `!` +error: no rules expected `!` --> $DIR/macro-doc-comments-1.rs:6:5 | LL | macro_rules! outer { diff --git a/tests/ui/parser/macro/macro-doc-comments-2.rs b/tests/ui/parser/macro/macro-doc-comments-2.rs index 8f33720ae80..2bee2435ef8 100644 --- a/tests/ui/parser/macro/macro-doc-comments-2.rs +++ b/tests/ui/parser/macro/macro-doc-comments-2.rs @@ -4,6 +4,6 @@ macro_rules! inner { inner! { /// Outer -} //~^ ERROR no rules expected the token `[` +} //~^ ERROR no rules expected `[` fn main() { } diff --git a/tests/ui/parser/macro/macro-doc-comments-2.stderr b/tests/ui/parser/macro/macro-doc-comments-2.stderr index 22efd995b46..02c12bf9591 100644 --- a/tests/ui/parser/macro/macro-doc-comments-2.stderr +++ b/tests/ui/parser/macro/macro-doc-comments-2.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `[` +error: no rules expected `[` --> $DIR/macro-doc-comments-2.rs:6:5 | LL | macro_rules! inner { diff --git a/tests/ui/parser/macro/macro-expand-to-match-arm.rs b/tests/ui/parser/macro/macro-expand-to-match-arm.rs index db38fa0d7bc..0e27836b718 100644 --- a/tests/ui/parser/macro/macro-expand-to-match-arm.rs +++ b/tests/ui/parser/macro/macro-expand-to-match-arm.rs @@ -1,7 +1,7 @@ macro_rules! arm { ($pattern:pat => $block:block) => { $pattern => $block - //~^ ERROR macro expansion ignores token `=>` and any following + //~^ ERROR macro expansion ignores `=>` and any tokens following //~| NOTE the usage of `arm!` is likely invalid in pattern context //~| NOTE macros cannot expand to match arms }; diff --git a/tests/ui/parser/macro/macro-expand-to-match-arm.stderr b/tests/ui/parser/macro/macro-expand-to-match-arm.stderr index e3e7ff89c81..1927d80fd72 100644 --- a/tests/ui/parser/macro/macro-expand-to-match-arm.stderr +++ b/tests/ui/parser/macro/macro-expand-to-match-arm.stderr @@ -1,4 +1,4 @@ -error: macro expansion ignores token `=>` and any following +error: macro expansion ignores `=>` and any tokens following --> $DIR/macro-expand-to-match-arm.rs:3:18 | LL | $pattern => $block diff --git a/tests/ui/parser/macro/macro-incomplete-parse.rs b/tests/ui/parser/macro/macro-incomplete-parse.rs index 544e4aa7b1b..612196aa4b2 100644 --- a/tests/ui/parser/macro/macro-incomplete-parse.rs +++ b/tests/ui/parser/macro/macro-incomplete-parse.rs @@ -2,7 +2,7 @@ macro_rules! ignored_item { () => { fn foo() {} fn bar() {} - , //~ ERROR macro expansion ignores token `,` + , //~ ERROR macro expansion ignores `,` } } @@ -13,7 +13,7 @@ macro_rules! ignored_expr { } macro_rules! ignored_pat { - () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,` + () => ( 1, 2 ) //~ ERROR macro expansion ignores `,` } ignored_item!(); diff --git a/tests/ui/parser/macro/macro-incomplete-parse.stderr b/tests/ui/parser/macro/macro-incomplete-parse.stderr index 707417b725e..096b5f718ae 100644 --- a/tests/ui/parser/macro/macro-incomplete-parse.stderr +++ b/tests/ui/parser/macro/macro-incomplete-parse.stderr @@ -1,4 +1,4 @@ -error: macro expansion ignores token `,` and any following +error: macro expansion ignores `,` and any tokens following --> $DIR/macro-incomplete-parse.rs:5:9 | LL | , @@ -20,7 +20,7 @@ LL | ignored_expr!(); | = note: this error originates in the macro `ignored_expr` (in Nightly builds, run with -Z macro-backtrace for more info) -error: macro expansion ignores token `,` and any following +error: macro expansion ignores `,` and any tokens following --> $DIR/macro-incomplete-parse.rs:16:14 | LL | () => ( 1, 2 ) diff --git a/tests/ui/parser/macro/trait-non-item-macros.rs b/tests/ui/parser/macro/trait-non-item-macros.rs index 97fb564bf64..e93000193b6 100644 --- a/tests/ui/parser/macro/trait-non-item-macros.rs +++ b/tests/ui/parser/macro/trait-non-item-macros.rs @@ -1,7 +1,7 @@ macro_rules! bah { ($a:expr) => { $a - }; //~^ ERROR macro expansion ignores token `2` and any following + }; //~^ ERROR macro expansion ignores expression `2` and any tokens following } trait Bar { diff --git a/tests/ui/parser/macro/trait-non-item-macros.stderr b/tests/ui/parser/macro/trait-non-item-macros.stderr index db20e6b24aa..1a828483778 100644 --- a/tests/ui/parser/macro/trait-non-item-macros.stderr +++ b/tests/ui/parser/macro/trait-non-item-macros.stderr @@ -1,4 +1,4 @@ -error: macro expansion ignores token `2` and any following +error: macro expansion ignores expression `2` and any tokens following --> $DIR/trait-non-item-macros.rs:3:9 | LL | $a diff --git a/tests/ui/parser/shebang/issue-71471-ignore-tidy.rs b/tests/ui/parser/shebang/issue-71471-ignore-tidy.rs index a2505180884..e9bff91f1e8 100644 --- a/tests/ui/parser/shebang/issue-71471-ignore-tidy.rs +++ b/tests/ui/parser/shebang/issue-71471-ignore-tidy.rs @@ -1,2 +1,4 @@ #!B //~ expected `[`, found `B` + +//@ reference: input.shebang diff --git a/tests/ui/parser/shebang/multiline-attrib.rs b/tests/ui/parser/shebang/multiline-attrib.rs index bb083610e55..2d2e0298638 100644 --- a/tests/ui/parser/shebang/multiline-attrib.rs +++ b/tests/ui/parser/shebang/multiline-attrib.rs @@ -1,6 +1,7 @@ #! [allow(unused_variables)] //@ check-pass +//@ reference: input.shebang.inner-attribute fn main() { let x = 5; diff --git a/tests/ui/parser/shebang/regular-attrib.rs b/tests/ui/parser/shebang/regular-attrib.rs index aed633d3ef1..c2ac25661ef 100644 --- a/tests/ui/parser/shebang/regular-attrib.rs +++ b/tests/ui/parser/shebang/regular-attrib.rs @@ -1,5 +1,6 @@ #![allow(unused_variables)] //@ check-pass +//@ reference: input.shebang.inner-attribute fn main() { let x = 5; } diff --git a/tests/ui/parser/shebang/shebang-and-attrib.rs b/tests/ui/parser/shebang/shebang-and-attrib.rs index a66c10db532..d73db6b22f0 100644 --- a/tests/ui/parser/shebang/shebang-and-attrib.rs +++ b/tests/ui/parser/shebang/shebang-and-attrib.rs @@ -1,6 +1,7 @@ #!/usr/bin/env run-cargo-script //@ check-pass +//@ reference: input.shebang.inner-attribute #![allow(unused_variables)] diff --git a/tests/ui/parser/shebang/shebang-comment.rs b/tests/ui/parser/shebang/shebang-comment.rs index 37bcac8b29e..6f89e8954c3 100644 --- a/tests/ui/parser/shebang/shebang-comment.rs +++ b/tests/ui/parser/shebang/shebang-comment.rs @@ -1,6 +1,7 @@ #!//bin/bash //@ check-pass +//@ reference: input.shebang fn main() { println!("a valid shebang (that is also a rust comment)") } diff --git a/tests/ui/parser/shebang/shebang-doc-comment.rs b/tests/ui/parser/shebang/shebang-doc-comment.rs index 72866753e0e..4992c758325 100644 --- a/tests/ui/parser/shebang/shebang-doc-comment.rs +++ b/tests/ui/parser/shebang/shebang-doc-comment.rs @@ -1,3 +1,5 @@ #!///bin/bash [allow(unused_variables)] //~^ ERROR expected item, found `[` + +//@ reference: input.shebang.inner-attribute diff --git a/tests/ui/parser/shebang/shebang-empty.rs b/tests/ui/parser/shebang/shebang-empty.rs index bb0df599783..51bf8a07c90 100644 --- a/tests/ui/parser/shebang/shebang-empty.rs +++ b/tests/ui/parser/shebang/shebang-empty.rs @@ -1,4 +1,5 @@ #! //@ check-pass +//@ reference: input.shebang fn main() {} diff --git a/tests/ui/parser/shebang/shebang-must-start-file.rs b/tests/ui/parser/shebang/shebang-must-start-file.rs index e0392572dc8..f91e32f744e 100644 --- a/tests/ui/parser/shebang/shebang-must-start-file.rs +++ b/tests/ui/parser/shebang/shebang-must-start-file.rs @@ -1,6 +1,8 @@ // something on the first line for tidy #!/bin/bash //~ expected `[`, found `/` +//@ reference: input.shebang + fn main() { println!("ok!"); } diff --git a/tests/ui/parser/shebang/shebang-space.rs b/tests/ui/parser/shebang/shebang-space.rs index cc58eed8b8a..803d4e04057 100644 --- a/tests/ui/parser/shebang/shebang-space.rs +++ b/tests/ui/parser/shebang/shebang-space.rs @@ -1,5 +1,6 @@ #! //@ check-pass +//@ reference: input.shebang // ignore-tidy-end-whitespace fn main() {} diff --git a/tests/ui/parser/shebang/sneaky-attrib.rs b/tests/ui/parser/shebang/sneaky-attrib.rs index eb814c6af24..e22c45cc39f 100644 --- a/tests/ui/parser/shebang/sneaky-attrib.rs +++ b/tests/ui/parser/shebang/sneaky-attrib.rs @@ -11,6 +11,7 @@ [allow(unused_variables)] //@ check-pass +//@ reference: input.shebang.inner-attribute fn main() { let x = 5; } diff --git a/tests/ui/parser/shebang/valid-shebang.rs b/tests/ui/parser/shebang/valid-shebang.rs index e59d4074ddf..f93b0e15d77 100644 --- a/tests/ui/parser/shebang/valid-shebang.rs +++ b/tests/ui/parser/shebang/valid-shebang.rs @@ -1,6 +1,7 @@ #!/usr/bin/env run-cargo-script //@ check-pass +//@ reference: input.shebang fn main() { println!("Hello World!"); } diff --git a/tests/ui/parser/struct-literal-in-for.stderr b/tests/ui/parser/struct-literal-in-for.stderr index d2ef2ad7b5a..1c91eba68e3 100644 --- a/tests/ui/parser/struct-literal-in-for.stderr +++ b/tests/ui/parser/struct-literal-in-for.stderr @@ -23,7 +23,7 @@ LL | | x: 3 LL | | }.hi() { | |__________^ `bool` is not an iterator | - = help: the trait `Iterator` is not implemented for `bool`, which is required by `bool: IntoIterator` + = help: the trait `Iterator` is not implemented for `bool` = note: required for `bool` to implement `IntoIterator` error: aborting due to 2 previous errors diff --git a/tests/ui/parser/utf16-be-without-bom.rs b/tests/ui/parser/utf16-be-without-bom.rs index 68e89bc7c22..f5fe8dc5a8c 100644 --- a/tests/ui/parser/utf16-be-without-bom.rs +++ b/tests/ui/parser/utf16-be-without-bom.rs Binary files differdiff --git a/tests/ui/parser/utf16-be-without-bom.stderr b/tests/ui/parser/utf16-be-without-bom.stderr index 55ebf7aacd2..b915c7941b3 100644 --- a/tests/ui/parser/utf16-be-without-bom.stderr +++ b/tests/ui/parser/utf16-be-without-bom.stderr @@ -1,5 +1,5 @@ error: unknown start of token: \u{0} - --> $DIR/utf16-be-without-bom.rs:4:1 + --> $DIR/utf16-be-without-bom.rs:5:1 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -7,7 +7,7 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-be-without-bom.rs:4:3 + --> $DIR/utf16-be-without-bom.rs:5:3 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -15,7 +15,7 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-be-without-bom.rs:4:5 + --> $DIR/utf16-be-without-bom.rs:5:5 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -23,7 +23,7 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-be-without-bom.rs:4:7 + --> $DIR/utf16-be-without-bom.rs:5:7 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -31,7 +31,7 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-be-without-bom.rs:4:9 + --> $DIR/utf16-be-without-bom.rs:5:9 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -39,7 +39,7 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-be-without-bom.rs:4:11 + --> $DIR/utf16-be-without-bom.rs:5:11 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -47,7 +47,7 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-be-without-bom.rs:4:13 + --> $DIR/utf16-be-without-bom.rs:5:13 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -55,7 +55,7 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-be-without-bom.rs:4:15 + --> $DIR/utf16-be-without-bom.rs:5:15 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -63,7 +63,7 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-be-without-bom.rs:4:17 + --> $DIR/utf16-be-without-bom.rs:5:17 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -71,7 +71,7 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-be-without-bom.rs:4:19 + --> $DIR/utf16-be-without-bom.rs:5:19 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -79,7 +79,7 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-be-without-bom.rs:4:21 + --> $DIR/utf16-be-without-bom.rs:5:21 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -87,7 +87,7 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-be-without-bom.rs:4:23 + --> $DIR/utf16-be-without-bom.rs:5:23 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -95,7 +95,7 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-be-without-bom.rs:4:25 + --> $DIR/utf16-be-without-bom.rs:5:25 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -103,7 +103,7 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: expected one of `!` or `::`, found `n` - --> $DIR/utf16-be-without-bom.rs:4:4 + --> $DIR/utf16-be-without-bom.rs:5:4 | LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ expected one of `!` or `::` diff --git a/tests/ui/parser/utf16-le-without-bom.rs b/tests/ui/parser/utf16-le-without-bom.rs index bdf4860d016..8c781b27dc0 100644 --- a/tests/ui/parser/utf16-le-without-bom.rs +++ b/tests/ui/parser/utf16-le-without-bom.rs Binary files differdiff --git a/tests/ui/parser/utf16-le-without-bom.stderr b/tests/ui/parser/utf16-le-without-bom.stderr index ad272a70f06..d937a07bc66 100644 --- a/tests/ui/parser/utf16-le-without-bom.stderr +++ b/tests/ui/parser/utf16-le-without-bom.stderr @@ -1,5 +1,5 @@ error: unknown start of token: \u{0} - --> $DIR/utf16-le-without-bom.rs:4:2 + --> $DIR/utf16-le-without-bom.rs:5:2 | LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -7,7 +7,7 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-le-without-bom.rs:4:4 + --> $DIR/utf16-le-without-bom.rs:5:4 | LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -15,7 +15,7 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-le-without-bom.rs:4:6 + --> $DIR/utf16-le-without-bom.rs:5:6 | LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -23,7 +23,7 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-le-without-bom.rs:4:8 + --> $DIR/utf16-le-without-bom.rs:5:8 | LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -31,7 +31,7 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-le-without-bom.rs:4:10 + --> $DIR/utf16-le-without-bom.rs:5:10 | LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -39,7 +39,7 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-le-without-bom.rs:4:12 + --> $DIR/utf16-le-without-bom.rs:5:12 | LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -47,7 +47,7 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-le-without-bom.rs:4:14 + --> $DIR/utf16-le-without-bom.rs:5:14 | LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -55,7 +55,7 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-le-without-bom.rs:4:16 + --> $DIR/utf16-le-without-bom.rs:5:16 | LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -63,7 +63,7 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-le-without-bom.rs:4:18 + --> $DIR/utf16-le-without-bom.rs:5:18 | LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -71,7 +71,7 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-le-without-bom.rs:4:20 + --> $DIR/utf16-le-without-bom.rs:5:20 | LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -79,7 +79,7 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-le-without-bom.rs:4:22 + --> $DIR/utf16-le-without-bom.rs:5:22 | LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -87,7 +87,7 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-le-without-bom.rs:4:24 + --> $DIR/utf16-le-without-bom.rs:5:24 | LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ @@ -95,7 +95,7 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: unknown start of token: \u{0} - --> $DIR/utf16-le-without-bom.rs:5:1 + --> $DIR/utf16-le-without-bom.rs:6:1 | LL | ␀ | ^ @@ -103,7 +103,7 @@ LL | ␀ = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used error: expected one of `!` or `::`, found `n` - --> $DIR/utf16-le-without-bom.rs:4:3 + --> $DIR/utf16-le-without-bom.rs:5:3 | LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | ^ expected one of `!` or `::` diff --git a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr index f277bfbc884..158eac9a1bd 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr @@ -21,6 +21,10 @@ LL | let HiddenStruct { one, two, .. } = HiddenStruct::default(); | ~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); + | ~~~~~~~~~~~~~~ +help: or always ignore missing fields here + | LL | let HiddenStruct { one, .. } = HiddenStruct::default(); | ~~~~~~ @@ -36,6 +40,10 @@ LL | let HiddenStruct { one, hide, two } = HiddenStruct::default(); | ~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); + | ~~~~~~~~~~ +help: or always ignore missing fields here + | LL | let HiddenStruct { one, hide, .. } = HiddenStruct::default(); | ~~~~~~ @@ -51,6 +59,10 @@ LL | let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: | ~~~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; + | ~~~~~~~~~~~~~~~~ +help: or always ignore missing fields here + | LL | let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; | ~~~~~~ diff --git a/tests/ui/pattern/usefulness/impl-trait.stderr b/tests/ui/pattern/usefulness/impl-trait.stderr index 75cba4b5f02..34f8eb1e163 100644 --- a/tests/ui/pattern/usefulness/impl-trait.stderr +++ b/tests/ui/pattern/usefulness/impl-trait.stderr @@ -25,6 +25,20 @@ LL | _ => {} | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types +error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty + --> $DIR/impl-trait.rs:23:11 + | +LL | match return_never_rpit(x) {} + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: the matched value is of type `impl Copy` +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown + | +LL ~ match return_never_rpit(x) { +LL + _ => todo!(), +LL + } + | + error: unreachable pattern --> $DIR/impl-trait.rs:45:13 | @@ -93,6 +107,20 @@ LL | _ => {} | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types +error[E0004]: non-exhaustive patterns: type `T` is non-empty + --> $DIR/impl-trait.rs:37:11 + | +LL | match return_never_tait(x) {} + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: the matched value is of type `T` +help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown + | +LL ~ match return_never_tait(x) { +LL + _ => todo!(), +LL + } + | + error: unreachable pattern --> $DIR/impl-trait.rs:105:9 | @@ -131,34 +159,6 @@ LL | _ => {} | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types -error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty - --> $DIR/impl-trait.rs:23:11 - | -LL | match return_never_rpit(x) {} - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: the matched value is of type `impl Copy` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown - | -LL ~ match return_never_rpit(x) { -LL + _ => todo!(), -LL + } - | - -error[E0004]: non-exhaustive patterns: type `T` is non-empty - --> $DIR/impl-trait.rs:37:11 - | -LL | match return_never_tait(x) {} - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: the matched value is of type `T` -help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown - | -LL ~ match return_never_tait(x) { -LL + _ => todo!(), -LL + } - | - error: aborting due to 15 previous errors For more information about this error, try `rustc --explain E0004`. diff --git a/tests/ui/pattern/usefulness/stable-gated-fields.stderr b/tests/ui/pattern/usefulness/stable-gated-fields.stderr index cf98c51a2b4..d6e9bac7c13 100644 --- a/tests/ui/pattern/usefulness/stable-gated-fields.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-fields.stderr @@ -10,6 +10,10 @@ LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); | ~~~~~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); + | ~~~~~~~~~~~~~~~~~~ +help: or always ignore missing fields here + | LL | let UnstableStruct { stable, .. } = UnstableStruct::default(); | ~~~~~~ diff --git a/tests/ui/pattern/usefulness/unstable-gated-fields.stderr b/tests/ui/pattern/usefulness/unstable-gated-fields.stderr index e4f5fa06b3f..bb10e439ee2 100644 --- a/tests/ui/pattern/usefulness/unstable-gated-fields.stderr +++ b/tests/ui/pattern/usefulness/unstable-gated-fields.stderr @@ -10,6 +10,10 @@ LL | let UnstableStruct { stable, stable2, unstable } = UnstableStruct::defa | ~~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | let UnstableStruct { stable, stable2, unstable: _ } = UnstableStruct::default(); + | ~~~~~~~~~~~~~~~ +help: or always ignore missing fields here + | LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); | ~~~~~~ @@ -25,6 +29,10 @@ LL | let UnstableStruct { stable, unstable, stable2 } = UnstableStruct::defa | ~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | let UnstableStruct { stable, unstable, stable2: _ } = UnstableStruct::default(); + | ~~~~~~~~~~~~~~ +help: or always ignore missing fields here + | LL | let UnstableStruct { stable, unstable, .. } = UnstableStruct::default(); | ~~~~~~ diff --git a/tests/ui/pin-macro/cant_access_internals.rs b/tests/ui/pin-macro/cant_access_internals.rs index 17fe7fa0738..36a47d0fdf9 100644 --- a/tests/ui/pin-macro/cant_access_internals.rs +++ b/tests/ui/pin-macro/cant_access_internals.rs @@ -8,5 +8,5 @@ use core::{ fn main() { let mut phantom_pinned = pin!(PhantomPinned); - mem::take(phantom_pinned.__pointer); //~ ERROR use of unstable library feature 'unsafe_pin_internals' + mem::take(phantom_pinned.__pointer); //~ ERROR use of unstable library feature `unsafe_pin_internals` } diff --git a/tests/ui/pin-macro/cant_access_internals.stderr b/tests/ui/pin-macro/cant_access_internals.stderr index 444314a9d8b..8ad897bbbb9 100644 --- a/tests/ui/pin-macro/cant_access_internals.stderr +++ b/tests/ui/pin-macro/cant_access_internals.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unsafe_pin_internals' +error[E0658]: use of unstable library feature `unsafe_pin_internals` --> $DIR/cant_access_internals.rs:11:15 | LL | mem::take(phantom_pinned.__pointer); diff --git a/tests/ui/print-request/host.rs b/tests/ui/print-request/host.rs new file mode 100644 index 00000000000..d54da9b35d0 --- /dev/null +++ b/tests/ui/print-request/host.rs @@ -0,0 +1,5 @@ +//@ only-x86_64-unknown-linux-gnu +//@ compile-flags: --print host-tuple +//@ check-pass + +fn main() {} diff --git a/tests/ui/print-request/host.stdout b/tests/ui/print-request/host.stdout new file mode 100644 index 00000000000..21696ec3a0c --- /dev/null +++ b/tests/ui/print-request/host.stdout @@ -0,0 +1 @@ +x86_64-unknown-linux-gnu diff --git a/tests/ui/deployment-target/invalid-target.rs b/tests/ui/print-request/invalid-target.rs index 52f09ea73d7..52f09ea73d7 100644 --- a/tests/ui/deployment-target/invalid-target.rs +++ b/tests/ui/print-request/invalid-target.rs diff --git a/tests/ui/deployment-target/invalid-target.stderr b/tests/ui/print-request/invalid-target.stderr index 0ab548f339b..0ab548f339b 100644 --- a/tests/ui/deployment-target/invalid-target.stderr +++ b/tests/ui/print-request/invalid-target.stderr diff --git a/tests/ui/deployment-target/macos-target.rs b/tests/ui/print-request/macos-target.rs index 197edd02474..197edd02474 100644 --- a/tests/ui/deployment-target/macos-target.rs +++ b/tests/ui/print-request/macos-target.rs diff --git a/tests/ui/deployment-target/macos-target.stdout b/tests/ui/print-request/macos-target.stdout index f55ef568ed6..f55ef568ed6 100644 --- a/tests/ui/deployment-target/macos-target.stdout +++ b/tests/ui/print-request/macos-target.stdout diff --git a/tests/ui/print_type_sizes/niche-filling.rs b/tests/ui/print_type_sizes/niche-filling.rs index 5dda0da8458..36739e3fc04 100644 --- a/tests/ui/print_type_sizes/niche-filling.rs +++ b/tests/ui/print_type_sizes/niche-filling.rs @@ -9,7 +9,7 @@ //! padding and overall computed sizes can be quite different. //! //@ compile-flags: -Z print-type-sizes --crate-type lib -//@ ignore-debug: debug assertions will print more types +//@ ignore-std-debug-assertions (debug assertions will print more types) //@ build-pass //@ ignore-pass // ^-- needed because `--pass check` does not emit the output needed. diff --git a/tests/ui/proc-macro/attr-invalid-exprs.rs b/tests/ui/proc-macro/attr-invalid-exprs.rs index 3d8806ee800..ec0b79469a4 100644 --- a/tests/ui/proc-macro/attr-invalid-exprs.rs +++ b/tests/ui/proc-macro/attr-invalid-exprs.rs @@ -13,7 +13,7 @@ fn main() { //~^ ERROR expected expression, found end of macro arguments let _ = #[duplicate] "Hello, world!"; - //~^ ERROR macro expansion ignores token `,` and any following + //~^ ERROR macro expansion ignores `,` and any tokens following let _ = { #[no_output] @@ -22,7 +22,7 @@ fn main() { let _ = { #[duplicate] - //~^ ERROR macro expansion ignores token `,` and any following + //~^ ERROR macro expansion ignores `,` and any tokens following "Hello, world!" }; } diff --git a/tests/ui/proc-macro/attr-invalid-exprs.stderr b/tests/ui/proc-macro/attr-invalid-exprs.stderr index f96939bb6ef..0d500c87145 100644 --- a/tests/ui/proc-macro/attr-invalid-exprs.stderr +++ b/tests/ui/proc-macro/attr-invalid-exprs.stderr @@ -4,7 +4,7 @@ error: expected expression, found end of macro arguments LL | let _ = #[no_output] "Hello, world!"; | ^^^^^^^^^^^^ -error: macro expansion ignores token `,` and any following +error: macro expansion ignores `,` and any tokens following --> $DIR/attr-invalid-exprs.rs:15:13 | LL | let _ = #[duplicate] "Hello, world!"; @@ -16,7 +16,7 @@ help: you might be missing a semicolon here LL | let _ = #[duplicate]; "Hello, world!"; | + -error: macro expansion ignores token `,` and any following +error: macro expansion ignores `,` and any tokens following --> $DIR/attr-invalid-exprs.rs:24:9 | LL | #[duplicate] diff --git a/tests/ui/proc-macro/expand-expr.rs b/tests/ui/proc-macro/expand-expr.rs index 5f7375d7450..e06ddc51a29 100644 --- a/tests/ui/proc-macro/expand-expr.rs +++ b/tests/ui/proc-macro/expand-expr.rs @@ -114,8 +114,8 @@ expand_expr_fail!(echo_pm!($)); //~ ERROR: expected expression, found `$` // We get errors reported and recover during macro expansion if the macro // doesn't produce a valid expression. -expand_expr_is!("string", echo_tts!("string"; hello)); //~ ERROR: macro expansion ignores token `hello` and any following -expand_expr_is!("string", echo_pm!("string"; hello)); //~ ERROR: macro expansion ignores token `;` and any following +expand_expr_is!("string", echo_tts!("string"; hello)); //~ ERROR: macro expansion ignores `hello` and any tokens following +expand_expr_is!("string", echo_pm!("string"; hello)); //~ ERROR: macro expansion ignores `;` and any tokens following // For now, fail if a non-literal expression is expanded. expand_expr_fail!(arbitrary_expression() + "etc"); diff --git a/tests/ui/proc-macro/expand-expr.stderr b/tests/ui/proc-macro/expand-expr.stderr index 2b92472e5ab..8b1df177cfa 100644 --- a/tests/ui/proc-macro/expand-expr.stderr +++ b/tests/ui/proc-macro/expand-expr.stderr @@ -22,7 +22,7 @@ error: expected expression, found `$` LL | expand_expr_fail!(echo_pm!($)); | ^ expected expression -error: macro expansion ignores token `hello` and any following +error: macro expansion ignores `hello` and any tokens following --> $DIR/expand-expr.rs:117:47 | LL | expand_expr_is!("string", echo_tts!("string"; hello)); @@ -34,7 +34,7 @@ help: you might be missing a semicolon here LL | expand_expr_is!("string", echo_tts!("string"; hello);); | + -error: macro expansion ignores token `;` and any following +error: macro expansion ignores `;` and any tokens following --> $DIR/expand-expr.rs:118:44 | LL | expand_expr_is!("string", echo_pm!("string"; hello)); diff --git a/tests/ui/proc-macro/expand-to-unstable.stderr b/tests/ui/proc-macro/expand-to-unstable.stderr index 9eb701d9702..563c7ae8f95 100644 --- a/tests/ui/proc-macro/expand-to-unstable.stderr +++ b/tests/ui/proc-macro/expand-to-unstable.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library +error[E0658]: use of unstable library feature `core_intrinsics`: intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library --> $DIR/expand-to-unstable.rs:8:10 | LL | #[derive(Unstable)] diff --git a/tests/ui/range/range-1.stderr b/tests/ui/range/range-1.stderr index f98420557c6..f77601bc43c 100644 --- a/tests/ui/range/range-1.stderr +++ b/tests/ui/range/range-1.stderr @@ -8,7 +8,7 @@ error[E0277]: the trait bound `bool: Step` is not satisfied --> $DIR/range-1.rs:9:14 | LL | for i in false..true {} - | ^^^^^^^^^^^ the trait `Step` is not implemented for `bool`, which is required by `std::ops::Range<bool>: IntoIterator` + | ^^^^^^^^^^^ the trait `Step` is not implemented for `bool` | = help: the following other types implement trait `Step`: Char diff --git a/tests/ui/recursion/issue-38591-non-regular-dropck-recursion.rs b/tests/ui/recursion/issue-38591-non-regular-dropck-recursion.rs index c9e93174e20..5c6eef46103 100644 --- a/tests/ui/recursion/issue-38591-non-regular-dropck-recursion.rs +++ b/tests/ui/recursion/issue-38591-non-regular-dropck-recursion.rs @@ -8,7 +8,7 @@ struct S<T> { s: Box<S<fn(u: T)>>, } -fn f(x: S<u32>) {} //~ ERROR overflow while adding drop-check rules for S<u32> +fn f(x: S<u32>) {} //~ ERROR overflow while adding drop-check rules for `S<u32>` fn main() { // Force instantiation. diff --git a/tests/ui/recursion/issue-38591-non-regular-dropck-recursion.stderr b/tests/ui/recursion/issue-38591-non-regular-dropck-recursion.stderr index a5bbc5499a8..409f63b91b6 100644 --- a/tests/ui/recursion/issue-38591-non-regular-dropck-recursion.stderr +++ b/tests/ui/recursion/issue-38591-non-regular-dropck-recursion.stderr @@ -1,10 +1,10 @@ -error[E0320]: overflow while adding drop-check rules for S<u32> +error[E0320]: overflow while adding drop-check rules for `S<u32>` --> $DIR/issue-38591-non-regular-dropck-recursion.rs:11:6 | LL | fn f(x: S<u32>) {} | ^ | - = note: overflowed on S<fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(u32)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))> + = note: overflowed on `S<fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(u32)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))>` error: aborting due to 1 previous error diff --git a/tests/ui/recursion/recursive-requirements.stderr b/tests/ui/recursion/recursive-requirements.stderr index f5cbed0ce34..bb63f7cd0dc 100644 --- a/tests/ui/recursion/recursive-requirements.stderr +++ b/tests/ui/recursion/recursive-requirements.stderr @@ -4,7 +4,7 @@ error[E0277]: `*const Bar` cannot be shared between threads safely LL | let _: AssertSync<Foo> = unimplemented!(); | ^^^^^^^^^^^^^^^ `*const Bar` cannot be shared between threads safely | - = help: within `Foo`, the trait `Sync` is not implemented for `*const Bar`, which is required by `Foo: Sync` + = help: within `Foo`, the trait `Sync` is not implemented for `*const Bar` note: required because it appears within the type `Foo` --> $DIR/recursive-requirements.rs:5:12 | @@ -22,7 +22,7 @@ error[E0277]: `*const Foo` cannot be shared between threads safely LL | let _: AssertSync<Foo> = unimplemented!(); | ^^^^^^^^^^^^^^^ `*const Foo` cannot be shared between threads safely | - = help: within `Foo`, the trait `Sync` is not implemented for `*const Foo`, which is required by `Foo: Sync` + = help: within `Foo`, the trait `Sync` is not implemented for `*const Foo` note: required because it appears within the type `Bar` --> $DIR/recursive-requirements.rs:10:12 | diff --git a/tests/ui/repr/16-bit-repr-c-enum.rs b/tests/ui/repr/16-bit-repr-c-enum.rs index 2509416ad87..2b6bbf12650 100644 --- a/tests/ui/repr/16-bit-repr-c-enum.rs +++ b/tests/ui/repr/16-bit-repr-c-enum.rs @@ -21,11 +21,12 @@ enum Foo { Bar, } -extern "rust-intrinsic" { - #[stable(feature = "intrinsics_for_test", since = "3.3.3")] - #[rustc_const_stable(feature = "intrinsics_for_test", since = "3.3.3")] - #[rustc_safe_intrinsic] - fn size_of<T>() -> usize; +#[stable(feature = "intrinsics_for_test", since = "3.3.3")] +#[rustc_const_stable(feature = "intrinsics_for_test", since = "3.3.3")] +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +const fn size_of<T>() -> usize { + loop {} } #[lang="sized"] diff --git a/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr b/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr index e2e57fe0e73..64a0cb7f31a 100644 --- a/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr +++ b/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr @@ -190,7 +190,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -254,7 +254,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr b/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr index 6ecdab1cc14..5c4daa6d519 100644 --- a/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr +++ b/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr @@ -190,7 +190,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -254,7 +254,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr b/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr index e2e57fe0e73..64a0cb7f31a 100644 --- a/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr +++ b/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr @@ -190,7 +190,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -254,7 +254,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr b/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr index e2e57fe0e73..64a0cb7f31a 100644 --- a/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr +++ b/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr @@ -190,7 +190,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -254,7 +254,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/repr/repr-c-int-dead-variants.stderr b/tests/ui/repr/repr-c-int-dead-variants.stderr index f7df576df24..75005a64523 100644 --- a/tests/ui/repr/repr-c-int-dead-variants.stderr +++ b/tests/ui/repr/repr-c-int-dead-variants.stderr @@ -190,7 +190,7 @@ error: layout_of(DeadBranchHasOtherFieldU8) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -254,7 +254,7 @@ error: layout_of(DeadBranchHasOtherFieldU8) = Layout { abi: Align(8 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/repr/repr_align_greater_usize.msp430.stderr b/tests/ui/repr/repr_align_greater_usize.msp430.stderr new file mode 100644 index 00000000000..7c85249c009 --- /dev/null +++ b/tests/ui/repr/repr_align_greater_usize.msp430.stderr @@ -0,0 +1,19 @@ +error[E0589]: alignment must not be greater than `isize::MAX` bytes + --> $DIR/repr_align_greater_usize.rs:21:8 + | +LL | #[repr(align(32768))] + | ^^^^^^^^^^^^ + | + = note: `isize::MAX` is 32767 for the current target + +error[E0589]: alignment must not be greater than `isize::MAX` bytes + --> $DIR/repr_align_greater_usize.rs:24:8 + | +LL | #[repr(align(65536))] + | ^^^^^^^^^^^^ + | + = note: `isize::MAX` is 32767 for the current target + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0589`. diff --git a/tests/ui/repr/repr_align_greater_usize.rs b/tests/ui/repr/repr_align_greater_usize.rs new file mode 100644 index 00000000000..b47320b6d9b --- /dev/null +++ b/tests/ui/repr/repr_align_greater_usize.rs @@ -0,0 +1,25 @@ +//@ revisions: msp430 aarch32 +//@[msp430] needs-llvm-components: msp430 +//@[msp430] compile-flags: --target=msp430-none-elf +//@[aarch32] build-pass +//@[aarch32] needs-llvm-components: arm +//@[aarch32] compile-flags: --target=thumbv7m-none-eabi + +// We should fail to compute alignment for types aligned higher than usize::MAX. +// We can't handle alignments that require all 32 bits, so this only affects 16-bit. + +#![feature(lang_items, no_core)] +#![no_core] +#![crate_type = "lib"] + +#[lang = "sized"] +trait Sized {} + +#[repr(align(16384))] +struct Kitten; + +#[repr(align(32768))] //[msp430]~ ERROR alignment must not be greater than `isize::MAX` +struct Cat; + +#[repr(align(65536))] //[msp430]~ ERROR alignment must not be greater than `isize::MAX` +struct BigCat; diff --git a/tests/ui/resolve/issue-100365.stderr b/tests/ui/resolve/issue-100365.stderr index 372d7726668..2d9bab4304d 100644 --- a/tests/ui/resolve/issue-100365.stderr +++ b/tests/ui/resolve/issue-100365.stderr @@ -2,19 +2,34 @@ error[E0423]: expected value, found trait `Into` --> $DIR/issue-100365.rs:2:16 | LL | let addr = Into::<std::net::IpAddr>.into([127, 0, 0, 1]); - | ^^^^^^^^^^^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let addr = Into::<std::net::IpAddr>::into([127, 0, 0, 1]); + | ~~ error[E0423]: expected value, found trait `Into` --> $DIR/issue-100365.rs:6:13 | LL | let _ = Into.into(()); - | ^^^^- help: use the path separator to refer to an item: `::` + | ^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = Into::into(()); + | ~~ error[E0423]: expected value, found trait `Into` --> $DIR/issue-100365.rs:10:13 | LL | let _ = Into::<()>.into; - | ^^^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = Into::<()>::into; + | ~~ error[E0423]: expected value, found trait `std::iter::Iterator` --> $DIR/issue-100365.rs:17:9 @@ -42,12 +57,16 @@ error[E0423]: expected value, found trait `Into` --> $DIR/issue-100365.rs:25:9 | LL | Into::<String>.into("") - | ^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^^^^^^^ ... LL | let _ = create!(); | --------- in this macro invocation | = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the path separator to refer to an item + | +LL | Into::<String>::into("") + | ~~ error: aborting due to 6 previous errors diff --git a/tests/ui/resolve/issue-22692.stderr b/tests/ui/resolve/issue-22692.stderr index 6962aa161e9..be0634ebffc 100644 --- a/tests/ui/resolve/issue-22692.stderr +++ b/tests/ui/resolve/issue-22692.stderr @@ -2,19 +2,34 @@ error[E0423]: expected value, found struct `String` --> $DIR/issue-22692.rs:2:13 | LL | let _ = String.new(); - | ^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = String::new(); + | ~~ error[E0423]: expected value, found struct `String` --> $DIR/issue-22692.rs:6:13 | LL | let _ = String.default; - | ^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = String::default; + | ~~ error[E0423]: expected value, found struct `Vec` --> $DIR/issue-22692.rs:10:13 | LL | let _ = Vec::<()>.with_capacity(1); - | ^^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = Vec::<()>::with_capacity(1); + | ~~ error[E0423]: expected value, found struct `std::cell::Cell` --> $DIR/issue-22692.rs:17:9 @@ -50,23 +65,31 @@ error[E0423]: expected value, found struct `Vec` --> $DIR/issue-22692.rs:26:9 | LL | Vec.new() - | ^^^- help: use the path separator to refer to an item: `::` + | ^^^ ... LL | let _ = create!(type method); | -------------------- in this macro invocation | = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the path separator to refer to an item + | +LL | Vec::new() + | ~~ error[E0423]: expected value, found struct `Vec` --> $DIR/issue-22692.rs:31:9 | LL | Vec.new - | ^^^- help: use the path separator to refer to an item: `::` + | ^^^ ... LL | let _ = create!(type field); | ------------------- in this macro invocation | = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the path separator to refer to an item + | +LL | Vec::new + | ~~ error[E0423]: expected value, found struct `std::cell::Cell` --> $DIR/issue-22692.rs:17:9 diff --git a/tests/ui/resolve/issue-39559-2.stderr b/tests/ui/resolve/issue-39559-2.stderr index 7f51357a56f..ea27e7bd250 100644 --- a/tests/ui/resolve/issue-39559-2.stderr +++ b/tests/ui/resolve/issue-39559-2.stderr @@ -5,10 +5,6 @@ LL | let array: [usize; Dim3::dim()] | ^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: cannot call non-const fn `<Dim3 as Dim>::dim` in constants --> $DIR/issue-39559-2.rs:16:15 @@ -17,10 +13,6 @@ LL | = [0; Dim3::dim()]; | ^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/resolve-variant-assoc-item.stderr b/tests/ui/resolve/resolve-variant-assoc-item.stderr index ed157197d17..9a5a605ac05 100644 --- a/tests/ui/resolve/resolve-variant-assoc-item.stderr +++ b/tests/ui/resolve/resolve-variant-assoc-item.stderr @@ -6,7 +6,7 @@ LL | E::V::associated_item; | help: there is an enum variant `E::V`; try using the variant's enum | -LL | E; +LL | E::associated_item; | ~ error[E0433]: failed to resolve: `V` is a variant, not a module @@ -17,10 +17,6 @@ LL | V::associated_item; | help: there is an enum variant `E::V`; try using the variant's enum | -LL | E; - | ~ -help: an enum with a similar name exists - | LL | E::associated_item; | ~ diff --git a/tests/ui/resolve/suggest-path-for-tuple-struct.stderr b/tests/ui/resolve/suggest-path-for-tuple-struct.stderr index 4764cf2db20..12c631f5a83 100644 --- a/tests/ui/resolve/suggest-path-for-tuple-struct.stderr +++ b/tests/ui/resolve/suggest-path-for-tuple-struct.stderr @@ -2,13 +2,23 @@ error[E0423]: expected value, found struct `SomeTupleStruct` --> $DIR/suggest-path-for-tuple-struct.rs:22:13 | LL | let _ = SomeTupleStruct.new(); - | ^^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^^^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = SomeTupleStruct::new(); + | ~~ error[E0423]: expected value, found struct `SomeRegularStruct` --> $DIR/suggest-path-for-tuple-struct.rs:24:13 | LL | let _ = SomeRegularStruct.new(); - | ^^^^^^^^^^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^^^^^^^^^^ + | +help: use the path separator to refer to an item + | +LL | let _ = SomeRegularStruct::new(); + | ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr b/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr index a4ce0deeb70..9c12fd2644c 100644 --- a/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr +++ b/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr @@ -2,19 +2,34 @@ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:17:5 | LL | a.I - | ^- help: use the path separator to refer to an item: `::` + | ^ + | +help: use the path separator to refer to an item + | +LL | a::I + | ~~ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:23:5 | LL | a.g() - | ^- help: use the path separator to refer to an item: `::` + | ^ + | +help: use the path separator to refer to an item + | +LL | a::g() + | ~~ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:29:5 | LL | a.b.J - | ^- help: use the path separator to refer to an item: `::` + | ^ + | +help: use the path separator to refer to an item + | +LL | a::b.J + | ~~ error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:35:5 @@ -38,7 +53,12 @@ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:42:5 | LL | a.b.f(); - | ^- help: use the path separator to refer to an item: `::` + | ^ + | +help: use the path separator to refer to an item + | +LL | a::b.f(); + | ~~ error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:46:12 @@ -117,23 +137,31 @@ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:80:9 | LL | a.f() - | ^- help: use the path separator to refer to an item: `::` + | ^ ... LL | let _ = create!(method); | --------------- in this macro invocation | = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the path separator to refer to an item + | +LL | a::f() + | ~~ error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:85:9 | LL | a.f - | ^- help: use the path separator to refer to an item: `::` + | ^ ... LL | let _ = create!(field); | -------------- in this macro invocation | = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the path separator to refer to an item + | +LL | a::f + | ~~ error: aborting due to 13 previous errors diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr index af6d05c1f96..08584349626 100644 --- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr +++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'structural_match' +error[E0658]: use of unstable library feature `structural_match` --> $DIR/feature-gate.rs:29:6 | LL | impl std::marker::StructuralPartialEq for Foo { } diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs index 839e9085440..711b07fee3b 100644 --- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs +++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/feature-gate.rs @@ -27,7 +27,7 @@ fn main() { //[with_gate]~ ERROR fatal error triggered by #[rustc_error] } impl std::marker::StructuralPartialEq for Foo { } -//[no_gate]~^ ERROR use of unstable library feature 'structural_match' +//[no_gate]~^ ERROR use of unstable library feature `structural_match` impl PartialEq<Foo> for Foo { fn eq(&self, other: &Self) -> bool { diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr index 4d23922892e..0a703367d96 100644 --- a/tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr +++ b/tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `f32: Termination` is not satisfied LL | #[test] | ------- in this procedural macro expansion LL | fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Termination` is not implemented for `f32`, which is required by `Result<f32, ParseFloatError>: Termination` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Termination` is not implemented for `f32` | = note: required for `Result<f32, ParseFloatError>` to implement `Termination` note: required by a bound in `assert_test_result` diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/auxiliary/types.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/auxiliary/types.rs index 4dc5932feab..5d9a8cfcac1 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/auxiliary/types.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/auxiliary/types.rs @@ -38,3 +38,9 @@ pub enum NonExhaustiveCLikeEnum { Four = 4, Five = 5, } + +#[repr(C)] +pub struct NormalStructWithNonExhaustiveCLikeEnum { + one: u8, + two: NonExhaustiveCLikeEnum, +} diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs index c7f470fb787..858e3374eac 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/improper_ctypes/extern_crate_improper.rs @@ -8,7 +8,7 @@ extern crate types; use types::{ NonExhaustiveCLikeEnum, NonExhaustiveEnum, NonExhaustiveVariants, - NormalStruct, TupleStruct, UnitStruct, + NormalStruct, TupleStruct, UnitStruct, NormalStructWithNonExhaustiveCLikeEnum }; extern "C" { @@ -27,6 +27,9 @@ extern "C" { // These should pass without remark, as they're C-compatible, despite being "non-exhaustive". extern "C" { pub fn non_exhaustive_c_compat_enum(_: NonExhaustiveCLikeEnum); + pub fn non_exhaustive_c_compat_enum_ret() -> *mut NonExhaustiveCLikeEnum; + pub fn struct_w_non_exhaustive_c_like_enum(_: NormalStructWithNonExhaustiveCLikeEnum); + pub fn struct_w_non_exhaustive_c_like_enum_ret() -> *mut NormalStructWithNonExhaustiveCLikeEnum; } fn main() {} diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs index b8c0eb3e6d6..4b2fc4a03b6 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs @@ -68,7 +68,7 @@ fn _macros() { _ => {} } use_expr!(let 0 = 1); - //~^ ERROR no rules expected the token `let` + //~^ ERROR no rules expected keyword `let` } fn main() {} diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr index 2341dbbbdbd..1c710b04897 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr @@ -131,7 +131,7 @@ LL | use_expr!((let 0 = 1)); | = note: only supported directly in conditions of `if` and `while` expressions -error: no rules expected the token `let` +error: no rules expected keyword `let` --> $DIR/feature-gate.rs:70:15 | LL | macro_rules! use_expr { diff --git a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr index eb6abbf8045..7ec018a95cc 100644 --- a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr +++ b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr @@ -4,7 +4,7 @@ error[E0277]: `NotDebug` doesn't implement `Debug` LL | let _: NotDebug = dbg!(NotDebug); | ^^^^^^^^^^^^^^ `NotDebug` cannot be formatted using `{:?}` | - = help: the trait `Debug` is not implemented for `NotDebug`, which is required by `&NotDebug: Debug` + = help: the trait `Debug` is not implemented for `NotDebug` = note: add `#[derive(Debug)]` to `NotDebug` or manually `impl Debug for NotDebug` = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `NotDebug` with `#[derive(Debug)]` diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs deleted file mode 100644 index 096036bb133..00000000000 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.rs +++ /dev/null @@ -1,340 +0,0 @@ -// Check that we don't suggest enabling a feature for code that's -// not accepted even with that feature. - -#![allow(irrefutable_let_patterns)] - -use std::ops::Range; - -fn main() {} - -fn _if() { - if (let 0 = 1) {} - //~^ ERROR expected expression, found `let` statement - - if (((let 0 = 1))) {} - //~^ ERROR expected expression, found `let` statement - - if (let 0 = 1) && true {} - //~^ ERROR expected expression, found `let` statement - - if true && (let 0 = 1) {} - //~^ ERROR expected expression, found `let` statement - - if (let 0 = 1) && (let 0 = 1) {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement - - if (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement -} - -fn _while() { - while (let 0 = 1) {} - //~^ ERROR expected expression, found `let` statement - - while (((let 0 = 1))) {} - //~^ ERROR expected expression, found `let` statement - - while (let 0 = 1) && true {} - //~^ ERROR expected expression, found `let` statement - - while true && (let 0 = 1) {} - //~^ ERROR expected expression, found `let` statement - - while (let 0 = 1) && (let 0 = 1) {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement - - while (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement -} - -fn _macros() { - macro_rules! use_expr { - ($e:expr) => { - if $e {} - while $e {} - } - } - use_expr!((let 0 = 1 && 0 == 0)); - //~^ ERROR expected expression, found `let` statement - use_expr!((let 0 = 1)); - //~^ ERROR expected expression, found `let` statement -} - -fn nested_within_if_expr() { - if &let 0 = 0 {} - //~^ ERROR expected expression, found `let` statement - - if !let 0 = 0 {} - //~^ ERROR expected expression, found `let` statement - if *let 0 = 0 {} - //~^ ERROR expected expression, found `let` statement - if -let 0 = 0 {} - //~^ ERROR expected expression, found `let` statement - - fn _check_try_binds_tighter() -> Result<(), ()> { - if let 0 = 0? {} - //~^ ERROR the `?` operator can only be applied to values that implement `Try` - Ok(()) - } - if (let 0 = 0)? {} - //~^ ERROR expected expression, found `let` statement - - if true || let 0 = 0 {} - //~^ ERROR expected expression, found `let` statement - if (true || let 0 = 0) {} - //~^ ERROR expected expression, found `let` statement - if true && (true || let 0 = 0) {} - //~^ ERROR expected expression, found `let` statement - if true || (true && let 0 = 0) {} - //~^ ERROR expected expression, found `let` statement - - let mut x = true; - if x = let 0 = 0 {} - //~^ ERROR expected expression, found `let` statement - - if true..(let 0 = 0) {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types - if ..(let 0 = 0) {} - //~^ ERROR expected expression, found `let` statement - if (let 0 = 0).. {} - //~^ ERROR expected expression, found `let` statement - - // Binds as `(let ... = true)..true &&/|| false`. - if let Range { start: _, end: _ } = true..true && false {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types - if let Range { start: _, end: _ } = true..true || false {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types - - // Binds as `(let Range { start: F, end } = F)..(|| true)`. - const F: fn() -> bool = || true; - if let Range { start: F, end } = F..|| true {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types - - // Binds as `(let Range { start: true, end } = t)..(&&false)`. - let t = &&true; - if let Range { start: true, end } = t..&&false {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types - - if let true = let true = true {} - //~^ ERROR expected expression, found `let` statement -} - -fn nested_within_while_expr() { - while &let 0 = 0 {} - //~^ ERROR expected expression, found `let` statement - - while !let 0 = 0 {} - //~^ ERROR expected expression, found `let` statement - while *let 0 = 0 {} - //~^ ERROR expected expression, found `let` statement - while -let 0 = 0 {} - //~^ ERROR expected expression, found `let` statement - - fn _check_try_binds_tighter() -> Result<(), ()> { - while let 0 = 0? {} - //~^ ERROR the `?` operator can only be applied to values that implement `Try` - Ok(()) - } - while (let 0 = 0)? {} - //~^ ERROR expected expression, found `let` statement - - while true || let 0 = 0 {} - //~^ ERROR expected expression, found `let` statement - while (true || let 0 = 0) {} - //~^ ERROR expected expression, found `let` statement - while true && (true || let 0 = 0) {} - //~^ ERROR expected expression, found `let` statement - while true || (true && let 0 = 0) {} - //~^ ERROR expected expression, found `let` statement - - let mut x = true; - while x = let 0 = 0 {} - //~^ ERROR expected expression, found `let` statement - - while true..(let 0 = 0) {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types - while ..(let 0 = 0) {} - //~^ ERROR expected expression, found `let` statement - while (let 0 = 0).. {} - //~^ ERROR expected expression, found `let` statement - - // Binds as `(let ... = true)..true &&/|| false`. - while let Range { start: _, end: _ } = true..true && false {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types - while let Range { start: _, end: _ } = true..true || false {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types - - // Binds as `(let Range { start: F, end } = F)..(|| true)`. - const F: fn() -> bool = || true; - while let Range { start: F, end } = F..|| true {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types - - // Binds as `(let Range { start: true, end } = t)..(&&false)`. - let t = &&true; - while let Range { start: true, end } = t..&&false {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types - - while let true = let true = true {} - //~^ ERROR expected expression, found `let` statement -} - -fn not_error_because_clarified_intent() { - if let Range { start: _, end: _ } = (true..true || false) { } - - if let Range { start: _, end: _ } = (true..true && false) { } - - while let Range { start: _, end: _ } = (true..true || false) { } - - while let Range { start: _, end: _ } = (true..true && false) { } -} - -fn outside_if_and_while_expr() { - &let 0 = 0; - //~^ ERROR expected expression, found `let` statement - - !let 0 = 0; - //~^ ERROR expected expression, found `let` statement - *let 0 = 0; - //~^ ERROR expected expression, found `let` statement - -let 0 = 0; - //~^ ERROR expected expression, found `let` statement - let _ = let _ = 3; - //~^ ERROR expected expression, found `let` statement - - fn _check_try_binds_tighter() -> Result<(), ()> { - let 0 = 0?; - //~^ ERROR the `?` operator can only be applied to values that implement `Try` - Ok(()) - } - (let 0 = 0)?; - //~^ ERROR expected expression, found `let` statement - - true || let 0 = 0; - //~^ ERROR expected expression, found `let` statement - (true || let 0 = 0); - //~^ ERROR expected expression, found `let` statement - true && (true || let 0 = 0); - //~^ ERROR expected expression, found `let` statement - - let mut x = true; - x = let 0 = 0; - //~^ ERROR expected expression, found `let` statement - - true..(let 0 = 0); - //~^ ERROR expected expression, found `let` statement - ..(let 0 = 0); - //~^ ERROR expected expression, found `let` statement - (let 0 = 0)..; - //~^ ERROR expected expression, found `let` statement - - (let Range { start: _, end: _ } = true..true || false); - //~^ ERROR mismatched types - //~| ERROR expected expression, found `let` statement - - (let true = let true = true); - //~^ ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement - - { - #[cfg(FALSE)] - let x = true && let y = 1; - //~^ ERROR expected expression, found `let` statement - } - - #[cfg(FALSE)] - { - [1, 2, 3][let _ = ()] - //~^ ERROR expected expression, found `let` statement - } - - // Check function tail position. - &let 0 = 0 - //~^ ERROR expected expression, found `let` statement -} - -// Let's make sure that `let` inside const generic arguments are considered. -fn inside_const_generic_arguments() { - struct A<const B: bool>; - impl<const B: bool> A<{B}> { const O: u32 = 5; } - - if let A::<{ - true && let 1 = 1 - //~^ ERROR expected expression, found `let` statement - }>::O = 5 {} - - while let A::<{ - true && let 1 = 1 - //~^ ERROR expected expression, found `let` statement - }>::O = 5 {} - - if A::<{ - true && let 1 = 1 - //~^ ERROR expected expression, found `let` statement - }>::O == 5 {} - - // In the cases above we have `ExprKind::Block` to help us out. - // Below however, we would not have a block and so an implementation might go - // from visiting expressions to types without banning `let` expressions down the tree. - // This tests ensures that we are not caught by surprise should the parser - // admit non-IDENT expressions in const generic arguments. - - if A::< - true && let 1 = 1 - //~^ ERROR expressions must be enclosed in braces - //~| ERROR expected expression, found `let` statement - >::O == 5 {} -} - -fn with_parenthesis() { - let opt = Some(Some(1i32)); - - if (let Some(a) = opt && true) { - //~^ ERROR expected expression, found `let` statement - } - - if (let Some(a) = opt) && true { - //~^ ERROR expected expression, found `let` statement - } - if (let Some(a) = opt) && (let Some(b) = a) { - //~^ ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement - } - - if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { - //~^ ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement - } - if (let Some(a) = opt && (let Some(b) = a)) && true { - //~^ ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement - } - if (let Some(a) = opt && (true)) && true { - //~^ ERROR expected expression, found `let` statement - } - - #[cfg(FALSE)] - let x = (true && let y = 1); - //~^ ERROR expected expression, found `let` statement - - #[cfg(FALSE)] - { - ([1, 2, 3][let _ = ()]) - //~^ ERROR expected expression, found `let` statement - } -} diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.feature.stderr index 31f389512ed..db32b8c1de4 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions-without-feature-gate.stderr +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.feature.stderr @@ -1,239 +1,239 @@ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:11:9 + --> $DIR/disallowed-positions.rs:33:9 | LL | if (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:11:9 + --> $DIR/disallowed-positions.rs:33:9 | LL | if (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:14:11 + --> $DIR/disallowed-positions.rs:36:11 | LL | if (((let 0 = 1))) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:14:11 + --> $DIR/disallowed-positions.rs:36:11 | LL | if (((let 0 = 1))) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:17:9 + --> $DIR/disallowed-positions.rs:39:9 | LL | if (let 0 = 1) && true {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:17:9 + --> $DIR/disallowed-positions.rs:39:9 | LL | if (let 0 = 1) && true {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:20:17 + --> $DIR/disallowed-positions.rs:42:17 | LL | if true && (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:20:17 + --> $DIR/disallowed-positions.rs:42:17 | LL | if true && (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:23:9 + --> $DIR/disallowed-positions.rs:45:9 | LL | if (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:23:9 + --> $DIR/disallowed-positions.rs:45:9 | LL | if (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:23:24 + --> $DIR/disallowed-positions.rs:45:24 | LL | if (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:23:24 + --> $DIR/disallowed-positions.rs:45:24 | LL | if (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:27:9 + --> $DIR/disallowed-positions.rs:49:35 | -LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - | ^^^^^^^^^ +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:27:9 + --> $DIR/disallowed-positions.rs:49:35 | -LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:27:22 + --> $DIR/disallowed-positions.rs:49:48 | -LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - | ^^^^^^^^^ +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:27:9 + --> $DIR/disallowed-positions.rs:49:35 | -LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:27:35 + --> $DIR/disallowed-positions.rs:49:61 | -LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - | ^^^^^^^^^ +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:27:9 + --> $DIR/disallowed-positions.rs:49:35 | -LL | if (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:34:12 + --> $DIR/disallowed-positions.rs:59:12 | LL | while (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:34:12 + --> $DIR/disallowed-positions.rs:59:12 | LL | while (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:37:14 + --> $DIR/disallowed-positions.rs:62:14 | LL | while (((let 0 = 1))) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:37:14 + --> $DIR/disallowed-positions.rs:62:14 | LL | while (((let 0 = 1))) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:40:12 + --> $DIR/disallowed-positions.rs:65:12 | LL | while (let 0 = 1) && true {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:40:12 + --> $DIR/disallowed-positions.rs:65:12 | LL | while (let 0 = 1) && true {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:43:20 + --> $DIR/disallowed-positions.rs:68:20 | LL | while true && (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:43:20 + --> $DIR/disallowed-positions.rs:68:20 | LL | while true && (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:46:12 + --> $DIR/disallowed-positions.rs:71:12 | LL | while (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:46:12 + --> $DIR/disallowed-positions.rs:71:12 | LL | while (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:46:27 + --> $DIR/disallowed-positions.rs:71:27 | LL | while (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:46:27 + --> $DIR/disallowed-positions.rs:71:27 | LL | while (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:50:12 + --> $DIR/disallowed-positions.rs:75:38 | -LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - | ^^^^^^^^^ +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:50:12 + --> $DIR/disallowed-positions.rs:75:38 | -LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:50:25 + --> $DIR/disallowed-positions.rs:75:51 | -LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - | ^^^^^^^^^ +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:50:12 + --> $DIR/disallowed-positions.rs:75:38 | -LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:50:38 + --> $DIR/disallowed-positions.rs:75:64 | -LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - | ^^^^^^^^^ +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:50:12 + --> $DIR/disallowed-positions.rs:75:38 | -LL | while (let 2 = 3 && let 3 = 4 && let 4 = 5) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:70:9 + --> $DIR/disallowed-positions.rs:99:9 | LL | if &let 0 = 0 {} | ^^^^^^^^^ @@ -241,7 +241,7 @@ LL | if &let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:73:9 + --> $DIR/disallowed-positions.rs:102:9 | LL | if !let 0 = 0 {} | ^^^^^^^^^ @@ -249,7 +249,7 @@ LL | if !let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:75:9 + --> $DIR/disallowed-positions.rs:104:9 | LL | if *let 0 = 0 {} | ^^^^^^^^^ @@ -257,7 +257,7 @@ LL | if *let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:77:9 + --> $DIR/disallowed-positions.rs:106:9 | LL | if -let 0 = 0 {} | ^^^^^^^^^ @@ -265,7 +265,7 @@ LL | if -let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:85:9 + --> $DIR/disallowed-positions.rs:114:9 | LL | if (let 0 = 0)? {} | ^^^^^^^^^ @@ -273,20 +273,20 @@ LL | if (let 0 = 0)? {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:88:16 + --> $DIR/disallowed-positions.rs:117:16 | LL | if true || let 0 = 0 {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `||` operators are not supported in let chain expressions - --> $DIR/disallowed-positions-without-feature-gate.rs:88:13 + --> $DIR/disallowed-positions.rs:117:13 | LL | if true || let 0 = 0 {} | ^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:90:17 + --> $DIR/disallowed-positions.rs:119:17 | LL | if (true || let 0 = 0) {} | ^^^^^^^^^ @@ -294,7 +294,7 @@ LL | if (true || let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:92:25 + --> $DIR/disallowed-positions.rs:121:25 | LL | if true && (true || let 0 = 0) {} | ^^^^^^^^^ @@ -302,7 +302,7 @@ LL | if true && (true || let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:94:25 + --> $DIR/disallowed-positions.rs:123:25 | LL | if true || (true && let 0 = 0) {} | ^^^^^^^^^ @@ -310,7 +310,7 @@ LL | if true || (true && let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:98:12 + --> $DIR/disallowed-positions.rs:127:12 | LL | if x = let 0 = 0 {} | ^^^ @@ -318,7 +318,7 @@ LL | if x = let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:101:15 + --> $DIR/disallowed-positions.rs:130:15 | LL | if true..(let 0 = 0) {} | ^^^^^^^^^ @@ -326,7 +326,7 @@ LL | if true..(let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:104:11 + --> $DIR/disallowed-positions.rs:133:11 | LL | if ..(let 0 = 0) {} | ^^^^^^^^^ @@ -334,7 +334,7 @@ LL | if ..(let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:106:9 + --> $DIR/disallowed-positions.rs:135:9 | LL | if (let 0 = 0).. {} | ^^^^^^^^^ @@ -342,7 +342,7 @@ LL | if (let 0 = 0).. {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:110:8 + --> $DIR/disallowed-positions.rs:139:8 | LL | if let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -350,7 +350,7 @@ LL | if let Range { start: _, end: _ } = true..true && false {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:113:8 + --> $DIR/disallowed-positions.rs:142:8 | LL | if let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -358,7 +358,7 @@ LL | if let Range { start: _, end: _ } = true..true || false {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:119:8 + --> $DIR/disallowed-positions.rs:148:8 | LL | if let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -366,7 +366,7 @@ LL | if let Range { start: F, end } = F..|| true {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:125:8 + --> $DIR/disallowed-positions.rs:154:8 | LL | if let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -374,7 +374,7 @@ LL | if let Range { start: true, end } = t..&&false {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:129:19 + --> $DIR/disallowed-positions.rs:158:19 | LL | if let true = let true = true {} | ^^^ @@ -382,7 +382,71 @@ LL | if let true = let true = true {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:134:12 + --> $DIR/disallowed-positions.rs:161:15 + | +LL | if return let 0 = 0 {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:164:21 + | +LL | loop { if break let 0 = 0 {} } + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:167:15 + | +LL | if (match let 0 = 0 { _ => { false } }) {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:170:9 + | +LL | if (let 0 = 0, false).1 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:173:9 + | +LL | if (let 0 = 0,) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:177:13 + | +LL | if (let 0 = 0).await {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:181:12 + | +LL | if (|| let 0 = 0) {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:184:9 + | +LL | if (let 0 = 0)() {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:190:12 | LL | while &let 0 = 0 {} | ^^^^^^^^^ @@ -390,7 +454,7 @@ LL | while &let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:137:12 + --> $DIR/disallowed-positions.rs:193:12 | LL | while !let 0 = 0 {} | ^^^^^^^^^ @@ -398,7 +462,7 @@ LL | while !let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:139:12 + --> $DIR/disallowed-positions.rs:195:12 | LL | while *let 0 = 0 {} | ^^^^^^^^^ @@ -406,7 +470,7 @@ LL | while *let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:141:12 + --> $DIR/disallowed-positions.rs:197:12 | LL | while -let 0 = 0 {} | ^^^^^^^^^ @@ -414,7 +478,7 @@ LL | while -let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:149:12 + --> $DIR/disallowed-positions.rs:205:12 | LL | while (let 0 = 0)? {} | ^^^^^^^^^ @@ -422,20 +486,20 @@ LL | while (let 0 = 0)? {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:152:19 + --> $DIR/disallowed-positions.rs:208:19 | LL | while true || let 0 = 0 {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `||` operators are not supported in let chain expressions - --> $DIR/disallowed-positions-without-feature-gate.rs:152:16 + --> $DIR/disallowed-positions.rs:208:16 | LL | while true || let 0 = 0 {} | ^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:154:20 + --> $DIR/disallowed-positions.rs:210:20 | LL | while (true || let 0 = 0) {} | ^^^^^^^^^ @@ -443,7 +507,7 @@ LL | while (true || let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:156:28 + --> $DIR/disallowed-positions.rs:212:28 | LL | while true && (true || let 0 = 0) {} | ^^^^^^^^^ @@ -451,7 +515,7 @@ LL | while true && (true || let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:158:28 + --> $DIR/disallowed-positions.rs:214:28 | LL | while true || (true && let 0 = 0) {} | ^^^^^^^^^ @@ -459,7 +523,7 @@ LL | while true || (true && let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:162:15 + --> $DIR/disallowed-positions.rs:218:15 | LL | while x = let 0 = 0 {} | ^^^ @@ -467,7 +531,7 @@ LL | while x = let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:165:18 + --> $DIR/disallowed-positions.rs:221:18 | LL | while true..(let 0 = 0) {} | ^^^^^^^^^ @@ -475,7 +539,7 @@ LL | while true..(let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:168:14 + --> $DIR/disallowed-positions.rs:224:14 | LL | while ..(let 0 = 0) {} | ^^^^^^^^^ @@ -483,7 +547,7 @@ LL | while ..(let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:170:12 + --> $DIR/disallowed-positions.rs:226:12 | LL | while (let 0 = 0).. {} | ^^^^^^^^^ @@ -491,7 +555,7 @@ LL | while (let 0 = 0).. {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:174:11 + --> $DIR/disallowed-positions.rs:230:11 | LL | while let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -499,7 +563,7 @@ LL | while let Range { start: _, end: _ } = true..true && false {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:177:11 + --> $DIR/disallowed-positions.rs:233:11 | LL | while let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -507,7 +571,7 @@ LL | while let Range { start: _, end: _ } = true..true || false {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:183:11 + --> $DIR/disallowed-positions.rs:239:11 | LL | while let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -515,7 +579,7 @@ LL | while let Range { start: F, end } = F..|| true {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:189:11 + --> $DIR/disallowed-positions.rs:245:11 | LL | while let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -523,7 +587,7 @@ LL | while let Range { start: true, end } = t..&&false {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:193:22 + --> $DIR/disallowed-positions.rs:249:22 | LL | while let true = let true = true {} | ^^^ @@ -531,7 +595,71 @@ LL | while let true = let true = true {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:208:6 + --> $DIR/disallowed-positions.rs:252:18 + | +LL | while return let 0 = 0 {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:255:39 + | +LL | 'outer: loop { while break 'outer let 0 = 0 {} } + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:258:18 + | +LL | while (match let 0 = 0 { _ => { false } }) {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:261:12 + | +LL | while (let 0 = 0, false).1 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:264:12 + | +LL | while (let 0 = 0,) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:268:16 + | +LL | while (let 0 = 0).await {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:272:15 + | +LL | while (|| let 0 = 0) {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:275:12 + | +LL | while (let 0 = 0)() {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:292:6 | LL | &let 0 = 0; | ^^^ @@ -539,7 +667,7 @@ LL | &let 0 = 0; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:211:6 + --> $DIR/disallowed-positions.rs:295:6 | LL | !let 0 = 0; | ^^^ @@ -547,7 +675,7 @@ LL | !let 0 = 0; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:213:6 + --> $DIR/disallowed-positions.rs:297:6 | LL | *let 0 = 0; | ^^^ @@ -555,7 +683,7 @@ LL | *let 0 = 0; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:215:6 + --> $DIR/disallowed-positions.rs:299:6 | LL | -let 0 = 0; | ^^^ @@ -563,7 +691,7 @@ LL | -let 0 = 0; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:217:13 + --> $DIR/disallowed-positions.rs:301:13 | LL | let _ = let _ = 3; | ^^^ @@ -571,7 +699,7 @@ LL | let _ = let _ = 3; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:225:6 + --> $DIR/disallowed-positions.rs:309:6 | LL | (let 0 = 0)?; | ^^^ @@ -579,7 +707,7 @@ LL | (let 0 = 0)?; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:228:13 + --> $DIR/disallowed-positions.rs:312:13 | LL | true || let 0 = 0; | ^^^ @@ -587,7 +715,7 @@ LL | true || let 0 = 0; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:230:14 + --> $DIR/disallowed-positions.rs:314:14 | LL | (true || let 0 = 0); | ^^^ @@ -595,7 +723,7 @@ LL | (true || let 0 = 0); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:232:22 + --> $DIR/disallowed-positions.rs:316:22 | LL | true && (true || let 0 = 0); | ^^^ @@ -603,7 +731,7 @@ LL | true && (true || let 0 = 0); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:236:9 + --> $DIR/disallowed-positions.rs:320:9 | LL | x = let 0 = 0; | ^^^ @@ -611,7 +739,7 @@ LL | x = let 0 = 0; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:239:12 + --> $DIR/disallowed-positions.rs:323:12 | LL | true..(let 0 = 0); | ^^^ @@ -619,7 +747,7 @@ LL | true..(let 0 = 0); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:241:8 + --> $DIR/disallowed-positions.rs:325:8 | LL | ..(let 0 = 0); | ^^^ @@ -627,7 +755,7 @@ LL | ..(let 0 = 0); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:243:6 + --> $DIR/disallowed-positions.rs:327:6 | LL | (let 0 = 0)..; | ^^^ @@ -635,7 +763,7 @@ LL | (let 0 = 0)..; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:246:6 + --> $DIR/disallowed-positions.rs:330:6 | LL | (let Range { start: _, end: _ } = true..true || false); | ^^^ @@ -643,7 +771,7 @@ LL | (let Range { start: _, end: _ } = true..true || false); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:250:6 + --> $DIR/disallowed-positions.rs:334:6 | LL | (let true = let true = true); | ^^^ @@ -651,7 +779,7 @@ LL | (let true = let true = true); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:250:17 + --> $DIR/disallowed-positions.rs:334:17 | LL | (let true = let true = true); | ^^^ @@ -659,7 +787,7 @@ LL | (let true = let true = true); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:256:25 + --> $DIR/disallowed-positions.rs:340:25 | LL | let x = true && let y = 1; | ^^^ @@ -667,7 +795,7 @@ LL | let x = true && let y = 1; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:262:19 + --> $DIR/disallowed-positions.rs:346:19 | LL | [1, 2, 3][let _ = ()] | ^^^ @@ -675,7 +803,7 @@ LL | [1, 2, 3][let _ = ()] = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:267:6 + --> $DIR/disallowed-positions.rs:351:6 | LL | &let 0 = 0 | ^^^ @@ -683,7 +811,7 @@ LL | &let 0 = 0 = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:277:17 + --> $DIR/disallowed-positions.rs:362:17 | LL | true && let 1 = 1 | ^^^ @@ -691,7 +819,7 @@ LL | true && let 1 = 1 = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:282:17 + --> $DIR/disallowed-positions.rs:367:17 | LL | true && let 1 = 1 | ^^^ @@ -699,7 +827,7 @@ LL | true && let 1 = 1 = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:287:17 + --> $DIR/disallowed-positions.rs:372:17 | LL | true && let 1 = 1 | ^^^ @@ -707,7 +835,7 @@ LL | true && let 1 = 1 = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:298:17 + --> $DIR/disallowed-positions.rs:383:17 | LL | true && let 1 = 1 | ^^^ @@ -715,7 +843,7 @@ LL | true && let 1 = 1 = note: only supported directly in conditions of `if` and `while` expressions error: expressions must be enclosed in braces to be used as const generic arguments - --> $DIR/disallowed-positions-without-feature-gate.rs:298:9 + --> $DIR/disallowed-positions.rs:383:9 | LL | true && let 1 = 1 | ^^^^^^^^^^^^^^^^^ @@ -726,124 +854,124 @@ LL | { true && let 1 = 1 } | + + error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:307:9 + --> $DIR/disallowed-positions.rs:393:9 | LL | if (let Some(a) = opt && true) { | ^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:307:9 + --> $DIR/disallowed-positions.rs:393:9 | LL | if (let Some(a) = opt && true) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:311:9 + --> $DIR/disallowed-positions.rs:397:9 | LL | if (let Some(a) = opt) && true { | ^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:311:9 + --> $DIR/disallowed-positions.rs:397:9 | LL | if (let Some(a) = opt) && true { | ^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:314:9 + --> $DIR/disallowed-positions.rs:400:9 | LL | if (let Some(a) = opt) && (let Some(b) = a) { | ^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:314:9 + --> $DIR/disallowed-positions.rs:400:9 | LL | if (let Some(a) = opt) && (let Some(b) = a) { | ^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:314:32 + --> $DIR/disallowed-positions.rs:400:32 | LL | if (let Some(a) = opt) && (let Some(b) = a) { | ^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:314:32 + --> $DIR/disallowed-positions.rs:400:32 | LL | if (let Some(a) = opt) && (let Some(b) = a) { | ^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:319:9 + --> $DIR/disallowed-positions.rs:408:9 | LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { | ^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:319:9 + --> $DIR/disallowed-positions.rs:408:9 | LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:319:31 + --> $DIR/disallowed-positions.rs:408:31 | LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { | ^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:319:31 + --> $DIR/disallowed-positions.rs:408:31 | LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { | ^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:323:9 + --> $DIR/disallowed-positions.rs:412:9 | LL | if (let Some(a) = opt && (let Some(b) = a)) && true { | ^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:323:9 + --> $DIR/disallowed-positions.rs:412:9 | LL | if (let Some(a) = opt && (let Some(b) = a)) && true { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:323:31 + --> $DIR/disallowed-positions.rs:412:31 | LL | if (let Some(a) = opt && (let Some(b) = a)) && true { | ^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:323:31 + --> $DIR/disallowed-positions.rs:412:31 | LL | if (let Some(a) = opt && (let Some(b) = a)) && true { | ^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:327:9 + --> $DIR/disallowed-positions.rs:416:9 | LL | if (let Some(a) = opt && (true)) && true { | ^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions-without-feature-gate.rs:327:9 + --> $DIR/disallowed-positions.rs:416:9 | LL | if (let Some(a) = opt && (true)) && true { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:332:22 + --> $DIR/disallowed-positions.rs:436:22 | LL | let x = (true && let y = 1); | ^^^ @@ -851,7 +979,7 @@ LL | let x = (true && let y = 1); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:337:20 + --> $DIR/disallowed-positions.rs:441:20 | LL | ([1, 2, 3][let _ = ()]) | ^^^ @@ -859,7 +987,7 @@ LL | ([1, 2, 3][let _ = ()]) = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:63:16 + --> $DIR/disallowed-positions.rs:91:16 | LL | use_expr!((let 0 = 1 && 0 == 0)); | ^^^ @@ -867,7 +995,7 @@ LL | use_expr!((let 0 = 1 && 0 == 0)); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions-without-feature-gate.rs:65:16 + --> $DIR/disallowed-positions.rs:93:16 | LL | use_expr!((let 0 = 1)); | ^^^ @@ -875,7 +1003,7 @@ LL | use_expr!((let 0 = 1)); = note: only supported directly in conditions of `if` and `while` expressions error[E0308]: mismatched types - --> $DIR/disallowed-positions-without-feature-gate.rs:101:8 + --> $DIR/disallowed-positions.rs:130:8 | LL | if true..(let 0 = 0) {} | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>` @@ -884,7 +1012,7 @@ LL | if true..(let 0 = 0) {} found struct `std::ops::Range<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions-without-feature-gate.rs:110:12 + --> $DIR/disallowed-positions.rs:139:12 | LL | if let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` @@ -895,7 +1023,7 @@ LL | if let Range { start: _, end: _ } = true..true && false {} found struct `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions-without-feature-gate.rs:113:12 + --> $DIR/disallowed-positions.rs:142:12 | LL | if let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` @@ -906,7 +1034,7 @@ LL | if let Range { start: _, end: _ } = true..true || false {} found struct `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions-without-feature-gate.rs:119:12 + --> $DIR/disallowed-positions.rs:148:12 | LL | if let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool` @@ -917,7 +1045,7 @@ LL | if let Range { start: F, end } = F..|| true {} found struct `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions-without-feature-gate.rs:125:12 + --> $DIR/disallowed-positions.rs:154:12 | LL | if let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool` @@ -928,7 +1056,7 @@ LL | if let Range { start: true, end } = t..&&false {} found struct `std::ops::Range<_>` error[E0277]: the `?` operator can only be applied to values that implement `Try` - --> $DIR/disallowed-positions-without-feature-gate.rs:81:20 + --> $DIR/disallowed-positions.rs:110:20 | LL | if let 0 = 0? {} | ^^ the `?` operator cannot be applied to type `{integer}` @@ -936,7 +1064,7 @@ LL | if let 0 = 0? {} = help: the trait `Try` is not implemented for `{integer}` error[E0308]: mismatched types - --> $DIR/disallowed-positions-without-feature-gate.rs:165:11 + --> $DIR/disallowed-positions.rs:221:11 | LL | while true..(let 0 = 0) {} | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>` @@ -945,7 +1073,7 @@ LL | while true..(let 0 = 0) {} found struct `std::ops::Range<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions-without-feature-gate.rs:174:15 + --> $DIR/disallowed-positions.rs:230:15 | LL | while let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` @@ -956,7 +1084,7 @@ LL | while let Range { start: _, end: _ } = true..true && false {} found struct `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions-without-feature-gate.rs:177:15 + --> $DIR/disallowed-positions.rs:233:15 | LL | while let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` @@ -967,7 +1095,7 @@ LL | while let Range { start: _, end: _ } = true..true || false {} found struct `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions-without-feature-gate.rs:183:15 + --> $DIR/disallowed-positions.rs:239:15 | LL | while let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool` @@ -978,7 +1106,7 @@ LL | while let Range { start: F, end } = F..|| true {} found struct `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions-without-feature-gate.rs:189:15 + --> $DIR/disallowed-positions.rs:245:15 | LL | while let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool` @@ -989,7 +1117,7 @@ LL | while let Range { start: true, end } = t..&&false {} found struct `std::ops::Range<_>` error[E0277]: the `?` operator can only be applied to values that implement `Try` - --> $DIR/disallowed-positions-without-feature-gate.rs:145:23 + --> $DIR/disallowed-positions.rs:201:23 | LL | while let 0 = 0? {} | ^^ the `?` operator cannot be applied to type `{integer}` @@ -997,7 +1125,7 @@ LL | while let 0 = 0? {} = help: the trait `Try` is not implemented for `{integer}` error[E0308]: mismatched types - --> $DIR/disallowed-positions-without-feature-gate.rs:246:10 + --> $DIR/disallowed-positions.rs:330:10 | LL | (let Range { start: _, end: _ } = true..true || false); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` @@ -1008,14 +1136,14 @@ LL | (let Range { start: _, end: _ } = true..true || false); found struct `std::ops::Range<_>` error[E0277]: the `?` operator can only be applied to values that implement `Try` - --> $DIR/disallowed-positions-without-feature-gate.rs:221:17 + --> $DIR/disallowed-positions.rs:305:17 | LL | let 0 = 0?; | ^^ the `?` operator cannot be applied to type `{integer}` | = help: the trait `Try` is not implemented for `{integer}` -error: aborting due to 105 previous errors +error: aborting due to 121 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.no_feature.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.no_feature.stderr new file mode 100644 index 00000000000..ad16a0f8ed8 --- /dev/null +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.no_feature.stderr @@ -0,0 +1,1239 @@ +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:33:9 + | +LL | if (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:33:9 + | +LL | if (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:36:11 + | +LL | if (((let 0 = 1))) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:36:11 + | +LL | if (((let 0 = 1))) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:39:9 + | +LL | if (let 0 = 1) && true {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:39:9 + | +LL | if (let 0 = 1) && true {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:42:17 + | +LL | if true && (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:42:17 + | +LL | if true && (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:45:9 + | +LL | if (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:45:9 + | +LL | if (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:45:24 + | +LL | if (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:45:24 + | +LL | if (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:49:35 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:49:35 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:49:48 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:49:35 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:49:61 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:49:35 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:59:12 + | +LL | while (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:59:12 + | +LL | while (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:62:14 + | +LL | while (((let 0 = 1))) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:62:14 + | +LL | while (((let 0 = 1))) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:65:12 + | +LL | while (let 0 = 1) && true {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:65:12 + | +LL | while (let 0 = 1) && true {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:68:20 + | +LL | while true && (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:68:20 + | +LL | while true && (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:71:12 + | +LL | while (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:71:12 + | +LL | while (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:71:27 + | +LL | while (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:71:27 + | +LL | while (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:75:38 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:75:38 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:75:51 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:75:38 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:75:64 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:75:38 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:99:9 + | +LL | if &let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:102:9 + | +LL | if !let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:104:9 + | +LL | if *let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:106:9 + | +LL | if -let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:114:9 + | +LL | if (let 0 = 0)? {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:117:16 + | +LL | if true || let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `||` operators are not supported in let chain expressions + --> $DIR/disallowed-positions.rs:117:13 + | +LL | if true || let 0 = 0 {} + | ^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:119:17 + | +LL | if (true || let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:121:25 + | +LL | if true && (true || let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:123:25 + | +LL | if true || (true && let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:127:12 + | +LL | if x = let 0 = 0 {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:130:15 + | +LL | if true..(let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:133:11 + | +LL | if ..(let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:135:9 + | +LL | if (let 0 = 0).. {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:139:8 + | +LL | if let Range { start: _, end: _ } = true..true && false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:142:8 + | +LL | if let Range { start: _, end: _ } = true..true || false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:148:8 + | +LL | if let Range { start: F, end } = F..|| true {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:154:8 + | +LL | if let Range { start: true, end } = t..&&false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:158:19 + | +LL | if let true = let true = true {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:161:15 + | +LL | if return let 0 = 0 {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:164:21 + | +LL | loop { if break let 0 = 0 {} } + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:167:15 + | +LL | if (match let 0 = 0 { _ => { false } }) {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:170:9 + | +LL | if (let 0 = 0, false).1 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:173:9 + | +LL | if (let 0 = 0,) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:177:13 + | +LL | if (let 0 = 0).await {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:181:12 + | +LL | if (|| let 0 = 0) {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:184:9 + | +LL | if (let 0 = 0)() {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:190:12 + | +LL | while &let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:193:12 + | +LL | while !let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:195:12 + | +LL | while *let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:197:12 + | +LL | while -let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:205:12 + | +LL | while (let 0 = 0)? {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:208:19 + | +LL | while true || let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `||` operators are not supported in let chain expressions + --> $DIR/disallowed-positions.rs:208:16 + | +LL | while true || let 0 = 0 {} + | ^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:210:20 + | +LL | while (true || let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:212:28 + | +LL | while true && (true || let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:214:28 + | +LL | while true || (true && let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:218:15 + | +LL | while x = let 0 = 0 {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:221:18 + | +LL | while true..(let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:224:14 + | +LL | while ..(let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:226:12 + | +LL | while (let 0 = 0).. {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:230:11 + | +LL | while let Range { start: _, end: _ } = true..true && false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:233:11 + | +LL | while let Range { start: _, end: _ } = true..true || false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:239:11 + | +LL | while let Range { start: F, end } = F..|| true {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:245:11 + | +LL | while let Range { start: true, end } = t..&&false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:249:22 + | +LL | while let true = let true = true {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:252:18 + | +LL | while return let 0 = 0 {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:255:39 + | +LL | 'outer: loop { while break 'outer let 0 = 0 {} } + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:258:18 + | +LL | while (match let 0 = 0 { _ => { false } }) {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:261:12 + | +LL | while (let 0 = 0, false).1 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:264:12 + | +LL | while (let 0 = 0,) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:268:16 + | +LL | while (let 0 = 0).await {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:272:15 + | +LL | while (|| let 0 = 0) {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:275:12 + | +LL | while (let 0 = 0)() {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:292:6 + | +LL | &let 0 = 0; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:295:6 + | +LL | !let 0 = 0; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:297:6 + | +LL | *let 0 = 0; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:299:6 + | +LL | -let 0 = 0; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:301:13 + | +LL | let _ = let _ = 3; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:309:6 + | +LL | (let 0 = 0)?; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:312:13 + | +LL | true || let 0 = 0; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:314:14 + | +LL | (true || let 0 = 0); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:316:22 + | +LL | true && (true || let 0 = 0); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:320:9 + | +LL | x = let 0 = 0; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:323:12 + | +LL | true..(let 0 = 0); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:325:8 + | +LL | ..(let 0 = 0); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:327:6 + | +LL | (let 0 = 0)..; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:330:6 + | +LL | (let Range { start: _, end: _ } = true..true || false); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:334:6 + | +LL | (let true = let true = true); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:334:17 + | +LL | (let true = let true = true); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:340:25 + | +LL | let x = true && let y = 1; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:346:19 + | +LL | [1, 2, 3][let _ = ()] + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:351:6 + | +LL | &let 0 = 0 + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:362:17 + | +LL | true && let 1 = 1 + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:367:17 + | +LL | true && let 1 = 1 + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:372:17 + | +LL | true && let 1 = 1 + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:383:17 + | +LL | true && let 1 = 1 + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expressions must be enclosed in braces to be used as const generic arguments + --> $DIR/disallowed-positions.rs:383:9 + | +LL | true && let 1 = 1 + | ^^^^^^^^^^^^^^^^^ + | +help: enclose the `const` expression in braces + | +LL | { true && let 1 = 1 } + | + + + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:393:9 + | +LL | if (let Some(a) = opt && true) { + | ^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:393:9 + | +LL | if (let Some(a) = opt && true) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:397:9 + | +LL | if (let Some(a) = opt) && true { + | ^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:397:9 + | +LL | if (let Some(a) = opt) && true { + | ^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:400:9 + | +LL | if (let Some(a) = opt) && (let Some(b) = a) { + | ^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:400:9 + | +LL | if (let Some(a) = opt) && (let Some(b) = a) { + | ^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:400:32 + | +LL | if (let Some(a) = opt) && (let Some(b) = a) { + | ^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:400:32 + | +LL | if (let Some(a) = opt) && (let Some(b) = a) { + | ^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:408:9 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { + | ^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:408:9 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:408:31 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { + | ^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:408:31 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { + | ^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:412:9 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && true { + | ^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:412:9 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && true { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:412:31 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && true { + | ^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:412:31 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && true { + | ^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:416:9 + | +LL | if (let Some(a) = opt && (true)) && true { + | ^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:416:9 + | +LL | if (let Some(a) = opt && (true)) && true { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:436:22 + | +LL | let x = (true && let y = 1); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:441:20 + | +LL | ([1, 2, 3][let _ = ()]) + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:91:16 + | +LL | use_expr!((let 0 = 1 && 0 == 0)); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:93:16 + | +LL | use_expr!((let 0 = 1)); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:49:8 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:49:21 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:75:11 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:75:24 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:404:8 + | +LL | if let Some(a) = opt && (true && true) { + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:420:28 + | +LL | if (true && (true)) && let Some(a) = opt { + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:423:18 + | +LL | if (true) && let Some(a) = opt { + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:426:16 + | +LL | if true && let Some(a) = opt { + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:431:8 + | +LL | if let true = (true && fun()) && (true) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0308]: mismatched types + --> $DIR/disallowed-positions.rs:130:8 + | +LL | if true..(let 0 = 0) {} + | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>` + | + = note: expected type `bool` + found struct `std::ops::Range<bool>` + +error[E0308]: mismatched types + --> $DIR/disallowed-positions.rs:139:12 + | +LL | if let Range { start: _, end: _ } = true..true && false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` + | | + | expected `bool`, found `Range<_>` + | + = note: expected type `bool` + found struct `std::ops::Range<_>` + +error[E0308]: mismatched types + --> $DIR/disallowed-positions.rs:142:12 + | +LL | if let Range { start: _, end: _ } = true..true || false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` + | | + | expected `bool`, found `Range<_>` + | + = note: expected type `bool` + found struct `std::ops::Range<_>` + +error[E0308]: mismatched types + --> $DIR/disallowed-positions.rs:148:12 + | +LL | if let Range { start: F, end } = F..|| true {} + | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool` + | | + | expected fn pointer, found `Range<_>` + | + = note: expected fn pointer `fn() -> bool` + found struct `std::ops::Range<_>` + +error[E0308]: mismatched types + --> $DIR/disallowed-positions.rs:154:12 + | +LL | if let Range { start: true, end } = t..&&false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool` + | | + | expected `bool`, found `Range<_>` + | + = note: expected type `bool` + found struct `std::ops::Range<_>` + +error[E0277]: the `?` operator can only be applied to values that implement `Try` + --> $DIR/disallowed-positions.rs:110:20 + | +LL | if let 0 = 0? {} + | ^^ the `?` operator cannot be applied to type `{integer}` + | + = help: the trait `Try` is not implemented for `{integer}` + +error[E0308]: mismatched types + --> $DIR/disallowed-positions.rs:221:11 + | +LL | while true..(let 0 = 0) {} + | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>` + | + = note: expected type `bool` + found struct `std::ops::Range<bool>` + +error[E0308]: mismatched types + --> $DIR/disallowed-positions.rs:230:15 + | +LL | while let Range { start: _, end: _ } = true..true && false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` + | | + | expected `bool`, found `Range<_>` + | + = note: expected type `bool` + found struct `std::ops::Range<_>` + +error[E0308]: mismatched types + --> $DIR/disallowed-positions.rs:233:15 + | +LL | while let Range { start: _, end: _ } = true..true || false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` + | | + | expected `bool`, found `Range<_>` + | + = note: expected type `bool` + found struct `std::ops::Range<_>` + +error[E0308]: mismatched types + --> $DIR/disallowed-positions.rs:239:15 + | +LL | while let Range { start: F, end } = F..|| true {} + | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool` + | | + | expected fn pointer, found `Range<_>` + | + = note: expected fn pointer `fn() -> bool` + found struct `std::ops::Range<_>` + +error[E0308]: mismatched types + --> $DIR/disallowed-positions.rs:245:15 + | +LL | while let Range { start: true, end } = t..&&false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool` + | | + | expected `bool`, found `Range<_>` + | + = note: expected type `bool` + found struct `std::ops::Range<_>` + +error[E0277]: the `?` operator can only be applied to values that implement `Try` + --> $DIR/disallowed-positions.rs:201:23 + | +LL | while let 0 = 0? {} + | ^^ the `?` operator cannot be applied to type `{integer}` + | + = help: the trait `Try` is not implemented for `{integer}` + +error[E0308]: mismatched types + --> $DIR/disallowed-positions.rs:330:10 + | +LL | (let Range { start: _, end: _ } = true..true || false); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` + | | + | expected `bool`, found `Range<_>` + | + = note: expected type `bool` + found struct `std::ops::Range<_>` + +error[E0277]: the `?` operator can only be applied to values that implement `Try` + --> $DIR/disallowed-positions.rs:305:17 + | +LL | let 0 = 0?; + | ^^ the `?` operator cannot be applied to type `{integer}` + | + = help: the trait `Try` is not implemented for `{integer}` + +error: aborting due to 130 previous errors + +Some errors have detailed explanations: E0277, E0308, E0658. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.nofeature.stderr index ab58abf4d46..f556ecf7f91 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.stderr +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.nofeature.stderr @@ -1,239 +1,239 @@ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:29:9 + --> $DIR/disallowed-positions.rs:31:9 | LL | if (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:29:9 + --> $DIR/disallowed-positions.rs:31:9 | LL | if (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:32:11 + --> $DIR/disallowed-positions.rs:34:11 | LL | if (((let 0 = 1))) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:32:11 + --> $DIR/disallowed-positions.rs:34:11 | LL | if (((let 0 = 1))) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:35:9 + --> $DIR/disallowed-positions.rs:37:9 | LL | if (let 0 = 1) && true {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:35:9 + --> $DIR/disallowed-positions.rs:37:9 | LL | if (let 0 = 1) && true {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:38:17 + --> $DIR/disallowed-positions.rs:40:17 | LL | if true && (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:38:17 + --> $DIR/disallowed-positions.rs:40:17 | LL | if true && (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:41:9 + --> $DIR/disallowed-positions.rs:43:9 | LL | if (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:41:9 + --> $DIR/disallowed-positions.rs:43:9 | LL | if (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:41:24 + --> $DIR/disallowed-positions.rs:43:24 | LL | if (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:41:24 + --> $DIR/disallowed-positions.rs:43:24 | LL | if (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:45:35 + --> $DIR/disallowed-positions.rs:47:35 | LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:45:35 + --> $DIR/disallowed-positions.rs:47:35 | LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:45:48 + --> $DIR/disallowed-positions.rs:47:48 | LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:45:35 + --> $DIR/disallowed-positions.rs:47:35 | LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:45:61 + --> $DIR/disallowed-positions.rs:47:61 | LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:45:35 + --> $DIR/disallowed-positions.rs:47:35 | LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:52:12 + --> $DIR/disallowed-positions.rs:56:12 | LL | while (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:52:12 + --> $DIR/disallowed-positions.rs:56:12 | LL | while (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:55:14 + --> $DIR/disallowed-positions.rs:59:14 | LL | while (((let 0 = 1))) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:55:14 + --> $DIR/disallowed-positions.rs:59:14 | LL | while (((let 0 = 1))) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:58:12 + --> $DIR/disallowed-positions.rs:62:12 | LL | while (let 0 = 1) && true {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:58:12 + --> $DIR/disallowed-positions.rs:62:12 | LL | while (let 0 = 1) && true {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:61:20 + --> $DIR/disallowed-positions.rs:65:20 | LL | while true && (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:61:20 + --> $DIR/disallowed-positions.rs:65:20 | LL | while true && (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:64:12 + --> $DIR/disallowed-positions.rs:68:12 | LL | while (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:64:12 + --> $DIR/disallowed-positions.rs:68:12 | LL | while (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:64:27 + --> $DIR/disallowed-positions.rs:68:27 | LL | while (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:64:27 + --> $DIR/disallowed-positions.rs:68:27 | LL | while (let 0 = 1) && (let 0 = 1) {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:68:38 + --> $DIR/disallowed-positions.rs:72:38 | LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:68:38 + --> $DIR/disallowed-positions.rs:72:38 | LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:68:51 + --> $DIR/disallowed-positions.rs:72:51 | LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:68:38 + --> $DIR/disallowed-positions.rs:72:38 | LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:68:64 + --> $DIR/disallowed-positions.rs:72:64 | LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:68:38 + --> $DIR/disallowed-positions.rs:72:38 | LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:88:9 + --> $DIR/disallowed-positions.rs:95:9 | LL | if &let 0 = 0 {} | ^^^^^^^^^ @@ -241,7 +241,7 @@ LL | if &let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:91:9 + --> $DIR/disallowed-positions.rs:98:9 | LL | if !let 0 = 0 {} | ^^^^^^^^^ @@ -249,7 +249,7 @@ LL | if !let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:93:9 + --> $DIR/disallowed-positions.rs:100:9 | LL | if *let 0 = 0 {} | ^^^^^^^^^ @@ -257,7 +257,7 @@ LL | if *let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:95:9 + --> $DIR/disallowed-positions.rs:102:9 | LL | if -let 0 = 0 {} | ^^^^^^^^^ @@ -265,7 +265,7 @@ LL | if -let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:103:9 + --> $DIR/disallowed-positions.rs:110:9 | LL | if (let 0 = 0)? {} | ^^^^^^^^^ @@ -273,20 +273,20 @@ LL | if (let 0 = 0)? {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:106:16 + --> $DIR/disallowed-positions.rs:113:16 | LL | if true || let 0 = 0 {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `||` operators are not supported in let chain expressions - --> $DIR/disallowed-positions.rs:106:13 + --> $DIR/disallowed-positions.rs:113:13 | LL | if true || let 0 = 0 {} | ^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:108:17 + --> $DIR/disallowed-positions.rs:115:17 | LL | if (true || let 0 = 0) {} | ^^^^^^^^^ @@ -294,7 +294,7 @@ LL | if (true || let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:110:25 + --> $DIR/disallowed-positions.rs:117:25 | LL | if true && (true || let 0 = 0) {} | ^^^^^^^^^ @@ -302,7 +302,7 @@ LL | if true && (true || let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:112:25 + --> $DIR/disallowed-positions.rs:119:25 | LL | if true || (true && let 0 = 0) {} | ^^^^^^^^^ @@ -310,7 +310,7 @@ LL | if true || (true && let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:116:12 + --> $DIR/disallowed-positions.rs:123:12 | LL | if x = let 0 = 0 {} | ^^^ @@ -318,7 +318,7 @@ LL | if x = let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:119:15 + --> $DIR/disallowed-positions.rs:126:15 | LL | if true..(let 0 = 0) {} | ^^^^^^^^^ @@ -326,7 +326,7 @@ LL | if true..(let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:122:11 + --> $DIR/disallowed-positions.rs:129:11 | LL | if ..(let 0 = 0) {} | ^^^^^^^^^ @@ -334,7 +334,7 @@ LL | if ..(let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:124:9 + --> $DIR/disallowed-positions.rs:131:9 | LL | if (let 0 = 0).. {} | ^^^^^^^^^ @@ -342,7 +342,7 @@ LL | if (let 0 = 0).. {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:128:8 + --> $DIR/disallowed-positions.rs:135:8 | LL | if let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -350,7 +350,7 @@ LL | if let Range { start: _, end: _ } = true..true && false {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:131:8 + --> $DIR/disallowed-positions.rs:138:8 | LL | if let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -358,7 +358,7 @@ LL | if let Range { start: _, end: _ } = true..true || false {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:137:8 + --> $DIR/disallowed-positions.rs:144:8 | LL | if let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -366,7 +366,7 @@ LL | if let Range { start: F, end } = F..|| true {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:143:8 + --> $DIR/disallowed-positions.rs:150:8 | LL | if let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -374,7 +374,7 @@ LL | if let Range { start: true, end } = t..&&false {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:147:19 + --> $DIR/disallowed-positions.rs:154:19 | LL | if let true = let true = true {} | ^^^ @@ -382,7 +382,7 @@ LL | if let true = let true = true {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:152:12 + --> $DIR/disallowed-positions.rs:160:12 | LL | while &let 0 = 0 {} | ^^^^^^^^^ @@ -390,7 +390,7 @@ LL | while &let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:155:12 + --> $DIR/disallowed-positions.rs:163:12 | LL | while !let 0 = 0 {} | ^^^^^^^^^ @@ -398,7 +398,7 @@ LL | while !let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:157:12 + --> $DIR/disallowed-positions.rs:165:12 | LL | while *let 0 = 0 {} | ^^^^^^^^^ @@ -406,7 +406,7 @@ LL | while *let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:159:12 + --> $DIR/disallowed-positions.rs:167:12 | LL | while -let 0 = 0 {} | ^^^^^^^^^ @@ -414,7 +414,7 @@ LL | while -let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:167:12 + --> $DIR/disallowed-positions.rs:175:12 | LL | while (let 0 = 0)? {} | ^^^^^^^^^ @@ -422,20 +422,20 @@ LL | while (let 0 = 0)? {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:170:19 + --> $DIR/disallowed-positions.rs:178:19 | LL | while true || let 0 = 0 {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `||` operators are not supported in let chain expressions - --> $DIR/disallowed-positions.rs:170:16 + --> $DIR/disallowed-positions.rs:178:16 | LL | while true || let 0 = 0 {} | ^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:172:20 + --> $DIR/disallowed-positions.rs:180:20 | LL | while (true || let 0 = 0) {} | ^^^^^^^^^ @@ -443,7 +443,7 @@ LL | while (true || let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:174:28 + --> $DIR/disallowed-positions.rs:182:28 | LL | while true && (true || let 0 = 0) {} | ^^^^^^^^^ @@ -451,7 +451,7 @@ LL | while true && (true || let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:176:28 + --> $DIR/disallowed-positions.rs:184:28 | LL | while true || (true && let 0 = 0) {} | ^^^^^^^^^ @@ -459,7 +459,7 @@ LL | while true || (true && let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:180:15 + --> $DIR/disallowed-positions.rs:188:15 | LL | while x = let 0 = 0 {} | ^^^ @@ -467,7 +467,7 @@ LL | while x = let 0 = 0 {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:183:18 + --> $DIR/disallowed-positions.rs:191:18 | LL | while true..(let 0 = 0) {} | ^^^^^^^^^ @@ -475,7 +475,7 @@ LL | while true..(let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:186:14 + --> $DIR/disallowed-positions.rs:194:14 | LL | while ..(let 0 = 0) {} | ^^^^^^^^^ @@ -483,7 +483,7 @@ LL | while ..(let 0 = 0) {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:188:12 + --> $DIR/disallowed-positions.rs:196:12 | LL | while (let 0 = 0).. {} | ^^^^^^^^^ @@ -491,7 +491,7 @@ LL | while (let 0 = 0).. {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:192:11 + --> $DIR/disallowed-positions.rs:200:11 | LL | while let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -499,7 +499,7 @@ LL | while let Range { start: _, end: _ } = true..true && false {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:195:11 + --> $DIR/disallowed-positions.rs:203:11 | LL | while let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -507,7 +507,7 @@ LL | while let Range { start: _, end: _ } = true..true || false {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:201:11 + --> $DIR/disallowed-positions.rs:209:11 | LL | while let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -515,7 +515,7 @@ LL | while let Range { start: F, end } = F..|| true {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:207:11 + --> $DIR/disallowed-positions.rs:215:11 | LL | while let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -523,7 +523,7 @@ LL | while let Range { start: true, end } = t..&&false {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:211:22 + --> $DIR/disallowed-positions.rs:219:22 | LL | while let true = let true = true {} | ^^^ @@ -531,7 +531,7 @@ LL | while let true = let true = true {} = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:226:6 + --> $DIR/disallowed-positions.rs:236:6 | LL | &let 0 = 0; | ^^^ @@ -539,7 +539,7 @@ LL | &let 0 = 0; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:229:6 + --> $DIR/disallowed-positions.rs:239:6 | LL | !let 0 = 0; | ^^^ @@ -547,7 +547,7 @@ LL | !let 0 = 0; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:231:6 + --> $DIR/disallowed-positions.rs:241:6 | LL | *let 0 = 0; | ^^^ @@ -555,7 +555,7 @@ LL | *let 0 = 0; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:233:6 + --> $DIR/disallowed-positions.rs:243:6 | LL | -let 0 = 0; | ^^^ @@ -563,7 +563,15 @@ LL | -let 0 = 0; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:241:6 + --> $DIR/disallowed-positions.rs:245:13 + | +LL | let _ = let _ = 3; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:253:6 | LL | (let 0 = 0)?; | ^^^ @@ -571,7 +579,7 @@ LL | (let 0 = 0)?; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:244:13 + --> $DIR/disallowed-positions.rs:256:13 | LL | true || let 0 = 0; | ^^^ @@ -579,7 +587,7 @@ LL | true || let 0 = 0; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:246:14 + --> $DIR/disallowed-positions.rs:258:14 | LL | (true || let 0 = 0); | ^^^ @@ -587,7 +595,7 @@ LL | (true || let 0 = 0); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:248:22 + --> $DIR/disallowed-positions.rs:260:22 | LL | true && (true || let 0 = 0); | ^^^ @@ -595,7 +603,7 @@ LL | true && (true || let 0 = 0); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:252:9 + --> $DIR/disallowed-positions.rs:264:9 | LL | x = let 0 = 0; | ^^^ @@ -603,7 +611,7 @@ LL | x = let 0 = 0; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:255:12 + --> $DIR/disallowed-positions.rs:267:12 | LL | true..(let 0 = 0); | ^^^ @@ -611,7 +619,7 @@ LL | true..(let 0 = 0); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:257:8 + --> $DIR/disallowed-positions.rs:269:8 | LL | ..(let 0 = 0); | ^^^ @@ -619,7 +627,7 @@ LL | ..(let 0 = 0); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:259:6 + --> $DIR/disallowed-positions.rs:271:6 | LL | (let 0 = 0)..; | ^^^ @@ -627,7 +635,7 @@ LL | (let 0 = 0)..; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:262:6 + --> $DIR/disallowed-positions.rs:274:6 | LL | (let Range { start: _, end: _ } = true..true || false); | ^^^ @@ -635,7 +643,7 @@ LL | (let Range { start: _, end: _ } = true..true || false); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:266:6 + --> $DIR/disallowed-positions.rs:278:6 | LL | (let true = let true = true); | ^^^ @@ -643,7 +651,7 @@ LL | (let true = let true = true); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:266:17 + --> $DIR/disallowed-positions.rs:278:17 | LL | (let true = let true = true); | ^^^ @@ -651,7 +659,7 @@ LL | (let true = let true = true); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:272:25 + --> $DIR/disallowed-positions.rs:284:25 | LL | let x = true && let y = 1; | ^^^ @@ -659,7 +667,7 @@ LL | let x = true && let y = 1; = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:278:19 + --> $DIR/disallowed-positions.rs:290:19 | LL | [1, 2, 3][let _ = ()] | ^^^ @@ -667,7 +675,7 @@ LL | [1, 2, 3][let _ = ()] = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:283:6 + --> $DIR/disallowed-positions.rs:295:6 | LL | &let 0 = 0 | ^^^ @@ -675,7 +683,7 @@ LL | &let 0 = 0 = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:293:17 + --> $DIR/disallowed-positions.rs:306:17 | LL | true && let 1 = 1 | ^^^ @@ -683,7 +691,7 @@ LL | true && let 1 = 1 = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:298:17 + --> $DIR/disallowed-positions.rs:311:17 | LL | true && let 1 = 1 | ^^^ @@ -691,7 +699,7 @@ LL | true && let 1 = 1 = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:303:17 + --> $DIR/disallowed-positions.rs:316:17 | LL | true && let 1 = 1 | ^^^ @@ -699,7 +707,7 @@ LL | true && let 1 = 1 = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:314:17 + --> $DIR/disallowed-positions.rs:327:17 | LL | true && let 1 = 1 | ^^^ @@ -707,7 +715,7 @@ LL | true && let 1 = 1 = note: only supported directly in conditions of `if` and `while` expressions error: expressions must be enclosed in braces to be used as const generic arguments - --> $DIR/disallowed-positions.rs:314:9 + --> $DIR/disallowed-positions.rs:327:9 | LL | true && let 1 = 1 | ^^^^^^^^^^^^^^^^^ @@ -718,124 +726,124 @@ LL | { true && let 1 = 1 } | + + error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:323:9 + --> $DIR/disallowed-positions.rs:337:9 | LL | if (let Some(a) = opt && true) { | ^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:323:9 + --> $DIR/disallowed-positions.rs:337:9 | LL | if (let Some(a) = opt && true) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:327:9 + --> $DIR/disallowed-positions.rs:341:9 | LL | if (let Some(a) = opt) && true { | ^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:327:9 + --> $DIR/disallowed-positions.rs:341:9 | LL | if (let Some(a) = opt) && true { | ^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:330:9 + --> $DIR/disallowed-positions.rs:344:9 | LL | if (let Some(a) = opt) && (let Some(b) = a) { | ^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:330:9 + --> $DIR/disallowed-positions.rs:344:9 | LL | if (let Some(a) = opt) && (let Some(b) = a) { | ^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:330:32 + --> $DIR/disallowed-positions.rs:344:32 | LL | if (let Some(a) = opt) && (let Some(b) = a) { | ^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:330:32 + --> $DIR/disallowed-positions.rs:344:32 | LL | if (let Some(a) = opt) && (let Some(b) = a) { | ^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:337:9 + --> $DIR/disallowed-positions.rs:351:9 | LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { | ^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:337:9 + --> $DIR/disallowed-positions.rs:351:9 | LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:337:31 + --> $DIR/disallowed-positions.rs:351:31 | LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { | ^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:337:31 + --> $DIR/disallowed-positions.rs:351:31 | LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { | ^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:341:9 + --> $DIR/disallowed-positions.rs:355:9 | LL | if (let Some(a) = opt && (let Some(b) = a)) && true { | ^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:341:9 + --> $DIR/disallowed-positions.rs:355:9 | LL | if (let Some(a) = opt && (let Some(b) = a)) && true { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:341:31 + --> $DIR/disallowed-positions.rs:355:31 | LL | if (let Some(a) = opt && (let Some(b) = a)) && true { | ^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:341:31 + --> $DIR/disallowed-positions.rs:355:31 | LL | if (let Some(a) = opt && (let Some(b) = a)) && true { | ^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:345:9 + --> $DIR/disallowed-positions.rs:359:9 | LL | if (let Some(a) = opt && (true)) && true { | ^^^^^^^^^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/disallowed-positions.rs:345:9 + --> $DIR/disallowed-positions.rs:359:9 | LL | if (let Some(a) = opt && (true)) && true { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:361:22 + --> $DIR/disallowed-positions.rs:375:22 | LL | let x = (true && let y = 1); | ^^^ @@ -843,7 +851,7 @@ LL | let x = (true && let y = 1); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:366:20 + --> $DIR/disallowed-positions.rs:380:20 | LL | ([1, 2, 3][let _ = ()]) | ^^^ @@ -851,7 +859,7 @@ LL | ([1, 2, 3][let _ = ()]) = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:81:16 + --> $DIR/disallowed-positions.rs:87:16 | LL | use_expr!((let 0 = 1 && 0 == 0)); | ^^^ @@ -859,15 +867,105 @@ LL | use_expr!((let 0 = 1 && 0 == 0)); = note: only supported directly in conditions of `if` and `while` expressions error: expected expression, found `let` statement - --> $DIR/disallowed-positions.rs:83:16 + --> $DIR/disallowed-positions.rs:89:16 | LL | use_expr!((let 0 = 1)); | ^^^ | = note: only supported directly in conditions of `if` and `while` expressions +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:47:8 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:47:21 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:72:11 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:72:24 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:348:8 + | +LL | if let Some(a) = opt && (true && true) { + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:363:28 + | +LL | if (true && (true)) && let Some(a) = opt { + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:365:18 + | +LL | if (true) && let Some(a) = opt { + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:367:16 + | +LL | if true && let Some(a) = opt { + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: `let` expressions in this position are unstable + --> $DIR/disallowed-positions.rs:371:8 + | +LL | if let true = (true && fun()) && (true) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + = help: add `#![feature(let_chains)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:119:8 + --> $DIR/disallowed-positions.rs:126:8 | LL | if true..(let 0 = 0) {} | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>` @@ -876,7 +974,7 @@ LL | if true..(let 0 = 0) {} found struct `std::ops::Range<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:128:12 + --> $DIR/disallowed-positions.rs:135:12 | LL | if let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` @@ -887,7 +985,7 @@ LL | if let Range { start: _, end: _ } = true..true && false {} found struct `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:131:12 + --> $DIR/disallowed-positions.rs:138:12 | LL | if let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` @@ -898,7 +996,7 @@ LL | if let Range { start: _, end: _ } = true..true || false {} found struct `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:137:12 + --> $DIR/disallowed-positions.rs:144:12 | LL | if let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool` @@ -909,7 +1007,7 @@ LL | if let Range { start: F, end } = F..|| true {} found struct `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:143:12 + --> $DIR/disallowed-positions.rs:150:12 | LL | if let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool` @@ -920,7 +1018,7 @@ LL | if let Range { start: true, end } = t..&&false {} found struct `std::ops::Range<_>` error[E0277]: the `?` operator can only be applied to values that implement `Try` - --> $DIR/disallowed-positions.rs:99:20 + --> $DIR/disallowed-positions.rs:106:20 | LL | if let 0 = 0? {} | ^^ the `?` operator cannot be applied to type `{integer}` @@ -928,7 +1026,7 @@ LL | if let 0 = 0? {} = help: the trait `Try` is not implemented for `{integer}` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:183:11 + --> $DIR/disallowed-positions.rs:191:11 | LL | while true..(let 0 = 0) {} | ^^^^^^^^^^^^^^^^^ expected `bool`, found `Range<bool>` @@ -937,7 +1035,7 @@ LL | while true..(let 0 = 0) {} found struct `std::ops::Range<bool>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:192:15 + --> $DIR/disallowed-positions.rs:200:15 | LL | while let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` @@ -948,7 +1046,7 @@ LL | while let Range { start: _, end: _ } = true..true && false {} found struct `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:195:15 + --> $DIR/disallowed-positions.rs:203:15 | LL | while let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` @@ -959,7 +1057,7 @@ LL | while let Range { start: _, end: _ } = true..true || false {} found struct `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:201:15 + --> $DIR/disallowed-positions.rs:209:15 | LL | while let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool` @@ -970,7 +1068,7 @@ LL | while let Range { start: F, end } = F..|| true {} found struct `std::ops::Range<_>` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:207:15 + --> $DIR/disallowed-positions.rs:215:15 | LL | while let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool` @@ -981,7 +1079,7 @@ LL | while let Range { start: true, end } = t..&&false {} found struct `std::ops::Range<_>` error[E0277]: the `?` operator can only be applied to values that implement `Try` - --> $DIR/disallowed-positions.rs:163:23 + --> $DIR/disallowed-positions.rs:171:23 | LL | while let 0 = 0? {} | ^^ the `?` operator cannot be applied to type `{integer}` @@ -989,7 +1087,7 @@ LL | while let 0 = 0? {} = help: the trait `Try` is not implemented for `{integer}` error[E0308]: mismatched types - --> $DIR/disallowed-positions.rs:262:10 + --> $DIR/disallowed-positions.rs:274:10 | LL | (let Range { start: _, end: _ } = true..true || false); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` @@ -1000,14 +1098,14 @@ LL | (let Range { start: _, end: _ } = true..true || false); found struct `std::ops::Range<_>` error[E0277]: the `?` operator can only be applied to values that implement `Try` - --> $DIR/disallowed-positions.rs:237:17 + --> $DIR/disallowed-positions.rs:249:17 | LL | let 0 = 0?; | ^^ the `?` operator cannot be applied to type `{integer}` | = help: the trait `Try` is not implemented for `{integer}` -error: aborting due to 104 previous errors +error: aborting due to 114 previous errors -Some errors have detailed explanations: E0277, E0308. +Some errors have detailed explanations: E0277, E0308, E0658. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.nothing.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.nothing.stderr new file mode 100644 index 00000000000..2d5fd1144ad --- /dev/null +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.nothing.stderr @@ -0,0 +1,990 @@ +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:33:9 + | +LL | if (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:33:9 + | +LL | if (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:36:11 + | +LL | if (((let 0 = 1))) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:36:11 + | +LL | if (((let 0 = 1))) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:39:9 + | +LL | if (let 0 = 1) && true {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:39:9 + | +LL | if (let 0 = 1) && true {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:42:17 + | +LL | if true && (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:42:17 + | +LL | if true && (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:45:9 + | +LL | if (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:45:9 + | +LL | if (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:45:24 + | +LL | if (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:45:24 + | +LL | if (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:49:35 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:49:35 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:49:48 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:49:35 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:49:61 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:49:35 + | +LL | if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:59:12 + | +LL | while (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:59:12 + | +LL | while (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:62:14 + | +LL | while (((let 0 = 1))) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:62:14 + | +LL | while (((let 0 = 1))) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:65:12 + | +LL | while (let 0 = 1) && true {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:65:12 + | +LL | while (let 0 = 1) && true {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:68:20 + | +LL | while true && (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:68:20 + | +LL | while true && (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:71:12 + | +LL | while (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:71:12 + | +LL | while (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:71:27 + | +LL | while (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:71:27 + | +LL | while (let 0 = 1) && (let 0 = 1) {} + | ^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:75:38 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:75:38 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:75:51 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:75:38 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:75:64 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:75:38 + | +LL | while let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:99:9 + | +LL | if &let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:102:9 + | +LL | if !let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:104:9 + | +LL | if *let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:106:9 + | +LL | if -let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:114:9 + | +LL | if (let 0 = 0)? {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:117:16 + | +LL | if true || let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `||` operators are not supported in let chain expressions + --> $DIR/disallowed-positions.rs:117:13 + | +LL | if true || let 0 = 0 {} + | ^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:119:17 + | +LL | if (true || let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:121:25 + | +LL | if true && (true || let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:123:25 + | +LL | if true || (true && let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:127:12 + | +LL | if x = let 0 = 0 {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:130:15 + | +LL | if true..(let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:133:11 + | +LL | if ..(let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:135:9 + | +LL | if (let 0 = 0).. {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:139:8 + | +LL | if let Range { start: _, end: _ } = true..true && false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:142:8 + | +LL | if let Range { start: _, end: _ } = true..true || false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:148:8 + | +LL | if let Range { start: F, end } = F..|| true {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:154:8 + | +LL | if let Range { start: true, end } = t..&&false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:158:19 + | +LL | if let true = let true = true {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:161:15 + | +LL | if return let 0 = 0 {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:164:21 + | +LL | loop { if break let 0 = 0 {} } + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:167:15 + | +LL | if (match let 0 = 0 { _ => { false } }) {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:170:9 + | +LL | if (let 0 = 0, false).1 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:173:9 + | +LL | if (let 0 = 0,) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:177:13 + | +LL | if (let 0 = 0).await {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:181:12 + | +LL | if (|| let 0 = 0) {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:184:9 + | +LL | if (let 0 = 0)() {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:190:12 + | +LL | while &let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:193:12 + | +LL | while !let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:195:12 + | +LL | while *let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:197:12 + | +LL | while -let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:205:12 + | +LL | while (let 0 = 0)? {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:208:19 + | +LL | while true || let 0 = 0 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `||` operators are not supported in let chain expressions + --> $DIR/disallowed-positions.rs:208:16 + | +LL | while true || let 0 = 0 {} + | ^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:210:20 + | +LL | while (true || let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:212:28 + | +LL | while true && (true || let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:214:28 + | +LL | while true || (true && let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:218:15 + | +LL | while x = let 0 = 0 {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:221:18 + | +LL | while true..(let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:224:14 + | +LL | while ..(let 0 = 0) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:226:12 + | +LL | while (let 0 = 0).. {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:230:11 + | +LL | while let Range { start: _, end: _ } = true..true && false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:233:11 + | +LL | while let Range { start: _, end: _ } = true..true || false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:239:11 + | +LL | while let Range { start: F, end } = F..|| true {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:245:11 + | +LL | while let Range { start: true, end } = t..&&false {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:249:22 + | +LL | while let true = let true = true {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:252:18 + | +LL | while return let 0 = 0 {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:255:39 + | +LL | 'outer: loop { while break 'outer let 0 = 0 {} } + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:258:18 + | +LL | while (match let 0 = 0 { _ => { false } }) {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:261:12 + | +LL | while (let 0 = 0, false).1 {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:264:12 + | +LL | while (let 0 = 0,) {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:268:16 + | +LL | while (let 0 = 0).await {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:272:15 + | +LL | while (|| let 0 = 0) {} + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:275:12 + | +LL | while (let 0 = 0)() {} + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:292:6 + | +LL | &let 0 = 0; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:295:6 + | +LL | !let 0 = 0; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:297:6 + | +LL | *let 0 = 0; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:299:6 + | +LL | -let 0 = 0; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:301:13 + | +LL | let _ = let _ = 3; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:309:6 + | +LL | (let 0 = 0)?; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:312:13 + | +LL | true || let 0 = 0; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:314:14 + | +LL | (true || let 0 = 0); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:316:22 + | +LL | true && (true || let 0 = 0); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:320:9 + | +LL | x = let 0 = 0; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:323:12 + | +LL | true..(let 0 = 0); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:325:8 + | +LL | ..(let 0 = 0); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:327:6 + | +LL | (let 0 = 0)..; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:330:6 + | +LL | (let Range { start: _, end: _ } = true..true || false); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:334:6 + | +LL | (let true = let true = true); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:334:17 + | +LL | (let true = let true = true); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:340:25 + | +LL | let x = true && let y = 1; + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:346:19 + | +LL | [1, 2, 3][let _ = ()] + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:351:6 + | +LL | &let 0 = 0 + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:362:17 + | +LL | true && let 1 = 1 + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:367:17 + | +LL | true && let 1 = 1 + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:372:17 + | +LL | true && let 1 = 1 + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:383:17 + | +LL | true && let 1 = 1 + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expressions must be enclosed in braces to be used as const generic arguments + --> $DIR/disallowed-positions.rs:383:9 + | +LL | true && let 1 = 1 + | ^^^^^^^^^^^^^^^^^ + | +help: enclose the `const` expression in braces + | +LL | { true && let 1 = 1 } + | + + + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:393:9 + | +LL | if (let Some(a) = opt && true) { + | ^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:393:9 + | +LL | if (let Some(a) = opt && true) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:397:9 + | +LL | if (let Some(a) = opt) && true { + | ^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:397:9 + | +LL | if (let Some(a) = opt) && true { + | ^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:400:9 + | +LL | if (let Some(a) = opt) && (let Some(b) = a) { + | ^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:400:9 + | +LL | if (let Some(a) = opt) && (let Some(b) = a) { + | ^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:400:32 + | +LL | if (let Some(a) = opt) && (let Some(b) = a) { + | ^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:400:32 + | +LL | if (let Some(a) = opt) && (let Some(b) = a) { + | ^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:408:9 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { + | ^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:408:9 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:408:31 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { + | ^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:408:31 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { + | ^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:412:9 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && true { + | ^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:412:9 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && true { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:412:31 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && true { + | ^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:412:31 + | +LL | if (let Some(a) = opt && (let Some(b) = a)) && true { + | ^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:416:9 + | +LL | if (let Some(a) = opt && (true)) && true { + | ^^^^^^^^^^^^^^^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions +note: `let`s wrapped in parentheses are not supported in a context with let chains + --> $DIR/disallowed-positions.rs:416:9 + | +LL | if (let Some(a) = opt && (true)) && true { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:436:22 + | +LL | let x = (true && let y = 1); + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: expected expression, found `let` statement + --> $DIR/disallowed-positions.rs:441:20 + | +LL | ([1, 2, 3][let _ = ()]) + | ^^^ + | + = note: only supported directly in conditions of `if` and `while` expressions + +error: aborting due to 105 previous errors + diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs index 4ac3ea53a08..8eb8d617d58 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs @@ -1,3 +1,5 @@ +//@ revisions: no_feature feature nothing +//@ edition: 2021 // Here we test that `lowering` behaves correctly wrt. `let $pats = $expr` expressions. // // We want to make sure that `let` is banned in situations other than: @@ -17,7 +19,8 @@ // // To that end, we check some positions which is not part of the language above. -#![feature(let_chains)] // Avoid inflating `.stderr` with overzealous gates in this test. +// Avoid inflating `.stderr` with overzealous gates (or test what happens if you disable the gate) +#![cfg_attr(not(no_feature), feature(let_chains))] #![allow(irrefutable_let_patterns)] @@ -25,6 +28,7 @@ use std::ops::Range; fn main() {} +#[cfg(not(nothing))] fn _if() { if (let 0 = 1) {} //~^ ERROR expected expression, found `let` statement @@ -46,8 +50,11 @@ fn _if() { //~^ ERROR expected expression, found `let` statement //~| ERROR expected expression, found `let` statement //~| ERROR expected expression, found `let` statement + //[no_feature]~| ERROR `let` expressions in this position are unstable + //[no_feature]~| ERROR `let` expressions in this position are unstable } +#[cfg(not(nothing))] fn _while() { while (let 0 = 1) {} //~^ ERROR expected expression, found `let` statement @@ -69,8 +76,11 @@ fn _while() { //~^ ERROR expected expression, found `let` statement //~| ERROR expected expression, found `let` statement //~| ERROR expected expression, found `let` statement + //[no_feature]~| ERROR `let` expressions in this position are unstable + //[no_feature]~| ERROR `let` expressions in this position are unstable } +#[cfg(not(nothing))] fn _macros() { macro_rules! use_expr { ($e:expr) => { @@ -79,11 +89,12 @@ fn _macros() { } } use_expr!((let 0 = 1 && 0 == 0)); - //~^ ERROR expected expression, found `let` statement + //[feature,no_feature]~^ ERROR expected expression, found `let` statement use_expr!((let 0 = 1)); - //~^ ERROR expected expression, found `let` statement + //[feature,no_feature]~^ ERROR expected expression, found `let` statement } +#[cfg(not(nothing))] fn nested_within_if_expr() { if &let 0 = 0 {} //~^ ERROR expected expression, found `let` statement @@ -97,7 +108,7 @@ fn nested_within_if_expr() { fn _check_try_binds_tighter() -> Result<(), ()> { if let 0 = 0? {} - //~^ ERROR the `?` operator can only be applied to values that implement `Try` + //[feature,no_feature]~^ ERROR the `?` operator can only be applied to values that implement `Try` Ok(()) } if (let 0 = 0)? {} @@ -118,7 +129,7 @@ fn nested_within_if_expr() { if true..(let 0 = 0) {} //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types + //[feature,no_feature]~| ERROR mismatched types if ..(let 0 = 0) {} //~^ ERROR expected expression, found `let` statement if (let 0 = 0).. {} @@ -127,27 +138,54 @@ fn nested_within_if_expr() { // Binds as `(let ... = true)..true &&/|| false`. if let Range { start: _, end: _ } = true..true && false {} //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types + //[feature,no_feature]~| ERROR mismatched types if let Range { start: _, end: _ } = true..true || false {} //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types + //[feature,no_feature]~| ERROR mismatched types // Binds as `(let Range { start: F, end } = F)..(|| true)`. const F: fn() -> bool = || true; if let Range { start: F, end } = F..|| true {} //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types + //[feature,no_feature]~| ERROR mismatched types // Binds as `(let Range { start: true, end } = t)..(&&false)`. let t = &&true; if let Range { start: true, end } = t..&&false {} //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types + //[feature,no_feature]~| ERROR mismatched types if let true = let true = true {} //~^ ERROR expected expression, found `let` statement + + if return let 0 = 0 {} + //~^ ERROR expected expression, found `let` statement + + loop { if break let 0 = 0 {} } + //~^ ERROR expected expression, found `let` statement + + if (match let 0 = 0 { _ => { false } }) {} + //~^ ERROR expected expression, found `let` statement + + if (let 0 = 0, false).1 {} + //~^ ERROR expected expression, found `let` statement + + if (let 0 = 0,) {} + //~^ ERROR expected expression, found `let` statement + + async fn foo() { + if (let 0 = 0).await {} + //~^ ERROR expected expression, found `let` statement + } + + if (|| let 0 = 0) {} + //~^ ERROR expected expression, found `let` statement + + if (let 0 = 0)() {} + //~^ ERROR expected expression, found `let` statement } +#[cfg(not(nothing))] fn nested_within_while_expr() { while &let 0 = 0 {} //~^ ERROR expected expression, found `let` statement @@ -161,7 +199,7 @@ fn nested_within_while_expr() { fn _check_try_binds_tighter() -> Result<(), ()> { while let 0 = 0? {} - //~^ ERROR the `?` operator can only be applied to values that implement `Try` + //[feature,no_feature]~^ ERROR the `?` operator can only be applied to values that implement `Try` Ok(()) } while (let 0 = 0)? {} @@ -182,7 +220,7 @@ fn nested_within_while_expr() { while true..(let 0 = 0) {} //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types + //[feature,no_feature]~| ERROR mismatched types while ..(let 0 = 0) {} //~^ ERROR expected expression, found `let` statement while (let 0 = 0).. {} @@ -191,27 +229,54 @@ fn nested_within_while_expr() { // Binds as `(let ... = true)..true &&/|| false`. while let Range { start: _, end: _ } = true..true && false {} //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types + //[feature,no_feature]~| ERROR mismatched types while let Range { start: _, end: _ } = true..true || false {} //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types + //[feature,no_feature]~| ERROR mismatched types // Binds as `(let Range { start: F, end } = F)..(|| true)`. const F: fn() -> bool = || true; while let Range { start: F, end } = F..|| true {} //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types + //[feature,no_feature]~| ERROR mismatched types // Binds as `(let Range { start: true, end } = t)..(&&false)`. let t = &&true; while let Range { start: true, end } = t..&&false {} //~^ ERROR expected expression, found `let` statement - //~| ERROR mismatched types + //[feature,no_feature]~| ERROR mismatched types while let true = let true = true {} //~^ ERROR expected expression, found `let` statement + + while return let 0 = 0 {} + //~^ ERROR expected expression, found `let` statement + + 'outer: loop { while break 'outer let 0 = 0 {} } + //~^ ERROR expected expression, found `let` statement + + while (match let 0 = 0 { _ => { false } }) {} + //~^ ERROR expected expression, found `let` statement + + while (let 0 = 0, false).1 {} + //~^ ERROR expected expression, found `let` statement + + while (let 0 = 0,) {} + //~^ ERROR expected expression, found `let` statement + + async fn foo() { + while (let 0 = 0).await {} + //~^ ERROR expected expression, found `let` statement + } + + while (|| let 0 = 0) {} + //~^ ERROR expected expression, found `let` statement + + while (let 0 = 0)() {} + //~^ ERROR expected expression, found `let` statement } +#[cfg(not(nothing))] fn not_error_because_clarified_intent() { if let Range { start: _, end: _ } = (true..true || false) { } @@ -222,6 +287,7 @@ fn not_error_because_clarified_intent() { while let Range { start: _, end: _ } = (true..true && false) { } } +#[cfg(not(nothing))] fn outside_if_and_while_expr() { &let 0 = 0; //~^ ERROR expected expression, found `let` statement @@ -232,10 +298,12 @@ fn outside_if_and_while_expr() { //~^ ERROR expected expression, found `let` statement -let 0 = 0; //~^ ERROR expected expression, found `let` statement + let _ = let _ = 3; + //~^ ERROR expected expression, found `let` statement fn _check_try_binds_tighter() -> Result<(), ()> { let 0 = 0?; - //~^ ERROR the `?` operator can only be applied to values that implement `Try` + //[feature,no_feature]~^ ERROR the `?` operator can only be applied to values that implement `Try` Ok(()) } (let 0 = 0)?; @@ -260,8 +328,8 @@ fn outside_if_and_while_expr() { //~^ ERROR expected expression, found `let` statement (let Range { start: _, end: _ } = true..true || false); - //~^ ERROR mismatched types - //~| ERROR expected expression, found `let` statement + //~^ ERROR expected expression, found `let` statement + //[feature,no_feature]~| ERROR mismatched types (let true = let true = true); //~^ ERROR expected expression, found `let` statement @@ -285,6 +353,7 @@ fn outside_if_and_while_expr() { } // Let's make sure that `let` inside const generic arguments are considered. +#[cfg(not(nothing))] fn inside_const_generic_arguments() { struct A<const B: bool>; impl<const B: bool> A<{B}> { const O: u32 = 5; } @@ -317,6 +386,7 @@ fn inside_const_generic_arguments() { >::O == 5 {} } +#[cfg(not(nothing))] fn with_parenthesis() { let opt = Some(Some(1i32)); @@ -332,6 +402,7 @@ fn with_parenthesis() { //~| ERROR expected expression, found `let` statement } if let Some(a) = opt && (true && true) { + //[no_feature]~^ ERROR `let` expressions in this position are unstable } if (let Some(a) = opt && (let Some(b) = a)) && b == 1 { @@ -347,14 +418,18 @@ fn with_parenthesis() { } if (true && (true)) && let Some(a) = opt { + //[no_feature]~^ ERROR `let` expressions in this position are unstable } if (true) && let Some(a) = opt { + //[no_feature]~^ ERROR `let` expressions in this position are unstable } if true && let Some(a) = opt { + //[no_feature]~^ ERROR `let` expressions in this position are unstable } let fun = || true; if let true = (true && fun()) && (true) { + //[no_feature]~^ ERROR `let` expressions in this position are unstable } #[cfg(FALSE)] diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs index bca7564efd8..2087fc42cf1 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.rs @@ -54,7 +54,7 @@ fn _macros() { #[cfg(FALSE)] (let 0 = 1); //~^ ERROR expected expression, found `let` statement use_expr!(let 0 = 1); - //~^ ERROR no rules expected the token `let` + //~^ ERROR no rules expected keyword `let` } fn main() {} diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr index 2b1a49be3da..7c874ae78a8 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/feature-gate.stderr @@ -14,7 +14,7 @@ LL | noop_expr!((let 0 = 1)); | = note: only supported directly in conditions of `if` and `while` expressions -error: no rules expected the token `let` +error: no rules expected keyword `let` --> $DIR/feature-gate.rs:56:15 | LL | macro_rules! use_expr { diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.disallowed.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.disallowed.stderr index be4a5231558..130d0296c5e 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.disallowed.stderr +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.disallowed.stderr @@ -111,5 +111,23 @@ LL | while let Some(ref first) = opt && let second = first && let _third = s = note: these patterns will always match = help: consider moving them into the body -error: aborting due to 12 previous errors +error: trailing irrefutable pattern in let chain + --> $DIR/irrefutable-lets.rs:87:12 + | +LL | && let x = &opt + | ^^^^^^^^^^^^ + | + = note: this pattern will always match + = help: consider moving it into the body + +error: leading irrefutable pattern in let chain + --> $DIR/irrefutable-lets.rs:93:12 + | +LL | if let x = opt.clone().map(|_| 1) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this pattern will always match + = help: consider moving it outside of the construct + +error: aborting due to 14 previous errors diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.rs index bd4df337614..e7d69f89773 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.rs +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.rs @@ -75,4 +75,24 @@ fn main() { && let Range { start: local_start, end: _ } = first && let None = local_start { } + + // No error. An extra nesting level would be required for the `else if`. + if opt == Some(None..None) { + } else if let x = opt.clone().map(|_| 1) + && x == Some(1) + {} + + if opt == Some(None..None) { + } else if opt.is_some() + && let x = &opt + //[disallowed]~^ ERROR trailing irrefutable pattern in let chain + {} + + if opt == Some(None..None) { + } else { + if let x = opt.clone().map(|_| 1) + //[disallowed]~^ ERROR leading irrefutable pattern in let chain + && x == Some(1) + {} + } } diff --git a/tests/ui/self/arbitrary-self-from-method-substs-ice.rs b/tests/ui/self/arbitrary-self-from-method-substs-ice.rs index a544c8ea0d1..d121a194be6 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs-ice.rs +++ b/tests/ui/self/arbitrary-self-from-method-substs-ice.rs @@ -8,7 +8,7 @@ use std::ops::Deref; struct Foo(u32); impl Foo { const fn get<R: Deref<Target = Self>>(self: R) -> u32 { - //~^ ERROR: `R` cannot be used as the type of `self` + //~^ ERROR invalid generic `self` parameter type //~| ERROR destructor of `R` cannot be evaluated at compile-time self.0 //~^ ERROR cannot call non-const fn `<R as Deref>::deref` in constant function diff --git a/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr b/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr index 505b0a173fa..7252b5890fd 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr +++ b/tests/ui/self/arbitrary-self-from-method-substs-ice.stderr @@ -5,10 +5,6 @@ LL | self.0 | ^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0493]: destructor of `R` cannot be evaluated at compile-time --> $DIR/arbitrary-self-from-method-substs-ice.rs:10:43 @@ -19,18 +15,16 @@ LL | const fn get<R: Deref<Target = Self>>(self: R) -> u32 { LL | } | - value is dropped here -error[E0658]: `R` cannot be used as the type of `self` without the `arbitrary_self_types` feature +error[E0801]: invalid generic `self` parameter type: `R` --> $DIR/arbitrary-self-from-method-substs-ice.rs:10:49 | LL | const fn get<R: Deref<Target = Self>>(self: R) -> u32 { | ^ | - = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information - = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) error: aborting due to 3 previous errors -Some errors have detailed explanations: E0015, E0493, E0658. +Some errors have detailed explanations: E0015, E0493, E0801. For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/self/arbitrary-self-from-method-substs.default.stderr b/tests/ui/self/arbitrary-self-from-method-substs.default.stderr index 4cc69666b88..5dc3a0b0234 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs.default.stderr +++ b/tests/ui/self/arbitrary-self-from-method-substs.default.stderr @@ -1,14 +1,168 @@ -error[E0658]: `R` cannot be used as the type of `self` without the `arbitrary_self_types` feature - --> $DIR/arbitrary-self-from-method-substs.rs:8:43 +error[E0801]: invalid generic `self` parameter type: `R` + --> $DIR/arbitrary-self-from-method-substs.rs:9:43 | LL | fn get<R: Deref<Target = Self>>(self: R) -> u32 { | ^ | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `&R` + --> $DIR/arbitrary-self-from-method-substs.rs:13:44 + | +LL | fn get1<R: Deref<Target = Self>>(self: &R) -> u32 { + | ^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `&mut R` + --> $DIR/arbitrary-self-from-method-substs.rs:17:44 + | +LL | fn get2<R: Deref<Target = Self>>(self: &mut R) -> u32 { + | ^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `Rc<R>` + --> $DIR/arbitrary-self-from-method-substs.rs:21:44 + | +LL | fn get3<R: Deref<Target = Self>>(self: std::rc::Rc<R>) -> u32 { + | ^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `&Rc<R>` + --> $DIR/arbitrary-self-from-method-substs.rs:25:44 + | +LL | fn get4<R: Deref<Target = Self>>(self: &std::rc::Rc<R>) -> u32 { + | ^^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `Rc<&R>` + --> $DIR/arbitrary-self-from-method-substs.rs:29:44 + | +LL | fn get5<R: Deref<Target = Self>>(self: std::rc::Rc<&R>) -> u32 { + | ^^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0658]: `<FR as FindReceiver>::Receiver` cannot be used as the type of `self` without the `arbitrary_self_types` feature + --> $DIR/arbitrary-self-from-method-substs.rs:33:37 + | +LL | fn get6<FR: FindReceiver>(self: FR::Receiver, other: FR) -> u32 { + | ^^^^^^^^^^^^ + | = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) -error: aborting due to 1 previous error +error[E0658]: `R` cannot be used as the type of `self` without the `arbitrary_self_types` feature + --> $DIR/arbitrary-self-from-method-substs.rs:61:18 + | +LL | fn get(self: R) {} + | ^ + | + = note: see issue #44874 <https://github.com/rust-lang/rust/issues/44874> for more information + = help: add `#![feature(arbitrary_self_types)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0271]: type mismatch resolving `<Silly as FindReceiver>::Receiver == Foo` + --> $DIR/arbitrary-self-from-method-substs.rs:92:9 + | +LL | foo.get6(Silly); + | ^^^^ type mismatch resolving `<Silly as FindReceiver>::Receiver == Foo` + | +note: expected this to be `Foo` + --> $DIR/arbitrary-self-from-method-substs.rs:71:21 + | +LL | type Receiver = std::rc::Rc<Foo>; + | ^^^^^^^^^^^^^^^^ + = note: expected struct `Foo` + found struct `Rc<Foo>` + +error[E0271]: type mismatch resolving `<Silly as FindReceiver>::Receiver == &Foo` + --> $DIR/arbitrary-self-from-method-substs.rs:96:9 + | +LL | foo.get6(Silly); + | ^^^^ type mismatch resolving `<Silly as FindReceiver>::Receiver == &Foo` + | +note: expected this to be `&Foo` + --> $DIR/arbitrary-self-from-method-substs.rs:71:21 + | +LL | type Receiver = std::rc::Rc<Foo>; + | ^^^^^^^^^^^^^^^^ + = note: expected reference `&Foo` + found struct `Rc<Foo>` + +error[E0599]: the method `get` exists for struct `Rc<Bar<_>>`, but its trait bounds were not satisfied + --> $DIR/arbitrary-self-from-method-substs.rs:100:7 + | +LL | struct Bar<R>(std::marker::PhantomData<R>); + | ------------- doesn't satisfy `Bar<_>: Deref` +... +LL | t.get(); + | ^^^ method cannot be called on `Rc<Bar<_>>` due to unsatisfied trait bounds + | +note: the following trait bounds were not satisfied: + `<&Bar<_> as Deref>::Target = Bar<&Bar<_>>` + `<&Rc<Bar<_>> as Deref>::Target = Bar<&Rc<Bar<_>>>` + `<&mut Bar<_> as Deref>::Target = Bar<&mut Bar<_>>` + `<&mut Rc<Bar<_>> as Deref>::Target = Bar<&mut Rc<Bar<_>>>` + `<Rc<Bar<_>> as Deref>::Target = Bar<Rc<Bar<_>>>` + `Bar<_>: Deref` + --> $DIR/arbitrary-self-from-method-substs.rs:60:9 + | +LL | impl<R: std::ops::Deref<Target = Self>> Bar<R> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------ + | | | + | | unsatisfied trait bound introduced here + | unsatisfied trait bound introduced here +note: the trait `Deref` must be implemented + --> $SRC_DIR/core/src/ops/deref.rs:LL:COL + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `get`, perhaps you need to implement it: + candidate #1: `SliceIndex` + +error[E0599]: the method `get` exists for reference `&Rc<Bar<_>>`, but its trait bounds were not satisfied + --> $DIR/arbitrary-self-from-method-substs.rs:108:7 + | +LL | struct Bar<R>(std::marker::PhantomData<R>); + | ------------- doesn't satisfy `Bar<_>: Deref` +... +LL | t.get(); + | ^^^ method cannot be called on `&Rc<Bar<_>>` due to unsatisfied trait bounds + | +note: the following trait bounds were not satisfied: + `<&&Rc<Bar<_>> as Deref>::Target = Bar<&&Rc<Bar<_>>>` + `<&Bar<_> as Deref>::Target = Bar<&Bar<_>>` + `<&Rc<Bar<_>> as Deref>::Target = Bar<&Rc<Bar<_>>>` + `<&mut &Rc<Bar<_>> as Deref>::Target = Bar<&mut &Rc<Bar<_>>>` + `<&mut Bar<_> as Deref>::Target = Bar<&mut Bar<_>>` + `<&mut Rc<Bar<_>> as Deref>::Target = Bar<&mut Rc<Bar<_>>>` + `<Rc<Bar<_>> as Deref>::Target = Bar<Rc<Bar<_>>>` + `Bar<_>: Deref` + --> $DIR/arbitrary-self-from-method-substs.rs:60:9 + | +LL | impl<R: std::ops::Deref<Target = Self>> Bar<R> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------ + | | | + | | unsatisfied trait bound introduced here + | unsatisfied trait bound introduced here +note: the trait `Deref` must be implemented + --> $SRC_DIR/core/src/ops/deref.rs:LL:COL + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `get`, perhaps you need to implement it: + candidate #1: `SliceIndex` + +error: aborting due to 12 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0271, E0599, E0658, E0801. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/self/arbitrary-self-from-method-substs.feature.stderr b/tests/ui/self/arbitrary-self-from-method-substs.feature.stderr index 44e553f1a06..6e864f44aa3 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs.feature.stderr +++ b/tests/ui/self/arbitrary-self-from-method-substs.feature.stderr @@ -1,9 +1,179 @@ +error[E0801]: invalid generic `self` parameter type: `R` + --> $DIR/arbitrary-self-from-method-substs.rs:9:43 + | +LL | fn get<R: Deref<Target = Self>>(self: R) -> u32 { + | ^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `&R` + --> $DIR/arbitrary-self-from-method-substs.rs:13:44 + | +LL | fn get1<R: Deref<Target = Self>>(self: &R) -> u32 { + | ^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `&mut R` + --> $DIR/arbitrary-self-from-method-substs.rs:17:44 + | +LL | fn get2<R: Deref<Target = Self>>(self: &mut R) -> u32 { + | ^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `Rc<R>` + --> $DIR/arbitrary-self-from-method-substs.rs:21:44 + | +LL | fn get3<R: Deref<Target = Self>>(self: std::rc::Rc<R>) -> u32 { + | ^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `&Rc<R>` + --> $DIR/arbitrary-self-from-method-substs.rs:25:44 + | +LL | fn get4<R: Deref<Target = Self>>(self: &std::rc::Rc<R>) -> u32 { + | ^^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + +error[E0801]: invalid generic `self` parameter type: `Rc<&R>` + --> $DIR/arbitrary-self-from-method-substs.rs:29:44 + | +LL | fn get5<R: Deref<Target = Self>>(self: std::rc::Rc<&R>) -> u32 { + | ^^^^^^^^^^^^^^^ + | + = note: type of `self` must not be a method generic parameter type + = help: use a concrete type such as `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) + error[E0308]: mismatched types - --> $DIR/arbitrary-self-from-method-substs.rs:16:5 + --> $DIR/arbitrary-self-from-method-substs.rs:76:5 | LL | foo.get::<&Foo>(); | ^^^ expected `&Foo`, found `Foo` -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/arbitrary-self-from-method-substs.rs:78:5 + | +LL | foo.get::<std::rc::Rc<Foo>>(); + | ^^^ expected `Rc<Foo>`, found `Foo` + | + = note: expected struct `Rc<Foo>` + found struct `Foo` + +error[E0308]: mismatched types + --> $DIR/arbitrary-self-from-method-substs.rs:84:5 + | +LL | smart_ptr.get::<SmartPtr2<Foo>>(); + | ^^^^^^^^^ expected `SmartPtr2<'_, Foo>`, found `SmartPtr<'_, Foo>` + | + = note: expected struct `SmartPtr2<'_, Foo>` + found struct `SmartPtr<'_, Foo>` + +error[E0308]: mismatched types + --> $DIR/arbitrary-self-from-method-substs.rs:86:5 + | +LL | smart_ptr.get::<&Foo>(); + | ^^^^^^^^^ expected `&Foo`, found `SmartPtr<'_, Foo>` + | + = note: expected reference `&Foo` + found struct `SmartPtr<'_, Foo, >` + +error[E0271]: type mismatch resolving `<Silly as FindReceiver>::Receiver == Foo` + --> $DIR/arbitrary-self-from-method-substs.rs:92:9 + | +LL | foo.get6(Silly); + | ^^^^ type mismatch resolving `<Silly as FindReceiver>::Receiver == Foo` + | +note: expected this to be `Foo` + --> $DIR/arbitrary-self-from-method-substs.rs:71:21 + | +LL | type Receiver = std::rc::Rc<Foo>; + | ^^^^^^^^^^^^^^^^ + = note: expected struct `Foo` + found struct `Rc<Foo>` + +error[E0271]: type mismatch resolving `<Silly as FindReceiver>::Receiver == &Foo` + --> $DIR/arbitrary-self-from-method-substs.rs:96:9 + | +LL | foo.get6(Silly); + | ^^^^ type mismatch resolving `<Silly as FindReceiver>::Receiver == &Foo` + | +note: expected this to be `&Foo` + --> $DIR/arbitrary-self-from-method-substs.rs:71:21 + | +LL | type Receiver = std::rc::Rc<Foo>; + | ^^^^^^^^^^^^^^^^ + = note: expected reference `&Foo` + found struct `Rc<Foo>` + +error[E0599]: the method `get` exists for struct `Rc<Bar<_>>`, but its trait bounds were not satisfied + --> $DIR/arbitrary-self-from-method-substs.rs:100:7 + | +LL | struct Bar<R>(std::marker::PhantomData<R>); + | ------------- doesn't satisfy `Bar<_>: Deref` +... +LL | t.get(); + | ^^^ method cannot be called on `Rc<Bar<_>>` due to unsatisfied trait bounds + | +note: the following trait bounds were not satisfied: + `<&Bar<_> as Deref>::Target = Bar<&Bar<_>>` + `<&Rc<Bar<_>> as Deref>::Target = Bar<&Rc<Bar<_>>>` + `<&mut Bar<_> as Deref>::Target = Bar<&mut Bar<_>>` + `<&mut Rc<Bar<_>> as Deref>::Target = Bar<&mut Rc<Bar<_>>>` + `<Rc<Bar<_>> as Deref>::Target = Bar<Rc<Bar<_>>>` + `Bar<_>: Deref` + --> $DIR/arbitrary-self-from-method-substs.rs:60:9 + | +LL | impl<R: std::ops::Deref<Target = Self>> Bar<R> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------ + | | | + | | unsatisfied trait bound introduced here + | unsatisfied trait bound introduced here +note: the trait `Deref` must be implemented + --> $SRC_DIR/core/src/ops/deref.rs:LL:COL + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `get`, perhaps you need to implement it: + candidate #1: `SliceIndex` + +error[E0599]: the method `get` exists for reference `&Rc<Bar<_>>`, but its trait bounds were not satisfied + --> $DIR/arbitrary-self-from-method-substs.rs:108:7 + | +LL | struct Bar<R>(std::marker::PhantomData<R>); + | ------------- doesn't satisfy `Bar<_>: Deref` +... +LL | t.get(); + | ^^^ method cannot be called on `&Rc<Bar<_>>` due to unsatisfied trait bounds + | +note: the following trait bounds were not satisfied: + `<&&Rc<Bar<_>> as Deref>::Target = Bar<&&Rc<Bar<_>>>` + `<&Bar<_> as Deref>::Target = Bar<&Bar<_>>` + `<&Rc<Bar<_>> as Deref>::Target = Bar<&Rc<Bar<_>>>` + `<&mut &Rc<Bar<_>> as Deref>::Target = Bar<&mut &Rc<Bar<_>>>` + `<&mut Bar<_> as Deref>::Target = Bar<&mut Bar<_>>` + `<&mut Rc<Bar<_>> as Deref>::Target = Bar<&mut Rc<Bar<_>>>` + `<Rc<Bar<_>> as Deref>::Target = Bar<Rc<Bar<_>>>` + `Bar<_>: Deref` + --> $DIR/arbitrary-self-from-method-substs.rs:60:9 + | +LL | impl<R: std::ops::Deref<Target = Self>> Bar<R> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------ + | | | + | | unsatisfied trait bound introduced here + | unsatisfied trait bound introduced here +note: the trait `Deref` must be implemented + --> $SRC_DIR/core/src/ops/deref.rs:LL:COL + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `get`, perhaps you need to implement it: + candidate #1: `SliceIndex` + +error: aborting due to 14 previous errors -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0271, E0308, E0599, E0801. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/self/arbitrary-self-from-method-substs.rs b/tests/ui/self/arbitrary-self-from-method-substs.rs index 99977ed9b8c..f2d65859615 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs.rs +++ b/tests/ui/self/arbitrary-self-from-method-substs.rs @@ -2,17 +2,109 @@ #![cfg_attr(feature, feature(arbitrary_self_types))] use std::ops::Deref; +use std::marker::PhantomData; struct Foo(u32); impl Foo { fn get<R: Deref<Target = Self>>(self: R) -> u32 { - //[default]~^ ERROR: `R` cannot be used as the type of `self` + //~^ ERROR: invalid generic `self` parameter type self.0 } + fn get1<R: Deref<Target = Self>>(self: &R) -> u32 { + //~^ ERROR: invalid generic `self` parameter type + self.0 + } + fn get2<R: Deref<Target = Self>>(self: &mut R) -> u32 { + //~^ ERROR: invalid generic `self` parameter type + self.0 + } + fn get3<R: Deref<Target = Self>>(self: std::rc::Rc<R>) -> u32 { + //~^ ERROR: invalid generic `self` parameter type + self.0 + } + fn get4<R: Deref<Target = Self>>(self: &std::rc::Rc<R>) -> u32 { + //~^ ERROR: invalid generic `self` parameter type + self.0 + } + fn get5<R: Deref<Target = Self>>(self: std::rc::Rc<&R>) -> u32 { + //~^ ERROR: invalid generic `self` parameter type + self.0 + } + fn get6<FR: FindReceiver>(self: FR::Receiver, other: FR) -> u32 { + //[default]~^ ERROR: `<FR as FindReceiver>::Receiver` cannot be used as the type of `self` + 42 + } +} + + +struct SmartPtr<'a, T: ?Sized>(&'a T); + +impl<'a, T: ?Sized> Deref for SmartPtr<'a, T> { + type Target = T; + fn deref(&self) -> &Self::Target { + unimplemented!() + } +} + +struct SmartPtr2<'a, T: ?Sized>(&'a T); + +impl<'a, T: ?Sized> Deref for SmartPtr2<'a, T> { + type Target = T; + fn deref(&self) -> &Self::Target { + unimplemented!() + } +} + +struct Bar<R>(std::marker::PhantomData<R>); + +impl<R: std::ops::Deref<Target = Self>> Bar<R> { + fn get(self: R) {} + //[default]~^ ERROR: `R` cannot be used as the type of `self` +} + +trait FindReceiver { + type Receiver: Deref<Target = Foo>; +} + +struct Silly; +impl FindReceiver for Silly { + type Receiver = std::rc::Rc<Foo>; } fn main() { let mut foo = Foo(1); foo.get::<&Foo>(); //[feature]~^ ERROR mismatched types + foo.get::<std::rc::Rc<Foo>>(); + //[feature]~^ ERROR mismatched types + + let smart_ptr = SmartPtr(&foo); + let smart_ptr2 = SmartPtr2(&foo); + smart_ptr.get(); // this compiles + smart_ptr.get::<SmartPtr2<Foo>>(); + //[feature]~^ ERROR mismatched types + smart_ptr.get::<&Foo>(); + //[feature]~^ ERROR mismatched types + + let mut foo = Foo(1); + // This test is slightly contrived in an attempt to generate a mismatched types + // error for the self type below, without using the turbofish. + foo.get6(Silly); + //~^ ERROR type mismatch + let mut foo = Foo(1); + let foo = &foo; + foo.get6(Silly); + //~^ ERROR type mismatch + + let t = std::rc::Rc::new(Bar(std::marker::PhantomData)); + t.get(); + //~^ ERROR its trait bounds were not satisfied + let t = &t; + // This is a further attempt at triggering 'type mismatch' errors + // from arbitrary self types without resorting to the turbofish. + // Ideally, here, t is Thing<Rc<Target=Self>> while we're going to call + // it with a &t method receiver. However, this doesn't work since that + // type of t becomes recursive and trait bounds can't be satisfied. + t.get(); + //~^ ERROR its trait bounds were not satisfied } diff --git a/tests/ui/simd-abi-checks.rs b/tests/ui/simd-abi-checks.rs new file mode 100644 index 00000000000..094c89930b7 --- /dev/null +++ b/tests/ui/simd-abi-checks.rs @@ -0,0 +1,81 @@ +//@ only-x86_64 +//@ build-pass +//@ ignore-pass (test emits codegen-time warnings) + +#![feature(avx512_target_feature)] +#![feature(portable_simd)] +#![allow(improper_ctypes_definitions)] + +use std::arch::x86_64::*; + +#[repr(transparent)] +struct Wrapper(__m256); + +unsafe extern "C" fn w(_: Wrapper) { + //~^ ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled + //~| WARNING this was previously accepted by the compiler + todo!() +} + +unsafe extern "C" fn f(_: __m256) { + //~^ ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled + //~| WARNING this was previously accepted by the compiler + todo!() +} + +unsafe extern "C" fn g() -> __m256 { + //~^ ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled + //~| WARNING this was previously accepted by the compiler + todo!() +} + +#[target_feature(enable = "avx")] +unsafe extern "C" fn favx() -> __m256 { + todo!() +} + +// avx2 implies avx, so no error here. +#[target_feature(enable = "avx2")] +unsafe extern "C" fn gavx(_: __m256) { + todo!() +} + +// No error because of "Rust" ABI. +fn as_f64x8(d: __m512d) -> std::simd::f64x8 { + unsafe { std::mem::transmute(d) } +} + +unsafe fn test() { + let arg = std::mem::transmute([0.0f64; 8]); + as_f64x8(arg); +} + +fn main() { + unsafe { + f(g()); + //~^ WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + //~| WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + //~| WARNING this was previously accepted by the compiler + //~| WARNING this was previously accepted by the compiler + } + + unsafe { + gavx(favx()); + //~^ WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + //~| WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + //~| WARNING this was previously accepted by the compiler + //~| WARNING this was previously accepted by the compiler + } + + unsafe { + test(); + } + + unsafe { + w(Wrapper(g())); + //~^ WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + //~| WARNING ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + //~| WARNING this was previously accepted by the compiler + //~| WARNING this was previously accepted by the compiler + } +} diff --git a/tests/ui/simd-abi-checks.stderr b/tests/ui/simd-abi-checks.stderr new file mode 100644 index 00000000000..aa7e9400169 --- /dev/null +++ b/tests/ui/simd-abi-checks.stderr @@ -0,0 +1,93 @@ +warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + --> $DIR/simd-abi-checks.rs:55:11 + | +LL | f(g()); + | ^^^ function called here + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> + = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) + = note: `#[warn(abi_unsupported_vector_types)]` on by default + +warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + --> $DIR/simd-abi-checks.rs:55:9 + | +LL | f(g()); + | ^^^^^^ function called here + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> + = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) + +warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + --> $DIR/simd-abi-checks.rs:63:14 + | +LL | gavx(favx()); + | ^^^^^^ function called here + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> + = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) + +warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + --> $DIR/simd-abi-checks.rs:63:9 + | +LL | gavx(favx()); + | ^^^^^^^^^^^^ function called here + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> + = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) + +warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + --> $DIR/simd-abi-checks.rs:75:19 + | +LL | w(Wrapper(g())); + | ^^^ function called here + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> + = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) + +warning: ABI error: this function call uses a vector type that requires the `avx` target feature, which is not enabled in the caller + --> $DIR/simd-abi-checks.rs:75:9 + | +LL | w(Wrapper(g())); + | ^^^^^^^^^^^^^^^ function called here + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> + = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) + +warning: ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled + --> $DIR/simd-abi-checks.rs:26:1 + | +LL | unsafe extern "C" fn g() -> __m256 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> + = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) + +warning: ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled + --> $DIR/simd-abi-checks.rs:20:1 + | +LL | unsafe extern "C" fn f(_: __m256) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> + = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) + +warning: ABI error: this function definition uses a vector type that requires the `avx` target feature, which is not enabled + --> $DIR/simd-abi-checks.rs:14:1 + | +LL | unsafe extern "C" fn w(_: Wrapper) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> + = help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) + +warning: 9 warnings emitted + diff --git a/tests/ui/specialization/const_trait_impl.stderr b/tests/ui/specialization/const_trait_impl.stderr index 746b08fa710..607fc06823e 100644 --- a/tests/ui/specialization/const_trait_impl.stderr +++ b/tests/ui/specialization/const_trait_impl.stderr @@ -1,93 +1,44 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const_trait_impl.rs:34:16 + --> $DIR/const_trait_impl.rs:34:9 | LL | impl<T: ~const Default> const A for T { - | ^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const_trait_impl.rs:40:16 + --> $DIR/const_trait_impl.rs:40:9 | LL | impl<T: ~const Default + ~const Sup> const A for T { - | ^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const_trait_impl.rs:46:16 + --> $DIR/const_trait_impl.rs:46:9 | LL | impl<T: ~const Default + ~const Sub> const A for T { - | ^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const_trait_impl.rs:40:16 + --> $DIR/const_trait_impl.rs:40:9 | LL | impl<T: ~const Default + ~const Sup> const A for T { - | ^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const_trait_impl.rs:34:16 + --> $DIR/const_trait_impl.rs:34:9 | LL | impl<T: ~const Default> const A for T { - | ^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const_trait_impl.rs:46:16 + --> $DIR/const_trait_impl.rs:46:9 | LL | impl<T: ~const Default + ~const Sub> const A for T { - | ^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0015]: cannot call non-const fn `<() as A>::a` in constants - --> $DIR/const_trait_impl.rs:52:23 - | -LL | const _: () = assert!(<()>::a() == 42); - | ^^^^^^^^^ - | - = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error[E0015]: cannot call non-const fn `<u8 as A>::a` in constants - --> $DIR/const_trait_impl.rs:53:23 - | -LL | const _: () = assert!(<u8>::a() == 3); - | ^^^^^^^^^ - | - = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error[E0015]: cannot call non-const fn `<u16 as A>::a` in constants - --> $DIR/const_trait_impl.rs:54:23 - | -LL | const _: () = assert!(<u16>::a() == 2); - | ^^^^^^^^^^ - | - = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error[E0015]: cannot call non-const fn `<T as Sup>::foo` in constant functions - --> $DIR/const_trait_impl.rs:48:9 - | -LL | T::foo() - | ^^^^^^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error: aborting due to 10 previous errors +error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/specialization/min_specialization/issue-79224.stderr b/tests/ui/specialization/min_specialization/issue-79224.stderr index db88be88a81..268fc3a9591 100644 --- a/tests/ui/specialization/min_specialization/issue-79224.stderr +++ b/tests/ui/specialization/min_specialization/issue-79224.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `B: Clone` is not satisfied --> $DIR/issue-79224.rs:18:29 | LL | impl<B: ?Sized> Display for Cow<'_, B> { - | ^^^^^^^^^^ the trait `Clone` is not implemented for `B`, which is required by `B: ToOwned` + | ^^^^^^^^^^ the trait `Clone` is not implemented for `B` | = note: required for `B` to implement `ToOwned` help: consider further restricting this bound @@ -14,7 +14,7 @@ error[E0277]: the trait bound `B: Clone` is not satisfied --> $DIR/issue-79224.rs:20:5 | LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B`, which is required by `B: ToOwned` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B` | = note: required for `B` to implement `ToOwned` help: consider further restricting this bound @@ -26,7 +26,7 @@ error[E0277]: the trait bound `B: Clone` is not satisfied --> $DIR/issue-79224.rs:20:13 | LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - | ^^^^ the trait `Clone` is not implemented for `B`, which is required by `B: ToOwned` + | ^^^^ the trait `Clone` is not implemented for `B` | = note: required for `B` to implement `ToOwned` help: consider further restricting this bound @@ -44,7 +44,7 @@ LL | | LL | | LL | | write!(f, "foo") LL | | } - | |_____^ the trait `Clone` is not implemented for `B`, which is required by `B: ToOwned` + | |_____^ the trait `Clone` is not implemented for `B` | = note: required for `B` to implement `ToOwned` help: consider further restricting this bound diff --git a/tests/ui/specialization/source-impl-requires-constraining-predicates-ambig.rs b/tests/ui/specialization/source-impl-requires-constraining-predicates-ambig.rs index 977493c885b..2296cd8a937 100644 --- a/tests/ui/specialization/source-impl-requires-constraining-predicates-ambig.rs +++ b/tests/ui/specialization/source-impl-requires-constraining-predicates-ambig.rs @@ -2,7 +2,7 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver //@[next] check-pass -//@[current] known-bug: unknown +//@[current] known-bug: #132519 //@[current] failure-status: 101 //@[current] dont-check-compiler-stderr diff --git a/tests/ui/sse-abi-checks.rs b/tests/ui/sse-abi-checks.rs new file mode 100644 index 00000000000..d2afd38fcc8 --- /dev/null +++ b/tests/ui/sse-abi-checks.rs @@ -0,0 +1,24 @@ +//! Ensure we trigger abi_unsupported_vector_types for target features that are usually enabled +//! on a target, but disabled in this file via a `-C` flag. +//@ compile-flags: --crate-type=rlib --target=i686-unknown-linux-gnu -C target-feature=-sse,-sse2 +//@ build-pass +//@ ignore-pass (test emits codegen-time warnings) +//@ needs-llvm-components: x86 +#![feature(no_core, lang_items, repr_simd)] +#![no_core] +#![allow(improper_ctypes_definitions)] + +#[lang = "sized"] +trait Sized {} + +#[lang = "copy"] +trait Copy {} + +#[repr(simd)] +pub struct SseVector([i64; 2]); + +#[no_mangle] +pub unsafe extern "C" fn f(_: SseVector) { + //~^ ABI error: this function definition uses a vector type that requires the `sse` target feature, which is not enabled + //~| WARNING this was previously accepted by the compiler +} diff --git a/tests/ui/sse-abi-checks.stderr b/tests/ui/sse-abi-checks.stderr new file mode 100644 index 00000000000..77c4e1fc07a --- /dev/null +++ b/tests/ui/sse-abi-checks.stderr @@ -0,0 +1,13 @@ +warning: ABI error: this function definition uses a vector type that requires the `sse` target feature, which is not enabled + --> $DIR/sse-abi-checks.rs:21:1 + | +LL | pub unsafe extern "C" fn f(_: SseVector) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #116558 <https://github.com/rust-lang/rust/issues/116558> + = help: consider enabling it globally (`-C target-feature=+sse`) or locally (`#[target_feature(enable="sse")]`) + = note: `#[warn(abi_unsupported_vector_types)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/stability-attribute/accidental-stable-in-unstable.rs b/tests/ui/stability-attribute/accidental-stable-in-unstable.rs index f8bbe90cfc5..86a9d2066eb 100644 --- a/tests/ui/stability-attribute/accidental-stable-in-unstable.rs +++ b/tests/ui/stability-attribute/accidental-stable-in-unstable.rs @@ -3,7 +3,7 @@ extern crate core; // Known accidental stabilizations with no known users, slated for un-stabilization // fully stable @ core::char::UNICODE_VERSION -use core::unicode::UNICODE_VERSION; //~ ERROR use of unstable library feature 'unicode_internals' +use core::unicode::UNICODE_VERSION; //~ ERROR use of unstable library feature `unicode_internals` // Known accidental stabilizations with known users // fully stable @ core::mem::transmute diff --git a/tests/ui/stability-attribute/accidental-stable-in-unstable.stderr b/tests/ui/stability-attribute/accidental-stable-in-unstable.stderr index 4abf8243d2f..9943e6d7ac6 100644 --- a/tests/ui/stability-attribute/accidental-stable-in-unstable.stderr +++ b/tests/ui/stability-attribute/accidental-stable-in-unstable.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unicode_internals' +error[E0658]: use of unstable library feature `unicode_internals` --> $DIR/accidental-stable-in-unstable.rs:6:5 | LL | use core::unicode::UNICODE_VERSION; diff --git a/tests/ui/stability-attribute/allow-unstable-reexport.rs b/tests/ui/stability-attribute/allow-unstable-reexport.rs index d2f1593c31a..b6ed2110918 100644 --- a/tests/ui/stability-attribute/allow-unstable-reexport.rs +++ b/tests/ui/stability-attribute/allow-unstable-reexport.rs @@ -20,11 +20,11 @@ pub use lint_stability_reexport::unstable_text; // Ensure items which aren't marked as unstable can't re-export unstable items #[stable(feature = "lint_stability", since = "1.0.0")] pub use lint_stability::unstable as unstable2; -//~^ ERROR use of unstable library feature 'unstable_test_feature' +//~^ ERROR use of unstable library feature `unstable_test_feature` fn main() { // Since we didn't enable the feature in this crate, we still can't // use these items, even though they're in scope from the `use`s which are now allowed. - unstable(); //~ ERROR use of unstable library feature 'unstable_test_feature' - unstable_text(); //~ ERROR use of unstable library feature 'unstable_test_feature' + unstable(); //~ ERROR use of unstable library feature `unstable_test_feature` + unstable_text(); //~ ERROR use of unstable library feature `unstable_test_feature` } diff --git a/tests/ui/stability-attribute/allow-unstable-reexport.stderr b/tests/ui/stability-attribute/allow-unstable-reexport.stderr index af75b6afb04..f869eeb790e 100644 --- a/tests/ui/stability-attribute/allow-unstable-reexport.stderr +++ b/tests/ui/stability-attribute/allow-unstable-reexport.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/allow-unstable-reexport.rs:22:9 | LL | pub use lint_stability::unstable as unstable2; @@ -7,7 +7,7 @@ LL | pub use lint_stability::unstable as unstable2; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/allow-unstable-reexport.rs:28:5 | LL | unstable(); @@ -16,7 +16,7 @@ LL | unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': text +error[E0658]: use of unstable library feature `unstable_test_feature`: text --> $DIR/allow-unstable-reexport.rs:29:5 | LL | unstable_text(); diff --git a/tests/ui/stability-attribute/allowed-through-unstable.rs b/tests/ui/stability-attribute/allowed-through-unstable.rs index 6bce5c87ddb..29911a70be9 100644 --- a/tests/ui/stability-attribute/allowed-through-unstable.rs +++ b/tests/ui/stability-attribute/allowed-through-unstable.rs @@ -6,4 +6,4 @@ extern crate allowed_through_unstable_core; use allowed_through_unstable_core::unstable_module::OldStableTraitAllowedThoughUnstable; -use allowed_through_unstable_core::unstable_module::NewStableTraitNotAllowedThroughUnstable; //~ ERROR use of unstable library feature 'unstable_test_feature' +use allowed_through_unstable_core::unstable_module::NewStableTraitNotAllowedThroughUnstable; //~ ERROR use of unstable library feature `unstable_test_feature` diff --git a/tests/ui/stability-attribute/allowed-through-unstable.stderr b/tests/ui/stability-attribute/allowed-through-unstable.stderr index 5c8e6358b7c..00eea9f730d 100644 --- a/tests/ui/stability-attribute/allowed-through-unstable.stderr +++ b/tests/ui/stability-attribute/allowed-through-unstable.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/allowed-through-unstable.rs:9:5 | LL | use allowed_through_unstable_core::unstable_module::NewStableTraitNotAllowedThroughUnstable; diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-missing.rs b/tests/ui/stability-attribute/const-stability-attribute-implies-missing.rs index 4089ec72885..6d6d793c62b 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-missing.rs +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-missing.rs @@ -14,4 +14,3 @@ pub const fn foobar() -> u32 { } const VAR: u32 = foobar(); -//~^ ERROR: `foobar` is not yet stable as a const fn diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-missing.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-missing.stderr index 918d6ebf992..232de41c769 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-missing.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-missing.stderr @@ -4,13 +4,5 @@ error: feature `const_bar` implying `const_foobar` does not exist LL | #[rustc_const_unstable(feature = "const_foobar", issue = "1", implied_by = "const_bar")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: `foobar` is not yet stable as a const fn - --> $DIR/const-stability-attribute-implies-missing.rs:16:18 - | -LL | const VAR: u32 = foobar(); - | ^^^^^^^^ - | - = help: add `#![feature(const_foobar)]` to the crate attributes to enable - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error diff --git a/tests/ui/stability-attribute/default-body-stability-err.stderr b/tests/ui/stability-attribute/default-body-stability-err.stderr index 9d8ad81f102..6173de5020b 100644 --- a/tests/ui/stability-attribute/default-body-stability-err.stderr +++ b/tests/ui/stability-attribute/default-body-stability-err.stderr @@ -5,7 +5,7 @@ LL | impl JustTrait for Type {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: default implementation of `CONSTANT` is unstable - = note: use of unstable library feature 'constant_default_body' + = note: use of unstable library feature `constant_default_body` = help: add `#![feature(constant_default_body)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date @@ -16,7 +16,7 @@ LL | impl JustTrait for Type {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: default implementation of `fun` is unstable - = note: use of unstable library feature 'fun_default_body' + = note: use of unstable library feature `fun_default_body` = help: add `#![feature(fun_default_body)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date @@ -27,7 +27,7 @@ LL | impl JustTrait for Type {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: default implementation of `fun2` is unstable - = note: use of unstable library feature 'fun_default_body': reason + = note: use of unstable library feature `fun_default_body`: reason = help: add `#![feature(fun_default_body)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date @@ -43,7 +43,7 @@ LL | | } | |_^ | = note: default implementation of `eq` is unstable - = note: use of unstable library feature 'eq_default_body' + = note: use of unstable library feature `eq_default_body` = help: add `#![feature(eq_default_body)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date diff --git a/tests/ui/stability-attribute/generics-default-stability-trait.rs b/tests/ui/stability-attribute/generics-default-stability-trait.rs index ba8ee143d4a..a2302959638 100644 --- a/tests/ui/stability-attribute/generics-default-stability-trait.rs +++ b/tests/ui/stability-attribute/generics-default-stability-trait.rs @@ -13,15 +13,15 @@ impl Trait1 for S { struct S; -impl Trait1<usize> for S { //~ ERROR use of unstable library feature 'unstable_default' +impl Trait1<usize> for S { //~ ERROR use of unstable library feature `unstable_default` fn foo() -> usize { 0 } } -impl Trait1<isize> for S { //~ ERROR use of unstable library feature 'unstable_default' +impl Trait1<isize> for S { //~ ERROR use of unstable library feature `unstable_default` fn foo() -> isize { 0 } } -impl Trait2<usize> for S { //~ ERROR use of unstable library feature 'unstable_default' +impl Trait2<usize> for S { //~ ERROR use of unstable library feature `unstable_default` fn foo() -> usize { 0 } } diff --git a/tests/ui/stability-attribute/generics-default-stability-trait.stderr b/tests/ui/stability-attribute/generics-default-stability-trait.stderr index 699e7c83c70..21b21fdb945 100644 --- a/tests/ui/stability-attribute/generics-default-stability-trait.stderr +++ b/tests/ui/stability-attribute/generics-default-stability-trait.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability-trait.rs:16:13 | LL | impl Trait1<usize> for S { @@ -7,7 +7,7 @@ LL | impl Trait1<usize> for S { = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability-trait.rs:20:13 | LL | impl Trait1<isize> for S { @@ -16,7 +16,7 @@ LL | impl Trait1<isize> for S { = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability-trait.rs:24:13 | LL | impl Trait2<usize> for S { diff --git a/tests/ui/stability-attribute/generics-default-stability-where.rs b/tests/ui/stability-attribute/generics-default-stability-where.rs index f8a2fb4873a..a7bc1756d78 100644 --- a/tests/ui/stability-attribute/generics-default-stability-where.rs +++ b/tests/ui/stability-attribute/generics-default-stability-where.rs @@ -4,7 +4,7 @@ extern crate unstable_generic_param; use unstable_generic_param::*; -impl<T> Trait3<usize> for T where T: Trait2<usize> { //~ ERROR use of unstable library feature 'unstable_default' +impl<T> Trait3<usize> for T where T: Trait2<usize> { //~ ERROR use of unstable library feature `unstable_default` //~^ ERROR `T` must be used as the type parameter for some local type fn foo() -> usize { T::foo() } } diff --git a/tests/ui/stability-attribute/generics-default-stability-where.stderr b/tests/ui/stability-attribute/generics-default-stability-where.stderr index 8e4089970f5..9437f5d65fa 100644 --- a/tests/ui/stability-attribute/generics-default-stability-where.stderr +++ b/tests/ui/stability-attribute/generics-default-stability-where.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability-where.rs:7:45 | LL | impl<T> Trait3<usize> for T where T: Trait2<usize> { diff --git a/tests/ui/stability-attribute/generics-default-stability.rs b/tests/ui/stability-attribute/generics-default-stability.rs index abd45b651ee..e1b3971f70c 100644 --- a/tests/ui/stability-attribute/generics-default-stability.rs +++ b/tests/ui/stability-attribute/generics-default-stability.rs @@ -20,12 +20,12 @@ impl Trait3<usize> for S { fn main() { let _ = S; - let _: Struct1<isize> = Struct1 { field: 1 }; //~ ERROR use of unstable library feature 'unstable_default' + let _: Struct1<isize> = Struct1 { field: 1 }; //~ ERROR use of unstable library feature `unstable_default` let _ = STRUCT1; // ok let _: Struct1 = STRUCT1; // ok - let _: Struct1<usize> = STRUCT1; //~ ERROR use of unstable library feature 'unstable_default' - let _: Struct1<isize> = Struct1 { field: 0 }; //~ ERROR use of unstable library feature 'unstable_default' + let _: Struct1<usize> = STRUCT1; //~ ERROR use of unstable library feature `unstable_default` + let _: Struct1<isize> = Struct1 { field: 0 }; //~ ERROR use of unstable library feature `unstable_default` // Instability is not enforced for generic type parameters used in public fields. // Note how the unstable type default `usize` leaks, @@ -54,10 +54,10 @@ fn main() { let _ = STRUCT3; let _: Struct3 = STRUCT3; // ok - let _: Struct3<isize, usize> = STRUCT3; //~ ERROR use of unstable library feature 'unstable_default' + let _: Struct3<isize, usize> = STRUCT3; //~ ERROR use of unstable library feature `unstable_default` let _: Struct3<isize> = STRUCT3; // ok - let _: Struct3<isize, isize> = Struct3 { field1: 0, field2: 0 }; //~ ERROR use of unstable library feature 'unstable_default' - let _: Struct3<usize, usize> = Struct3 { field1: 0, field2: 0 }; //~ ERROR use of unstable library feature 'unstable_default' + let _: Struct3<isize, isize> = Struct3 { field1: 0, field2: 0 }; //~ ERROR use of unstable library feature `unstable_default` + let _: Struct3<usize, usize> = Struct3 { field1: 0, field2: 0 }; //~ ERROR use of unstable library feature `unstable_default` let _ = STRUCT3.field1; // ok let _: isize = STRUCT3.field1; // ok let _ = STRUCT3.field1 + 1; // ok @@ -81,15 +81,15 @@ fn main() { //~^^^ use of deprecated field `unstable_generic_param::Struct4::field`: test [deprecated] let _ = STRUCT5; - let _: Struct5<isize> = Struct5 { field: 1 }; //~ ERROR use of unstable library feature 'unstable_default' + let _: Struct5<isize> = Struct5 { field: 1 }; //~ ERROR use of unstable library feature `unstable_default` //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] //~^^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] //~^^^ use of deprecated field `unstable_generic_param::Struct5::field`: test [deprecated] let _ = STRUCT5; let _: Struct5 = STRUCT5; //~ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] - let _: Struct5<usize> = STRUCT5; //~ ERROR use of unstable library feature 'unstable_default' + let _: Struct5<usize> = STRUCT5; //~ ERROR use of unstable library feature `unstable_default` //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] - let _: Struct5<isize> = Struct5 { field: 0 }; //~ ERROR use of unstable library feature 'unstable_default' + let _: Struct5<isize> = Struct5 { field: 0 }; //~ ERROR use of unstable library feature `unstable_default` //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] //~^^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] //~^^^ use of deprecated field `unstable_generic_param::Struct5::field`: test [deprecated] @@ -97,12 +97,12 @@ fn main() { let _: Struct6<isize> = Struct6 { field: 1 }; // ok let _: Struct6<isize> = Struct6 { field: 0 }; // ok - let _: Alias1<isize> = Alias1::Some(1); //~ ERROR use of unstable library feature 'unstable_default' + let _: Alias1<isize> = Alias1::Some(1); //~ ERROR use of unstable library feature `unstable_default` let _ = ALIAS1; // ok let _: Alias1 = ALIAS1; // ok - let _: Alias1<usize> = ALIAS1; //~ ERROR use of unstable library feature 'unstable_default' - let _: Alias1<isize> = Alias1::Some(0); //~ ERROR use of unstable library feature 'unstable_default' + let _: Alias1<usize> = ALIAS1; //~ ERROR use of unstable library feature `unstable_default` + let _: Alias1<isize> = Alias1::Some(0); //~ ERROR use of unstable library feature `unstable_default` // Instability is not enforced for generic type parameters used in public fields. // Note how the unstable type default `usize` leaks, @@ -130,10 +130,10 @@ fn main() { let _ = ALIAS3; let _: Alias3 = ALIAS3; // ok - let _: Alias3<isize, usize> = ALIAS3; //~ ERROR use of unstable library feature 'unstable_default' + let _: Alias3<isize, usize> = ALIAS3; //~ ERROR use of unstable library feature `unstable_default` let _: Alias3<isize> = ALIAS3; // ok - let _: Alias3<isize, isize> = Alias3::Ok(0); //~ ERROR use of unstable library feature 'unstable_default' - let _: Alias3<usize, usize> = Alias3::Ok(0); //~ ERROR use of unstable library feature 'unstable_default' + let _: Alias3<isize, isize> = Alias3::Ok(0); //~ ERROR use of unstable library feature `unstable_default` + let _: Alias3<usize, usize> = Alias3::Ok(0); //~ ERROR use of unstable library feature `unstable_default` let _ = ALIAS3.unwrap(); // ok let _: isize = ALIAS3.unwrap(); // ok let _ = ALIAS3.unwrap() + 1; // ok @@ -155,26 +155,26 @@ fn main() { //~^^ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated] let _ = ALIAS5; - let _: Alias5<isize> = Alias5::Some(1); //~ ERROR use of unstable library feature 'unstable_default' + let _: Alias5<isize> = Alias5::Some(1); //~ ERROR use of unstable library feature `unstable_default` //~^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] //~^^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] let _ = ALIAS5; let _: Alias5 = ALIAS5; //~ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] - let _: Alias5<usize> = ALIAS5; //~ ERROR use of unstable library feature 'unstable_default' + let _: Alias5<usize> = ALIAS5; //~ ERROR use of unstable library feature `unstable_default` //~^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] - let _: Alias5<isize> = Alias5::Some(0); //~ ERROR use of unstable library feature 'unstable_default' + let _: Alias5<isize> = Alias5::Some(0); //~ ERROR use of unstable library feature `unstable_default` //~^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] //~^^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] let _: Alias6<isize> = Alias6::Some(1); // ok let _: Alias6<isize> = Alias6::Some(0); // ok - let _: Enum1<isize> = Enum1::Some(1); //~ ERROR use of unstable library feature 'unstable_default' + let _: Enum1<isize> = Enum1::Some(1); //~ ERROR use of unstable library feature `unstable_default` let _ = ENUM1; // ok let _: Enum1 = ENUM1; // ok - let _: Enum1<usize> = ENUM1; //~ ERROR use of unstable library feature 'unstable_default' - let _: Enum1<isize> = Enum1::Some(0); //~ ERROR use of unstable library feature 'unstable_default' + let _: Enum1<usize> = ENUM1; //~ ERROR use of unstable library feature `unstable_default` + let _: Enum1<isize> = Enum1::Some(0); //~ ERROR use of unstable library feature `unstable_default` // Instability is not enforced for generic type parameters used in public fields. // Note how the unstable type default `usize` leaks, @@ -202,10 +202,10 @@ fn main() { let _ = ENUM3; let _: Enum3 = ENUM3; // ok - let _: Enum3<isize, usize> = ENUM3; //~ ERROR use of unstable library feature 'unstable_default' + let _: Enum3<isize, usize> = ENUM3; //~ ERROR use of unstable library feature `unstable_default` let _: Enum3<isize> = ENUM3; // ok - let _: Enum3<isize, isize> = Enum3::Ok(0); //~ ERROR use of unstable library feature 'unstable_default' - let _: Enum3<usize, usize> = Enum3::Ok(0); //~ ERROR use of unstable library feature 'unstable_default' + let _: Enum3<isize, isize> = Enum3::Ok(0); //~ ERROR use of unstable library feature `unstable_default` + let _: Enum3<usize, usize> = Enum3::Ok(0); //~ ERROR use of unstable library feature `unstable_default` if let Enum3::Ok(x) = ENUM3 {let _ = x;} // ok if let Enum3::Ok(x) = ENUM3 {let _: isize = x;} // ok if let Enum3::Ok(x) = ENUM3 {let _ = x + 1;} // ok @@ -227,21 +227,21 @@ fn main() { //~^^ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated] let _ = ENUM5; - let _: Enum5<isize> = Enum5::Some(1); //~ ERROR use of unstable library feature 'unstable_default' + let _: Enum5<isize> = Enum5::Some(1); //~ ERROR use of unstable library feature `unstable_default` //~^ use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test [deprecated] //~^^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated] let _ = ENUM5; let _: Enum5 = ENUM5; //~ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated] - let _: Enum5<usize> = ENUM5; //~ ERROR use of unstable library feature 'unstable_default' + let _: Enum5<usize> = ENUM5; //~ ERROR use of unstable library feature `unstable_default` //~^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated] - let _: Enum5<isize> = Enum5::Some(0); //~ ERROR use of unstable library feature 'unstable_default' + let _: Enum5<isize> = Enum5::Some(0); //~ ERROR use of unstable library feature `unstable_default` //~^ use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test [deprecated] //~^^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated] let _: Enum6<isize> = Enum6::Some(1); // ok let _: Enum6<isize> = Enum6::Some(0); // ok - let _: Box1<isize, System> = Box1::new(1); //~ ERROR use of unstable library feature 'box_alloc_param' + let _: Box1<isize, System> = Box1::new(1); //~ ERROR use of unstable library feature `box_alloc_param` let _: Box1<isize> = Box1::new(1); // ok let _: Box2<isize, System> = Box2::new(1); // ok diff --git a/tests/ui/stability-attribute/generics-default-stability.stderr b/tests/ui/stability-attribute/generics-default-stability.stderr index b1b91a850e9..f4f51a14248 100644 --- a/tests/ui/stability-attribute/generics-default-stability.stderr +++ b/tests/ui/stability-attribute/generics-default-stability.stderr @@ -216,7 +216,7 @@ warning: use of deprecated enum `unstable_generic_param::Enum5`: test LL | let _: Enum5<isize> = Enum5::Some(0); | ^^^^^ -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:23:20 | LL | let _: Struct1<isize> = Struct1 { field: 1 }; @@ -225,7 +225,7 @@ LL | let _: Struct1<isize> = Struct1 { field: 1 }; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:27:20 | LL | let _: Struct1<usize> = STRUCT1; @@ -234,7 +234,7 @@ LL | let _: Struct1<usize> = STRUCT1; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:28:20 | LL | let _: Struct1<isize> = Struct1 { field: 0 }; @@ -243,7 +243,7 @@ LL | let _: Struct1<isize> = Struct1 { field: 0 }; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:57:27 | LL | let _: Struct3<isize, usize> = STRUCT3; @@ -252,7 +252,7 @@ LL | let _: Struct3<isize, usize> = STRUCT3; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:59:27 | LL | let _: Struct3<isize, isize> = Struct3 { field1: 0, field2: 0 }; @@ -261,7 +261,7 @@ LL | let _: Struct3<isize, isize> = Struct3 { field1: 0, field2: 0 }; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:60:27 | LL | let _: Struct3<usize, usize> = Struct3 { field1: 0, field2: 0 }; @@ -270,7 +270,7 @@ LL | let _: Struct3<usize, usize> = Struct3 { field1: 0, field2: 0 }; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:84:20 | LL | let _: Struct5<isize> = Struct5 { field: 1 }; @@ -279,7 +279,7 @@ LL | let _: Struct5<isize> = Struct5 { field: 1 }; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:90:20 | LL | let _: Struct5<usize> = STRUCT5; @@ -288,7 +288,7 @@ LL | let _: Struct5<usize> = STRUCT5; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:92:20 | LL | let _: Struct5<isize> = Struct5 { field: 0 }; @@ -297,7 +297,7 @@ LL | let _: Struct5<isize> = Struct5 { field: 0 }; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:100:19 | LL | let _: Alias1<isize> = Alias1::Some(1); @@ -306,7 +306,7 @@ LL | let _: Alias1<isize> = Alias1::Some(1); = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:104:19 | LL | let _: Alias1<usize> = ALIAS1; @@ -315,7 +315,7 @@ LL | let _: Alias1<usize> = ALIAS1; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:105:19 | LL | let _: Alias1<isize> = Alias1::Some(0); @@ -324,7 +324,7 @@ LL | let _: Alias1<isize> = Alias1::Some(0); = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:133:26 | LL | let _: Alias3<isize, usize> = ALIAS3; @@ -333,7 +333,7 @@ LL | let _: Alias3<isize, usize> = ALIAS3; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:135:26 | LL | let _: Alias3<isize, isize> = Alias3::Ok(0); @@ -342,7 +342,7 @@ LL | let _: Alias3<isize, isize> = Alias3::Ok(0); = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:136:26 | LL | let _: Alias3<usize, usize> = Alias3::Ok(0); @@ -351,7 +351,7 @@ LL | let _: Alias3<usize, usize> = Alias3::Ok(0); = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:158:19 | LL | let _: Alias5<isize> = Alias5::Some(1); @@ -360,7 +360,7 @@ LL | let _: Alias5<isize> = Alias5::Some(1); = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:163:19 | LL | let _: Alias5<usize> = ALIAS5; @@ -369,7 +369,7 @@ LL | let _: Alias5<usize> = ALIAS5; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:165:19 | LL | let _: Alias5<isize> = Alias5::Some(0); @@ -378,7 +378,7 @@ LL | let _: Alias5<isize> = Alias5::Some(0); = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:172:18 | LL | let _: Enum1<isize> = Enum1::Some(1); @@ -387,7 +387,7 @@ LL | let _: Enum1<isize> = Enum1::Some(1); = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:176:18 | LL | let _: Enum1<usize> = ENUM1; @@ -396,7 +396,7 @@ LL | let _: Enum1<usize> = ENUM1; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:177:18 | LL | let _: Enum1<isize> = Enum1::Some(0); @@ -405,7 +405,7 @@ LL | let _: Enum1<isize> = Enum1::Some(0); = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:205:25 | LL | let _: Enum3<isize, usize> = ENUM3; @@ -414,7 +414,7 @@ LL | let _: Enum3<isize, usize> = ENUM3; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:207:25 | LL | let _: Enum3<isize, isize> = Enum3::Ok(0); @@ -423,7 +423,7 @@ LL | let _: Enum3<isize, isize> = Enum3::Ok(0); = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:208:25 | LL | let _: Enum3<usize, usize> = Enum3::Ok(0); @@ -432,7 +432,7 @@ LL | let _: Enum3<usize, usize> = Enum3::Ok(0); = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:230:18 | LL | let _: Enum5<isize> = Enum5::Some(1); @@ -441,7 +441,7 @@ LL | let _: Enum5<isize> = Enum5::Some(1); = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:235:18 | LL | let _: Enum5<usize> = ENUM5; @@ -450,7 +450,7 @@ LL | let _: Enum5<usize> = ENUM5; = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_default' +error[E0658]: use of unstable library feature `unstable_default` --> $DIR/generics-default-stability.rs:237:18 | LL | let _: Enum5<isize> = Enum5::Some(0); @@ -459,7 +459,7 @@ LL | let _: Enum5<isize> = Enum5::Some(0); = help: add `#![feature(unstable_default)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'box_alloc_param' +error[E0658]: use of unstable library feature `box_alloc_param` --> $DIR/generics-default-stability.rs:244:24 | LL | let _: Box1<isize, System> = Box1::new(1); diff --git a/tests/ui/stability-attribute/issue-28075.rs b/tests/ui/stability-attribute/issue-28075.rs index 8fc2ffe3dc9..b6b231d4afa 100644 --- a/tests/ui/stability-attribute/issue-28075.rs +++ b/tests/ui/stability-attribute/issue-28075.rs @@ -7,7 +7,7 @@ extern crate lint_stability; use lint_stability::{unstable, deprecated}; -//~^ ERROR use of unstable library feature 'unstable_test_feature' +//~^ ERROR use of unstable library feature `unstable_test_feature` fn main() { } diff --git a/tests/ui/stability-attribute/issue-28075.stderr b/tests/ui/stability-attribute/issue-28075.stderr index 282686d82bb..d10a27b874e 100644 --- a/tests/ui/stability-attribute/issue-28075.stderr +++ b/tests/ui/stability-attribute/issue-28075.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/issue-28075.rs:9:22 | LL | use lint_stability::{unstable, deprecated}; diff --git a/tests/ui/stability-attribute/issue-28388-3.rs b/tests/ui/stability-attribute/issue-28388-3.rs index 2f61146f6e3..7b6b6ce7f4b 100644 --- a/tests/ui/stability-attribute/issue-28388-3.rs +++ b/tests/ui/stability-attribute/issue-28388-3.rs @@ -5,7 +5,7 @@ extern crate lint_stability; use lint_stability::UnstableEnum::{}; -//~^ ERROR use of unstable library feature 'unstable_test_feature' +//~^ ERROR use of unstable library feature `unstable_test_feature` use lint_stability::StableEnum::{}; // OK fn main() {} diff --git a/tests/ui/stability-attribute/issue-28388-3.stderr b/tests/ui/stability-attribute/issue-28388-3.stderr index 56ca57591ce..def27c0b44d 100644 --- a/tests/ui/stability-attribute/issue-28388-3.stderr +++ b/tests/ui/stability-attribute/issue-28388-3.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/issue-28388-3.rs:7:5 | LL | use lint_stability::UnstableEnum::{}; diff --git a/tests/ui/stability-attribute/missing-const-stability.rs b/tests/ui/stability-attribute/missing-const-stability.rs index 82da18cc9ac..10c31d79438 100644 --- a/tests/ui/stability-attribute/missing-const-stability.rs +++ b/tests/ui/stability-attribute/missing-const-stability.rs @@ -1,6 +1,6 @@ //@ compile-flags: -Znext-solver #![feature(staged_api)] -#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete +#![feature(const_trait_impl, rustc_attrs, intrinsics)] #![stable(feature = "stable", since = "1.0.0")] #[stable(feature = "stable", since = "1.0.0")] @@ -31,4 +31,9 @@ impl const Bar for Foo { fn fun() {} } +#[stable(feature = "stable", since = "1.0.0")] +#[rustc_intrinsic] +pub const unsafe fn size_of_val<T>(x: *const T) -> usize { 42 } +//~^ ERROR function has missing const stability attribute + fn main() {} diff --git a/tests/ui/stability-attribute/missing-const-stability.stderr b/tests/ui/stability-attribute/missing-const-stability.stderr index adf60c38611..ad8a1fa9d36 100644 --- a/tests/ui/stability-attribute/missing-const-stability.stderr +++ b/tests/ui/stability-attribute/missing-const-stability.stderr @@ -1,12 +1,3 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/missing-const-stability.rs:3:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - error: function has missing const stability attribute --> $DIR/missing-const-stability.rs:7:1 | @@ -22,11 +13,17 @@ LL | | fn fun() {} LL | | } | |_^ +error: function has missing const stability attribute + --> $DIR/missing-const-stability.rs:36:1 + | +LL | pub const unsafe fn size_of_val<T>(x: *const T) -> usize { 42 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: associated function has missing const stability attribute --> $DIR/missing-const-stability.rs:16:5 | LL | pub const fn foo() {} | ^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 4 previous errors diff --git a/tests/ui/stability-attribute/stability-attribute-implies-no-feature.rs b/tests/ui/stability-attribute/stability-attribute-implies-no-feature.rs index 47f885a43d6..0cc1dd20fd8 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-no-feature.rs +++ b/tests/ui/stability-attribute/stability-attribute-implies-no-feature.rs @@ -5,9 +5,9 @@ extern crate stability_attribute_implies; use stability_attribute_implies::{foo, foobar}; -//~^ ERROR use of unstable library feature 'foobar' +//~^ ERROR use of unstable library feature `foobar` fn main() { foo(); // no error - stable - foobar(); //~ ERROR use of unstable library feature 'foobar' + foobar(); //~ ERROR use of unstable library feature `foobar` } diff --git a/tests/ui/stability-attribute/stability-attribute-implies-no-feature.stderr b/tests/ui/stability-attribute/stability-attribute-implies-no-feature.stderr index b35ee6c1291..a625ef504b1 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-no-feature.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-no-feature.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'foobar' +error[E0658]: use of unstable library feature `foobar` --> $DIR/stability-attribute-implies-no-feature.rs:7:40 | LL | use stability_attribute_implies::{foo, foobar}; @@ -8,7 +8,7 @@ LL | use stability_attribute_implies::{foo, foobar}; = help: add `#![feature(foobar)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'foobar' +error[E0658]: use of unstable library feature `foobar` --> $DIR/stability-attribute-implies-no-feature.rs:12:5 | LL | foobar(); diff --git a/tests/ui/stability-attribute/stability-attribute-issue.rs b/tests/ui/stability-attribute/stability-attribute-issue.rs index 2d25c0c8bd7..e9d1f144e6b 100644 --- a/tests/ui/stability-attribute/stability-attribute-issue.rs +++ b/tests/ui/stability-attribute/stability-attribute-issue.rs @@ -6,7 +6,7 @@ use stability_attribute_issue::*; fn main() { unstable(); - //~^ ERROR use of unstable library feature 'unstable_test_feature' + //~^ ERROR use of unstable library feature `unstable_test_feature` unstable_msg(); - //~^ ERROR use of unstable library feature 'unstable_test_feature': message + //~^ ERROR use of unstable library feature `unstable_test_feature`: message } diff --git a/tests/ui/stability-attribute/stability-attribute-issue.stderr b/tests/ui/stability-attribute/stability-attribute-issue.stderr index 336e0f1718f..9dc6f441987 100644 --- a/tests/ui/stability-attribute/stability-attribute-issue.stderr +++ b/tests/ui/stability-attribute/stability-attribute-issue.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/stability-attribute-issue.rs:8:5 | LL | unstable(); @@ -8,7 +8,7 @@ LL | unstable(); = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature': message +error[E0658]: use of unstable library feature `unstable_test_feature`: message --> $DIR/stability-attribute-issue.rs:10:5 | LL | unstable_msg(); diff --git a/tests/ui/stability-attribute/stable-in-unstable.rs b/tests/ui/stability-attribute/stable-in-unstable.rs index d10845d49a3..1fe084f6e59 100644 --- a/tests/ui/stability-attribute/stable-in-unstable.rs +++ b/tests/ui/stability-attribute/stable-in-unstable.rs @@ -13,8 +13,8 @@ extern crate stable_in_unstable_core; extern crate stable_in_unstable_std; mod isolated1 { - use stable_in_unstable_core::new_unstable_module; //~ ERROR use of unstable library feature 'unstable_test_feature' - use stable_in_unstable_core::new_unstable_module::OldTrait; //~ ERROR use of unstable library feature 'unstable_test_feature' + use stable_in_unstable_core::new_unstable_module; //~ ERROR use of unstable library feature `unstable_test_feature` + use stable_in_unstable_core::new_unstable_module::OldTrait; //~ ERROR use of unstable library feature `unstable_test_feature` } mod isolated2 { @@ -26,7 +26,7 @@ mod isolated2 { } mod isolated3 { - use stable_in_unstable_core::new_unstable_module::OldTrait; //~ ERROR use of unstable library feature 'unstable_test_feature' + use stable_in_unstable_core::new_unstable_module::OldTrait; //~ ERROR use of unstable library feature `unstable_test_feature` struct LocalType; @@ -36,7 +36,7 @@ mod isolated3 { mod isolated4 { struct LocalType; - impl stable_in_unstable_core::new_unstable_module::OldTrait for LocalType {} //~ ERROR use of unstable library feature 'unstable_test_feature' + impl stable_in_unstable_core::new_unstable_module::OldTrait for LocalType {} //~ ERROR use of unstable library feature `unstable_test_feature` } mod isolated5 { @@ -46,9 +46,9 @@ mod isolated5 { } mod isolated6 { - use stable_in_unstable_core::new_unstable_module::{OldTrait}; //~ ERROR use of unstable library feature 'unstable_test_feature' + use stable_in_unstable_core::new_unstable_module::{OldTrait}; //~ ERROR use of unstable library feature `unstable_test_feature` } mod isolated7 { - use stable_in_unstable_core::new_unstable_module::*; //~ ERROR use of unstable library feature 'unstable_test_feature' + use stable_in_unstable_core::new_unstable_module::*; //~ ERROR use of unstable library feature `unstable_test_feature` } diff --git a/tests/ui/stability-attribute/stable-in-unstable.stderr b/tests/ui/stability-attribute/stable-in-unstable.stderr index eb73f047acd..b37b4dfd586 100644 --- a/tests/ui/stability-attribute/stable-in-unstable.stderr +++ b/tests/ui/stability-attribute/stable-in-unstable.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/stable-in-unstable.rs:16:9 | LL | use stable_in_unstable_core::new_unstable_module; @@ -8,7 +8,7 @@ LL | use stable_in_unstable_core::new_unstable_module; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/stable-in-unstable.rs:17:9 | LL | use stable_in_unstable_core::new_unstable_module::OldTrait; @@ -18,7 +18,7 @@ LL | use stable_in_unstable_core::new_unstable_module::OldTrait; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/stable-in-unstable.rs:29:9 | LL | use stable_in_unstable_core::new_unstable_module::OldTrait; @@ -28,7 +28,7 @@ LL | use stable_in_unstable_core::new_unstable_module::OldTrait; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/stable-in-unstable.rs:39:10 | LL | impl stable_in_unstable_core::new_unstable_module::OldTrait for LocalType {} @@ -38,7 +38,7 @@ LL | impl stable_in_unstable_core::new_unstable_module::OldTrait for LocalTy = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/stable-in-unstable.rs:49:56 | LL | use stable_in_unstable_core::new_unstable_module::{OldTrait}; @@ -48,7 +48,7 @@ LL | use stable_in_unstable_core::new_unstable_module::{OldTrait}; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'unstable_test_feature' +error[E0658]: use of unstable library feature `unstable_test_feature` --> $DIR/stable-in-unstable.rs:53:9 | LL | use stable_in_unstable_core::new_unstable_module::*; diff --git a/tests/ui/stability-attribute/suggest-vec-allocator-api.rs b/tests/ui/stability-attribute/suggest-vec-allocator-api.rs index fac52ab77c6..61a48c19e72 100644 --- a/tests/ui/stability-attribute/suggest-vec-allocator-api.rs +++ b/tests/ui/stability-attribute/suggest-vec-allocator-api.rs @@ -1,9 +1,9 @@ fn main() { - let _: Vec<u8, _> = vec![]; //~ ERROR use of unstable library feature 'allocator_api' + let _: Vec<u8, _> = vec![]; //~ ERROR use of unstable library feature `allocator_api` #[rustfmt::skip] let _: Vec< String, - _> = vec![]; //~ ERROR use of unstable library feature 'allocator_api' - let _ = Vec::<u16, _>::new(); //~ ERROR use of unstable library feature 'allocator_api' - let _boxed: Box<u32, _> = Box::new(10); //~ ERROR use of unstable library feature 'allocator_api' + _> = vec![]; //~ ERROR use of unstable library feature `allocator_api` + let _ = Vec::<u16, _>::new(); //~ ERROR use of unstable library feature `allocator_api` + let _boxed: Box<u32, _> = Box::new(10); //~ ERROR use of unstable library feature `allocator_api` } diff --git a/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr b/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr index d7fcba4ced5..6662ceda90b 100644 --- a/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr +++ b/tests/ui/stability-attribute/suggest-vec-allocator-api.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'allocator_api' +error[E0658]: use of unstable library feature `allocator_api` --> $DIR/suggest-vec-allocator-api.rs:2:20 | LL | let _: Vec<u8, _> = vec![]; @@ -10,7 +10,7 @@ LL | let _: Vec<u8, _> = vec![]; = help: add `#![feature(allocator_api)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'allocator_api' +error[E0658]: use of unstable library feature `allocator_api` --> $DIR/suggest-vec-allocator-api.rs:6:9 | LL | _> = vec![]; @@ -26,7 +26,7 @@ LL + String, LL ~ _)> = vec![]; | -error[E0658]: use of unstable library feature 'allocator_api' +error[E0658]: use of unstable library feature `allocator_api` --> $DIR/suggest-vec-allocator-api.rs:8:26 | LL | let _boxed: Box<u32, _> = Box::new(10); @@ -36,7 +36,7 @@ LL | let _boxed: Box<u32, _> = Box::new(10); = help: add `#![feature(allocator_api)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'allocator_api' +error[E0658]: use of unstable library feature `allocator_api` --> $DIR/suggest-vec-allocator-api.rs:7:24 | LL | let _ = Vec::<u16, _>::new(); diff --git a/tests/ui/stable-mir-print/operands.rs b/tests/ui/stable-mir-print/operands.rs new file mode 100644 index 00000000000..34a74e2287e --- /dev/null +++ b/tests/ui/stable-mir-print/operands.rs @@ -0,0 +1,48 @@ +//@ compile-flags: -Z unpretty=stable-mir --crate-type lib -C panic=abort +//@ check-pass +//@ only-x86_64 +//@ needs-unwind unwind edges are different with panic=abort +//! Check how stable mir pretty printer prints different operands and abort strategy. + +pub fn operands(val: u8) { + let array = [val; 10]; + let first = array[0]; + let last = array[10 - 1]; + assert_eq!(first, last); + + let reference = &first; + let dereferenced = *reference; + assert_eq!(dereferenced, first); + + let tuple = (first, last); + let (first_again, _) = tuple; + let first_again_again = tuple.0; + assert_eq!(first_again, first_again_again); + + let length = array.len(); + let size_of = std::mem::size_of_val(&length); + assert_eq!(length, size_of); +} + +pub struct Dummy { + c: char, + i: i32, +} + +pub enum Ctors { + Unit, + StructLike { d: Dummy }, + TupLike(bool), +} + +pub fn more_operands() -> [Ctors; 3] { + let dummy = Dummy { c: 'a', i: i32::MIN }; + let unit = Ctors::Unit; + let struct_like = Ctors::StructLike { d: dummy }; + let tup_like = Ctors::TupLike(false); + [unit, struct_like, tup_like] +} + +pub fn closures(x: bool, z: bool) -> impl FnOnce(bool) -> bool { + move |y: bool| (x ^ y) || z +} diff --git a/tests/ui/stable-mir-print/operands.stdout b/tests/ui/stable-mir-print/operands.stdout new file mode 100644 index 00000000000..3c27878b3cf --- /dev/null +++ b/tests/ui/stable-mir-print/operands.stdout @@ -0,0 +1,263 @@ +// WARNING: This is highly experimental output it's intended for stable-mir developers only. +// If you find a bug or want to improve the output open a issue at https://github.com/rust-lang/project-stable-mir. +fn operands(_1: u8) -> () { + let mut _0: (); + let _2: [u8; 10]; + let _3: u8; + let _4: usize; + let mut _5: usize; + let mut _6: bool; + let _7: u8; + let _8: usize; + let mut _9: (usize, bool); + let mut _10: usize; + let mut _11: bool; + let mut _12: (&u8, &u8); + let mut _13: &u8; + let mut _14: &u8; + let _15: &u8; + let _16: &u8; + let mut _17: bool; + let mut _18: u8; + let mut _19: u8; + let _20: core::panicking::AssertKind; + let _21: !; + let mut _22: Option<Arguments<'_>>; + let _23: &u8; + let _24: u8; + let mut _25: (&u8, &u8); + let mut _26: &u8; + let mut _27: &u8; + let _28: &u8; + let _29: &u8; + let mut _30: bool; + let mut _31: u8; + let mut _32: u8; + let _33: core::panicking::AssertKind; + let _34: !; + let mut _35: Option<Arguments<'_>>; + let _36: (u8, u8); + let _37: u8; + let _38: u8; + let mut _39: (&u8, &u8); + let mut _40: &u8; + let mut _41: &u8; + let _42: &u8; + let _43: &u8; + let mut _44: bool; + let mut _45: u8; + let mut _46: u8; + let _47: core::panicking::AssertKind; + let _48: !; + let mut _49: Option<Arguments<'_>>; + let _50: usize; + let mut _51: &[u8]; + let mut _52: &[u8; 10]; + let _53: usize; + let _54: &usize; + let mut _55: (&usize, &usize); + let mut _56: &usize; + let mut _57: &usize; + let _58: &usize; + let _59: &usize; + let mut _60: bool; + let mut _61: usize; + let mut _62: usize; + let _63: core::panicking::AssertKind; + let _64: !; + let mut _65: Option<Arguments<'_>>; + debug val => _1; + debug array => _2; + debug first => _3; + debug last => _7; + debug left_val => _15; + debug right_val => _16; + debug kind => _20; + debug reference => _23; + debug dereferenced => _24; + debug left_val => _28; + debug right_val => _29; + debug kind => _33; + debug tuple => _36; + debug first_again => _37; + debug first_again_again => _38; + debug left_val => _42; + debug right_val => _43; + debug kind => _47; + debug length => _50; + debug size_of => _53; + debug left_val => _58; + debug right_val => _59; + debug kind => _63; + bb0: { + _2 = [_1; 10]; + _4 = 0_usize; + _5 = 10_usize; + _6 = Lt(_4, _5); + assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; + } + bb1: { + _3 = _2[_4]; + _9 = CheckedSub(10_usize, 1_usize); + assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", 10_usize, 1_usize) -> [success: bb2, unwind unreachable]; + } + bb2: { + _8 = move (_9.0: usize); + _10 = 10_usize; + _11 = Lt(_8, _10); + assert(move _11, "index out of bounds: the length is {} but the index is {}", move _10, _8) -> [success: bb3, unwind unreachable]; + } + bb3: { + _7 = _2[_8]; + _13 = &_3; + _14 = &_7; + _12 = (move _13, move _14); + _15 = (_12.0: &u8); + _16 = (_12.1: &u8); + _18 = (*_15); + _19 = (*_16); + _17 = Eq(move _18, move _19); + switchInt(move _17) -> [0: bb5, otherwise: bb4]; + } + bb4: { + _23 = &_3; + _24 = (*_23); + _26 = &_24; + _27 = &_3; + _25 = (move _26, move _27); + _28 = (_25.0: &u8); + _29 = (_25.1: &u8); + _31 = (*_28); + _32 = (*_29); + _30 = Eq(move _31, move _32); + switchInt(move _30) -> [0: bb7, otherwise: bb6]; + } + bb5: { + _20 = core::panicking::AssertKind::Eq; + _22 = std::option::Option::None; + _21 = core::panicking::assert_failed::<u8, u8>(move _20, _15, _16, move _22) -> unwind unreachable; + } + bb6: { + _36 = (_3, _7); + _37 = (_36.0: u8); + _38 = (_36.0: u8); + _40 = &_37; + _41 = &_38; + _39 = (move _40, move _41); + _42 = (_39.0: &u8); + _43 = (_39.1: &u8); + _45 = (*_42); + _46 = (*_43); + _44 = Eq(move _45, move _46); + switchInt(move _44) -> [0: bb9, otherwise: bb8]; + } + bb7: { + _33 = core::panicking::AssertKind::Eq; + _35 = std::option::Option::None; + _34 = core::panicking::assert_failed::<u8, u8>(move _33, _28, _29, move _35) -> unwind unreachable; + } + bb8: { + _52 = &_2; + _51 = move _52 as &[u8]; + _50 = PtrMetadata(move _51); + _54 = &_50; + _53 = std::mem::size_of_val::<usize>(_54) -> [return: bb10, unwind unreachable]; + } + bb9: { + _47 = core::panicking::AssertKind::Eq; + _49 = std::option::Option::None; + _48 = core::panicking::assert_failed::<u8, u8>(move _47, _42, _43, move _49) -> unwind unreachable; + } + bb10: { + _56 = &_50; + _57 = &_53; + _55 = (move _56, move _57); + _58 = (_55.0: &usize); + _59 = (_55.1: &usize); + _61 = (*_58); + _62 = (*_59); + _60 = Eq(move _61, move _62); + switchInt(move _60) -> [0: bb12, otherwise: bb11]; + } + bb11: { + return; + } + bb12: { + _63 = core::panicking::AssertKind::Eq; + _65 = std::option::Option::None; + _64 = core::panicking::assert_failed::<usize, usize>(move _63, _58, _59, move _65) -> unwind unreachable; + } +} +fn operands::{constant#0}() -> usize { + let mut _0: usize; + bb0: { + _0 = 10_usize; + return; + } +} +fn more_operands() -> [Ctors; 3] { + let mut _0: [Ctors; 3]; + let _1: Dummy; + let _2: Ctors; + let _3: Ctors; + let _4: Ctors; + debug dummy => _1; + debug unit => _2; + debug struct_like => _3; + debug tup_like => _4; + bb0: { + _1 = Dummy('a', core::num::<impl i32>::MIN); + _2 = Ctors::Unit; + _3 = Ctors::StructLike(move _1); + _4 = Ctors::TupLike(false); + _0 = [move _2, move _3, move _4]; + return; + } +} +fn more_operands::{constant#0}() -> usize { + let mut _0: usize; + bb0: { + _0 = 3_usize; + return; + } +} +fn closures(_1: bool, _2: bool) -> {closure@$DIR/operands.rs:47:5: 47:19} { + let mut _0: {closure@$DIR/operands.rs:47:5: 47:19}; + debug x => _1; + debug z => _2; + bb0: { + _0 = {closure@$DIR/operands.rs:47:5: 47:19}(_1, _2); + return; + } +} +fn closures::{closure#0}(_1: {closure@$DIR/operands.rs:47:5: 47:19}, _2: bool) -> bool { + let mut _0: bool; + let mut _3: bool; + let mut _4: bool; + debug y => _2; + debug x => (_1.0: bool); + debug z => (_1.1: bool); + bb0: { + _4 = (_1.0: bool); + _3 = BitXor(move _4, _2); + switchInt(move _3) -> [0: bb2, otherwise: bb1]; + } + bb1: { + _0 = true; + goto -> bb3; + } + bb2: { + _0 = (_1.1: bool); + goto -> bb3; + } + bb3: { + return; + } +} +fn Ctors::TupLike(_1: bool) -> Ctors { + let mut _0: Ctors; + bb0: { + _0 = Ctors::TupLike(move _1); + return; + } +} diff --git a/tests/ui/statics/check-values-constraints.stderr b/tests/ui/statics/check-values-constraints.stderr index 24763c175fc..b4ee34530d3 100644 --- a/tests/ui/statics/check-values-constraints.stderr +++ b/tests/ui/statics/check-values-constraints.stderr @@ -37,10 +37,6 @@ LL | field2: SafeEnum::Variant4("str".to_string()), | = note: calls in statics are limited to constant functions, tuple structs and tuple variants = note: consider wrapping this expression in `std::sync::LazyLock::new(|| ...)` -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0010]: allocations are not allowed in statics --> $DIR/check-values-constraints.rs:96:5 diff --git a/tests/ui/statics/static-mut-shared-parens.rs b/tests/ui/statics/static-mut-shared-parens.rs new file mode 100644 index 00000000000..8e58152e27a --- /dev/null +++ b/tests/ui/statics/static-mut-shared-parens.rs @@ -0,0 +1,13 @@ +//Missing paren in diagnostic msg: https://github.com/rust-lang/rust/issues/131977 +//@check-pass + + +static mut TEST: usize = 0; + +fn main() { + let _ = unsafe { (&TEST) as *const usize }; + //~^WARN creating a shared reference to mutable static is discouraged + + let _ = unsafe { ((&mut TEST)) as *const usize }; + //~^WARN creating a mutable reference to mutable static is discouraged +} diff --git a/tests/ui/statics/static-mut-shared-parens.stderr b/tests/ui/statics/static-mut-shared-parens.stderr new file mode 100644 index 00000000000..aa7a760ded8 --- /dev/null +++ b/tests/ui/statics/static-mut-shared-parens.stderr @@ -0,0 +1,29 @@ +warning: creating a shared reference to mutable static is discouraged + --> $DIR/static-mut-shared-parens.rs:8:22 + | +LL | let _ = unsafe { (&TEST) as *const usize }; + | ^^^^^^^ shared reference to mutable static + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html> + = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives + = note: `#[warn(static_mut_refs)]` on by default +help: use `&raw const` instead to create a raw pointer + | +LL | let _ = unsafe { (&raw const TEST) as *const usize }; + | ~~~~~~~~~~ + +warning: creating a mutable reference to mutable static is discouraged + --> $DIR/static-mut-shared-parens.rs:11:22 + | +LL | let _ = unsafe { ((&mut TEST)) as *const usize }; + | ^^^^^^^^^^^^^ mutable reference to mutable static + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html> + = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives +help: use `&raw mut` instead to create a raw pointer + | +LL | let _ = unsafe { ((&raw mut TEST)) as *const usize }; + | ~~~~~~~~ + +warning: 2 warnings emitted + diff --git a/tests/ui/statics/unsized_type2.stderr b/tests/ui/statics/unsized_type2.stderr index 4e47b37afdc..b18a99fab72 100644 --- a/tests/ui/statics/unsized_type2.stderr +++ b/tests/ui/statics/unsized_type2.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t LL | pub static WITH_ERROR: Foo = Foo { version: 0 }; | ^^^ doesn't have a size known at compile-time | - = help: within `Foo`, the trait `Sized` is not implemented for `str`, which is required by `Foo: Sized` + = help: within `Foo`, the trait `Sized` is not implemented for `str` note: required because it appears within the type `Foo` --> $DIR/unsized_type2.rs:5:12 | @@ -17,7 +17,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t LL | pub static WITH_ERROR: Foo = Foo { version: 0 }; | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `Foo`, the trait `Sized` is not implemented for `str`, which is required by `Foo: Sized` + = help: within `Foo`, the trait `Sized` is not implemented for `str` note: required because it appears within the type `Foo` --> $DIR/unsized_type2.rs:5:12 | diff --git a/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr b/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr index 59e09e48523..35dd570e91f 100644 --- a/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr +++ b/tests/ui/statics/unsizing-wfcheck-issue-127299.stderr @@ -26,7 +26,7 @@ error[E0277]: `(dyn Qux + 'static)` cannot be shared between threads safely LL | static FOO: &Lint = &Lint { desc: "desc" }; | ^^^^^ `(dyn Qux + 'static)` cannot be shared between threads safely | - = help: within `&'static Lint`, the trait `Sync` is not implemented for `(dyn Qux + 'static)`, which is required by `&'static Lint: Sync` + = help: within `&'static Lint`, the trait `Sync` is not implemented for `(dyn Qux + 'static)` = note: required because it appears within the type `&'static (dyn Qux + 'static)` note: required because it appears within the type `Lint` --> $DIR/unsizing-wfcheck-issue-127299.rs:7:12 diff --git a/tests/ui/std/channel-stack-overflow-issue-102246.rs b/tests/ui/std/channel-stack-overflow-issue-102246.rs new file mode 100644 index 00000000000..984ebdd553f --- /dev/null +++ b/tests/ui/std/channel-stack-overflow-issue-102246.rs @@ -0,0 +1,29 @@ +//@ run-pass +//@ needs-threads +//@ compile-flags: -Copt-level=0 + +// The channel's `Block::new` was causing a stack overflow because it held 32 item slots, which is +// 1MiB for this test's `BigStruct` -- instantiated on the stack before moving to `Box::new`. +// +// That block is now initialized directly on the heap. +// +// Ref: https://github.com/rust-lang/rust/issues/102246 + +use std::sync::mpsc::channel; +use std::thread; + +const N: usize = 32_768; +struct BigStruct { + _data: [u8; N], +} + +fn main() { + let (sender, receiver) = channel::<BigStruct>(); + + let thread1 = thread::spawn(move || { + sender.send(BigStruct { _data: [0u8; N] }).unwrap(); + }); + + thread1.join().unwrap(); + for _data in receiver.try_iter() {} +} diff --git a/tests/ui/str/str-idx.stderr b/tests/ui/str/str-idx.stderr index 84806cbea0d..bedbbd9cb50 100644 --- a/tests/ui/str/str-idx.stderr +++ b/tests/ui/str/str-idx.stderr @@ -4,10 +4,10 @@ error[E0277]: the type `str` cannot be indexed by `{integer}` LL | let _: u8 = s[4]; | ^ string indices are ranges of `usize` | - = help: the trait `SliceIndex<str>` is not implemented for `{integer}`, which is required by `str: Index<_>` = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> - = help: the trait `SliceIndex<[_]>` is implemented for `usize` + = help: the trait `SliceIndex<str>` is not implemented for `{integer}` + but trait `SliceIndex<[_]>` is implemented for `usize` = help: for that trait implementation, expected `[_]`, found `str` = note: required for `str` to implement `Index<{integer}>` @@ -19,10 +19,10 @@ LL | let _ = s.get(4); | | | required by a bound introduced by this call | - = help: the trait `SliceIndex<str>` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> - = help: the trait `SliceIndex<[_]>` is implemented for `usize` + = help: the trait `SliceIndex<str>` is not implemented for `{integer}` + but trait `SliceIndex<[_]>` is implemented for `usize` = help: for that trait implementation, expected `[_]`, found `str` note: required by a bound in `core::str::<impl str>::get` --> $SRC_DIR/core/src/str/mod.rs:LL:COL @@ -35,10 +35,10 @@ LL | let _ = s.get_unchecked(4); | | | required by a bound introduced by this call | - = help: the trait `SliceIndex<str>` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> - = help: the trait `SliceIndex<[_]>` is implemented for `usize` + = help: the trait `SliceIndex<str>` is not implemented for `{integer}` + but trait `SliceIndex<[_]>` is implemented for `usize` = help: for that trait implementation, expected `[_]`, found `str` note: required by a bound in `core::str::<impl str>::get_unchecked` --> $SRC_DIR/core/src/str/mod.rs:LL:COL @@ -49,7 +49,7 @@ error[E0277]: the type `str` cannot be indexed by `char` LL | let _: u8 = s['c']; | ^^^ string indices are ranges of `usize` | - = help: the trait `SliceIndex<str>` is not implemented for `char`, which is required by `str: Index<_>` + = help: the trait `SliceIndex<str>` is not implemented for `char` = note: required for `str` to implement `Index<char>` error: aborting due to 4 previous errors diff --git a/tests/ui/str/str-mut-idx.stderr b/tests/ui/str/str-mut-idx.stderr index 679f783126f..f09a4c329e5 100644 --- a/tests/ui/str/str-mut-idx.stderr +++ b/tests/ui/str/str-mut-idx.stderr @@ -30,8 +30,8 @@ error[E0277]: the type `str` cannot be indexed by `usize` LL | s[1usize] = bot(); | ^^^^^^ string indices are ranges of `usize` | - = help: the trait `SliceIndex<str>` is not implemented for `usize`, which is required by `str: Index<_>` - = help: the trait `SliceIndex<[_]>` is implemented for `usize` + = help: the trait `SliceIndex<str>` is not implemented for `usize` + but trait `SliceIndex<[_]>` is implemented for it = help: for that trait implementation, expected `[_]`, found `str` = note: required for `str` to implement `Index<usize>` @@ -43,10 +43,10 @@ LL | s.get_mut(1); | | | required by a bound introduced by this call | - = help: the trait `SliceIndex<str>` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> - = help: the trait `SliceIndex<[_]>` is implemented for `usize` + = help: the trait `SliceIndex<str>` is not implemented for `{integer}` + but trait `SliceIndex<[_]>` is implemented for `usize` = help: for that trait implementation, expected `[_]`, found `str` note: required by a bound in `core::str::<impl str>::get_mut` --> $SRC_DIR/core/src/str/mod.rs:LL:COL @@ -59,10 +59,10 @@ LL | s.get_unchecked_mut(1); | | | required by a bound introduced by this call | - = help: the trait `SliceIndex<str>` is not implemented for `{integer}` = note: you can use `.chars().nth()` or `.bytes().nth()` for more information, see chapter 8 in The Book: <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> - = help: the trait `SliceIndex<[_]>` is implemented for `usize` + = help: the trait `SliceIndex<str>` is not implemented for `{integer}` + but trait `SliceIndex<[_]>` is implemented for `usize` = help: for that trait implementation, expected `[_]`, found `str` note: required by a bound in `core::str::<impl str>::get_unchecked_mut` --> $SRC_DIR/core/src/str/mod.rs:LL:COL @@ -73,7 +73,7 @@ error[E0277]: the type `str` cannot be indexed by `char` LL | s['c']; | ^^^ string indices are ranges of `usize` | - = help: the trait `SliceIndex<str>` is not implemented for `char`, which is required by `str: Index<_>` + = help: the trait `SliceIndex<str>` is not implemented for `char` = note: required for `str` to implement `Index<char>` error: aborting due to 6 previous errors diff --git a/tests/ui/structs-enums/rec-align-u32.rs b/tests/ui/structs-enums/rec-align-u32.rs index 9cd2a988871..44879189739 100644 --- a/tests/ui/structs-enums/rec-align-u32.rs +++ b/tests/ui/structs-enums/rec-align-u32.rs @@ -3,17 +3,10 @@ #![allow(unused_unsafe)] // Issue #2303 -#![feature(intrinsics, rustc_attrs)] +#![feature(core_intrinsics, rustc_attrs)] use std::mem; - -mod rusti { - extern "rust-intrinsic" { - pub fn pref_align_of<T>() -> usize; - #[rustc_safe_intrinsic] - pub fn min_align_of<T>() -> usize; - } -} +use std::intrinsics; // This is the type with the questionable alignment #[derive(Debug)] @@ -41,12 +34,12 @@ pub fn main() { // Send it through the shape code let y = format!("{:?}", x); - println!("align inner = {:?}", rusti::min_align_of::<Inner>()); + println!("align inner = {:?}", intrinsics::min_align_of::<Inner>()); println!("size outer = {:?}", mem::size_of::<Outer>()); println!("y = {:?}", y); // per clang/gcc the alignment of `inner` is 4 on x86. - assert_eq!(rusti::min_align_of::<Inner>(), m::align()); + assert_eq!(intrinsics::min_align_of::<Inner>(), m::align()); // per clang/gcc the size of `outer` should be 12 // because `inner`s alignment was 4. diff --git a/tests/ui/structs-enums/rec-align-u64.rs b/tests/ui/structs-enums/rec-align-u64.rs index 313ce6d578d..8b501ea5509 100644 --- a/tests/ui/structs-enums/rec-align-u64.rs +++ b/tests/ui/structs-enums/rec-align-u64.rs @@ -4,17 +4,10 @@ // Issue #2303 -#![feature(intrinsics, rustc_attrs)] +#![feature(core_intrinsics, rustc_attrs)] use std::mem; - -mod rusti { - extern "rust-intrinsic" { - pub fn pref_align_of<T>() -> usize; - #[rustc_safe_intrinsic] - pub fn min_align_of<T>() -> usize; - } -} +use std::intrinsics; // This is the type with the questionable alignment #[derive(Debug)] @@ -90,12 +83,12 @@ pub fn main() { let y = format!("{:?}", x); - println!("align inner = {:?}", rusti::min_align_of::<Inner>()); + println!("align inner = {:?}", intrinsics::min_align_of::<Inner>()); println!("size outer = {:?}", mem::size_of::<Outer>()); println!("y = {:?}", y); // per clang/gcc the alignment of `Inner` is 4 on x86. - assert_eq!(rusti::min_align_of::<Inner>(), m::m::align()); + assert_eq!(intrinsics::min_align_of::<Inner>(), m::m::align()); // per clang/gcc the size of `Outer` should be 12 // because `Inner`s alignment was 4. diff --git a/tests/ui/structs/struct-field-cfg.stderr b/tests/ui/structs/struct-field-cfg.stderr index 2b9ba85ddcb..f30d343d582 100644 --- a/tests/ui/structs/struct-field-cfg.stderr +++ b/tests/ui/structs/struct-field-cfg.stderr @@ -24,6 +24,10 @@ LL | let Foo { present } = foo; | ~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | let Foo { present: _ } = foo; + | ~~~~~~~~~~~~~~ +help: or always ignore missing fields here + | LL | let Foo { .. } = foo; | ~~~~~~ diff --git a/tests/ui/structs/struct-pat-derived-error.stderr b/tests/ui/structs/struct-pat-derived-error.stderr index 78bb018cb4b..d1d68121cf1 100644 --- a/tests/ui/structs/struct-pat-derived-error.stderr +++ b/tests/ui/structs/struct-pat-derived-error.stderr @@ -27,6 +27,10 @@ LL | let A { x, y, b, c } = self.d; | ~~~~~~~~ help: if you don't care about these missing fields, you can explicitly ignore them | +LL | let A { x, y, b: _, c: _ } = self.d; + | ~~~~~~~~~~~~~~ +help: or always ignore missing fields here + | LL | let A { x, y, .. } = self.d; | ~~~~~~ diff --git a/tests/ui/structs/struct-tuple-field-names.stderr b/tests/ui/structs/struct-tuple-field-names.stderr index 0b837a47a82..5f1ab2f9d68 100644 --- a/tests/ui/structs/struct-tuple-field-names.stderr +++ b/tests/ui/structs/struct-tuple-field-names.stderr @@ -32,6 +32,10 @@ LL | if let E::S { 0: a, 1: _ } = x { | ~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | if let E::S { 0: a, 1: _ } = x { + | ~~~~~~~~ +help: or always ignore missing fields here + | LL | if let E::S { 0: a, .. } = x { | ~~~~~~ diff --git a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr index e8503f540c2..af530e2b759 100644 --- a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr +++ b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr @@ -19,6 +19,10 @@ LL | Foo::Bar { a, aa: 1, c, b } => (), | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | Foo::Bar { a, aa: 1, c, b: _ } => (), + | ~~~~~~~~ +help: or always ignore missing fields here + | LL | Foo::Bar { a, aa: 1, c, .. } => (), | ~~~~~~ @@ -43,6 +47,10 @@ LL | Foo::Baz { bb: 1.0, a } => (), | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | Foo::Baz { bb: 1.0, a: _ } => (), + | ~~~~~~~~ +help: or always ignore missing fields here + | LL | Foo::Baz { bb: 1.0, .. } => (), | ~~~~~~ @@ -64,6 +72,10 @@ LL | Foo::Bar { a, aa: "", c, b } => (), | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | Foo::Bar { a, aa: "", c, b: _ } => (), + | ~~~~~~~~ +help: or always ignore missing fields here + | LL | Foo::Bar { a, aa: "", c, .. } => (), | ~~~~~~ @@ -85,6 +97,10 @@ LL | Foo::Baz { bb: "", a } => (), | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | Foo::Baz { bb: "", a: _ } => (), + | ~~~~~~~~ +help: or always ignore missing fields here + | LL | Foo::Baz { bb: "", .. } => (), | ~~~~~~ diff --git a/tests/ui/suggestions/assoc-const-as-field.stderr b/tests/ui/suggestions/assoc-const-as-field.stderr index 0f58ce65049..6c095e52ac9 100644 --- a/tests/ui/suggestions/assoc-const-as-field.stderr +++ b/tests/ui/suggestions/assoc-const-as-field.stderr @@ -2,7 +2,12 @@ error[E0423]: expected value, found struct `Mod::Foo` --> $DIR/assoc-const-as-field.rs:11:9 | LL | foo(Mod::Foo.Bar); - | ^^^^^^^^- help: use the path separator to refer to an item: `::` + | ^^^^^^^^ + | +help: use the path separator to refer to an item + | +LL | foo(Mod::Foo::Bar); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/derive-clone-for-eq.stderr b/tests/ui/suggestions/derive-clone-for-eq.stderr index 6fae6e1316d..680890e880c 100644 --- a/tests/ui/suggestions/derive-clone-for-eq.stderr +++ b/tests/ui/suggestions/derive-clone-for-eq.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Clone` is not satisfied --> $DIR/derive-clone-for-eq.rs:4:17 | LL | #[derive(Clone, Eq)] - | ^^ the trait `Clone` is not implemented for `T`, which is required by `Struct<T>: PartialEq` + | ^^ the trait `Clone` is not implemented for `T` | note: required for `Struct<T>` to implement `PartialEq` --> $DIR/derive-clone-for-eq.rs:7:19 diff --git a/tests/ui/suggestions/derive-macro-missing-bounds.stderr b/tests/ui/suggestions/derive-macro-missing-bounds.stderr index 5da85a9d061..bffcb1af487 100644 --- a/tests/ui/suggestions/derive-macro-missing-bounds.stderr +++ b/tests/ui/suggestions/derive-macro-missing-bounds.stderr @@ -6,7 +6,7 @@ LL | #[derive(Debug)] LL | struct Outer<T>(Inner<T>); | ^^^^^^^^ `a::Inner<T>` cannot be formatted using `{:?}` | - = help: the trait `Debug` is not implemented for `a::Inner<T>`, which is required by `&a::Inner<T>: Debug` + = help: the trait `Debug` is not implemented for `a::Inner<T>` = note: add `#[derive(Debug)]` to `a::Inner<T>` or manually `impl Debug for a::Inner<T>` = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `a::Inner<T>` with `#[derive(Debug)]` @@ -25,7 +25,7 @@ error[E0277]: the trait bound `T: c::Trait` is not satisfied LL | #[derive(Debug)] | ----- in this derive macro expansion LL | struct Outer<T>(Inner<T>); - | ^^^^^^^^ the trait `c::Trait` is not implemented for `T`, which is required by `&c::Inner<T>: Debug` + | ^^^^^^^^ the trait `c::Trait` is not implemented for `T` | note: required for `c::Inner<T>` to implement `Debug` --> $DIR/derive-macro-missing-bounds.rs:34:28 @@ -49,7 +49,7 @@ error[E0277]: the trait bound `T: d::Trait` is not satisfied LL | #[derive(Debug)] | ----- in this derive macro expansion LL | struct Outer<T>(Inner<T>); - | ^^^^^^^^ the trait `d::Trait` is not implemented for `T`, which is required by `&d::Inner<T>: Debug` + | ^^^^^^^^ the trait `d::Trait` is not implemented for `T` | note: required for `d::Inner<T>` to implement `Debug` --> $DIR/derive-macro-missing-bounds.rs:49:13 @@ -71,7 +71,7 @@ error[E0277]: the trait bound `T: e::Trait` is not satisfied LL | #[derive(Debug)] | ----- in this derive macro expansion LL | struct Outer<T>(Inner<T>); - | ^^^^^^^^ the trait `e::Trait` is not implemented for `T`, which is required by `&e::Inner<T>: Debug` + | ^^^^^^^^ the trait `e::Trait` is not implemented for `T` | note: required for `e::Inner<T>` to implement `Debug` --> $DIR/derive-macro-missing-bounds.rs:64:13 @@ -93,7 +93,7 @@ error[E0277]: the trait bound `T: f::Trait` is not satisfied LL | #[derive(Debug)] | ----- in this derive macro expansion LL | struct Outer<T>(Inner<T>); - | ^^^^^^^^ the trait `f::Trait` is not implemented for `T`, which is required by `&f::Inner<T>: Debug` + | ^^^^^^^^ the trait `f::Trait` is not implemented for `T` | note: required for `f::Inner<T>` to implement `Debug` --> $DIR/derive-macro-missing-bounds.rs:79:20 diff --git a/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr index 75a3ae1a83e..60d0263c149 100644 --- a/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr +++ b/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr @@ -20,10 +20,11 @@ error[E0277]: the trait bound `{closure@$DIR/fn-ctor-passed-as-arg-where-it-shou --> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:19:9 | LL | bar(closure); - | --- ^^^^^^^ the trait `T` is not implemented for closure `{closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21}` + | --- ^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | + = help: the trait `T` is not implemented for closure `{closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21}` note: required by a bound in `bar` --> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:14:16 | diff --git a/tests/ui/suggestions/into-str.stderr b/tests/ui/suggestions/into-str.stderr index ac6e531fee2..d02d3186082 100644 --- a/tests/ui/suggestions/into-str.stderr +++ b/tests/ui/suggestions/into-str.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `&str: From<String>` is not satisfied --> $DIR/into-str.rs:4:9 | LL | foo(String::new()); - | --- ^^^^^^^^^^^^^ the trait `From<String>` is not implemented for `&str`, which is required by `String: Into<&str>` + | --- ^^^^^^^^^^^^^ the trait `From<String>` is not implemented for `&str` | | | required by a bound introduced by this call | diff --git a/tests/ui/suggestions/issue-101623.stderr b/tests/ui/suggestions/issue-101623.stderr index 4de91a1b995..0733e67ea02 100644 --- a/tests/ui/suggestions/issue-101623.stderr +++ b/tests/ui/suggestions/issue-101623.stderr @@ -7,7 +7,8 @@ LL | Trait::do_stuff({ fun(&mut *inner) }); | | the trait `Trait<'_>` is not implemented for `*mut ()` | required by a bound introduced by this call | - = help: the trait `Trait<'_>` is implemented for `()` + = help: the trait `Trait<'_>` is not implemented for `*mut ()` + but it is implemented for `()` = help: for that trait implementation, expected `()`, found `*mut ()` error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-71394-no-from-impl.stderr b/tests/ui/suggestions/issue-71394-no-from-impl.stderr index 79f5dcf4b73..31f8f1d455a 100644 --- a/tests/ui/suggestions/issue-71394-no-from-impl.stderr +++ b/tests/ui/suggestions/issue-71394-no-from-impl.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied --> $DIR/issue-71394-no-from-impl.rs:8:25 | LL | let _: &[i8] = data.into(); - | ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]`, which is required by `&[u8]: Into<_>` + | ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]` | = help: the following other types implement trait `From<T>`: `[T; 10]` implements `From<(T, T, T, T, T, T, T, T, T, T)>` diff --git a/tests/ui/suggestions/issue-84973-blacklist.rs b/tests/ui/suggestions/issue-84973-blacklist.rs index edc0637636b..7edf4d347af 100644 --- a/tests/ui/suggestions/issue-84973-blacklist.rs +++ b/tests/ui/suggestions/issue-84973-blacklist.rs @@ -1,5 +1,6 @@ // Checks that certain traits for which we don't want to suggest borrowing // are blacklisted and don't cause the suggestion to be issued. +//@compile-flags: --diagnostic-width=300 #![feature(coroutines)] diff --git a/tests/ui/suggestions/issue-84973-blacklist.stderr b/tests/ui/suggestions/issue-84973-blacklist.stderr index c1ef1cd428e..a6324a824c1 100644 --- a/tests/ui/suggestions/issue-84973-blacklist.stderr +++ b/tests/ui/suggestions/issue-84973-blacklist.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `String: Copy` is not satisfied - --> $DIR/issue-84973-blacklist.rs:15:12 + --> $DIR/issue-84973-blacklist.rs:16:12 | LL | f_copy("".to_string()); | ------ ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` @@ -7,7 +7,7 @@ LL | f_copy("".to_string()); | required by a bound introduced by this call | note: required by a bound in `f_copy` - --> $DIR/issue-84973-blacklist.rs:6:14 + --> $DIR/issue-84973-blacklist.rs:7:14 | LL | fn f_copy<T: Copy>(t: T) {} | ^^^^ required by this bound in `f_copy` @@ -18,7 +18,7 @@ LL + f_copy(""); | error[E0277]: the trait bound `S: Clone` is not satisfied - --> $DIR/issue-84973-blacklist.rs:16:13 + --> $DIR/issue-84973-blacklist.rs:17:13 | LL | f_clone(S); | ------- ^ the trait `Clone` is not implemented for `S` @@ -26,7 +26,7 @@ LL | f_clone(S); | required by a bound introduced by this call | note: required by a bound in `f_clone` - --> $DIR/issue-84973-blacklist.rs:7:15 + --> $DIR/issue-84973-blacklist.rs:8:15 | LL | fn f_clone<T: Clone>(t: T) {} | ^^^^^ required by this bound in `f_clone` @@ -36,24 +36,24 @@ LL + #[derive(Clone)] LL | struct S; | -error[E0277]: `{static coroutine@$DIR/issue-84973-blacklist.rs:17:26: 17:35}` cannot be unpinned - --> $DIR/issue-84973-blacklist.rs:17:26 +error[E0277]: `{static coroutine@$DIR/issue-84973-blacklist.rs:18:26: 18:35}` cannot be unpinned + --> $DIR/issue-84973-blacklist.rs:18:26 | LL | f_unpin(#[coroutine] static || { yield; }); - | ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/issue-84973-blacklist.rs:17:26: 17:35}` + | ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/issue-84973-blacklist.rs:18:26: 18:35}` | | | required by a bound introduced by this call | = note: consider using the `pin!` macro consider using `Box::pin` if you need to access the pinned value outside of the current scope note: required by a bound in `f_unpin` - --> $DIR/issue-84973-blacklist.rs:8:15 + --> $DIR/issue-84973-blacklist.rs:9:15 | LL | fn f_unpin<T: Unpin>(t: T) {} | ^^^^^ required by this bound in `f_unpin` error[E0277]: the size for values of type `dyn Fn()` cannot be known at compilation time - --> $DIR/issue-84973-blacklist.rs:22:13 + --> $DIR/issue-84973-blacklist.rs:23:13 | LL | f_sized(*ref_cl); | ------- ^^^^^^^ doesn't have a size known at compile-time @@ -62,7 +62,7 @@ LL | f_sized(*ref_cl); | = help: the trait `Sized` is not implemented for `dyn Fn()` note: required by a bound in `f_sized` - --> $DIR/issue-84973-blacklist.rs:9:15 + --> $DIR/issue-84973-blacklist.rs:10:15 | LL | fn f_sized<T: Sized>(t: T) {} | ^^^^^ required by this bound in `f_sized` @@ -73,7 +73,7 @@ LL + f_sized(ref_cl); | error[E0277]: `Rc<{integer}>` cannot be sent between threads safely - --> $DIR/issue-84973-blacklist.rs:27:12 + --> $DIR/issue-84973-blacklist.rs:28:12 | LL | f_send(rc); | ------ ^^ `Rc<{integer}>` cannot be sent between threads safely @@ -82,7 +82,7 @@ LL | f_send(rc); | = help: the trait `Send` is not implemented for `Rc<{integer}>` note: required by a bound in `f_send` - --> $DIR/issue-84973-blacklist.rs:10:14 + --> $DIR/issue-84973-blacklist.rs:11:14 | LL | fn f_send<T: Send>(t: T) {} | ^^^^ required by this bound in `f_send` diff --git a/tests/ui/suggestions/issue-88696.stderr b/tests/ui/suggestions/issue-88696.stderr index a8bc970e055..b4f0793c225 100644 --- a/tests/ui/suggestions/issue-88696.stderr +++ b/tests/ui/suggestions/issue-88696.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Result<u32, i32>: From<Result<u64, i32>>` is not --> $DIR/issue-88696.rs:9:9 | LL | a().into() - | ^^^^ the trait `From<Result<u64, i32>>` is not implemented for `Result<u32, i32>`, which is required by `Result<u64, i32>: Into<_>` + | ^^^^ the trait `From<Result<u64, i32>>` is not implemented for `Result<u32, i32>` | = note: required for `Result<u64, i32>` to implement `Into<Result<u32, i32>>` diff --git a/tests/ui/suggestions/issue-96223.stderr b/tests/ui/suggestions/issue-96223.stderr index 4a77b240f3e..a54a4e7b3be 100644 --- a/tests/ui/suggestions/issue-96223.stderr +++ b/tests/ui/suggestions/issue-96223.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `for<'de> EmptyBis<'de>: Foo<'_>` is not satisfied --> $DIR/issue-96223.rs:49:17 | LL | icey_bounds(&p); - | ----------- ^^ the trait `for<'de> Foo<'_>` is not implemented for `EmptyBis<'de>`, which is required by `Empty: Dummy<EmptyMarker>` + | ----------- ^^ the trait `for<'de> Foo<'_>` is not implemented for `EmptyBis<'de>` | | | required by a bound introduced by this call | diff --git a/tests/ui/suggestions/issue-96555.stderr b/tests/ui/suggestions/issue-96555.stderr index f77681ae80f..1a1e069f09e 100644 --- a/tests/ui/suggestions/issue-96555.stderr +++ b/tests/ui/suggestions/issue-96555.stderr @@ -6,7 +6,7 @@ LL | m::f1().await; | | | this call returns `()` | - = help: the trait `Future` is not implemented for `()`, which is required by `(): IntoFuture` + = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` help: remove the `.await` @@ -27,7 +27,7 @@ LL | m::f2().await; | | | this call returns `()` | - = help: the trait `Future` is not implemented for `()`, which is required by `(): IntoFuture` + = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` help: remove the `.await` @@ -48,7 +48,7 @@ LL | m::f3().await; | | | this call returns `()` | - = help: the trait `Future` is not implemented for `()`, which is required by `(): IntoFuture` + = help: the trait `Future` is not implemented for `()` = note: () must be a future or must implement `IntoFuture` to be awaited = note: required for `()` to implement `IntoFuture` help: remove the `.await` diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr index db16fff826f..d65ad109241 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr @@ -21,7 +21,7 @@ LL | #[derive(Debug, Copy, Clone)] | ----- in this derive macro expansion LL | pub struct AABB<K: Debug> { LL | pub loc: Vector2<K>, - | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K`, which is required by `Vector2<K>: Debug` + | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K` | note: required for `Vector2<K>` to implement `Debug` --> $DIR/missing-bound-in-derive-copy-impl-2.rs:4:10 @@ -64,7 +64,7 @@ LL | #[derive(Debug, Copy, Clone)] | ----- in this derive macro expansion ... LL | pub size: Vector2<K>, - | ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K`, which is required by `Vector2<K>: Clone` + | ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K` | note: required for `Vector2<K>` to implement `Clone` --> $DIR/missing-bound-in-derive-copy-impl-2.rs:4:23 diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr index cf383b5c8ff..316c2fa0fc9 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr @@ -57,7 +57,7 @@ LL | #[derive(Debug, Copy, Clone)] | ----- in this derive macro expansion LL | pub struct AABB<K> { LL | pub loc: Vector2<K>, - | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K`, which is required by `Vector2<K>: Debug` + | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K` | note: required for `Vector2<K>` to implement `Debug` --> $DIR/missing-bound-in-derive-copy-impl.rs:3:10 @@ -130,7 +130,7 @@ LL | #[derive(Debug, Copy, Clone)] | ----- in this derive macro expansion ... LL | pub size: Vector2<K>, - | ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K`, which is required by `Vector2<K>: Clone` + | ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K` | note: required for `Vector2<K>` to implement `Clone` --> $DIR/missing-bound-in-derive-copy-impl.rs:3:23 diff --git a/tests/ui/suggestions/partialeq_suggest_swap.rs b/tests/ui/suggestions/partialeq_suggest_swap.rs new file mode 100644 index 00000000000..ee5583a5488 --- /dev/null +++ b/tests/ui/suggestions/partialeq_suggest_swap.rs @@ -0,0 +1,11 @@ +struct T(i32); + +impl PartialEq<i32> for T { + fn eq(&self, other: &i32) -> bool { + &self.0 == other + } +} + +fn main() { + 4i32 == T(4); //~ mismatched types [E0308] +} diff --git a/tests/ui/suggestions/partialeq_suggest_swap.stderr b/tests/ui/suggestions/partialeq_suggest_swap.stderr new file mode 100644 index 00000000000..2cadc5a16d5 --- /dev/null +++ b/tests/ui/suggestions/partialeq_suggest_swap.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/partialeq_suggest_swap.rs:10:13 + | +LL | 4i32 == T(4); + | ---- ^^^^ expected `i32`, found `T` + | | + | expected because this is `i32` + | + = note: `T` implements `PartialEq<i32>` +help: consider swapping the equality + | +LL | T(4) == 4i32; + | ~~~~ ~~~~ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/path-by-value.stderr b/tests/ui/suggestions/path-by-value.stderr index 62feafe534d..d870e21043c 100644 --- a/tests/ui/suggestions/path-by-value.stderr +++ b/tests/ui/suggestions/path-by-value.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation LL | fn f(p: Path) { } | ^^^^ doesn't have a size known at compile-time | - = help: within `Path`, the trait `Sized` is not implemented for `[u8]`, which is required by `Path: Sized` + = help: within `Path`, the trait `Sized` is not implemented for `[u8]` note: required because it appears within the type `Path` --> $SRC_DIR/std/src/path.rs:LL:COL = help: unsized fn params are gated as an unstable feature diff --git a/tests/ui/suggestions/path-display.stderr b/tests/ui/suggestions/path-display.stderr index f9159c45030..46d0b35825b 100644 --- a/tests/ui/suggestions/path-display.stderr +++ b/tests/ui/suggestions/path-display.stderr @@ -4,7 +4,7 @@ error[E0277]: `Path` doesn't implement `std::fmt::Display` LL | println!("{}", path); | ^^^^ `Path` cannot be formatted with the default formatter; call `.display()` on it | - = help: the trait `std::fmt::Display` is not implemented for `Path`, which is required by `&Path: std::fmt::Display` + = help: the trait `std::fmt::Display` is not implemented for `Path` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/suggestions/suggest-dereferencing-index.stderr b/tests/ui/suggestions/suggest-dereferencing-index.stderr index 86487cdcc44..0335d8eafde 100644 --- a/tests/ui/suggestions/suggest-dereferencing-index.stderr +++ b/tests/ui/suggestions/suggest-dereferencing-index.stderr @@ -4,8 +4,8 @@ error[E0277]: the type `[{integer}]` cannot be indexed by `&usize` LL | let one_item_please: i32 = [1, 2, 3][i]; | ^ slice indices are of type `usize` or ranges of `usize` | - = help: the trait `SliceIndex<[{integer}]>` is not implemented for `&usize`, which is required by `[{integer}; 3]: Index<_>` - = help: the trait `SliceIndex<[{integer}]>` is implemented for `usize` + = help: the trait `SliceIndex<[{integer}]>` is not implemented for `&_` + but it is implemented for `_` = help: for that trait implementation, expected `usize`, found `&usize` = note: required for `[{integer}]` to implement `Index<&usize>` = note: 1 redundant requirement hidden diff --git a/tests/ui/suggestions/suggest-let-and-typo-issue-132483.rs b/tests/ui/suggestions/suggest-let-and-typo-issue-132483.rs new file mode 100644 index 00000000000..d56a6b78d37 --- /dev/null +++ b/tests/ui/suggestions/suggest-let-and-typo-issue-132483.rs @@ -0,0 +1,7 @@ +fn main() { + let x1 = 0; + x2 = 1; + //~^ ERROR E0425 + other_val = 2; + //~^ ERROR E0425 +} diff --git a/tests/ui/suggestions/suggest-let-and-typo-issue-132483.stderr b/tests/ui/suggestions/suggest-let-and-typo-issue-132483.stderr new file mode 100644 index 00000000000..c84f9363f03 --- /dev/null +++ b/tests/ui/suggestions/suggest-let-and-typo-issue-132483.stderr @@ -0,0 +1,29 @@ +error[E0425]: cannot find value `x2` in this scope + --> $DIR/suggest-let-and-typo-issue-132483.rs:3:5 + | +LL | x2 = 1; + | ^^ + | +help: a local variable with a similar name exists + | +LL | x1 = 1; + | ~~ +help: you might have meant to introduce a new binding + | +LL | let x2 = 1; + | +++ + +error[E0425]: cannot find value `other_val` in this scope + --> $DIR/suggest-let-and-typo-issue-132483.rs:5:5 + | +LL | other_val = 2; + | ^^^^^^^^^ + | +help: you might have meant to introduce a new binding + | +LL | let other_val = 2; + | +++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/suggestions/suggest-pin-macro.stderr b/tests/ui/suggestions/suggest-pin-macro.stderr index 68f4099a976..a761a454ad5 100644 --- a/tests/ui/suggestions/suggest-pin-macro.stderr +++ b/tests/ui/suggestions/suggest-pin-macro.stderr @@ -2,7 +2,7 @@ error[E0277]: `PhantomPinned` cannot be unpinned --> $DIR/suggest-pin-macro.rs:22:17 | LL | dummy(test1.get_mut()); - | ^^^^^^^ within `Test`, the trait `Unpin` is not implemented for `PhantomPinned`, which is required by `Test: Unpin` + | ^^^^^^^ within `Test`, the trait `Unpin` is not implemented for `PhantomPinned` | = note: consider using the `pin!` macro consider using `Box::pin` if you need to access the pinned value outside of the current scope diff --git a/tests/ui/suggestions/suggest-remove-refs-1.stderr b/tests/ui/suggestions/suggest-remove-refs-1.stderr index 171184bf77d..523f78dffcc 100644 --- a/tests/ui/suggestions/suggest-remove-refs-1.stderr +++ b/tests/ui/suggestions/suggest-remove-refs-1.stderr @@ -4,7 +4,7 @@ error[E0277]: `&Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator LL | for (i, _) in &v.iter().enumerate() { | ^^^^^^^^^^^^^^^^^^^^^ `&Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator | - = help: the trait `Iterator` is not implemented for `&Enumerate<std::slice::Iter<'_, {integer}>>`, which is required by `&Enumerate<std::slice::Iter<'_, {integer}>>: IntoIterator` + = help: the trait `Iterator` is not implemented for `&Enumerate<std::slice::Iter<'_, {integer}>>` = note: required for `&Enumerate<std::slice::Iter<'_, {integer}>>` to implement `IntoIterator` help: consider removing the leading `&`-reference | diff --git a/tests/ui/suggestions/suggest-remove-refs-2.stderr b/tests/ui/suggestions/suggest-remove-refs-2.stderr index 4e1994523dc..bbe3261e148 100644 --- a/tests/ui/suggestions/suggest-remove-refs-2.stderr +++ b/tests/ui/suggestions/suggest-remove-refs-2.stderr @@ -4,7 +4,7 @@ error[E0277]: `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterat LL | for (i, _) in & & & & &v.iter().enumerate() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator | - = help: the trait `Iterator` is not implemented for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>`, which is required by `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>: IntoIterator` + = help: the trait `Iterator` is not implemented for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` = note: required for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` to implement `IntoIterator` help: consider removing 5 leading `&`-references | diff --git a/tests/ui/suggestions/suggest-remove-refs-3.stderr b/tests/ui/suggestions/suggest-remove-refs-3.stderr index 1d180f9d8be..a3e142563ff 100644 --- a/tests/ui/suggestions/suggest-remove-refs-3.stderr +++ b/tests/ui/suggestions/suggest-remove-refs-3.stderr @@ -8,7 +8,7 @@ LL | | .iter() LL | | .enumerate() { | |____________________^ `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` is not an iterator | - = help: the trait `Iterator` is not implemented for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>`, which is required by `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>: IntoIterator` + = help: the trait `Iterator` is not implemented for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` = note: required for `&&&&&Enumerate<std::slice::Iter<'_, {integer}>>` to implement `IntoIterator` help: consider removing 5 leading `&`-references | diff --git a/tests/ui/suggestions/suggest-remove-refs-4.stderr b/tests/ui/suggestions/suggest-remove-refs-4.stderr index 7ab34c4af51..ed9fc2dd256 100644 --- a/tests/ui/suggestions/suggest-remove-refs-4.stderr +++ b/tests/ui/suggestions/suggest-remove-refs-4.stderr @@ -4,7 +4,7 @@ error[E0277]: `&&std::slice::Iter<'_, {integer}>` is not an iterator LL | for _i in &foo {} | ^^^^ `&&std::slice::Iter<'_, {integer}>` is not an iterator | - = help: the trait `Iterator` is not implemented for `&&std::slice::Iter<'_, {integer}>`, which is required by `&&std::slice::Iter<'_, {integer}>: IntoIterator` + = help: the trait `Iterator` is not implemented for `&&std::slice::Iter<'_, {integer}>` = note: required for `&&std::slice::Iter<'_, {integer}>` to implement `IntoIterator` help: consider removing 2 leading `&`-references | diff --git a/tests/ui/suggestions/suggest-remove-refs-5.stderr b/tests/ui/suggestions/suggest-remove-refs-5.stderr index b132c56473e..ae83012c70e 100644 --- a/tests/ui/suggestions/suggest-remove-refs-5.stderr +++ b/tests/ui/suggestions/suggest-remove-refs-5.stderr @@ -4,7 +4,7 @@ error[E0277]: `&mut &mut &mut &mut Vec<i32>` is not an iterator LL | for _ in &mut &mut v {} | ^^^^^^^^^^^ `&mut &mut &mut &mut Vec<i32>` is not an iterator | - = help: the trait `Iterator` is not implemented for `Vec<i32>`, which is required by `&mut &mut &mut &mut Vec<i32>: IntoIterator` + = help: the trait `Iterator` is not implemented for `Vec<i32>` = note: required for `&mut Vec<i32>` to implement `Iterator` = note: 3 redundant requirements hidden = note: required for `&mut &mut &mut &mut Vec<i32>` to implement `Iterator` @@ -21,7 +21,7 @@ error[E0277]: `&mut &mut &mut [u8; 1]` is not an iterator LL | for _ in &mut v {} | ^^^^^^ `&mut &mut &mut [u8; 1]` is not an iterator | - = help: the trait `Iterator` is not implemented for `[u8; 1]`, which is required by `&mut &mut &mut [u8; 1]: IntoIterator` + = help: the trait `Iterator` is not implemented for `[u8; 1]` = note: required for `&mut [u8; 1]` to implement `Iterator` = note: 2 redundant requirements hidden = note: required for `&mut &mut &mut [u8; 1]` to implement `Iterator` diff --git a/tests/ui/sync/mutexguard-sync.stderr b/tests/ui/sync/mutexguard-sync.stderr index 6b686741d1f..1501a793d5e 100644 --- a/tests/ui/sync/mutexguard-sync.stderr +++ b/tests/ui/sync/mutexguard-sync.stderr @@ -6,7 +6,7 @@ LL | test_sync(guard); | | | required by a bound introduced by this call | - = help: the trait `Sync` is not implemented for `Cell<i32>`, which is required by `MutexGuard<'_, Cell<i32>>: Sync` + = help: the trait `Sync` is not implemented for `Cell<i32>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead = note: required for `MutexGuard<'_, Cell<i32>>` to implement `Sync` note: required by a bound in `test_sync` diff --git a/tests/ui/sync/reentrantlockguard-sync.stderr b/tests/ui/sync/reentrantlockguard-sync.stderr index ed2e3e2f112..6bedf8f9f2e 100644 --- a/tests/ui/sync/reentrantlockguard-sync.stderr +++ b/tests/ui/sync/reentrantlockguard-sync.stderr @@ -6,7 +6,7 @@ LL | test_sync(guard); | | | required by a bound introduced by this call | - = help: the trait `Sync` is not implemented for `Cell<i32>`, which is required by `ReentrantLockGuard<'_, Cell<i32>>: Sync` + = help: the trait `Sync` is not implemented for `Cell<i32>` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` or `std::sync::atomic::AtomicI32` instead = note: required for `ReentrantLockGuard<'_, Cell<i32>>` to implement `Sync` note: required by a bound in `test_sync` diff --git a/tests/ui/auxiliary/using-target-feature-unstable.rs b/tests/ui/target-feature/auxiliary/using-target-feature-unstable.rs index 2682028936c..2682028936c 100644 --- a/tests/ui/auxiliary/using-target-feature-unstable.rs +++ b/tests/ui/target-feature/auxiliary/using-target-feature-unstable.rs diff --git a/tests/ui/target-feature/feature-hierarchy.rs b/tests/ui/target-feature/feature-hierarchy.rs index 4cf9112810c..d62b86693c2 100644 --- a/tests/ui/target-feature/feature-hierarchy.rs +++ b/tests/ui/target-feature/feature-hierarchy.rs @@ -18,9 +18,12 @@ trait Sized {} trait Copy {} impl Copy for bool {} -extern "rust-intrinsic" { - #[rustc_const_stable(feature = "test", since = "1.0.0")] - fn unreachable() -> !; +#[stable(feature = "test", since = "1.0.0")] +#[rustc_const_stable(feature = "test", since = "1.0.0")] +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +const unsafe fn unreachable() -> ! { + loop {} } #[rustc_builtin_macro] diff --git a/tests/ui/target-feature/forbidden-target-feature-attribute.rs b/tests/ui/target-feature/forbidden-target-feature-attribute.rs new file mode 100644 index 00000000000..91c56b43689 --- /dev/null +++ b/tests/ui/target-feature/forbidden-target-feature-attribute.rs @@ -0,0 +1,12 @@ +//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib +//@ needs-llvm-components: x86 +#![feature(no_core, lang_items)] +#![no_std] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} + +#[target_feature(enable = "soft-float")] +//~^ERROR: cannot be toggled with +pub unsafe fn my_fun() {} diff --git a/tests/ui/target-feature/forbidden-target-feature-attribute.stderr b/tests/ui/target-feature/forbidden-target-feature-attribute.stderr new file mode 100644 index 00000000000..fb318531f7e --- /dev/null +++ b/tests/ui/target-feature/forbidden-target-feature-attribute.stderr @@ -0,0 +1,8 @@ +error: target feature `soft-float` cannot be toggled with `#[target_feature]`: unsound because it changes float ABI + --> $DIR/forbidden-target-feature-attribute.rs:10:18 + | +LL | #[target_feature(enable = "soft-float")] + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/target-feature/forbidden-target-feature-cfg.rs b/tests/ui/target-feature/forbidden-target-feature-cfg.rs new file mode 100644 index 00000000000..5df26e26793 --- /dev/null +++ b/tests/ui/target-feature/forbidden-target-feature-cfg.rs @@ -0,0 +1,15 @@ +//@ compile-flags: --target=x86_64-unknown-none --crate-type=lib +//@ needs-llvm-components: x86 +//@ check-pass +#![feature(no_core, lang_items)] +#![no_std] +#![no_core] +#![allow(unexpected_cfgs)] + +#[lang = "sized"] +pub trait Sized {} + +// The compile_error macro does not exist, so if the `cfg` evaluates to `true` this +// complains about the missing macro rather than showing the error... but that's good enough. +#[cfg(target_feature = "soft-float")] +compile_error!("the soft-float feature should not be exposed in `cfg`"); diff --git a/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs b/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs new file mode 100644 index 00000000000..b27e8a10afe --- /dev/null +++ b/tests/ui/target-feature/forbidden-target-feature-flag-disable.rs @@ -0,0 +1,11 @@ +//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib +//@ needs-llvm-components: x86 +//@ compile-flags: -Ctarget-feature=-soft-float +// For now this is just a warning. +//@ build-pass +#![feature(no_core, lang_items)] +#![no_std] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} diff --git a/tests/ui/target-feature/forbidden-target-feature-flag-disable.stderr b/tests/ui/target-feature/forbidden-target-feature-flag-disable.stderr new file mode 100644 index 00000000000..508e1fe0cf4 --- /dev/null +++ b/tests/ui/target-feature/forbidden-target-feature-flag-disable.stderr @@ -0,0 +1,7 @@ +warning: target feature `soft-float` cannot be toggled with `-Ctarget-feature`: unsound because it changes float ABI + | + = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344> + +warning: 1 warning emitted + diff --git a/tests/ui/target-feature/forbidden-target-feature-flag.rs b/tests/ui/target-feature/forbidden-target-feature-flag.rs new file mode 100644 index 00000000000..93cebc6b536 --- /dev/null +++ b/tests/ui/target-feature/forbidden-target-feature-flag.rs @@ -0,0 +1,11 @@ +//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib +//@ needs-llvm-components: x86 +//@ compile-flags: -Ctarget-feature=+soft-float +// For now this is just a warning. +//@ build-pass +#![feature(no_core, lang_items)] +#![no_std] +#![no_core] + +#[lang = "sized"] +pub trait Sized {} diff --git a/tests/ui/target-feature/forbidden-target-feature-flag.stderr b/tests/ui/target-feature/forbidden-target-feature-flag.stderr new file mode 100644 index 00000000000..508e1fe0cf4 --- /dev/null +++ b/tests/ui/target-feature/forbidden-target-feature-flag.stderr @@ -0,0 +1,7 @@ +warning: target feature `soft-float` cannot be toggled with `-Ctarget-feature`: unsound because it changes float ABI + | + = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344> + +warning: 1 warning emitted + diff --git a/tests/ui/target-feature/gate.rs b/tests/ui/target-feature/gate.rs index 5c4fb847932..f35fbd11155 100644 --- a/tests/ui/target-feature/gate.rs +++ b/tests/ui/target-feature/gate.rs @@ -23,6 +23,7 @@ // gate-test-lahfsahf_target_feature // gate-test-prfchw_target_feature // gate-test-s390x_target_feature +// gate-test-sparc_target_feature #[target_feature(enable = "avx512bw")] //~^ ERROR: currently unstable diff --git a/tests/ui/target-feature/gate.stderr b/tests/ui/target-feature/gate.stderr index 37c5ed01688..b84bab370be 100644 --- a/tests/ui/target-feature/gate.stderr +++ b/tests/ui/target-feature/gate.stderr @@ -1,5 +1,5 @@ error[E0658]: the target feature `avx512bw` is currently unstable - --> $DIR/gate.rs:27:18 + --> $DIR/gate.rs:28:18 | LL | #[target_feature(enable = "avx512bw")] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/target-feature/no-llvm-leaks.rs b/tests/ui/target-feature/no-llvm-leaks.rs index 9f5dec4447f..10268686405 100644 --- a/tests/ui/target-feature/no-llvm-leaks.rs +++ b/tests/ui/target-feature/no-llvm-leaks.rs @@ -16,9 +16,12 @@ trait Sized {} trait Copy {} impl Copy for bool {} -extern "rust-intrinsic" { - #[rustc_const_stable(feature = "test", since = "1.0.0")] - fn unreachable() -> !; +#[stable(feature = "test", since = "1.0.0")] +#[rustc_const_stable(feature = "test", since = "1.0.0")] +#[rustc_intrinsic] +#[rustc_intrinsic_must_be_overridden] +const unsafe fn unreachable() -> ! { + loop {} } #[rustc_builtin_macro] diff --git a/tests/ui/using-target-feature-unstable.rs b/tests/ui/target-feature/using-target-feature-unstable.rs index 5ec0bda5eef..5ec0bda5eef 100644 --- a/tests/ui/using-target-feature-unstable.rs +++ b/tests/ui/target-feature/using-target-feature-unstable.rs diff --git a/tests/ui/target-feature/wasm-disable-simd.rs b/tests/ui/target-feature/wasm-disable-simd.rs new file mode 100644 index 00000000000..998c8674823 --- /dev/null +++ b/tests/ui/target-feature/wasm-disable-simd.rs @@ -0,0 +1,12 @@ +//@ only-wasm32-wasip1 +//@ compile-flags: -Ctarget-feature=-simd128 --crate-type=lib +//@ build-pass + +// This is a regression test of #131031. + +use std::arch::wasm32::*; + +#[target_feature(enable = "simd128")] +pub unsafe fn some_simd128_fn(chunk: v128) -> bool { + u8x16_all_true(chunk) +} diff --git a/tests/ui/thir-print/thir-tree-match.stdout b/tests/ui/thir-print/thir-tree-match.stdout index b2431698cc6..8cff7887661 100644 --- a/tests/ui/thir-print/thir-tree-match.stdout +++ b/tests/ui/thir-print/thir-tree-match.stdout @@ -41,7 +41,7 @@ body: Block { targeted_by_break: false span: $DIR/thir-tree-match.rs:15:32: 21:2 (#0) - region_scope: Node(25) + region_scope: Node(3) safety_mode: Safe stmts: [] expr: @@ -51,8 +51,8 @@ body: span: $DIR/thir-tree-match.rs:16:5: 20:6 (#0) kind: Scope { - region_scope: Node(3) - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).3)) + region_scope: Node(4) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).4)) value: Expr { ty: bool @@ -67,8 +67,8 @@ body: span: $DIR/thir-tree-match.rs:16:11: 16:14 (#0) kind: Scope { - region_scope: Node(4) - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).4)) + region_scope: Node(5) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).5)) value: Expr { ty: Foo @@ -123,16 +123,16 @@ body: body: Expr { ty: bool - temp_lifetime: Some(Node(12)) + temp_lifetime: Some(Node(13)) span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0) kind: Scope { - region_scope: Node(13) - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).13)) + region_scope: Node(14) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).14)) value: Expr { ty: bool - temp_lifetime: Some(Node(12)) + temp_lifetime: Some(Node(13)) span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0) kind: Literal( lit: Spanned { node: Bool(true), span: $DIR/thir-tree-match.rs:17:36: 17:40 (#0) }, neg: false) @@ -140,8 +140,8 @@ body: } } } - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).12)) - scope: Node(12) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).13)) + scope: Node(13) span: $DIR/thir-tree-match.rs:17:9: 17:40 (#0) } Arm { @@ -175,16 +175,16 @@ body: body: Expr { ty: bool - temp_lifetime: Some(Node(18)) + temp_lifetime: Some(Node(19)) span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0) kind: Scope { - region_scope: Node(19) - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).19)) + region_scope: Node(20) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).20)) value: Expr { ty: bool - temp_lifetime: Some(Node(18)) + temp_lifetime: Some(Node(19)) span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0) kind: Literal( lit: Spanned { node: Bool(false), span: $DIR/thir-tree-match.rs:18:27: 18:32 (#0) }, neg: false) @@ -192,8 +192,8 @@ body: } } } - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).18)) - scope: Node(18) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).19)) + scope: Node(19) span: $DIR/thir-tree-match.rs:18:9: 18:32 (#0) } Arm { @@ -219,16 +219,16 @@ body: body: Expr { ty: bool - temp_lifetime: Some(Node(23)) + temp_lifetime: Some(Node(24)) span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0) kind: Scope { - region_scope: Node(24) - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).24)) + region_scope: Node(25) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).25)) value: Expr { ty: bool - temp_lifetime: Some(Node(23)) + temp_lifetime: Some(Node(24)) span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0) kind: Literal( lit: Spanned { node: Bool(true), span: $DIR/thir-tree-match.rs:19:24: 19:28 (#0) }, neg: false) @@ -236,8 +236,8 @@ body: } } } - lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).23)) - scope: Node(23) + lint_level: Explicit(HirId(DefId(0:16 ~ thir_tree_match[fcf8]::has_match).24)) + scope: Node(24) span: $DIR/thir-tree-match.rs:19:9: 19:28 (#0) } ] diff --git a/tests/ui/trait-bounds/maybe-bound-generics-deny.rs b/tests/ui/trait-bounds/maybe-bound-generics-deny.rs new file mode 100644 index 00000000000..dfa8e9886b6 --- /dev/null +++ b/tests/ui/trait-bounds/maybe-bound-generics-deny.rs @@ -0,0 +1,4 @@ +fn uwu<T: ?Sized<i32>>() {} +//~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied + +fn main() {} diff --git a/tests/ui/trait-bounds/maybe-bound-generics-deny.stderr b/tests/ui/trait-bounds/maybe-bound-generics-deny.stderr new file mode 100644 index 00000000000..3297eb6279f --- /dev/null +++ b/tests/ui/trait-bounds/maybe-bound-generics-deny.stderr @@ -0,0 +1,11 @@ +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/maybe-bound-generics-deny.rs:1:12 + | +LL | fn uwu<T: ?Sized<i32>>() {} + | ^^^^^----- help: remove the unnecessary generics + | | + | expected 0 generic arguments + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0107`. diff --git a/tests/ui/trait-bounds/maybe-bound-has-path-args.rs b/tests/ui/trait-bounds/maybe-bound-has-path-args.rs new file mode 100644 index 00000000000..2cb63f25d06 --- /dev/null +++ b/tests/ui/trait-bounds/maybe-bound-has-path-args.rs @@ -0,0 +1,7 @@ +trait Trait {} + +fn test<T: ?self::<i32>::Trait>() {} +//~^ ERROR type arguments are not allowed on this type +//~| WARN relaxing a default bound only does something for `?Sized` + +fn main() {} diff --git a/tests/ui/trait-bounds/maybe-bound-has-path-args.stderr b/tests/ui/trait-bounds/maybe-bound-has-path-args.stderr new file mode 100644 index 00000000000..701e493f5a5 --- /dev/null +++ b/tests/ui/trait-bounds/maybe-bound-has-path-args.stderr @@ -0,0 +1,17 @@ +warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/maybe-bound-has-path-args.rs:3:12 + | +LL | fn test<T: ?self::<i32>::Trait>() {} + | ^^^^^^^^^^^^^^^^^^^ + +error[E0109]: type arguments are not allowed on this type + --> $DIR/maybe-bound-has-path-args.rs:3:20 + | +LL | fn test<T: ?self::<i32>::Trait>() {} + | ---- ^^^ type argument not allowed + | | + | not allowed on this type + +error: aborting due to 1 previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0109`. diff --git a/tests/ui/trait-bounds/maybe-bound-with-assoc.rs b/tests/ui/trait-bounds/maybe-bound-with-assoc.rs new file mode 100644 index 00000000000..b6b2551e463 --- /dev/null +++ b/tests/ui/trait-bounds/maybe-bound-with-assoc.rs @@ -0,0 +1,12 @@ +trait HasAssoc { + type Assoc; +} +fn hasassoc<T: ?HasAssoc<Assoc = ()>>() {} +//~^ WARN relaxing a default bound + +trait NoAssoc {} +fn noassoc<T: ?NoAssoc<Missing = ()>>() {} +//~^ WARN relaxing a default bound +//~| ERROR associated type `Missing` not found for `NoAssoc` + +fn main() {} diff --git a/tests/ui/trait-bounds/maybe-bound-with-assoc.stderr b/tests/ui/trait-bounds/maybe-bound-with-assoc.stderr new file mode 100644 index 00000000000..91d78e59cd5 --- /dev/null +++ b/tests/ui/trait-bounds/maybe-bound-with-assoc.stderr @@ -0,0 +1,21 @@ +warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/maybe-bound-with-assoc.rs:4:16 + | +LL | fn hasassoc<T: ?HasAssoc<Assoc = ()>>() {} + | ^^^^^^^^^^^^^^^^^^^^^ + +warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default + --> $DIR/maybe-bound-with-assoc.rs:8:15 + | +LL | fn noassoc<T: ?NoAssoc<Missing = ()>>() {} + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0220]: associated type `Missing` not found for `NoAssoc` + --> $DIR/maybe-bound-with-assoc.rs:8:24 + | +LL | fn noassoc<T: ?NoAssoc<Missing = ()>>() {} + | ^^^^^^^ associated type `Missing` not found + +error: aborting due to 1 previous error; 2 warnings emitted + +For more information about this error, try `rustc --explain E0220`. diff --git a/tests/ui/trait-bounds/super-assoc-mismatch.stderr b/tests/ui/trait-bounds/super-assoc-mismatch.stderr index f2c5eb47e59..780535283a3 100644 --- a/tests/ui/trait-bounds/super-assoc-mismatch.stderr +++ b/tests/ui/trait-bounds/super-assoc-mismatch.stderr @@ -53,7 +53,7 @@ error[E0277]: the trait bound `(): Sub` is not satisfied --> $DIR/super-assoc-mismatch.rs:29:21 | LL | type Assoc<T> = (); - | ^^ the trait `Sub` is not implemented for `()`, which is required by `<u8 as BoundOnGat>::Assoc<u8>: Sub` + | ^^ the trait `Sub` is not implemented for `()` | help: this trait has no implementations, consider adding one --> $DIR/super-assoc-mismatch.rs:7:1 @@ -87,7 +87,7 @@ error[E0277]: the trait bound `(): SubGeneric<u16>` is not satisfied --> $DIR/super-assoc-mismatch.rs:55:22 | LL | type Assoc1<T> = (); - | ^^ the trait `SubGeneric<u16>` is not implemented for `()`, which is required by `<u8 as MultiAssoc>::Assoc1<()>: SubGeneric<<u8 as MultiAssoc>::Assoc2>` + | ^^ the trait `SubGeneric<u16>` is not implemented for `()` | help: this trait has no implementations, consider adding one --> $DIR/super-assoc-mismatch.rs:43:1 diff --git a/tests/ui/traits/alias/cross-crate.stderr b/tests/ui/traits/alias/cross-crate.stderr index 52eb7e44f44..8ed05b4758d 100644 --- a/tests/ui/traits/alias/cross-crate.stderr +++ b/tests/ui/traits/alias/cross-crate.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Rc<u32>: SendSync` is not satisfied --> $DIR/cross-crate.rs:14:17 | LL | use_alias::<Rc<u32>>(); - | ^^^^^^^ the trait `Send` is not implemented for `Rc<u32>`, which is required by `Rc<u32>: SendSync` + | ^^^^^^^ the trait `Send` is not implemented for `Rc<u32>` | = note: required for `Rc<u32>` to implement `SendSync` note: required by a bound in `use_alias` @@ -15,7 +15,7 @@ error[E0277]: the trait bound `Rc<u32>: SendSync` is not satisfied --> $DIR/cross-crate.rs:14:17 | LL | use_alias::<Rc<u32>>(); - | ^^^^^^^ the trait `Sync` is not implemented for `Rc<u32>`, which is required by `Rc<u32>: SendSync` + | ^^^^^^^ the trait `Sync` is not implemented for `Rc<u32>` | = note: required for `Rc<u32>` to implement `SendSync` note: required by a bound in `use_alias` diff --git a/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.stderr b/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.stderr index c73c2f68032..27e23adb92a 100644 --- a/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.stderr +++ b/tests/ui/traits/alias/issue-108072-unmet-trait-alias-bound.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `(): IteratorAlias` is not satisfied --> $DIR/issue-108072-unmet-trait-alias-bound.rs:10:7 | LL | f(()) - | - ^^ the trait `Iterator` is not implemented for `()`, which is required by `(): IteratorAlias` + | - ^^ the trait `Iterator` is not implemented for `()` | | | required by a bound introduced by this call | diff --git a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs index dc2de5bb715..667d283bea3 100644 --- a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs +++ b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.rs @@ -2,7 +2,7 @@ fn strip_lf(s: &str) -> &str { s.strip_suffix(b'\n').unwrap_or(s) //~^ ERROR the trait bound `u8: Pattern` is not satisfied //~| NOTE required by a bound introduced by this call - //~| NOTE the trait `FnMut(char)` is not implemented for `u8`, which is required by `u8: Pattern` + //~| NOTE the trait `FnMut(char)` is not implemented for `u8` //~| HELP the following other types implement trait `Pattern`: //~| NOTE required for `u8` to implement `Pattern` //~| NOTE required by a bound in `core::str::<impl str>::strip_suffix` diff --git a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr index 8351d15fdf3..1cd62d2cbdb 100644 --- a/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr +++ b/tests/ui/traits/bound/assoc-fn-bound-root-obligation.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `u8: Pattern` is not satisfied --> $DIR/assoc-fn-bound-root-obligation.rs:2:20 | LL | s.strip_suffix(b'\n').unwrap_or(s) - | ------------ ^^^^^ the trait `FnMut(char)` is not implemented for `u8`, which is required by `u8: Pattern` + | ------------ ^^^^^ the trait `FnMut(char)` is not implemented for `u8` | | | required by a bound introduced by this call | diff --git a/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs b/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs new file mode 100644 index 00000000000..48a98efea5e --- /dev/null +++ b/tests/ui/traits/bound/unknown-assoc-with-const-arg.rs @@ -0,0 +1,20 @@ +// issue#132534 + +trait X { + fn a<T>() -> T::unknown<{}> {} + //~^ ERROR: associated type `unknown` not found for `T` + //~| ERROR: associated type `unknown` not found for `T` +} + +trait Y { + fn a() -> NOT_EXIST::unknown<{}> {} + //~^ ERROR: failed to resolve: use of undeclared type `NOT_EXIST` +} + +trait Z<T> { + fn a() -> T::unknown<{}> {} + //~^ ERROR: associated type `unknown` not found for `T` + //~| ERROR: associated type `unknown` not found for `T` +} + +fn main() {} diff --git a/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr b/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr new file mode 100644 index 00000000000..9598c373e6e --- /dev/null +++ b/tests/ui/traits/bound/unknown-assoc-with-const-arg.stderr @@ -0,0 +1,38 @@ +error[E0220]: associated type `unknown` not found for `T` + --> $DIR/unknown-assoc-with-const-arg.rs:4:21 + | +LL | fn a<T>() -> T::unknown<{}> {} + | ^^^^^^^ associated type `unknown` not found + +error[E0220]: associated type `unknown` not found for `T` + --> $DIR/unknown-assoc-with-const-arg.rs:15:18 + | +LL | fn a() -> T::unknown<{}> {} + | ^^^^^^^ associated type `unknown` not found + +error[E0220]: associated type `unknown` not found for `T` + --> $DIR/unknown-assoc-with-const-arg.rs:4:21 + | +LL | fn a<T>() -> T::unknown<{}> {} + | ^^^^^^^ associated type `unknown` not found + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0220]: associated type `unknown` not found for `T` + --> $DIR/unknown-assoc-with-const-arg.rs:15:18 + | +LL | fn a() -> T::unknown<{}> {} + | ^^^^^^^ associated type `unknown` not found + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0433]: failed to resolve: use of undeclared type `NOT_EXIST` + --> $DIR/unknown-assoc-with-const-arg.rs:10:15 + | +LL | fn a() -> NOT_EXIST::unknown<{}> {} + | ^^^^^^^^^ use of undeclared type `NOT_EXIST` + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0220, E0433. +For more information about an error, try `rustc --explain E0220`. diff --git a/tests/ui/traits/coercion-generic-bad.stderr b/tests/ui/traits/coercion-generic-bad.stderr index 26136c6f72c..c0553ea62c5 100644 --- a/tests/ui/traits/coercion-generic-bad.stderr +++ b/tests/ui/traits/coercion-generic-bad.stderr @@ -4,7 +4,8 @@ error[E0277]: the trait bound `Struct: Trait<isize>` is not satisfied LL | let s: Box<dyn Trait<isize>> = Box::new(Struct { person: "Fred" }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<isize>` is not implemented for `Struct` | - = help: the trait `Trait<&'static str>` is implemented for `Struct` + = help: the trait `Trait<isize>` is not implemented for `Struct` + but trait `Trait<&'static str>` is implemented for it = help: for that trait implementation, expected `&'static str`, found `isize` = note: required for the cast from `Box<Struct>` to `Box<dyn Trait<isize>>` diff --git a/tests/ui/traits/const-traits/assoc-type-const-bound-usage-0.rs b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-0.rs index 5a54e8eec91..bac7ee023f4 100644 --- a/tests/ui/traits/const-traits/assoc-type-const-bound-usage-0.rs +++ b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-0.rs @@ -1,8 +1,7 @@ //@ compile-flags: -Znext-solver -//@ known-bug: unknown +//@ check-pass -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Trait { diff --git a/tests/ui/traits/const-traits/assoc-type-const-bound-usage-0.stderr b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-0.stderr deleted file mode 100644 index 35069a5a52f..00000000000 --- a/tests/ui/traits/const-traits/assoc-type-const-bound-usage-0.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0271]: type mismatch resolving `<T as Trait>::Assoc == T` - --> $DIR/assoc-type-const-bound-usage-0.rs:14:5 - | -LL | T::Assoc::func() - | ^^^^^^^^^^^^^^^^ types differ - -error[E0271]: type mismatch resolving `<T as Trait>::Assoc == T` - --> $DIR/assoc-type-const-bound-usage-0.rs:18:5 - | -LL | <T as Trait>::Assoc::func() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/const-traits/assoc-type-const-bound-usage-1.rs b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-1.rs index 04ad94556c3..a0375cda079 100644 --- a/tests/ui/traits/const-traits/assoc-type-const-bound-usage-1.rs +++ b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-1.rs @@ -1,7 +1,7 @@ //@ compile-flags: -Znext-solver //@ known-bug: unknown -#![feature(const_trait_impl, effects, generic_const_exprs)] +#![feature(const_trait_impl, generic_const_exprs)] #![allow(incomplete_features)] #[const_trait] diff --git a/tests/ui/traits/const-traits/assoc-type-const-bound-usage-1.stderr b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-1.stderr index ed9182c7334..8d1c85c0c8a 100644 --- a/tests/ui/traits/const-traits/assoc-type-const-bound-usage-1.stderr +++ b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-1.stderr @@ -1,23 +1,35 @@ error: `-Znext-solver=globally` and `generic_const_exprs` are incompatible, using them at the same time is not allowed - --> $DIR/assoc-type-const-bound-usage-1.rs:4:39 + --> $DIR/assoc-type-const-bound-usage-1.rs:4:30 | -LL | #![feature(const_trait_impl, effects, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ +LL | #![feature(const_trait_impl, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ | = help: remove one of these features -error[E0271]: type mismatch resolving `<T as Trait>::Assoc == T` - --> $DIR/assoc-type-const-bound-usage-1.rs:15:44 +error[E0284]: type annotations needed: cannot normalize `unqualified<T>::{constant#0}` + --> $DIR/assoc-type-const-bound-usage-1.rs:15:37 | LL | fn unqualified<T: const Trait>() -> Type<{ T::Assoc::func() }> { - | ^^^^^^^^^^^^^^^^ types differ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `unqualified<T>::{constant#0}` -error[E0271]: type mismatch resolving `<T as Trait>::Assoc == T` - --> $DIR/assoc-type-const-bound-usage-1.rs:19:42 +error[E0284]: type annotations needed: cannot normalize `qualified<T>::{constant#0}` + --> $DIR/assoc-type-const-bound-usage-1.rs:19:35 | LL | fn qualified<T: const Trait>() -> Type<{ <T as Trait>::Assoc::func() }> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot normalize `qualified<T>::{constant#0}` -error: aborting due to 3 previous errors +error[E0284]: type annotations needed: cannot normalize `unqualified<T>::{constant#0}` + --> $DIR/assoc-type-const-bound-usage-1.rs:16:5 + | +LL | Type + | ^^^^ cannot normalize `unqualified<T>::{constant#0}` + +error[E0284]: type annotations needed: cannot normalize `qualified<T>::{constant#0}` + --> $DIR/assoc-type-const-bound-usage-1.rs:20:5 + | +LL | Type + | ^^^^ cannot normalize `qualified<T>::{constant#0}` + +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0271`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/traits/const-traits/assoc-type-const-bound-usage-fail-2.rs b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-fail-2.rs new file mode 100644 index 00000000000..b3a636b0f71 --- /dev/null +++ b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-fail-2.rs @@ -0,0 +1,34 @@ +//@ compile-flags: -Znext-solver + +// Check that `~const` item bounds only hold if the where clauses on the +// associated type are also const. +// i.e. check that we validate the const conditions for the associated type +// when considering one of implied const bounds. + +#![feature(const_trait_impl)] + +#[const_trait] +trait Trait { + type Assoc<U>: ~const Trait + where + U: ~const Other; + + fn func(); +} + +#[const_trait] +trait Other {} + +const fn fails<T: ~const Trait, U: Other>() { + T::Assoc::<U>::func(); + //~^ ERROR the trait bound `<T as Trait>::Assoc<U>: ~const Trait` is not satisfied + <T as Trait>::Assoc::<U>::func(); + //~^ ERROR the trait bound `<T as Trait>::Assoc<U>: ~const Trait` is not satisfied +} + +const fn works<T: ~const Trait, U: ~const Other>() { + T::Assoc::<U>::func(); + <T as Trait>::Assoc::<U>::func(); +} + +fn main() {} diff --git a/tests/ui/traits/const-traits/assoc-type-const-bound-usage-fail-2.stderr b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-fail-2.stderr new file mode 100644 index 00000000000..86bd07a5f59 --- /dev/null +++ b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-fail-2.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `<T as Trait>::Assoc<U>: ~const Trait` is not satisfied + --> $DIR/assoc-type-const-bound-usage-fail-2.rs:23:5 + | +LL | T::Assoc::<U>::func(); + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0277]: the trait bound `<T as Trait>::Assoc<U>: ~const Trait` is not satisfied + --> $DIR/assoc-type-const-bound-usage-fail-2.rs:25:5 + | +LL | <T as Trait>::Assoc::<U>::func(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/assoc-type-const-bound-usage-fail.rs b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-fail.rs new file mode 100644 index 00000000000..ce01086f0dc --- /dev/null +++ b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-fail.rs @@ -0,0 +1,27 @@ +//@ compile-flags: -Znext-solver + +// Check that `~const` item bounds only hold if the parent trait is `~const`. +// i.e. check that we validate the const conditions for the associated type +// when considering one of implied const bounds. + +#![feature(const_trait_impl)] + +#[const_trait] +trait Trait { + type Assoc: ~const Trait; + fn func(); +} + +const fn unqualified<T: Trait>() { + T::Assoc::func(); + //~^ ERROR the trait bound `T: ~const Trait` is not satisfied + <T as Trait>::Assoc::func(); + //~^ ERROR the trait bound `T: ~const Trait` is not satisfied +} + +const fn works<T: ~const Trait>() { + T::Assoc::func(); + <T as Trait>::Assoc::func(); +} + +fn main() {} diff --git a/tests/ui/traits/const-traits/assoc-type-const-bound-usage-fail.stderr b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-fail.stderr new file mode 100644 index 00000000000..145fe2c41dd --- /dev/null +++ b/tests/ui/traits/const-traits/assoc-type-const-bound-usage-fail.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `T: ~const Trait` is not satisfied + --> $DIR/assoc-type-const-bound-usage-fail.rs:16:5 + | +LL | T::Assoc::func(); + | ^^^^^^^^^^^^^^^^ + +error[E0277]: the trait bound `T: ~const Trait` is not satisfied + --> $DIR/assoc-type-const-bound-usage-fail.rs:18:5 + | +LL | <T as Trait>::Assoc::func(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/assoc-type.rs b/tests/ui/traits/const-traits/assoc-type.rs index a9394d90ed8..32c91fa51f1 100644 --- a/tests/ui/traits/const-traits/assoc-type.rs +++ b/tests/ui/traits/const-traits/assoc-type.rs @@ -1,6 +1,6 @@ //@ compile-flags: -Znext-solver -#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] #[const_trait] trait Add<Rhs = Self> { diff --git a/tests/ui/traits/const-traits/assoc-type.stderr b/tests/ui/traits/const-traits/assoc-type.stderr index 5c77754200a..b318675b612 100644 --- a/tests/ui/traits/const-traits/assoc-type.stderr +++ b/tests/ui/traits/const-traits/assoc-type.stderr @@ -1,12 +1,3 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/assoc-type.rs:3:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: the trait bound `NonConstAdd: ~const Add` is not satisfied --> $DIR/assoc-type.rs:36:16 | @@ -17,8 +8,8 @@ note: required by a bound in `Foo::Bar` --> $DIR/assoc-type.rs:32:15 | LL | type Bar: ~const Add; - | ^^^^^^^^^^ required by this bound in `Foo::Bar` + | ^^^^^^ required by this bound in `Foo::Bar` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/auxiliary/cross-crate.rs b/tests/ui/traits/const-traits/auxiliary/cross-crate.rs index 8f63cd1d521..01921c140cb 100644 --- a/tests/ui/traits/const-traits/auxiliary/cross-crate.rs +++ b/tests/ui/traits/const-traits/auxiliary/cross-crate.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] pub trait MyTrait { diff --git a/tests/ui/traits/const-traits/auxiliary/staged-api.rs b/tests/ui/traits/const-traits/auxiliary/staged-api.rs index 986165ef91e..abe22db702c 100644 --- a/tests/ui/traits/const-traits/auxiliary/staged-api.rs +++ b/tests/ui/traits/const-traits/auxiliary/staged-api.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #![feature(staged_api)] #![stable(feature = "rust1", since = "1.0.0")] @@ -19,3 +18,12 @@ pub struct Unstable; impl const MyTrait for Unstable { fn func() {} } + +#[stable(feature = "rust1", since = "1.0.0")] +pub struct Unstable2; + +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_const_unstable(feature = "unstable2", issue = "none")] +impl const MyTrait for Unstable2 { + fn func() {} +} diff --git a/tests/ui/traits/const-traits/call-const-closure.rs b/tests/ui/traits/const-traits/call-const-closure.rs index cbf3e6c3ac4..21f4374b8d5 100644 --- a/tests/ui/traits/const-traits/call-const-closure.rs +++ b/tests/ui/traits/const-traits/call-const-closure.rs @@ -1,7 +1,7 @@ //@ compile-flags: -Znext-solver //@ edition:2021 -#![feature(const_trait_impl, effects, const_closures)] +#![feature(const_trait_impl, const_closures)] #![allow(incomplete_features)] #[const_trait] @@ -16,7 +16,7 @@ impl Bar for () { const FOO: () = { (const || ().foo())(); //~^ ERROR the trait bound `(): ~const Bar` is not satisfied - // FIXME(effects): The constness environment for const closures is wrong. + // FIXME(const_trait_impl): The constness environment for const closures is wrong. }; fn main() {} diff --git a/tests/ui/traits/const-traits/call-const-in-tilde-const.rs b/tests/ui/traits/const-traits/call-const-in-tilde-const.rs index 970ee93fd49..b6d1517499d 100644 --- a/tests/ui/traits/const-traits/call-const-in-tilde-const.rs +++ b/tests/ui/traits/const-traits/call-const-in-tilde-const.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![feature(const_trait_impl, effects)] -//~^ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] #[const_trait] trait Foo { fn foo(); diff --git a/tests/ui/traits/const-traits/call-const-in-tilde-const.stderr b/tests/ui/traits/const-traits/call-const-in-tilde-const.stderr index 49c310f1f75..e56968b9097 100644 --- a/tests/ui/traits/const-traits/call-const-in-tilde-const.stderr +++ b/tests/ui/traits/const-traits/call-const-in-tilde-const.stderr @@ -1,18 +1,9 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/call-const-in-tilde-const.rs:2:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: the trait bound `T: const Foo` is not satisfied - --> $DIR/call-const-in-tilde-const.rs:10:13 + --> $DIR/call-const-in-tilde-const.rs:9:13 | LL | const { T::foo() } | ^^^^^^^^ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/call-const-trait-method-fail.rs b/tests/ui/traits/const-traits/call-const-trait-method-fail.rs index 878f9a713a0..e06d04db804 100644 --- a/tests/ui/traits/const-traits/call-const-trait-method-fail.rs +++ b/tests/ui/traits/const-traits/call-const-trait-method-fail.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] pub trait Plus { diff --git a/tests/ui/traits/const-traits/call-const-trait-method-fail.stderr b/tests/ui/traits/const-traits/call-const-trait-method-fail.stderr index 40a06af85ed..b461fd9e39e 100644 --- a/tests/ui/traits/const-traits/call-const-trait-method-fail.stderr +++ b/tests/ui/traits/const-traits/call-const-trait-method-fail.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `u32: ~const Plus` is not satisfied - --> $DIR/call-const-trait-method-fail.rs:27:5 + --> $DIR/call-const-trait-method-fail.rs:26:5 | LL | a.plus(b) | ^^^^^^^^^ diff --git a/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr b/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr index c1cead54216..9ae1ed18e35 100644 --- a/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr +++ b/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr @@ -23,22 +23,6 @@ LL | const ADD_INT: Int = Int(1i32) + Int(2i32); | ^^^^^^^^^^^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error[E0015]: cannot call non-const fn `<i32 as Plus>::plus` in constant functions - --> $DIR/call-const-trait-method-pass.rs:11:20 - | -LL | Int(self.0.plus(rhs.0)) - | ^^^^^^^^^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error[E0015]: cannot call non-const fn `<Int as PartialEq>::eq` in constant functions --> $DIR/call-const-trait-method-pass.rs:20:15 @@ -47,23 +31,7 @@ LL | !self.eq(other) | ^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error[E0015]: cannot call non-const fn `<i32 as Plus>::plus` in constant functions - --> $DIR/call-const-trait-method-pass.rs:36:7 - | -LL | a.plus(b) - | ^^^^^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/call-generic-in-impl.rs b/tests/ui/traits/const-traits/call-generic-in-impl.rs index 6b3a4ae1b95..6149dc3d126 100644 --- a/tests/ui/traits/const-traits/call-generic-in-impl.rs +++ b/tests/ui/traits/const-traits/call-generic-in-impl.rs @@ -1,5 +1,5 @@ //@ known-bug: #110395 -// FIXME(effects) check-pass +// FIXME(const_trait_impl) check-pass #![feature(const_trait_impl)] #[const_trait] diff --git a/tests/ui/traits/const-traits/call-generic-in-impl.stderr b/tests/ui/traits/const-traits/call-generic-in-impl.stderr index 368c22675e7..52ee04425b2 100644 --- a/tests/ui/traits/const-traits/call-generic-in-impl.stderr +++ b/tests/ui/traits/const-traits/call-generic-in-impl.stderr @@ -1,14 +1,14 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/call-generic-in-impl.rs:10:16 + --> $DIR/call-generic-in-impl.rs:10:9 | LL | impl<T: ~const PartialEq> const MyPartialEq for T { - | ^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/call-generic-in-impl.rs:10:16 + --> $DIR/call-generic-in-impl.rs:10:9 | LL | impl<T: ~const PartialEq> const MyPartialEq for T { - | ^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` @@ -19,10 +19,6 @@ LL | PartialEq::eq(self, other) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/call-generic-method-chain.rs b/tests/ui/traits/const-traits/call-generic-method-chain.rs index e5baedae818..74beab71208 100644 --- a/tests/ui/traits/const-traits/call-generic-method-chain.rs +++ b/tests/ui/traits/const-traits/call-generic-method-chain.rs @@ -2,9 +2,9 @@ //@ known-bug: #110395 //@ compile-flags: -Znext-solver -// FIXME(effects) check-pass +// FIXME(const_trait_impl) check-pass -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] struct S; diff --git a/tests/ui/traits/const-traits/call-generic-method-chain.stderr b/tests/ui/traits/const-traits/call-generic-method-chain.stderr index 62eed0f14f9..9a53c61d019 100644 --- a/tests/ui/traits/const-traits/call-generic-method-chain.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-chain.stderr @@ -1,12 +1,3 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/call-generic-method-chain.rs:7:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]` --> $DIR/call-generic-method-chain.rs:11:12 | @@ -17,32 +8,53 @@ LL | impl const PartialEq for S { = note: adding a non-const method body in the future would be a breaking change error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/call-generic-method-chain.rs:20:32 + --> $DIR/call-generic-method-chain.rs:20:25 | LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/call-generic-method-chain.rs:20:32 + --> $DIR/call-generic-method-chain.rs:20:25 | LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/call-generic-method-chain.rs:24:40 + --> $DIR/call-generic-method-chain.rs:24:33 | LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/call-generic-method-chain.rs:24:40 + --> $DIR/call-generic-method-chain.rs:24:33 | LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 5 previous errors; 1 warning emitted +error[E0015]: cannot call non-const operator in constant functions + --> $DIR/call-generic-method-chain.rs:21:5 + | +LL | *t == *t + | ^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants +help: consider further restricting this bound + | +LL | const fn equals_self<T: ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool { + | ++++++++++++++++++++++++++++ + +error[E0015]: cannot call non-const fn `<S as PartialEq>::eq` in constant functions + --> $DIR/call-generic-method-chain.rs:16:15 + | +LL | !self.eq(other) + | ^^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 7 previous errors +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/call-generic-method-dup-bound.rs b/tests/ui/traits/const-traits/call-generic-method-dup-bound.rs index 83a4bb25436..ec615d8484c 100644 --- a/tests/ui/traits/const-traits/call-generic-method-dup-bound.rs +++ b/tests/ui/traits/const-traits/call-generic-method-dup-bound.rs @@ -1,8 +1,8 @@ //@ compile-flags: -Znext-solver //@ known-bug: #110395 -// FIXME(effects) check-pass +// FIXME(const_trait_impl) check-pass -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] struct S; diff --git a/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr b/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr index 3f9dce919d0..a168171cfe8 100644 --- a/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr @@ -1,12 +1,3 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/call-generic-method-dup-bound.rs:5:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]` --> $DIR/call-generic-method-dup-bound.rs:9:12 | @@ -17,32 +8,65 @@ LL | impl const PartialEq for S { = note: adding a non-const method body in the future would be a breaking change error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/call-generic-method-dup-bound.rs:20:44 + --> $DIR/call-generic-method-dup-bound.rs:20:37 | LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool { - | ^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/call-generic-method-dup-bound.rs:20:44 + --> $DIR/call-generic-method-dup-bound.rs:20:37 | LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool { - | ^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/call-generic-method-dup-bound.rs:27:37 + --> $DIR/call-generic-method-dup-bound.rs:27:30 | LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool { - | ^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/call-generic-method-dup-bound.rs:27:37 + --> $DIR/call-generic-method-dup-bound.rs:27:30 | LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool { - | ^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 5 previous errors; 1 warning emitted +error[E0015]: cannot call non-const operator in constant functions + --> $DIR/call-generic-method-dup-bound.rs:21:5 + | +LL | *t == *t + | ^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants +help: consider further restricting this bound + | +LL | const fn equals_self<T: PartialEq + ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool { + | ++++++++++++++++++++++++++++ + +error[E0015]: cannot call non-const fn `<S as PartialEq>::eq` in constant functions + --> $DIR/call-generic-method-dup-bound.rs:14:15 + | +LL | !self.eq(other) + | ^^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error[E0015]: cannot call non-const operator in constant functions + --> $DIR/call-generic-method-dup-bound.rs:28:5 + | +LL | *t == *t + | ^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants +help: consider further restricting this bound + | +LL | const fn equals_self2<T: A + ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool { + | ++++++++++++++++++++++++++++ + +error: aborting due to 8 previous errors +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/call-generic-method-fail.rs b/tests/ui/traits/const-traits/call-generic-method-fail.rs index 86e0eae61c9..66881334a29 100644 --- a/tests/ui/traits/const-traits/call-generic-method-fail.rs +++ b/tests/ui/traits/const-traits/call-generic-method-fail.rs @@ -1,12 +1,9 @@ -//@ check-pass //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] pub const fn equals_self<T: PartialEq>(t: &T) -> bool { *t == *t - // FIXME(effects) ~^ ERROR mismatched types - // FIXME(effects): diagnostic + //~^ ERROR cannot call non-const operator in constant functions } fn main() {} diff --git a/tests/ui/traits/const-traits/call-generic-method-fail.stderr b/tests/ui/traits/const-traits/call-generic-method-fail.stderr new file mode 100644 index 00000000000..07e50a7f7da --- /dev/null +++ b/tests/ui/traits/const-traits/call-generic-method-fail.stderr @@ -0,0 +1,15 @@ +error[E0015]: cannot call non-const operator in constant functions + --> $DIR/call-generic-method-fail.rs:5:5 + | +LL | *t == *t + | ^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants +help: consider further restricting this bound + | +LL | pub const fn equals_self<T: PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool { + | ++++++++++++++++++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/call-generic-method-nonconst.rs b/tests/ui/traits/const-traits/call-generic-method-nonconst.rs index f9e79d41752..446a74eb7b7 100644 --- a/tests/ui/traits/const-traits/call-generic-method-nonconst.rs +++ b/tests/ui/traits/const-traits/call-generic-method-nonconst.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] struct S; diff --git a/tests/ui/traits/const-traits/call-generic-method-nonconst.stderr b/tests/ui/traits/const-traits/call-generic-method-nonconst.stderr index 06b99375cda..d881bd5f4de 100644 --- a/tests/ui/traits/const-traits/call-generic-method-nonconst.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-nonconst.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `S: const Foo` is not satisfied - --> $DIR/call-generic-method-nonconst.rs:25:22 + --> $DIR/call-generic-method-nonconst.rs:24:22 | LL | pub const EQ: bool = equals_self(&S); | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/traits/const-traits/call-generic-method-pass.rs b/tests/ui/traits/const-traits/call-generic-method-pass.rs index cbeeb2567dd..af793b8da03 100644 --- a/tests/ui/traits/const-traits/call-generic-method-pass.rs +++ b/tests/ui/traits/const-traits/call-generic-method-pass.rs @@ -2,9 +2,9 @@ //@ compile-flags: -Znext-solver //@ known-bug: #110395 -// FIXME(effects) check-pass +// FIXME(const_trait_impl) check-pass -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] struct S; diff --git a/tests/ui/traits/const-traits/call-generic-method-pass.stderr b/tests/ui/traits/const-traits/call-generic-method-pass.stderr index e35de48ed60..af6e6d25dc9 100644 --- a/tests/ui/traits/const-traits/call-generic-method-pass.stderr +++ b/tests/ui/traits/const-traits/call-generic-method-pass.stderr @@ -1,12 +1,3 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/call-generic-method-pass.rs:7:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]` --> $DIR/call-generic-method-pass.rs:11:12 | @@ -17,18 +8,39 @@ LL | impl const PartialEq for S { = note: adding a non-const method body in the future would be a breaking change error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/call-generic-method-pass.rs:20:32 + --> $DIR/call-generic-method-pass.rs:20:25 | LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/call-generic-method-pass.rs:20:32 + --> $DIR/call-generic-method-pass.rs:20:25 | LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool { - | ^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 3 previous errors; 1 warning emitted +error[E0015]: cannot call non-const operator in constant functions + --> $DIR/call-generic-method-pass.rs:21:5 + | +LL | *t == *t + | ^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants +help: consider further restricting this bound + | +LL | const fn equals_self<T: ~const PartialEq + ~const std::cmp::PartialEq>(t: &T) -> bool { + | ++++++++++++++++++++++++++++ + +error[E0015]: cannot call non-const fn `<S as PartialEq>::eq` in constant functions + --> $DIR/call-generic-method-pass.rs:16:15 + | +LL | !self.eq(other) + | ^^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/call.rs b/tests/ui/traits/const-traits/call.rs index af2f7caf88c..b985e3da345 100644 --- a/tests/ui/traits/const-traits/call.rs +++ b/tests/ui/traits/const-traits/call.rs @@ -1,10 +1,11 @@ -//@ check-pass +// FIXME(const_trait_impl) check-pass //@ compile-flags: -Znext-solver -#![feature(const_closures, const_trait_impl, effects)] +#![feature(const_closures, const_trait_impl)] #![allow(incomplete_features)] pub const _: () = { assert!((const || true)()); + //~^ ERROR cannot call non-const closure in constants }; fn main() {} diff --git a/tests/ui/traits/const-traits/call.stderr b/tests/ui/traits/const-traits/call.stderr new file mode 100644 index 00000000000..e9bf64092f3 --- /dev/null +++ b/tests/ui/traits/const-traits/call.stderr @@ -0,0 +1,12 @@ +error[E0015]: cannot call non-const closure in constants + --> $DIR/call.rs:7:13 + | +LL | assert!((const || true)()); + | ^^^^^^^^^^^^^^^^^ + | + = note: closures need an RFC before allowed to be called in constants + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/const-bound-in-host.rs b/tests/ui/traits/const-traits/const-bound-in-host.rs index 6fbc21074b6..b4c4f5a6de1 100644 --- a/tests/ui/traits/const-traits/const-bound-in-host.rs +++ b/tests/ui/traits/const-traits/const-bound-in-host.rs @@ -1,8 +1,7 @@ //@ compile-flags: -Znext-solver //@ check-pass -#![feature(const_trait_impl, effects)] -//~^ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] #[const_trait] trait Foo { fn foo(); diff --git a/tests/ui/traits/const-traits/const-bound-in-host.stderr b/tests/ui/traits/const-traits/const-bound-in-host.stderr deleted file mode 100644 index b815f745ee8..00000000000 --- a/tests/ui/traits/const-traits/const-bound-in-host.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-bound-in-host.rs:4:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/const-traits/const-bound-on-not-const-associated-fn.rs b/tests/ui/traits/const-traits/const-bound-on-not-const-associated-fn.rs index 7c3e2af1797..c735f855bce 100644 --- a/tests/ui/traits/const-traits/const-bound-on-not-const-associated-fn.rs +++ b/tests/ui/traits/const-traits/const-bound-on-not-const-associated-fn.rs @@ -1,7 +1,6 @@ //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait MyTrait { diff --git a/tests/ui/traits/const-traits/const-bound-on-not-const-associated-fn.stderr b/tests/ui/traits/const-traits/const-bound-on-not-const-associated-fn.stderr index ae1260ffab7..50ab52ade49 100644 --- a/tests/ui/traits/const-traits/const-bound-on-not-const-associated-fn.stderr +++ b/tests/ui/traits/const-traits/const-bound-on-not-const-associated-fn.stderr @@ -1,23 +1,23 @@ error: `~const` is not allowed here - --> $DIR/const-bound-on-not-const-associated-fn.rs:12:40 + --> $DIR/const-bound-on-not-const-associated-fn.rs:11:40 | LL | fn do_something_else() where Self: ~const MyTrait; | ^^^^^^ | note: this function is not `const`, so it cannot have `~const` trait bounds - --> $DIR/const-bound-on-not-const-associated-fn.rs:12:8 + --> $DIR/const-bound-on-not-const-associated-fn.rs:11:8 | LL | fn do_something_else() where Self: ~const MyTrait; | ^^^^^^^^^^^^^^^^^ error: `~const` is not allowed here - --> $DIR/const-bound-on-not-const-associated-fn.rs:23:32 + --> $DIR/const-bound-on-not-const-associated-fn.rs:22:32 | LL | pub fn foo(&self) where T: ~const MyTrait { | ^^^^^^ | note: this function is not `const`, so it cannot have `~const` trait bounds - --> $DIR/const-bound-on-not-const-associated-fn.rs:23:12 + --> $DIR/const-bound-on-not-const-associated-fn.rs:22:12 | LL | pub fn foo(&self) where T: ~const MyTrait { | ^^^ diff --git a/tests/ui/traits/const-traits/const-bounds-non-const-trait.rs b/tests/ui/traits/const-traits/const-bounds-non-const-trait.rs index d51d231b8a9..e446eb15481 100644 --- a/tests/ui/traits/const-traits/const-bounds-non-const-trait.rs +++ b/tests/ui/traits/const-traits/const-bounds-non-const-trait.rs @@ -1,5 +1,5 @@ // Regression test for issue #117244. -#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] trait NonConst {} diff --git a/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr b/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr index 6c3c11c6a47..2436c97ccf2 100644 --- a/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr +++ b/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr @@ -1,36 +1,22 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-bounds-non-const-trait.rs:2:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-bounds-non-const-trait.rs:6:28 + --> $DIR/const-bounds-non-const-trait.rs:6:21 | LL | const fn perform<T: ~const NonConst>() {} - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-bounds-non-const-trait.rs:6:28 + --> $DIR/const-bounds-non-const-trait.rs:6:21 | LL | const fn perform<T: ~const NonConst>() {} - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `const` can only be applied to `#[const_trait]` traits - --> $DIR/const-bounds-non-const-trait.rs:10:21 + --> $DIR/const-bounds-non-const-trait.rs:10:15 | LL | fn operate<T: const NonConst>() {} - | ^^^^^^^^ + | ^^^^^ -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/const-check-fns-in-const-impl.rs b/tests/ui/traits/const-traits/const-check-fns-in-const-impl.rs index 7f9b38b8207..0330ed5ca8b 100644 --- a/tests/ui/traits/const-traits/const-check-fns-in-const-impl.rs +++ b/tests/ui/traits/const-traits/const-check-fns-in-const-impl.rs @@ -1,6 +1,6 @@ //@ compile-flags: -Znext-solver -#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] struct S; #[const_trait] diff --git a/tests/ui/traits/const-traits/const-check-fns-in-const-impl.stderr b/tests/ui/traits/const-traits/const-check-fns-in-const-impl.stderr index ba12854987e..d111a9d5639 100644 --- a/tests/ui/traits/const-traits/const-check-fns-in-const-impl.stderr +++ b/tests/ui/traits/const-traits/const-check-fns-in-const-impl.stderr @@ -1,12 +1,3 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-check-fns-in-const-impl.rs:3:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0015]: cannot call non-const fn `non_const` in constant functions --> $DIR/const-check-fns-in-const-impl.rs:14:16 | @@ -15,6 +6,6 @@ LL | fn foo() { non_const() } | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr b/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr index 12cc79f5961..25c81ff900f 100644 --- a/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr +++ b/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr @@ -1,14 +1,14 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closure-parse-not-item.rs:7:32 + --> $DIR/const-closure-parse-not-item.rs:7:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closure-parse-not-item.rs:7:32 + --> $DIR/const-closure-parse-not-item.rs:7:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr index 4e6707bba51..cb4c994bc2f 100644 --- a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr +++ b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr @@ -1,14 +1,14 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closure-trait-method-fail.rs:14:39 + --> $DIR/const-closure-trait-method-fail.rs:14:32 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closure-trait-method-fail.rs:14:39 + --> $DIR/const-closure-trait-method-fail.rs:14:32 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` @@ -23,10 +23,6 @@ help: consider further restricting this bound | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const FnOnce(())>(x: T) -> i32 { | +++++++++++++++++++ -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/const-closure-trait-method.stderr b/tests/ui/traits/const-traits/const-closure-trait-method.stderr index 0f0cd73cc10..43af435ae64 100644 --- a/tests/ui/traits/const-traits/const-closure-trait-method.stderr +++ b/tests/ui/traits/const-traits/const-closure-trait-method.stderr @@ -1,14 +1,14 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closure-trait-method.rs:14:39 + --> $DIR/const-closure-trait-method.rs:14:32 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closure-trait-method.rs:14:39 + --> $DIR/const-closure-trait-method.rs:14:32 | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 { - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` @@ -23,10 +23,6 @@ help: consider further restricting this bound | LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32 + ~const FnOnce(())>(x: T) -> i32 { | +++++++++++++++++++ -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/const-closures.stderr b/tests/ui/traits/const-traits/const-closures.stderr index 4d354cb281f..2e9e37ba321 100644 --- a/tests/ui/traits/const-traits/const-closures.stderr +++ b/tests/ui/traits/const-traits/const-closures.stderr @@ -1,56 +1,56 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closures.rs:8:19 + --> $DIR/const-closures.rs:8:12 | LL | F: ~const FnOnce() -> u8, - | ^^^^^^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closures.rs:9:19 + --> $DIR/const-closures.rs:9:12 | LL | F: ~const FnMut() -> u8, - | ^^^^^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closures.rs:10:19 + --> $DIR/const-closures.rs:10:12 | LL | F: ~const Fn() -> u8, - | ^^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closures.rs:8:19 + --> $DIR/const-closures.rs:8:12 | LL | F: ~const FnOnce() -> u8, - | ^^^^^^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closures.rs:9:19 + --> $DIR/const-closures.rs:9:12 | LL | F: ~const FnMut() -> u8, - | ^^^^^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closures.rs:10:19 + --> $DIR/const-closures.rs:10:12 | LL | F: ~const Fn() -> u8, - | ^^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closures.rs:23:27 + --> $DIR/const-closures.rs:23:20 | LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 { - | ^^^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-closures.rs:23:27 + --> $DIR/const-closures.rs:23:20 | LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 { - | ^^^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` @@ -65,10 +65,6 @@ help: consider further restricting this bound | LL | const fn answer<F: ~const Fn() -> u8 + ~const Fn()>(f: &F) -> u8 { | +++++++++++++ -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error[E0015]: cannot call non-const closure in constant functions --> $DIR/const-closures.rs:24:11 @@ -81,10 +77,6 @@ help: consider further restricting this bound | LL | const fn answer<F: ~const Fn() -> u8 + ~const Fn()>(f: &F) -> u8 { | +++++++++++++ -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error[E0015]: cannot call non-const closure in constant functions --> $DIR/const-closures.rs:12:5 @@ -97,10 +89,6 @@ help: consider further restricting this bound | LL | F: ~const FnOnce() -> u8 + ~const Fn(), | +++++++++++++ -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 11 previous errors diff --git a/tests/ui/traits/const-traits/const-default-method-bodies.rs b/tests/ui/traits/const-traits/const-default-method-bodies.rs index a0333153f85..0ef11a7f0c9 100644 --- a/tests/ui/traits/const-traits/const-default-method-bodies.rs +++ b/tests/ui/traits/const-traits/const-default-method-bodies.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait ConstDefaultFn: Sized { diff --git a/tests/ui/traits/const-traits/const-default-method-bodies.stderr b/tests/ui/traits/const-traits/const-default-method-bodies.stderr index 071eaf49541..5879330f158 100644 --- a/tests/ui/traits/const-traits/const-default-method-bodies.stderr +++ b/tests/ui/traits/const-traits/const-default-method-bodies.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `NonConstImpl: ~const ConstDefaultFn` is not satisfied - --> $DIR/const-default-method-bodies.rs:26:5 + --> $DIR/const-default-method-bodies.rs:25:5 | LL | NonConstImpl.a(); | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/traits/const-traits/const-drop-bound.stderr b/tests/ui/traits/const-traits/const-drop-bound.stderr index d94b0542324..3f718645433 100644 --- a/tests/ui/traits/const-traits/const-drop-bound.stderr +++ b/tests/ui/traits/const-traits/const-drop-bound.stderr @@ -1,42 +1,42 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop-bound.rs:9:68 + --> $DIR/const-drop-bound.rs:9:61 | LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct { - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop-bound.rs:9:68 + --> $DIR/const-drop-bound.rs:9:61 | LL | const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct { - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop-bound.rs:20:15 + --> $DIR/const-drop-bound.rs:20:8 | LL | T: ~const Destruct, - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop-bound.rs:21:15 + --> $DIR/const-drop-bound.rs:21:8 | LL | E: ~const Destruct, - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop-bound.rs:20:15 + --> $DIR/const-drop-bound.rs:20:8 | LL | T: ~const Destruct, - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop-bound.rs:21:15 + --> $DIR/const-drop-bound.rs:21:8 | LL | E: ~const Destruct, - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/traits/const-traits/const-drop-fail-2.rs b/tests/ui/traits/const-traits/const-drop-fail-2.rs index 7b57e0405af..5d7bafa3887 100644 --- a/tests/ui/traits/const-traits/const-drop-fail-2.rs +++ b/tests/ui/traits/const-traits/const-drop-fail-2.rs @@ -20,7 +20,7 @@ impl A for NonTrivialDrop {} const fn check<T: ~const Destruct>(_: T) {} -/* FIXME(effects) +/* FIXME(const_trait_impl) struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>); impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> { diff --git a/tests/ui/traits/const-traits/const-drop-fail-2.stderr b/tests/ui/traits/const-traits/const-drop-fail-2.stderr index 27e8053c969..fde106599c2 100644 --- a/tests/ui/traits/const-traits/const-drop-fail-2.stderr +++ b/tests/ui/traits/const-traits/const-drop-fail-2.stderr @@ -8,19 +8,25 @@ LL | impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> { = note: adding a non-const method body in the future would be a breaking change error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop-fail-2.rs:20:26 + --> $DIR/const-drop-fail-2.rs:20:19 | LL | const fn check<T: ~const Destruct>(_: T) {} - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop-fail-2.rs:20:26 + --> $DIR/const-drop-fail-2.rs:20:19 | LL | const fn check<T: ~const Destruct>(_: T) {} - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0277]: the trait bound `T: ~const A` is not satisfied + --> $DIR/const-drop-fail-2.rs:41:9 + | +LL | T::a(); + | ^^^^^^ + error[E0493]: destructor of `T` cannot be evaluated at compile-time --> $DIR/const-drop-fail-2.rs:20:36 | @@ -29,19 +35,7 @@ LL | const fn check<T: ~const Destruct>(_: T) {} | | | the destructor for this type cannot be evaluated in constant functions -error[E0015]: cannot call non-const fn `<T as A>::a` in constant functions - --> $DIR/const-drop-fail-2.rs:41:9 - | -LL | T::a(); - | ^^^^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - error: aborting due to 5 previous errors -Some errors have detailed explanations: E0015, E0493. -For more information about an error, try `rustc --explain E0015`. +Some errors have detailed explanations: E0277, E0493. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/const-drop-fail.precise.stderr b/tests/ui/traits/const-traits/const-drop-fail.precise.stderr index bde13b4d6cf..859fdfae81a 100644 --- a/tests/ui/traits/const-traits/const-drop-fail.precise.stderr +++ b/tests/ui/traits/const-traits/const-drop-fail.precise.stderr @@ -8,16 +8,16 @@ LL | impl const Drop for ConstImplWithDropGlue { = note: adding a non-const method body in the future would be a breaking change error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop-fail.rs:23:26 + --> $DIR/const-drop-fail.rs:23:19 | LL | const fn check<T: ~const Destruct>(_: T) {} - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop-fail.rs:23:26 + --> $DIR/const-drop-fail.rs:23:19 | LL | const fn check<T: ~const Destruct>(_: T) {} - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/traits/const-traits/const-drop-fail.stock.stderr b/tests/ui/traits/const-traits/const-drop-fail.stock.stderr index 064ffacca42..20dea28922b 100644 --- a/tests/ui/traits/const-traits/const-drop-fail.stock.stderr +++ b/tests/ui/traits/const-traits/const-drop-fail.stock.stderr @@ -8,16 +8,16 @@ LL | impl const Drop for ConstImplWithDropGlue { = note: adding a non-const method body in the future would be a breaking change error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop-fail.rs:23:26 + --> $DIR/const-drop-fail.rs:23:19 | LL | const fn check<T: ~const Destruct>(_: T) {} - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop-fail.rs:23:26 + --> $DIR/const-drop-fail.rs:23:19 | LL | const fn check<T: ~const Destruct>(_: T) {} - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/traits/const-traits/const-drop.precise.stderr b/tests/ui/traits/const-traits/const-drop.precise.stderr index 7b6d185c7cc..ed90b234761 100644 --- a/tests/ui/traits/const-traits/const-drop.precise.stderr +++ b/tests/ui/traits/const-traits/const-drop.precise.stderr @@ -35,38 +35,56 @@ LL | impl<T: SomeTrait> const Drop for ConstDropWithNonconstBound<T> { = note: adding a non-const method body in the future would be a breaking change error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop.rs:18:22 + --> $DIR/const-drop.rs:18:15 | LL | const fn a<T: ~const Destruct>(_: T) {} - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop.rs:18:22 + --> $DIR/const-drop.rs:18:15 | LL | const fn a<T: ~const Destruct>(_: T) {} - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0277]: the trait bound `T: const SomeTrait` is not satisfied + --> $DIR/const-drop.rs:67:46 + | +LL | impl<T: ~const SomeTrait> const Drop for ConstDropWithBound<T> { + | ^^^^^^^^^^^^^^^^^^^^^ + | +note: required by a bound in `t::ConstDropWithBound` + --> $DIR/const-drop.rs:65:38 + | +LL | pub struct ConstDropWithBound<T: const SomeTrait>(pub core::marker::PhantomData<T>); + | ^^^^^ required by this bound in `ConstDropWithBound` + +error[E0277]: the trait bound `T: const SomeTrait` is not satisfied + --> $DIR/const-drop.rs:68:22 + | +LL | fn drop(&mut self) { + | ^^^^ + | +note: required by a bound in `t::ConstDropWithBound` + --> $DIR/const-drop.rs:65:38 + | +LL | pub struct ConstDropWithBound<T: const SomeTrait>(pub core::marker::PhantomData<T>); + | ^^^^^ required by this bound in `ConstDropWithBound` + error[E0493]: destructor of `T` cannot be evaluated at compile-time --> $DIR/const-drop.rs:18:32 | LL | const fn a<T: ~const Destruct>(_: T) {} | ^ the destructor for this type cannot be evaluated in constant functions -error[E0015]: cannot call non-const fn `<T as SomeTrait>::foo` in constant functions +error[E0277]: the trait bound `T: ~const SomeTrait` is not satisfied --> $DIR/const-drop.rs:69:13 | LL | T::foo(); | ^^^^^^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | -error: aborting due to 8 previous errors +error: aborting due to 10 previous errors -Some errors have detailed explanations: E0015, E0493. -For more information about an error, try `rustc --explain E0015`. +Some errors have detailed explanations: E0277, E0493. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/const-drop.stock.stderr b/tests/ui/traits/const-traits/const-drop.stock.stderr index b497c39b08a..2b46b048e90 100644 --- a/tests/ui/traits/const-traits/const-drop.stock.stderr +++ b/tests/ui/traits/const-traits/const-drop.stock.stderr @@ -35,19 +35,43 @@ LL | impl<T: SomeTrait> const Drop for ConstDropWithNonconstBound<T> { = note: adding a non-const method body in the future would be a breaking change error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop.rs:18:22 + --> $DIR/const-drop.rs:18:15 | LL | const fn a<T: ~const Destruct>(_: T) {} - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/const-drop.rs:18:22 + --> $DIR/const-drop.rs:18:15 | LL | const fn a<T: ~const Destruct>(_: T) {} - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0277]: the trait bound `T: const SomeTrait` is not satisfied + --> $DIR/const-drop.rs:67:46 + | +LL | impl<T: ~const SomeTrait> const Drop for ConstDropWithBound<T> { + | ^^^^^^^^^^^^^^^^^^^^^ + | +note: required by a bound in `t::ConstDropWithBound` + --> $DIR/const-drop.rs:65:38 + | +LL | pub struct ConstDropWithBound<T: const SomeTrait>(pub core::marker::PhantomData<T>); + | ^^^^^ required by this bound in `ConstDropWithBound` + +error[E0277]: the trait bound `T: const SomeTrait` is not satisfied + --> $DIR/const-drop.rs:68:22 + | +LL | fn drop(&mut self) { + | ^^^^ + | +note: required by a bound in `t::ConstDropWithBound` + --> $DIR/const-drop.rs:65:38 + | +LL | pub struct ConstDropWithBound<T: const SomeTrait>(pub core::marker::PhantomData<T>); + | ^^^^^ required by this bound in `ConstDropWithBound` + error[E0493]: destructor of `T` cannot be evaluated at compile-time --> $DIR/const-drop.rs:18:32 | @@ -56,19 +80,13 @@ LL | const fn a<T: ~const Destruct>(_: T) {} | | | the destructor for this type cannot be evaluated in constant functions -error[E0015]: cannot call non-const fn `<T as SomeTrait>::foo` in constant functions +error[E0277]: the trait bound `T: ~const SomeTrait` is not satisfied --> $DIR/const-drop.rs:69:13 | LL | T::foo(); | ^^^^^^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | -error: aborting due to 8 previous errors +error: aborting due to 10 previous errors -Some errors have detailed explanations: E0015, E0493. -For more information about an error, try `rustc --explain E0015`. +Some errors have detailed explanations: E0277, E0493. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/const-fns-are-early-bound.rs b/tests/ui/traits/const-traits/const-fns-are-early-bound.rs index 6d08d8bdd91..c26eaf67454 100644 --- a/tests/ui/traits/const-traits/const-fns-are-early-bound.rs +++ b/tests/ui/traits/const-traits/const-fns-are-early-bound.rs @@ -1,7 +1,7 @@ //@ known-bug: #110395 //@ failure-status: 101 //@ dont-check-compiler-stderr -// FIXME(effects) check-pass +// FIXME(const_trait_impl) check-pass //@ compile-flags: -Znext-solver #![crate_type = "lib"] diff --git a/tests/ui/traits/const-traits/const-impl-requires-const-trait.rs b/tests/ui/traits/const-traits/const-impl-requires-const-trait.rs index e49e9090eb4..6bea664b65f 100644 --- a/tests/ui/traits/const-traits/const-impl-requires-const-trait.rs +++ b/tests/ui/traits/const-traits/const-impl-requires-const-trait.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![feature(const_trait_impl, effects)] -#![allow(incomplete_features)] +#![feature(const_trait_impl)] pub trait A {} diff --git a/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr b/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr index 828e2174f00..bcaae381949 100644 --- a/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr +++ b/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr @@ -1,5 +1,5 @@ error: const `impl` for trait `A` which is not marked with `#[const_trait]` - --> $DIR/const-impl-requires-const-trait.rs:7:12 + --> $DIR/const-impl-requires-const-trait.rs:6:12 | LL | pub trait A {} | - help: mark `A` as const: `#[const_trait]` diff --git a/tests/ui/traits/const-traits/const-in-closure.rs b/tests/ui/traits/const-traits/const-in-closure.rs index 51b22c53036..ebc17a50c86 100644 --- a/tests/ui/traits/const-traits/const-in-closure.rs +++ b/tests/ui/traits/const-traits/const-in-closure.rs @@ -1,8 +1,7 @@ //@ compile-flags: -Znext-solver //@ check-pass -#![feature(const_trait_impl, effects)] -//~^ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] #[const_trait] trait Trait { fn method(); diff --git a/tests/ui/traits/const-traits/const-in-closure.stderr b/tests/ui/traits/const-traits/const-in-closure.stderr deleted file mode 100644 index f4b03b9ed20..00000000000 --- a/tests/ui/traits/const-traits/const-in-closure.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-in-closure.rs:4:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/const-traits/const-trait-bounds-trait-objects.rs b/tests/ui/traits/const-traits/const-trait-bounds-trait-objects.rs index 691bce19dc2..2dac1970835 100644 --- a/tests/ui/traits/const-traits/const-trait-bounds-trait-objects.rs +++ b/tests/ui/traits/const-traits/const-trait-bounds-trait-objects.rs @@ -1,5 +1,5 @@ #![feature(const_trait_impl)] -// FIXME(effects) add effects +// FIXME(const_trait_impl) add effects //@ edition: 2021 #[const_trait] diff --git a/tests/ui/traits/const-traits/const-trait-bounds.rs b/tests/ui/traits/const-traits/const-trait-bounds.rs index 3b4ba6a998f..8722d9909ed 100644 --- a/tests/ui/traits/const-traits/const-trait-bounds.rs +++ b/tests/ui/traits/const-traits/const-trait-bounds.rs @@ -1,7 +1,7 @@ //@ known-bug: #110395 //@ compile-flags: -Znext-solver -// FIXME(effects): check-pass -#![feature(const_trait_impl, effects, generic_const_exprs)] +// FIXME(const_trait_impl): check-pass +#![feature(const_trait_impl, generic_const_exprs)] #![allow(incomplete_features)] fn main() { diff --git a/tests/ui/traits/const-traits/const-trait-bounds.stderr b/tests/ui/traits/const-traits/const-trait-bounds.stderr index 698b1b5b578..29a01b9d7dc 100644 --- a/tests/ui/traits/const-traits/const-trait-bounds.stderr +++ b/tests/ui/traits/const-traits/const-trait-bounds.stderr @@ -1,8 +1,8 @@ error: `-Znext-solver=globally` and `generic_const_exprs` are incompatible, using them at the same time is not allowed - --> $DIR/const-trait-bounds.rs:4:39 + --> $DIR/const-trait-bounds.rs:4:30 | -LL | #![feature(const_trait_impl, effects, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ +LL | #![feature(const_trait_impl, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ | = help: remove one of these features diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr index 3ccae5a83e6..95f6f32f21d 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr +++ b/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'derive_const' +error[E0658]: use of unstable library feature `derive_const` --> $DIR/derive-const-gate.rs:1:3 | LL | #[derive_const(Default)] diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.rs b/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.rs index 5896091f8c4..7bda7117a47 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.rs +++ b/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.rs @@ -1,5 +1,5 @@ //@ known-bug: #110395 -#![feature(derive_const, effects)] +#![feature(derive_const)] pub struct A; diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr index 777b3313da6..9492000a563 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr +++ b/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr @@ -1,17 +1,3 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/derive-const-non-const-type.rs:2:26 - | -LL | #![feature(derive_const, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error: const `impl` for trait `Default` which is not marked with `#[const_trait]` --> $DIR/derive-const-non-const-type.rs:10:16 | @@ -22,5 +8,17 @@ LL | #[derive_const(Default)] = note: adding a non-const method body in the future would be a breaking change = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 2 previous errors; 1 warning emitted +error[E0015]: cannot call non-const fn `<A as Default>::default` in constant functions + --> $DIR/derive-const-non-const-type.rs:11:14 + | +LL | #[derive_const(Default)] + | ------- in this derive macro expansion +LL | pub struct S(A); + | ^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-use.rs b/tests/ui/traits/const-traits/const_derives/derive-const-use.rs index cb649b1ec79..1e447147213 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-use.rs +++ b/tests/ui/traits/const-traits/const_derives/derive-const-use.rs @@ -1,6 +1,6 @@ //@ known-bug: #110395 -#![feature(const_trait_impl, const_cmp, const_default_impls, derive_const, effects)] +#![feature(const_trait_impl, const_cmp, const_default_impls, derive_const)] pub struct A; diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr index ad727fc36cd..6f4fc90f636 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr +++ b/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr @@ -1,29 +1,15 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/derive-const-use.rs:3:76 - | -LL | #![feature(const_trait_impl, const_cmp, const_default_impls, derive_const, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0635]: unknown feature `const_cmp` --> $DIR/derive-const-use.rs:3:30 | -LL | #![feature(const_trait_impl, const_cmp, const_default_impls, derive_const, effects)] +LL | #![feature(const_trait_impl, const_cmp, const_default_impls, derive_const)] | ^^^^^^^^^ error[E0635]: unknown feature `const_default_impls` --> $DIR/derive-const-use.rs:3:41 | -LL | #![feature(const_trait_impl, const_cmp, const_default_impls, derive_const, effects)] +LL | #![feature(const_trait_impl, const_cmp, const_default_impls, derive_const)] | ^^^^^^^^^^^^^^^^^^^ -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error: const `impl` for trait `Default` which is not marked with `#[const_trait]` --> $DIR/derive-const-use.rs:7:12 | @@ -62,29 +48,67 @@ LL | #[derive_const(Default, PartialEq)] = note: adding a non-const method body in the future would be a breaking change = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0080]: evaluation of constant value failed +error[E0015]: cannot call non-const fn `<S as Default>::default` in constants + --> $DIR/derive-const-use.rs:18:35 + | +LL | const _: () = assert!(S((), A) == S::default()); + | ^^^^^^^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + +error[E0015]: cannot call non-const operator in constants + --> $DIR/derive-const-use.rs:18:23 + | +LL | const _: () = assert!(S((), A) == S::default()); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + +error[E0015]: cannot call non-const fn `<() as Default>::default` in constant functions --> $DIR/derive-const-use.rs:16:14 | LL | #[derive_const(Default, PartialEq)] | ------- in this derive macro expansion LL | pub struct S((), A); - | ^^ calling non-const function `<() as Default>::default` + | ^^ | -note: inside `<S as Default>::default` - --> $DIR/derive-const-use.rs:16:14 + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: cannot call non-const fn `<A as Default>::default` in constant functions + --> $DIR/derive-const-use.rs:16:18 | LL | #[derive_const(Default, PartialEq)] | ------- in this derive macro expansion LL | pub struct S((), A); - | ^^ -note: inside `_` - --> $DIR/derive-const-use.rs:18:35 + | ^ | -LL | const _: () = assert!(S((), A) == S::default()); - | ^^^^^^^^^^^^ + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 8 previous errors; 1 warning emitted +error[E0015]: cannot call non-const operator in constant functions + --> $DIR/derive-const-use.rs:16:14 + | +LL | #[derive_const(Default, PartialEq)] + | --------- in this derive macro expansion +LL | pub struct S((), A); + | ^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0015]: cannot call non-const operator in constant functions + --> $DIR/derive-const-use.rs:16:18 + | +LL | #[derive_const(Default, PartialEq)] + | --------- in this derive macro expansion +LL | pub struct S((), A); + | ^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 12 previous errors -Some errors have detailed explanations: E0080, E0635. -For more information about an error, try `rustc --explain E0080`. +Some errors have detailed explanations: E0015, E0635. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-with-params.rs b/tests/ui/traits/const-traits/const_derives/derive-const-with-params.rs index c032c76d38f..18b224af278 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-with-params.rs +++ b/tests/ui/traits/const-traits/const_derives/derive-const-with-params.rs @@ -1,8 +1,8 @@ //@ known-bug: #110395 -// FIXME(effects) check-pass +// FIXME(const_trait_impl) check-pass #![feature(derive_const)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[derive_const(PartialEq)] pub struct Reverse<T>(T); diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr index addce8dcd6c..21cf64f89ea 100644 --- a/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr +++ b/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr @@ -1,17 +1,3 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/derive-const-with-params.rs:5:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]` --> $DIR/derive-const-with-params.rs:7:16 | @@ -23,12 +9,26 @@ LL | #[derive_const(PartialEq)] = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/derive-const-with-params.rs:7:16 + +error[E0015]: cannot call non-const operator in constant functions + --> $DIR/derive-const-with-params.rs:8:23 | LL | #[derive_const(PartialEq)] - | ^^^^^^^^^ + | --------- in this derive macro expansion +LL | pub struct Reverse<T>(T); + | ^ | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 3 previous errors; 1 warning emitted +error[E0015]: cannot call non-const operator in constant functions + --> $DIR/derive-const-with-params.rs:11:5 + | +LL | a == b + | ^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/cross-crate-default-method-body-is-const.rs b/tests/ui/traits/const-traits/cross-crate-default-method-body-is-const.rs index 9ee5254dbf8..80b4124a644 100644 --- a/tests/ui/traits/const-traits/cross-crate-default-method-body-is-const.rs +++ b/tests/ui/traits/const-traits/cross-crate-default-method-body-is-const.rs @@ -3,8 +3,7 @@ // //@ check-pass //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] //@ aux-build: cross-crate.rs extern crate cross_crate; diff --git a/tests/ui/traits/const-traits/cross-crate.rs b/tests/ui/traits/const-traits/cross-crate.rs index cfcada9c828..b07aa8944c0 100644 --- a/tests/ui/traits/const-traits/cross-crate.rs +++ b/tests/ui/traits/const-traits/cross-crate.rs @@ -1,7 +1,7 @@ //@ revisions: stock gated stocknc gatednc //@ [gated] check-pass //@ compile-flags: -Znext-solver -#![cfg_attr(any(gated, gatednc), feature(const_trait_impl, effects))] +#![cfg_attr(any(gated, gatednc), feature(const_trait_impl))] #![allow(incomplete_features)] //@ aux-build: cross-crate.rs @@ -20,8 +20,7 @@ const fn const_context() { //[stocknc]~^ ERROR: cannot call //[gatednc]~^^ ERROR: the trait bound Const.func(); - //[stock]~^ ERROR: cannot call - //[stocknc]~^^ ERROR: cannot call + //[stock,stocknc]~^ ERROR: cannot call } fn main() {} diff --git a/tests/ui/traits/const-traits/cross-crate.stock.stderr b/tests/ui/traits/const-traits/cross-crate.stock.stderr index b481bdc470c..09bf9c023c8 100644 --- a/tests/ui/traits/const-traits/cross-crate.stock.stderr +++ b/tests/ui/traits/const-traits/cross-crate.stock.stderr @@ -1,15 +1,13 @@ -error[E0015]: cannot call non-const fn `<cross_crate::Const as cross_crate::MyTrait>::func` in constant functions - --> $DIR/cross-crate.rs:22:11 +error[E0658]: cannot call conditionally-const method `<cross_crate::Const as cross_crate::MyTrait>::func` in constant functions + --> $DIR/cross-crate.rs:22:5 | LL | Const.func(); - | ^^^^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] + | ^^^^^^^^^^^^ | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0015`. +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/traits/const-traits/cross-crate.stocknc.stderr b/tests/ui/traits/const-traits/cross-crate.stocknc.stderr index 5c3e3b6ff40..e52e5609b01 100644 --- a/tests/ui/traits/const-traits/cross-crate.stocknc.stderr +++ b/tests/ui/traits/const-traits/cross-crate.stocknc.stderr @@ -1,27 +1,23 @@ -error[E0015]: cannot call non-const fn `<cross_crate::NonConst as cross_crate::MyTrait>::func` in constant functions - --> $DIR/cross-crate.rs:19:14 +error[E0658]: cannot call conditionally-const method `<cross_crate::NonConst as cross_crate::MyTrait>::func` in constant functions + --> $DIR/cross-crate.rs:19:5 | LL | NonConst.func(); - | ^^^^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] + | ^^^^^^^^^^^^^^^ | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0015]: cannot call non-const fn `<cross_crate::Const as cross_crate::MyTrait>::func` in constant functions - --> $DIR/cross-crate.rs:22:11 +error[E0658]: cannot call conditionally-const method `<cross_crate::Const as cross_crate::MyTrait>::func` in constant functions + --> $DIR/cross-crate.rs:22:5 | LL | Const.func(); - | ^^^^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] + | ^^^^^^^^^^^^ | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0015`. +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/traits/const-traits/default-method-body-is-const-body-checking.rs b/tests/ui/traits/const-traits/default-method-body-is-const-body-checking.rs index b534d23b107..96acdc300e0 100644 --- a/tests/ui/traits/const-traits/default-method-body-is-const-body-checking.rs +++ b/tests/ui/traits/const-traits/default-method-body-is-const-body-checking.rs @@ -1,6 +1,3 @@ -//@ known-bug: #110395 -//@ check-pass - #![feature(const_trait_impl)] #[const_trait] @@ -13,7 +10,7 @@ const fn foo<T>() where T: ~const Tr {} pub trait Foo { fn foo() { foo::<()>(); - //FIXME ~^ ERROR the trait bound `(): Tr` is not satisfied + //~^ ERROR the trait bound `(): ~const Tr` is not satisfied } } diff --git a/tests/ui/traits/const-traits/default-method-body-is-const-body-checking.stderr b/tests/ui/traits/const-traits/default-method-body-is-const-body-checking.stderr new file mode 100644 index 00000000000..0534f3eb8d2 --- /dev/null +++ b/tests/ui/traits/const-traits/default-method-body-is-const-body-checking.stderr @@ -0,0 +1,9 @@ +error[E0277]: the trait bound `(): ~const Tr` is not satisfied + --> $DIR/default-method-body-is-const-body-checking.rs:12:9 + | +LL | foo::<()>(); + | ^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/default-method-body-is-const-same-trait-ck.rs b/tests/ui/traits/const-traits/default-method-body-is-const-same-trait-ck.rs index 0c2d93775a4..b3beba08237 100644 --- a/tests/ui/traits/const-traits/default-method-body-is-const-same-trait-ck.rs +++ b/tests/ui/traits/const-traits/default-method-body-is-const-same-trait-ck.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] pub trait Tr { diff --git a/tests/ui/traits/const-traits/default-method-body-is-const-same-trait-ck.stderr b/tests/ui/traits/const-traits/default-method-body-is-const-same-trait-ck.stderr index 7b4d512e391..d987cad6f14 100644 --- a/tests/ui/traits/const-traits/default-method-body-is-const-same-trait-ck.stderr +++ b/tests/ui/traits/const-traits/default-method-body-is-const-same-trait-ck.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `(): ~const Tr` is not satisfied - --> $DIR/default-method-body-is-const-same-trait-ck.rs:10:9 + --> $DIR/default-method-body-is-const-same-trait-ck.rs:9:9 | LL | ().a() | ^^^^^^ diff --git a/tests/ui/traits/const-traits/do-not-const-check-override.rs b/tests/ui/traits/const-traits/do-not-const-check-override.rs index 71e6375283f..2b8e1d38ac9 100644 --- a/tests/ui/traits/const-traits/do-not-const-check-override.rs +++ b/tests/ui/traits/const-traits/do-not-const-check-override.rs @@ -1,7 +1,7 @@ //@ check-pass //@ compile-flags: -Znext-solver #![allow(incomplete_features)] -#![feature(const_trait_impl, rustc_attrs, effects)] +#![feature(const_trait_impl, rustc_attrs)] #[const_trait] trait Foo { diff --git a/tests/ui/traits/const-traits/dont-observe-host-opaque.rs b/tests/ui/traits/const-traits/dont-observe-host-opaque.rs index 4a5ae346e39..751ba1cb8c7 100644 --- a/tests/ui/traits/const-traits/dont-observe-host-opaque.rs +++ b/tests/ui/traits/const-traits/dont-observe-host-opaque.rs @@ -1,8 +1,7 @@ //@ compile-flags: -Znext-solver //@ check-pass -#![feature(const_trait_impl, effects)] -//~^ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] const fn opaque() -> impl Sized {} diff --git a/tests/ui/traits/const-traits/dont-observe-host-opaque.stderr b/tests/ui/traits/const-traits/dont-observe-host-opaque.stderr deleted file mode 100644 index 1b457ab7643..00000000000 --- a/tests/ui/traits/const-traits/dont-observe-host-opaque.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/dont-observe-host-opaque.rs:4:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/const-traits/dont-observe-host.rs b/tests/ui/traits/const-traits/dont-observe-host.rs index d027d578c42..06050385f91 100644 --- a/tests/ui/traits/const-traits/dont-observe-host.rs +++ b/tests/ui/traits/const-traits/dont-observe-host.rs @@ -1,8 +1,7 @@ //@ compile-flags: -Znext-solver //@ check-pass -#![feature(const_trait_impl, effects)] -//~^ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] #[const_trait] trait Trait { diff --git a/tests/ui/traits/const-traits/dont-observe-host.stderr b/tests/ui/traits/const-traits/dont-observe-host.stderr deleted file mode 100644 index 64ef611f011..00000000000 --- a/tests/ui/traits/const-traits/dont-observe-host.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/dont-observe-host.rs:4:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/const-traits/effects/auxiliary/cross-crate.rs b/tests/ui/traits/const-traits/effects/auxiliary/cross-crate.rs index 779527e22d4..e02bf6a4d2c 100644 --- a/tests/ui/traits/const-traits/effects/auxiliary/cross-crate.rs +++ b/tests/ui/traits/const-traits/effects/auxiliary/cross-crate.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] pub const fn foo() {} diff --git a/tests/ui/traits/const-traits/effects/minicore.rs b/tests/ui/traits/const-traits/effects/auxiliary/minicore.rs index a756f4d9f6c..209a111c243 100644 --- a/tests/ui/traits/const-traits/effects/minicore.rs +++ b/tests/ui/traits/const-traits/effects/auxiliary/minicore.rs @@ -1,28 +1,34 @@ -//@ known-bug: #110395 -//@ failure-status: 101 -//@ normalize-stderr-test: ".*note: .*\n\n" -> "" -//@ normalize-stderr-test: "thread 'rustc' panicked.*:\n.*\n" -> "" -//@ rustc-env:RUST_BACKTRACE=0 -// FIXME(effects) check-pass -//@ compile-flags: -Znext-solver - -#![crate_type = "lib"] -#![feature(no_core, lang_items, unboxed_closures, auto_traits, intrinsics, rustc_attrs, staged_api)] -#![feature(fundamental, marker_trait_attr)] -#![feature(const_trait_impl, effects)] +//@ compile-flags: -Znext-solver -Cpanic=abort +//@ no-prefer-dynamic + +#![crate_type = "rlib"] +#![feature( + no_core, + lang_items, + unboxed_closures, + auto_traits, + intrinsics, + rustc_attrs, + fundamental, + marker_trait_attr, + const_trait_impl +)] #![allow(internal_features, incomplete_features)] #![no_std] #![no_core] -#![stable(feature = "minicore", since = "1.0.0")] #[lang = "sized"] -trait Sized {} +pub trait Sized {} #[lang = "copy"] -trait Copy {} +pub trait Copy {} + +impl Copy for bool {} +impl Copy for u8 {} +impl<T: ?Sized> Copy for &T {} #[lang = "add"] #[const_trait] -trait Add<Rhs = Self> { +pub trait Add<Rhs = Self> { type Output; fn add(self, rhs: Rhs) -> Self::Output; @@ -43,10 +49,9 @@ const fn bar() { let x = 42_i32 + 43_i32; } - #[lang = "Try"] #[const_trait] -trait Try: FromResidual<Self::Residual> { +pub trait Try: FromResidual<Self::Residual> { type Output; type Residual; @@ -57,9 +62,8 @@ trait Try: FromResidual<Self::Residual> { fn branch(self) -> ControlFlow<Self::Residual, Self::Output>; } -// FIXME -// #[const_trait] -trait FromResidual<R = <Self as /* FIXME: ~const */ Try>::Residual> { +#[const_trait] +pub trait FromResidual<R = <Self as Try>::Residual> { #[lang = "from_residual"] fn from_residual(residual: R) -> Self; } @@ -74,71 +78,32 @@ enum ControlFlow<B, C = ()> { #[const_trait] #[lang = "fn"] #[rustc_paren_sugar] -trait Fn<Args: Tuple>: ~const FnMut<Args> { +pub trait Fn<Args: Tuple>: ~const FnMut<Args> { extern "rust-call" fn call(&self, args: Args) -> Self::Output; } #[const_trait] #[lang = "fn_mut"] #[rustc_paren_sugar] -trait FnMut<Args: Tuple>: ~const FnOnce<Args> { +pub trait FnMut<Args: Tuple>: ~const FnOnce<Args> { extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; } #[const_trait] #[lang = "fn_once"] #[rustc_paren_sugar] -trait FnOnce<Args: Tuple> { +pub trait FnOnce<Args: Tuple> { #[lang = "fn_once_output"] type Output; extern "rust-call" fn call_once(self, args: Args) -> Self::Output; } -struct ConstFnMutClosure<CapturedData, Function> { - data: CapturedData, - func: Function, -} - #[lang = "tuple_trait"] -trait Tuple {} - -macro_rules! impl_fn_mut_tuple { - ($($var:ident)*) => { - impl<'a, $($var,)* ClosureArguments: Tuple, Function, ClosureReturnValue> const - FnOnce<ClosureArguments> for ConstFnMutClosure<($(&'a mut $var),*), Function> - where - Function: ~const Fn(($(&mut $var),*), ClosureArguments) -> ClosureReturnValue, - Function: ~const Destruct, - { - type Output = ClosureReturnValue; - - extern "rust-call" fn call_once(mut self, args: ClosureArguments) -> Self::Output { - self.call_mut(args) - } - } - impl<'a, $($var,)* ClosureArguments: Tuple, Function, ClosureReturnValue> const - FnMut<ClosureArguments> for ConstFnMutClosure<($(&'a mut $var),*), Function> - where - Function: ~const Fn(($(&mut $var),*), ClosureArguments)-> ClosureReturnValue, - Function: ~const Destruct, - { - extern "rust-call" fn call_mut(&mut self, args: ClosureArguments) -> Self::Output { - #[allow(non_snake_case)] - let ($($var),*) = &mut self.data; - (self.func)(($($var),*), args) - } - } - }; -} -//impl_fn_mut_tuple!(A); -//impl_fn_mut_tuple!(A B); -//impl_fn_mut_tuple!(A B C); -//impl_fn_mut_tuple!(A B C D); -//impl_fn_mut_tuple!(A B C D E); +pub trait Tuple {} #[lang = "legacy_receiver"] -trait LegacyReceiver {} +pub trait LegacyReceiver {} impl<T: ?Sized> LegacyReceiver for &T {} @@ -146,30 +111,26 @@ impl<T: ?Sized> LegacyReceiver for &mut T {} #[lang = "destruct"] #[const_trait] -trait Destruct {} +pub trait Destruct {} #[lang = "freeze"] -unsafe auto trait Freeze {} +pub unsafe auto trait Freeze {} #[lang = "drop"] #[const_trait] -trait Drop { +pub trait Drop { fn drop(&mut self); } -/* #[const_trait] -trait Residual<O> { +pub trait Residual<O> { type TryType: ~const Try<Output = O, Residual = Self> + Try<Output = O, Residual = Self>; } -*/ const fn size_of<T>() -> usize { 42 } -impl Copy for u8 {} - impl usize { #[rustc_allow_incoherent_impl] const fn repeat_u8(x: u8) -> usize { @@ -190,15 +151,14 @@ fn panic_fmt() {} #[lang = "index"] #[const_trait] -trait Index<Idx: ?Sized> { +pub trait Index<Idx: ?Sized> { type Output: ?Sized; fn index(&self, index: Idx) -> &Self::Output; } - #[const_trait] -unsafe trait SliceIndex<T: ?Sized> { +pub unsafe trait SliceIndex<T: ?Sized> { type Output: ?Sized; fn index(self, slice: &T) -> &Self::Output; } @@ -214,7 +174,7 @@ where index.index(self) } } -/* FIXME + impl<T, I, const N: usize> const Index<I> for [T; N] where [T]: ~const Index<I>, @@ -222,35 +182,29 @@ where type Output = <[T] as Index<I>>::Output; #[inline] - // FIXME: make `Self::Output` act like `<Self as ~const Index<I>>::Output` fn index(&self, index: I) -> &<[T] as Index<I>>::Output { Index::index(self as &[T], index) } } -*/ #[lang = "unsize"] -trait Unsize<T: ?Sized> { -} +pub trait Unsize<T: ?Sized> {} #[lang = "coerce_unsized"] -trait CoerceUnsized<T: ?Sized> { -} +pub trait CoerceUnsized<T: ?Sized> {} impl<'a, 'b: 'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {} - #[lang = "deref"] -// #[const_trait] FIXME -trait Deref { +#[const_trait] +pub trait Deref { #[lang = "deref_target"] type Target: ?Sized; fn deref(&self) -> &Self::Target; } - -impl<T: ?Sized> /* const */ Deref for &T { +impl<T: ?Sized> const Deref for &T { type Target = T; fn deref(&self) -> &T { @@ -258,7 +212,7 @@ impl<T: ?Sized> /* const */ Deref for &T { } } -impl<T: ?Sized> /* const */ Deref for &mut T { +impl<T: ?Sized> const Deref for &mut T { type Target = T; fn deref(&self) -> &T { @@ -291,7 +245,6 @@ impl<T> Option<T> { use Option::*; -/* const fn as_deref<T>(opt: &Option<T>) -> Option<&T::Target> where T: ~const Deref, @@ -301,15 +254,14 @@ where Option::None => Option::None, } } -*/ #[const_trait] -trait Into<T>: Sized { +pub trait Into<T>: Sized { fn into(self) -> T; } #[const_trait] -trait From<T>: Sized { +pub trait From<T>: Sized { fn from(value: T) -> Self; } @@ -344,7 +296,7 @@ fn from_str(s: &str) -> Result<bool, ()> { #[lang = "eq"] #[const_trait] -trait PartialEq<Rhs: ?Sized = Self> { +pub trait PartialEq<Rhs: ?Sized = Self> { fn eq(&self, other: &Rhs) -> bool; fn ne(&self, other: &Rhs) -> bool { !self.eq(other) @@ -366,10 +318,9 @@ impl PartialEq for str { } } - #[lang = "not"] #[const_trait] -trait Not { +pub trait Not { type Output; fn not(self) -> Self::Output; } @@ -381,9 +332,6 @@ impl const Not for bool { } } -impl Copy for bool {} -impl<'a> Copy for &'a str {} - #[lang = "pin"] #[fundamental] #[repr(transparent)] @@ -404,23 +352,21 @@ impl<'a, T: ?Sized> Pin<&'a T> { } } - impl<P: Deref> Pin<P> { - /* const */ fn as_ref(&self) -> Pin<&P::Target> + const fn as_ref(&self) -> Pin<&P::Target> where - P: /* ~const */ Deref, + P: ~const Deref, { unsafe { Pin::new_unchecked(&*self.pointer) } } } - impl<'a, T: ?Sized> Pin<&'a mut T> { const unsafe fn get_unchecked_mut(self) -> &'a mut T { self.pointer } } -/* FIXME lol + impl<T> Option<T> { const fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> { match Pin::get_ref(self).as_ref() { @@ -438,16 +384,15 @@ impl<T> Option<T> { } } } -*/ -impl<P: /* ~const */ Deref> /* const */ Deref for Pin<P> { +impl<P: ~const Deref> const Deref for Pin<P> { type Target = P::Target; fn deref(&self) -> &P::Target { Pin::get_ref(Pin::as_ref(self)) } } -impl<T> /* const */ Deref for Option<T> { +impl<T> const Deref for Option<T> { type Target = T; fn deref(&self) -> &T { loop {} @@ -499,23 +444,22 @@ impl<T: ?Sized> Deref for Ref<'_, T> { #[lang = "clone"] #[rustc_trivial_field_reads] -#[const_trait] -trait Clone: Sized { +// FIXME: #[const_trait] +pub trait Clone: Sized { fn clone(&self) -> Self; fn clone_from(&mut self, source: &Self) where - Self: ~const Destruct, + // FIXME: Self: ~const Destruct, { *self = source.clone() } } #[lang = "structural_peq"] -trait StructuralPartialEq {} +pub trait StructuralPartialEq {} -const fn drop<T: ~const Destruct>(_: T) {} +// FIXME: const fn drop<T: ~const Destruct>(_: T) {} -#[rustc_const_stable(feature = "const_eval_select", since = "1.0.0")] #[rustc_intrinsic_must_be_overridden] #[rustc_intrinsic] const fn const_eval_select<ARG: Tuple, F, G, RET>( @@ -529,10 +473,3 @@ where { loop {} } - -fn test_const_eval_select() { - const fn const_fn() {} - fn rt_fn() {} - - const_eval_select((), const_fn, rt_fn); -} diff --git a/tests/ui/traits/const-traits/effects/const_closure-const_trait_impl-ice-113381.rs b/tests/ui/traits/const-traits/effects/const_closure-const_trait_impl-ice-113381.rs index 3debc22098a..877249135cd 100644 --- a/tests/ui/traits/const-traits/effects/const_closure-const_trait_impl-ice-113381.rs +++ b/tests/ui/traits/const-traits/effects/const_closure-const_trait_impl-ice-113381.rs @@ -1,7 +1,5 @@ -//@ check-pass -// FIXME(effects) this shouldn't pass //@ compile-flags: -Znext-solver -#![feature(const_closures, const_trait_impl, effects)] +#![feature(const_closures, const_trait_impl)] #![allow(incomplete_features)] trait Foo { @@ -14,5 +12,6 @@ impl Foo for () { fn main() { (const || { (()).foo() })(); - // FIXME(effects) ~^ ERROR: cannot call non-const fn + //~^ ERROR: cannot call non-const fn `<() as Foo>::foo` in constant functions + // FIXME(const_trait_impl) this should probably say constant closures } diff --git a/tests/ui/consts/intrinsic_without_const_stab.stderr b/tests/ui/traits/const-traits/effects/const_closure-const_trait_impl-ice-113381.stderr index e3143080c5f..243e94087bb 100644 --- a/tests/ui/consts/intrinsic_without_const_stab.stderr +++ b/tests/ui/traits/const-traits/effects/const_closure-const_trait_impl-ice-113381.stderr @@ -1,8 +1,8 @@ -error[E0015]: cannot call non-const fn `copy::copy::<T>` in constant functions - --> $DIR/intrinsic_without_const_stab.rs:13:14 +error[E0015]: cannot call non-const fn `<() as Foo>::foo` in constant functions + --> $DIR/const_closure-const_trait_impl-ice-113381.rs:14:22 | -LL | unsafe { copy(src, dst, count) } - | ^^^^^^^^^^^^^^^^^^^^^ +LL | (const || { (()).foo() })(); + | ^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants diff --git a/tests/ui/traits/const-traits/effects/effect-param-infer.rs b/tests/ui/traits/const-traits/effects/effect-param-infer.rs index 958b9ac6d57..fcacf458a9f 100644 --- a/tests/ui/traits/const-traits/effects/effect-param-infer.rs +++ b/tests/ui/traits/const-traits/effects/effect-param-infer.rs @@ -3,8 +3,7 @@ // //@ check-pass //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] pub trait Foo<Rhs: ?Sized = Self> { diff --git a/tests/ui/traits/const-traits/effects/fallback.rs b/tests/ui/traits/const-traits/effects/fallback.rs index 4cfba00526b..253d16f3251 100644 --- a/tests/ui/traits/const-traits/effects/fallback.rs +++ b/tests/ui/traits/const-traits/effects/fallback.rs @@ -1,7 +1,5 @@ //@ check-pass //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(effects)] pub const fn owo() {} diff --git a/tests/ui/traits/const-traits/effects/helloworld.rs b/tests/ui/traits/const-traits/effects/helloworld.rs deleted file mode 100644 index 54f362b4413..00000000000 --- a/tests/ui/traits/const-traits/effects/helloworld.rs +++ /dev/null @@ -1,33 +0,0 @@ -//@ check-pass -//@ compile-flags: -Znext-solver -// gate-test-effects -// ^ effects doesn't have a gate so we will trick tidy into thinking this is a gate test -#![allow(incomplete_features)] -#![feature( - const_trait_impl, - effects, - core_intrinsics, - const_eval_select -)] - -// ensure we are passing in the correct host effect in always const contexts. - -pub const fn hmm<T>() -> usize { - // FIXME(const_trait_impl): maybe we should have a way to refer to the (hidden) effect param - fn one() -> usize { 1 } - const fn zero() -> usize { 0 } - unsafe { - std::intrinsics::const_eval_select((), zero, one) - } -} - -const _: () = { - let x = hmm::<()>(); - assert!(0 == x); -}; - -pub const fn uwu(x: [u8; hmm::<()>()]) { - let [] = x; -} - -fn main() {} diff --git a/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.rs b/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.rs index 9a9016de3a0..c467088ab3d 100644 --- a/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.rs +++ b/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.rs @@ -1,4 +1,4 @@ -#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] const fn test() -> impl ~const Fn() { //~^ ERROR `~const` can only be applied to `#[const_trait]` traits @@ -10,6 +10,7 @@ const fn test() -> impl ~const Fn() { [first, remainder @ ..] => { assert_eq!(first, &b'f'); //~^ ERROR cannot call non-const fn + //~| ERROR cannot call non-const operator } [] => panic!(), } diff --git a/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr b/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr index 526746eec73..6d7edaf19f2 100644 --- a/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr +++ b/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr @@ -8,34 +8,29 @@ LL | const move || { = help: add `#![feature(const_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/ice-112822-expected-type-for-param.rs:1:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/ice-112822-expected-type-for-param.rs:3:32 + --> $DIR/ice-112822-expected-type-for-param.rs:3:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/ice-112822-expected-type-for-param.rs:3:32 + --> $DIR/ice-112822-expected-type-for-param.rs:3:25 | LL | const fn test() -> impl ~const Fn() { - | ^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +error[E0015]: cannot call non-const operator in constant functions + --> $DIR/ice-112822-expected-type-for-param.rs:11:17 + | +LL | assert_eq!(first, &b'f'); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + error[E0015]: cannot call non-const fn `core::panicking::assert_failed::<&u8, &u8>` in constant functions --> $DIR/ice-112822-expected-type-for-param.rs:11:17 | @@ -45,7 +40,7 @@ LL | assert_eq!(first, &b'f'); = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 5 previous errors; 1 warning emitted +error: aborting due to 5 previous errors Some errors have detailed explanations: E0015, E0658. For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/effects/ice-113375-index-out-of-bounds-generics.rs b/tests/ui/traits/const-traits/effects/ice-113375-index-out-of-bounds-generics.rs index 06e3377c5ee..f3cbaf847a9 100644 --- a/tests/ui/traits/const-traits/effects/ice-113375-index-out-of-bounds-generics.rs +++ b/tests/ui/traits/const-traits/effects/ice-113375-index-out-of-bounds-generics.rs @@ -3,7 +3,7 @@ // effects ice https://github.com/rust-lang/rust/issues/113375 index out of bounds #![allow(incomplete_features, unused)] -#![feature(effects, adt_const_params)] +#![feature(adt_const_params)] struct Bar<T>(T); diff --git a/tests/ui/traits/const-traits/effects/infer-fallback.rs b/tests/ui/traits/const-traits/effects/infer-fallback.rs index 581c3949d38..a7342d72a9c 100644 --- a/tests/ui/traits/const-traits/effects/infer-fallback.rs +++ b/tests/ui/traits/const-traits/effects/infer-fallback.rs @@ -1,7 +1,6 @@ //@ check-pass //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] const fn a() {} diff --git a/tests/ui/traits/const-traits/effects/minicore-deref-fail.rs b/tests/ui/traits/const-traits/effects/minicore-deref-fail.rs new file mode 100644 index 00000000000..f4a7678a009 --- /dev/null +++ b/tests/ui/traits/const-traits/effects/minicore-deref-fail.rs @@ -0,0 +1,20 @@ +//@ aux-build:minicore.rs +//@ compile-flags: --crate-type=lib -Znext-solver -Cpanic=abort + +#![feature(no_core, const_trait_impl)] +#![no_std] +#![no_core] + +extern crate minicore; +use minicore::*; + +struct Ty; +impl Deref for Ty { + type Target = (); + fn deref(&self) -> &Self::Target { &() } +} + +const fn foo() { + *Ty; + //~^ ERROR the trait bound `Ty: ~const minicore::Deref` is not satisfied +} diff --git a/tests/ui/traits/const-traits/effects/minicore-deref-fail.stderr b/tests/ui/traits/const-traits/effects/minicore-deref-fail.stderr new file mode 100644 index 00000000000..a1f840114fc --- /dev/null +++ b/tests/ui/traits/const-traits/effects/minicore-deref-fail.stderr @@ -0,0 +1,9 @@ +error[E0277]: the trait bound `Ty: ~const minicore::Deref` is not satisfied + --> $DIR/minicore-deref-fail.rs:18:5 + | +LL | *Ty; + | ^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/effects/minicore-works.rs b/tests/ui/traits/const-traits/effects/minicore-works.rs new file mode 100644 index 00000000000..bfbfa8b2d05 --- /dev/null +++ b/tests/ui/traits/const-traits/effects/minicore-works.rs @@ -0,0 +1,22 @@ +//@ aux-build:minicore.rs +//@ compile-flags: --crate-type=lib -Znext-solver -Cpanic=abort +//@ check-pass + +#![feature(no_core)] +#![no_std] +#![no_core] +#![feature(const_trait_impl)] + +extern crate minicore; +use minicore::*; + +struct Custom; +impl const Add for Custom { + type Output = (); + fn add(self, _other: Self) {} +} + +const fn test_op() { + let _x = Add::add(1, 2); + let _y = Custom + Custom; +} diff --git a/tests/ui/traits/const-traits/effects/minicore.stderr b/tests/ui/traits/const-traits/effects/minicore.stderr deleted file mode 100644 index 568d98cfe87..00000000000 --- a/tests/ui/traits/const-traits/effects/minicore.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: the compiler unexpectedly panicked. this is a bug. - -query stack during panic: -#0 [typeck] type-checking `Clone::clone_from` -#1 [analysis] running analysis passes on this crate -end of query stack - -error: the compiler unexpectedly panicked. this is a bug. - -query stack during panic: -#0 [typeck] type-checking `test_const_eval_select` -#1 [analysis] running analysis passes on this crate -end of query stack diff --git a/tests/ui/traits/const-traits/effects/no-explicit-const-params-cross-crate.stderr b/tests/ui/traits/const-traits/effects/no-explicit-const-params-cross-crate.stderr index eea6a06c1c8..d1180dbd80e 100644 --- a/tests/ui/traits/const-traits/effects/no-explicit-const-params-cross-crate.stderr +++ b/tests/ui/traits/const-traits/effects/no-explicit-const-params-cross-crate.stderr @@ -7,7 +7,7 @@ LL | foo::<false>(); | expected 0 generic arguments | note: function defined here, with 0 generic parameters - --> $DIR/auxiliary/cross-crate.rs:5:14 + --> $DIR/auxiliary/cross-crate.rs:4:14 | LL | pub const fn foo() {} | ^^^ @@ -21,7 +21,7 @@ LL | <() as Bar<false>>::bar(); | expected 0 generic arguments | note: trait defined here, with 0 generic parameters - --> $DIR/auxiliary/cross-crate.rs:8:11 + --> $DIR/auxiliary/cross-crate.rs:7:11 | LL | pub trait Bar { | ^^^ @@ -35,7 +35,7 @@ LL | foo::<true>(); | expected 0 generic arguments | note: function defined here, with 0 generic parameters - --> $DIR/auxiliary/cross-crate.rs:5:14 + --> $DIR/auxiliary/cross-crate.rs:4:14 | LL | pub const fn foo() {} | ^^^ @@ -49,7 +49,7 @@ LL | <() as Bar<true>>::bar(); | expected 0 generic arguments | note: trait defined here, with 0 generic parameters - --> $DIR/auxiliary/cross-crate.rs:8:11 + --> $DIR/auxiliary/cross-crate.rs:7:11 | LL | pub trait Bar { | ^^^ diff --git a/tests/ui/traits/const-traits/effects/no-explicit-const-params.rs b/tests/ui/traits/const-traits/effects/no-explicit-const-params.rs index b08aba9acbc..76663292223 100644 --- a/tests/ui/traits/const-traits/effects/no-explicit-const-params.rs +++ b/tests/ui/traits/const-traits/effects/no-explicit-const-params.rs @@ -1,4 +1,4 @@ -#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] const fn foo() {} @@ -23,4 +23,5 @@ const FOO: () = { //~^ ERROR: function takes 0 generic arguments but 1 generic argument was supplied <() as Bar<false>>::bar(); //~^ ERROR: trait takes 0 generic arguments but 1 generic argument was supplied + //~| ERROR the trait bound `(): const Bar` is not satisfied }; diff --git a/tests/ui/traits/const-traits/effects/no-explicit-const-params.stderr b/tests/ui/traits/const-traits/effects/no-explicit-const-params.stderr index a3aa970e94d..0b8e4696c46 100644 --- a/tests/ui/traits/const-traits/effects/no-explicit-const-params.stderr +++ b/tests/ui/traits/const-traits/effects/no-explicit-const-params.stderr @@ -1,17 +1,3 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/no-explicit-const-params.rs:1:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params.rs:22:5 | @@ -40,6 +26,12 @@ note: trait defined here, with 0 generic parameters LL | trait Bar { | ^^^ +error[E0277]: the trait bound `(): const Bar` is not satisfied + --> $DIR/no-explicit-const-params.rs:24:5 + | +LL | <() as Bar<false>>::bar(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params.rs:15:5 | @@ -68,6 +60,7 @@ note: trait defined here, with 0 generic parameters LL | trait Bar { | ^^^ -error: aborting due to 5 previous errors; 1 warning emitted +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0107`. +Some errors have detailed explanations: E0107, E0277. +For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/traits/const-traits/effects/project.rs b/tests/ui/traits/const-traits/effects/project.rs index 9f6ca1f294f..139299753e5 100644 --- a/tests/ui/traits/const-traits/effects/project.rs +++ b/tests/ui/traits/const-traits/effects/project.rs @@ -1,7 +1,6 @@ //@ check-pass //@ compile-flags: -Znext-solver -#![feature(const_trait_impl, effects)] -#![allow(incomplete_features)] +#![feature(const_trait_impl)] #[const_trait] pub trait Owo<X = <Self as Uwu>::T> {} diff --git a/tests/ui/traits/const-traits/effects/span-bug-issue-121418.rs b/tests/ui/traits/const-traits/effects/span-bug-issue-121418.rs index e6e41c472bd..50a7e12f2a7 100644 --- a/tests/ui/traits/const-traits/effects/span-bug-issue-121418.rs +++ b/tests/ui/traits/const-traits/effects/span-bug-issue-121418.rs @@ -1,5 +1,4 @@ #![feature(const_trait_impl)] -#![feature(effects)] //~ WARN the feature `effects` is incomplete struct S; trait T {} diff --git a/tests/ui/traits/const-traits/effects/span-bug-issue-121418.stderr b/tests/ui/traits/const-traits/effects/span-bug-issue-121418.stderr index 5ff1c6c5b9f..fe1e5e558b2 100644 --- a/tests/ui/traits/const-traits/effects/span-bug-issue-121418.stderr +++ b/tests/ui/traits/const-traits/effects/span-bug-issue-121418.stderr @@ -1,5 +1,5 @@ error: inherent impls cannot be `const` - --> $DIR/span-bug-issue-121418.rs:7:12 + --> $DIR/span-bug-issue-121418.rs:6:12 | LL | impl const dyn T { | ----- ^^^^^ inherent impl for this type @@ -8,22 +8,8 @@ LL | impl const dyn T { | = note: only trait implementations may be annotated with `const` -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/span-bug-issue-121418.rs:2:12 - | -LL | #![feature(effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error[E0308]: mismatched types - --> $DIR/span-bug-issue-121418.rs:9:27 + --> $DIR/span-bug-issue-121418.rs:8:27 | LL | pub const fn new() -> std::sync::Mutex<dyn T> {} | --- ^^^^^^^^^^^^^^^^^^^^^^^ expected `Mutex<dyn T>`, found `()` @@ -34,17 +20,17 @@ LL | pub const fn new() -> std::sync::Mutex<dyn T> {} found unit type `()` error[E0277]: the size for values of type `(dyn T + 'static)` cannot be known at compilation time - --> $DIR/span-bug-issue-121418.rs:9:27 + --> $DIR/span-bug-issue-121418.rs:8:27 | LL | pub const fn new() -> std::sync::Mutex<dyn T> {} | ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `Mutex<(dyn T + 'static)>`, the trait `Sized` is not implemented for `(dyn T + 'static)`, which is required by `Mutex<(dyn T + 'static)>: Sized` + = help: within `Mutex<(dyn T + 'static)>`, the trait `Sized` is not implemented for `(dyn T + 'static)` note: required because it appears within the type `Mutex<(dyn T + 'static)>` --> $SRC_DIR/std/src/sync/mutex.rs:LL:COL = note: the return type of a function must have a statically known size -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 3 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/effects/spec-effectvar-ice.rs b/tests/ui/traits/const-traits/effects/spec-effectvar-ice.rs index d29cd93d3fb..c85b1746967 100644 --- a/tests/ui/traits/const-traits/effects/spec-effectvar-ice.rs +++ b/tests/ui/traits/const-traits/effects/spec-effectvar-ice.rs @@ -1,6 +1,5 @@ // Fixes #119830 -#![feature(effects)] //~ WARN the feature `effects` is incomplete #![feature(min_specialization)] #![feature(const_trait_impl)] diff --git a/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr b/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr index d9655c4995f..5659102c5e5 100644 --- a/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr +++ b/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr @@ -1,19 +1,5 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/spec-effectvar-ice.rs:3:12 - | -LL | #![feature(effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error: const `impl` for trait `Foo` which is not marked with `#[const_trait]` - --> $DIR/spec-effectvar-ice.rs:11:15 + --> $DIR/spec-effectvar-ice.rs:10:15 | LL | trait Foo {} | - help: mark `Foo` as const: `#[const_trait]` @@ -25,7 +11,7 @@ LL | impl<T> const Foo for T {} = note: adding a non-const method body in the future would be a breaking change error: const `impl` for trait `Foo` which is not marked with `#[const_trait]` - --> $DIR/spec-effectvar-ice.rs:14:15 + --> $DIR/spec-effectvar-ice.rs:13:15 | LL | trait Foo {} | - help: mark `Foo` as const: `#[const_trait]` @@ -37,28 +23,28 @@ LL | impl<T> const Foo for T where T: const Specialize {} = note: adding a non-const method body in the future would be a breaking change error: `const` can only be applied to `#[const_trait]` traits - --> $DIR/spec-effectvar-ice.rs:14:40 + --> $DIR/spec-effectvar-ice.rs:13:34 | LL | impl<T> const Foo for T where T: const Specialize {} - | ^^^^^^^^^^ + | ^^^^^ error: specialization impl does not specialize any associated items - --> $DIR/spec-effectvar-ice.rs:14:1 + --> $DIR/spec-effectvar-ice.rs:13:1 | LL | impl<T> const Foo for T where T: const Specialize {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: impl is a specialization of this impl - --> $DIR/spec-effectvar-ice.rs:11:1 + --> $DIR/spec-effectvar-ice.rs:10:1 | LL | impl<T> const Foo for T {} | ^^^^^^^^^^^^^^^^^^^^^^^ error: cannot specialize on trait `Specialize` - --> $DIR/spec-effectvar-ice.rs:14:34 + --> $DIR/spec-effectvar-ice.rs:13:34 | LL | impl<T> const Foo for T where T: const Specialize {} | ^^^^^^^^^^^^^^^^ -error: aborting due to 6 previous errors; 1 warning emitted +error: aborting due to 5 previous errors diff --git a/tests/ui/traits/const-traits/effects/trait-fn-const.rs b/tests/ui/traits/const-traits/effects/trait-fn-const.rs index d63dbfbf57d..07eac032a82 100644 --- a/tests/ui/traits/const-traits/effects/trait-fn-const.rs +++ b/tests/ui/traits/const-traits/effects/trait-fn-const.rs @@ -1,5 +1,5 @@ // Regression test for issue #113378. -#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] #[const_trait] trait Trait { diff --git a/tests/ui/traits/const-traits/effects/trait-fn-const.stderr b/tests/ui/traits/const-traits/effects/trait-fn-const.stderr index 15cb84026e4..4d0b03046d2 100644 --- a/tests/ui/traits/const-traits/effects/trait-fn-const.stderr +++ b/tests/ui/traits/const-traits/effects/trait-fn-const.stderr @@ -54,20 +54,6 @@ LL + #[const_trait] LL | trait NonConst { | -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/trait-fn-const.rs:2:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - -error: aborting due to 5 previous errors; 1 warning emitted +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0379`. diff --git a/tests/ui/traits/const-traits/effects/with-without-next-solver.coherence.stderr b/tests/ui/traits/const-traits/effects/with-without-next-solver.coherence.stderr deleted file mode 100644 index 20448f51de2..00000000000 --- a/tests/ui/traits/const-traits/effects/with-without-next-solver.coherence.stderr +++ /dev/null @@ -1,7 +0,0 @@ -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - -error: aborting due to 1 previous error - diff --git a/tests/ui/traits/const-traits/effects/with-without-next-solver.rs b/tests/ui/traits/const-traits/effects/with-without-next-solver.rs deleted file mode 100644 index f022af05c50..00000000000 --- a/tests/ui/traits/const-traits/effects/with-without-next-solver.rs +++ /dev/null @@ -1,10 +0,0 @@ -// test that we error correctly when effects is used without the next-solver flag. -//@ revisions: stock coherence full -//@[coherence] compile-flags: -Znext-solver=coherence -//@[full] compile-flags: -Znext-solver -//@[full] check-pass - -#![feature(effects)] -#![allow(incomplete_features)] - -fn main() {} diff --git a/tests/ui/traits/const-traits/effects/with-without-next-solver.stock.stderr b/tests/ui/traits/const-traits/effects/with-without-next-solver.stock.stderr deleted file mode 100644 index 20448f51de2..00000000000 --- a/tests/ui/traits/const-traits/effects/with-without-next-solver.stock.stderr +++ /dev/null @@ -1,7 +0,0 @@ -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - -error: aborting due to 1 previous error - diff --git a/tests/ui/traits/const-traits/fn-ptr-lub.rs b/tests/ui/traits/const-traits/fn-ptr-lub.rs index 0fc32678827..8f1a29e612c 100644 --- a/tests/ui/traits/const-traits/fn-ptr-lub.rs +++ b/tests/ui/traits/const-traits/fn-ptr-lub.rs @@ -1,8 +1,7 @@ //@ compile-flags: -Znext-solver //@ check-pass -#![feature(const_trait_impl, effects)] -//~^ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] const fn foo() {} const fn bar() {} diff --git a/tests/ui/traits/const-traits/fn-ptr-lub.stderr b/tests/ui/traits/const-traits/fn-ptr-lub.stderr deleted file mode 100644 index b333311b660..00000000000 --- a/tests/ui/traits/const-traits/fn-ptr-lub.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/fn-ptr-lub.rs:4:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/const-traits/generic-bound.stderr b/tests/ui/traits/const-traits/generic-bound.stderr index 2baac1d2a16..0444c319577 100644 --- a/tests/ui/traits/const-traits/generic-bound.stderr +++ b/tests/ui/traits/const-traits/generic-bound.stderr @@ -14,10 +14,6 @@ LL | arg + arg | ^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 2 previous errors diff --git a/tests/ui/traits/const-traits/hir-const-check.rs b/tests/ui/traits/const-traits/hir-const-check.rs index b3df6495afc..ea1783b7c2c 100644 --- a/tests/ui/traits/const-traits/hir-const-check.rs +++ b/tests/ui/traits/const-traits/hir-const-check.rs @@ -2,7 +2,7 @@ // Regression test for #69615. -#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] #[const_trait] pub trait MyTrait { @@ -12,6 +12,8 @@ pub trait MyTrait { impl const MyTrait for () { fn method(&self) -> Option<()> { Some(())?; //~ ERROR `?` is not allowed in a `const fn` + //~^ ERROR `?` cannot determine the branch of `Option<()>` in constant functions + //~| ERROR `?` cannot convert from residual of `Option<()>` in constant functions None } } diff --git a/tests/ui/traits/const-traits/hir-const-check.stderr b/tests/ui/traits/const-traits/hir-const-check.stderr index 19ea734efb7..ef5dba0dc0e 100644 --- a/tests/ui/traits/const-traits/hir-const-check.stderr +++ b/tests/ui/traits/const-traits/hir-const-check.stderr @@ -1,12 +1,3 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/hir-const-check.rs:5:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0658]: `?` is not allowed in a `const fn` --> $DIR/hir-const-check.rs:14:9 | @@ -17,6 +8,27 @@ LL | Some(())?; = help: add `#![feature(const_try)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 1 previous error; 1 warning emitted +error[E0015]: `?` cannot determine the branch of `Option<()>` in constant functions + --> $DIR/hir-const-check.rs:14:9 + | +LL | Some(())?; + | ^^^^^^^^^ + | +note: impl defined here, but it is not `const` + --> $SRC_DIR/core/src/option.rs:LL:COL + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error[E0015]: `?` cannot convert from residual of `Option<()>` in constant functions + --> $DIR/hir-const-check.rs:14:9 + | +LL | Some(())?; + | ^^^^^^^^^ + | +note: impl defined here, but it is not `const` + --> $SRC_DIR/core/src/option.rs:LL:COL + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0015, E0658. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.rs b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.rs index c2f452a9925..dc1e719bded 100644 --- a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.rs +++ b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.rs @@ -1,5 +1,5 @@ #![allow(incomplete_features)] -#![feature(const_trait_impl, effects, try_trait_v2)] +#![feature(const_trait_impl, try_trait_v2)] use std::ops::FromResidual; diff --git a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr index 50cdded8d51..9e22422ad3b 100644 --- a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr +++ b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr @@ -1,8 +1,3 @@ -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error: const `impl` for trait `FromResidual` which is not marked with `#[const_trait]` --> $DIR/ice-119717-constant-lifetime.rs:6:15 | @@ -32,7 +27,7 @@ help: try replacing `_` with the type in the corresponding trait method signatur LL | fn from_residual(t: T) -> T { | ~ -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors Some errors have detailed explanations: E0121, E0210. For more information about an error, try `rustc --explain E0121`. diff --git a/tests/ui/traits/const-traits/ice-120503-async-const-method.rs b/tests/ui/traits/const-traits/ice-120503-async-const-method.rs index 9cd18d4566d..4c337a42a68 100644 --- a/tests/ui/traits/const-traits/ice-120503-async-const-method.rs +++ b/tests/ui/traits/const-traits/ice-120503-async-const-method.rs @@ -1,5 +1,4 @@ //@ edition: 2021 -#![feature(effects)] //~ WARN the feature `effects` is incomplete trait MyTrait {} diff --git a/tests/ui/traits/const-traits/ice-120503-async-const-method.stderr b/tests/ui/traits/const-traits/ice-120503-async-const-method.stderr index 90771c344b5..66862d97bf9 100644 --- a/tests/ui/traits/const-traits/ice-120503-async-const-method.stderr +++ b/tests/ui/traits/const-traits/ice-120503-async-const-method.stderr @@ -1,5 +1,5 @@ error: expected one of `extern`, `fn`, `safe`, or `unsafe`, found keyword `const` - --> $DIR/ice-120503-async-const-method.rs:7:11 + --> $DIR/ice-120503-async-const-method.rs:6:11 | LL | async const fn bar(&self) { | ------^^^^^ @@ -10,7 +10,7 @@ LL | async const fn bar(&self) { = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` error[E0379]: functions in trait impls cannot be declared const - --> $DIR/ice-120503-async-const-method.rs:7:11 + --> $DIR/ice-120503-async-const-method.rs:6:11 | LL | async const fn bar(&self) { | ^^^^^- @@ -19,7 +19,7 @@ LL | async const fn bar(&self) { | help: remove the `const` error: functions cannot be both `const` and `async` - --> $DIR/ice-120503-async-const-method.rs:7:5 + --> $DIR/ice-120503-async-const-method.rs:6:5 | LL | async const fn bar(&self) { | -^^^^ ^^^^^ `const` because of this @@ -35,7 +35,7 @@ LL | | } | |_____- error[E0407]: method `bar` is not a member of trait `MyTrait` - --> $DIR/ice-120503-async-const-method.rs:7:5 + --> $DIR/ice-120503-async-const-method.rs:6:5 | LL | / async const fn bar(&self) { LL | | @@ -46,22 +46,8 @@ LL | | LL | | } | |_____^ not a member of trait `MyTrait` -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/ice-120503-async-const-method.rs:2:12 - | -LL | #![feature(effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error[E0425]: cannot find function `main8` in this scope - --> $DIR/ice-120503-async-const-method.rs:12:9 + --> $DIR/ice-120503-async-const-method.rs:11:9 | LL | main8().await; | ^^^^^ help: a function with a similar name exists: `main` @@ -69,7 +55,7 @@ LL | main8().await; LL | fn main() {} | --------- similarly named function `main` defined here -error: aborting due to 6 previous errors; 1 warning emitted +error: aborting due to 5 previous errors Some errors have detailed explanations: E0379, E0407, E0425. For more information about an error, try `rustc --explain E0379`. diff --git a/tests/ui/traits/const-traits/ice-121536-const-method.rs b/tests/ui/traits/const-traits/ice-121536-const-method.rs index a01329278d7..b89786bfd93 100644 --- a/tests/ui/traits/const-traits/ice-121536-const-method.rs +++ b/tests/ui/traits/const-traits/ice-121536-const-method.rs @@ -1,4 +1,4 @@ -#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] pub struct Vec3; diff --git a/tests/ui/traits/const-traits/ice-121536-const-method.stderr b/tests/ui/traits/const-traits/ice-121536-const-method.stderr index 29187654c3c..408958abf63 100644 --- a/tests/ui/traits/const-traits/ice-121536-const-method.stderr +++ b/tests/ui/traits/const-traits/ice-121536-const-method.stderr @@ -14,20 +14,6 @@ help: ... and declare the impl to be const instead LL | impl const Add for Vec3 { | +++++ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/ice-121536-const-method.rs:1:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0379`. diff --git a/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.rs b/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.rs index 29f40604747..fadcaa39816 100644 --- a/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.rs +++ b/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.rs @@ -1,5 +1,5 @@ #![allow(incomplete_features)] -#![feature(generic_const_exprs, const_trait_impl, effects)] +#![feature(generic_const_exprs, const_trait_impl)] const fn with_positive<F: ~const Fn()>() {} //~^ ERROR `~const` can only be applied to `#[const_trait]` traits diff --git a/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr b/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr index 03f88be0093..1178c90fce5 100644 --- a/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr +++ b/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr @@ -1,21 +1,16 @@ -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/ice-123664-unexpected-bound-var.rs:4:34 + --> $DIR/ice-123664-unexpected-bound-var.rs:4:27 | LL | const fn with_positive<F: ~const Fn()>() {} - | ^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/ice-123664-unexpected-bound-var.rs:4:34 + --> $DIR/ice-123664-unexpected-bound-var.rs:4:27 | LL | const fn with_positive<F: ~const Fn()>() {} - | ^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/traits/const-traits/ice-124857-combine-effect-const-infer-vars.rs b/tests/ui/traits/const-traits/ice-124857-combine-effect-const-infer-vars.rs index d4fcbfb1b83..d6df1714314 100644 --- a/tests/ui/traits/const-traits/ice-124857-combine-effect-const-infer-vars.rs +++ b/tests/ui/traits/const-traits/ice-124857-combine-effect-const-infer-vars.rs @@ -1,7 +1,6 @@ //@ compile-flags: -Znext-solver=coherence -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Foo {} diff --git a/tests/ui/traits/const-traits/ice-124857-combine-effect-const-infer-vars.stderr b/tests/ui/traits/const-traits/ice-124857-combine-effect-const-infer-vars.stderr index 284757c1a89..183c2c2cdf4 100644 --- a/tests/ui/traits/const-traits/ice-124857-combine-effect-const-infer-vars.stderr +++ b/tests/ui/traits/const-traits/ice-124857-combine-effect-const-infer-vars.stderr @@ -1,10 +1,5 @@ -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error[E0119]: conflicting implementations of trait `Foo` for type `i32` - --> $DIR/ice-124857-combine-effect-const-infer-vars.rs:11:1 + --> $DIR/ice-124857-combine-effect-const-infer-vars.rs:10:1 | LL | impl const Foo for i32 {} | ---------------------- first implementation here @@ -12,6 +7,6 @@ LL | LL | impl<T> const Foo for T where T: ~const Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.rs b/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.rs index 717c0e7c088..9ce81031b27 100644 --- a/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.rs +++ b/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.rs @@ -1,5 +1,5 @@ #![allow(incomplete_features)] -#![feature(const_trait_impl, effects, try_trait_v2, const_try)] +#![feature(const_trait_impl, try_trait_v2, const_try)] use std::ops::{FromResidual, Try}; struct TryMe; @@ -18,6 +18,8 @@ impl const Try for TryMe { const fn t() -> TryMe { TryMe?; + //~^ ERROR `?` cannot determine the branch of `TryMe` in constant functions + //~| ERROR `?` cannot convert from residual of `TryMe` in constant functions TryMe } diff --git a/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr b/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr index e49436c8f0f..db047bfd94d 100644 --- a/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr +++ b/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr @@ -1,8 +1,3 @@ -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error: const `impl` for trait `FromResidual` which is not marked with `#[const_trait]` --> $DIR/ice-126148-failed-to-normalize.rs:8:12 | @@ -38,6 +33,23 @@ LL | impl const Try for TryMe { = help: implement the missing item: `fn from_output(_: <Self as Try>::Output) -> Self { todo!() }` = help: implement the missing item: `fn branch(self) -> ControlFlow<<Self as Try>::Residual, <Self as Try>::Output> { todo!() }` -error: aborting due to 5 previous errors +error[E0015]: `?` cannot determine the branch of `TryMe` in constant functions + --> $DIR/ice-126148-failed-to-normalize.rs:20:5 + | +LL | TryMe?; + | ^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error[E0015]: `?` cannot convert from residual of `TryMe` in constant functions + --> $DIR/ice-126148-failed-to-normalize.rs:20:5 + | +LL | TryMe?; + | ^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0046`. +Some errors have detailed explanations: E0015, E0046. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/impl-with-default-fn-fail.rs b/tests/ui/traits/const-traits/impl-with-default-fn-fail.rs index 49741ca24c7..6df9696f2cb 100644 --- a/tests/ui/traits/const-traits/impl-with-default-fn-fail.rs +++ b/tests/ui/traits/const-traits/impl-with-default-fn-fail.rs @@ -1,5 +1,4 @@ -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Tr { diff --git a/tests/ui/traits/const-traits/impl-with-default-fn-fail.stderr b/tests/ui/traits/const-traits/impl-with-default-fn-fail.stderr index 2ea203627f4..36c8163f1c5 100644 --- a/tests/ui/traits/const-traits/impl-with-default-fn-fail.stderr +++ b/tests/ui/traits/const-traits/impl-with-default-fn-fail.stderr @@ -1,10 +1,5 @@ -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error[E0046]: not all trait items implemented, missing: `req` - --> $DIR/impl-with-default-fn-fail.rs:13:1 + --> $DIR/impl-with-default-fn-fail.rs:12:1 | LL | fn req(&self); | -------------- `req` from trait @@ -12,6 +7,6 @@ LL | fn req(&self); LL | impl const Tr for u16 { | ^^^^^^^^^^^^^^^^^^^^^ missing `req` in implementation -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0046`. diff --git a/tests/ui/traits/const-traits/impl-with-default-fn-pass.rs b/tests/ui/traits/const-traits/impl-with-default-fn-pass.rs index 2c375036941..c776a29716f 100644 --- a/tests/ui/traits/const-traits/impl-with-default-fn-pass.rs +++ b/tests/ui/traits/const-traits/impl-with-default-fn-pass.rs @@ -1,7 +1,6 @@ //@ check-pass //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Tr { diff --git a/tests/ui/traits/const-traits/inline-incorrect-early-bound-in-ctfe.rs b/tests/ui/traits/const-traits/inline-incorrect-early-bound-in-ctfe.rs index e3adcce17b4..86cb38e0bcf 100644 --- a/tests/ui/traits/const-traits/inline-incorrect-early-bound-in-ctfe.rs +++ b/tests/ui/traits/const-traits/inline-incorrect-early-bound-in-ctfe.rs @@ -8,8 +8,7 @@ //@ compile-flags: -Znext-solver -Zinline-mir=yes -#![feature(const_trait_impl, effects)] -//~^ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] trait Trait { fn foo(self); @@ -25,6 +24,7 @@ impl Trait for () { const fn foo() { ().foo(); + //~^ ERROR cannot call non-const fn `<() as Trait>::foo` in constant functions } const UWU: () = foo(); diff --git a/tests/ui/traits/const-traits/inline-incorrect-early-bound-in-ctfe.stderr b/tests/ui/traits/const-traits/inline-incorrect-early-bound-in-ctfe.stderr index 2e7801c0b8a..c4547f4c43d 100644 --- a/tests/ui/traits/const-traits/inline-incorrect-early-bound-in-ctfe.stderr +++ b/tests/ui/traits/const-traits/inline-incorrect-early-bound-in-ctfe.stderr @@ -1,14 +1,5 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/inline-incorrect-early-bound-in-ctfe.rs:11:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0 type parameters - --> $DIR/inline-incorrect-early-bound-in-ctfe.rs:20:12 + --> $DIR/inline-incorrect-early-bound-in-ctfe.rs:19:12 | LL | fn foo(self); | - expected 0 type parameters @@ -16,6 +7,15 @@ LL | fn foo(self); LL | fn foo<T>(self) { | ^ found 1 type parameter -error: aborting due to 1 previous error; 1 warning emitted +error[E0015]: cannot call non-const fn `<() as Trait>::foo` in constant functions + --> $DIR/inline-incorrect-early-bound-in-ctfe.rs:26:8 + | +LL | ().foo(); + | ^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0049`. +Some errors have detailed explanations: E0015, E0049. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/issue-100222.rs b/tests/ui/traits/const-traits/issue-100222.rs index 13c469d656c..55722d35075 100644 --- a/tests/ui/traits/const-traits/issue-100222.rs +++ b/tests/ui/traits/const-traits/issue-100222.rs @@ -3,7 +3,7 @@ //@ check-pass #![allow(incomplete_features)] -#![feature(const_trait_impl, effects, associated_type_defaults)] +#![feature(const_trait_impl, associated_type_defaults)] #[cfg_attr(any(yn, yy), const_trait)] pub trait Index { diff --git a/tests/ui/traits/const-traits/issue-102985.stderr b/tests/ui/traits/const-traits/issue-102985.stderr index 8401d1bd4f6..7c5c5acf207 100644 --- a/tests/ui/traits/const-traits/issue-102985.stderr +++ b/tests/ui/traits/const-traits/issue-102985.stderr @@ -6,10 +6,6 @@ LL | n => n(), | = note: closures need an RFC before allowed to be called in constants = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/issue-79450.rs b/tests/ui/traits/const-traits/issue-79450.rs index b8b9e07b3bd..521576d27ef 100644 --- a/tests/ui/traits/const-traits/issue-79450.rs +++ b/tests/ui/traits/const-traits/issue-79450.rs @@ -1,7 +1,5 @@ //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_fmt_arguments_new)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Tr { diff --git a/tests/ui/traits/const-traits/issue-79450.stderr b/tests/ui/traits/const-traits/issue-79450.stderr index 9e6348d37ed..85996c21211 100644 --- a/tests/ui/traits/const-traits/issue-79450.stderr +++ b/tests/ui/traits/const-traits/issue-79450.stderr @@ -1,5 +1,5 @@ error[E0015]: cannot call non-const fn `_print` in constant functions - --> $DIR/issue-79450.rs:11:9 + --> $DIR/issue-79450.rs:9:9 | LL | println!("lul"); | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/traits/const-traits/issue-88155.stderr b/tests/ui/traits/const-traits/issue-88155.stderr index afe1ea3b1b7..157b54214fa 100644 --- a/tests/ui/traits/const-traits/issue-88155.stderr +++ b/tests/ui/traits/const-traits/issue-88155.stderr @@ -5,10 +5,6 @@ LL | T::assoc() | ^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/issue-92111.stderr b/tests/ui/traits/const-traits/issue-92111.stderr index 805cc537014..51c6a22b43b 100644 --- a/tests/ui/traits/const-traits/issue-92111.stderr +++ b/tests/ui/traits/const-traits/issue-92111.stderr @@ -1,14 +1,14 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/issue-92111.rs:20:22 + --> $DIR/issue-92111.rs:20:15 | LL | const fn a<T: ~const Destruct>(t: T) {} - | ^^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/issue-92111.rs:20:22 + --> $DIR/issue-92111.rs:20:15 | LL | const fn a<T: ~const Destruct>(t: T) {} - | ^^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/traits/const-traits/issue-92230-wf-super-trait-env.rs b/tests/ui/traits/const-traits/issue-92230-wf-super-trait-env.rs index e666355db6f..a3edc5ff8b1 100644 --- a/tests/ui/traits/const-traits/issue-92230-wf-super-trait-env.rs +++ b/tests/ui/traits/const-traits/issue-92230-wf-super-trait-env.rs @@ -3,8 +3,7 @@ //@ check-pass //@ compile-flags: -Znext-solver -#![feature(const_trait_impl, effects)] -#![allow(incomplete_features)] +#![feature(const_trait_impl)] #[const_trait] pub trait Super {} diff --git a/tests/ui/traits/const-traits/item-bound-entailment-fails.rs b/tests/ui/traits/const-traits/item-bound-entailment-fails.rs index 42799e3700c..f4bfcbda0ac 100644 --- a/tests/ui/traits/const-traits/item-bound-entailment-fails.rs +++ b/tests/ui/traits/const-traits/item-bound-entailment-fails.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![feature(const_trait_impl, effects)] -//~^ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] #[const_trait] trait Foo { type Assoc<T>: ~const Bar diff --git a/tests/ui/traits/const-traits/item-bound-entailment-fails.stderr b/tests/ui/traits/const-traits/item-bound-entailment-fails.stderr index 3b3868c4bc8..3fc6f584709 100644 --- a/tests/ui/traits/const-traits/item-bound-entailment-fails.stderr +++ b/tests/ui/traits/const-traits/item-bound-entailment-fails.stderr @@ -1,36 +1,27 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/item-bound-entailment-fails.rs:2:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: the trait bound `N<T>: ~const Bar` is not satisfied - --> $DIR/item-bound-entailment-fails.rs:18:21 + --> $DIR/item-bound-entailment-fails.rs:17:21 | LL | type Assoc<T> = N<T> | ^^^^ | note: required by a bound in `Foo::Assoc` - --> $DIR/item-bound-entailment-fails.rs:6:20 + --> $DIR/item-bound-entailment-fails.rs:5:20 | LL | type Assoc<T>: ~const Bar - | ^^^^^^^^^^ required by this bound in `Foo::Assoc` + | ^^^^^^ required by this bound in `Foo::Assoc` error[E0277]: the trait bound `T: ~const Bar` is not satisfied - --> $DIR/item-bound-entailment-fails.rs:25:21 + --> $DIR/item-bound-entailment-fails.rs:24:21 | LL | type Assoc<T> = C<T> | ^^^^ | note: required by a bound in `Foo::Assoc` - --> $DIR/item-bound-entailment-fails.rs:6:20 + --> $DIR/item-bound-entailment-fails.rs:5:20 | LL | type Assoc<T>: ~const Bar - | ^^^^^^^^^^ required by this bound in `Foo::Assoc` + | ^^^^^^ required by this bound in `Foo::Assoc` -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/item-bound-entailment.rs b/tests/ui/traits/const-traits/item-bound-entailment.rs index 3670eabd66c..11db57be815 100644 --- a/tests/ui/traits/const-traits/item-bound-entailment.rs +++ b/tests/ui/traits/const-traits/item-bound-entailment.rs @@ -1,8 +1,7 @@ //@ compile-flags: -Znext-solver //@ check-pass -#![feature(const_trait_impl, effects)] -//~^ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] #[const_trait] trait Foo { type Assoc<T>: ~const Bar diff --git a/tests/ui/traits/const-traits/item-bound-entailment.stderr b/tests/ui/traits/const-traits/item-bound-entailment.stderr deleted file mode 100644 index b4a4ebdbee2..00000000000 --- a/tests/ui/traits/const-traits/item-bound-entailment.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/item-bound-entailment.rs:4:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/const-traits/match-non-const-eq.gated.stderr b/tests/ui/traits/const-traits/match-non-const-eq.gated.stderr index c7d21151661..89e59e5db6e 100644 --- a/tests/ui/traits/const-traits/match-non-const-eq.gated.stderr +++ b/tests/ui/traits/const-traits/match-non-const-eq.gated.stderr @@ -6,10 +6,6 @@ LL | "a" => (), //FIXME [gated]~ ERROR can't compare `str` with `str` in | = note: `str` cannot be compared in compile-time, and therefore cannot be used in `match`es = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/match-non-const-eq.stock.stderr b/tests/ui/traits/const-traits/match-non-const-eq.stock.stderr index 0f5ecac3891..89e59e5db6e 100644 --- a/tests/ui/traits/const-traits/match-non-const-eq.stock.stderr +++ b/tests/ui/traits/const-traits/match-non-const-eq.stock.stderr @@ -6,10 +6,6 @@ LL | "a" => (), //FIXME [gated]~ ERROR can't compare `str` with `str` in | = note: `str` cannot be compared in compile-time, and therefore cannot be used in `match`es = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/non-const-op-const-closure-non-const-outer.stderr b/tests/ui/traits/const-traits/non-const-op-const-closure-non-const-outer.stderr index c362a1077e3..97ad83130d4 100644 --- a/tests/ui/traits/const-traits/non-const-op-const-closure-non-const-outer.stderr +++ b/tests/ui/traits/const-traits/non-const-op-const-closure-non-const-outer.stderr @@ -5,10 +5,6 @@ LL | (const || { (()).foo() })(); | ^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr b/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr index 2803c37646b..837effb7ca4 100644 --- a/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr +++ b/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr @@ -1,14 +1,14 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/non-const-op-in-closure-in-const.rs:10:51 + --> $DIR/non-const-op-in-closure-in-const.rs:10:44 | LL | impl<A, B> const Convert<B> for A where B: ~const From<A> { - | ^^^^^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/non-const-op-in-closure-in-const.rs:10:51 + --> $DIR/non-const-op-in-closure-in-const.rs:10:44 | LL | impl<A, B> const Convert<B> for A where B: ~const From<A> { - | ^^^^^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` @@ -19,10 +19,6 @@ LL | B::from(self) | ^^^^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 3 previous errors diff --git a/tests/ui/traits/const-traits/predicate-entailment-fails.rs b/tests/ui/traits/const-traits/predicate-entailment-fails.rs index 5d6109bfad3..266a49f9e38 100644 --- a/tests/ui/traits/const-traits/predicate-entailment-fails.rs +++ b/tests/ui/traits/const-traits/predicate-entailment-fails.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![feature(const_trait_impl, effects)] -//~^ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] #[const_trait] trait Bar {} impl const Bar for () {} diff --git a/tests/ui/traits/const-traits/predicate-entailment-fails.stderr b/tests/ui/traits/const-traits/predicate-entailment-fails.stderr index 7cd48ef1d48..369e95688a9 100644 --- a/tests/ui/traits/const-traits/predicate-entailment-fails.stderr +++ b/tests/ui/traits/const-traits/predicate-entailment-fails.stderr @@ -1,66 +1,57 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/predicate-entailment-fails.rs:2:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0276]: impl has stricter requirements than trait - --> $DIR/predicate-entailment-fails.rs:15:31 + --> $DIR/predicate-entailment-fails.rs:14:31 | LL | type Bar<T> where T: ~const Bar; | ----------- definition of `Bar` from trait ... LL | type Bar<T> = () where T: const Bar; - | ^^^^^^^^^ impl has extra requirement `T: const Bar` + | ^^^^^ impl has extra requirement `T: const Bar` error[E0276]: impl has stricter requirements than trait - --> $DIR/predicate-entailment-fails.rs:18:26 + --> $DIR/predicate-entailment-fails.rs:17:26 | LL | fn foo<T>() where T: ~const Bar; | -------------------------------- definition of `foo` from trait ... LL | fn foo<T>() where T: const Bar {} - | ^^^^^^^^^ impl has extra requirement `T: const Bar` + | ^^^^^ impl has extra requirement `T: const Bar` error[E0276]: impl has stricter requirements than trait - --> $DIR/predicate-entailment-fails.rs:29:31 + --> $DIR/predicate-entailment-fails.rs:28:31 | LL | type Bar<T> where T: Bar; | ----------- definition of `Bar` from trait ... LL | type Bar<T> = () where T: const Bar; - | ^^^^^^^^^ impl has extra requirement `T: const Bar` + | ^^^^^ impl has extra requirement `T: const Bar` error[E0276]: impl has stricter requirements than trait - --> $DIR/predicate-entailment-fails.rs:32:26 + --> $DIR/predicate-entailment-fails.rs:31:26 | LL | fn foo<T>() where T: Bar; | ------------------------- definition of `foo` from trait ... LL | fn foo<T>() where T: const Bar {} - | ^^^^^^^^^ impl has extra requirement `T: const Bar` + | ^^^^^ impl has extra requirement `T: const Bar` error[E0276]: impl has stricter requirements than trait - --> $DIR/predicate-entailment-fails.rs:36:31 + --> $DIR/predicate-entailment-fails.rs:35:31 | LL | type Bar<T> where T: Bar; | ----------- definition of `Bar` from trait ... LL | type Bar<T> = () where T: ~const Bar; - | ^^^^^^^^^^ impl has extra requirement `T: ~const Bar` + | ^^^^^^ impl has extra requirement `T: ~const Bar` error[E0276]: impl has stricter requirements than trait - --> $DIR/predicate-entailment-fails.rs:39:26 + --> $DIR/predicate-entailment-fails.rs:38:26 | LL | fn foo<T>() where T: Bar; | ------------------------- definition of `foo` from trait ... LL | fn foo<T>() where T: ~const Bar {} - | ^^^^^^^^^^ impl has extra requirement `T: ~const Bar` + | ^^^^^^ impl has extra requirement `T: ~const Bar` -error: aborting due to 6 previous errors; 1 warning emitted +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0276`. diff --git a/tests/ui/traits/const-traits/predicate-entailment-passes.rs b/tests/ui/traits/const-traits/predicate-entailment-passes.rs index b660329151b..9c8d5a5e3f6 100644 --- a/tests/ui/traits/const-traits/predicate-entailment-passes.rs +++ b/tests/ui/traits/const-traits/predicate-entailment-passes.rs @@ -1,8 +1,7 @@ //@ compile-flags: -Znext-solver //@ check-pass -#![feature(const_trait_impl, effects)] -//~^ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] #[const_trait] trait Bar {} impl const Bar for () {} diff --git a/tests/ui/traits/const-traits/predicate-entailment-passes.stderr b/tests/ui/traits/const-traits/predicate-entailment-passes.stderr deleted file mode 100644 index dcaeea73b58..00000000000 --- a/tests/ui/traits/const-traits/predicate-entailment-passes.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/predicate-entailment-passes.rs:4:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/const-traits/specialization/const-default-bound-non-const-specialized-bound.rs b/tests/ui/traits/const-traits/specialization/const-default-bound-non-const-specialized-bound.rs index 69dcb403aa9..5af9ee8614f 100644 --- a/tests/ui/traits/const-traits/specialization/const-default-bound-non-const-specialized-bound.rs +++ b/tests/ui/traits/const-traits/specialization/const-default-bound-non-const-specialized-bound.rs @@ -1,7 +1,7 @@ // Tests that trait bounds on specializing trait impls must be `~const` if the // same bound is present on the default impl and is `~const` there. //@ known-bug: #110395 -// FIXME(effects) ^ should error +// FIXME(const_trait_impl) ^ should error #![feature(const_trait_impl)] #![feature(rustc_attrs)] diff --git a/tests/ui/traits/const-traits/specialization/const-default-const-specialized.rs b/tests/ui/traits/const-traits/specialization/const-default-const-specialized.rs index a48a50b9e5c..89ad61c3c31 100644 --- a/tests/ui/traits/const-traits/specialization/const-default-const-specialized.rs +++ b/tests/ui/traits/const-traits/specialization/const-default-const-specialized.rs @@ -1,8 +1,7 @@ // Tests that a const default trait impl can be specialized by another const // trait impl and that the specializing impl will be used during const-eval. -//@ known-bug: #110395 -// FIXME(effects) run-pass +//@ run-pass #![feature(const_trait_impl)] #![feature(min_specialization)] diff --git a/tests/ui/traits/const-traits/specialization/const-default-const-specialized.stderr b/tests/ui/traits/const-traits/specialization/const-default-const-specialized.stderr deleted file mode 100644 index f127268d2a1..00000000000 --- a/tests/ui/traits/const-traits/specialization/const-default-const-specialized.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0015]: cannot call non-const fn `<T as Value>::value` in constant functions - --> $DIR/const-default-const-specialized.rs:16:5 - | -LL | T::value() - | ^^^^^^^^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/specialization/const-default-impl-non-const-specialized-impl.rs b/tests/ui/traits/const-traits/specialization/const-default-impl-non-const-specialized-impl.rs index 40fc3b17ae4..a3bb9b3f93e 100644 --- a/tests/ui/traits/const-traits/specialization/const-default-impl-non-const-specialized-impl.rs +++ b/tests/ui/traits/const-traits/specialization/const-default-impl-non-const-specialized-impl.rs @@ -1,6 +1,6 @@ // Tests that specializing trait impls must be at least as const as the default impl. -#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete +#![feature(const_trait_impl)] #![feature(min_specialization)] #[const_trait] diff --git a/tests/ui/traits/const-traits/specialization/const-default-impl-non-const-specialized-impl.stderr b/tests/ui/traits/const-traits/specialization/const-default-impl-non-const-specialized-impl.stderr index c51d169dd33..e356621ba47 100644 --- a/tests/ui/traits/const-traits/specialization/const-default-impl-non-const-specialized-impl.stderr +++ b/tests/ui/traits/const-traits/specialization/const-default-impl-non-const-specialized-impl.stderr @@ -1,22 +1,8 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-default-impl-non-const-specialized-impl.rs:3:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error: cannot specialize on const impl with non-const impl --> $DIR/const-default-impl-non-const-specialized-impl.rs:19:1 | LL | impl Value for FortyTwo { | ^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.rs b/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.rs index 912b35095f9..e9b494bc2c0 100644 --- a/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.rs +++ b/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.rs @@ -1,7 +1,7 @@ // Tests that a non-const default impl can be specialized by a const trait impl, // but that the default impl cannot be used in a const context. -//@ known-bug: #110395 -// FIXME(effects) run-pass + +//@ run-pass #![feature(const_trait_impl)] #![feature(min_specialization)] diff --git a/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.stderr b/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.stderr deleted file mode 100644 index a4095d7e8ce..00000000000 --- a/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0015]: cannot call non-const fn `<T as Value>::value` in constant functions - --> $DIR/non-const-default-const-specialized.rs:15:5 - | -LL | T::value() - | ^^^^^^^^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/specializing-constness-2.stderr b/tests/ui/traits/const-traits/specializing-constness-2.stderr index 8e6f6945a1b..4ad5e3157d4 100644 --- a/tests/ui/traits/const-traits/specializing-constness-2.stderr +++ b/tests/ui/traits/const-traits/specializing-constness-2.stderr @@ -1,15 +1,9 @@ -error[E0015]: cannot call non-const fn `<T as A>::a` in constant functions +error[E0277]: the trait bound `T: ~const A` is not satisfied --> $DIR/specializing-constness-2.rs:27:5 | LL | <T as A>::a(); | ^^^^^^^^^^^^^ - | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0015`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/specializing-constness.rs b/tests/ui/traits/const-traits/specializing-constness.rs index 3aabaf137d5..632121924a6 100644 --- a/tests/ui/traits/const-traits/specializing-constness.rs +++ b/tests/ui/traits/const-traits/specializing-constness.rs @@ -1,4 +1,4 @@ -#![feature(const_trait_impl, effects, min_specialization, rustc_attrs)] //~ WARN the feature `effects` is incomplete +#![feature(const_trait_impl, min_specialization, rustc_attrs)] #[rustc_specialization_trait] #[const_trait] @@ -22,7 +22,7 @@ impl<T: ~const Spec> const A for T { impl<T: Spec + Sup> A for T { //~^ ERROR: cannot specialize -//FIXME(effects) ~| ERROR: missing `~const` qualifier +//FIXME(const_trait_impl) ~| ERROR: missing `~const` qualifier fn a() -> u32 { 3 } diff --git a/tests/ui/traits/const-traits/specializing-constness.stderr b/tests/ui/traits/const-traits/specializing-constness.stderr index e8c4fb0f0c7..21e21c2cb71 100644 --- a/tests/ui/traits/const-traits/specializing-constness.stderr +++ b/tests/ui/traits/const-traits/specializing-constness.stderr @@ -1,22 +1,8 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/specializing-constness.rs:1:30 - | -LL | #![feature(const_trait_impl, effects, min_specialization, rustc_attrs)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -error: using `#![feature(effects)]` without enabling next trait solver globally - | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable - error: cannot specialize on const impl with non-const impl --> $DIR/specializing-constness.rs:23:1 | LL | impl<T: Spec + Sup> A for T { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/staged-api-user-crate.rs b/tests/ui/traits/const-traits/staged-api-user-crate.rs index c4ecb8f67a1..7587042cf27 100644 --- a/tests/ui/traits/const-traits/staged-api-user-crate.rs +++ b/tests/ui/traits/const-traits/staged-api-user-crate.rs @@ -10,7 +10,7 @@ fn non_const_context() { const fn stable_const_context() { Unstable::func(); - //~^ ERROR cannot call non-const fn `<staged_api::Unstable as staged_api::MyTrait>::func` in constant functions + //~^ ERROR cannot call conditionally-const associated function `<staged_api::Unstable as staged_api::MyTrait>::func` in constant functions } fn main() {} diff --git a/tests/ui/traits/const-traits/staged-api-user-crate.stderr b/tests/ui/traits/const-traits/staged-api-user-crate.stderr index 781191ec97c..bf7466b8e16 100644 --- a/tests/ui/traits/const-traits/staged-api-user-crate.stderr +++ b/tests/ui/traits/const-traits/staged-api-user-crate.stderr @@ -1,15 +1,13 @@ -error[E0015]: cannot call non-const fn `<staged_api::Unstable as staged_api::MyTrait>::func` in constant functions +error[E0658]: cannot call conditionally-const associated function `<staged_api::Unstable as staged_api::MyTrait>::func` in constant functions --> $DIR/staged-api-user-crate.rs:12:5 | LL | Unstable::func(); | ^^^^^^^^^^^^^^^^ | - = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | + = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0015`. +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/traits/const-traits/staged-api.rs b/tests/ui/traits/const-traits/staged-api.rs index f87e723472a..755a4e456bc 100644 --- a/tests/ui/traits/const-traits/staged-api.rs +++ b/tests/ui/traits/const-traits/staged-api.rs @@ -1,10 +1,11 @@ -//@ revisions: stable unstable +//! Checks whether we are properly enforcing recursive const stability for trait calls. //@ compile-flags: -Znext-solver -#![cfg_attr(unstable, feature(unstable))] // The feature from the ./auxiliary/staged-api.rs file. -#![feature(const_trait_impl, effects)] -#![allow(incomplete_features)] +#![feature(unstable)] // The feature from the ./auxiliary/staged-api.rs file. +#![feature(local_feature)] +#![feature(const_trait_impl)] #![feature(staged_api)] +#![feature(rustc_allow_const_fn_unstable)] #![stable(feature = "rust1", since = "1.0.0")] //@ aux-build: staged-api.rs @@ -16,13 +17,16 @@ use staged_api::*; pub struct Foo; #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(unstable, rustc_const_unstable(feature = "foo", issue = "none"))] -#[cfg_attr(stable, rustc_const_stable(feature = "foo", since = "1.0.0"))] +#[rustc_const_unstable(feature = "local_feature", issue = "none")] impl const MyTrait for Foo { - //[stable]~^ ERROR trait implementations cannot be const stable yet fn func() {} } +#[rustc_allow_const_fn_unstable(const_trait_impl)] +const fn conditionally_const<T: ~const MyTrait>() { + T::func(); +} + // Const stability has no impact on usage in non-const contexts. fn non_const_context() { Unstable::func(); @@ -32,32 +36,35 @@ fn non_const_context() { #[unstable(feature = "none", issue = "none")] const fn const_context() { Unstable::func(); - //[stable]~^ ERROR not yet stable as a const fn + //~^ ERROR cannot use `#[feature(const_trait_impl)]` Foo::func(); - //[unstable]~^ ERROR not yet stable as a const fn - // ^ fails, because the `foo` feature is not active + //~^ ERROR cannot use `#[feature(const_trait_impl)]` + Unstable2::func(); + //~^ ERROR cannot use `#[feature(const_trait_impl)]` + conditionally_const::<Foo>(); + //~^ ERROR cannot use `#[feature(const_trait_impl)]` } #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(unstable, rustc_const_unstable(feature = "foo", issue = "none"))] +#[rustc_const_unstable(feature = "local_feature", issue = "none")] pub const fn const_context_not_const_stable() { - //[stable]~^ ERROR function has missing const stability attribute Unstable::func(); - //[stable]~^ ERROR not yet stable as a const fn Foo::func(); - //[unstable]~^ ERROR not yet stable as a const fn - // ^ fails, because the `foo` feature is not active + Unstable2::func(); + conditionally_const::<Foo>(); } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "cheese", since = "1.0.0")] const fn stable_const_context() { Unstable::func(); - //~^ ERROR not yet stable as a const fn + //~^ ERROR cannot use `#[feature(const_trait_impl)]` Foo::func(); - //[unstable]~^ ERROR not yet stable as a const fn - const_context_not_const_stable() - //[unstable]~^ ERROR not yet stable as a const fn + //~^ ERROR cannot use `#[feature(const_trait_impl)]` + const_context_not_const_stable(); + //~^ ERROR cannot use `#[feature(local_feature)]` + conditionally_const::<Foo>(); + //~^ ERROR cannot use `#[feature(const_trait_impl)]` } fn main() {} diff --git a/tests/ui/traits/const-traits/staged-api.stable.stderr b/tests/ui/traits/const-traits/staged-api.stable.stderr deleted file mode 100644 index 6c07a253f5b..00000000000 --- a/tests/ui/traits/const-traits/staged-api.stable.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error: trait implementations cannot be const stable yet - --> $DIR/staged-api.rs:21:1 - | -LL | / impl const MyTrait for Foo { -LL | | -LL | | fn func() {} -LL | | } - | |_^ - | - = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information - -error: function has missing const stability attribute - --> $DIR/staged-api.rs:43:1 - | -LL | / pub const fn const_context_not_const_stable() { -LL | | -LL | | Unstable::func(); -LL | | -... | -LL | | // ^ fails, because the `foo` feature is not active -LL | | } - | |_^ - -error: `<staged_api::Unstable as staged_api::MyTrait>::func` is not yet stable as a const fn - --> $DIR/staged-api.rs:34:5 - | -LL | Unstable::func(); - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(unstable)]` to the crate attributes to enable - -error: `<staged_api::Unstable as staged_api::MyTrait>::func` is not yet stable as a const fn - --> $DIR/staged-api.rs:45:5 - | -LL | Unstable::func(); - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(unstable)]` to the crate attributes to enable - -error: `<staged_api::Unstable as staged_api::MyTrait>::func` is not yet stable as a const fn - --> $DIR/staged-api.rs:55:5 - | -LL | Unstable::func(); - | ^^^^^^^^^^^^^^^^ - | - = help: const-stable functions can only call other const-stable functions - -error: aborting due to 5 previous errors - diff --git a/tests/ui/traits/const-traits/staged-api.stderr b/tests/ui/traits/const-traits/staged-api.stderr new file mode 100644 index 00000000000..29aafa4e0f3 --- /dev/null +++ b/tests/ui/traits/const-traits/staged-api.stderr @@ -0,0 +1,139 @@ +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]` + --> $DIR/staged-api.rs:38:5 + | +LL | Unstable::func(); + | ^^^^^^^^^^^^^^^^ + | +help: if the function is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn const_context() { + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(const_trait_impl)] +LL | const fn const_context() { + | + +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]` + --> $DIR/staged-api.rs:40:5 + | +LL | Foo::func(); + | ^^^^^^^^^^^ + | +help: if the function is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn const_context() { + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(const_trait_impl)] +LL | const fn const_context() { + | + +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]` + --> $DIR/staged-api.rs:42:5 + | +LL | Unstable2::func(); + | ^^^^^^^^^^^^^^^^^ + | +help: if the function is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn const_context() { + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(const_trait_impl)] +LL | const fn const_context() { + | + +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]` + --> $DIR/staged-api.rs:44:5 + | +LL | conditionally_const::<Foo>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: if the function is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn const_context() { + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(const_trait_impl)] +LL | const fn const_context() { + | + +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]` + --> $DIR/staged-api.rs:60:5 + | +LL | Unstable::func(); + | ^^^^^^^^^^^^^^^^ + | +help: if the function is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn stable_const_context() { + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(const_trait_impl)] +LL | const fn stable_const_context() { + | + +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]` + --> $DIR/staged-api.rs:62:5 + | +LL | Foo::func(); + | ^^^^^^^^^^^ + | +help: if the function is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn stable_const_context() { + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(const_trait_impl)] +LL | const fn stable_const_context() { + | + +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(local_feature)]` + --> $DIR/staged-api.rs:64:5 + | +LL | const_context_not_const_stable(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features +help: if the caller is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn stable_const_context() { + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(local_feature)] +LL | const fn stable_const_context() { + | + +error: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]` + --> $DIR/staged-api.rs:66:5 + | +LL | conditionally_const::<Foo>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: if the function is not (yet) meant to be exposed to stable, add `#[rustc_const_unstable]` (this is what you probably want to do) + | +LL + #[rustc_const_unstable(feature = "...", issue = "...")] +LL | const fn stable_const_context() { + | +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) + | +LL + #[rustc_allow_const_fn_unstable(const_trait_impl)] +LL | const fn stable_const_context() { + | + +error: aborting due to 8 previous errors + diff --git a/tests/ui/traits/const-traits/staged-api.unstable.stderr b/tests/ui/traits/const-traits/staged-api.unstable.stderr deleted file mode 100644 index 1c772f13dd5..00000000000 --- a/tests/ui/traits/const-traits/staged-api.unstable.stderr +++ /dev/null @@ -1,42 +0,0 @@ -error: `<Foo as staged_api::MyTrait>::func` is not yet stable as a const fn - --> $DIR/staged-api.rs:36:5 - | -LL | Foo::func(); - | ^^^^^^^^^^^ - | - = help: add `#![feature(foo)]` to the crate attributes to enable - -error: `<Foo as staged_api::MyTrait>::func` is not yet stable as a const fn - --> $DIR/staged-api.rs:47:5 - | -LL | Foo::func(); - | ^^^^^^^^^^^ - | - = help: add `#![feature(foo)]` to the crate attributes to enable - -error: `<staged_api::Unstable as staged_api::MyTrait>::func` is not yet stable as a const fn - --> $DIR/staged-api.rs:55:5 - | -LL | Unstable::func(); - | ^^^^^^^^^^^^^^^^ - | - = help: const-stable functions can only call other const-stable functions - -error: `<Foo as staged_api::MyTrait>::func` is not yet stable as a const fn - --> $DIR/staged-api.rs:57:5 - | -LL | Foo::func(); - | ^^^^^^^^^^^ - | - = help: const-stable functions can only call other const-stable functions - -error: `const_context_not_const_stable` is not yet stable as a const fn - --> $DIR/staged-api.rs:59:5 - | -LL | const_context_not_const_stable() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: const-stable functions can only call other const-stable functions - -error: aborting due to 5 previous errors - diff --git a/tests/ui/traits/const-traits/std-impl-gate.gated.stderr b/tests/ui/traits/const-traits/std-impl-gate.gated.stderr index d761fdce4bf..f3b17130761 100644 --- a/tests/ui/traits/const-traits/std-impl-gate.gated.stderr +++ b/tests/ui/traits/const-traits/std-impl-gate.gated.stderr @@ -11,10 +11,6 @@ LL | Default::default() | ^^^^^^^^^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(effects)]` to the crate attributes to enable - | -LL + #![feature(effects)] - | error: aborting due to 2 previous errors diff --git a/tests/ui/traits/const-traits/std-impl-gate.stock.stderr b/tests/ui/traits/const-traits/std-impl-gate.stock.stderr index b63ea695fc2..7240b5f4a94 100644 --- a/tests/ui/traits/const-traits/std-impl-gate.stock.stderr +++ b/tests/ui/traits/const-traits/std-impl-gate.stock.stderr @@ -5,10 +5,6 @@ LL | Default::default() | ^^^^^^^^^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr b/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr index 48bb1907be2..e7f54b4c5bd 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr @@ -1,36 +1,45 @@ error: `~const` is not allowed here - --> $DIR/super-traits-fail-2.rs:12:12 + --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} | ^^^^^^ | note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds - --> $DIR/super-traits-fail-2.rs:12:1 + --> $DIR/super-traits-fail-2.rs:11:1 | LL | trait Bar: ~const Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-2.rs:12:19 + --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-2.rs:12:19 + --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-2.rs:12:19 + --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 4 previous errors +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-2.rs:20:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr b/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr index a0848fe520e..a09fe81f716 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr @@ -1,40 +1,49 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-2.rs:12:19 + --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-2.rs:12:19 + --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-2.rs:12:19 + --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-2.rs:12:19 + --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-2.rs:12:19 + --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 5 previous errors +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-2.rs:20:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 6 previous errors +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-2.rs b/tests/ui/traits/const-traits/super-traits-fail-2.rs index 0ea61f4ae20..53a84bcdd1b 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-2.rs +++ b/tests/ui/traits/const-traits/super-traits-fail-2.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] //@ revisions: yy yn ny nn #[cfg_attr(any(yy, yn), const_trait)] @@ -20,6 +19,7 @@ trait Bar: ~const Foo {} const fn foo<T: Bar>(x: &T) { x.a(); //[yy,yn]~^ ERROR the trait bound `T: ~const Foo` + //[nn,ny]~^^ ERROR cannot call non-const fn `<T as Foo>::a` in constant functions } fn main() {} diff --git a/tests/ui/traits/const-traits/super-traits-fail-2.yn.stderr b/tests/ui/traits/const-traits/super-traits-fail-2.yn.stderr index ec6ca107289..01ae209016a 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-2.yn.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-2.yn.stderr @@ -1,17 +1,17 @@ error: `~const` is not allowed here - --> $DIR/super-traits-fail-2.rs:12:12 + --> $DIR/super-traits-fail-2.rs:11:12 | LL | trait Bar: ~const Foo {} | ^^^^^^ | note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds - --> $DIR/super-traits-fail-2.rs:12:1 + --> $DIR/super-traits-fail-2.rs:11:1 | LL | trait Bar: ~const Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: ~const Foo` is not satisfied - --> $DIR/super-traits-fail-2.rs:21:5 + --> $DIR/super-traits-fail-2.rs:20:5 | LL | x.a(); | ^^^^^ diff --git a/tests/ui/traits/const-traits/super-traits-fail-2.yy.stderr b/tests/ui/traits/const-traits/super-traits-fail-2.yy.stderr index 3fa6256abc3..ae4c65e4aee 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-2.yy.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-2.yy.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `T: ~const Foo` is not satisfied - --> $DIR/super-traits-fail-2.rs:21:5 + --> $DIR/super-traits-fail-2.rs:20:5 | LL | x.a(); | ^^^^^ diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nn.stderr index 294545014bf..599b8c826f7 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-3.nn.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-3.nn.stderr @@ -1,50 +1,59 @@ error: `~const` is not allowed here - --> $DIR/super-traits-fail-3.rs:14:12 + --> $DIR/super-traits-fail-3.rs:13:12 | LL | trait Bar: ~const Foo {} | ^^^^^^ | note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds - --> $DIR/super-traits-fail-3.rs:14:1 + --> $DIR/super-traits-fail-3.rs:13:1 | LL | trait Bar: ~const Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:14:19 + --> $DIR/super-traits-fail-3.rs:13:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:14:19 + --> $DIR/super-traits-fail-3.rs:13:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:14:19 + --> $DIR/super-traits-fail-3.rs:13:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:22:24 + --> $DIR/super-traits-fail-3.rs:21:17 | LL | const fn foo<T: ~const Bar>(x: &T) { - | ^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:22:24 + --> $DIR/super-traits-fail-3.rs:21:17 | LL | const fn foo<T: ~const Bar>(x: &T) { - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 6 previous errors +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-3.rs:24:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 7 previous errors +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr index 54bb6c5ca44..a880c2a2206 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr @@ -1,40 +1,49 @@ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:14:19 + --> $DIR/super-traits-fail-3.rs:13:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:14:19 + --> $DIR/super-traits-fail-3.rs:13:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:14:19 + --> $DIR/super-traits-fail-3.rs:13:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:14:19 + --> $DIR/super-traits-fail-3.rs:13:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:14:19 + --> $DIR/super-traits-fail-3.rs:13:12 | LL | trait Bar: ~const Foo {} - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 5 previous errors +error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions + --> $DIR/super-traits-fail-3.rs:24:7 + | +LL | x.a(); + | ^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 6 previous errors +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.rs b/tests/ui/traits/const-traits/super-traits-fail-3.rs index a9b08e6edcd..bd95ae8d96a 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-3.rs +++ b/tests/ui/traits/const-traits/super-traits-fail-3.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] //@ revisions: yy yn ny nn //@[yy] check-pass @@ -24,6 +23,7 @@ const fn foo<T: ~const Bar>(x: &T) { //[yn,nn]~| ERROR: `~const` can only be applied to `#[const_trait]` x.a(); //[yn]~^ ERROR: the trait bound `T: ~const Foo` is not satisfied + //[nn,ny]~^^ ERROR: cannot call non-const fn `<T as Foo>::a` in constant functions } fn main() {} diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.yn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.yn.stderr index b6747d10e83..8fcada1bfd1 100644 --- a/tests/ui/traits/const-traits/super-traits-fail-3.yn.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail-3.yn.stderr @@ -1,31 +1,31 @@ error: `~const` is not allowed here - --> $DIR/super-traits-fail-3.rs:14:12 + --> $DIR/super-traits-fail-3.rs:13:12 | LL | trait Bar: ~const Foo {} | ^^^^^^ | note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds - --> $DIR/super-traits-fail-3.rs:14:1 + --> $DIR/super-traits-fail-3.rs:13:1 | LL | trait Bar: ~const Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:22:24 + --> $DIR/super-traits-fail-3.rs:21:17 | LL | const fn foo<T: ~const Bar>(x: &T) { - | ^^^ + | ^^^^^^ error: `~const` can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:22:24 + --> $DIR/super-traits-fail-3.rs:21:17 | LL | const fn foo<T: ~const Bar>(x: &T) { - | ^^^ + | ^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0277]: the trait bound `T: ~const Foo` is not satisfied - --> $DIR/super-traits-fail-3.rs:25:5 + --> $DIR/super-traits-fail-3.rs:24:5 | LL | x.a(); | ^^^^^ diff --git a/tests/ui/traits/const-traits/super-traits-fail.rs b/tests/ui/traits/const-traits/super-traits-fail.rs index c07619fbf62..9fd6263118b 100644 --- a/tests/ui/traits/const-traits/super-traits-fail.rs +++ b/tests/ui/traits/const-traits/super-traits-fail.rs @@ -1,7 +1,6 @@ //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Foo { diff --git a/tests/ui/traits/const-traits/super-traits-fail.stderr b/tests/ui/traits/const-traits/super-traits-fail.stderr index 7a734a6c9f1..1f453edf035 100644 --- a/tests/ui/traits/const-traits/super-traits-fail.stderr +++ b/tests/ui/traits/const-traits/super-traits-fail.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `S: ~const Foo` is not satisfied - --> $DIR/super-traits-fail.rs:18:20 + --> $DIR/super-traits-fail.rs:17:20 | LL | impl const Bar for S {} | ^ diff --git a/tests/ui/traits/const-traits/super-traits.rs b/tests/ui/traits/const-traits/super-traits.rs index ff7349bba3c..73ddc037cd7 100644 --- a/tests/ui/traits/const-traits/super-traits.rs +++ b/tests/ui/traits/const-traits/super-traits.rs @@ -1,7 +1,6 @@ //@ check-pass //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Foo { diff --git a/tests/ui/traits/const-traits/tilde-const-and-const-params.rs b/tests/ui/traits/const-traits/tilde-const-and-const-params.rs index f6a7c7c1746..706c77b6200 100644 --- a/tests/ui/traits/const-traits/tilde-const-and-const-params.rs +++ b/tests/ui/traits/const-traits/tilde-const-and-const-params.rs @@ -1,4 +1,4 @@ -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #![feature(generic_arg_infer)] #![feature(generic_const_exprs)] #![allow(incomplete_features)] @@ -8,6 +8,7 @@ struct Foo<const N: usize>; impl<const N: usize> Foo<N> { fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> { //~^ ERROR `~const` is not allowed here + //~| ERROR the trait bound `A: const Add42` is not satisfied Foo } } @@ -25,6 +26,7 @@ impl const Add42 for () { fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> { //~^ ERROR `~const` is not allowed here + //~| ERROR the trait bound `A: const Add42` is not satisfied Foo } diff --git a/tests/ui/traits/const-traits/tilde-const-and-const-params.stderr b/tests/ui/traits/const-traits/tilde-const-and-const-params.stderr index 84a425f6791..78bf85e9c6d 100644 --- a/tests/ui/traits/const-traits/tilde-const-and-const-params.stderr +++ b/tests/ui/traits/const-traits/tilde-const-and-const-params.stderr @@ -11,21 +11,29 @@ LL | fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> { | ^^^ error: `~const` is not allowed here - --> $DIR/tilde-const-and-const-params.rs:26:11 + --> $DIR/tilde-const-and-const-params.rs:27:11 | LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> { | ^^^^^^ | note: this function is not `const`, so it cannot have `~const` trait bounds - --> $DIR/tilde-const-and-const-params.rs:26:4 + --> $DIR/tilde-const-and-const-params.rs:27:4 | LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> { | ^^^ -error: using `#![feature(effects)]` without enabling next trait solver globally +error[E0277]: the trait bound `A: const Add42` is not satisfied + --> $DIR/tilde-const-and-const-params.rs:27:61 | - = note: the next trait solver must be enabled globally for the effects feature to work correctly - = help: use `-Znext-solver` to enable +LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> { + | ^^^^^^^^^ + +error[E0277]: the trait bound `A: const Add42` is not satisfied + --> $DIR/tilde-const-and-const-params.rs:9:44 + | +LL | fn add<A: ~const Add42>(self) -> Foo<{ A::add(N) }> { + | ^^^^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/const-traits/tilde-const-assoc-fn-in-trait-impl.rs b/tests/ui/traits/const-traits/tilde-const-assoc-fn-in-trait-impl.rs index 8e7202ecaa1..73b2bdc4e3f 100644 --- a/tests/ui/traits/const-traits/tilde-const-assoc-fn-in-trait-impl.rs +++ b/tests/ui/traits/const-traits/tilde-const-assoc-fn-in-trait-impl.rs @@ -1,8 +1,7 @@ // Regression test for issue #119700. //@ check-pass //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Main { diff --git a/tests/ui/traits/const-traits/tilde-const-in-struct-args.rs b/tests/ui/traits/const-traits/tilde-const-in-struct-args.rs index 4722be955e9..e7ec3d31eb9 100644 --- a/tests/ui/traits/const-traits/tilde-const-in-struct-args.rs +++ b/tests/ui/traits/const-traits/tilde-const-in-struct-args.rs @@ -2,7 +2,7 @@ //@ known-bug: #132067 //@ check-pass -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] struct S; #[const_trait] diff --git a/tests/ui/traits/const-traits/tilde-const-in-struct-args.stderr b/tests/ui/traits/const-traits/tilde-const-in-struct-args.stderr deleted file mode 100644 index a9759f10d06..00000000000 --- a/tests/ui/traits/const-traits/tilde-const-in-struct-args.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/tilde-const-in-struct-args.rs:5:30 - | -LL | #![feature(const_trait_impl, effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/const-traits/tilde-const-inherent-assoc-const-fn.rs b/tests/ui/traits/const-traits/tilde-const-inherent-assoc-const-fn.rs index 71c5d8366b2..0e010695587 100644 --- a/tests/ui/traits/const-traits/tilde-const-inherent-assoc-const-fn.rs +++ b/tests/ui/traits/const-traits/tilde-const-inherent-assoc-const-fn.rs @@ -1,7 +1,6 @@ //@ check-pass //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Foo { diff --git a/tests/ui/traits/const-traits/tilde-const-trait-assoc-tys.rs b/tests/ui/traits/const-traits/tilde-const-trait-assoc-tys.rs index 254cf2200d8..53ddb5c0cdf 100644 --- a/tests/ui/traits/const-traits/tilde-const-trait-assoc-tys.rs +++ b/tests/ui/traits/const-traits/tilde-const-trait-assoc-tys.rs @@ -1,12 +1,9 @@ //@ check-pass //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Trait { - // FIXME(effects): `~const` bounds in trait associated types (excluding associated type bounds) - // don't look super useful. Should we forbid them again? type Assoc<T: ~const Bound>; } diff --git a/tests/ui/traits/const-traits/trait-default-body-stability.rs b/tests/ui/traits/const-traits/trait-default-body-stability.rs index b36e9535ca1..5f7486eb176 100644 --- a/tests/ui/traits/const-traits/trait-default-body-stability.rs +++ b/tests/ui/traits/const-traits/trait-default-body-stability.rs @@ -2,7 +2,7 @@ //@ compile-flags: -Znext-solver #![allow(incomplete_features)] #![feature(staged_api)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #![feature(const_t_try)] #![feature(const_try)] #![feature(try_trait_v2)] diff --git a/tests/ui/traits/const-traits/trait-default-body-stability.stderr b/tests/ui/traits/const-traits/trait-default-body-stability.stderr index 49fbef9aaa2..5806b6d6fd2 100644 --- a/tests/ui/traits/const-traits/trait-default-body-stability.stderr +++ b/tests/ui/traits/const-traits/trait-default-body-stability.stderr @@ -16,5 +16,22 @@ LL | impl const FromResidual for T { = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const` = note: adding a non-const method body in the future would be a breaking change -error: aborting due to 2 previous errors +error[E0015]: `?` cannot determine the branch of `T` in constant functions + --> $DIR/trait-default-body-stability.rs:45:9 + | +LL | T? + | ^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error[E0015]: `?` cannot convert from residual of `T` in constant functions + --> $DIR/trait-default-body-stability.rs:45:9 + | +LL | T? + | ^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/traits/const-traits/trait-where-clause-const.rs b/tests/ui/traits/const-traits/trait-where-clause-const.rs index 61e2bc38426..6f281ca5718 100644 --- a/tests/ui/traits/const-traits/trait-where-clause-const.rs +++ b/tests/ui/traits/const-traits/trait-where-clause-const.rs @@ -4,8 +4,7 @@ // (`rustc_const_eval` instead of `rustc_hir_analysis`) Therefore one file as a // test is not enough. -#![feature(const_trait_impl, effects)] -#![allow(incomplete_features)] +#![feature(const_trait_impl)] #[const_trait] trait Bar {} diff --git a/tests/ui/traits/const-traits/trait-where-clause-const.stderr b/tests/ui/traits/const-traits/trait-where-clause-const.stderr index 30a7ef1fd0d..d7735ef282f 100644 --- a/tests/ui/traits/const-traits/trait-where-clause-const.stderr +++ b/tests/ui/traits/const-traits/trait-where-clause-const.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `T: ~const Bar` is not satisfied - --> $DIR/trait-where-clause-const.rs:22:5 + --> $DIR/trait-where-clause-const.rs:21:5 | LL | T::b(); | ^^^^^^ error[E0277]: the trait bound `T: ~const Bar` is not satisfied - --> $DIR/trait-where-clause-const.rs:24:5 + --> $DIR/trait-where-clause-const.rs:23:5 | LL | T::c::<T>(); | ^^^^^^^^^^^ diff --git a/tests/ui/traits/const-traits/trait-where-clause-run.rs b/tests/ui/traits/const-traits/trait-where-clause-run.rs index 2837c835429..2582a69acab 100644 --- a/tests/ui/traits/const-traits/trait-where-clause-run.rs +++ b/tests/ui/traits/const-traits/trait-where-clause-run.rs @@ -1,8 +1,7 @@ //@ run-pass //@ compile-flags: -Znext-solver -#![feature(const_trait_impl, effects)] -#![allow(incomplete_features)] +#![feature(const_trait_impl)] #[const_trait] trait Bar { diff --git a/tests/ui/traits/const-traits/trait-where-clause-self-referential.rs b/tests/ui/traits/const-traits/trait-where-clause-self-referential.rs index cb5cc924bfd..b6ac574a4fc 100644 --- a/tests/ui/traits/const-traits/trait-where-clause-self-referential.rs +++ b/tests/ui/traits/const-traits/trait-where-clause-self-referential.rs @@ -1,7 +1,6 @@ //@ check-pass //@ compile-flags: -Znext-solver -#![allow(incomplete_features)] -#![feature(const_trait_impl, effects)] +#![feature(const_trait_impl)] #[const_trait] trait Foo { diff --git a/tests/ui/traits/const-traits/unsatisfied-const-trait-bound.rs b/tests/ui/traits/const-traits/unsatisfied-const-trait-bound.rs index d336719f52e..6d19ef771af 100644 --- a/tests/ui/traits/const-traits/unsatisfied-const-trait-bound.rs +++ b/tests/ui/traits/const-traits/unsatisfied-const-trait-bound.rs @@ -2,7 +2,7 @@ // Ensure that we print unsatisfied always-const trait bounds as `const Trait` in diagnostics. //@ compile-flags: -Znext-solver -#![feature(const_trait_impl, effects, generic_const_exprs)] +#![feature(const_trait_impl, generic_const_exprs)] #![allow(incomplete_features)] fn require<T: const Trait>() {} @@ -24,10 +24,10 @@ fn main() { struct Container<const N: u32>; -// FIXME(effects): Somehow emit `the trait bound `T: const Trait` is not satisfied` here instead -// and suggest changing `Trait` to `const Trait`. +// FIXME(const_trait_impl): Somehow emit `the trait bound `T: const Trait` +// is not satisfied` here instead and suggest changing `Trait` to `const Trait`. fn accept0<T: Trait>(_: Container<{ T::make() }>) {} -// FIXME(effects): Instead of suggesting `+ const Trait`, suggest +// FIXME(const_trait_impl): Instead of suggesting `+ const Trait`, suggest // changing `~const Trait` to `const Trait`. const fn accept1<T: ~const Trait>(_: Container<{ T::make() }>) {} diff --git a/tests/ui/traits/const-traits/unsatisfied-const-trait-bound.stderr b/tests/ui/traits/const-traits/unsatisfied-const-trait-bound.stderr index e0cf062ad95..d04143fc464 100644 --- a/tests/ui/traits/const-traits/unsatisfied-const-trait-bound.stderr +++ b/tests/ui/traits/const-traits/unsatisfied-const-trait-bound.stderr @@ -1,8 +1,8 @@ error: `-Znext-solver=globally` and `generic_const_exprs` are incompatible, using them at the same time is not allowed - --> $DIR/unsatisfied-const-trait-bound.rs:5:39 + --> $DIR/unsatisfied-const-trait-bound.rs:5:30 | -LL | #![feature(const_trait_impl, effects, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ +LL | #![feature(const_trait_impl, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ | = help: remove one of these features @@ -28,7 +28,7 @@ note: required by a bound in `require` --> $DIR/unsatisfied-const-trait-bound.rs:8:15 | LL | fn require<T: const Trait>() {} - | ^^^^^^^^^^^ required by this bound in `require` + | ^^^^^ required by this bound in `require` error: aborting due to 4 previous errors diff --git a/tests/ui/traits/copy-impl-cannot-normalize.stderr b/tests/ui/traits/copy-impl-cannot-normalize.stderr index a98bb47f54f..3bdb8b70172 100644 --- a/tests/ui/traits/copy-impl-cannot-normalize.stderr +++ b/tests/ui/traits/copy-impl-cannot-normalize.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: TraitFoo` is not satisfied --> $DIR/copy-impl-cannot-normalize.rs:22:18 | LL | impl<T> Copy for Foo<T> {} - | ^^^^^^ the trait `TraitFoo` is not implemented for `T`, which is required by `Foo<T>: Clone` + | ^^^^^^ the trait `TraitFoo` is not implemented for `T` | note: required for `Foo<T>` to implement `Clone` --> $DIR/copy-impl-cannot-normalize.rs:12:9 diff --git a/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr index fecb05cade7..a5d0e6ab095 100644 --- a/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr +++ b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr @@ -8,7 +8,7 @@ error[E0277]: the trait bound `for<'a> &'a mut Vec<&'a u32>: Foo<'static, i32>` --> $DIR/dont-autoderef-ty-with-escaping-var.rs:17:6 | LL | <i32 as RefFoo<i32>>::ref_foo(unknown); - | ^^^ the trait `for<'a> Foo<'static, i32>` is not implemented for `&'a mut Vec<&'a u32>`, which is required by `i32: RefFoo<i32>` + | ^^^ the trait `for<'a> Foo<'static, i32>` is not implemented for `&'a mut Vec<&'a u32>` | help: this trait has no implementations, consider adding one --> $DIR/dont-autoderef-ty-with-escaping-var.rs:3:1 diff --git a/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.stderr b/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.stderr index 0666da4c707..5b89158b0db 100644 --- a/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.stderr +++ b/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.stderr @@ -20,10 +20,11 @@ error[E0277]: the trait bound `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:14: --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11 | LL | takes(|_: Argument| -> Return { todo!() }); - | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for closure `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11: 14:34}` + | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | | | required by a bound introduced by this call | + = help: the trait `Trait` is not implemented for closure `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11: 14:34}` = help: the trait `Trait` is implemented for fn pointer `fn(Argument) -> Return` note: required by a bound in `takes` --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:9:18 diff --git a/tests/ui/traits/ice-index-out-of-bounds-issue-117446.rs b/tests/ui/traits/ice-index-out-of-bounds-issue-117446.rs new file mode 100644 index 00000000000..fa31d8b820c --- /dev/null +++ b/tests/ui/traits/ice-index-out-of-bounds-issue-117446.rs @@ -0,0 +1,24 @@ +//@ check-fail +// +// Regression for https://github.com/rust-lang/rust/issues/117446 + +pub struct Repeated<T>(Vec<T>); + +trait Foo<'a> { + fn outer<D>() -> Option<()>; +} + +impl<'a, T> Foo<'a> for Repeated<T> { + fn outer() -> Option<()> { + //~^ ERROR associated function `outer` has 0 type parameters but its trait declaration has 1 type parameter [E0049] + //~^^ ERROR mismatched types [E0308] + fn inner<Q>(value: Option<()>) -> Repeated<Q> { + match value { + _ => Self(unimplemented!()), + //~^ ERROR can't reference `Self` constructor from outer item [E0401] + } + } + } +} + +fn main() {} diff --git a/tests/ui/traits/ice-index-out-of-bounds-issue-117446.stderr b/tests/ui/traits/ice-index-out-of-bounds-issue-117446.stderr new file mode 100644 index 00000000000..ad33a70ed3b --- /dev/null +++ b/tests/ui/traits/ice-index-out-of-bounds-issue-117446.stderr @@ -0,0 +1,33 @@ +error[E0049]: associated function `outer` has 0 type parameters but its trait declaration has 1 type parameter + --> $DIR/ice-index-out-of-bounds-issue-117446.rs:12:13 + | +LL | fn outer<D>() -> Option<()>; + | - expected 1 type parameter +... +LL | fn outer() -> Option<()> { + | ^ found 0 type parameters + +error[E0308]: mismatched types + --> $DIR/ice-index-out-of-bounds-issue-117446.rs:12:19 + | +LL | fn outer() -> Option<()> { + | ----- ^^^^^^^^^^ expected `Option<()>`, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression + | + = note: expected enum `Option<()>` + found unit type `()` + +error[E0401]: can't reference `Self` constructor from outer item + --> $DIR/ice-index-out-of-bounds-issue-117446.rs:17:22 + | +LL | impl<'a, T> Foo<'a> for Repeated<T> { + | ----------------------------------- the inner item doesn't inherit generics from this impl, so `Self` is invalid to reference +... +LL | _ => Self(unimplemented!()), + | ^^^^ help: replace `Self` with the actual type: `Repeated` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0049, E0308, E0401. +For more information about an error, try `rustc --explain E0049`. diff --git a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr index 17fced307ed..07edc4ede76 100644 --- a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr +++ b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr @@ -10,7 +10,7 @@ error[E0277]: the trait bound `NoClone: Magic` is not satisfied --> $DIR/supertrait-auto-trait.rs:16:23 | LL | let (a, b) = copy(NoClone); - | ---- ^^^^^^^ the trait `Copy` is not implemented for `NoClone`, which is required by `NoClone: Magic` + | ---- ^^^^^^^ the trait `Copy` is not implemented for `NoClone` | | | required by a bound introduced by this call | diff --git a/tests/ui/traits/issue-43784-supertrait.stderr b/tests/ui/traits/issue-43784-supertrait.stderr index 4c565c3fa1d..2bf365745a6 100644 --- a/tests/ui/traits/issue-43784-supertrait.stderr +++ b/tests/ui/traits/issue-43784-supertrait.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/issue-43784-supertrait.rs:8:22 | LL | impl<T> Complete for T {} - | ^ the trait `Copy` is not implemented for `T`, which is required by `T: Partial` + | ^ the trait `Copy` is not implemented for `T` | note: required for `T` to implement `Partial` --> $DIR/issue-43784-supertrait.rs:1:11 diff --git a/tests/ui/traits/issue-7013.stderr b/tests/ui/traits/issue-7013.stderr index 5067c7d7dd7..17493663172 100644 --- a/tests/ui/traits/issue-7013.stderr +++ b/tests/ui/traits/issue-7013.stderr @@ -4,7 +4,7 @@ error[E0277]: `Rc<RefCell<A>>` cannot be sent between threads safely LL | let a = A {v: Box::new(B{v: None}) as Box<dyn Foo + Send>}; | ^^^^^^^^^^^^^^^^^^^^ `Rc<RefCell<A>>` cannot be sent between threads safely | - = help: within `B`, the trait `Send` is not implemented for `Rc<RefCell<A>>`, which is required by `B: Send` + = help: within `B`, the trait `Send` is not implemented for `Rc<RefCell<A>>` note: required because it appears within the type `Option<Rc<RefCell<A>>>` --> $SRC_DIR/core/src/option.rs:LL:COL note: required because it appears within the type `B` diff --git a/tests/ui/traits/issue-71036.stderr b/tests/ui/traits/issue-71036.stderr index 35d543eb017..2452731f19f 100644 --- a/tests/ui/traits/issue-71036.stderr +++ b/tests/ui/traits/issue-71036.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `&'a T: Unsize<&'a U>` is not satisfied --> $DIR/issue-71036.rs:11:1 | LL | impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Foo<'a, U>> for Foo<'a, T> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unsize<&'a U>` is not implemented for `&'a T`, which is required by `&'a &'a T: DispatchFromDyn<&'a &'a U>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Unsize<&'a U>` is not implemented for `&'a T` | = note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information = note: required for `&'a &'a T` to implement `DispatchFromDyn<&'a &'a U>` diff --git a/tests/ui/traits/issue-71136.stderr b/tests/ui/traits/issue-71136.stderr index d37ad8ae34d..2c03c6bf08e 100644 --- a/tests/ui/traits/issue-71136.stderr +++ b/tests/ui/traits/issue-71136.stderr @@ -5,7 +5,7 @@ LL | #[derive(Clone)] | ----- in this derive macro expansion LL | struct FooHolster { LL | the_foos: Vec<Foo>, - | ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `Foo`, which is required by `Vec<Foo>: Clone` + | ^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `Foo` | = note: required for `Vec<Foo>` to implement `Clone` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/traits/issue-78372.rs b/tests/ui/traits/issue-78372.rs index b97835bbc57..82b13cc0b62 100644 --- a/tests/ui/traits/issue-78372.rs +++ b/tests/ui/traits/issue-78372.rs @@ -1,8 +1,8 @@ -use std::ops::DispatchFromDyn; //~ ERROR use of unstable library feature 'dispatch_from_dyn' +use std::ops::DispatchFromDyn; //~ ERROR use of unstable library feature `dispatch_from_dyn` struct Smaht<T, MISC>(PhantomData); //~ ERROR cannot find type `PhantomData` in this scope impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {} //~ ERROR cannot find type `U` in this scope //~^ ERROR cannot find type `MISC` in this scope -//~| ERROR use of unstable library feature 'dispatch_from_dyn' +//~| ERROR use of unstable library feature `dispatch_from_dyn` //~| ERROR the trait `DispatchFromDyn` may only be implemented for a coercion between structures trait Foo: X<u32> {} trait X<T> { diff --git a/tests/ui/traits/issue-78372.stderr b/tests/ui/traits/issue-78372.stderr index 9b93ffe8efb..4cc2c59fd8d 100644 --- a/tests/ui/traits/issue-78372.stderr +++ b/tests/ui/traits/issue-78372.stderr @@ -37,7 +37,7 @@ help: you might be missing a type parameter LL | impl<T, MISC> DispatchFromDyn<Smaht<U, MISC>> for T {} | ++++++ -error[E0658]: use of unstable library feature 'dispatch_from_dyn' +error[E0658]: use of unstable library feature `dispatch_from_dyn` --> $DIR/issue-78372.rs:1:5 | LL | use std::ops::DispatchFromDyn; @@ -46,7 +46,7 @@ LL | use std::ops::DispatchFromDyn; = help: add `#![feature(dispatch_from_dyn)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'dispatch_from_dyn' +error[E0658]: use of unstable library feature `dispatch_from_dyn` --> $DIR/issue-78372.rs:3:9 | LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {} diff --git a/tests/ui/traits/issue-91594.stderr b/tests/ui/traits/issue-91594.stderr index 726ee5b6146..13568179e81 100644 --- a/tests/ui/traits/issue-91594.stderr +++ b/tests/ui/traits/issue-91594.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Foo: HasComponent<()>` is not satisfied --> $DIR/issue-91594.rs:10:19 | LL | impl HasComponent<<Foo as Component<Foo>>::Interface> for Foo {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasComponent<()>` is not implemented for `Foo`, which is required by `Foo: Component<Foo>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasComponent<()>` is not implemented for `Foo` | = help: the trait `HasComponent<<Foo as Component<Foo>>::Interface>` is implemented for `Foo` note: required for `Foo` to implement `Component<Foo>` diff --git a/tests/ui/traits/issue-97576.stderr b/tests/ui/traits/issue-97576.stderr index bee254461f1..2c6cfd83b95 100644 --- a/tests/ui/traits/issue-97576.stderr +++ b/tests/ui/traits/issue-97576.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `String: From<impl ToString>` is not satisfied --> $DIR/issue-97576.rs:8:22 | LL | bar: bar.into(), - | ^^^^ the trait `From<impl ToString>` is not implemented for `String`, which is required by `impl ToString: Into<_>` + | ^^^^ the trait `From<impl ToString>` is not implemented for `String` | = note: required for `impl ToString` to implement `Into<String>` diff --git a/tests/ui/traits/negative-bounds/on-unimplemented.stderr b/tests/ui/traits/negative-bounds/on-unimplemented.stderr index 07483e788e5..ed473d57917 100644 --- a/tests/ui/traits/negative-bounds/on-unimplemented.stderr +++ b/tests/ui/traits/negative-bounds/on-unimplemented.stderr @@ -6,12 +6,6 @@ LL | fn hello() -> impl !Foo { LL | LL | NotFoo | ------ return type was inferred to be `NotFoo` here - | -help: this trait has no implementations, consider adding one - --> $DIR/on-unimplemented.rs:4:1 - | -LL | trait Foo {} - | ^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/traits/negative-bounds/simple.stderr b/tests/ui/traits/negative-bounds/simple.stderr index b8d12138794..499c19bb854 100644 --- a/tests/ui/traits/negative-bounds/simple.stderr +++ b/tests/ui/traits/negative-bounds/simple.stderr @@ -28,17 +28,11 @@ error[E0277]: the trait bound `Copyable: !Copy` is not satisfied LL | not_copy::<Copyable>(); | ^^^^^^^^ the trait bound `Copyable: !Copy` is not satisfied | - = help: the trait `Copy` is implemented for `Copyable` note: required by a bound in `not_copy` --> $DIR/simple.rs:3:16 | LL | fn not_copy<T: !Copy>() {} | ^^^^^ required by this bound in `not_copy` -help: consider annotating `Copyable` with `#[derive(Copy)]` - | -LL + #[derive(Copy)] -LL | struct Copyable; - | error[E0277]: the trait bound `NotNecessarilyCopyable: !Copy` is not satisfied --> $DIR/simple.rs:37:16 @@ -51,11 +45,6 @@ note: required by a bound in `not_copy` | LL | fn not_copy<T: !Copy>() {} | ^^^^^ required by this bound in `not_copy` -help: consider annotating `NotNecessarilyCopyable` with `#[derive(Copy)]` - | -LL + #[derive(Copy)] -LL | struct NotNecessarilyCopyable; - | error: aborting due to 4 previous errors diff --git a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr index 2a3833beb26..8f5b937e586 100644 --- a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr +++ b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr @@ -49,7 +49,7 @@ LL | is_send((8, TestType)); | | | required by a bound introduced by this call | - = help: within `({integer}, dummy1c::TestType)`, the trait `Send` is not implemented for `dummy1c::TestType`, which is required by `({integer}, dummy1c::TestType): Send` + = help: within `({integer}, dummy1c::TestType)`, the trait `Send` is not implemented for `dummy1c::TestType` = note: required because it appears within the type `({integer}, dummy1c::TestType)` note: required by a bound in `is_send` --> $DIR/negated-auto-traits-error.rs:16:15 @@ -87,7 +87,7 @@ LL | is_send(Box::new(Outer2(TestType))); | | | required by a bound introduced by this call | - = help: within `Outer2<dummy3::TestType>`, the trait `Send` is not implemented for `dummy3::TestType`, which is required by `Box<Outer2<dummy3::TestType>>: Send` + = help: within `Outer2<dummy3::TestType>`, the trait `Send` is not implemented for `dummy3::TestType` note: required because it appears within the type `Outer2<dummy3::TestType>` --> $DIR/negated-auto-traits-error.rs:12:8 | @@ -110,7 +110,7 @@ LL | is_sync(Outer2(TestType)); | | | required by a bound introduced by this call | - = help: the trait `Send` is not implemented for `main::TestType`, which is required by `Outer2<main::TestType>: Sync` + = help: the trait `Send` is not implemented for `main::TestType` note: required for `Outer2<main::TestType>` to implement `Sync` --> $DIR/negated-auto-traits-error.rs:14:22 | diff --git a/tests/ui/traits/next-solver/auto-with-drop_tracking_mir.fail.stderr b/tests/ui/traits/next-solver/auto-with-drop_tracking_mir.fail.stderr index c2029a5a1c8..55f52181ec9 100644 --- a/tests/ui/traits/next-solver/auto-with-drop_tracking_mir.fail.stderr +++ b/tests/ui/traits/next-solver/auto-with-drop_tracking_mir.fail.stderr @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely LL | is_send(foo()); | ^^^^^ future returned by `foo` is not `Send` | - = help: the trait `Sync` is not implemented for `NotSync`, which is required by `impl Future<Output = ()>: Send` + = help: the trait `Sync` is not implemented for `NotSync` note: future is not `Send` as this value is used across an await --> $DIR/auto-with-drop_tracking_mir.rs:16:11 | diff --git a/tests/ui/traits/next-solver/builtin-fn-must-return-sized.stderr b/tests/ui/traits/next-solver/builtin-fn-must-return-sized.stderr index b487ceef1d4..bb39d110777 100644 --- a/tests/ui/traits/next-solver/builtin-fn-must-return-sized.stderr +++ b/tests/ui/traits/next-solver/builtin-fn-must-return-sized.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t LL | foo::<fn() -> str, _>(None, ()); | ^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `fn() -> str`, the trait `Sized` is not implemented for `str`, which is required by `fn() -> str: Fn<_>` + = help: within `fn() -> str`, the trait `Sized` is not implemented for `str` = note: required because it appears within the type `fn() -> str` note: required by a bound in `foo` --> $DIR/builtin-fn-must-return-sized.rs:10:11 diff --git a/tests/ui/traits/next-solver/canonical/effect-var.rs b/tests/ui/traits/next-solver/canonical/effect-var.rs index d1e3e18cdc8..82dbde0413c 100644 --- a/tests/ui/traits/next-solver/canonical/effect-var.rs +++ b/tests/ui/traits/next-solver/canonical/effect-var.rs @@ -1,7 +1,6 @@ //@ compile-flags: -Znext-solver //@ check-pass -#![feature(effects)] //~ WARN the feature `effects` is incomplete #![feature(const_trait_impl)] #[const_trait] diff --git a/tests/ui/traits/next-solver/canonical/effect-var.stderr b/tests/ui/traits/next-solver/canonical/effect-var.stderr deleted file mode 100644 index 994228c51e5..00000000000 --- a/tests/ui/traits/next-solver/canonical/effect-var.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/effect-var.rs:4:12 - | -LL | #![feature(effects)] - | ^^^^^^^ - | - = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/next-solver/coroutine.rs b/tests/ui/traits/next-solver/coroutine.rs index bdc34842f6d..7f75f29e4b1 100644 --- a/tests/ui/traits/next-solver/coroutine.rs +++ b/tests/ui/traits/next-solver/coroutine.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Znext-solver +//@ compile-flags: -Znext-solver --diagnostic-width=300 //@ edition: 2021 //@ revisions: pass fail //@[pass] check-pass diff --git a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.with.stderr b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.with.stderr index a81229e5e35..9114bcadac0 100644 --- a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.with.stderr +++ b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.with.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `A<X>: Trait<_, _, _>` is not satisfied --> $DIR/incompleteness-unstable-result.rs:65:19 | LL | impls_trait::<A<X>, _, _, _>(); - | ^^^^ the trait `Trait<_, _, _>` is not implemented for `A<X>`, which is required by `A<X>: Trait<_, _, _>` + | ^^^^ the trait `Trait<_, _, _>` is not implemented for `A<X>` | = help: the trait `Trait<U, V, D>` is implemented for `A<T>` note: required for `A<X>` to implement `Trait<_, _, _>` diff --git a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.without.stderr b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.without.stderr index a81229e5e35..9114bcadac0 100644 --- a/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.without.stderr +++ b/tests/ui/traits/next-solver/cycles/coinduction/incompleteness-unstable-result.without.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `A<X>: Trait<_, _, _>` is not satisfied --> $DIR/incompleteness-unstable-result.rs:65:19 | LL | impls_trait::<A<X>, _, _, _>(); - | ^^^^ the trait `Trait<_, _, _>` is not implemented for `A<X>`, which is required by `A<X>: Trait<_, _, _>` + | ^^^^ the trait `Trait<_, _, _>` is not implemented for `A<X>` | = help: the trait `Trait<U, V, D>` is implemented for `A<T>` note: required for `A<X>` to implement `Trait<_, _, _>` diff --git a/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr index 9a18a58debd..a841618ec6f 100644 --- a/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr +++ b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `(): Foo` is not satisfied --> $DIR/point-at-failing-nested.rs:22:17 | LL | needs_foo::<()>(); - | ^^ the trait `Bar` is not implemented for `()`, which is required by `(): Foo` + | ^^ the trait `Bar` is not implemented for `()` | help: this trait has no implementations, consider adding one --> $DIR/point-at-failing-nested.rs:4:1 diff --git a/tests/ui/traits/next-solver/diagnostics/where-clause-doesnt-apply.stderr b/tests/ui/traits/next-solver/diagnostics/where-clause-doesnt-apply.stderr index ab1d4a56c02..29703679a86 100644 --- a/tests/ui/traits/next-solver/diagnostics/where-clause-doesnt-apply.stderr +++ b/tests/ui/traits/next-solver/diagnostics/where-clause-doesnt-apply.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `(): Foo` is not satisfied --> $DIR/where-clause-doesnt-apply.rs:18:15 | LL | needs_foo(()); - | --------- ^^ the trait `Bar` is not implemented for `()`, which is required by `(): Foo` + | --------- ^^ the trait `Bar` is not implemented for `()` | | | required by a bound introduced by this call | diff --git a/tests/ui/traits/next-solver/dyn-incompatibility.stderr b/tests/ui/traits/next-solver/dyn-incompatibility.stderr index 7f2c0646ef5..a720797efc4 100644 --- a/tests/ui/traits/next-solver/dyn-incompatibility.stderr +++ b/tests/ui/traits/next-solver/dyn-incompatibility.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied in `dyn Setup<From = T> --> $DIR/dyn-incompatibility.rs:12:12 | LL | copy::<dyn Setup<From=T>>(t) - | ^^^^^^^^^^^^^^^^^ within `dyn Setup<From = T>`, the trait `Copy` is not implemented for `T`, which is required by `dyn Setup<From = T>: Setup` + | ^^^^^^^^^^^^^^^^^ within `dyn Setup<From = T>`, the trait `Copy` is not implemented for `T` | = note: required because it appears within the type `dyn Setup<From = T>` note: required by a bound in `copy` @@ -35,7 +35,7 @@ error[E0277]: the trait bound `T: Copy` is not satisfied in `dyn Setup<From = T> --> $DIR/dyn-incompatibility.rs:12:5 | LL | copy::<dyn Setup<From=T>>(t) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `dyn Setup<From = T>`, the trait `Copy` is not implemented for `T`, which is required by `dyn Setup<From = T>: Setup` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `dyn Setup<From = T>`, the trait `Copy` is not implemented for `T` | = note: required because it appears within the type `dyn Setup<From = T>` help: consider restricting type parameter `T` diff --git a/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr b/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr index 65e7dd2ab34..1f319cc6743 100644 --- a/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr +++ b/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Clone` is not satisfied --> $DIR/global-cache-and-parallel-frontend.rs:15:17 | LL | #[derive(Clone, Eq)] - | ^^ the trait `Clone` is not implemented for `T`, which is required by `Struct<T>: PartialEq` + | ^^ the trait `Clone` is not implemented for `T` | note: required for `Struct<T>` to implement `PartialEq` --> $DIR/global-cache-and-parallel-frontend.rs:18:19 diff --git a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr index f7d5d6fcee4..f4deb169516 100644 --- a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr +++ b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr @@ -29,7 +29,7 @@ error[E0277]: `V` is not an iterator LL | bar(); | ^^^^^ `V` is not an iterator | - = help: the trait `Iterator` is not implemented for `V`, which is required by `V: IntoIterator` + = help: the trait `Iterator` is not implemented for `V` = note: required for `V` to implement `IntoIterator` note: required by a bound in `bar` --> $DIR/bad-sized-cond.rs:12:15 @@ -46,7 +46,7 @@ error[E0277]: the size for values of type `V` cannot be known at compilation tim LL | bar(); | ^^^^^ doesn't have a size known at compile-time | - = help: the trait `Sized` is not implemented for `V`, which is required by `V: IntoIterator` + = help: the trait `Sized` is not implemented for `V` = note: required for `V` to implement `IntoIterator` note: required by a bound in `bar` --> $DIR/bad-sized-cond.rs:12:15 diff --git a/tests/ui/traits/question-mark-result-err-mismatch.stderr b/tests/ui/traits/question-mark-result-err-mismatch.stderr index 0e0ae6d5990..bad325a6720 100644 --- a/tests/ui/traits/question-mark-result-err-mismatch.stderr +++ b/tests/ui/traits/question-mark-result-err-mismatch.stderr @@ -11,7 +11,7 @@ LL | | e; LL | | }) | |__________- this can't be annotated with `?` because it has type `Result<_, ()>` LL | .map(|()| "")?; - | ^ the trait `From<()>` is not implemented for `String`, which is required by `Result<String, String>: FromResidual<Result<Infallible, ()>>` + | ^ the trait `From<()>` is not implemented for `String` | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait = note: required for `Result<String, String>` to implement `FromResidual<Result<Infallible, ()>>` @@ -25,7 +25,7 @@ LL | let x = foo(); | ----- this has type `Result<_, String>` ... LL | .map_err(|_| ())?; - | ---------------^ the trait `From<()>` is not implemented for `String`, which is required by `Result<(), String>: FromResidual<Result<Infallible, ()>>` + | ---------------^ the trait `From<()>` is not implemented for `String` | | | this can't be annotated with `?` because it has type `Result<_, ()>` | @@ -50,7 +50,7 @@ LL | .ok_or_else(|| { LL | | "Couldn't split the test string"; | | - help: remove this semicolon LL | | })?; - | | -^ the trait `From<()>` is not implemented for `String`, which is required by `Result<String, String>: FromResidual<Result<Infallible, ()>>` + | | -^ the trait `From<()>` is not implemented for `String` | |__________| | this can't be annotated with `?` because it has type `Result<_, ()>` | diff --git a/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr index 28a0646a86b..8024ad28d5a 100644 --- a/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr +++ b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr @@ -6,7 +6,7 @@ LL | use_iterator(i); | | | required by a bound introduced by this call | - = help: the trait `Iterator` is not implemented for `&dyn IntoIterator<IntoIter = I, Item = i32>`, which is required by `&dyn IntoIterator<IntoIter = I, Item = i32>: IntoIterator` + = help: the trait `Iterator` is not implemented for `&dyn IntoIterator<IntoIter = I, Item = i32>` = note: required for `&dyn IntoIterator<IntoIter = I, Item = i32>` to implement `IntoIterator` note: required by a bound in `use_iterator` --> $DIR/dont-suggest-unsize-deref.rs:3:8 diff --git a/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr b/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr index 85d6cdf779b..f0957e5cd9f 100644 --- a/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr +++ b/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr @@ -6,7 +6,7 @@ LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter()) { | | | required by a bound introduced by this call | - = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>`, which is required by `&std::slice::Iter<'_, {integer}>: IntoIterator` + = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>` = note: required for `&std::slice::Iter<'_, {integer}>` to implement `IntoIterator` note: required by a bound in `std::iter::zip` --> $SRC_DIR/core/src/iter/adapters/zip.rs:LL:COL @@ -22,7 +22,7 @@ error[E0277]: `&std::slice::Iter<'_, {integer}>` is not an iterator LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&std::slice::Iter<'_, {integer}>` is not an iterator | - = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>`, which is required by `Zip<std::slice::Iter<'_, {integer}>, &std::slice::Iter<'_, {integer}>>: IntoIterator` + = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>` = help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` = note: required for `Zip<std::slice::Iter<'_, {integer}>, &std::slice::Iter<'_, {integer}>>` to implement `Iterator` = note: required for `Zip<std::slice::Iter<'_, {integer}>, &std::slice::Iter<'_, {integer}>>` to implement `IntoIterator` @@ -35,7 +35,7 @@ LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter().clone( | | | required by a bound introduced by this call | - = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>`, which is required by `&std::slice::Iter<'_, {integer}>: IntoIterator` + = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>` = note: required for `&std::slice::Iter<'_, {integer}>` to implement `IntoIterator` note: required by a bound in `std::iter::zip` --> $SRC_DIR/core/src/iter/adapters/zip.rs:LL:COL @@ -51,7 +51,7 @@ error[E0277]: `&std::slice::Iter<'_, {integer}>` is not an iterator LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter().clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&std::slice::Iter<'_, {integer}>` is not an iterator | - = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>`, which is required by `Zip<std::slice::Iter<'_, {integer}>, &std::slice::Iter<'_, {integer}>>: IntoIterator` + = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>` = help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` = note: required for `Zip<std::slice::Iter<'_, {integer}>, &std::slice::Iter<'_, {integer}>>` to implement `Iterator` = note: required for `Zip<std::slice::Iter<'_, {integer}>, &std::slice::Iter<'_, {integer}>>` to implement `IntoIterator` diff --git a/tests/ui/traits/suggest-dereferences/issue-39029.stderr b/tests/ui/traits/suggest-dereferences/issue-39029.stderr index 0eea6cbcc5a..fd45fa3cf74 100644 --- a/tests/ui/traits/suggest-dereferences/issue-39029.stderr +++ b/tests/ui/traits/suggest-dereferences/issue-39029.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied --> $DIR/issue-39029.rs:16:38 | LL | let _errors = TcpListener::bind(&bad); - | ----------------- ^^^ the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs`, which is required by `&NoToSocketAddrs: ToSocketAddrs` + | ----------------- ^^^ the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs` | | | required by a bound introduced by this call | diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.stderr b/tests/ui/traits/suggest-dereferences/root-obligation.stderr index 2f5e1c5b537..dafd3469b6f 100644 --- a/tests/ui/traits/suggest-dereferences/root-obligation.stderr +++ b/tests/ui/traits/suggest-dereferences/root-obligation.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `&char: Pattern` is not satisfied --> $DIR/root-obligation.rs:6:38 | LL | .filter(|c| "aeiou".contains(c)) - | -------- ^ the trait `Fn(char)` is not implemented for `char`, which is required by `&char: Pattern` + | -------- ^ the trait `Fn(char)` is not implemented for `char` | | | required by a bound introduced by this call | diff --git a/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr index d1d75625aba..d6033bc6baa 100644 --- a/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr +++ b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `TargetStruct: From<&{integer}>` is not satisfied --> $DIR/suggest-dereferencing-receiver-argument.rs:13:30 | LL | let _b: TargetStruct = a.into(); - | ^^^^ the trait `From<&{integer}>` is not implemented for `TargetStruct`, which is required by `&{integer}: Into<_>` + | ^^^^ the trait `From<&{integer}>` is not implemented for `TargetStruct` | = note: required for `&{integer}` to implement `Into<TargetStruct>` help: consider dereferencing here diff --git a/tests/ui/traits/unsend-future.stderr b/tests/ui/traits/unsend-future.stderr index 4462208cb49..25df3419794 100644 --- a/tests/ui/traits/unsend-future.stderr +++ b/tests/ui/traits/unsend-future.stderr @@ -4,7 +4,7 @@ error: future cannot be sent between threads safely LL | require_handler(handler) | ^^^^^^^ future returned by `handler` is not `Send` | - = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const i32`, which is required by `fn() -> impl Future<Output = ()> {handler}: Handler` + = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const i32` note: future is not `Send` as this value is used across an await --> $DIR/unsend-future.rs:15:14 | diff --git a/tests/ui/transmutability/assoc-bound.stderr b/tests/ui/transmutability/assoc-bound.stderr index 08d90894396..b3c7680bf29 100644 --- a/tests/ui/transmutability/assoc-bound.stderr +++ b/tests/ui/transmutability/assoc-bound.stderr @@ -2,8 +2,9 @@ error[E0277]: the trait bound `<T as A>::AssocA: TransmuteFrom<(), Assume { alig --> $DIR/assoc-bound.rs:16:19 | LL | type AssocB = T::AssocA; - | ^^^^^^^^^ the trait `TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not implemented for `<T as A>::AssocA` + | ^^^^^^^^^ unsatisfied trait bound | + = help: the trait `TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not implemented for `<T as A>::AssocA` note: required by a bound in `B::AssocB` --> $DIR/assoc-bound.rs:9:18 | diff --git a/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.rs b/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.rs index 07133aa5614..7fe2324698e 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.rs @@ -3,7 +3,7 @@ #![crate_type = "lib"] use std::mem::TransmuteFrom; -//~^ ERROR use of unstable library feature 'transmutability' [E0658] +//~^ ERROR use of unstable library feature `transmutability` [E0658] use std::mem::Assume; -//~^ ERROR use of unstable library feature 'transmutability' [E0658] +//~^ ERROR use of unstable library feature `transmutability` [E0658] diff --git a/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.stderr b/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.stderr index a2096cd53e5..e4ad720ff69 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.stderr +++ b/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'transmutability' +error[E0658]: use of unstable library feature `transmutability` --> $DIR/feature-missing.rs:5:5 | LL | use std::mem::TransmuteFrom; @@ -8,7 +8,7 @@ LL | use std::mem::TransmuteFrom; = help: add `#![feature(transmutability)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'transmutability' +error[E0658]: use of unstable library feature `transmutability` --> $DIR/feature-missing.rs:8:5 | LL | use std::mem::Assume; diff --git a/tests/ui/try-block/try-block-bad-type.stderr b/tests/ui/try-block/try-block-bad-type.stderr index e9e6255cd2a..c67ad762a83 100644 --- a/tests/ui/try-block/try-block-bad-type.stderr +++ b/tests/ui/try-block/try-block-bad-type.stderr @@ -2,12 +2,13 @@ error[E0277]: `?` couldn't convert the error to `TryFromSliceError` --> $DIR/try-block-bad-type.rs:7:16 | LL | Err("")?; - | -------^ the trait `From<&str>` is not implemented for `TryFromSliceError`, which is required by `Result<u32, TryFromSliceError>: FromResidual<Result<Infallible, &str>>` + | -------^ the trait `From<&str>` is not implemented for `TryFromSliceError` | | | this can't be annotated with `?` because it has type `Result<_, &str>` | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait - = help: the trait `From<Infallible>` is implemented for `TryFromSliceError` + = help: the trait `From<&str>` is not implemented for `TryFromSliceError` + but trait `From<Infallible>` is implemented for it = help: for that trait implementation, expected `Infallible`, found `&str` = note: required for `Result<u32, TryFromSliceError>` to implement `FromResidual<Result<Infallible, &str>>` diff --git a/tests/ui/try-trait/bad-interconversion.stderr b/tests/ui/try-trait/bad-interconversion.stderr index 82877baef3e..bb5e5646ad2 100644 --- a/tests/ui/try-trait/bad-interconversion.stderr +++ b/tests/ui/try-trait/bad-interconversion.stderr @@ -4,7 +4,7 @@ error[E0277]: `?` couldn't convert the error to `u8` LL | fn result_to_result() -> Result<u64, u8> { | --------------- expected `u8` because of this LL | Ok(Err(123_i32)?) - | ------------^ the trait `From<i32>` is not implemented for `u8`, which is required by `Result<u64, u8>: FromResidual<Result<Infallible, i32>>` + | ------------^ the trait `From<i32>` is not implemented for `u8` | | | this can't be annotated with `?` because it has type `Result<_, i32>` | @@ -67,7 +67,7 @@ LL | ControlFlow::Continue(Err("hello")?) | ^ this `?` produces `Result<Infallible, &str>`, which is incompatible with `ControlFlow<String>` | = help: the trait `FromResidual<Result<Infallible, &str>>` is not implemented for `ControlFlow<String>` - = help: the trait `FromResidual<ControlFlow<String, Infallible>>` is implemented for `ControlFlow<String>` + but trait `FromResidual<ControlFlow<String, Infallible>>` is implemented for it = help: for that trait implementation, expected `ControlFlow<String, Infallible>`, found `Result<Infallible, &str>` error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow` @@ -79,7 +79,7 @@ LL | Some(3)?; | ^ this `?` produces `Option<Infallible>`, which is incompatible with `ControlFlow<u64>` | = help: the trait `FromResidual<Option<Infallible>>` is not implemented for `ControlFlow<u64>` - = help: the trait `FromResidual<ControlFlow<u64, Infallible>>` is implemented for `ControlFlow<u64>` + but trait `FromResidual<ControlFlow<u64, Infallible>>` is implemented for it = help: for that trait implementation, expected `ControlFlow<u64, Infallible>`, found `Option<Infallible>` error[E0277]: the `?` operator in a function that returns `ControlFlow<B, _>` can only be used on other `ControlFlow<B, _>`s (with the same Break type) @@ -90,9 +90,9 @@ LL | fn control_flow_to_control_flow() -> ControlFlow<i64> { LL | ControlFlow::Break(4_u8)?; | ^ this `?` produces `ControlFlow<u8, Infallible>`, which is incompatible with `ControlFlow<i64>` | - = help: the trait `FromResidual<ControlFlow<u8, Infallible>>` is not implemented for `ControlFlow<i64>` = note: unlike `Result`, there's no `From`-conversion performed for `ControlFlow` - = help: the trait `FromResidual<ControlFlow<i64, Infallible>>` is implemented for `ControlFlow<i64>` + = help: the trait `FromResidual<ControlFlow<u8, _>>` is not implemented for `ControlFlow<i64>` + but trait `FromResidual<ControlFlow<i64, _>>` is implemented for it = help: for that trait implementation, expected `i64`, found `u8` error: aborting due to 8 previous errors diff --git a/tests/ui/try-trait/issue-32709.stderr b/tests/ui/try-trait/issue-32709.stderr index 9b77f578437..475bd1ff3ac 100644 --- a/tests/ui/try-trait/issue-32709.stderr +++ b/tests/ui/try-trait/issue-32709.stderr @@ -4,7 +4,7 @@ error[E0277]: `?` couldn't convert the error to `()` LL | fn a() -> Result<i32, ()> { | --------------- expected `()` because of this LL | Err(5)?; - | ------^ the trait `From<{integer}>` is not implemented for `()`, which is required by `Result<i32, ()>: FromResidual<Result<Infallible, {integer}>>` + | ------^ the trait `From<{integer}>` is not implemented for `()` | | | this can't be annotated with `?` because it has type `Result<_, {integer}>` | diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage2.stderr b/tests/ui/type-alias-impl-trait/auto-trait-leakage2.stderr index 5c5506fb853..2ed918eca17 100644 --- a/tests/ui/type-alias-impl-trait/auto-trait-leakage2.stderr +++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage2.stderr @@ -9,7 +9,7 @@ LL | is_send(m::foo()); | | | required by a bound introduced by this call | - = help: within `Foo`, the trait `Send` is not implemented for `Rc<u32>`, which is required by `Foo: Send` + = help: within `Foo`, the trait `Send` is not implemented for `Rc<u32>` note: required because it appears within the type `Foo` --> $DIR/auto-trait-leakage2.rs:7:16 | diff --git a/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr b/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr index 0c937f92253..8f887a6ac68 100644 --- a/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr +++ b/tests/ui/type-alias-impl-trait/bounds-are-checked-2.stderr @@ -4,6 +4,16 @@ error[E0277]: the trait bound `T: Clone` is not satisfied LL | t | ^ the trait `Clone` is not implemented for `T` | +note: required by a bound in an opaque type + --> $DIR/bounds-are-checked-2.rs:7:26 + | +LL | pub type X<T> = impl Clone; + | ^^^^^ +note: this definition site has more where clauses than the opaque type + --> $DIR/bounds-are-checked-2.rs:9:5 + | +LL | fn f<T: Clone>(t: T) -> X<T> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider restricting type parameter `T` | LL | pub type X<T: std::clone::Clone> = impl Clone; diff --git a/tests/ui/type-alias-impl-trait/closure_wf_outlives.rs b/tests/ui/type-alias-impl-trait/closure_wf_outlives.rs index 430b444aae1..caa9b6d979a 100644 --- a/tests/ui/type-alias-impl-trait/closure_wf_outlives.rs +++ b/tests/ui/type-alias-impl-trait/closure_wf_outlives.rs @@ -12,20 +12,19 @@ // requires `'a: 'b` bound mod test1 { type Opaque<'a, 'b> = impl Sized + 'a + 'b; - //~^ ERROR lifetime bound not satisfied fn define<'a, 'b>() -> Opaque<'a, 'b> where 'a: 'b, { || {} + //~^ ERROR lifetime bound not satisfied } } // Same as the above but through indirection `'x` mod test2 { type Opaque<'a, 'b> = impl Sized + 'a + 'b; - //~^ ERROR cannot infer an appropriate lifetime fn define<'a, 'b, 'x>() -> Opaque<'a, 'b> where @@ -33,6 +32,7 @@ mod test2 { 'x: 'b, { || {} + //~^ ERROR cannot infer an appropriate lifetime } } @@ -52,13 +52,13 @@ mod test2_fixed { // requires `T: 'static` mod test3 { type Opaque<T> = impl Sized; - //~^ ERROR the parameter type `T` may not live long enough fn define<T>() -> Opaque<T> where T: 'static, { || {} + //~^ ERROR the parameter type `T` may not live long enough } } diff --git a/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr b/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr index 3484485e3fd..04288112fa8 100644 --- a/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr +++ b/tests/ui/type-alias-impl-trait/closure_wf_outlives.stderr @@ -1,8 +1,8 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/closure_wf_outlives.rs:14:27 + --> $DIR/closure_wf_outlives.rs:20:9 | -LL | type Opaque<'a, 'b> = impl Sized + 'a + 'b; - | ^^^^^^^^^^^^^^^^^^^^ +LL | || {} + | ^^^^^ | note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/closure_wf_outlives.rs:14:17 @@ -16,10 +16,10 @@ LL | type Opaque<'a, 'b> = impl Sized + 'a + 'b; | ^^ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/closure_wf_outlives.rs:27:27 + --> $DIR/closure_wf_outlives.rs:34:9 | -LL | type Opaque<'a, 'b> = impl Sized + 'a + 'b; - | ^^^^^^^^^^^^^^^^^^^^ +LL | || {} + | ^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/closure_wf_outlives.rs:27:17 @@ -27,32 +27,32 @@ note: first, the lifetime cannot outlive the lifetime `'a` as defined here... LL | type Opaque<'a, 'b> = impl Sized + 'a + 'b; | ^^ note: ...so that the declared lifetime parameter bounds are satisfied - --> $DIR/closure_wf_outlives.rs:27:27 + --> $DIR/closure_wf_outlives.rs:34:9 | -LL | type Opaque<'a, 'b> = impl Sized + 'a + 'b; - | ^^^^^^^^^^^^^^^^^^^^ +LL | || {} + | ^^^^^ note: but, the lifetime must be valid for the lifetime `'b` as defined here... --> $DIR/closure_wf_outlives.rs:27:21 | LL | type Opaque<'a, 'b> = impl Sized + 'a + 'b; | ^^ note: ...so that the declared lifetime parameter bounds are satisfied - --> $DIR/closure_wf_outlives.rs:27:27 + --> $DIR/closure_wf_outlives.rs:34:9 | -LL | type Opaque<'a, 'b> = impl Sized + 'a + 'b; - | ^^^^^^^^^^^^^^^^^^^^ +LL | || {} + | ^^^^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/closure_wf_outlives.rs:54:22 + --> $DIR/closure_wf_outlives.rs:60:9 | -LL | type Opaque<T> = impl Sized; - | ^^^^^^^^^^ - | | - | the parameter type `T` must be valid for the static lifetime... - | ...so that the type `T` will meet its required lifetime bounds... +LL | || {} + | ^^^^^ + | | + | the parameter type `T` must be valid for the static lifetime... + | ...so that the type `T` will meet its required lifetime bounds... | note: ...that is required by this bound - --> $DIR/closure_wf_outlives.rs:59:12 + --> $DIR/closure_wf_outlives.rs:58:12 | LL | T: 'static, | ^^^^^^^ diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr b/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr index c215d197db4..d96c86a2e6f 100644 --- a/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr +++ b/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr @@ -4,7 +4,8 @@ error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied LL | let x = <Foo as Trait<Bar>>::Assoc::default(); | ^^^ the trait `Trait<Bar>` is not implemented for `Foo` | - = help: the trait `Trait<()>` is implemented for `Foo` + = help: the trait `Trait<Bar>` is not implemented for `Foo` + but trait `Trait<()>` is implemented for it error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/escaping-bound-var.rs b/tests/ui/type-alias-impl-trait/escaping-bound-var.rs index 1ff200680be..07206dd2491 100644 --- a/tests/ui/type-alias-impl-trait/escaping-bound-var.rs +++ b/tests/ui/type-alias-impl-trait/escaping-bound-var.rs @@ -8,6 +8,7 @@ trait Test<'a> {} pub type Foo = impl for<'a> Trait<'a, Assoc = impl Test<'a>>; //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` +//~| ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` impl Trait<'_> for () { type Assoc = (); diff --git a/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr b/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr index 09f6fba79cf..c9f0618639a 100644 --- a/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr +++ b/tests/ui/type-alias-impl-trait/escaping-bound-var.stderr @@ -10,6 +10,18 @@ note: lifetime declared here LL | pub type Foo = impl for<'a> Trait<'a, Assoc = impl Test<'a>>; | ^^ -error: aborting due to 1 previous error +error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` + --> $DIR/escaping-bound-var.rs:9:57 + | +LL | pub type Foo = impl for<'a> Trait<'a, Assoc = impl Test<'a>>; + | ^^ + | +note: lifetime declared here + --> $DIR/escaping-bound-var.rs:9:25 + | +LL | pub type Foo = impl for<'a> Trait<'a, Assoc = impl Test<'a>>; + | ^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0657`. diff --git a/tests/ui/type-alias-impl-trait/fallback.stderr b/tests/ui/type-alias-impl-trait/fallback.stderr index 5250252a0da..c909ab66f0e 100644 --- a/tests/ui/type-alias-impl-trait/fallback.stderr +++ b/tests/ui/type-alias-impl-trait/fallback.stderr @@ -4,7 +4,10 @@ error[E0283]: type annotations needed LL | fn unconstrained_foo() -> Wrapper<Foo> { | ------------ type must be known at this point LL | Wrapper::Second - | ^^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the enum `Wrapper` + | ^^^^^^^^^^^^^^^ + | | + | cannot infer type of the type parameter `T` declared on the enum `Wrapper` + | return type was inferred to be `Wrapper<_>` here | = note: cannot satisfy `_: Copy` help: consider specifying the generic argument diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr index d2d6380b65a..af6e6e1e66e 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use2.stderr @@ -4,6 +4,16 @@ error[E0277]: `T` doesn't implement `Debug` LL | t | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` | +note: required by a bound in an opaque type + --> $DIR/generic_duplicate_param_use2.rs:8:23 + | +LL | type Two<T, U> = impl Debug; + | ^^^^^ +note: this definition site has more where clauses than the opaque type + --> $DIR/generic_duplicate_param_use2.rs:10:1 + | +LL | fn two<T: Debug, U>(t: T, _: U) -> Two<T, U> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider restricting type parameter `T` | LL | type Two<T: std::fmt::Debug, U> = impl Debug; diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.rs index e7a25fc7240..2074f12750f 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.rs +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.rs @@ -9,10 +9,9 @@ type Two<T, U> = impl Debug; fn two<T: Debug, U>(t: T, _: U) -> Two<T, U> { t - //~^ ERROR `T` doesn't implement `Debug` } fn three<T, U: Debug>(_: T, u: U) -> Two<T, U> { u - //~^ ERROR `U` doesn't implement `Debug` + //~^ ERROR concrete type differs } diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.stderr index 7bec3822071..9a10a4980d8 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use3.stderr @@ -1,25 +1,14 @@ -error[E0277]: `T` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use3.rs:11:5 - | -LL | t - | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | -help: consider restricting type parameter `T` - | -LL | type Two<T: std::fmt::Debug, U> = impl Debug; - | +++++++++++++++++ - -error[E0277]: `U` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use3.rs:16:5 +error: concrete type differs from previous defining opaque type use + --> $DIR/generic_duplicate_param_use3.rs:15:5 | LL | u - | ^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | ^ expected `T`, got `U` | -help: consider restricting type parameter `U` +note: previous use here + --> $DIR/generic_duplicate_param_use3.rs:11:5 | -LL | type Two<T, U: std::fmt::Debug> = impl Debug; - | +++++++++++++++++ +LL | t + | ^ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr index 2338dbd522b..a847bed93da 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use4.stderr @@ -4,6 +4,16 @@ error[E0277]: `U` doesn't implement `Debug` LL | u | ^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` | +note: required by a bound in an opaque type + --> $DIR/generic_duplicate_param_use4.rs:8:23 + | +LL | type Two<T, U> = impl Debug; + | ^^^^^ +note: this definition site has more where clauses than the opaque type + --> $DIR/generic_duplicate_param_use4.rs:10:1 + | +LL | fn three<T, U: Debug>(_: T, u: U) -> Two<T, U> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider restricting type parameter `U` | LL | type Two<T, U: std::fmt::Debug> = impl Debug; diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.rs index 3bd1dda6331..b3d6beaf848 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.rs +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.rs @@ -9,12 +9,9 @@ type Two<T, U> = impl Debug; fn two<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> { (t, u) - //~^ ERROR `T` doesn't implement `Debug` - //~| ERROR `U` doesn't implement `Debug` } fn three<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> { (u, t) - //~^ ERROR `T` doesn't implement `Debug` - //~| ERROR `U` doesn't implement `Debug` + //~^ ERROR concrete type differs } diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr index 586ea82342a..b0027f8fa57 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use5.stderr @@ -1,51 +1,14 @@ -error[E0277]: `T` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use5.rs:11:5 - | -LL | (t, u) - | ^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` +error: concrete type differs from previous defining opaque type use + --> $DIR/generic_duplicate_param_use5.rs:15:5 | - = note: required for `(T, U)` to implement `Debug` -help: consider restricting type parameter `T` +LL | (u, t) + | ^^^^^^ expected `(T, U)`, got `(U, T)` | -LL | type Two<T: std::fmt::Debug, U> = impl Debug; - | +++++++++++++++++ - -error[E0277]: `U` doesn't implement `Debug` +note: previous use here --> $DIR/generic_duplicate_param_use5.rs:11:5 | LL | (t, u) - | ^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = note: required for `(T, U)` to implement `Debug` -help: consider restricting type parameter `U` - | -LL | type Two<T, U: std::fmt::Debug> = impl Debug; - | +++++++++++++++++ - -error[E0277]: `U` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use5.rs:17:5 - | -LL | (u, t) - | ^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = note: required for `(U, T)` to implement `Debug` -help: consider restricting type parameter `U` - | -LL | type Two<T, U: std::fmt::Debug> = impl Debug; - | +++++++++++++++++ - -error[E0277]: `T` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use5.rs:17:5 - | -LL | (u, t) - | ^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = note: required for `(U, T)` to implement `Debug` -help: consider restricting type parameter `T` - | -LL | type Two<T: std::fmt::Debug, U> = impl Debug; - | +++++++++++++++++ + | ^^^^^^ -error: aborting due to 4 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.rs index 5120925e5a4..fa8b2a290b9 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.rs +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.rs @@ -9,11 +9,9 @@ type Two<T, U> = impl Debug; fn two<T: Copy + Debug, U: Debug>(t: T, u: U) -> Two<T, U> { (t, t) - //~^ ERROR `T` doesn't implement `Debug` } fn three<T: Copy + Debug, U: Debug>(t: T, u: U) -> Two<T, U> { (u, t) - //~^ ERROR `T` doesn't implement `Debug` - //~| ERROR `U` doesn't implement `Debug` + //~^ ERROR concrete type differs } diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr index cb162d382b6..09c01932cef 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use6.stderr @@ -1,39 +1,14 @@ -error[E0277]: `T` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use6.rs:11:5 - | -LL | (t, t) - | ^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = note: required for `(T, T)` to implement `Debug` -help: consider restricting type parameter `T` - | -LL | type Two<T: std::fmt::Debug, U> = impl Debug; - | +++++++++++++++++ - -error[E0277]: `U` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use6.rs:16:5 +error: concrete type differs from previous defining opaque type use + --> $DIR/generic_duplicate_param_use6.rs:15:5 | LL | (u, t) - | ^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = note: required for `(U, T)` to implement `Debug` -help: consider restricting type parameter `U` + | ^^^^^^ expected `(T, T)`, got `(U, T)` | -LL | type Two<T, U: std::fmt::Debug> = impl Debug; - | +++++++++++++++++ - -error[E0277]: `T` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use6.rs:16:5 - | -LL | (u, t) - | ^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = note: required for `(U, T)` to implement `Debug` -help: consider restricting type parameter `T` +note: previous use here + --> $DIR/generic_duplicate_param_use6.rs:11:5 | -LL | type Two<T: std::fmt::Debug, U> = impl Debug; - | +++++++++++++++++ +LL | (t, t) + | ^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.rs index 3a4b5047b41..76c13bb027b 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.rs +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.rs @@ -8,10 +8,9 @@ type Two<T, U> = impl Debug; fn two<T: Debug, U: Debug>(t: T, _: U) -> Two<T, U> { (t, 4u32) - //~^ ERROR `T` doesn't implement `Debug` } fn three<T: Debug, U: Debug>(_: T, u: U) -> Two<T, U> { (u, 4u32) - //~^ ERROR `U` doesn't implement `Debug` + //~^ concrete type differs } diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr index 14cbfb3806f..09d2abe3663 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use8.stderr @@ -1,27 +1,14 @@ -error[E0277]: `T` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use8.rs:10:5 - | -LL | (t, 4u32) - | ^^^^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = note: required for `(T, u32)` to implement `Debug` -help: consider restricting type parameter `T` - | -LL | type Two<T: std::fmt::Debug, U> = impl Debug; - | +++++++++++++++++ - -error[E0277]: `U` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use8.rs:15:5 +error: concrete type differs from previous defining opaque type use + --> $DIR/generic_duplicate_param_use8.rs:14:5 | LL | (u, 4u32) - | ^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | ^^^^^^^^^ expected `(T, u32)`, got `(U, u32)` | - = note: required for `(U, u32)` to implement `Debug` -help: consider restricting type parameter `U` +note: previous use here + --> $DIR/generic_duplicate_param_use8.rs:10:5 | -LL | type Two<T, U: std::fmt::Debug> = impl Debug; - | +++++++++++++++++ +LL | (t, 4u32) + | ^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs index 6afcdfe4d1c..5da7aab0da7 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.rs @@ -13,13 +13,9 @@ trait Foo { fn two<T: Debug + Foo, U: Debug>(t: T, u: U) -> Two<T, U> { (t, u, T::BAR) - //~^ ERROR the trait bound `A: Foo` is not satisfied - //~| ERROR `A` doesn't implement `Debug` - //~| ERROR `B` doesn't implement `Debug` } fn three<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> { (t, u, 42) - //~^ ERROR `A` doesn't implement `Debug` - //~| ERROR `B` doesn't implement `Debug` + //~^ ERROR concrete type differs } diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr index 722693e4266..6e1bb3dfa17 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use9.stderr @@ -1,62 +1,14 @@ -error[E0277]: the trait bound `A: Foo` is not satisfied - --> $DIR/generic_duplicate_param_use9.rs:15:5 - | -LL | (t, u, T::BAR) - | ^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `A` - | -help: consider restricting type parameter `A` - | -LL | type Two<A: Foo, B> = impl Debug; - | +++++ - -error[E0277]: `A` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use9.rs:15:5 - | -LL | (t, u, T::BAR) - | ^^^^^^^^^^^^^^ `A` cannot be formatted using `{:?}` because it doesn't implement `Debug` +error: concrete type differs from previous defining opaque type use + --> $DIR/generic_duplicate_param_use9.rs:19:5 | - = note: required for `(A, B, _)` to implement `Debug` -help: consider restricting type parameter `A` +LL | (t, u, 42) + | ^^^^^^^^^^ expected `(A, B, <A as Foo>::Bar)`, got `(A, B, i32)` | -LL | type Two<A: std::fmt::Debug, B> = impl Debug; - | +++++++++++++++++ - -error[E0277]: `B` doesn't implement `Debug` +note: previous use here --> $DIR/generic_duplicate_param_use9.rs:15:5 | LL | (t, u, T::BAR) - | ^^^^^^^^^^^^^^ `B` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = note: required for `(A, B, _)` to implement `Debug` -help: consider restricting type parameter `B` - | -LL | type Two<A, B: std::fmt::Debug> = impl Debug; - | +++++++++++++++++ - -error[E0277]: `A` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use9.rs:22:5 - | -LL | (t, u, 42) - | ^^^^^^^^^^ `A` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = note: required for `(A, B, i32)` to implement `Debug` -help: consider restricting type parameter `A` - | -LL | type Two<A: std::fmt::Debug, B> = impl Debug; - | +++++++++++++++++ - -error[E0277]: `B` doesn't implement `Debug` - --> $DIR/generic_duplicate_param_use9.rs:22:5 - | -LL | (t, u, 42) - | ^^^^^^^^^^ `B` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = note: required for `(A, B, i32)` to implement `Debug` -help: consider restricting type parameter `B` - | -LL | type Two<A, B: std::fmt::Debug> = impl Debug; - | +++++++++++++++++ + | ^^^^^^^^^^^^^^ -error: aborting due to 5 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr b/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr index b05121a489e..be68bac5575 100644 --- a/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr +++ b/tests/ui/type-alias-impl-trait/hidden_type_mismatch.stderr @@ -21,6 +21,20 @@ LL | impl<T: Proj<Assoc = i32> + Copy> Copy for Bar<T> {} | ----------- ^^^^ ^^^^^^ | | | unsatisfied trait bound introduced here +note: required by a bound in an opaque type + --> $DIR/hidden_type_mismatch.rs:36:26 + | +LL | pub type Tait = impl Copy + From<Bar<()>> + Into<Bar<()>>; + | ^^^^ +note: this definition site has more where clauses than the opaque type + --> $DIR/hidden_type_mismatch.rs:37:5 + | +LL | / pub fn define_tait() -> Tait +LL | | where +LL | | // this proves `Bar<()>: Copy`, but `define_tait` is +LL | | // now uncallable +LL | | (): Proj<Assoc = i32>, + | |______________________________^ error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.rs b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.rs index f8b09814caa..7b2bbc99530 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.rs +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.rs @@ -2,9 +2,9 @@ mod test_type_param_static { pub type Ty<A> = impl Sized + 'static; - //~^ ERROR: the parameter type `A` may not live long enough fn defining<A: 'static>(s: A) -> Ty<A> { s + //~^ ERROR: the parameter type `A` may not live long enough } pub fn assert_static<A: 'static>() {} } diff --git a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr index f2e5e95b96f..f23b978d0b6 100644 --- a/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr +++ b/tests/ui/type-alias-impl-trait/implied_lifetime_wf_check4_static.stderr @@ -1,12 +1,17 @@ error[E0310]: the parameter type `A` may not live long enough - --> $DIR/implied_lifetime_wf_check4_static.rs:4:22 + --> $DIR/implied_lifetime_wf_check4_static.rs:6:9 | -LL | pub type Ty<A> = impl Sized + 'static; - | ^^^^^^^^^^^^^^^^^^^^ - | | - | the parameter type `A` must be valid for the static lifetime... - | ...so that the type `A` will meet its required lifetime bounds +LL | s + | ^ + | | + | the parameter type `A` must be valid for the static lifetime... + | ...so that the type `A` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/implied_lifetime_wf_check4_static.rs:4:35 | +LL | pub type Ty<A> = impl Sized + 'static; + | ^^^^^^^ help: consider adding an explicit lifetime bound | LL | pub type Ty<A: 'static> = impl Sized + 'static; diff --git a/tests/ui/type-alias-impl-trait/issue-52843.stderr b/tests/ui/type-alias-impl-trait/issue-52843.stderr index ea4c5297ad5..a6bdddbc98c 100644 --- a/tests/ui/type-alias-impl-trait/issue-52843.stderr +++ b/tests/ui/type-alias-impl-trait/issue-52843.stderr @@ -4,6 +4,16 @@ error[E0277]: the trait bound `T: Default` is not satisfied LL | t | ^ the trait `Default` is not implemented for `T` | +note: required by a bound in an opaque type + --> $DIR/issue-52843.rs:3:20 + | +LL | type Foo<T> = impl Default; + | ^^^^^^^ +note: this definition site has more where clauses than the opaque type + --> $DIR/issue-52843.rs:6:1 + | +LL | fn foo<T: Default>(t: T) -> Foo<T> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider restricting type parameter `T` | LL | type Foo<T: std::default::Default> = impl Default; diff --git a/tests/ui/type-alias-impl-trait/issue-57700.rs b/tests/ui/type-alias-impl-trait/issue-57700.rs deleted file mode 100644 index 8746545ecc9..00000000000 --- a/tests/ui/type-alias-impl-trait/issue-57700.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![feature(arbitrary_self_types)] -#![feature(impl_trait_in_assoc_type)] - -use std::ops::Deref; - -trait Foo { - type Bar: Foo; - - fn foo(self: impl Deref<Target = Self>) -> Self::Bar; -} - -impl<C> Foo for C { - type Bar = impl Foo; - - fn foo(self: impl Deref<Target = Self>) -> Self::Bar { - self - //~^ Error type parameter `impl Deref<Target = Self>` is part of concrete type but not used in parameter list for the `impl Trait` type alias - } -} - -fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-57700.stderr b/tests/ui/type-alias-impl-trait/issue-57700.stderr deleted file mode 100644 index 7efb05f40b0..00000000000 --- a/tests/ui/type-alias-impl-trait/issue-57700.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: type parameter `impl Deref<Target = Self>` is part of concrete type but not used in parameter list for the `impl Trait` type alias - --> $DIR/issue-57700.rs:16:9 - | -LL | self - | ^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/type-alias-impl-trait/issue-90400-2.stderr b/tests/ui/type-alias-impl-trait/issue-90400-2.stderr index b4b78f8175f..4a6a62bdf96 100644 --- a/tests/ui/type-alias-impl-trait/issue-90400-2.stderr +++ b/tests/ui/type-alias-impl-trait/issue-90400-2.stderr @@ -4,11 +4,23 @@ error[E0277]: the trait bound `B: Bar` is not satisfied LL | MyBaz(bar) | ^^^^^^^^^^ the trait `Bar` is not implemented for `B` | -note: required by a bound in `MyBaz` - --> $DIR/issue-90400-2.rs:29:17 +note: required for `MyBaz<B>` to implement `Baz` + --> $DIR/issue-90400-2.rs:30:14 | -LL | struct MyBaz<B: Bar>(B); - | ^^^ required by this bound in `MyBaz` +LL | impl<B: Bar> Baz for MyBaz<B> { + | --- ^^^ ^^^^^^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in an opaque type + --> $DIR/issue-90400-2.rs:22:26 + | +LL | type FooFn<B> = impl Baz; + | ^^^ +note: this definition site has more where clauses than the opaque type + --> $DIR/issue-90400-2.rs:24:5 + | +LL | fn foo<B: Bar>(&self, bar: B) -> Self::FooFn<B> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider restricting type parameter `B` | LL | type FooFn<B: Bar> = impl Baz; diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr index a7840e0a5bf..b5f38074632 100644 --- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr +++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `&'static B: From<&A>` is not satisfied --> $DIR/multiple-def-uses-in-one-fn.rs:9:45 | LL | fn f<A, B: 'static>(a: &'static A, b: B) -> (X<A, B>, X<B, A>) { - | ^^^^^^^^^^^^^^^^^^ the trait `From<&A>` is not implemented for `&'static B`, which is required by `&A: Into<&'static B>` + | ^^^^^^^^^^^^^^^^^^ the trait `From<&A>` is not implemented for `&'static B` | = note: required for `&A` to implement `Into<&'static B>` help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference.current.stderr b/tests/ui/type-alias-impl-trait/nested-tait-inference.current.stderr index 34532afcbba..915432bbe67 100644 --- a/tests/ui/type-alias-impl-trait/nested-tait-inference.current.stderr +++ b/tests/ui/type-alias-impl-trait/nested-tait-inference.current.stderr @@ -7,7 +7,8 @@ LL | fn foo() -> impl Foo<FooX> { LL | () | -- return type was inferred to be `()` here | - = help: the trait `Foo<()>` is implemented for `()` + = help: the trait `Foo<FooX>` is not implemented for `()` + but trait `Foo<()>` is implemented for it error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/non-lifetime-binder-in-constraint.stderr b/tests/ui/type-alias-impl-trait/non-lifetime-binder-in-constraint.stderr index fa3306ff11f..6e5bd34ce38 100644 --- a/tests/ui/type-alias-impl-trait/non-lifetime-binder-in-constraint.stderr +++ b/tests/ui/type-alias-impl-trait/non-lifetime-binder-in-constraint.stderr @@ -17,6 +17,9 @@ error[E0277]: the trait bound `{integer}: Trait<()>` is not satisfied | LL | fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<()>` is not implemented for `{integer}` +... +LL | 16 + | -- return type was inferred to be `{integer}` here | help: this trait has no implementations, consider adding one --> $DIR/non-lifetime-binder-in-constraint.rs:4:1 diff --git a/tests/ui/type-alias-impl-trait/not_a_defining_use.rs b/tests/ui/type-alias-impl-trait/not_a_defining_use.rs index fa47d13f516..b5ef1470629 100644 --- a/tests/ui/type-alias-impl-trait/not_a_defining_use.rs +++ b/tests/ui/type-alias-impl-trait/not_a_defining_use.rs @@ -8,7 +8,6 @@ type Two<T, U> = impl Debug; fn three<T: Debug, U>(t: T) -> Two<T, U> { (t, 5i8) - //~^ ERROR `T` doesn't implement `Debug` } trait Bar { @@ -23,8 +22,7 @@ impl Bar for u32 { fn four<T: Debug, U: Bar>(t: T) -> Two<T, U> { (t, <U as Bar>::FOO) - //~^ ERROR `U: Bar` is not satisfied - //~| ERROR `T` doesn't implement `Debug` + //~^ ERROR concrete type differs } fn is_sync<T: Sync>() {} diff --git a/tests/ui/type-alias-impl-trait/not_a_defining_use.stderr b/tests/ui/type-alias-impl-trait/not_a_defining_use.stderr index b11198c584c..b59f9c49b07 100644 --- a/tests/ui/type-alias-impl-trait/not_a_defining_use.stderr +++ b/tests/ui/type-alias-impl-trait/not_a_defining_use.stderr @@ -1,38 +1,14 @@ -error[E0277]: `T` doesn't implement `Debug` - --> $DIR/not_a_defining_use.rs:10:5 - | -LL | (t, 5i8) - | ^^^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = note: required for `(T, i8)` to implement `Debug` -help: consider restricting type parameter `T` - | -LL | type Two<T: std::fmt::Debug, U> = impl Debug; - | +++++++++++++++++ - -error[E0277]: the trait bound `U: Bar` is not satisfied - --> $DIR/not_a_defining_use.rs:25:5 +error: concrete type differs from previous defining opaque type use + --> $DIR/not_a_defining_use.rs:24:5 | LL | (t, <U as Bar>::FOO) - | ^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `U` - | -help: consider restricting type parameter `U` + | ^^^^^^^^^^^^^^^^^^^^ expected `(T, i8)`, got `(T, <U as Bar>::Blub)` | -LL | type Two<T, U: Bar> = impl Debug; - | +++++ - -error[E0277]: `T` doesn't implement `Debug` - --> $DIR/not_a_defining_use.rs:25:5 - | -LL | (t, <U as Bar>::FOO) - | ^^^^^^^^^^^^^^^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = note: required for `(T, _)` to implement `Debug` -help: consider restricting type parameter `T` +note: previous use here + --> $DIR/not_a_defining_use.rs:10:5 | -LL | type Two<T: std::fmt::Debug, U> = impl Debug; - | +++++++++++++++++ +LL | (t, 5i8) + | ^^^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr b/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr index 3ae3590ca7f..e4399f2d8f4 100644 --- a/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr +++ b/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr @@ -7,7 +7,7 @@ LL | 42_i32 | ------ return type was inferred to be `i32` here | = help: the trait `PartialEq<Foo>` is not implemented for `i32` - = help: the trait `PartialEq` is implemented for `i32` + but trait `PartialEq<i32>` is implemented for it error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr index 913a35eb9fb..48cef847fbb 100644 --- a/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr +++ b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Trait` is not satisfied --> $DIR/underconstrained_generic.rs:22:5 | LL | () - | ^^ the trait `Trait` is not implemented for `T`, which is required by `(): ProofForConversion<T>` + | ^^ the trait `Trait` is not implemented for `T` | note: required for `()` to implement `ProofForConversion<T>` --> $DIR/underconstrained_generic.rs:13:16 @@ -11,6 +11,16 @@ LL | impl<X: Trait> ProofForConversion<X> for () { | ----- ^^^^^^^^^^^^^^^^^^^^^ ^^ | | | unsatisfied trait bound introduced here +note: required by a bound in an opaque type + --> $DIR/underconstrained_generic.rs:19:26 + | +LL | type Converter<T> = impl ProofForConversion<T>; + | ^^^^^^^^^^^^^^^^^^^^^ +note: this definition site has more where clauses than the opaque type + --> $DIR/underconstrained_generic.rs:21:1 + | +LL | fn _defining_use<T: Trait>() -> Converter<T> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider restricting type parameter `T` | LL | type Converter<T: Trait> = impl ProofForConversion<T>; diff --git a/tests/ui/type-alias-impl-trait/underconstrained_lifetime.rs b/tests/ui/type-alias-impl-trait/underconstrained_lifetime.rs index c5b2e8a1c5e..e8e7dd0ea08 100644 --- a/tests/ui/type-alias-impl-trait/underconstrained_lifetime.rs +++ b/tests/ui/type-alias-impl-trait/underconstrained_lifetime.rs @@ -13,11 +13,11 @@ impl<'a, 'b> ProofForConversion<'a, 'b> for &'b &'a () { } type Converter<'a, 'b> = impl ProofForConversion<'a, 'b>; -//~^ ERROR reference has a longer lifetime than the data it references // Even _defining_use with an explicit `'a: 'b` compiles fine, too. fn _defining_use<'a, 'b>(x: &'b &'a ()) -> Converter<'a, 'b> { x + //~^ ERROR reference has a longer lifetime than the data it references } fn extend_lifetime<'a, 'b, T: ?Sized>(x: &'a T) -> &'b T { diff --git a/tests/ui/type-alias-impl-trait/underconstrained_lifetime.stderr b/tests/ui/type-alias-impl-trait/underconstrained_lifetime.stderr index 34b50fb1f05..7c07578d887 100644 --- a/tests/ui/type-alias-impl-trait/underconstrained_lifetime.stderr +++ b/tests/ui/type-alias-impl-trait/underconstrained_lifetime.stderr @@ -1,8 +1,8 @@ error[E0491]: in type `&'b &'a ()`, reference has a longer lifetime than the data it references - --> $DIR/underconstrained_lifetime.rs:15:26 + --> $DIR/underconstrained_lifetime.rs:19:5 | -LL | type Converter<'a, 'b> = impl ProofForConversion<'a, 'b>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | x + | ^ | note: the pointer is valid for the lifetime `'b` as defined here --> $DIR/underconstrained_lifetime.rs:15:20 diff --git a/tests/ui/type-alias-impl-trait/variance.rs b/tests/ui/type-alias-impl-trait/variance.rs index 113f6a4cc44..40e8ec0129a 100644 --- a/tests/ui/type-alias-impl-trait/variance.rs +++ b/tests/ui/type-alias-impl-trait/variance.rs @@ -11,11 +11,11 @@ type NotCapturedEarly<'a> = impl Sized; //~ ['a: *, 'a: o] type CapturedEarly<'a> = impl Sized + Captures<'a>; //~ ['a: *, 'a: o] //~^ ERROR: unconstrained opaque type -type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; //~ ['a: *, 'b: o, 'a: o] +type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; //~ ['a: *, 'a: o, 'b: o] //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type //~| ERROR: unconstrained opaque type -type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>; //~ ['a: *, 'b: o, 'a: o] +type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>; //~ ['a: *, 'a: o, 'b: o] //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type //~| ERROR: unconstrained opaque type @@ -31,24 +31,24 @@ trait Foo<'i> { } impl<'i> Foo<'i> for &'i () { - type ImplicitCapture<'a> = impl Sized; //~ ['i: *, 'a: *, 'a: o, 'i: o] + type ImplicitCapture<'a> = impl Sized; //~ ['i: *, 'a: *, 'i: o, 'a: o] //~^ ERROR: unconstrained opaque type - type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ['i: *, 'a: *, 'a: o, 'i: o] + type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ['i: *, 'a: *, 'i: o, 'a: o] //~^ ERROR: unconstrained opaque type - type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ['i: *, 'a: *, 'a: o, 'i: o] + type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ['i: *, 'a: *, 'i: o, 'a: o] //~^ ERROR: unconstrained opaque type } impl<'i> Foo<'i> for () { - type ImplicitCapture<'a> = impl Sized; //~ ['i: *, 'a: *, 'a: o, 'i: o] + type ImplicitCapture<'a> = impl Sized; //~ ['i: *, 'a: *, 'i: o, 'a: o] //~^ ERROR: unconstrained opaque type - type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ['i: *, 'a: *, 'a: o, 'i: o] + type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ['i: *, 'a: *, 'i: o, 'a: o] //~^ ERROR: unconstrained opaque type - type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ['i: *, 'a: *, 'a: o, 'i: o] + type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ['i: *, 'a: *, 'i: o, 'a: o] //~^ ERROR: unconstrained opaque type } diff --git a/tests/ui/type-alias-impl-trait/variance.stderr b/tests/ui/type-alias-impl-trait/variance.stderr index 489dfe03d44..79ce8148f19 100644 --- a/tests/ui/type-alias-impl-trait/variance.stderr +++ b/tests/ui/type-alias-impl-trait/variance.stderr @@ -122,13 +122,13 @@ error: ['a: *, 'a: o] LL | type CapturedEarly<'a> = impl Sized + Captures<'a>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: ['a: *, 'b: o, 'a: o] +error: ['a: *, 'a: o, 'b: o] --> $DIR/variance.rs:14:56 | LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; | ^^^^^^^^^^ -error: ['a: *, 'b: o, 'a: o] +error: ['a: *, 'a: o, 'b: o] --> $DIR/variance.rs:18:49 | LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>; @@ -140,37 +140,37 @@ error: ['a: *, 'b: *, T: o, 'a: o, 'b: o] LL | type Bar<'a, 'b: 'b, T> = impl Sized; | ^^^^^^^^^^ -error: ['i: *, 'a: *, 'a: o, 'i: o] +error: ['i: *, 'a: *, 'i: o, 'a: o] --> $DIR/variance.rs:34:32 | LL | type ImplicitCapture<'a> = impl Sized; | ^^^^^^^^^^ -error: ['i: *, 'a: *, 'a: o, 'i: o] +error: ['i: *, 'a: *, 'i: o, 'a: o] --> $DIR/variance.rs:37:42 | LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: ['i: *, 'a: *, 'a: o, 'i: o] +error: ['i: *, 'a: *, 'i: o, 'a: o] --> $DIR/variance.rs:40:39 | LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: ['i: *, 'a: *, 'a: o, 'i: o] +error: ['i: *, 'a: *, 'i: o, 'a: o] --> $DIR/variance.rs:45:32 | LL | type ImplicitCapture<'a> = impl Sized; | ^^^^^^^^^^ -error: ['i: *, 'a: *, 'a: o, 'i: o] +error: ['i: *, 'a: *, 'i: o, 'a: o] --> $DIR/variance.rs:48:42 | LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: ['i: *, 'a: *, 'a: o, 'i: o] +error: ['i: *, 'a: *, 'i: o, 'a: o] --> $DIR/variance.rs:51:39 | LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; diff --git a/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr b/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr index c4ad8434ed1..34648a420ac 100644 --- a/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr +++ b/tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr @@ -1,23 +1,30 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/wf-in-associated-type.rs:38:23 + --> $DIR/wf-in-associated-type.rs:40:13 | LL | impl<'a, T> Trait<'a, T> for () { | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... -LL | type Opaque = impl Sized + 'a; - | ^^^^^^^^^^^^^^^ ...so that the type `&'a T` will meet its required lifetime bounds +... +LL | req + | ^^^ ...so that the type `&'a T` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/wf-in-associated-type.rs:38:36 | +LL | type Opaque = impl Sized + 'a; + | ^^ help: consider adding an explicit lifetime bound | LL | impl<'a, T: 'a> Trait<'a, T> for () { | ++++ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/wf-in-associated-type.rs:38:23 + --> $DIR/wf-in-associated-type.rs:40:13 | LL | impl<'a, T> Trait<'a, T> for () { | -- the parameter type `T` must be valid for the lifetime `'a` as defined here... -LL | type Opaque = impl Sized + 'a; - | ^^^^^^^^^^^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at +... +LL | req + | ^^^ ...so that the reference type `&'a T` does not outlive the data it points at | help: consider adding an explicit lifetime bound | diff --git a/tests/ui/type-alias-impl-trait/wf-in-associated-type.rs b/tests/ui/type-alias-impl-trait/wf-in-associated-type.rs index c20be3125bc..e548609e89a 100644 --- a/tests/ui/type-alias-impl-trait/wf-in-associated-type.rs +++ b/tests/ui/type-alias-impl-trait/wf-in-associated-type.rs @@ -36,10 +36,10 @@ mod fail { impl<'a, T> Trait<'a, T> for () { type Opaque = impl Sized + 'a; - //[fail]~^ ERROR the parameter type `T` may not live long enough - //[fail]~| ERROR the parameter type `T` may not live long enough fn constrain_opaque(req: &'a T) -> Self::Opaque { req + //[fail]~^ ERROR the parameter type `T` may not live long enough + //[fail]~| ERROR the parameter type `T` may not live long enough } } } diff --git a/tests/ui/type/issue-58355.stderr b/tests/ui/type/issue-58355.stderr index cd8e3538802..b6056f0fd65 100644 --- a/tests/ui/type/issue-58355.stderr +++ b/tests/ui/type/issue-58355.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `dyn ToString` cannot be known at comp LL | x = Some(Box::new(callback)); | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `fn() -> dyn ToString`, the trait `Sized` is not implemented for `dyn ToString`, which is required by `fn() -> dyn ToString: Fn()` + = help: within `fn() -> dyn ToString`, the trait `Sized` is not implemented for `dyn ToString` = note: required because it appears within the type `fn() -> dyn ToString` = note: required for the cast from `Box<fn() -> dyn ToString>` to `Box<dyn Fn() -> (dyn ToString + 'static)>` diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types.rs b/tests/ui/type/pattern_types/feature-gate-pattern_types.rs index 3c507a9669d..e638f3c6c40 100644 --- a/tests/ui/type/pattern_types/feature-gate-pattern_types.rs +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types.rs @@ -3,12 +3,12 @@ use std::pat::pattern_type; type NonNullU32 = pattern_type!(u32 is 1..); -//~^ use of unstable library feature 'core_pattern_type' +//~^ use of unstable library feature `core_pattern_type` type Percent = pattern_type!(u32 is 0..=100); -//~^ use of unstable library feature 'core_pattern_type' +//~^ use of unstable library feature `core_pattern_type` type Negative = pattern_type!(i32 is ..=0); -//~^ use of unstable library feature 'core_pattern_type' +//~^ use of unstable library feature `core_pattern_type` type Positive = pattern_type!(i32 is 0..); -//~^ use of unstable library feature 'core_pattern_type' +//~^ use of unstable library feature `core_pattern_type` type Always = pattern_type!(Option<u32> is Some(_)); -//~^ use of unstable library feature 'core_pattern_type' +//~^ use of unstable library feature `core_pattern_type` diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr b/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr index 03e91b52a2a..6cbadf370a7 100644 --- a/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr @@ -1,4 +1,4 @@ -error[E0658]: use of unstable library feature 'core_pattern_type' +error[E0658]: use of unstable library feature `core_pattern_type` --> $DIR/feature-gate-pattern_types.rs:5:19 | LL | type NonNullU32 = pattern_type!(u32 is 1..); @@ -8,7 +8,7 @@ LL | type NonNullU32 = pattern_type!(u32 is 1..); = help: add `#![feature(core_pattern_type)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'core_pattern_type' +error[E0658]: use of unstable library feature `core_pattern_type` --> $DIR/feature-gate-pattern_types.rs:7:16 | LL | type Percent = pattern_type!(u32 is 0..=100); @@ -18,7 +18,7 @@ LL | type Percent = pattern_type!(u32 is 0..=100); = help: add `#![feature(core_pattern_type)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'core_pattern_type' +error[E0658]: use of unstable library feature `core_pattern_type` --> $DIR/feature-gate-pattern_types.rs:9:17 | LL | type Negative = pattern_type!(i32 is ..=0); @@ -28,7 +28,7 @@ LL | type Negative = pattern_type!(i32 is ..=0); = help: add `#![feature(core_pattern_type)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'core_pattern_type' +error[E0658]: use of unstable library feature `core_pattern_type` --> $DIR/feature-gate-pattern_types.rs:11:17 | LL | type Positive = pattern_type!(i32 is 0..); @@ -38,7 +38,7 @@ LL | type Positive = pattern_type!(i32 is 0..); = help: add `#![feature(core_pattern_type)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: use of unstable library feature 'core_pattern_type' +error[E0658]: use of unstable library feature `core_pattern_type` --> $DIR/feature-gate-pattern_types.rs:13:15 | LL | type Always = pattern_type!(Option<u32> is Some(_)); diff --git a/tests/ui/type/pattern_types/range_patterns.stderr b/tests/ui/type/pattern_types/range_patterns.stderr index 8465e1b7ff2..7bd0d826cab 100644 --- a/tests/ui/type/pattern_types/range_patterns.stderr +++ b/tests/ui/type/pattern_types/range_patterns.stderr @@ -124,7 +124,7 @@ error: layout_of(Option<(u32) is 1..=>) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { @@ -232,7 +232,7 @@ error: layout_of(Option<NonZero<u32>>) = Layout { abi: Align(1 bytes), pref: $SOME_ALIGN, }, - abi: Aggregate { + abi: Memory { sized: true, }, fields: Arbitrary { diff --git a/tests/ui/typeck/bad-index-due-to-nested.stderr b/tests/ui/typeck/bad-index-due-to-nested.stderr index 137c7b06396..bd7fd0392c3 100644 --- a/tests/ui/typeck/bad-index-due-to-nested.stderr +++ b/tests/ui/typeck/bad-index-due-to-nested.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `K: Hash` is not satisfied --> $DIR/bad-index-due-to-nested.rs:20:5 | LL | map[k] - | ^^^ the trait `Hash` is not implemented for `K`, which is required by `HashMap<_, _>: Index<&_>` + | ^^^ the trait `Hash` is not implemented for `K` | note: required for `HashMap<K, V>` to implement `Index<&K>` --> $DIR/bad-index-due-to-nested.rs:7:12 @@ -21,7 +21,7 @@ error[E0277]: the trait bound `V: Copy` is not satisfied --> $DIR/bad-index-due-to-nested.rs:20:5 | LL | map[k] - | ^^^ the trait `Copy` is not implemented for `V`, which is required by `HashMap<_, _>: Index<&_>` + | ^^^ the trait `Copy` is not implemented for `V` | note: required for `HashMap<K, V>` to implement `Index<&K>` --> $DIR/bad-index-due-to-nested.rs:7:12 diff --git a/tests/ui/typeck/foreign_struct_trait_unimplemented.stderr b/tests/ui/typeck/foreign_struct_trait_unimplemented.stderr index b9bb97548f6..70de107b1ae 100644 --- a/tests/ui/typeck/foreign_struct_trait_unimplemented.stderr +++ b/tests/ui/typeck/foreign_struct_trait_unimplemented.stderr @@ -6,12 +6,7 @@ LL | needs_test(foreign_struct_trait_unimplemented::B); | | | required by a bound introduced by this call | -help: there are multiple different versions of crate `foreign_struct_trait_unimplemented` in the dependency graph - --> $DIR/foreign_struct_trait_unimplemented.rs:3:1 - | -LL | extern crate foreign_struct_trait_unimplemented; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one version of crate `foreign_struct_trait_unimplemented` is used here, as a direct dependency of the current crate - = help: you can use `cargo tree` to explore your dependency tree + = help: the trait `Test` is implemented for `A` note: required by a bound in `needs_test` --> $DIR/foreign_struct_trait_unimplemented.rs:10:23 | diff --git a/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr b/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr index 96ac481438f..b9bdf6f9a39 100644 --- a/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr +++ b/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr @@ -10,6 +10,10 @@ LL | let foo::Foo { visible, .. } = foo::Foo::default(); | ~~~~~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | +LL | let foo::Foo { visible: _, .. } = foo::Foo::default(); + | ~~~~~~~~~~~~~~~~~~ +help: or always ignore missing fields here + | LL | let foo::Foo { .. } = foo::Foo::default(); | ~~~~~~ diff --git a/tests/ui/typeck/issue-90101.stderr b/tests/ui/typeck/issue-90101.stderr index 796e904a438..2e140461c1d 100644 --- a/tests/ui/typeck/issue-90101.stderr +++ b/tests/ui/typeck/issue-90101.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `PathBuf: From<Cow<'_, str>>` is not satisfied --> $DIR/issue-90101.rs:6:10 | LL | func(Path::new("hello").to_path_buf().to_string_lossy(), "world") - | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<Cow<'_, str>>` is not implemented for `PathBuf`, which is required by `Cow<'_, str>: Into<PathBuf>` + | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<Cow<'_, str>>` is not implemented for `PathBuf` | | | required by a bound introduced by this call | diff --git a/tests/ui/typeck/suggest-similar-impls-for-root-obligation.stderr b/tests/ui/typeck/suggest-similar-impls-for-root-obligation.stderr index 8410574e311..5c0d98735f7 100644 --- a/tests/ui/typeck/suggest-similar-impls-for-root-obligation.stderr +++ b/tests/ui/typeck/suggest-similar-impls-for-root-obligation.stderr @@ -2,9 +2,10 @@ error[E0277]: the trait bound `((),): Into<Bar>` is not satisfied --> $DIR/suggest-similar-impls-for-root-obligation.rs:14:24 | LL | let _: Bar = ((),).into(); - | ^^^^ the trait `Foo<'_>` is not implemented for `((),)`, which is required by `((),): Into<_>` + | ^^^^ the trait `Foo<'_>` is not implemented for `((),)` | - = help: the trait `Foo<'_>` is implemented for `()` + = help: the trait `Foo<'_>` is not implemented for `((),)` + but it is implemented for `()` = help: for that trait implementation, expected `()`, found `((),)` note: required for `Bar` to implement `From<((),)>` --> $DIR/suggest-similar-impls-for-root-obligation.rs:7:22 diff --git a/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr b/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr index f5311b6e8ed..b9fca1a1b54 100644 --- a/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr +++ b/tests/ui/typeck/typeck-default-trait-impl-negation-sync.stderr @@ -17,7 +17,7 @@ error[E0277]: `UnsafeCell<u8>` cannot be shared between threads safely LL | is_sync::<MyTypeWUnsafe>(); | ^^^^^^^^^^^^^ `UnsafeCell<u8>` cannot be shared between threads safely | - = help: within `MyTypeWUnsafe`, the trait `Sync` is not implemented for `UnsafeCell<u8>`, which is required by `MyTypeWUnsafe: Sync` + = help: within `MyTypeWUnsafe`, the trait `Sync` is not implemented for `UnsafeCell<u8>` note: required because it appears within the type `MyTypeWUnsafe` --> $DIR/typeck-default-trait-impl-negation-sync.rs:21:8 | @@ -35,7 +35,7 @@ error[E0277]: `Managed` cannot be shared between threads safely LL | is_sync::<MyTypeManaged>(); | ^^^^^^^^^^^^^ `Managed` cannot be shared between threads safely | - = help: within `MyTypeManaged`, the trait `Sync` is not implemented for `Managed`, which is required by `MyTypeManaged: Sync` + = help: within `MyTypeManaged`, the trait `Sync` is not implemented for `Managed` note: required because it appears within the type `MyTypeManaged` --> $DIR/typeck-default-trait-impl-negation-sync.rs:25:8 | diff --git a/tests/ui/typeck/typeck-unsafe-always-share.stderr b/tests/ui/typeck/typeck-unsafe-always-share.stderr index 3eb792b82e0..154e504996b 100644 --- a/tests/ui/typeck/typeck-unsafe-always-share.stderr +++ b/tests/ui/typeck/typeck-unsafe-always-share.stderr @@ -36,7 +36,7 @@ LL | test(ms); | | | required by a bound introduced by this call | - = help: within `MySync<NoSync>`, the trait `Sync` is not implemented for `UnsafeCell<NoSync>`, which is required by `MySync<NoSync>: Sync` + = help: within `MySync<NoSync>`, the trait `Sync` is not implemented for `UnsafeCell<NoSync>` note: required because it appears within the type `MySync<NoSync>` --> $DIR/typeck-unsafe-always-share.rs:8:8 | diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr index 8a765c21624..5e32d5c429e 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr @@ -675,10 +675,6 @@ LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); | ^^^^^^^^^^^^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error[E0015]: cannot call non-const fn `<Filter<std::ops::Range<i32>, {closure@$DIR/typeck_type_placeholder_item.rs:230:29: 230:32}> as Iterator>::map::<i32, {closure@$DIR/typeck_type_placeholder_item.rs:230:49: 230:52}>` in constants --> $DIR/typeck_type_placeholder_item.rs:230:45 @@ -687,10 +683,6 @@ LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); | ^^^^^^^^^^^^^^ | = note: calls in constants are limited to constant functions, tuple structs and tuple variants -help: add `#![feature(const_trait_impl)]` to the crate attributes to enable - | -LL + #![feature(const_trait_impl)] - | error: aborting due to 74 previous errors diff --git a/tests/ui/underscore-ident-matcher.rs b/tests/ui/underscore-ident-matcher.rs index bddc8c80a7b..77ec70d43d5 100644 --- a/tests/ui/underscore-ident-matcher.rs +++ b/tests/ui/underscore-ident-matcher.rs @@ -5,5 +5,5 @@ macro_rules! identity { } fn main() { - let identity!(_) = 10; //~ ERROR no rules expected the token `_` + let identity!(_) = 10; //~ ERROR no rules expected reserved identifier `_` } diff --git a/tests/ui/underscore-ident-matcher.stderr b/tests/ui/underscore-ident-matcher.stderr index a663f34cde1..0c3f980cf6c 100644 --- a/tests/ui/underscore-ident-matcher.stderr +++ b/tests/ui/underscore-ident-matcher.stderr @@ -1,4 +1,4 @@ -error: no rules expected the token `_` +error: no rules expected reserved identifier `_` --> $DIR/underscore-ident-matcher.rs:8:19 | LL | macro_rules! identity { diff --git a/tests/ui/union/projection-as-union-type-error-2.stderr b/tests/ui/union/projection-as-union-type-error-2.stderr index 39cdf30d860..3b073ca1fb4 100644 --- a/tests/ui/union/projection-as-union-type-error-2.stderr +++ b/tests/ui/union/projection-as-union-type-error-2.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `u8: NotImplemented` is not satisfied --> $DIR/projection-as-union-type-error-2.rs:18:8 | LL | a: <Foo as Identity>::Identity, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotImplemented` is not implemented for `u8`, which is required by `u8: Identity` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotImplemented` is not implemented for `u8` | help: this trait has no implementations, consider adding one --> $DIR/projection-as-union-type-error-2.rs:9:1 diff --git a/tests/ui/unpretty/unsafe-attr.rs b/tests/ui/unpretty/unsafe-attr.rs new file mode 100644 index 00000000000..8734ea86b6d --- /dev/null +++ b/tests/ui/unpretty/unsafe-attr.rs @@ -0,0 +1,11 @@ +//@ compile-flags: -Zunpretty=normal +//@ check-pass + +#[no_mangle] +extern "C" fn foo() {} + +#[unsafe(no_mangle)] +extern "C" fn bar() {} + +#[cfg_attr(FALSE, unsafe(no_mangle))] +extern "C" fn zoo() {} diff --git a/tests/ui/unpretty/unsafe-attr.stdout b/tests/ui/unpretty/unsafe-attr.stdout new file mode 100644 index 00000000000..8734ea86b6d --- /dev/null +++ b/tests/ui/unpretty/unsafe-attr.stdout @@ -0,0 +1,11 @@ +//@ compile-flags: -Zunpretty=normal +//@ check-pass + +#[no_mangle] +extern "C" fn foo() {} + +#[unsafe(no_mangle)] +extern "C" fn bar() {} + +#[cfg_attr(FALSE, unsafe(no_mangle))] +extern "C" fn zoo() {} diff --git a/tests/ui/unsized-locals/issue-50940-with-feature.stderr b/tests/ui/unsized-locals/issue-50940-with-feature.stderr index 4c06566709e..b39eb2e70bb 100644 --- a/tests/ui/unsized-locals/issue-50940-with-feature.stderr +++ b/tests/ui/unsized-locals/issue-50940-with-feature.stderr @@ -13,7 +13,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t LL | A as fn(str) -> A<str>; | ^ doesn't have a size known at compile-time | - = help: within `A<str>`, the trait `Sized` is not implemented for `str`, which is required by `A<str>: Sized` + = help: within `A<str>`, the trait `Sized` is not implemented for `str` note: required because it appears within the type `A<str>` --> $DIR/issue-50940-with-feature.rs:5:12 | diff --git a/tests/ui/unsized-locals/rust-call.stderr b/tests/ui/unsized-locals/rust-call.stderr index b2e13b553e9..9eb0f3dabcc 100644 --- a/tests/ui/unsized-locals/rust-call.stderr +++ b/tests/ui/unsized-locals/rust-call.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation LL | f(*slice); | ^^^^^^ doesn't have a size known at compile-time | - = help: within `([u8],)`, the trait `Sized` is not implemented for `[u8]`, which is required by `([u8],): Sized` + = help: within `([u8],)`, the trait `Sized` is not implemented for `[u8]` = note: required because it appears within the type `([u8],)` = note: argument required to be sized due to `extern "rust-call"` ABI diff --git a/tests/ui/unsized-locals/unsized-exprs.stderr b/tests/ui/unsized-locals/unsized-exprs.stderr index 6da37749fac..8a2ecf0f6c3 100644 --- a/tests/ui/unsized-locals/unsized-exprs.stderr +++ b/tests/ui/unsized-locals/unsized-exprs.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation LL | udrop::<(i32, [u8])>((42, *foo())); | ^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `({integer}, [u8])`, the trait `Sized` is not implemented for `[u8]`, which is required by `({integer}, [u8]): Sized` + = help: within `({integer}, [u8])`, the trait `Sized` is not implemented for `[u8]` = note: required because it appears within the type `({integer}, [u8])` = note: tuples must have a statically known size to be initialized @@ -14,7 +14,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation LL | udrop::<A<[u8]>>(A { 0: *foo() }); | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `A<[u8]>`, the trait `Sized` is not implemented for `[u8]`, which is required by `A<[u8]>: Sized` + = help: within `A<[u8]>`, the trait `Sized` is not implemented for `[u8]` note: required because it appears within the type `A<[u8]>` --> $DIR/unsized-exprs.rs:3:8 | @@ -28,7 +28,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation LL | udrop::<A<[u8]>>(A(*foo())); | ^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `A<[u8]>`, the trait `Sized` is not implemented for `[u8]`, which is required by `A<[u8]>: Sized` + = help: within `A<[u8]>`, the trait `Sized` is not implemented for `[u8]` note: required because it appears within the type `A<[u8]>` --> $DIR/unsized-exprs.rs:3:8 | diff --git a/tests/ui/unsized/unsized-enum2.stderr b/tests/ui/unsized/unsized-enum2.stderr index 48cca6eb4bd..71cf782120e 100644 --- a/tests/ui/unsized/unsized-enum2.stderr +++ b/tests/ui/unsized/unsized-enum2.stderr @@ -320,7 +320,7 @@ error[E0277]: the size for values of type `(dyn PathHelper1 + 'static)` cannot b LL | VI(Path1), | ^^^^^ doesn't have a size known at compile-time | - = help: within `Path1`, the trait `Sized` is not implemented for `(dyn PathHelper1 + 'static)`, which is required by `Path1: Sized` + = help: within `Path1`, the trait `Sized` is not implemented for `(dyn PathHelper1 + 'static)` note: required because it appears within the type `Path1` --> $DIR/unsized-enum2.rs:16:8 | @@ -343,7 +343,7 @@ error[E0277]: the size for values of type `(dyn PathHelper2 + 'static)` cannot b LL | VJ{x: Path2}, | ^^^^^ doesn't have a size known at compile-time | - = help: within `Path2`, the trait `Sized` is not implemented for `(dyn PathHelper2 + 'static)`, which is required by `Path2: Sized` + = help: within `Path2`, the trait `Sized` is not implemented for `(dyn PathHelper2 + 'static)` note: required because it appears within the type `Path2` --> $DIR/unsized-enum2.rs:17:8 | @@ -366,7 +366,7 @@ error[E0277]: the size for values of type `(dyn PathHelper3 + 'static)` cannot b LL | VK(isize, Path3), | ^^^^^ doesn't have a size known at compile-time | - = help: within `Path3`, the trait `Sized` is not implemented for `(dyn PathHelper3 + 'static)`, which is required by `Path3: Sized` + = help: within `Path3`, the trait `Sized` is not implemented for `(dyn PathHelper3 + 'static)` note: required because it appears within the type `Path3` --> $DIR/unsized-enum2.rs:18:8 | @@ -389,7 +389,7 @@ error[E0277]: the size for values of type `(dyn PathHelper4 + 'static)` cannot b LL | VL{u: isize, x: Path4}, | ^^^^^ doesn't have a size known at compile-time | - = help: within `Path4`, the trait `Sized` is not implemented for `(dyn PathHelper4 + 'static)`, which is required by `Path4: Sized` + = help: within `Path4`, the trait `Sized` is not implemented for `(dyn PathHelper4 + 'static)` note: required because it appears within the type `Path4` --> $DIR/unsized-enum2.rs:19:8 | diff --git a/tests/ui/utf8-bom.rs b/tests/ui/utf8-bom.rs index 5b9e27fb7b9..eb82f6652cb 100644 --- a/tests/ui/utf8-bom.rs +++ b/tests/ui/utf8-bom.rs @@ -1,4 +1,5 @@ // This file has utf-8 BOM, it should be compiled normally without error. //@ run-pass +//@ reference: input.byte-order-mark pub fn main() {} diff --git a/tests/ui/wf/hir-wf-check-erase-regions.stderr b/tests/ui/wf/hir-wf-check-erase-regions.stderr index 93449d60e9d..4b696dc1d1d 100644 --- a/tests/ui/wf/hir-wf-check-erase-regions.stderr +++ b/tests/ui/wf/hir-wf-check-erase-regions.stderr @@ -4,7 +4,7 @@ error[E0277]: `&'a T` is not an iterator LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator | - = help: the trait `Iterator` is not implemented for `&'a T`, which is required by `Flatten<std::slice::Iter<'a, T>>: Iterator` + = help: the trait `Iterator` is not implemented for `&'a T` = help: the trait `Iterator` is implemented for `&mut I` = note: required for `Flatten<std::slice::Iter<'a, T>>` to implement `Iterator` note: required by a bound in `std::iter::IntoIterator::IntoIter` @@ -16,7 +16,7 @@ error[E0277]: `&'a T` is not an iterator LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator | - = help: the trait `Iterator` is not implemented for `&'a T`, which is required by `&'a T: IntoIterator` + = help: the trait `Iterator` is not implemented for `&'a T` = help: the trait `Iterator` is implemented for `&mut I` = note: required for `&'a T` to implement `IntoIterator` note: required by a bound in `Flatten` @@ -28,7 +28,7 @@ error[E0277]: `&'a T` is not an iterator LL | fn into_iter(self) -> Self::IntoIter { | ^^^^^^^^^^^^^^ `&'a T` is not an iterator | - = help: the trait `Iterator` is not implemented for `&'a T`, which is required by `&'a T: IntoIterator` + = help: the trait `Iterator` is not implemented for `&'a T` = help: the trait `Iterator` is implemented for `&mut I` = note: required for `&'a T` to implement `IntoIterator` note: required by a bound in `Flatten` diff --git a/tests/ui/wf/wf-const-type.stderr b/tests/ui/wf/wf-const-type.stderr index d73642729ea..dd6e97755bd 100644 --- a/tests/ui/wf/wf-const-type.stderr +++ b/tests/ui/wf/wf-const-type.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-const-type.rs:10:12 | LL | const FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` @@ -20,7 +20,7 @@ error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-const-type.rs:10:12 | LL | const FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` @@ -39,7 +39,7 @@ error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-const-type.rs:10:50 | LL | const FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; - | ^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` + | ^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` diff --git a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.rs b/tests/ui/wf/wf-dyn-incompat-trait-obj-match.rs index 07e90538b85..6eba6b7abec 100644 --- a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.rs +++ b/tests/ui/wf/wf-dyn-incompat-trait-obj-match.rs @@ -22,8 +22,8 @@ fn main() { Some(()) => &S, None => &R, //~ ERROR E0308 } - let t: &dyn Trait = match opt() { //~ ERROR E0038 + let t: &dyn Trait = match opt() { Some(()) => &S, //~ ERROR E0038 - None => &R, + None => &R, //~ ERROR E0038 }; } diff --git a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr b/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr index d7366e12256..6cd4ebf8412 100644 --- a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr +++ b/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr @@ -31,14 +31,10 @@ LL | trait Trait: Sized {} = note: required for the cast from `&S` to `&dyn Trait` error[E0038]: the trait `Trait` cannot be made into an object - --> $DIR/wf-dyn-incompat-trait-obj-match.rs:25:25 + --> $DIR/wf-dyn-incompat-trait-obj-match.rs:27:17 | -LL | let t: &dyn Trait = match opt() { - | _________________________^ -LL | | Some(()) => &S, -LL | | None => &R, -LL | | }; - | |_____^ `Trait` cannot be made into an object +LL | None => &R, + | ^^ `Trait` cannot be made into an object | note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> --> $DIR/wf-dyn-incompat-trait-obj-match.rs:6:14 diff --git a/tests/ui/wf/wf-static-type.stderr b/tests/ui/wf/wf-static-type.stderr index 36234f3fd17..53b90c69960 100644 --- a/tests/ui/wf/wf-static-type.stderr +++ b/tests/ui/wf/wf-static-type.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` @@ -20,7 +20,7 @@ error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` + | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` @@ -39,7 +39,7 @@ error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:51 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; - | ^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` + | ^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` diff --git a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr index bb99f4ad277..0d8ec5f8928 100644 --- a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr +++ b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr @@ -2,8 +2,9 @@ error[E0277]: the trait bound `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_t --> $DIR/higher-ranked-fn-type.rs:20:5 | LL | called() - | ^^^^^^^^ the trait `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), 'b))> Foo` is not implemented for `fn(&'^1_0.Named(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), "'b") ())` + | ^^^^^^^^ unsatisfied trait bound | + = help: the trait `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), 'b))> Foo` is not implemented for `fn(&'^1_0.Named(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), "'b") ())` help: this trait has no implementations, consider adding one --> $DIR/higher-ranked-fn-type.rs:6:1 | |
