diff options
Diffstat (limited to 'tests')
97 files changed, 1688 insertions, 564 deletions
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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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 c6b7e21b9dd..31d15c45921 100644 --- a/tests/ui/async-await/issue-70935-complex-spans.stderr +++ b/tests/ui/async-await/issue-70935-complex-spans.stderr @@ -1,8 +1,13 @@ 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 ()` note: required because it appears within the type `PhantomData<*mut ()>` @@ -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 @@ -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/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.stderr index 43766788de7..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 247 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 224313c6c8d..f51271dc3de 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -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`, `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`, `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: 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` 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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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-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/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/underconstrained_generic.stderr b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr index e4de9245951..48cef847fbb 100644 --- a/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr +++ b/tests/ui/type-alias-impl-trait/underconstrained_generic.stderr @@ -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/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/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 | |
