diff options
Diffstat (limited to 'tests')
774 files changed, 5627 insertions, 2674 deletions
diff --git a/tests/assembly/cstring-merging.rs b/tests/assembly/cstring-merging.rs index 7436e241823..07f25d1e1a4 100644 --- a/tests/assembly/cstring-merging.rs +++ b/tests/assembly/cstring-merging.rs @@ -1,6 +1,7 @@ //@ only-linux //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -Copt-level=3 --edition 2024 +//@ compile-flags: --crate-type=lib -Copt-level=3 +//@ edition: 2024 use std::ffi::CStr; diff --git a/tests/assembly/simd-bitmask.rs b/tests/assembly/simd-bitmask.rs index a632791153b..e4122461087 100644 --- a/tests/assembly/simd-bitmask.rs +++ b/tests/assembly/simd-bitmask.rs @@ -35,9 +35,8 @@ pub struct m64x2([i64; 2]); #[repr(simd)] pub struct m64x4([i64; 4]); -extern "rust-intrinsic" { - fn simd_bitmask<V, B>(mask: V) -> B; -} +#[rustc_intrinsic] +unsafe fn simd_bitmask<V, B>(mask: V) -> B; // CHECK-LABEL: bitmask_m8x16 #[no_mangle] diff --git a/tests/assembly/simd-intrinsic-gather.rs b/tests/assembly/simd-intrinsic-gather.rs index 8c17a58046d..bcab0ba1cc0 100644 --- a/tests/assembly/simd-intrinsic-gather.rs +++ b/tests/assembly/simd-intrinsic-gather.rs @@ -22,9 +22,8 @@ pub struct m64x4([i64; 4]); #[repr(simd)] pub struct pf64x4([*const f64; 4]); -extern "rust-intrinsic" { - fn simd_gather<V, M, P>(values: V, mask: M, pointer: P) -> V; -} +#[rustc_intrinsic] +unsafe fn simd_gather<V, M, P>(values: V, mask: M, pointer: P) -> V; // CHECK-LABEL: gather_f64x4 #[no_mangle] diff --git a/tests/assembly/simd-intrinsic-mask-load.rs b/tests/assembly/simd-intrinsic-mask-load.rs index a0d0514c014..d3f3453a780 100644 --- a/tests/assembly/simd-intrinsic-mask-load.rs +++ b/tests/assembly/simd-intrinsic-mask-load.rs @@ -34,9 +34,8 @@ pub struct f64x4([f64; 4]); #[repr(simd)] pub struct m64x4([i64; 4]); -extern "rust-intrinsic" { - fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; -} +#[rustc_intrinsic] +unsafe fn simd_masked_load<M, P, T>(mask: M, pointer: P, values: T) -> T; // CHECK-LABEL: load_i8x16 #[no_mangle] diff --git a/tests/assembly/simd-intrinsic-mask-reduce.rs b/tests/assembly/simd-intrinsic-mask-reduce.rs index 959c4ddefdb..8b15ed0a254 100644 --- a/tests/assembly/simd-intrinsic-mask-reduce.rs +++ b/tests/assembly/simd-intrinsic-mask-reduce.rs @@ -20,10 +20,10 @@ use minicore::*; #[repr(simd)] pub struct mask8x16([i8; 16]); -extern "rust-intrinsic" { - fn simd_reduce_all<T>(x: T) -> bool; - fn simd_reduce_any<T>(x: T) -> bool; -} +#[rustc_intrinsic] +unsafe fn simd_reduce_all<T>(x: T) -> bool; +#[rustc_intrinsic] +unsafe fn simd_reduce_any<T>(x: T) -> bool; // CHECK-LABEL: mask_reduce_all: #[no_mangle] diff --git a/tests/assembly/simd-intrinsic-mask-store.rs b/tests/assembly/simd-intrinsic-mask-store.rs index 4be9194943c..001762e5060 100644 --- a/tests/assembly/simd-intrinsic-mask-store.rs +++ b/tests/assembly/simd-intrinsic-mask-store.rs @@ -34,9 +34,8 @@ pub struct f64x4([f64; 4]); #[repr(simd)] pub struct m64x4([i64; 4]); -extern "rust-intrinsic" { - fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T); -} +#[rustc_intrinsic] +unsafe fn simd_masked_store<M, P, T>(mask: M, pointer: P, values: T); // CHECK-LABEL: store_i8x16 #[no_mangle] diff --git a/tests/assembly/simd-intrinsic-scatter.rs b/tests/assembly/simd-intrinsic-scatter.rs index 715de04af4d..d77dfad3546 100644 --- a/tests/assembly/simd-intrinsic-scatter.rs +++ b/tests/assembly/simd-intrinsic-scatter.rs @@ -22,9 +22,8 @@ pub struct m64x4([i64; 4]); #[repr(simd)] pub struct pf64x4([*mut f64; 4]); -extern "rust-intrinsic" { - fn simd_scatter<V, P, M>(values: V, pointer: P, mask: M); -} +#[rustc_intrinsic] +unsafe fn simd_scatter<V, P, M>(values: V, pointer: P, mask: M); // CHECK-LABEL: scatter_f64x4 #[no_mangle] diff --git a/tests/assembly/simd-intrinsic-select.rs b/tests/assembly/simd-intrinsic-select.rs index 7f1e42662bf..4f8d6b825b6 100644 --- a/tests/assembly/simd-intrinsic-select.rs +++ b/tests/assembly/simd-intrinsic-select.rs @@ -48,9 +48,8 @@ pub struct f64x8([f64; 8]); #[repr(simd)] pub struct m64x8([i64; 8]); -extern "rust-intrinsic" { - fn simd_select<M, V>(mask: M, a: V, b: V) -> V; -} +#[rustc_intrinsic] +unsafe fn simd_select<M, V>(mask: M, a: V, b: V) -> V; // CHECK-LABEL: select_i8x16 #[no_mangle] diff --git a/tests/assembly/x86_64-typed-swap.rs b/tests/assembly/x86_64-typed-swap.rs index dfd6ee565bc..a6753011d36 100644 --- a/tests/assembly/x86_64-typed-swap.rs +++ b/tests/assembly/x86_64-typed-swap.rs @@ -51,3 +51,31 @@ pub fn swap_simd(x: &mut __m128, y: &mut __m128) { // CHECK-NEXT: retq swap(x, y) } + +// CHECK-LABEL: swap_string: +#[no_mangle] +pub fn swap_string(x: &mut String, y: &mut String) { + // CHECK-NOT: mov + // CHECK-COUNT-4: movups + // CHECK-NOT: mov + // CHECK-COUNT-4: movq + // CHECK-NOT: mov + swap(x, y) +} + +// CHECK-LABEL: swap_44_bytes: +#[no_mangle] +pub fn swap_44_bytes(x: &mut [u8; 44], y: &mut [u8; 44]) { + // Ensure we do better than a long run of byte copies, + // see <https://github.com/rust-lang/rust/issues/134946> + + // CHECK-NOT: movb + // CHECK-COUNT-8: movups{{.+}}xmm + // CHECK-NOT: movb + // CHECK-COUNT-4: movq + // CHECK-NOT: movb + // CHECK-COUNT-4: movl + // CHECK-NOT: movb + // CHECK: retq + swap(x, y) +} diff --git a/tests/assembly/x86_64-windows-float-abi.rs b/tests/assembly/x86_64-windows-float-abi.rs index e8900be1aae..cbc80910851 100644 --- a/tests/assembly/x86_64-windows-float-abi.rs +++ b/tests/assembly/x86_64-windows-float-abi.rs @@ -37,7 +37,8 @@ pub extern "C" fn second_f64(_: f64, x: f64) -> f64 { } // CHECK-LABEL: second_f128 -// CHECK: movaps %xmm1, %xmm0 +// FIXME(llvm21): this can be just %rdx instead of the regex once we don't test on LLVM 20 +// CHECK: movaps {{(%xmm1|\(%rdx\))}}, %xmm0 // CHECK-NEXT: retq #[no_mangle] pub extern "C" fn second_f128(_: f128, x: f128) -> f128 { diff --git a/tests/codegen/async-closure-debug.rs b/tests/codegen/async-closure-debug.rs index 2d67e02eb9c..b5b369e6e54 100644 --- a/tests/codegen/async-closure-debug.rs +++ b/tests/codegen/async-closure-debug.rs @@ -1,6 +1,7 @@ // Just make sure that async closures don't ICE. // -//@ compile-flags: -C debuginfo=2 --edition=2018 +//@ compile-flags: -C debuginfo=2 +//@ edition: 2018 //@ ignore-msvc // CHECK-DAG: [[GEN_FN:!.*]] = !DINamespace(name: "async_closure_test" diff --git a/tests/codegen/async-fn-debug-awaitee-field.rs b/tests/codegen/async-fn-debug-awaitee-field.rs index ab13d4509e2..50860c90662 100644 --- a/tests/codegen/async-fn-debug-awaitee-field.rs +++ b/tests/codegen/async-fn-debug-awaitee-field.rs @@ -7,7 +7,8 @@ //@[MSVC] only-msvc //@[NONMSVC] ignore-msvc -//@ compile-flags: -C debuginfo=2 --edition=2018 -Copt-level=0 +//@ compile-flags: -C debuginfo=2 -Copt-level=0 +//@ edition: 2018 #![crate_type = "lib"] diff --git a/tests/codegen/async-fn-debug-msvc.rs b/tests/codegen/async-fn-debug-msvc.rs index 7c695042b42..e0c601146f8 100644 --- a/tests/codegen/async-fn-debug-msvc.rs +++ b/tests/codegen/async-fn-debug-msvc.rs @@ -4,7 +4,8 @@ // - Other fields are not marked artificial // // -//@ compile-flags: -C debuginfo=2 --edition=2018 +//@ compile-flags: -C debuginfo=2 +//@ edition: 2018 //@ only-msvc async fn foo() {} @@ -19,23 +20,23 @@ async fn async_fn_test() { // CHECK-DAG: [[GEN:!.*]] = !DICompositeType(tag: DW_TAG_union_type, name: "enum2$<async_fn_debug_msvc::async_fn_test::async_fn_env$0>", // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant0", scope: [[GEN]], // For brevity, we only check the struct name and members of the last variant. -// CHECK-SAME: file: [[FILE:![0-9]*]], line: 11, +// CHECK-SAME: file: [[FILE:![0-9]*]], line: 12, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant1", scope: [[GEN]], -// CHECK-SAME: file: [[FILE]], line: 15, +// CHECK-SAME: file: [[FILE]], line: 16, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant2", scope: [[GEN]], -// CHECK-SAME: file: [[FILE]], line: 15, +// CHECK-SAME: file: [[FILE]], line: 16, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant3", scope: [[GEN]], -// CHECK-SAME: file: [[FILE]], line: 12, +// CHECK-SAME: file: [[FILE]], line: 13, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant4", scope: [[GEN]], -// CHECK-SAME: file: [[FILE]], line: 14, +// CHECK-SAME: file: [[FILE]], line: 15, // CHECK-SAME: baseType: [[VARIANT_WRAPPER:![0-9]*]] // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) diff --git a/tests/codegen/async-fn-debug.rs b/tests/codegen/async-fn-debug.rs index 7be4ad45665..ed704c7cc8b 100644 --- a/tests/codegen/async-fn-debug.rs +++ b/tests/codegen/async-fn-debug.rs @@ -4,7 +4,8 @@ // - Other fields are not marked artificial // // -//@ compile-flags: -C debuginfo=2 --edition=2018 +//@ compile-flags: -C debuginfo=2 +//@ edition: 2018 //@ ignore-msvc async fn foo() {} @@ -22,26 +23,26 @@ async fn async_fn_test() { // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: discriminator: [[DISC:![0-9]*]] // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "0", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE:![0-9]*]], line: 11, +// CHECK-SAME: file: [[FILE:![0-9]*]], line: 12, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "Unresumed", scope: [[GEN]], // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "1", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE]], line: 15, +// CHECK-SAME: file: [[FILE]], line: 16, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "2", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE]], line: 15, +// CHECK-SAME: file: [[FILE]], line: 16, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "3", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE]], line: 12, +// CHECK-SAME: file: [[FILE]], line: 13, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "4", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE]], line: 14, +// CHECK-SAME: file: [[FILE]], line: 15, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: [[S1:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Suspend1", scope: [[GEN]], diff --git a/tests/codegen/autodiffv.rs b/tests/codegen/autodiff/batched.rs index e0047116405..e0047116405 100644 --- a/tests/codegen/autodiffv.rs +++ b/tests/codegen/autodiff/batched.rs diff --git a/tests/codegen/autodiff.rs b/tests/codegen/autodiff/scalar.rs index 85358f5fcb6..85358f5fcb6 100644 --- a/tests/codegen/autodiff.rs +++ b/tests/codegen/autodiff/scalar.rs diff --git a/tests/codegen/autodiff/sret.rs b/tests/codegen/autodiff/sret.rs new file mode 100644 index 00000000000..5ead90041ed --- /dev/null +++ b/tests/codegen/autodiff/sret.rs @@ -0,0 +1,45 @@ +//@ compile-flags: -Zautodiff=Enable -C opt-level=3 -Clto=fat +//@ no-prefer-dynamic +//@ needs-enzyme + +// This test is almost identical to the scalar.rs one, +// but we intentionally add a few more floats. +// `df` would ret `{ f64, f32, f32 }`, but is lowered as an sret. +// We therefore use this test to verify some of our sret handling. + +#![feature(autodiff)] + +use std::autodiff::autodiff; + +#[no_mangle] +#[autodiff(df, Reverse, Active, Active, Active)] +fn primal(x: f32, y: f32) -> f64 { + (x * x * y) as f64 +} + +// CHECK:define internal fastcc void @_ZN4sret2df17h93be4316dd8ea006E(ptr dead_on_unwind noalias nocapture noundef nonnull writable writeonly align 8 dereferenceable(16) initializes((0, 16)) %_0, float noundef %x, float noundef %y) +// CHECK-NEXT:start: +// CHECK-NEXT: %0 = tail call fastcc { double, float, float } @diffeprimal(float %x, float %y) +// CHECK-NEXT: %.elt = extractvalue { double, float, float } %0, 0 +// CHECK-NEXT: store double %.elt, ptr %_0, align 8 +// CHECK-NEXT: %_0.repack1 = getelementptr inbounds nuw i8, ptr %_0, i64 8 +// CHECK-NEXT: %.elt2 = extractvalue { double, float, float } %0, 1 +// CHECK-NEXT: store float %.elt2, ptr %_0.repack1, align 8 +// CHECK-NEXT: %_0.repack3 = getelementptr inbounds nuw i8, ptr %_0, i64 12 +// CHECK-NEXT: %.elt4 = extractvalue { double, float, float } %0, 2 +// CHECK-NEXT: store float %.elt4, ptr %_0.repack3, align 4 +// CHECK-NEXT: ret void +// CHECK-NEXT:} + +fn main() { + let x = std::hint::black_box(3.0); + let y = std::hint::black_box(2.5); + let scalar = std::hint::black_box(1.0); + let (r1, r2, r3) = df(x, y, scalar); + // 3*3*1.5 = 22.5 + assert_eq!(r1, 22.5); + // 2*x*y = 2*3*2.5 = 15.0 + assert_eq!(r2, 15.0); + // x*x*1 = 3*3 = 9 + assert_eq!(r3, 9.0); +} diff --git a/tests/codegen/avr/avr-func-addrspace.rs b/tests/codegen/avr/avr-func-addrspace.rs index 2ae2f40d7b3..e0192f8b45a 100644 --- a/tests/codegen/avr/avr-func-addrspace.rs +++ b/tests/codegen/avr/avr-func-addrspace.rs @@ -17,9 +17,8 @@ extern crate minicore; use minicore::*; -extern "rust-intrinsic" { - pub fn transmute<Src, Dst>(src: Src) -> Dst; -} +#[rustc_intrinsic] +pub unsafe fn transmute<Src, Dst>(src: Src) -> Dst; pub static mut STORAGE_FOO: fn(&usize, &mut u32) -> Result<(), ()> = arbitrary_black_box; pub static mut STORAGE_BAR: u32 = 12; diff --git a/tests/codegen/coroutine-debug.rs b/tests/codegen/coroutine-debug.rs index d00667a37d5..ff62e9709b4 100644 --- a/tests/codegen/coroutine-debug.rs +++ b/tests/codegen/coroutine-debug.rs @@ -4,7 +4,8 @@ // - Other fields are not marked artificial // // -//@ compile-flags: -C debuginfo=2 --edition=2018 +//@ compile-flags: -C debuginfo=2 +//@ edition: 2018 //@ ignore-msvc #![feature(coroutines, coroutine_trait)] @@ -27,26 +28,26 @@ fn coroutine_test() -> impl Coroutine<Yield = i32, Return = ()> { // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: discriminator: [[DISC:![0-9]*]] // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "0", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE:![0-9]*]], line: 15, +// CHECK-SAME: file: [[FILE:![0-9]*]], line: 16, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DICompositeType(tag: DW_TAG_structure_type, name: "Unresumed", scope: [[GEN]], // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "1", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE]], line: 19, +// CHECK-SAME: file: [[FILE]], line: 20, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "2", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE]], line: 19, +// CHECK-SAME: file: [[FILE]], line: 20, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "3", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE]], line: 16, +// CHECK-SAME: file: [[FILE]], line: 17, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "4", scope: [[VARIANT]], -// CHECK-SAME: file: [[FILE]], line: 18, +// CHECK-SAME: file: [[FILE]], line: 19, // CHECK-NOT: flags: DIFlagArtificial // CHECK-SAME: ) // CHECK: [[S1:!.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Suspend1", scope: [[GEN]], diff --git a/tests/codegen/debuginfo-generic-closure-env-names.rs b/tests/codegen/debuginfo-generic-closure-env-names.rs index 6b314c9abae..64bc58e1df7 100644 --- a/tests/codegen/debuginfo-generic-closure-env-names.rs +++ b/tests/codegen/debuginfo-generic-closure-env-names.rs @@ -18,7 +18,8 @@ // legacy mangling scheme rustc version and generic parameters are both hashed into a single part // of the name, thus randomizing item order with respect to rustc version. -//@ compile-flags: -Cdebuginfo=2 --edition 2021 -Copt-level=0 -Csymbol-mangling-version=v0 +//@ compile-flags: -Cdebuginfo=2 -Copt-level=0 -Csymbol-mangling-version=v0 +//@ edition: 2021 // non_generic_closure() // NONMSVC: !DICompositeType(tag: DW_TAG_structure_type, name: "{closure_env#0}", scope: ![[non_generic_closure_NAMESPACE:[0-9]+]], diff --git a/tests/codegen/emscripten-catch-unwind-js-eh.rs b/tests/codegen/emscripten-catch-unwind-js-eh.rs index 018ad5454fc..3ab4b5c9c63 100644 --- a/tests/codegen/emscripten-catch-unwind-js-eh.rs +++ b/tests/codegen/emscripten-catch-unwind-js-eh.rs @@ -23,13 +23,12 @@ fn size_of<T>() -> usize { loop {} } -extern "rust-intrinsic" { - fn catch_unwind( - try_fn: fn(_: *mut u8), - data: *mut u8, - catch_fn: fn(_: *mut u8, _: *mut u8), - ) -> i32; -} +#[rustc_intrinsic] +unsafe fn catch_unwind( + try_fn: fn(_: *mut u8), + data: *mut u8, + catch_fn: fn(_: *mut u8, _: *mut u8), +) -> i32; // CHECK-LABEL: @ptr_size #[no_mangle] diff --git a/tests/codegen/emscripten-catch-unwind-wasm-eh.rs b/tests/codegen/emscripten-catch-unwind-wasm-eh.rs index 0fc9ae96720..d0571e4df08 100644 --- a/tests/codegen/emscripten-catch-unwind-wasm-eh.rs +++ b/tests/codegen/emscripten-catch-unwind-wasm-eh.rs @@ -21,14 +21,12 @@ impl<T> Copy for *mut T {} fn size_of<T>() -> usize { loop {} } - -extern "rust-intrinsic" { - fn catch_unwind( - try_fn: fn(_: *mut u8), - data: *mut u8, - catch_fn: fn(_: *mut u8, _: *mut u8), - ) -> i32; -} +#[rustc_intrinsic] +unsafe fn catch_unwind( + try_fn: fn(_: *mut u8), + data: *mut u8, + catch_fn: fn(_: *mut u8, _: *mut u8), +) -> i32; // CHECK-LABEL: @ptr_size #[no_mangle] diff --git a/tests/codegen/enum/enum-match.rs b/tests/codegen/enum/enum-match.rs index a24b98050d2..6e185cf8932 100644 --- a/tests/codegen/enum/enum-match.rs +++ b/tests/codegen/enum/enum-match.rs @@ -1,21 +1,26 @@ //@ compile-flags: -Copt-level=1 -//@ only-x86_64 +//@ only-64bit #![crate_type = "lib"] +#![feature(core_intrinsics)] // Check each of the 3 cases for `codegen_get_discr`. +// FIXME: once our min-bar LLVM has `range` attributes, update the various +// tests here to no longer have the `range`s and `nsw`s as optional. + // Case 0: One tagged variant. pub enum Enum0 { A(bool), B, } -// CHECK: define noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match0{{.*}} +// CHECK-LABEL: define noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match0(i8{{.+}}%0) // CHECK-NEXT: start: -// CHECK-NEXT: %1 = icmp eq i8 %0, 2 -// CHECK-NEXT: %2 = and i8 %0, 1 -// CHECK-NEXT: %{{.+}} = select i1 %1, i8 13, i8 %2 +// CHECK-NEXT: %[[IS_B:.+]] = icmp eq i8 %0, 2 +// CHECK-NEXT: %[[TRUNC:.+]] = and i8 %0, 1 +// CHECK-NEXT: %[[R:.+]] = select i1 %[[IS_B]], i8 13, i8 %[[TRUNC]] +// CHECK-NEXT: ret i8 %[[R]] #[no_mangle] pub fn match0(e: Enum0) -> u8 { use Enum0::*; @@ -32,13 +37,14 @@ pub enum Enum1 { C, } -// CHECK: define noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match1{{.*}} +// CHECK-LABEL: define noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match1(i8{{.+}}%0) // CHECK-NEXT: start: -// CHECK-NEXT: %1 = add{{( nsw)?}} i8 %0, -2 -// CHECK-NEXT: %2 = zext i8 %1 to i64 -// CHECK-NEXT: %3 = icmp ult i8 %1, 2 -// CHECK-NEXT: %4 = add nuw nsw i64 %2, 1 -// CHECK-NEXT: %_2 = select i1 %3, i64 %4, i64 0 +// CHECK-NEXT: %[[REL_VAR:.+]] = add{{( nsw)?}} i8 %0, -2 +// CHECK-NEXT: %[[REL_VAR_WIDE:.+]] = zext i8 %[[REL_VAR]] to i64 +// CHECK-NEXT: %[[IS_NICHE:.+]] = icmp ult i8 %[[REL_VAR]], 2 +// CHECK-NEXT: %[[NICHE_DISCR:.+]] = add nuw nsw i64 %[[REL_VAR_WIDE]], 1 +// CHECK-NEXT: %[[DISCR:.+]] = select i1 %[[IS_NICHE]], i64 %[[NICHE_DISCR]], i64 0 +// CHECK-NEXT: switch i64 %[[DISCR]] #[no_mangle] pub fn match1(e: Enum1) -> u8 { use Enum1::*; @@ -92,14 +98,14 @@ pub enum Enum2 { E, } -// CHECK: define noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match2{{.*}} +// CHECK-LABEL: define noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match2(i8{{.+}}%0) // CHECK-NEXT: start: -// CHECK-NEXT: %1 = add i8 %0, 2 -// CHECK-NEXT: %2 = zext i8 %1 to i64 -// CHECK-NEXT: %3 = icmp ult i8 %1, 4 -// CHECK-NEXT: %4 = add nuw nsw i64 %2, 1 -// CHECK-NEXT: %_2 = select i1 %3, i64 %4, i64 0 -// CHECK-NEXT: switch i64 %_2, label {{.*}} [ +// CHECK-NEXT: %[[REL_VAR:.+]] = add i8 %0, 2 +// CHECK-NEXT: %[[REL_VAR_WIDE:.+]] = zext i8 %[[REL_VAR]] to i64 +// CHECK-NEXT: %[[IS_NICHE:.+]] = icmp ult i8 %[[REL_VAR]], 4 +// CHECK-NEXT: %[[NICHE_DISCR:.+]] = add nuw nsw i64 %[[REL_VAR_WIDE]], 1 +// CHECK-NEXT: %[[DISCR:.+]] = select i1 %[[IS_NICHE]], i64 %[[NICHE_DISCR]], i64 0 +// CHECK-NEXT: switch i64 %[[DISCR]] #[no_mangle] pub fn match2(e: Enum2) -> u8 { use Enum2::*; @@ -111,3 +117,357 @@ pub fn match2(e: Enum2) -> u8 { E => 250, } } + +// And make sure it works even if the niched scalar is a pointer. +// (For example, that we don't try to `sub` on pointers.) + +// CHECK-LABEL: define noundef{{( range\(i16 -?[0-9]+, -?[0-9]+\))?}} i16 @match3(ptr{{.+}}%0) +// CHECK-NEXT: start: +// CHECK-NEXT: %[[IS_NULL:.+]] = icmp eq ptr %0, null +// CHECK-NEXT: br i1 %[[IS_NULL]] +#[no_mangle] +pub fn match3(e: Option<&u8>) -> i16 { + match e { + Some(r) => *r as _, + None => -1, + } +} + +// If the untagged variant is in the middle, there's an impossible value that's +// not reflected in the `range` parameter attribute, so we assume it away. + +#[derive(PartialEq)] +pub enum MiddleNiche { + A, + B, + C(bool), + D, + E, +} + +// CHECK-LABEL: define noundef{{( range\(i8 -?[0-9]+, -?[0-9]+\))?}} i8 @match4(i8{{.+}}%0) +// CHECK-NEXT: start: +// CHECK-NEXT: %[[REL_VAR:.+]] = add{{( nsw)?}} i8 %0, -2 +// CHECK-NEXT: %[[IS_NICHE:.+]] = icmp ult i8 %[[REL_VAR]], 5 +// CHECK-NEXT: %[[NOT_IMPOSSIBLE:.+]] = icmp ne i8 %[[REL_VAR]], 2 +// CHECK-NEXT: call void @llvm.assume(i1 %[[NOT_IMPOSSIBLE]]) +// CHECK-NEXT: %[[DISCR:.+]] = select i1 %[[IS_NICHE]], i8 %[[REL_VAR]], i8 2 +// CHECK-NEXT: switch i8 %[[DISCR]] +#[no_mangle] +pub fn match4(e: MiddleNiche) -> u8 { + use MiddleNiche::*; + match e { + A => 13, + B => 100, + C(b) => b as u8, + D => 200, + E => 250, + } +} + +// CHECK-LABEL: define{{.+}}i1 @match4_is_c(i8{{.+}}%e) +// CHECK-NEXT: start +// CHECK-NEXT: %[[REL_VAR:.+]] = add{{( nsw)?}} i8 %e, -2 +// CHECK-NEXT: %[[NOT_NICHE:.+]] = icmp ugt i8 %[[REL_VAR]], 4 +// CHECK-NEXT: %[[NOT_IMPOSSIBLE:.+]] = icmp ne i8 %[[REL_VAR]], 2 +// CHECK-NEXT: call void @llvm.assume(i1 %[[NOT_IMPOSSIBLE]]) +// CHECK-NEXT: ret i1 %[[NOT_NICHE]] +#[no_mangle] +pub fn match4_is_c(e: MiddleNiche) -> bool { + // Before #139098, this couldn't optimize out the `select` because it looked + // like it was possible for a `2` to be produced on both sides. + + std::intrinsics::discriminant_value(&e) == 2 +} + +// You have to do something pretty obnoxious to get a variant index that doesn't +// fit in the tag size, but it's possible + +pub enum Never {} + +pub enum HugeVariantIndex { + V000(Never), + V001(Never), + V002(Never), + V003(Never), + V004(Never), + V005(Never), + V006(Never), + V007(Never), + V008(Never), + V009(Never), + V010(Never), + V011(Never), + V012(Never), + V013(Never), + V014(Never), + V015(Never), + V016(Never), + V017(Never), + V018(Never), + V019(Never), + V020(Never), + V021(Never), + V022(Never), + V023(Never), + V024(Never), + V025(Never), + V026(Never), + V027(Never), + V028(Never), + V029(Never), + V030(Never), + V031(Never), + V032(Never), + V033(Never), + V034(Never), + V035(Never), + V036(Never), + V037(Never), + V038(Never), + V039(Never), + V040(Never), + V041(Never), + V042(Never), + V043(Never), + V044(Never), + V045(Never), + V046(Never), + V047(Never), + V048(Never), + V049(Never), + V050(Never), + V051(Never), + V052(Never), + V053(Never), + V054(Never), + V055(Never), + V056(Never), + V057(Never), + V058(Never), + V059(Never), + V060(Never), + V061(Never), + V062(Never), + V063(Never), + V064(Never), + V065(Never), + V066(Never), + V067(Never), + V068(Never), + V069(Never), + V070(Never), + V071(Never), + V072(Never), + V073(Never), + V074(Never), + V075(Never), + V076(Never), + V077(Never), + V078(Never), + V079(Never), + V080(Never), + V081(Never), + V082(Never), + V083(Never), + V084(Never), + V085(Never), + V086(Never), + V087(Never), + V088(Never), + V089(Never), + V090(Never), + V091(Never), + V092(Never), + V093(Never), + V094(Never), + V095(Never), + V096(Never), + V097(Never), + V098(Never), + V099(Never), + V100(Never), + V101(Never), + V102(Never), + V103(Never), + V104(Never), + V105(Never), + V106(Never), + V107(Never), + V108(Never), + V109(Never), + V110(Never), + V111(Never), + V112(Never), + V113(Never), + V114(Never), + V115(Never), + V116(Never), + V117(Never), + V118(Never), + V119(Never), + V120(Never), + V121(Never), + V122(Never), + V123(Never), + V124(Never), + V125(Never), + V126(Never), + V127(Never), + V128(Never), + V129(Never), + V130(Never), + V131(Never), + V132(Never), + V133(Never), + V134(Never), + V135(Never), + V136(Never), + V137(Never), + V138(Never), + V139(Never), + V140(Never), + V141(Never), + V142(Never), + V143(Never), + V144(Never), + V145(Never), + V146(Never), + V147(Never), + V148(Never), + V149(Never), + V150(Never), + V151(Never), + V152(Never), + V153(Never), + V154(Never), + V155(Never), + V156(Never), + V157(Never), + V158(Never), + V159(Never), + V160(Never), + V161(Never), + V162(Never), + V163(Never), + V164(Never), + V165(Never), + V166(Never), + V167(Never), + V168(Never), + V169(Never), + V170(Never), + V171(Never), + V172(Never), + V173(Never), + V174(Never), + V175(Never), + V176(Never), + V177(Never), + V178(Never), + V179(Never), + V180(Never), + V181(Never), + V182(Never), + V183(Never), + V184(Never), + V185(Never), + V186(Never), + V187(Never), + V188(Never), + V189(Never), + V190(Never), + V191(Never), + V192(Never), + V193(Never), + V194(Never), + V195(Never), + V196(Never), + V197(Never), + V198(Never), + V199(Never), + V200(Never), + V201(Never), + V202(Never), + V203(Never), + V204(Never), + V205(Never), + V206(Never), + V207(Never), + V208(Never), + V209(Never), + V210(Never), + V211(Never), + V212(Never), + V213(Never), + V214(Never), + V215(Never), + V216(Never), + V217(Never), + V218(Never), + V219(Never), + V220(Never), + V221(Never), + V222(Never), + V223(Never), + V224(Never), + V225(Never), + V226(Never), + V227(Never), + V228(Never), + V229(Never), + V230(Never), + V231(Never), + V232(Never), + V233(Never), + V234(Never), + V235(Never), + V236(Never), + V237(Never), + V238(Never), + V239(Never), + V240(Never), + V241(Never), + V242(Never), + V243(Never), + V244(Never), + V245(Never), + V246(Never), + V247(Never), + V248(Never), + V249(Never), + V250(Never), + V251(Never), + V252(Never), + V253(Never), + V254(Never), + V255(Never), + V256(Never), + + Possible257, + Bool258(bool), + Possible259, +} + +// CHECK-LABEL: define noundef{{( range\(i8 [0-9]+, [0-9]+\))?}} i8 @match5(i8{{.+}}%0) +// CHECK-NEXT: start: +// CHECK-NEXT: %[[REL_VAR:.+]] = add{{( nsw)?}} i8 %0, -2 +// CHECK-NEXT: %[[REL_VAR_WIDE:.+]] = zext i8 %[[REL_VAR]] to i64 +// CHECK-NEXT: %[[IS_NICHE:.+]] = icmp ult i8 %[[REL_VAR]], 3 +// CHECK-NEXT: %[[NOT_IMPOSSIBLE:.+]] = icmp ne i8 %[[REL_VAR]], 1 +// CHECK-NEXT: call void @llvm.assume(i1 %[[NOT_IMPOSSIBLE]]) +// CHECK-NEXT: %[[NICHE_DISCR:.+]] = add nuw nsw i64 %[[REL_VAR_WIDE]], 257 +// CHECK-NEXT: %[[DISCR:.+]] = select i1 %[[IS_NICHE]], i64 %[[NICHE_DISCR]], i64 258 +// CHECK-NEXT: switch i64 %[[DISCR]], +// CHECK-NEXT: i64 257, +// CHECK-NEXT: i64 258, +// CHECK-NEXT: i64 259, +#[no_mangle] +pub fn match5(e: HugeVariantIndex) -> u8 { + use HugeVariantIndex::*; + match e { + Possible257 => 13, + Bool258(b) => b as u8, + Possible259 => 100, + } +} diff --git a/tests/codegen/enum/enum-two-variants-match.rs b/tests/codegen/enum/enum-two-variants-match.rs index 21ae1f96bca..12d9edc4d62 100644 --- a/tests/codegen/enum/enum-two-variants-match.rs +++ b/tests/codegen/enum/enum-two-variants-match.rs @@ -1,8 +1,12 @@ //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -//@ only-x86_64 (because these discriminants are isize) +//@ only-64bit (because these discriminants are isize) #![crate_type = "lib"] +// This directly tests what we emit for these matches, rather than what happens +// after optimization, so it doesn't need to worry about extra flags on the +// instructions and is less susceptible to being broken on LLVM updates. + // CHECK-LABEL: @option_match #[no_mangle] pub fn option_match(x: Option<i32>) -> u16 { @@ -51,3 +55,76 @@ pub fn result_match(x: Result<u64, i64>) -> u16 { Ok(_) => 42, } } + +// CHECK-LABEL: @option_bool_match( +#[no_mangle] +pub fn option_bool_match(x: Option<bool>) -> char { + // CHECK: %[[RAW:.+]] = load i8, ptr %x + // CHECK: %[[IS_NONE:.+]] = icmp eq i8 %[[RAW]], 2 + // CHECK: %[[OPT_DISCR:.+]] = select i1 %[[IS_NONE]], i64 0, i64 1 + // CHECK: %[[OPT_DISCR_T:.+]] = trunc nuw i64 %[[OPT_DISCR]] to i1 + // CHECK: br i1 %[[OPT_DISCR_T]], label %[[BB_SOME:.+]], label %[[BB_NONE:.+]] + + // CHECK: [[BB_SOME]]: + // CHECK: %[[FIELD:.+]] = load i8, ptr %x + // CHECK: %[[FIELD_T:.+]] = trunc nuw i8 %[[FIELD]] to i1 + // CHECK: br i1 %[[FIELD_T]] + match x { + None => 'n', + Some(false) => 'f', + Some(true) => 't', + } +} + +use std::cmp::Ordering::{self, *}; +// CHECK-LABEL: @option_ordering_match( +#[no_mangle] +pub fn option_ordering_match(x: Option<Ordering>) -> char { + // CHECK: %[[RAW:.+]] = load i8, ptr %x + // CHECK: %[[IS_NONE:.+]] = icmp eq i8 %[[RAW]], 2 + // CHECK: %[[OPT_DISCR:.+]] = select i1 %[[IS_NONE]], i64 0, i64 1 + // CHECK: %[[OPT_DISCR_T:.+]] = trunc nuw i64 %[[OPT_DISCR]] to i1 + // CHECK: br i1 %[[OPT_DISCR_T]], label %[[BB_SOME:.+]], label %[[BB_NONE:.+]] + + // CHECK: [[BB_SOME]]: + // CHECK: %[[FIELD:.+]] = load i8, ptr %x + // CHECK: switch i8 %[[FIELD]], label %[[UNREACHABLE:.+]] [ + // CHECK-NEXT: i8 -1, label + // CHECK-NEXT: i8 0, label + // CHECK-NEXT: i8 1, label + // CHECK-NEXT: ] + + // CHECK: [[UNREACHABLE]]: + // CHECK-NEXT: unreachable + match x { + None => '?', + Some(Less) => '<', + Some(Equal) => '=', + Some(Greater) => '>', + } +} + +// CHECK-LABEL: @option_nonzero_match( +#[no_mangle] +pub fn option_nonzero_match(x: Option<std::num::NonZero<u16>>) -> u16 { + // CHECK: %[[OUT:.+]] = alloca [2 x i8] + + // CHECK: %[[IS_NONE:.+]] = icmp eq i16 %x, 0 + // CHECK: %[[OPT_DISCR:.+]] = select i1 %[[IS_NONE]], i64 0, i64 1 + // CHECK: %[[OPT_DISCR_T:.+]] = trunc nuw i64 %[[OPT_DISCR]] to i1 + // CHECK: br i1 %[[OPT_DISCR_T]], label %[[BB_SOME:.+]], label %[[BB_NONE:.+]] + + // CHECK: [[BB_SOME]]: + // CHECK: store i16 987, ptr %[[OUT]] + + // CHECK: [[BB_NONE]]: + // CHECK: store i16 123, ptr %[[OUT]] + + // CHECK: %[[RET:.+]] = load i16, ptr %[[OUT]] + // CHECK: ret i16 %[[RET]] + + match x { + None => 123, + Some(_) => 987, + } +} diff --git a/tests/codegen/ergonomic-clones/closure.rs b/tests/codegen/ergonomic-clones/closure.rs new file mode 100644 index 00000000000..b6fc8172641 --- /dev/null +++ b/tests/codegen/ergonomic-clones/closure.rs @@ -0,0 +1,55 @@ +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 -Zmir-opt-level=0 + +#![crate_type = "lib"] + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +use std::clone::UseCloned; + +pub fn ergonomic_clone_closure_move() -> String { + let s = String::from("hi"); + + // CHECK-NOT: ; call core::clone::impls::<impl core::clone::Clone for String>::clone + let cl = use || s; + cl() +} + +#[derive(Clone)] +struct Foo; + +impl UseCloned for Foo {} + +pub fn ergonomic_clone_closure_use_cloned() -> Foo { + let f = Foo; + + // CHECK: ; call <closure::Foo as core::clone::Clone>::clone + let f1 = use || f; + + // CHECK: ; call <closure::Foo as core::clone::Clone>::clone + let f2 = use || f; + + f +} + +pub fn ergonomic_clone_closure_copy() -> i32 { + let i = 1; + + // CHECK-NOT: ; call core::clone::impls::<impl core::clone::Clone for i32>::clone + let i1 = use || i; + + // CHECK-NOT: ; call core::clone::impls::<impl core::clone::Clone for i32>::clone + let i2 = use || i; + + i +} + +pub fn ergonomic_clone_closure_use_cloned_generics<T: UseCloned>(f: T) -> T { + // CHECK-NOT: ; call core::clone::impls::<impl core::clone::Clone for i32>::clone + let f1 = use || f; + + // CHECK-NOT: ; call core::clone::impls::<impl core::clone::Clone for i32>::clone + let f2 = use || f; + + f +} diff --git a/tests/codegen/infallible-unwrap-in-opt-z.rs b/tests/codegen/infallible-unwrap-in-opt-z.rs index 3756fafe384..c2297c58e77 100644 --- a/tests/codegen/infallible-unwrap-in-opt-z.rs +++ b/tests/codegen/infallible-unwrap-in-opt-z.rs @@ -1,4 +1,5 @@ -//@ compile-flags: -C opt-level=z --edition=2021 +//@ compile-flags: -C opt-level=z +//@ edition: 2021 #![crate_type = "lib"] diff --git a/tests/codegen/inline-function-args-debug-info.rs b/tests/codegen/inline-function-args-debug-info.rs index 53a179160dc..c31419cb914 100644 --- a/tests/codegen/inline-function-args-debug-info.rs +++ b/tests/codegen/inline-function-args-debug-info.rs @@ -2,7 +2,8 @@ // gets inlined by MIR inlining. Without function argument indexes, `info args` in gdb won't show // arguments and their values for the current function. -//@ compile-flags: -Zinline-mir=yes -Cdebuginfo=2 --edition=2021 +//@ compile-flags: -Zinline-mir=yes -Cdebuginfo=2 +//@ edition: 2021 #![crate_type = "lib"] @@ -14,9 +15,9 @@ pub fn outer_function(x: usize, y: usize) -> usize { #[inline] fn inner_function(aaaa: usize, bbbb: usize) -> usize { // CHECK: !DILocalVariable(name: "aaaa", arg: 1 - // CHECK-SAME: line: 15 + // CHECK-SAME: line: 16 // CHECK-NOT: !DILexicalBlock( // CHECK: !DILocalVariable(name: "bbbb", arg: 2 - // CHECK-SAME: line: 15 + // CHECK-SAME: line: 16 aaaa + bbbb } diff --git a/tests/codegen/intrinsic-no-unnamed-attr.rs b/tests/codegen/intrinsic-no-unnamed-attr.rs index fce0de80d7b..35eb025ab6b 100644 --- a/tests/codegen/intrinsic-no-unnamed-attr.rs +++ b/tests/codegen/intrinsic-no-unnamed-attr.rs @@ -2,9 +2,9 @@ #![feature(intrinsics)] -extern "rust-intrinsic" { - fn sqrtf32(x: f32) -> f32; -} +#[rustc_intrinsic] +unsafe fn sqrtf32(x: f32) -> f32; + // CHECK: @llvm.sqrt.f32(float) #{{[0-9]*}} fn main() { diff --git a/tests/codegen/intrinsics/nontemporal.rs b/tests/codegen/intrinsics/nontemporal.rs index 1d4fae83c29..a151d4bd297 100644 --- a/tests/codegen/intrinsics/nontemporal.rs +++ b/tests/codegen/intrinsics/nontemporal.rs @@ -18,9 +18,8 @@ extern crate minicore; use minicore::*; -extern "rust-intrinsic" { - pub fn nontemporal_store<T>(ptr: *mut T, val: T); -} +#[rustc_intrinsic] +pub unsafe fn nontemporal_store<T>(ptr: *mut T, val: T); #[no_mangle] pub fn a(a: &mut u32, b: u32) { diff --git a/tests/codegen/issues/issue-101082.rs b/tests/codegen/issues/issue-101082.rs index 7fb850ca253..96cdff64dda 100644 --- a/tests/codegen/issues/issue-101082.rs +++ b/tests/codegen/issues/issue-101082.rs @@ -1,8 +1,16 @@ //@ compile-flags: -Copt-level=3 -//@ revisions: host x86-64-v3 +//@ revisions: host x86-64 x86-64-v3 //@ min-llvm-version: 20 -// This particular CPU regressed in #131563 +//@[host] ignore-x86_64 + +// Set the base cpu explicitly, in case the default has been changed. +//@[x86-64] only-x86_64 +//@[x86-64] compile-flags: -Ctarget-cpu=x86-64 + +// FIXME(cuviper) x86-64-v3 in particular regressed in #131563, and the workaround +// at the time still sometimes fails, so only verify it for the power-of-two size +// - https://github.com/llvm/llvm-project/issues/134735 //@[x86-64-v3] only-x86_64 //@[x86-64-v3] compile-flags: -Ctarget-cpu=x86-64-v3 @@ -11,7 +19,16 @@ #[no_mangle] pub fn test() -> usize { // CHECK-LABEL: @test( - // CHECK: ret {{i64|i32}} 165 + // host: ret {{i64|i32}} 165 + // x86-64: ret {{i64|i32}} 165 + + // FIXME: Now that this autovectorizes via a masked load, it doesn't actually + // const-fold for certain widths. The `test_eight` case below shows that, yes, + // what we're emitting *can* be const-folded, except that the way LLVM does it + // for certain widths doesn't today. We should be able to put this back to + // the same check after <https://github.com/llvm/llvm-project/issues/134513> + // x86-64-v3: masked.load + let values = [23, 16, 54, 3, 60, 9]; let mut acc = 0; for item in values { @@ -19,3 +36,15 @@ pub fn test() -> usize { } acc } + +#[no_mangle] +pub fn test_eight() -> usize { + // CHECK-LABEL: @test_eight( + // CHECK: ret {{i64|i32}} 220 + let values = [23, 16, 54, 3, 60, 9, 13, 42]; + let mut acc = 0; + for item in values { + acc += item; + } + acc +} diff --git a/tests/codegen/issues/issue-119422.rs b/tests/codegen/issues/issue-119422.rs index e1a082c377f..17ae71605b5 100644 --- a/tests/codegen/issues/issue-119422.rs +++ b/tests/codegen/issues/issue-119422.rs @@ -1,7 +1,8 @@ //! This test checks that compiler don't generate useless compares to zeros //! for `NonZero` integer types. //! -//@ compile-flags: -Copt-level=3 --edition=2021 -Zmerge-functions=disabled +//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled +//@ edition: 2021 //@ only-64bit (because the LLVM type of i64 for usize shows up) #![crate_type = "lib"] diff --git a/tests/codegen/simd/extract-insert-dyn.rs b/tests/codegen/simd/extract-insert-dyn.rs new file mode 100644 index 00000000000..584e2c7887a --- /dev/null +++ b/tests/codegen/simd/extract-insert-dyn.rs @@ -0,0 +1,75 @@ +//@compile-flags: -C opt-level=3 -C no-prepopulate-passes + +#![feature(core_intrinsics, repr_simd)] +#![no_std] +#![crate_type = "lib"] +#![allow(non_camel_case_types)] + +// Test that `core::intrinsics::simd::{simd_extract_dyn, simd_insert_dyn}` +// lower to an LLVM extractelement or insertelement operation. + +use core::intrinsics::simd::{simd_extract, simd_extract_dyn, simd_insert, simd_insert_dyn}; + +#[repr(simd)] +#[derive(Clone, Copy)] +pub struct u32x16([u32; 16]); + +#[repr(simd)] +#[derive(Clone, Copy)] +pub struct i8x16([i8; 16]); + +// CHECK-LABEL: dyn_simd_extract +// CHECK: extractelement <16 x i8> %x, i32 %idx +#[no_mangle] +unsafe extern "C" fn dyn_simd_extract(x: i8x16, idx: u32) -> i8 { + simd_extract_dyn(x, idx) +} + +// CHECK-LABEL: literal_dyn_simd_extract +// CHECK: extractelement <16 x i8> %x, i32 7 +#[no_mangle] +unsafe extern "C" fn literal_dyn_simd_extract(x: i8x16) -> i8 { + simd_extract_dyn(x, 7) +} + +// CHECK-LABEL: const_dyn_simd_extract +// CHECK: extractelement <16 x i8> %x, i32 7 +#[no_mangle] +unsafe extern "C" fn const_dyn_simd_extract(x: i8x16) -> i8 { + simd_extract_dyn(x, const { 3 + 4 }) +} + +// CHECK-LABEL: const_simd_extract +// CHECK: extractelement <16 x i8> %x, i32 7 +#[no_mangle] +unsafe extern "C" fn const_simd_extract(x: i8x16) -> i8 { + simd_extract(x, const { 3 + 4 }) +} + +// CHECK-LABEL: dyn_simd_insert +// CHECK: insertelement <16 x i8> %x, i8 %e, i32 %idx +#[no_mangle] +unsafe extern "C" fn dyn_simd_insert(x: i8x16, e: i8, idx: u32) -> i8x16 { + simd_insert_dyn(x, idx, e) +} + +// CHECK-LABEL: literal_dyn_simd_insert +// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7 +#[no_mangle] +unsafe extern "C" fn literal_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 { + simd_insert_dyn(x, 7, e) +} + +// CHECK-LABEL: const_dyn_simd_insert +// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7 +#[no_mangle] +unsafe extern "C" fn const_dyn_simd_insert(x: i8x16, e: i8) -> i8x16 { + simd_insert_dyn(x, const { 3 + 4 }, e) +} + +// CHECK-LABEL: const_simd_insert +// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7 +#[no_mangle] +unsafe extern "C" fn const_simd_insert(x: i8x16, e: i8) -> i8x16 { + simd_insert(x, const { 3 + 4 }, e) +} diff --git a/tests/codegen/simd/simd-wide-sum.rs b/tests/codegen/simd/simd-wide-sum.rs index fb9b61884e7..95117b2c748 100644 --- a/tests/codegen/simd/simd-wide-sum.rs +++ b/tests/codegen/simd/simd-wide-sum.rs @@ -1,5 +1,6 @@ //@ revisions: llvm mir-opt3 -//@ compile-flags: -C opt-level=3 -Z merge-functions=disabled --edition=2021 +//@ compile-flags: -C opt-level=3 -Z merge-functions=disabled +//@ edition: 2021 //@ only-x86_64 //@ [mir-opt3]compile-flags: -Zmir-opt-level=3 //@ [mir-opt3]build-pass diff --git a/tests/codegen/simd/swap-simd-types.rs b/tests/codegen/simd/swap-simd-types.rs index 69767d0a755..c063cc683a6 100644 --- a/tests/codegen/simd/swap-simd-types.rs +++ b/tests/codegen/simd/swap-simd-types.rs @@ -23,8 +23,8 @@ pub fn swap_single_m256(x: &mut __m256, y: &mut __m256) { #[no_mangle] pub fn swap_m256_slice(x: &mut [__m256], y: &mut [__m256]) { // CHECK-NOT: alloca - // CHECK: load <8 x float>{{.+}}align 32 - // CHECK: store <8 x float>{{.+}}align 32 + // CHECK-COUNT-2: load <4 x i64>{{.+}}align 32 + // CHECK-COUNT-2: store <4 x i64>{{.+}}align 32 if x.len() == y.len() { x.swap_with_slice(y); } @@ -34,7 +34,7 @@ pub fn swap_m256_slice(x: &mut [__m256], y: &mut [__m256]) { #[no_mangle] pub fn swap_bytes32(x: &mut [u8; 32], y: &mut [u8; 32]) { // CHECK-NOT: alloca - // CHECK: load <32 x i8>{{.+}}align 1 - // CHECK: store <32 x i8>{{.+}}align 1 + // CHECK-COUNT-2: load <4 x i64>{{.+}}align 1 + // CHECK-COUNT-2: store <4 x i64>{{.+}}align 1 swap(x, y) } diff --git a/tests/codegen/string-push.rs b/tests/codegen/string-push.rs new file mode 100644 index 00000000000..cf5f6bb1aa3 --- /dev/null +++ b/tests/codegen/string-push.rs @@ -0,0 +1,11 @@ +//! Check that `String::push` is optimized enough not to call `memcpy`. + +//@ compile-flags: -O +#![crate_type = "lib"] + +// CHECK-LABEL: @string_push_does_not_call_memcpy +#[no_mangle] +pub fn string_push_does_not_call_memcpy(s: &mut String, ch: char) { + // CHECK-NOT: call void @llvm.memcpy + s.push(ch); +} diff --git a/tests/codegen/swap-large-types.rs b/tests/codegen/swap-large-types.rs index 49a41bb1469..08c486affd9 100644 --- a/tests/codegen/swap-large-types.rs +++ b/tests/codegen/swap-large-types.rs @@ -12,6 +12,16 @@ type KeccakBuffer = [[u64; 5]; 5]; // to stack for large types, which is completely unnecessary as the lack of // overlap means we can just do whatever fits in registers at a time. +// The tests here (after the first one showing that the problem still exists) +// are less about testing *exactly* what the codegen is, and more about testing +// 1) That things are swapped directly from one argument to the other, +// never going through stack along the way, and +// 2) That we're doing the swapping for big things using large vector types, +// rather then `i64` or `<8 x i8>` (or, even worse, `i8`) at a time. +// +// (There are separate tests for intrinsics::typed_swap_nonoverlapping that +// check that it, as an intrinsic, are emitting exactly what it should.) + // CHECK-LABEL: @swap_basic #[no_mangle] pub fn swap_basic(x: &mut KeccakBuffer, y: &mut KeccakBuffer) { @@ -26,55 +36,55 @@ pub fn swap_basic(x: &mut KeccakBuffer, y: &mut KeccakBuffer) { } } -// This test verifies that the library does something smarter, and thus -// doesn't need any scratch space on the stack. - // CHECK-LABEL: @swap_std #[no_mangle] pub fn swap_std(x: &mut KeccakBuffer, y: &mut KeccakBuffer) { // CHECK-NOT: alloca - // CHECK: load <{{[0-9]+}} x i64> - // CHECK: store <{{[0-9]+}} x i64> + // CHECK: load <{{2|4}} x i64> + // CHECK: store <{{2|4}} x i64> swap(x, y) } -// Verify that types with usize alignment are swapped via vectored usizes, -// not falling back to byte-level code. - // CHECK-LABEL: @swap_slice #[no_mangle] pub fn swap_slice(x: &mut [KeccakBuffer], y: &mut [KeccakBuffer]) { // CHECK-NOT: alloca - // CHECK: load <{{[0-9]+}} x i64> - // CHECK: store <{{[0-9]+}} x i64> + // CHECK: load <{{2|4}} x i64> + // CHECK: store <{{2|4}} x i64> if x.len() == y.len() { x.swap_with_slice(y); } } -// But for a large align-1 type, vectorized byte copying is what we want. - type OneKilobyteBuffer = [u8; 1024]; // CHECK-LABEL: @swap_1kb_slices #[no_mangle] pub fn swap_1kb_slices(x: &mut [OneKilobyteBuffer], y: &mut [OneKilobyteBuffer]) { // CHECK-NOT: alloca - // CHECK: load <{{[0-9]+}} x i8> - // CHECK: store <{{[0-9]+}} x i8> + + // CHECK-NOT: load i32 + // CHECK-NOT: store i32 + // CHECK-NOT: load i16 + // CHECK-NOT: store i16 + // CHECK-NOT: load i8 + // CHECK-NOT: store i8 + + // CHECK: load <{{2|4}} x i64>{{.+}}align 1, + // CHECK: store <{{2|4}} x i64>{{.+}}align 1, + + // CHECK-NOT: load i32 + // CHECK-NOT: store i32 + // CHECK-NOT: load i16 + // CHECK-NOT: store i16 + // CHECK-NOT: load i8 + // CHECK-NOT: store i8 + if x.len() == y.len() { x.swap_with_slice(y); } } -// This verifies that the 2×read + 2×write optimizes to just 3 memcpys -// for an unusual type like this. It's not clear whether we should do anything -// smarter in Rust for these, so for now it's fine to leave these up to the backend. -// That's not as bad as it might seem, as for example, LLVM will lower the -// memcpys below to VMOVAPS on YMMs if one enables the AVX target feature. -// Eventually we'll be able to pass `align_of::<T>` to a const generic and -// thus pick a smarter chunk size ourselves without huge code duplication. - #[repr(align(64))] pub struct BigButHighlyAligned([u8; 64 * 3]); @@ -82,9 +92,25 @@ pub struct BigButHighlyAligned([u8; 64 * 3]); #[no_mangle] pub fn swap_big_aligned(x: &mut BigButHighlyAligned, y: &mut BigButHighlyAligned) { // CHECK-NOT: call void @llvm.memcpy - // CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) - // CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) - // CHECK: call void @llvm.memcpy.{{.+}}(ptr noundef nonnull align 64 dereferenceable(192) + // CHECK-NOT: load i32 + // CHECK-NOT: store i32 + // CHECK-NOT: load i16 + // CHECK-NOT: store i16 + // CHECK-NOT: load i8 + // CHECK-NOT: store i8 + + // CHECK-COUNT-2: load <{{2|4}} x i64>{{.+}}align 64, + // CHECK-COUNT-2: store <{{2|4}} x i64>{{.+}}align 64, + + // CHECK-COUNT-2: load <{{2|4}} x i64>{{.+}}align 32, + // CHECK-COUNT-2: store <{{2|4}} x i64>{{.+}}align 32, + + // CHECK-NOT: load i32 + // CHECK-NOT: store i32 + // CHECK-NOT: load i16 + // CHECK-NOT: store i16 + // CHECK-NOT: load i8 + // CHECK-NOT: store i8 // CHECK-NOT: call void @llvm.memcpy swap(x, y) } diff --git a/tests/codegen/swap-small-types.rs b/tests/codegen/swap-small-types.rs index 76bb853e642..7aa613ae9c2 100644 --- a/tests/codegen/swap-small-types.rs +++ b/tests/codegen/swap-small-types.rs @@ -1,5 +1,7 @@ //@ compile-flags: -Copt-level=3 -Z merge-functions=disabled //@ only-x86_64 +//@ min-llvm-version: 20 +//@ ignore-std-debug-assertions (`ptr::swap_nonoverlapping` has one which blocks some optimizations) #![crate_type = "lib"] @@ -27,13 +29,19 @@ pub fn swap_rgb48_manually(x: &mut RGB48, y: &mut RGB48) { pub fn swap_rgb48(x: &mut RGB48, y: &mut RGB48) { // CHECK-NOT: alloca - // Whether `i8` is the best for this is unclear, but - // might as well record what's actually happening right now. - - // CHECK: load i8 - // CHECK: load i8 - // CHECK: store i8 - // CHECK: store i8 + // Swapping `i48` might be cleaner in LLVM-IR here, but `i32`+`i16` isn't bad, + // and is closer to the assembly it generates anyway. + + // CHECK-NOT: load{{ }} + // CHECK: load i32{{.+}}align 2 + // CHECK-NEXT: load i32{{.+}}align 2 + // CHECK-NEXT: store i32{{.+}}align 2 + // CHECK-NEXT: store i32{{.+}}align 2 + // CHECK: load i16{{.+}}align 2 + // CHECK-NEXT: load i16{{.+}}align 2 + // CHECK-NEXT: store i16{{.+}}align 2 + // CHECK-NEXT: store i16{{.+}}align 2 + // CHECK-NOT: store{{ }} swap(x, y) } @@ -76,30 +84,49 @@ pub fn swap_slices<'a>(x: &mut &'a [u32], y: &mut &'a [u32]) { swap(x, y) } -// LLVM doesn't vectorize a loop over 3-byte elements, -// so we chunk it down to bytes and loop over those instead. type RGB24 = [u8; 3]; // CHECK-LABEL: @swap_rgb24_slices #[no_mangle] pub fn swap_rgb24_slices(x: &mut [RGB24], y: &mut [RGB24]) { // CHECK-NOT: alloca - // CHECK: load <{{[0-9]+}} x i8> - // CHECK: store <{{[0-9]+}} x i8> + + // CHECK: mul nuw nsw i64 %{{x|y}}.1, 3 + + // CHECK: load <{{[0-9]+}} x i64> + // CHECK: store <{{[0-9]+}} x i64> + + // CHECK-COUNT-2: load i32 + // CHECK-COUNT-2: store i32 + // CHECK-COUNT-2: load i16 + // CHECK-COUNT-2: store i16 + // CHECK-COUNT-2: load i8 + // CHECK-COUNT-2: store i8 if x.len() == y.len() { x.swap_with_slice(y); } } -// This one has a power-of-two size, so we iterate over it directly type RGBA32 = [u8; 4]; // CHECK-LABEL: @swap_rgba32_slices #[no_mangle] pub fn swap_rgba32_slices(x: &mut [RGBA32], y: &mut [RGBA32]) { // CHECK-NOT: alloca - // CHECK: load <{{[0-9]+}} x i32> - // CHECK: store <{{[0-9]+}} x i32> + + // Because the size in bytes in a multiple of 4, we can skip the smallest sizes. + + // CHECK: load <{{[0-9]+}} x i64> + // CHECK: store <{{[0-9]+}} x i64> + + // CHECK-COUNT-2: load i32 + // CHECK-COUNT-2: store i32 + + // CHECK-NOT: load i16 + // CHECK-NOT: store i16 + // CHECK-NOT: load i8 + // CHECK-NOT: store i8 + if x.len() == y.len() { x.swap_with_slice(y); } @@ -113,8 +140,8 @@ const _: () = assert!(!std::mem::size_of::<String>().is_power_of_two()); #[no_mangle] pub fn swap_string_slices(x: &mut [String], y: &mut [String]) { // CHECK-NOT: alloca - // CHECK: load <{{[0-9]+}} x i64> - // CHECK: store <{{[0-9]+}} x i64> + // CHECK: load <{{[0-9]+}} x i64>{{.+}}, align 8, + // CHECK: store <{{[0-9]+}} x i64>{{.+}}, align 8, if x.len() == y.len() { x.swap_with_slice(y); } @@ -130,6 +157,26 @@ pub struct Packed { #[no_mangle] pub fn swap_packed_structs(x: &mut Packed, y: &mut Packed) { // CHECK-NOT: alloca + + // CHECK-NOT: load + // CHECK-NOT: store + + // CHECK: %[[A:.+]] = load i64, ptr %x, align 1, + // CHECK-NEXT: %[[B:.+]] = load i64, ptr %y, align 1, + // CHECK-NEXT: store i64 %[[B]], ptr %x, align 1, + // CHECK-NEXT: store i64 %[[A]], ptr %y, align 1, + + // CHECK-NOT: load + // CHECK-NOT: store + + // CHECK: %[[C:.+]] = load i8, ptr %[[X8:.+]], align 1, + // CHECK-NEXT: %[[D:.+]] = load i8, ptr %[[Y8:.+]], align 1, + // CHECK-NEXT: store i8 %[[D]], ptr %[[X8]], align 1, + // CHECK-NEXT: store i8 %[[C]], ptr %[[Y8]], align 1, + + // CHECK-NOT: load + // CHECK-NOT: store + // CHECK: ret void swap(x, y) } diff --git a/tests/codegen/try_question_mark_nop.rs b/tests/codegen/try_question_mark_nop.rs index 9f68d742a75..398c9a580bc 100644 --- a/tests/codegen/try_question_mark_nop.rs +++ b/tests/codegen/try_question_mark_nop.rs @@ -1,4 +1,5 @@ -//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled --edition=2021 +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled +//@ edition: 2021 //@ only-x86_64 //@ revisions: NINETEEN TWENTY //@[NINETEEN] exact-llvm-major-version: 19 diff --git a/tests/crashes/119095.rs b/tests/crashes/119095.rs index 28742e0d5da..9b6c976d3e5 100644 --- a/tests/crashes/119095.rs +++ b/tests/crashes/119095.rs @@ -1,5 +1,5 @@ //@ known-bug: #119095 -//@ compile-flags: --edition=2021 +//@ edition: 2021 fn any<T>() -> T { loop {} diff --git a/tests/crashes/120016.rs b/tests/crashes/120016.rs index faba1af91b4..7eda330e7ad 100644 --- a/tests/crashes/120016.rs +++ b/tests/crashes/120016.rs @@ -1,5 +1,6 @@ //@ known-bug: #120016 -//@ compile-flags: -Zcrate-attr=feature(const_async_blocks) --edition=2021 +//@ compile-flags: -Zcrate-attr=feature(const_async_blocks) +//@ edition: 2021 #![feature(type_alias_impl_trait, const_async_blocks)] diff --git a/tests/crashes/127033.rs b/tests/crashes/127033.rs index 919c9dfd30e..52b880e4859 100644 --- a/tests/crashes/127033.rs +++ b/tests/crashes/127033.rs @@ -1,5 +1,5 @@ //@ known-bug: #127033 -//@ compile-flags: --edition=2021 +//@ edition: 2021 pub trait RaftLogStorage { fn save_vote(vote: ()) -> impl std::future::Future + Send; diff --git a/tests/crashes/128094.rs b/tests/crashes/128094.rs index 5f0ae108f8f..56d09d78bed 100644 --- a/tests/crashes/128094.rs +++ b/tests/crashes/128094.rs @@ -1,5 +1,6 @@ //@ known-bug: rust-lang/rust#128094 -//@ compile-flags: -Zmir-enable-passes=+GVN --edition=2018 +//@ compile-flags: -Zmir-enable-passes=+GVN +//@ edition: 2018 pub enum Request { TestSome(T), diff --git a/tests/crashes/129372.rs b/tests/crashes/129372.rs deleted file mode 100644 index 43be01b35df..00000000000 --- a/tests/crashes/129372.rs +++ /dev/null @@ -1,52 +0,0 @@ -//@ known-bug: #129372 -//@ compile-flags: -Cdebuginfo=2 -Copt-level=0 - -pub struct Wrapper<T>(T); -struct Struct; - -pub trait TraitA { - type AssocA<'t>; -} -pub trait TraitB { - type AssocB; -} - -pub fn helper(v: impl MethodTrait) { - let _local_that_causes_ice = v.method(); -} - -pub fn main() { - helper(Wrapper(Struct)); -} - -pub trait MethodTrait { - type Assoc<'a>; - - fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a>; -} - -impl<T: TraitB> MethodTrait for T -where - <T as TraitB>::AssocB: TraitA, -{ - type Assoc<'a> = <T::AssocB as TraitA>::AssocA<'a>; - - fn method(self) -> impl for<'a> FnMut(&'a ()) -> Self::Assoc<'a> { - move |_| loop {} - } -} - -impl<T, B> TraitB for Wrapper<B> -where - B: TraitB<AssocB = T>, -{ - type AssocB = T; -} - -impl TraitB for Struct { - type AssocB = Struct; -} - -impl TraitA for Struct { - type AssocA<'t> = Self; -} diff --git a/tests/crashes/132103.rs b/tests/crashes/132103.rs index 5bf4792c44c..e2d8378efe6 100644 --- a/tests/crashes/132103.rs +++ b/tests/crashes/132103.rs @@ -1,5 +1,6 @@ //@ known-bug: #132103 -//@compile-flags: -Zvalidate-mir --edition=2018 -Zinline-mir=yes +//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes +//@ edition: 2018 use core::future::{async_drop_in_place, Future}; use core::mem::{self}; use core::pin::pin; diff --git a/tests/crashes/132430.rs b/tests/crashes/132430.rs index 995bdf06224..81c8c6d6f7d 100644 --- a/tests/crashes/132430.rs +++ b/tests/crashes/132430.rs @@ -1,6 +1,7 @@ //@ known-bug: #132430 -//@compile-flags: --edition=2018 --crate-type=lib +//@ compile-flags: --crate-type=lib +//@ edition: 2018 #![feature(cmse_nonsecure_entry)] struct Test; diff --git a/tests/crashes/135128.rs b/tests/crashes/135128.rs index a8fd1ae1ff5..c718b758dc6 100644 --- a/tests/crashes/135128.rs +++ b/tests/crashes/135128.rs @@ -1,5 +1,6 @@ //@ known-bug: #135128 -//@ compile-flags: -Copt-level=1 --edition=2021 +//@ compile-flags: -Copt-level=1 +//@ edition: 2021 #![feature(trivial_bounds)] diff --git a/tests/crashes/135470.rs b/tests/crashes/135470.rs index 7d357a9317f..efa017b5457 100644 --- a/tests/crashes/135470.rs +++ b/tests/crashes/135470.rs @@ -1,5 +1,6 @@ //@ known-bug: #135470 -//@ compile-flags: --edition=2021 -Copt-level=0 +//@ compile-flags: -Copt-level=0 +//@ edition: 2021 use std::future::Future; trait Access { diff --git a/tests/crashes/135646.rs b/tests/crashes/135646.rs index 67b0ad93db4..841ea5b81b4 100644 --- a/tests/crashes/135646.rs +++ b/tests/crashes/135646.rs @@ -1,5 +1,7 @@ //@ known-bug: #135646 -//@ compile-flags: --edition=2024 -Zpolonius=next +//@ compile-flags: -Zpolonius=next +//@ edition: 2024 + fn main() { &{ [1, 2, 3][4] }; } diff --git a/tests/crashes/135668.rs b/tests/crashes/135668.rs index 8126a65606b..00d7b5db0c6 100644 --- a/tests/crashes/135668.rs +++ b/tests/crashes/135668.rs @@ -1,5 +1,5 @@ //@ known-bug: #135668 -//@ compile-flags: --edition=2021 +//@ edition: 2021 use std::future::Future; pub async fn foo() { diff --git a/tests/crashes/137467-1.rs b/tests/crashes/137467-1.rs index 1d62cba59a7..b6bff2bdc4e 100644 --- a/tests/crashes/137467-1.rs +++ b/tests/crashes/137467-1.rs @@ -1,5 +1,5 @@ //@ known-bug: #137467 -//@ compile-flags: --edition=2021 +//@ edition: 2021 enum Camera { Normal { base_transform: i32 }, Volume { transform: i32 }, diff --git a/tests/crashes/137467-2.rs b/tests/crashes/137467-2.rs index 151d6a0767f..a70ea92b22d 100644 --- a/tests/crashes/137467-2.rs +++ b/tests/crashes/137467-2.rs @@ -1,5 +1,5 @@ //@ known-bug: #137467 -//@ compile-flags: --edition=2021 +//@ edition: 2021 enum Camera { Normal { base_transform: i32 }, diff --git a/tests/crashes/137467-3.rs b/tests/crashes/137467-3.rs index 2140fe044a7..cb81a9a912e 100644 --- a/tests/crashes/137467-3.rs +++ b/tests/crashes/137467-3.rs @@ -1,5 +1,5 @@ //@ known-bug: #137467 -//@ compile-flags: --edition=2021 +//@ edition: 2021 fn meow(x: (u32, u32, u32)) { let f = || { diff --git a/tests/crashes/137916.rs b/tests/crashes/137916.rs index 3d6b0e0fbab..b25e7b200d9 100644 --- a/tests/crashes/137916.rs +++ b/tests/crashes/137916.rs @@ -1,5 +1,5 @@ //@ known-bug: #137916 -//@ compile-flags: --edition=2021 +//@ edition: 2021 use std::ptr::null; async fn a() -> Box<dyn Send> { diff --git a/tests/debuginfo/coroutine-closure.rs b/tests/debuginfo/coroutine-closure.rs index ffb6ae68a2b..002531084fb 100644 --- a/tests/debuginfo/coroutine-closure.rs +++ b/tests/debuginfo/coroutine-closure.rs @@ -1,6 +1,7 @@ #![feature(async_closure)] //@ only-cdb -//@ compile-flags:-g --edition=2021 +//@ compile-flags: -g +//@ edition: 2021 // === CDB TESTS ================================================================================== diff --git a/tests/incremental/circular-dependencies.rs b/tests/incremental/circular-dependencies.rs index c7b5b931fbb..bd3b109b62c 100644 --- a/tests/incremental/circular-dependencies.rs +++ b/tests/incremental/circular-dependencies.rs @@ -15,6 +15,7 @@ pub struct Foo; pub fn consume_foo(_: Foo) {} //[cfail2]~^ NOTE function defined here +//[cfail2]~| NOTE pub fn produce_foo() -> Foo { Foo diff --git a/tests/incremental/issue-85360-eval-obligation-ice.rs b/tests/incremental/issue-85360-eval-obligation-ice.rs index 6efae1aa12d..70bb43f39ec 100644 --- a/tests/incremental/issue-85360-eval-obligation-ice.rs +++ b/tests/incremental/issue-85360-eval-obligation-ice.rs @@ -1,6 +1,7 @@ //@ revisions:cfail1 cfail2 -//@[cfail1] compile-flags: --crate-type=lib --edition=2021 -Zassert-incr-state=not-loaded -//@[cfail2] compile-flags: --crate-type=lib --edition=2021 -Zassert-incr-state=loaded +//@[cfail1] compile-flags: --crate-type=lib -Zassert-incr-state=not-loaded +//@[cfail2] compile-flags: --crate-type=lib -Zassert-incr-state=loaded +//@ edition: 2021 //@ build-pass use core::any::Any; diff --git a/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff b/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff index e33185f17bc..c23afae829f 100644 --- a/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff +++ b/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff @@ -31,15 +31,13 @@ (*_3) = const true; _4 = const (); StorageDead(_4); -- StorageLive(_5); -+ nop; + StorageLive(_5); StorageLive(_6); _6 = copy (_2.1: bool); _5 = Not(move _6); StorageDead(_6); _0 = copy _5; -- StorageDead(_5); -+ nop; + StorageDead(_5); StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff index 37dd14e6c89..35eb4fbd106 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff @@ -69,8 +69,7 @@ bb0: { StorageLive(_1); -- StorageLive(_2); -+ nop; + StorageLive(_2); StorageLive(_3); StorageLive(_11); StorageLive(_12); @@ -119,8 +118,7 @@ StorageDead(_11); _2 = &_3; _1 = copy _2; -- StorageDead(_2); -+ nop; + StorageDead(_2); StorageLive(_4); - _9 = deref_copy _3; + _9 = copy _3; @@ -141,7 +139,7 @@ StorageLive(_8); _8 = copy _5; - _7 = copy _8 as *mut () (PtrToPtr); -+ _7 = copy _5 as *mut () (PtrToPtr); ++ _7 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *mut () (Transmute); StorageDead(_8); StorageDead(_7); - StorageDead(_5); diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff index 6bac6805943..b2085afb713 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff @@ -35,8 +35,7 @@ bb0: { StorageLive(_1); -- StorageLive(_2); -+ nop; + StorageLive(_2); StorageLive(_3); _3 = Box::<()>::new(const ()) -> [return: bb1, unwind continue]; } @@ -44,8 +43,7 @@ bb1: { _2 = &_3; _1 = copy _2; -- StorageDead(_2); -+ nop; + StorageDead(_2); StorageLive(_4); - _9 = deref_copy _3; + _9 = copy _3; @@ -66,7 +64,7 @@ StorageLive(_8); _8 = copy _5; - _7 = copy _8 as *mut () (PtrToPtr); -+ _7 = copy _5 as *mut () (PtrToPtr); ++ _7 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *mut () (Transmute); StorageDead(_8); StorageDead(_7); - StorageDead(_5); diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff index 1cf0f6de011..4427a5fcc7d 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff @@ -69,8 +69,7 @@ bb0: { StorageLive(_1); -- StorageLive(_2); -+ nop; + StorageLive(_2); StorageLive(_3); StorageLive(_11); StorageLive(_12); @@ -119,8 +118,7 @@ StorageDead(_11); _2 = &_3; _1 = copy _2; -- StorageDead(_2); -+ nop; + StorageDead(_2); StorageLive(_4); - _9 = deref_copy _3; + _9 = copy _3; @@ -141,7 +139,7 @@ StorageLive(_8); _8 = copy _5; - _7 = copy _8 as *mut () (PtrToPtr); -+ _7 = copy _5 as *mut () (PtrToPtr); ++ _7 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *mut () (Transmute); StorageDead(_8); StorageDead(_7); - StorageDead(_5); diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff index 6bac6805943..b2085afb713 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff @@ -35,8 +35,7 @@ bb0: { StorageLive(_1); -- StorageLive(_2); -+ nop; + StorageLive(_2); StorageLive(_3); _3 = Box::<()>::new(const ()) -> [return: bb1, unwind continue]; } @@ -44,8 +43,7 @@ bb1: { _2 = &_3; _1 = copy _2; -- StorageDead(_2); -+ nop; + StorageDead(_2); StorageLive(_4); - _9 = deref_copy _3; + _9 = copy _3; @@ -66,7 +64,7 @@ StorageLive(_8); _8 = copy _5; - _7 = copy _8 as *mut () (PtrToPtr); -+ _7 = copy _5 as *mut () (PtrToPtr); ++ _7 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *mut () (Transmute); StorageDead(_8); StorageDead(_7); - StorageDead(_5); diff --git a/tests/mir-opt/ergonomic-clones/closure.rs b/tests/mir-opt/ergonomic-clones/closure.rs new file mode 100644 index 00000000000..682f4844984 --- /dev/null +++ b/tests/mir-opt/ergonomic-clones/closure.rs @@ -0,0 +1,55 @@ +#![crate_type = "lib"] +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +use std::clone::UseCloned; + +pub fn ergonomic_clone_closure_move() -> String { + // CHECK-LABEL: fn ergonomic_clone_closure_move( + // CHECK: _0 = move (_1.0: std::string::String); + // CHECK-NOT: <String as Clone>::clone + let s = String::from("hi"); + + let cl = use || s; + cl() +} + +#[derive(Clone)] +struct Foo; + +impl UseCloned for Foo {} + +pub fn ergonomic_clone_closure_use_cloned() -> Foo { + // CHECK-LABEL: fn ergonomic_clone_closure_use_cloned( + // CHECK: <Foo as Clone>::clone + let f = Foo; + + let f1 = use || f; + + let f2 = use || f; + + f +} + +pub fn ergonomic_clone_closure_copy() -> i32 { + // CHECK-LABEL: fn ergonomic_clone_closure_copy( + // CHECK: _0 = copy ((*_1).0: i32); + // CHECK-NOT: <i32 as Clone>::clone + let i = 1; + + let i1 = use || i; + + let i2 = use || i; + + i +} + +pub fn ergonomic_clone_closure_use_cloned_generics<T: UseCloned>(f: T) -> T { + // CHECK-LABEL: fn ergonomic_clone_closure_use_cloned_generics( + // CHECK: <T as Clone>::clone + let f1 = use || f; + + let f2 = use || f; + + f +} diff --git a/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-abort.diff b/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-abort.diff new file mode 100644 index 00000000000..e2e55304921 --- /dev/null +++ b/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-abort.diff @@ -0,0 +1,58 @@ +- // MIR for `compare_constant_index` before GVN ++ // MIR for `compare_constant_index` after GVN + + fn compare_constant_index(_1: [i32; 1], _2: [i32; 1]) -> std::cmp::Ordering { + debug x => _1; + debug y => _2; + let mut _0: std::cmp::Ordering; + let _3: &i32; + let _4: usize; + let mut _5: bool; + let _6: &i32; + let _7: usize; + let mut _8: bool; + scope 1 (inlined std::cmp::impls::<impl Ord for i32>::cmp) { + let mut _9: i32; + let mut _10: i32; + } + + bb0: { +- StorageLive(_4); ++ nop; + _4 = const 0_usize; +- _5 = Lt(copy _4, const 1_usize); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", const 1_usize, copy _4) -> [success: bb1, unwind unreachable]; ++ _5 = const true; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 1_usize, const 0_usize) -> [success: bb1, unwind unreachable]; + } + + bb1: { +- _3 = &_1[_4]; ++ _3 = &_1[0 of 1]; + StorageLive(_7); + _7 = const 0_usize; +- _8 = Lt(copy _7, const 1_usize); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", const 1_usize, copy _7) -> [success: bb2, unwind unreachable]; ++ _8 = const true; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 1_usize, const 0_usize) -> [success: bb2, unwind unreachable]; + } + + bb2: { +- _6 = &_2[_7]; ++ _6 = &_2[0 of 1]; + StorageLive(_9); +- _9 = copy (*_3); ++ _9 = copy _1[0 of 1]; + StorageLive(_10); +- _10 = copy (*_6); ++ _10 = copy _2[0 of 1]; + _0 = Cmp(move _9, move _10); + StorageDead(_10); + StorageDead(_9); + StorageDead(_7); +- StorageDead(_4); ++ nop; + return; + } + } + diff --git a/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-unwind.diff b/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-unwind.diff new file mode 100644 index 00000000000..60611146a0e --- /dev/null +++ b/tests/mir-opt/gvn_copy_constant_projection.compare_constant_index.GVN.panic-unwind.diff @@ -0,0 +1,58 @@ +- // MIR for `compare_constant_index` before GVN ++ // MIR for `compare_constant_index` after GVN + + fn compare_constant_index(_1: [i32; 1], _2: [i32; 1]) -> std::cmp::Ordering { + debug x => _1; + debug y => _2; + let mut _0: std::cmp::Ordering; + let _3: &i32; + let _4: usize; + let mut _5: bool; + let _6: &i32; + let _7: usize; + let mut _8: bool; + scope 1 (inlined std::cmp::impls::<impl Ord for i32>::cmp) { + let mut _9: i32; + let mut _10: i32; + } + + bb0: { +- StorageLive(_4); ++ nop; + _4 = const 0_usize; +- _5 = Lt(copy _4, const 1_usize); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", const 1_usize, copy _4) -> [success: bb1, unwind continue]; ++ _5 = const true; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 1_usize, const 0_usize) -> [success: bb1, unwind continue]; + } + + bb1: { +- _3 = &_1[_4]; ++ _3 = &_1[0 of 1]; + StorageLive(_7); + _7 = const 0_usize; +- _8 = Lt(copy _7, const 1_usize); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", const 1_usize, copy _7) -> [success: bb2, unwind continue]; ++ _8 = const true; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 1_usize, const 0_usize) -> [success: bb2, unwind continue]; + } + + bb2: { +- _6 = &_2[_7]; ++ _6 = &_2[0 of 1]; + StorageLive(_9); +- _9 = copy (*_3); ++ _9 = copy _1[0 of 1]; + StorageLive(_10); +- _10 = copy (*_6); ++ _10 = copy _2[0 of 1]; + _0 = Cmp(move _9, move _10); + StorageDead(_10); + StorageDead(_9); + StorageDead(_7); +- StorageDead(_4); ++ nop; + return; + } + } + diff --git a/tests/mir-opt/gvn_copy_constant_projection.rs b/tests/mir-opt/gvn_copy_constant_projection.rs new file mode 100644 index 00000000000..a08ae0ac7c9 --- /dev/null +++ b/tests/mir-opt/gvn_copy_constant_projection.rs @@ -0,0 +1,18 @@ +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY + +use std::cmp::Ordering; +fn compare_constant_index(x: [i32; 1], y: [i32; 1]) -> Ordering { + // CHECK-LABEL: fn compare_constant_index( + // CHECK-NOT: (*{{_.*}}); + // CHECK: [[lhs:_.*]] = copy _1[0 of 1]; + // CHECK-NOT: (*{{_.*}}); + // CHECK: [[rhs:_.*]] = copy _2[0 of 1]; + // CHECK: _0 = Cmp(move [[lhs]], move [[rhs]]); + Ord::cmp(&x[0], &y[0]) +} + +fn main() { + compare_constant_index([1], [2]); +} + +// EMIT_MIR gvn_copy_constant_projection.compare_constant_index.GVN.diff diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff index eb97af1e284..e49d7cea28e 100644 --- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff +++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff @@ -229,7 +229,6 @@ + StorageDead(_24); + StorageLive(_45); + StorageLive(_46); -+ StorageLive(_49); + StorageLive(_51); + StorageLive(_42); + StorageLive(_43); @@ -243,9 +242,11 @@ + _47 = Pin::<&mut std::future::Ready<()>> { __pointer: copy _45 }; + StorageDead(_47); + _44 = &mut ((*_45).0: std::option::Option<()>); ++ StorageLive(_49); + _49 = Option::<()>::None; + _43 = copy ((*_45).0: std::option::Option<()>); + ((*_45).0: std::option::Option<()>) = copy _49; ++ StorageDead(_49); + StorageDead(_44); + StorageLive(_50); + _50 = discriminant(_43); @@ -322,7 +323,6 @@ + _18 = Poll::<()>::Ready(move _42); + StorageDead(_42); + StorageDead(_51); -+ StorageDead(_49); + StorageDead(_46); + StorageDead(_45); + StorageDead(_22); diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff index eb757e09114..e7aed556f2d 100644 --- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff @@ -246,7 +246,6 @@ + StorageDead(_24); + StorageLive(_47); + StorageLive(_48); -+ StorageLive(_51); + StorageLive(_53); + StorageLive(_44); + StorageLive(_45); @@ -260,9 +259,11 @@ + _49 = Pin::<&mut std::future::Ready<()>> { __pointer: copy _47 }; + StorageDead(_49); + _46 = &mut ((*_47).0: std::option::Option<()>); ++ StorageLive(_51); + _51 = Option::<()>::None; + _45 = copy ((*_47).0: std::option::Option<()>); + ((*_47).0: std::option::Option<()>) = copy _51; ++ StorageDead(_51); + StorageDead(_46); + StorageLive(_52); + _52 = discriminant(_45); @@ -363,7 +364,6 @@ + _18 = Poll::<()>::Ready(move _44); + StorageDead(_44); + StorageDead(_53); -+ StorageDead(_51); + StorageDead(_48); + StorageDead(_47); + StorageDead(_22); diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs index 4859d935461..5afddc5ff73 100644 --- a/tests/mir-opt/lower_intrinsics.rs +++ b/tests/mir-opt/lower_intrinsics.rs @@ -153,11 +153,10 @@ pub fn discriminant<T>(t: T) { core::intrinsics::discriminant_value(&E::B); } -extern "rust-intrinsic" { - // Cannot use `std::intrinsics::copy_nonoverlapping` as that is a wrapper function - #[rustc_nounwind] - fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize); -} +// Cannot use `std::intrinsics::copy_nonoverlapping` as that is a wrapper function +#[rustc_nounwind] +#[rustc_intrinsic] +unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize); // EMIT_MIR lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.diff pub fn f_copy_nonoverlapping() { diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-unwind.diff index 596ad70b3bf..f29bc5dfc6e 100644 --- a/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-unwind.diff @@ -18,7 +18,7 @@ _4 = copy _1; StorageLive(_5); _5 = copy _2; -- _3 = three_way_compare::<char>(move _4, move _5) -> [return: bb1, unwind continue]; +- _3 = three_way_compare::<char>(move _4, move _5) -> [return: bb1, unwind unreachable]; + _3 = Cmp(move _4, move _5); + goto -> bb1; } diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-unwind.diff index 987c2166692..654cb2503df 100644 --- a/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-unwind.diff @@ -15,7 +15,7 @@ _4 = copy _1; StorageLive(_5); _5 = copy _2; -- _3 = three_way_compare::<i16>(move _4, move _5) -> [return: bb1, unwind continue]; +- _3 = three_way_compare::<i16>(move _4, move _5) -> [return: bb1, unwind unreachable]; + _3 = Cmp(move _4, move _5); + goto -> bb1; } diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-unwind.diff index d7ec6dcfa2c..82c89b7ce54 100644 --- a/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-unwind.diff @@ -18,7 +18,7 @@ _4 = copy _1; StorageLive(_5); _5 = copy _2; -- _3 = three_way_compare::<u32>(move _4, move _5) -> [return: bb1, unwind continue]; +- _3 = three_way_compare::<u32>(move _4, move _5) -> [return: bb1, unwind unreachable]; + _3 = Cmp(move _4, move _5); + goto -> bb1; } diff --git a/tests/mir-opt/pre-codegen/derived_ord.demo_le.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/derived_ord.demo_le.PreCodegen.after.mir index 49314a64c3f..8746cb08991 100644 --- a/tests/mir-opt/pre-codegen/derived_ord.demo_le.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/derived_ord.demo_le.PreCodegen.after.mir @@ -40,6 +40,7 @@ fn demo_le(_1: &MultiField, _2: &MultiField) -> bool { StorageLive(_12); StorageLive(_11); StorageLive(_5); + StorageLive(_6); StorageLive(_7); StorageLive(_3); _3 = copy ((*_1).0: char); @@ -65,6 +66,7 @@ fn demo_le(_1: &MultiField, _2: &MultiField) -> bool { _11 = Option::<std::cmp::Ordering>::Some(move _10); StorageDead(_10); StorageDead(_7); + StorageDead(_6); StorageDead(_5); goto -> bb3; } @@ -72,6 +74,7 @@ fn demo_le(_1: &MultiField, _2: &MultiField) -> bool { bb2: { _11 = copy _6; StorageDead(_7); + StorageDead(_6); StorageDead(_5); goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/tuple_ord.demo_ge_partial.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/tuple_ord.demo_ge_partial.PreCodegen.after.mir index dd2eebc8f4a..c4d0e318b58 100644 --- a/tests/mir-opt/pre-codegen/tuple_ord.demo_ge_partial.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/tuple_ord.demo_ge_partial.PreCodegen.after.mir @@ -44,8 +44,10 @@ fn demo_ge_partial(_1: &(f32, f32), _2: &(f32, f32)) -> bool { StorageDead(_5); StorageDead(_4); StorageDead(_3); + StorageLive(_8); _8 = copy ((_7 as Break).0: bool); _0 = copy _8; + StorageDead(_8); goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/tuple_ord.demo_le_total.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/tuple_ord.demo_le_total.PreCodegen.after.mir index ea1d164cefa..44df8b27993 100644 --- a/tests/mir-opt/pre-codegen/tuple_ord.demo_le_total.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/tuple_ord.demo_le_total.PreCodegen.after.mir @@ -44,8 +44,10 @@ fn demo_le_total(_1: &(u16, i16), _2: &(u16, i16)) -> bool { StorageDead(_5); StorageDead(_4); StorageDead(_3); + StorageLive(_8); _8 = copy ((_7 as Break).0: bool); _0 = copy _8; + StorageDead(_8); goto -> bb3; } diff --git a/tests/pretty/autodiff_forward.pp b/tests/pretty/autodiff_forward.pp index 4b2fb6166ff..713b8f541ae 100644 --- a/tests/pretty/autodiff_forward.pp +++ b/tests/pretty/autodiff_forward.pp @@ -29,6 +29,8 @@ pub fn f1(x: &[f64], y: f64) -> f64 { // Make sure, that we add the None for the default return. + // We want to make sure that we can use the macro for functions defined inside of functions + ::core::panicking::panic("not implemented") } #[rustc_autodiff(Forward, 1, Dual, Const, Dual)] @@ -158,4 +160,25 @@ fn f8_1(x: &f32, bx_0: &f32) -> f32 { ::core::hint::black_box((bx_0,)); ::core::hint::black_box(<f32>::default()) } +pub fn f9() { + #[rustc_autodiff] + #[inline(never)] + fn inner(x: f32) -> f32 { x * x } + #[rustc_autodiff(Forward, 1, Dual, Dual)] + #[inline(never)] + fn d_inner_2(x: f32, bx_0: f32) -> (f32, f32) { + unsafe { asm!("NOP", options(pure, nomem)); }; + ::core::hint::black_box(inner(x)); + ::core::hint::black_box((bx_0,)); + ::core::hint::black_box(<(f32, f32)>::default()) + } + #[rustc_autodiff(Forward, 1, Dual, DualOnly)] + #[inline(never)] + fn d_inner_1(x: f32, bx_0: f32) -> f32 { + unsafe { asm!("NOP", options(pure, nomem)); }; + ::core::hint::black_box(inner(x)); + ::core::hint::black_box((bx_0,)); + ::core::hint::black_box(<f32>::default()) + } +} fn main() {} diff --git a/tests/pretty/autodiff_forward.rs b/tests/pretty/autodiff_forward.rs index a765738c2a8..5a0660a08e5 100644 --- a/tests/pretty/autodiff_forward.rs +++ b/tests/pretty/autodiff_forward.rs @@ -54,4 +54,13 @@ fn f8(x: &f32) -> f32 { unimplemented!() } +// We want to make sure that we can use the macro for functions defined inside of functions +pub fn f9() { + #[autodiff(d_inner_1, Forward, Dual, DualOnly)] + #[autodiff(d_inner_2, Forward, Dual, Dual)] + fn inner(x: f32) -> f32 { + x * x + } +} + fn main() {} diff --git a/tests/pretty/hir-delegation.pp b/tests/pretty/hir-delegation.pp new file mode 100644 index 00000000000..872a6a45aed --- /dev/null +++ b/tests/pretty/hir-delegation.pp @@ -0,0 +1,23 @@ +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:hir-delegation.pp + +#![allow(incomplete_features)]#![feature(fn_delegation)] +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; + +fn b<C>(e: C) { } + +trait G { + fn b(arg0: _) -> _ { b({ }) } +} + +mod m { + fn add(a: u32, b: u32) -> u32 { a + b } +} + +fn add(arg0: _, arg1: _) -> _ { m::add(arg0, arg1) } + +fn main() { { let _ = add(1, 2); }; } diff --git a/tests/pretty/hir-delegation.rs b/tests/pretty/hir-delegation.rs new file mode 100644 index 00000000000..9e351a1e32f --- /dev/null +++ b/tests/pretty/hir-delegation.rs @@ -0,0 +1,22 @@ +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:hir-delegation.pp + +#![allow(incomplete_features)] +#![feature(fn_delegation)] + +fn b<C>(e: C) {} + +trait G { + reuse b {} +} + +mod m { + pub fn add(a: u32, b: u32) -> u32 { a + b } +} + +reuse m::add; + +fn main() { + _ = add(1, 2); +} diff --git a/tests/run-make/atomic-lock-free/atomic_lock_free.rs b/tests/run-make/atomic-lock-free/atomic_lock_free.rs index 1f1116b9bfd..b49c5044f31 100644 --- a/tests/run-make/atomic-lock-free/atomic_lock_free.rs +++ b/tests/run-make/atomic-lock-free/atomic_lock_free.rs @@ -2,9 +2,8 @@ #![crate_type = "rlib"] #![no_core] -extern "rust-intrinsic" { - fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T; -} +#[rustc_intrinsic] +unsafe fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T; #[lang = "sized"] trait Sized {} diff --git a/tests/run-make/avr-rjmp-offset/avr-rjmp-offsets.rs b/tests/run-make/avr-rjmp-offset/avr-rjmp-offsets.rs index 2f97fc1ed95..c91cd695cee 100644 --- a/tests/run-make/avr-rjmp-offset/avr-rjmp-offsets.rs +++ b/tests/run-make/avr-rjmp-offset/avr-rjmp-offsets.rs @@ -37,10 +37,9 @@ mod minicore { #[inline] #[rustc_diagnostic_item = "ptr_write_volatile"] pub unsafe fn write_volatile<T>(dst: *mut T, src: T) { - extern "rust-intrinsic" { - #[rustc_nounwind] - pub fn volatile_store<T>(dst: *mut T, val: T); - } + #[rustc_intrinsic] + pub unsafe fn volatile_store<T>(dst: *mut T, val: T); + unsafe { volatile_store(dst, src) }; } } diff --git a/tests/run-make/crate-data-smoke/rmake.rs b/tests/run-make/crate-data-smoke/rmake.rs index 70f8e46b6d9..b5708d05a82 100644 --- a/tests/run-make/crate-data-smoke/rmake.rs +++ b/tests/run-make/crate-data-smoke/rmake.rs @@ -1,9 +1,20 @@ -use run_make_support::{bin_name, rust_lib_name, rustc}; +use run_make_support::{bin_name, rust_lib_name, rustc, target}; fn main() { - rustc().print("crate-name").input("crate.rs").run().assert_stdout_equals("foo"); - rustc().print("file-names").input("crate.rs").run().assert_stdout_equals(bin_name("foo")); rustc() + .target(target()) + .print("crate-name") + .input("crate.rs") + .run() + .assert_stdout_equals("foo"); + rustc() + .target(target()) + .print("file-names") + .input("crate.rs") + .run() + .assert_stdout_equals(bin_name("foo")); + rustc() + .target(target()) .print("file-names") .crate_type("lib") .arg("--test") @@ -11,11 +22,22 @@ fn main() { .run() .assert_stdout_equals(bin_name("foo")); rustc() + .target(target()) .print("file-names") .arg("--test") .input("lib.rs") .run() .assert_stdout_equals(bin_name("mylib")); - rustc().print("file-names").input("lib.rs").run().assert_stdout_equals(rust_lib_name("mylib")); - rustc().print("file-names").input("rlib.rs").run().assert_stdout_equals(rust_lib_name("mylib")); + rustc() + .target(target()) + .print("file-names") + .input("lib.rs") + .run() + .assert_stdout_equals(rust_lib_name("mylib")); + rustc() + .target(target()) + .print("file-names") + .input("rlib.rs") + .run() + .assert_stdout_equals(rust_lib_name("mylib")); } diff --git a/tests/run-make/crate-name-priority/rmake.rs b/tests/run-make/crate-name-priority/rmake.rs index 5bdb49b33ce..82e482b5a2e 100644 --- a/tests/run-make/crate-name-priority/rmake.rs +++ b/tests/run-make/crate-name-priority/rmake.rs @@ -4,6 +4,8 @@ // and the compiler flags, and checks that the flag is favoured each time. // See https://github.com/rust-lang/rust/pull/15518 +//@ ignore-cross-compile (relocations in generic ELF against `arm-unknown-linux-gnueabihf`) + use run_make_support::{bin_name, rfs, rustc}; fn main() { diff --git a/tests/run-make/dirty-incr-due-to-hard-link/rmake.rs b/tests/run-make/dirty-incr-due-to-hard-link/rmake.rs new file mode 100644 index 00000000000..942b667814a --- /dev/null +++ b/tests/run-make/dirty-incr-due-to-hard-link/rmake.rs @@ -0,0 +1,32 @@ +//@ only-x86_64-unknown-linux-gnu + +// Regression test for the incremental bug in <https://github.com/rust-lang/rust/issues/139407>. +// +// A detailed explanation is described in <https://github.com/rust-lang/rust/pull/139453>, +// however the gist of the issue is that hard-linking temporary files can interact strangely +// across incremental sessions that are not finalized due to errors originating from the +// codegen backend. + +use run_make_support::{run, rustc}; + +fn main() { + let mk_rustc = || { + let mut rustc = rustc(); + rustc.input("test.rs").incremental("incr").arg("-Csave-temps").output("test"); + rustc + }; + + // Revision 1 + mk_rustc().cfg("rpass1").run(); + + run("test"); + + // Revision 2 + mk_rustc().cfg("cfail2").run_fail(); + // Expected to fail. + + // Revision 3 + mk_rustc().cfg("rpass3").run(); + + run("test"); +} diff --git a/tests/run-make/dirty-incr-due-to-hard-link/test.rs b/tests/run-make/dirty-incr-due-to-hard-link/test.rs new file mode 100644 index 00000000000..dba5a6bbc82 --- /dev/null +++ b/tests/run-make/dirty-incr-due-to-hard-link/test.rs @@ -0,0 +1,31 @@ +#[inline(never)] +#[cfg(any(rpass1, rpass3))] +fn a() -> i32 { + 0 +} + +#[cfg(any(cfail2))] +fn a() -> i32 { + 1 +} + +fn main() { + evil::evil(); + assert_eq!(a(), 0); +} + +mod evil { + #[cfg(any(rpass1, rpass3))] + pub fn evil() { + unsafe { + std::arch::asm!("/* */"); + } + } + + #[cfg(any(cfail2))] + pub fn evil() { + unsafe { + std::arch::asm!("missing"); + } + } +} diff --git a/tests/run-make/extra-filename-with-temp-outputs/rmake.rs b/tests/run-make/extra-filename-with-temp-outputs/rmake.rs index 0910045bb85..f93a3ecc8d1 100644 --- a/tests/run-make/extra-filename-with-temp-outputs/rmake.rs +++ b/tests/run-make/extra-filename-with-temp-outputs/rmake.rs @@ -6,6 +6,8 @@ // are named as expected. // See https://github.com/rust-lang/rust/pull/15686 +//@ ignore-cross-compile (relocations in generic ELF against `arm-unknown-linux-gnueabihf`) + use run_make_support::{bin_name, cwd, has_prefix, has_suffix, rfs, rustc, shallow_find_files}; fn main() { diff --git a/tests/run-make/output-type-permutations/rmake.rs b/tests/run-make/output-type-permutations/rmake.rs index c0569af6e84..8da0bfaa12d 100644 --- a/tests/run-make/output-type-permutations/rmake.rs +++ b/tests/run-make/output-type-permutations/rmake.rs @@ -4,6 +4,9 @@ // files are exactly what is expected, no more, no less. // See https://github.com/rust-lang/rust/pull/12020 +//@ ignore-cross-compile +// Reason: some cross-compiled targets don't support various crate types and fail to link. + use std::path::PathBuf; use run_make_support::{ @@ -17,6 +20,7 @@ use run_make_support::{ // `dir`: the name of the directory where the test happens // `rustc_invocation`: the rustc command being tested // Any unexpected output files not listed in `must_exist` or `can_exist` will cause a failure. +#[track_caller] fn assert_expected_output_files(expectations: Expectations, rustc_invocation: impl Fn()) { let Expectations { expected_files: must_exist, allowed_files: can_exist, test_dir: dir } = expectations; diff --git a/tests/run-make/reproducible-build/rmake.rs b/tests/run-make/reproducible-build/rmake.rs index 8a8b0d6d652..93fc30de07d 100644 --- a/tests/run-make/reproducible-build/rmake.rs +++ b/tests/run-make/reproducible-build/rmake.rs @@ -20,6 +20,8 @@ // See https://github.com/rust-lang/rust/pull/32293 // Tracking Issue: https://github.com/rust-lang/rust/issues/129080 +//@ ignore-cross-compile (linker binary needs to run) + use run_make_support::{ bin_name, cwd, diff, is_darwin, is_windows, regex, rfs, run_in_tmpdir, rust_lib_name, rustc, }; diff --git a/tests/run-make/strip/rmake.rs b/tests/run-make/strip/rmake.rs index ef1acc26b45..01b31ac3094 100644 --- a/tests/run-make/strip/rmake.rs +++ b/tests/run-make/strip/rmake.rs @@ -1,4 +1,5 @@ -//@ ignore-windows Windows does not actually strip +//@ ignore-windows (Windows does not actually strip) +//@ ignore-cross-compile (relocations in generic ELF against `arm-unknown-linux-gnueabihf`) // Test that -Cstrip correctly strips/preserves debuginfo and symbols. diff --git a/tests/run-make/symbols-all-mangled/rmake.rs b/tests/run-make/symbols-all-mangled/rmake.rs index 1fb03c62399..79ddd06bb94 100644 --- a/tests/run-make/symbols-all-mangled/rmake.rs +++ b/tests/run-make/symbols-all-mangled/rmake.rs @@ -1,5 +1,7 @@ // Check that all symbols in cdylibs, staticlibs and bins are mangled //@ only-elf some object file formats create multiple symbols for each function with different names +//@ ignore-nvptx64 (needs target std) +//@ ignore-cross-compile (host-only) use run_make_support::object::read::{Object, ObjectSymbol}; use run_make_support::{bin_name, dynamic_lib_name, object, rfs, rustc, static_lib_name}; diff --git a/tests/run-make/unstable-feature-usage-metrics-incremental/main.rs b/tests/run-make/unstable-feature-usage-metrics-incremental/main.rs new file mode 100644 index 00000000000..f970d395b2c --- /dev/null +++ b/tests/run-make/unstable-feature-usage-metrics-incremental/main.rs @@ -0,0 +1,16 @@ +#![feature(ascii_char)] // random lib feature +#![feature(box_patterns)] // random lang feature + +// picked arbitrary unstable features, just need a random lib and lang feature, ideally ones that +// won't be stabilized any time soon so we don't have to update this test +fn main() { + for s in quix("foo/bar") { + print!("{s}"); + } + println!(); +} + +// need a latebound var to trigger the incremental compilation ICE +fn quix(foo: &str) -> impl Iterator<Item = &'_ str> + '_ { + foo.split('/') +} diff --git a/tests/run-make/unstable-feature-usage-metrics-incremental/rmake.rs b/tests/run-make/unstable-feature-usage-metrics-incremental/rmake.rs new file mode 100644 index 00000000000..7e070d80c79 --- /dev/null +++ b/tests/run-make/unstable-feature-usage-metrics-incremental/rmake.rs @@ -0,0 +1,94 @@ +//! This test checks if unstable feature usage metric dump files `unstable-feature-usage*.json` work +//! as expected. +//! +//! - Basic sanity checks on a default ICE dump. +//! +//! See <https://github.com/rust-lang/rust/issues/129485>. +//! +//! # Test history +//! +//! - forked from dump-ice-to-disk test, which has flakeyness issues on i686-mingw, I'm assuming +//! those will be present in this test as well on the same platform + +//@ ignore-windows +//FIXME(#128911): still flakey on i686-mingw. + +use std::path::{Path, PathBuf}; + +use run_make_support::rfs::create_dir_all; +use run_make_support::{ + cwd, filename_contains, has_extension, rfs, run_in_tmpdir, rustc, serde_json, + shallow_find_files, +}; + +fn find_feature_usage_metrics<P: AsRef<Path>>(dir: P) -> Vec<PathBuf> { + shallow_find_files(dir, |path| { + if filename_contains(path, "unstable_feature_usage") && has_extension(path, "json") { + true + } else { + dbg!(path); + false + } + }) +} + +fn main() { + test_metrics_dump(); + test_metrics_errors(); +} + +#[track_caller] +fn test_metrics_dump() { + run_in_tmpdir(|| { + let metrics_dir = cwd().join("metrics"); + create_dir_all(&metrics_dir); + rustc() + .input("main.rs") + .incremental("incremental") + .env("RUST_BACKTRACE", "short") + .arg(format!("-Zmetrics-dir={}", metrics_dir.display())) + .run(); + let mut metrics = find_feature_usage_metrics(&metrics_dir); + let json_path = + metrics.pop().expect("there should be one metrics file in the output directory"); + + // After the `pop` above, there should be no files left. + assert!( + metrics.is_empty(), + "there should be no more than one metrics file in the output directory" + ); + + let message = rfs::read_to_string(json_path); + let mut parsed: serde_json::Value = + serde_json::from_str(&message).expect("metrics should be dumped as json"); + // remove timestamps + assert!(parsed["lib_features"][0]["timestamp"].is_number()); + assert!(parsed["lang_features"][0]["timestamp"].is_number()); + parsed["lib_features"][0]["timestamp"] = serde_json::json!(null); + parsed["lang_features"][0]["timestamp"] = serde_json::json!(null); + let expected = serde_json::json!( + { + "lib_features":[{"symbol":"ascii_char", "timestamp":null}], + "lang_features":[{"symbol":"box_patterns","since":null, "timestamp":null}] + } + ); + + assert_eq!(expected, parsed); + }); +} + +#[track_caller] +fn test_metrics_errors() { + run_in_tmpdir(|| { + rustc() + .input("main.rs") + .incremental("incremental") + .env("RUST_BACKTRACE", "short") + .arg("-Zmetrics-dir=invaliddirectorythatdefinitelydoesntexist") + .run_fail() + .assert_stderr_contains( + "error: cannot dump feature usage metrics: No such file or directory", + ) + .assert_stdout_not_contains("internal compiler error"); + }); +} diff --git a/tests/rustdoc-gui/settings.goml b/tests/rustdoc-gui/settings.goml index 4ab5b83d7c4..11d3696ccf6 100644 --- a/tests/rustdoc-gui/settings.goml +++ b/tests/rustdoc-gui/settings.goml @@ -314,6 +314,13 @@ compare-elements-position: (".sub form", "#settings", ["x"]) // Check that setting-line has the same margin in this mode as in the popover. assert-css: (".setting-line", {"margin": |setting_line_margin|}) +// We will check that the checkboxes size doesn't change either. +assert-size: ( + "#settings label > input[type='checkbox']", + {"width": 19, "height": 19}, + ALL, +) + // We now check the display with JS disabled. assert-false: "noscript section" javascript: false @@ -327,3 +334,10 @@ reload: set-window-size: (300, 1000) wait-for: "#settings" assert-css: (".setting-radio", {"cursor": "pointer"}) + +// We ensure that the checkboxes size didn't change. +assert-size: ( + "#settings label > input[type='checkbox']", + {"width": 19, "height": 19}, + ALL, +) diff --git a/tests/rustdoc-js-std/unbox-type-result.js b/tests/rustdoc-js-std/unbox-type-result.js new file mode 100644 index 00000000000..1f5cba58adf --- /dev/null +++ b/tests/rustdoc-js-std/unbox-type-result.js @@ -0,0 +1,20 @@ +// exact-check + +// Test case for https://github.com/rust-lang/rust/issues/139665 +// make sure that std::io::Result and std::thread::Result get unboxed + +const EXPECTED = [ + { + query: "File -> Metadata", + others: [ + { path: "std::fs::File", name: "metadata" }, + { path: "std::fs::File", name: "metadata_at" }, + ] + }, + { + query: "JoinHandle<T> -> T", + others: [ + { path: "std::thread::JoinHandle", name: "join" }, + ] + }, +]; diff --git a/tests/rustdoc-js/generics-unbox.js b/tests/rustdoc-js/generics-unbox.js index 6baf00c814b..a4f2ba8e3a6 100644 --- a/tests/rustdoc-js/generics-unbox.js +++ b/tests/rustdoc-js/generics-unbox.js @@ -31,4 +31,10 @@ const EXPECTED = [ { 'path': 'generics_unbox', 'name': 'beta' }, ], }, + { + 'query': '-> Sigma', + 'others': [ + { 'path': 'generics_unbox', 'name': 'delta' }, + ], + }, ]; diff --git a/tests/rustdoc-js/generics-unbox.rs b/tests/rustdoc-js/generics-unbox.rs index c2578575997..b16e35ee3d4 100644 --- a/tests/rustdoc-js/generics-unbox.rs +++ b/tests/rustdoc-js/generics-unbox.rs @@ -42,3 +42,15 @@ pub fn beta<T, U>(_: Inside<T>) -> Out<Out3<T, U>, Out4<U, T>> { pub fn gamma<T, U>(_: Inside<T>) -> Out<Out3<U, T>, Out4<T, U>> { loop {} } + +pub fn delta(_: i32) -> Epsilon<Sigma> { + loop {} +} + +#[doc(search_unbox)] +pub struct Theta<T>(T); + +#[doc(search_unbox)] +pub type Epsilon<T> = Theta<T>; + +pub struct Sigma; diff --git a/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.rs b/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.rs index d8c43100d2f..1ed67694a90 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.rs @@ -1,7 +1,8 @@ // FIXME: if/when the output of the test harness can be tested on its own, this test should be // adapted to use that, and that normalize line can go away -//@ compile-flags:--test --edition 2021 +//@ compile-flags: --test +//@ edition: 2021 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ failure-status: 101 diff --git a/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.stdout b/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.stdout index 63d987de8a9..9f4d60e6f4d 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.stdout +++ b/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.stdout @@ -1,14 +1,14 @@ running 1 test -test $DIR/failed-doctest-should-panic-2021.rs - Foo (line 9) ... FAILED +test $DIR/failed-doctest-should-panic-2021.rs - Foo (line 10) ... FAILED failures: ----- $DIR/failed-doctest-should-panic-2021.rs - Foo (line 9) stdout ---- +---- $DIR/failed-doctest-should-panic-2021.rs - Foo (line 10) stdout ---- Test executable succeeded, but it's marked `should_panic`. failures: - $DIR/failed-doctest-should-panic-2021.rs - Foo (line 9) + $DIR/failed-doctest-should-panic-2021.rs - Foo (line 10) test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/tests/rustdoc-ui/intra-doc/import-inline-merge-module.rs b/tests/rustdoc-ui/intra-doc/import-inline-merge-module.rs index 636c3c8de42..bcfb790e55f 100644 --- a/tests/rustdoc-ui/intra-doc/import-inline-merge-module.rs +++ b/tests/rustdoc-ui/intra-doc/import-inline-merge-module.rs @@ -3,7 +3,8 @@ //@ check-pass //@ aux-build: inner-crate-doc.rs -//@ compile-flags: --extern inner_crate_doc --edition 2018 +//@ compile-flags: --extern inner_crate_doc +//@ edition: 2018 /// Import doc comment [inner_crate_doc] #[doc(inline)] diff --git a/tests/rustdoc-ui/invalid-syntax.rs b/tests/rustdoc-ui/invalid-syntax.rs index 42469da8376..3b60239df8d 100644 --- a/tests/rustdoc-ui/invalid-syntax.rs +++ b/tests/rustdoc-ui/invalid-syntax.rs @@ -47,7 +47,7 @@ pub fn baz() {} /// /// Indented block end pub fn quux() {} -//~^^^^^ could not parse code block as Rust code +//~^^^^^ WARN could not parse code block as Rust code /// Unclosed fence /// diff --git a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs index 89b55beaea1..73a68777c6d 100644 --- a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs +++ b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs @@ -5,10 +5,10 @@ use std::ops::Index; pub fn next<'a, T>(s: &'a mut dyn SVec<Item = T, Output = T>) { //~^ expected 1 lifetime argument //~| expected 1 generic argument - //~| the trait `SVec` is not dyn compatible + //~| ERROR the trait `SVec` is not dyn compatible //~| `SVec` is not dyn compatible - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` let _ = s; } @@ -16,52 +16,52 @@ pub trait SVec: Index< <Self as SVec>::Item, //~^ expected 1 lifetime argument //~| expected 1 generic argument - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` Output = <Index<<Self as SVec>::Item, //~^ expected 1 lifetime argument //~| expected 1 generic argument - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` Output = <Self as SVec>::Item> as SVec>::Item, //~^ expected 1 lifetime argument //~| expected 1 generic argument //~| expected 1 lifetime argument - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` //~| expected 1 generic argument - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` > { type Item<'a, T>; fn len(&self) -> <Self as SVec>::Item; //~^ expected 1 lifetime argument - //~| missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` //~| expected 1 generic argument - //~| missing generics for associated type `SVec::Item` + //~| ERROR missing generics for associated type `SVec::Item` } diff --git a/tests/rustdoc-ui/issues/ice-typeof-102986.rs b/tests/rustdoc-ui/issues/ice-typeof-102986.rs index 8fcbfffe172..b1ad19cb9ff 100644 --- a/tests/rustdoc-ui/issues/ice-typeof-102986.rs +++ b/tests/rustdoc-ui/issues/ice-typeof-102986.rs @@ -1,5 +1,5 @@ // https://github.com/rust-lang/rust/issues/102986 struct Struct { y: (typeof("hey"),), - //~^ `typeof` is a reserved keyword but unimplemented + //~^ ERROR `typeof` is a reserved keyword but unimplemented } diff --git a/tests/rustdoc-ui/multi-par-footnote.rs b/tests/rustdoc-ui/multi-par-footnote.rs new file mode 100644 index 00000000000..bb6a85db0db --- /dev/null +++ b/tests/rustdoc-ui/multi-par-footnote.rs @@ -0,0 +1,18 @@ +//@ check-pass +//@ compile-flags:--test +//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME" +// Regression test for #139064. + +/// Example +/// +/// Footnote with multiple paragraphs[^multiple] +/// +/// [^multiple]: +/// One +/// +/// Two +/// +/// Three +pub fn add(left: u64, right: u64) -> u64 { + left + right +} diff --git a/tests/rustdoc-ui/multi-par-footnote.stdout b/tests/rustdoc-ui/multi-par-footnote.stdout new file mode 100644 index 00000000000..7326c0a25a0 --- /dev/null +++ b/tests/rustdoc-ui/multi-par-footnote.stdout @@ -0,0 +1,5 @@ + +running 0 tests + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc/auxiliary/primitive-doc.rs b/tests/rustdoc/auxiliary/primitive-doc.rs index a7253ed2450..859716c38e4 100644 --- a/tests/rustdoc/auxiliary/primitive-doc.rs +++ b/tests/rustdoc/auxiliary/primitive-doc.rs @@ -1,4 +1,5 @@ -//@ compile-flags: --crate-type lib --edition 2018 +//@ compile-flags: --crate-type lib +//@ edition: 2018 #![feature(rustc_attrs)] #![feature(no_core)] diff --git a/tests/rustdoc/auxiliary/primitive-reexport.rs b/tests/rustdoc/auxiliary/primitive-reexport.rs index 18b57037634..7c85038674b 100644 --- a/tests/rustdoc/auxiliary/primitive-reexport.rs +++ b/tests/rustdoc/auxiliary/primitive-reexport.rs @@ -1,4 +1,5 @@ -//@ compile-flags: --emit metadata --crate-type lib --edition 2018 +//@ compile-flags: --emit metadata --crate-type lib +//@ edition: 2018 #![crate_name = "foo"] diff --git a/tests/rustdoc/intra-doc/extern-crate-only-used-in-link.rs b/tests/rustdoc/intra-doc/extern-crate-only-used-in-link.rs index 7cec30c8b74..30834bd7210 100644 --- a/tests/rustdoc/intra-doc/extern-crate-only-used-in-link.rs +++ b/tests/rustdoc/intra-doc/extern-crate-only-used-in-link.rs @@ -6,7 +6,8 @@ //@ aux-build:empty2.rs //@ aux-crate:priv:empty2=empty2.rs //@ build-aux-docs -//@ compile-flags:-Z unstable-options --edition 2018 +//@ compile-flags:-Z unstable-options +//@ edition: 2018 //@ has extern_crate_only_used_in_link/index.html //@ has - '//a[@href="../issue_66159_1/struct.Something.html"]' 'issue_66159_1::Something' diff --git a/tests/rustdoc/primitive-reexport.rs b/tests/rustdoc/primitive-reexport.rs index eb255745392..9b23b24fc93 100644 --- a/tests/rustdoc/primitive-reexport.rs +++ b/tests/rustdoc/primitive-reexport.rs @@ -1,5 +1,6 @@ //@ aux-build: primitive-reexport.rs -//@ compile-flags:--extern foo --edition 2018 +//@ compile-flags: --extern foo +//@ edition: 2018 #![crate_name = "bar"] diff --git a/tests/rustdoc/primitive-slice-auto-trait.rs b/tests/rustdoc/primitive-slice-auto-trait.rs index e78d1d94614..647c1cca948 100644 --- a/tests/rustdoc/primitive-slice-auto-trait.rs +++ b/tests/rustdoc/primitive-slice-auto-trait.rs @@ -1,4 +1,5 @@ -//@ compile-flags: --crate-type lib --edition 2018 +//@ compile-flags: --crate-type lib +//@ edition: 2018 #![crate_name = "foo"] #![feature(rustc_attrs)] diff --git a/tests/rustdoc/primitive-tuple-auto-trait.rs b/tests/rustdoc/primitive-tuple-auto-trait.rs index 045478e6b4f..51300bd6b2f 100644 --- a/tests/rustdoc/primitive-tuple-auto-trait.rs +++ b/tests/rustdoc/primitive-tuple-auto-trait.rs @@ -1,4 +1,5 @@ -//@ compile-flags: --crate-type lib --edition 2018 +//@ compile-flags: --crate-type lib +//@ edition: 2018 #![crate_name = "foo"] #![feature(rustc_attrs)] diff --git a/tests/rustdoc/primitive-tuple-variadic.rs b/tests/rustdoc/primitive-tuple-variadic.rs index d142729d2a8..bab5eaae9a2 100644 --- a/tests/rustdoc/primitive-tuple-variadic.rs +++ b/tests/rustdoc/primitive-tuple-variadic.rs @@ -1,4 +1,5 @@ -//@ compile-flags: --crate-type lib --edition 2018 +//@ compile-flags: --crate-type lib +//@ edition: 2018 #![crate_name = "foo"] #![feature(rustdoc_internals)] diff --git a/tests/rustdoc/primitive-unit-auto-trait.rs b/tests/rustdoc/primitive-unit-auto-trait.rs index 6cae094c21c..7dada1f9832 100644 --- a/tests/rustdoc/primitive-unit-auto-trait.rs +++ b/tests/rustdoc/primitive-unit-auto-trait.rs @@ -1,4 +1,5 @@ -//@ compile-flags: --crate-type lib --edition 2018 +//@ compile-flags: --crate-type lib +//@ edition: 2018 #![crate_name = "foo"] #![feature(rustc_attrs)] diff --git a/tests/ui-fulldeps/hash-stable-is-unstable.rs b/tests/ui-fulldeps/hash-stable-is-unstable.rs index a4b8533eb04..7f62b604410 100644 --- a/tests/ui-fulldeps/hash-stable-is-unstable.rs +++ b/tests/ui-fulldeps/hash-stable-is-unstable.rs @@ -1,24 +1,24 @@ //@ compile-flags: -Zdeduplicate-diagnostics=yes extern crate rustc_data_structures; -//~^ use of unstable library feature `rustc_private` +//~^ ERROR use of unstable library feature `rustc_private` //~| NOTE: issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date extern crate rustc_macros; -//~^ use of unstable library feature `rustc_private` +//~^ ERROR use of unstable library feature `rustc_private` //~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date extern crate rustc_query_system; -//~^ use of unstable library feature `rustc_private` +//~^ ERROR use of unstable library feature `rustc_private` //~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date use rustc_macros::HashStable; -//~^ use of unstable library feature `rustc_private` +//~^ ERROR use of unstable library feature `rustc_private` //~| NOTE: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date #[derive(HashStable)] -//~^ use of unstable library feature `rustc_private` +//~^ ERROR use of unstable library feature `rustc_private` //~| NOTE: in this expansion of #[derive(HashStable)] //~| NOTE: in this expansion of #[derive(HashStable)] //~| NOTE: in this expansion of #[derive(HashStable)] diff --git a/tests/ui-fulldeps/run-compiler-twice.rs b/tests/ui-fulldeps/run-compiler-twice.rs index ffc19b138a5..fa651baa7bc 100644 --- a/tests/ui-fulldeps/run-compiler-twice.rs +++ b/tests/ui-fulldeps/run-compiler-twice.rs @@ -70,6 +70,7 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf, linker: Option<&Path hash_untracked_state: None, register_lints: None, override_queries: None, + extra_symbols: Vec::new(), make_codegen_backend: None, registry: rustc_driver::diagnostics_registry(), using_internal_features: &rustc_driver::USING_INTERNAL_FEATURES, diff --git a/tests/ui-fulldeps/stable-mir/check_assoc_items.rs b/tests/ui-fulldeps/stable-mir/check_assoc_items.rs index f6f895588f2..f7511367675 100644 --- a/tests/ui-fulldeps/stable-mir/check_assoc_items.rs +++ b/tests/ui-fulldeps/stable-mir/check_assoc_items.rs @@ -51,7 +51,7 @@ fn test_assoc_items() -> ControlFlow<()> { check_items( &trait_assoc_item_defs, &[ - "ATrait::{synthetic#0}", + "ATrait::{anon_assoc#0}", "ATrait::rpitit", "ATrait::Assoc", "ATrait::assoc_fn_no_self", @@ -64,7 +64,7 @@ fn test_assoc_items() -> ControlFlow<()> { check_items( &impl_assoc_item_defs, &[ - "<AStruct as ATrait>::{synthetic#0}", + "<AStruct as ATrait>::{anon_assoc#0}", "<AStruct as ATrait>::rpitit", "<AStruct as ATrait>::Assoc", "<AStruct as ATrait>::assoc_fn_no_self", diff --git a/tests/ui-fulldeps/try-from-u32/errors.rs b/tests/ui-fulldeps/try-from-u32/errors.rs index 0470063312c..a25069c0a53 100644 --- a/tests/ui-fulldeps/try-from-u32/errors.rs +++ b/tests/ui-fulldeps/try-from-u32/errors.rs @@ -8,17 +8,17 @@ extern crate rustc_macros; use rustc_macros::TryFromU32; #[derive(TryFromU32)] -struct MyStruct {} //~ type is not an enum +struct MyStruct {} //~ ERROR type is not an enum #[derive(TryFromU32)] enum NonTrivial { A, B(), C {}, - D(bool), //~ enum variant cannot have fields - E(bool, bool), //~ enum variant cannot have fields - F { x: bool }, //~ enum variant cannot have fields - G { x: bool, y: bool }, //~ enum variant cannot have fields + D(bool), //~ ERROR enum variant cannot have fields + E(bool, bool), //~ ERROR enum variant cannot have fields + F { x: bool }, //~ ERROR enum variant cannot have fields + G { x: bool, y: bool }, //~ ERROR enum variant cannot have fields } fn main() {} diff --git a/tests/ui/README.md b/tests/ui/README.md deleted file mode 100644 index aa36481ae06..00000000000 --- a/tests/ui/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# UI Tests - -This folder contains `rustc`'s -[UI tests](https://rustc-dev-guide.rust-lang.org/tests/ui.html). - -## Test Directives (Headers) - -Typically, a UI test will have some test directives / headers which are -special comments that tell compiletest how to build and interpret a test. - -As part of an ongoing effort to rewrite compiletest -(see <https://github.com/rust-lang/compiler-team/issues/536>), a major -change proposal to change legacy compiletest-style headers `// <directive>` -to [`ui_test`](https://github.com/oli-obk/ui_test)-style headers -`//@ <directive>` was accepted (see -<https://github.com/rust-lang/compiler-team/issues/512>. - -An example directive is `ignore-test`. In legacy compiletest style, the header -would be written as - -```rs -// ignore-test -``` - -but in `ui_test` style, the header would be written as - -```rs -//@ ignore-test -``` - -compiletest is changed to accept only `//@` directives for UI tests -(currently), and will reject and report an error if it encounters any -comments `// <content>` that may be parsed as a legacy compiletest-style -test header. To fix this, you should migrate to the `ui_test`-style header -`//@ <content>`. diff --git a/tests/ui/abi/abi-typo-unstable.stderr b/tests/ui/abi/abi-typo-unstable.feature_disabled.stderr index 9ba67ad7dbe..1934b483c47 100644 --- a/tests/ui/abi/abi-typo-unstable.stderr +++ b/tests/ui/abi/abi-typo-unstable.feature_disabled.stderr @@ -1,8 +1,8 @@ -error[E0703]: invalid ABI: found `rust-intrinsec` - --> $DIR/abi-typo-unstable.rs:2:8 +error[E0703]: invalid ABI: found `rust-cull` + --> $DIR/abi-typo-unstable.rs:5:8 | -LL | extern "rust-intrinsec" fn rust_intrinsic() {} - | ^^^^^^^^^^^^^^^^ invalid ABI +LL | extern "rust-cull" fn rust_call(_: ()) {} + | ^^^^^^^^^^^ invalid ABI | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions diff --git a/tests/ui/abi/abi-typo-unstable.feature_enabled.stderr b/tests/ui/abi/abi-typo-unstable.feature_enabled.stderr new file mode 100644 index 00000000000..868b9509830 --- /dev/null +++ b/tests/ui/abi/abi-typo-unstable.feature_enabled.stderr @@ -0,0 +1,16 @@ +error[E0703]: invalid ABI: found `rust-cull` + --> $DIR/abi-typo-unstable.rs:5:8 + | +LL | extern "rust-cull" fn rust_call(_: ()) {} + | ^^^^^^^^^^^ invalid ABI + | + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions +help: there's a similarly named valid ABI `rust-call` + | +LL - extern "rust-cull" fn rust_call(_: ()) {} +LL + extern "rust-call" fn rust_call(_: ()) {} + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0703`. diff --git a/tests/ui/abi/abi-typo-unstable.rs b/tests/ui/abi/abi-typo-unstable.rs index 94991a5eb17..75366217fa2 100644 --- a/tests/ui/abi/abi-typo-unstable.rs +++ b/tests/ui/abi/abi-typo-unstable.rs @@ -1,6 +1,11 @@ -// rust-intrinsic is unstable and not enabled, so it should not be suggested as a fix -extern "rust-intrinsec" fn rust_intrinsic() {} //~ ERROR invalid ABI +//@ revisions: feature_disabled feature_enabled +#![cfg_attr(feature_enabled, feature(unboxed_closures))] + +// rust-call is unstable and not enabled, so it should not be suggested as a fix +extern "rust-cull" fn rust_call(_: ()) {} +//~^ ERROR invalid ABI +//[feature_enabled]~| HELP there's a similarly named valid ABI fn main() { - rust_intrinsic(); + rust_call(()); } diff --git a/tests/ui/abi/simd-abi-checks-avx.rs b/tests/ui/abi/simd-abi-checks-avx.rs index fa4b3ba3054..c31af6460fc 100644 --- a/tests/ui/abi/simd-abi-checks-avx.rs +++ b/tests/ui/abi/simd-abi-checks-avx.rs @@ -14,19 +14,19 @@ use std::arch::x86_64::*; struct Wrapper(__m256); unsafe extern "C" fn w(_: Wrapper) { - //~^ requires the `avx` target feature, which is not enabled + //~^ WARN requires the `avx` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler todo!() } unsafe extern "C" fn f(_: __m256) { - //~^ requires the `avx` target feature, which is not enabled + //~^ WARN requires the `avx` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler todo!() } unsafe extern "C" fn g() -> __m256 { - //~^ requires the `avx` target feature, which is not enabled + //~^ WARN requires the `avx` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler todo!() } diff --git a/tests/ui/abi/simd-abi-checks-empty-list.rs b/tests/ui/abi/simd-abi-checks-empty-list.rs index ca0889364fc..ba1b38af5b3 100644 --- a/tests/ui/abi/simd-abi-checks-empty-list.rs +++ b/tests/ui/abi/simd-abi-checks-empty-list.rs @@ -14,5 +14,5 @@ use minicore::*; pub struct SimdVec([i32; 4]); pub extern "C" fn pass_by_vec(_: SimdVec) {} -//~^ this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI +//~^ WARN this function definition uses SIMD vector type `SimdVec` which is not currently supported with the chosen ABI //~| WARNING this was previously accepted by the compiler diff --git a/tests/ui/abi/simd-abi-checks-sse.rs b/tests/ui/abi/simd-abi-checks-sse.rs index cb708bea3ca..d5fa9c0c0a3 100644 --- a/tests/ui/abi/simd-abi-checks-sse.rs +++ b/tests/ui/abi/simd-abi-checks-sse.rs @@ -18,6 +18,6 @@ pub struct SseVector([i64; 2]); #[no_mangle] pub unsafe extern "C" fn f(_: SseVector) { - //~^ this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled + //~^ WARN this function definition uses SIMD vector type `SseVector` which (with the chosen ABI) requires the `sse` target feature, which is not enabled //~| WARNING this was previously accepted by the compiler } diff --git a/tests/ui/abi/vectorcall-abi-checks.rs b/tests/ui/abi/vectorcall-abi-checks.rs index d83bbffa745..f3f399e0e31 100644 --- a/tests/ui/abi/vectorcall-abi-checks.rs +++ b/tests/ui/abi/vectorcall-abi-checks.rs @@ -11,11 +11,11 @@ use minicore::*; #[no_mangle] pub extern "vectorcall" fn f() { - //~^ ABI "vectorcall" which requires the `sse2` target feature + //~^ ERROR ABI "vectorcall" which requires the `sse2` target feature } #[no_mangle] pub fn call_site() { f(); - //~^ ABI "vectorcall" which requires the `sse2` target feature + //~^ ERROR ABI "vectorcall" which requires the `sse2` target feature } diff --git a/tests/ui/anon-params/anon-params-denied-2018.rs b/tests/ui/anon-params/anon-params-denied-2018.rs index 3602b401f85..d9d4363a681 100644 --- a/tests/ui/anon-params/anon-params-denied-2018.rs +++ b/tests/ui/anon-params/anon-params-denied-2018.rs @@ -3,7 +3,7 @@ //@ edition:2018 trait T { - fn foo(i32); //~ expected one of `:`, `@`, or `|`, found `)` + fn foo(i32); //~ ERROR expected one of `:`, `@`, or `|`, found `)` // Also checks with `&` fn foo_with_ref(&mut i32); diff --git a/tests/ui/argument-suggestions/issue-100478.rs b/tests/ui/argument-suggestions/issue-100478.rs index fb50fa11537..b0a9703112e 100644 --- a/tests/ui/argument-suggestions/issue-100478.rs +++ b/tests/ui/argument-suggestions/issue-100478.rs @@ -45,7 +45,7 @@ fn main() { let p8 = Arc::default(); foo( - //~^ 47:5: 47:8: this function takes 8 arguments but 7 arguments were supplied [E0061] + //~^ ERROR this function takes 8 arguments but 7 arguments were supplied [E0061] p1, //p2, p3, p4, p5, p6, p7, p8, ); diff --git a/tests/ui/argument-suggestions/issue-101097.rs b/tests/ui/argument-suggestions/issue-101097.rs index 25f7f583799..9b1565fef6f 100644 --- a/tests/ui/argument-suggestions/issue-101097.rs +++ b/tests/ui/argument-suggestions/issue-101097.rs @@ -15,7 +15,7 @@ fn f( fn main() { f(C, A, A, A, B, B, C); //~ ERROR function takes 6 arguments but 7 arguments were supplied [E0061] f(C, C, A, A, B, B); //~ ERROR arguments to this function are incorrect [E0308] - f(A, A, D, D, B, B); //~ arguments to this function are incorrect [E0308] - f(C, C, B, B, A, A); //~ arguments to this function are incorrect [E0308] - f(C, C, A, B, A, A); //~ arguments to this function are incorrect [E0308] + f(A, A, D, D, B, B); //~ ERROR arguments to this function are incorrect [E0308] + f(C, C, B, B, A, A); //~ ERROR arguments to this function are incorrect [E0308] + f(C, C, A, B, A, A); //~ ERROR arguments to this function are incorrect [E0308] } diff --git a/tests/ui/array-slice-vec/array_const_index-0.rs b/tests/ui/array-slice-vec/array_const_index-0.rs index 96755802ec7..f4fe89a50c2 100644 --- a/tests/ui/array-slice-vec/array_const_index-0.rs +++ b/tests/ui/array-slice-vec/array_const_index-0.rs @@ -1,6 +1,6 @@ const A: &'static [i32] = &[]; const B: i32 = (&A)[1]; -//~^ index out of bounds: the length is 0 but the index is 1 +//~^ NOTE index out of bounds: the length is 0 but the index is 1 //~| ERROR evaluation of constant value failed fn main() { diff --git a/tests/ui/array-slice-vec/array_const_index-1.rs b/tests/ui/array-slice-vec/array_const_index-1.rs index 625bf06a745..0d4de137a6e 100644 --- a/tests/ui/array-slice-vec/array_const_index-1.rs +++ b/tests/ui/array-slice-vec/array_const_index-1.rs @@ -1,6 +1,6 @@ const A: [i32; 0] = []; const B: i32 = A[1]; -//~^ index out of bounds: the length is 0 but the index is 1 +//~^ NOTE index out of bounds: the length is 0 but the index is 1 //~| ERROR evaluation of constant value failed fn main() { diff --git a/tests/ui/asm/issue-85247.rs b/tests/ui/asm/issue-85247.rs index 47bfda14092..f54c868dd56 100644 --- a/tests/ui/asm/issue-85247.rs +++ b/tests/ui/asm/issue-85247.rs @@ -18,6 +18,6 @@ use minicore::*; fn main() { unsafe { asm!("", out("r9") _); - //[rwpi]~^ cannot use register `r9` + //[rwpi]~^ ERROR cannot use register `r9` } } diff --git a/tests/ui/asm/issue-99071.rs b/tests/ui/asm/issue-99071.rs index 6a00fce7de4..522ac1fe887 100644 --- a/tests/ui/asm/issue-99071.rs +++ b/tests/ui/asm/issue-99071.rs @@ -13,6 +13,6 @@ use minicore::*; pub fn foo() { unsafe { asm!("", in("r8") 0); - //~^ cannot use register `r8`: high registers (r8+) can only be used as clobbers in Thumb-1 code + //~^ ERROR cannot use register `r8`: high registers (r8+) can only be used as clobbers in Thumb-1 code } } diff --git a/tests/ui/asm/type-check-4.rs b/tests/ui/asm/type-check-4.rs index a5b5e29294b..97b1ab74a7e 100644 --- a/tests/ui/asm/type-check-4.rs +++ b/tests/ui/asm/type-check-4.rs @@ -11,7 +11,7 @@ fn main() { let mut a = 0isize; let p = &a; asm!("{}", out(reg) a); - //~^ cannot assign to `a` because it is borrowed + //~^ ERROR cannot assign to `a` because it is borrowed println!("{}", p); // Can't read from mutable borrowed values. @@ -19,7 +19,7 @@ fn main() { let mut a = 0isize; let p = &mut a; asm!("{}", in(reg) a); - //~^ cannot use `a` because it was mutably borrowed + //~^ ERROR cannot use `a` because it was mutably borrowed println!("{}", p); } } diff --git a/tests/ui/asm/x86_64/issue-82869.rs b/tests/ui/asm/x86_64/issue-82869.rs index 5d3f417f733..448ebd9c99f 100644 --- a/tests/ui/asm/x86_64/issue-82869.rs +++ b/tests/ui/asm/x86_64/issue-82869.rs @@ -12,9 +12,9 @@ pub unsafe fn aarch64(a: f64, b: f64) -> f64 { || {}; b }); - //~^^^^ invalid register class - //~^^^^^ invalid register class - //~^^^^^^ invalid register + //~^^^^ ERROR invalid register class + //~^^^^^ ERROR invalid register class + //~^^^^^^ ERROR invalid register c } diff --git a/tests/ui/associated-consts/defaults-cyclic-fail.rs b/tests/ui/associated-consts/defaults-cyclic-fail.rs index b868ef31004..cc3b60b30e5 100644 --- a/tests/ui/associated-consts/defaults-cyclic-fail.rs +++ b/tests/ui/associated-consts/defaults-cyclic-fail.rs @@ -3,7 +3,7 @@ // Cyclic assoc. const defaults don't error unless *used* trait Tr { const A: u8 = Self::B; - //~^ cycle detected + //~^ ERROR cycle detected const B: u8 = Self::A; } diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.rs b/tests/ui/associated-inherent-types/generic-associated-types-bad.rs index fdc2a0f64e4..fd3281cefee 100644 --- a/tests/ui/associated-inherent-types/generic-associated-types-bad.rs +++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.rs @@ -13,8 +13,8 @@ impl Ty { } #[cfg(item)] -const _: Ty::Pr<String> = String::new(); //[item]~ the trait bound `String: Copy` is not satisfied -//[item]~^ the trait bound `String: Copy` is not satisfied +const _: Ty::Pr<String> = String::new(); //[item]~ ERROR the trait bound `String: Copy` is not satisfied +//[item]~^ ERROR the trait bound `String: Copy` is not satisfied fn main() { #[cfg(local)] diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-missing.rs b/tests/ui/associated-type-bounds/return-type-notation/path-missing.rs index 8cab48bd0c4..1ad02f754db 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-missing.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/path-missing.rs @@ -17,7 +17,7 @@ where fn type_dependent<T: A>() where T::method(..): Send, - //~^ associated function `method` not found for `T` + //~^ ERROR associated function `method` not found for `T` { } diff --git a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr index d7d2161e7ad..1be8db5ddf4 100644 --- a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr +++ b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr @@ -11,24 +11,6 @@ LL + fn get<T:Get,U:Get>(x: T, y: U) -> <Example as Get>::Value {} | error[E0223]: ambiguous associated type - --> $DIR/associated-types-in-ambiguous-context.rs:13:23 - | -LL | fn grab(&self) -> Grab::Value; - | ^^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Grab>::Value` - -error[E0223]: ambiguous associated type - --> $DIR/associated-types-in-ambiguous-context.rs:16:22 - | -LL | fn get(&self) -> Get::Value; - | ^^^^^^^^^^ - | -help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path - | -LL - fn get(&self) -> Get::Value; -LL + fn get(&self) -> <Example as Get>::Value; - | - -error[E0223]: ambiguous associated type --> $DIR/associated-types-in-ambiguous-context.rs:22:17 | LL | trait Foo where Foo::Assoc: Bar { @@ -56,6 +38,24 @@ LL + type X = <IoSlice<'_> as Deref>::Target; | and N other candidates +error[E0223]: ambiguous associated type + --> $DIR/associated-types-in-ambiguous-context.rs:13:23 + | +LL | fn grab(&self) -> Grab::Value; + | ^^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Grab>::Value` + +error[E0223]: ambiguous associated type + --> $DIR/associated-types-in-ambiguous-context.rs:16:22 + | +LL | fn get(&self) -> Get::Value; + | ^^^^^^^^^^ + | +help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path + | +LL - fn get(&self) -> Get::Value; +LL + fn get(&self) -> <Example as Get>::Value; + | + error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-2.rs b/tests/ui/associated-types/hr-associated-type-bound-2.rs index a89f61a81a5..467400f4b80 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-2.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-2.rs @@ -8,7 +8,7 @@ where } } -impl X<'_> for u32 //~ overflow evaluating the requirement `for<'b> u32: X<'b>` +impl X<'_> for u32 //~ ERROR overflow evaluating the requirement `for<'b> u32: X<'b>` where for<'b> <Self as X<'b>>::U: Clone, { diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-2.rs b/tests/ui/associated-types/hr-associated-type-bound-param-2.rs index 673f02c7cd0..d6546c24dc5 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-2.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-param-2.rs @@ -1,16 +1,16 @@ trait Z<'a, T: ?Sized> where T: Z<'a, u16>, - //~^ the trait bound `str: Clone` is not satisfied - //~| the trait bound `str: Clone` is not satisfied + //~^ ERROR the trait bound `str: Clone` is not satisfied + //~| ERROR the trait bound `str: Clone` is not satisfied for<'b> <T as Z<'b, u16>>::W: Clone, { type W: ?Sized; fn h(&self, x: &T::W) { <T::W>::clone(x); - //~^ the trait bound `str: Clone` is not satisfied - //~| the trait bound `str: Clone` is not satisfied - //~| the trait bound `str: Clone` is not satisfied + //~^ ERROR the trait bound `str: Clone` is not satisfied + //~| ERROR the trait bound `str: Clone` is not satisfied + //~| ERROR the trait bound `str: Clone` is not satisfied } } diff --git a/tests/ui/associated-types/hr-associated-type-projection-1.rs b/tests/ui/associated-types/hr-associated-type-projection-1.rs index d7fc5d122c3..1d272a66044 100644 --- a/tests/ui/associated-types/hr-associated-type-projection-1.rs +++ b/tests/ui/associated-types/hr-associated-type-projection-1.rs @@ -12,10 +12,10 @@ where impl<T: Copy + std::ops::Deref> UnsafeCopy<'_, T> for T { type Item = T; - //~^ type mismatch resolving `<T as Deref>::Target == T` + //~^ ERROR type mismatch resolving `<T as Deref>::Target == T` } pub fn main() { <&'static str>::bug(&""); - //~^ type mismatch resolving `<&str as Deref>::Target == &str` + //~^ ERROR type mismatch resolving `<&str as Deref>::Target == &str` } diff --git a/tests/ui/associated-types/impl-wf-cycle-4.rs b/tests/ui/associated-types/impl-wf-cycle-4.rs index bfa8adc71a1..1c1b3991d32 100644 --- a/tests/ui/associated-types/impl-wf-cycle-4.rs +++ b/tests/ui/associated-types/impl-wf-cycle-4.rs @@ -2,7 +2,7 @@ trait Filter { type ToMatch; } -impl<T> Filter for T //~ ERROR overflow evaluating the requirement +impl<T> Filter for T //~ ERROR cycle detected when where T: Fn(Self::ToMatch), { diff --git a/tests/ui/associated-types/impl-wf-cycle-4.stderr b/tests/ui/associated-types/impl-wf-cycle-4.stderr index cdbac267d34..c966579aecf 100644 --- a/tests/ui/associated-types/impl-wf-cycle-4.stderr +++ b/tests/ui/associated-types/impl-wf-cycle-4.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `<T as Filter>::ToMatch == <T as Filter>::ToMatch` +error[E0391]: cycle detected when computing normalized predicates of `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` --> $DIR/impl-wf-cycle-4.rs:5:1 | LL | / impl<T> Filter for T @@ -6,20 +6,23 @@ LL | | where LL | | T: Fn(Self::ToMatch), | |_________________________^ | -note: required for `T` to implement `Filter` - --> $DIR/impl-wf-cycle-4.rs:5:9 +note: ...which requires computing whether `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` has a guaranteed unsized self type... + --> $DIR/impl-wf-cycle-4.rs:5:1 | -LL | impl<T> Filter for T - | ^^^^^^ ^ -LL | where -LL | T: Fn(Self::ToMatch), - | ----------------- unsatisfied trait bound introduced here -note: associated types for the current `impl` cannot be restricted in `where` clauses - --> $DIR/impl-wf-cycle-4.rs:7:11 +LL | / impl<T> Filter for T +LL | | where +LL | | T: Fn(Self::ToMatch), + | |_________________________^ + = note: ...which again requires computing normalized predicates of `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>`, completing the cycle +note: cycle used when checking that `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` is well-formed + --> $DIR/impl-wf-cycle-4.rs:5:1 | -LL | T: Fn(Self::ToMatch), - | ^^^^^^^^^^^^^ +LL | / impl<T> Filter for T +LL | | where +LL | | T: Fn(Self::ToMatch), + | |_________________________^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/associated-types/issue-85103-layout-debug.rs b/tests/ui/associated-types/issue-85103-layout-debug.rs index 77c9876ffa5..29a59924ef0 100644 --- a/tests/ui/associated-types/issue-85103-layout-debug.rs +++ b/tests/ui/associated-types/issue-85103-layout-debug.rs @@ -4,6 +4,6 @@ use std::borrow::Cow; #[rustc_layout(debug)] type Edges<'a, E> = Cow<'a, [E]>; -//~^ the trait bound `[E]: ToOwned` is not satisfied +//~^ ERROR the trait bound `[E]: ToOwned` is not satisfied fn main() {} diff --git a/tests/ui/associated-types/remove-invalid-type-bound-suggest-issue-127555.rs b/tests/ui/associated-types/remove-invalid-type-bound-suggest-issue-127555.rs index 4dfeab9e8c3..70685504ccc 100644 --- a/tests/ui/associated-types/remove-invalid-type-bound-suggest-issue-127555.rs +++ b/tests/ui/associated-types/remove-invalid-type-bound-suggest-issue-127555.rs @@ -13,7 +13,7 @@ impl Foo for Baz { async fn bar<F>(&mut self, _func: F) -> () where F: FnMut() + Send, - //~^ impl has stricter requirements than trait + //~^ ERROR impl has stricter requirements than trait { () } diff --git a/tests/ui/async-await/async-closures/closure-shim-borrowck-error.rs b/tests/ui/async-await/async-closures/closure-shim-borrowck-error.rs index 069744a3282..12dca587e07 100644 --- a/tests/ui/async-await/async-closures/closure-shim-borrowck-error.rs +++ b/tests/ui/async-await/async-closures/closure-shim-borrowck-error.rs @@ -1,4 +1,5 @@ -//@ compile-flags: -Zvalidate-mir --edition=2018 --crate-type=lib -Copt-level=3 +//@ compile-flags: -Zvalidate-mir --crate-type=lib -Copt-level=3 +//@ edition: 2018 fn main() {} diff --git a/tests/ui/async-await/async-closures/closure-shim-borrowck-error.stderr b/tests/ui/async-await/async-closures/closure-shim-borrowck-error.stderr index 52697bac509..03fa220b0bf 100644 --- a/tests/ui/async-await/async-closures/closure-shim-borrowck-error.stderr +++ b/tests/ui/async-await/async-closures/closure-shim-borrowck-error.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of `x` which is behind a mutable reference - --> $DIR/closure-shim-borrowck-error.rs:10:18 + --> $DIR/closure-shim-borrowck-error.rs:11:18 | LL | needs_fn_mut(async || { | ^^^^^^^^ `x` is moved here @@ -11,7 +11,7 @@ LL | x.hello(); | move occurs because `x` has type `Ty`, which does not implement the `Copy` trait | note: if `Ty` implemented `Clone`, you could clone the value - --> $DIR/closure-shim-borrowck-error.rs:16:1 + --> $DIR/closure-shim-borrowck-error.rs:17:1 | LL | x.hello(); | - you could clone this value diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.rs b/tests/ui/async-await/drop-track-field-assign-nonsend.rs index 7002836ee47..2b93f901376 100644 --- a/tests/ui/async-await/drop-track-field-assign-nonsend.rs +++ b/tests/ui/async-await/drop-track-field-assign-nonsend.rs @@ -40,5 +40,5 @@ fn main() { let agent = Agent { info_result: InfoResult { node: None } }; // FIXME: It would be nice for this to work. See #94067. assert_send(agent.handle()); - //~^ cannot be sent between threads safely + //~^ ERROR cannot be sent between threads safely } diff --git a/tests/ui/async-await/field-assign-nonsend.rs b/tests/ui/async-await/field-assign-nonsend.rs index 7002836ee47..2b93f901376 100644 --- a/tests/ui/async-await/field-assign-nonsend.rs +++ b/tests/ui/async-await/field-assign-nonsend.rs @@ -40,5 +40,5 @@ fn main() { let agent = Agent { info_result: InfoResult { node: None } }; // FIXME: It would be nice for this to work. See #94067. assert_send(agent.handle()); - //~^ cannot be sent between threads safely + //~^ ERROR cannot be sent between threads safely } diff --git a/tests/ui/async-await/issue-60709.rs b/tests/ui/async-await/issue-60709.rs index 8634d6f7768..a3f54d70316 100644 --- a/tests/ui/async-await/issue-60709.rs +++ b/tests/ui/async-await/issue-60709.rs @@ -1,6 +1,7 @@ // This used to compile the future down to ud2, due to uninhabited types being // handled incorrectly in coroutines. -//@ compile-flags: -Copt-level=z -Cdebuginfo=2 --edition=2018 +//@ compile-flags: -Copt-level=z -Cdebuginfo=2 +//@ edition: 2018 //@ run-pass diff --git a/tests/ui/async-await/issue-70818.rs b/tests/ui/async-await/issue-70818.rs index 36295a84e7a..bc181de8d92 100644 --- a/tests/ui/async-await/issue-70818.rs +++ b/tests/ui/async-await/issue-70818.rs @@ -2,7 +2,7 @@ use std::future::Future; fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send { - //~^ Error future cannot be sent between threads safely + //~^ ERROR future cannot be sent between threads safely async { (ty, ty1) } } diff --git a/tests/ui/async-await/issue-71137.rs b/tests/ui/async-await/issue-71137.rs index 551cf85047c..6fbf17ccf0d 100644 --- a/tests/ui/async-await/issue-71137.rs +++ b/tests/ui/async-await/issue-71137.rs @@ -19,5 +19,5 @@ async fn wrong_mutex() { } fn main() { - fake_spawn(wrong_mutex()); //~ Error future cannot be sent between threads safely + fake_spawn(wrong_mutex()); //~ ERROR future cannot be sent between threads safely } diff --git a/tests/ui/async-await/issues/issue-59972.rs b/tests/ui/async-await/issues/issue-59972.rs index c30477fcd30..e64a856fab3 100644 --- a/tests/ui/async-await/issues/issue-59972.rs +++ b/tests/ui/async-await/issues/issue-59972.rs @@ -4,7 +4,8 @@ //@ run-pass -//@ compile-flags: --edition=2018 -Aunused +//@ compile-flags: -Aunused +//@ edition: 2018 pub enum Uninhabited { } diff --git a/tests/ui/async-await/suggest-missing-await.rs b/tests/ui/async-await/suggest-missing-await.rs index 0bd67cec335..989792825cf 100644 --- a/tests/ui/async-await/suggest-missing-await.rs +++ b/tests/ui/async-await/suggest-missing-await.rs @@ -43,7 +43,7 @@ async fn suggest_await_on_previous_match_arms() { 0 => dummy(), //~ HELP consider `await`ing on the `Future` 1 => dummy(), 2 => dummy().await, - //~^ `match` arms have incompatible types [E0308] + //~^ ERROR `match` arms have incompatible types [E0308] }; } diff --git a/tests/ui/attributes/issue-90873.rs b/tests/ui/attributes/issue-90873.rs index 53339ce7e28..50336e04c88 100644 --- a/tests/ui/attributes/issue-90873.rs +++ b/tests/ui/attributes/issue-90873.rs @@ -1,7 +1,7 @@ #![u=||{static d=||1;}] -//~^ attribute value must be a literal -//~| cannot find attribute `u` in this scope -//~| missing type for `static` item +//~^ ERROR attribute value must be a literal +//~| ERROR cannot find attribute `u` in this scope +//~| ERROR missing type for `static` item #![a={impl std::ops::Neg for i8 {}}] //~^ ERROR attribute value must be a literal diff --git a/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs b/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs index eaf8706369a..2f17d9620b4 100644 --- a/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs +++ b/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs @@ -30,6 +30,8 @@ pub fn e() {} //~| ERROR: expected identifier, found keyword `unsafe` //~| ERROR: malformed lint attribute input //~| ERROR: malformed lint attribute input +//~| ERROR: malformed lint attribute input +//~| ERROR: malformed lint attribute input pub fn f() {} fn main() {} diff --git a/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr b/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr index 9c5751c82e4..25b83a26e17 100644 --- a/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr +++ b/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr @@ -114,6 +114,22 @@ LL | #[unsafe(allow(unsafe(dead_code)))] | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 15 previous errors +error[E0452]: malformed lint attribute input + --> $DIR/proc-unsafe-attributes.rs:26:16 + | +LL | #[unsafe(allow(unsafe(dead_code)))] + | ^^^^^^^^^^^^^^^^^ bad attribute argument + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0452]: malformed lint attribute input + --> $DIR/proc-unsafe-attributes.rs:26:16 + | +LL | #[unsafe(allow(unsafe(dead_code)))] + | ^^^^^^^^^^^^^^^^^ bad attribute argument + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 17 previous errors For more information about this error, try `rustc --explain E0452`. diff --git a/tests/ui/attributes/used_with_multi_args.rs b/tests/ui/attributes/used_with_multi_args.rs index 2e17fcfd7a4..d3109cc6444 100644 --- a/tests/ui/attributes/used_with_multi_args.rs +++ b/tests/ui/attributes/used_with_multi_args.rs @@ -1,6 +1,6 @@ #![feature(used_with_arg)] -#[used(compiler, linker)] //~ expected `used`, `used(compiler)` or `used(linker)` +#[used(compiler, linker)] //~ ERROR expected `used`, `used(compiler)` or `used(linker)` static mut USED_COMPILER_LINKER: [usize; 1] = [0]; fn main() {} diff --git a/tests/ui/augmented-assignments.rs b/tests/ui/augmented-assignments.rs index 440a4a7fd65..35ab2d454f7 100644 --- a/tests/ui/augmented-assignments.rs +++ b/tests/ui/augmented-assignments.rs @@ -16,13 +16,13 @@ fn main() { += x; //~^ ERROR cannot move out of `x` because it is borrowed - //~| move out of `x` occurs here + //~| NOTE move out of `x` occurs here let y = Int(2); //~^ HELP consider changing this to be mutable //~| SUGGESTION mut y //~ ERROR cannot borrow `y` as mutable, as it is not declared as mutable - //~| cannot borrow as mutable + //~| NOTE cannot borrow as mutable += Int(1); } diff --git a/tests/ui/auto-traits/auto-trait-validation.fixed b/tests/ui/auto-traits/auto-trait-validation.fixed index f65952e00f5..8a445448c85 100644 --- a/tests/ui/auto-traits/auto-trait-validation.fixed +++ b/tests/ui/auto-traits/auto-trait-validation.fixed @@ -4,11 +4,11 @@ //@ run-rustfix auto trait Generic {} -//~^ auto traits cannot have generic parameters [E0567] +//~^ ERROR auto traits cannot have generic parameters [E0567] auto trait Bound {} -//~^ auto traits cannot have super traits or lifetime bounds [E0568] +//~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568] auto trait LifetimeBound {} -//~^ auto traits cannot have super traits or lifetime bounds [E0568] +//~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568] auto trait MyTrait { } -//~^ auto traits cannot have associated items [E0380] +//~^ ERROR auto traits cannot have associated items [E0380] fn main() {} diff --git a/tests/ui/auto-traits/auto-trait-validation.rs b/tests/ui/auto-traits/auto-trait-validation.rs index c83d7426e47..b5e7505d86a 100644 --- a/tests/ui/auto-traits/auto-trait-validation.rs +++ b/tests/ui/auto-traits/auto-trait-validation.rs @@ -4,11 +4,11 @@ //@ run-rustfix auto trait Generic<T> {} -//~^ auto traits cannot have generic parameters [E0567] +//~^ ERROR auto traits cannot have generic parameters [E0567] auto trait Bound : Copy {} -//~^ auto traits cannot have super traits or lifetime bounds [E0568] +//~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568] auto trait LifetimeBound : 'static {} -//~^ auto traits cannot have super traits or lifetime bounds [E0568] +//~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568] auto trait MyTrait { fn foo() {} } -//~^ auto traits cannot have associated items [E0380] +//~^ ERROR auto traits cannot have associated items [E0380] fn main() {} diff --git a/tests/ui/autodiff/autodiff_illegal.rs b/tests/ui/autodiff/autodiff_illegal.rs index 2f2cd8d9353..a916bd8b857 100644 --- a/tests/ui/autodiff/autodiff_illegal.rs +++ b/tests/ui/autodiff/autodiff_illegal.rs @@ -63,7 +63,7 @@ fn dummy() { // Malformed, where args? #[autodiff] pub fn f7(x: f64) { - //~^ ERROR autodiff must be applied to function + //~^ ERROR autodiff requires at least a name and mode unimplemented!() } @@ -77,7 +77,7 @@ pub fn f8(x: f64) { // Invalid attribute syntax #[autodiff = ""] pub fn f9(x: f64) { - //~^ ERROR autodiff must be applied to function + //~^ ERROR autodiff requires at least a name and mode unimplemented!() } diff --git a/tests/ui/autodiff/autodiff_illegal.stderr b/tests/ui/autodiff/autodiff_illegal.stderr index 3752b27e7dd..b119f61b8ae 100644 --- a/tests/ui/autodiff/autodiff_illegal.stderr +++ b/tests/ui/autodiff/autodiff_illegal.stderr @@ -62,7 +62,7 @@ error: autodiff must be applied to function LL | let add_one_v2 = |x: u32| -> u32 { x + 1 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: autodiff must be applied to function +error: autodiff requires at least a name and mode --> $DIR/autodiff_illegal.rs:65:1 | LL | / pub fn f7(x: f64) { @@ -80,7 +80,7 @@ LL | | unimplemented!() LL | | } | |_^ -error: autodiff must be applied to function +error: autodiff requires at least a name and mode --> $DIR/autodiff_illegal.rs:79:1 | LL | / pub fn f9(x: f64) { diff --git a/tests/ui/bootstrap/self-test/a.rs b/tests/ui/bootstrap/self-test/a.rs index 64d2d6f11bb..b8abd8179c9 100644 --- a/tests/ui/bootstrap/self-test/a.rs +++ b/tests/ui/bootstrap/self-test/a.rs @@ -1,2 +1,2 @@ //! Not used by compiler, this is used by bootstrap cli self-test. -//@ ignore-test +//@ ignore-test (used by bootstrap) diff --git a/tests/ui/bootstrap/self-test/b.rs b/tests/ui/bootstrap/self-test/b.rs index 91f92f67910..5bbd2f946fe 100644 --- a/tests/ui/bootstrap/self-test/b.rs +++ b/tests/ui/bootstrap/self-test/b.rs @@ -1,2 +1,2 @@ //! Not used by compiler, used by bootstrap cli self-test. -//@ ignore-test +//@ ignore-test (used by bootstrap) diff --git a/tests/ui/borrowck/borrowck-fn-in-const-c.rs b/tests/ui/borrowck/borrowck-fn-in-const-c.rs index c638cd08bc9..3cabedfe994 100644 --- a/tests/ui/borrowck/borrowck-fn-in-const-c.rs +++ b/tests/ui/borrowck/borrowck-fn-in-const-c.rs @@ -14,7 +14,7 @@ impl Drop for DropString { const LOCAL_REF: fn() -> &'static str = { fn broken() -> &'static str { let local = DropString { inner: format!("Some local string") }; - return &local.inner; //~ borrow may still be in use when destructor runs + return &local.inner; //~ ERROR borrow may still be in use when destructor runs } broken }; diff --git a/tests/ui/borrowck/borrowck-vec-pattern-nesting.rs b/tests/ui/borrowck/borrowck-vec-pattern-nesting.rs index ec074d2cf1c..400e5f010ec 100644 --- a/tests/ui/borrowck/borrowck-vec-pattern-nesting.rs +++ b/tests/ui/borrowck/borrowck-vec-pattern-nesting.rs @@ -19,7 +19,7 @@ fn b() { let vec: &mut [Box<isize>] = &mut vec; match vec { &mut [ref _b @ ..] => { - //~^ `vec[_]` is borrowed here + //~^ NOTE `vec[_]` is borrowed here vec[0] = Box::new(4); //~ ERROR cannot assign //~^ NOTE `vec[_]` is assigned to here _b.use_ref(); diff --git a/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr b/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr index 3a6b8008fce..02d5231f713 100644 --- a/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr +++ b/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr @@ -23,12 +23,6 @@ LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> = note: `#[warn(anonymous_parameters)]` on by default -error[E0220]: associated type `Assoc` not found for `Self` - --> $DIR/ice-mutability-error-slicing-121807.rs:7:36 - | -LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; - | ^^^^^ associated type `Assoc` not found - error[E0185]: method `read_dword` has a `&self` declaration in the impl, but not in the trait --> $DIR/ice-mutability-error-slicing-121807.rs:17:5 | @@ -47,6 +41,12 @@ LL | extern "C" fn read_word(&mut self) -> u8; LL | impl MemoryUnit for ROM { | ^^^^^^^^^^^^^^^^^^^^^^^ missing `read_word` in implementation +error[E0220]: associated type `Assoc` not found for `Self` + --> $DIR/ice-mutability-error-slicing-121807.rs:7:36 + | +LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; + | ^^^^^ associated type `Assoc` not found + error: aborting due to 4 previous errors; 1 warning emitted Some errors have detailed explanations: E0046, E0185, E0220, E0261. diff --git a/tests/ui/borrowck/issue-36082.fixed b/tests/ui/borrowck/issue-36082.fixed index 2209c56048e..9ac89b01607 100644 --- a/tests/ui/borrowck/issue-36082.fixed +++ b/tests/ui/borrowck/issue-36082.fixed @@ -13,5 +13,5 @@ fn main() { //~| NOTE creates a temporary value which is freed while still in use //~| HELP consider using a `let` binding to create a longer lived value println!("{}", val); - //~^ borrow later used here + //~^ NOTE borrow later used here } diff --git a/tests/ui/borrowck/issue-36082.rs b/tests/ui/borrowck/issue-36082.rs index da8b0068882..f2f769ea1c3 100644 --- a/tests/ui/borrowck/issue-36082.rs +++ b/tests/ui/borrowck/issue-36082.rs @@ -12,5 +12,5 @@ fn main() { //~| NOTE creates a temporary value which is freed while still in use //~| HELP consider using a `let` binding to create a longer lived value println!("{}", val); - //~^ borrow later used here + //~^ NOTE borrow later used here } diff --git a/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr b/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr index 190ddeaa8f2..a656bb67bcb 100644 --- a/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr +++ b/tests/ui/borrowck/trait-impl-argument-difference-ice.stderr @@ -8,12 +8,6 @@ LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686> = note: `#[warn(anonymous_parameters)]` on by default -error[E0220]: associated type `Assoc` not found for `Self` - --> $DIR/trait-impl-argument-difference-ice.rs:4:36 - | -LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; - | ^^^^^ associated type `Assoc` not found - error[E0185]: method `read_dword` has a `&self` declaration in the impl, but not in the trait --> $DIR/trait-impl-argument-difference-ice.rs:14:5 | @@ -32,6 +26,12 @@ LL | extern "C" fn read_word(&mut self) -> u8; LL | impl MemoryUnit for ROM { | ^^^^^^^^^^^^^^^^^^^^^^^ missing `read_word` in implementation +error[E0220]: associated type `Assoc` not found for `Self` + --> $DIR/trait-impl-argument-difference-ice.rs:4:36 + | +LL | extern "C" fn read_dword(Self::Assoc<'_>) -> u16; + | ^^^^^ associated type `Assoc` not found + error[E0596]: cannot borrow `*self` as mutable, as it is behind a `&` reference --> $DIR/trait-impl-argument-difference-ice.rs:16:19 | diff --git a/tests/ui/borrowck/two-phase-multi-mut.rs b/tests/ui/borrowck/two-phase-multi-mut.rs index bb646d7caf1..8ff924ccc2a 100644 --- a/tests/ui/borrowck/two-phase-multi-mut.rs +++ b/tests/ui/borrowck/two-phase-multi-mut.rs @@ -9,6 +9,6 @@ impl Foo { fn main() { let mut foo = Foo { }; foo.method(&mut foo); - //~^ cannot borrow `foo` as mutable more than once at a time - //~^^ cannot borrow `foo` as mutable more than once at a time + //~^ ERROR cannot borrow `foo` as mutable more than once at a time + //~^^ ERROR cannot borrow `foo` as mutable more than once at a time } diff --git a/tests/ui/cfg/cfg_false_no_std-2.rs b/tests/ui/cfg/cfg_false_no_std-2.rs index 35e545aae34..349c49412ff 100644 --- a/tests/ui/cfg/cfg_false_no_std-2.rs +++ b/tests/ui/cfg/cfg_false_no_std-2.rs @@ -1,7 +1,6 @@ // Error, the linked empty library is `no_std` and doesn't provide a panic handler. -//@ compile-flags: --error-format=human -//@ error-pattern: `#[panic_handler]` function required, but not found +//@ dont-require-annotations:ERROR //@ dont-check-compiler-stderr //@ aux-build: cfg_false_lib_no_std_before.rs @@ -11,6 +10,7 @@ extern crate cfg_false_lib_no_std_before as _; fn main() {} -// FIXME: The second error is target-dependent. -//FIXME~? ERROR `#[panic_handler]` function required, but not found +//~? ERROR `#[panic_handler]` function required, but not found +// FIXME: This error is target-dependent, could be served by some "optional error" annotation +// instead of `dont-require-annotations`. //FIXME~? ERROR unwinding panics are not supported without std diff --git a/tests/ui/check-cfg/raw-keywords.edition2015.stderr b/tests/ui/check-cfg/raw-keywords.edition2015.stderr index 8ca33e088fc..29c1a71c0b7 100644 --- a/tests/ui/check-cfg/raw-keywords.edition2015.stderr +++ b/tests/ui/check-cfg/raw-keywords.edition2015.stderr @@ -1,5 +1,5 @@ warning: unexpected `cfg` condition name: `tru` - --> $DIR/raw-keywords.rs:14:7 + --> $DIR/raw-keywords.rs:15:7 | LL | #[cfg(tru)] | ^^^ help: there is a config with a similar name: `r#true` @@ -9,7 +9,7 @@ LL | #[cfg(tru)] = note: `#[warn(unexpected_cfgs)]` on by default warning: unexpected `cfg` condition name: `r#false` - --> $DIR/raw-keywords.rs:19:7 + --> $DIR/raw-keywords.rs:20:7 | LL | #[cfg(r#false)] | ^^^^^^^ @@ -19,7 +19,7 @@ LL | #[cfg(r#false)] = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition name: `await` - --> $DIR/raw-keywords.rs:27:29 + --> $DIR/raw-keywords.rs:28:29 | LL | #[cfg_attr(edition2015, cfg(await))] | ^^^^^ @@ -28,7 +28,7 @@ LL | #[cfg_attr(edition2015, cfg(await))] = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition name: `raw` - --> $DIR/raw-keywords.rs:33:7 + --> $DIR/raw-keywords.rs:34:7 | LL | #[cfg(r#raw)] | ^^^^^ diff --git a/tests/ui/check-cfg/raw-keywords.edition2021.stderr b/tests/ui/check-cfg/raw-keywords.edition2021.stderr index cce55720bdd..cc3702685fd 100644 --- a/tests/ui/check-cfg/raw-keywords.edition2021.stderr +++ b/tests/ui/check-cfg/raw-keywords.edition2021.stderr @@ -1,5 +1,5 @@ warning: unexpected `cfg` condition name: `tru` - --> $DIR/raw-keywords.rs:14:7 + --> $DIR/raw-keywords.rs:15:7 | LL | #[cfg(tru)] | ^^^ help: there is a config with a similar name: `r#true` @@ -9,7 +9,7 @@ LL | #[cfg(tru)] = note: `#[warn(unexpected_cfgs)]` on by default warning: unexpected `cfg` condition name: `r#false` - --> $DIR/raw-keywords.rs:19:7 + --> $DIR/raw-keywords.rs:20:7 | LL | #[cfg(r#false)] | ^^^^^^^ @@ -19,7 +19,7 @@ LL | #[cfg(r#false)] = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition name: `r#await` - --> $DIR/raw-keywords.rs:28:29 + --> $DIR/raw-keywords.rs:29:29 | LL | #[cfg_attr(edition2021, cfg(r#await))] | ^^^^^^^ @@ -28,7 +28,7 @@ LL | #[cfg_attr(edition2021, cfg(r#await))] = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition name: `raw` - --> $DIR/raw-keywords.rs:33:7 + --> $DIR/raw-keywords.rs:34:7 | LL | #[cfg(r#raw)] | ^^^^^ diff --git a/tests/ui/check-cfg/raw-keywords.rs b/tests/ui/check-cfg/raw-keywords.rs index 5de13240d7e..b82eb5a64e9 100644 --- a/tests/ui/check-cfg/raw-keywords.rs +++ b/tests/ui/check-cfg/raw-keywords.rs @@ -6,7 +6,8 @@ //@ compile-flags: --cfg=true --cfg=async --check-cfg=cfg(r#true,r#async,edition2015,edition2021) // //@ revisions: edition2015 edition2021 -//@ [edition2021] compile-flags: --edition 2021 +//@ [edition2015] edition: 2015 +//@ [edition2021] edition: 2021 #[cfg(r#true)] fn foo() {} diff --git a/tests/ui/closures/2229_closure_analysis/by_value.rs b/tests/ui/closures/2229_closure_analysis/by_value.rs index 2c9202fd617..605b8ea35e5 100644 --- a/tests/ui/closures/2229_closure_analysis/by_value.rs +++ b/tests/ui/closures/2229_closure_analysis/by_value.rs @@ -20,8 +20,8 @@ fn big_box() { //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: let p = t.0.0; //~^ NOTE: Capturing t[(0, 0),Deref,(0, 0)] -> ByValue //~| NOTE: Min Capture t[(0, 0)] -> ByValue diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-1.rs b/tests/ui/closures/2229_closure_analysis/capture-analysis-1.rs index 0c42e66a2fa..3eb5cef3005 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-1.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-1.rs @@ -17,8 +17,8 @@ fn main() { //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: println!("{:?}", p); //~^ NOTE: Capturing p[] -> Immutable //~| NOTE: Min Capture p[] -> Immutable diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-2.rs b/tests/ui/closures/2229_closure_analysis/capture-analysis-2.rs index adb618d1771..e6cda824809 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-2.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-2.rs @@ -16,8 +16,8 @@ fn main() { //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: let _x = p.x; //~^ NOTE: Capturing p[(0, 0)] -> ByValue //~| NOTE: p[] captured as ByValue here diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-3.rs b/tests/ui/closures/2229_closure_analysis/capture-analysis-3.rs index 0a21eaaaa12..b25b613b61c 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-3.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-3.rs @@ -21,8 +21,8 @@ fn main() { //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: let _x = a.b.c; //~^ NOTE: Capturing a[(0, 0),(0, 0)] -> ByValue //~| NOTE: a[(0, 0)] captured as ByValue here diff --git a/tests/ui/closures/2229_closure_analysis/capture-analysis-4.rs b/tests/ui/closures/2229_closure_analysis/capture-analysis-4.rs index 790dad0710b..355e36c1463 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-analysis-4.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-analysis-4.rs @@ -21,8 +21,8 @@ fn main() { //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: let _x = a.b; //~^ NOTE: Capturing a[(0, 0)] -> ByValue //~| NOTE: Min Capture a[(0, 0)] -> ByValue diff --git a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs index af12e0b259d..52f0dcba6be 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-struct.rs @@ -15,8 +15,8 @@ fn main() { //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: println!("{}", p.x); //~^ NOTE: Capturing p[(0, 0)] -> Immutable //~| NOTE: Min Capture p[(0, 0)] -> Immutable diff --git a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs index ccd26049264..bac79ad2860 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-disjoint-field-tuple.rs @@ -10,8 +10,8 @@ fn main() { //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: println!("{}", t.0); //~^ NOTE: Capturing t[(0, 0)] -> Immutable //~| NOTE: Min Capture t[(0, 0)] -> Immutable diff --git a/tests/ui/closures/2229_closure_analysis/capture-enums.rs b/tests/ui/closures/2229_closure_analysis/capture-enums.rs index b1e21bd0f8d..d9c06a68c95 100644 --- a/tests/ui/closures/2229_closure_analysis/capture-enums.rs +++ b/tests/ui/closures/2229_closure_analysis/capture-enums.rs @@ -18,8 +18,8 @@ fn multi_variant_enum() { //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: if let Info::Point(_, _, str) = point { //~^ NOTE: Capturing point[] -> Immutable //~| NOTE: Capturing point[(2, 0)] -> ByValue @@ -50,8 +50,8 @@ fn single_variant_enum() { //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: let SingleVariant::Point(_, _, str) = point; //~^ NOTE: Capturing point[(2, 0)] -> ByValue //~| NOTE: Min Capture point[(2, 0)] -> ByValue diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/union.rs b/tests/ui/closures/2229_closure_analysis/diagnostics/union.rs index 647005bc1c9..c036712381c 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/union.rs +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/union.rs @@ -11,15 +11,15 @@ union A { fn main() { let mut a = A { y: 1 }; let mut c = || { - //~^ `a.y` is borrowed here + //~^ NOTE `a.y` is borrowed here let _ = unsafe { &a.y }; let _ = &mut a; - //~^ borrow occurs due to use in closure + //~^ NOTE borrow occurs due to use in closure let _ = unsafe { &mut a.y }; }; a.y = 1; - //~^ cannot assign to `a.y` because it is borrowed [E0506] - //~| `a.y` is assigned to here + //~^ ERROR cannot assign to `a.y` because it is borrowed [E0506] + //~| NOTE `a.y` is assigned to here c(); - //~^ borrow later used here + //~^ NOTE borrow later used here } diff --git a/tests/ui/closures/2229_closure_analysis/issue-89606.rs b/tests/ui/closures/2229_closure_analysis/issue-89606.rs index 8c88a4b8226..5494686356d 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-89606.rs +++ b/tests/ui/closures/2229_closure_analysis/issue-89606.rs @@ -2,8 +2,8 @@ // //@ check-pass //@ revisions: twenty_eighteen twenty_twentyone -//@ [twenty_eighteen]compile-flags: --edition 2018 -//@ [twenty_twentyone]compile-flags: --edition 2021 +//@ [twenty_eighteen] edition: 2018 +//@ [twenty_twentyone] edition: 2021 struct S<'a>(Option<&'a mut i32>); diff --git a/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.rs b/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.rs index 9c7b70457d9..40330af4088 100644 --- a/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.rs +++ b/tests/ui/closures/2229_closure_analysis/match/patterns-capture-analysis.rs @@ -10,8 +10,8 @@ fn test_1_should_capture() { let variant = Some(2229); let c = #[rustc_capture_analysis] || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: match variant { //~^ NOTE: Capturing variant[] -> Immutable //~| NOTE: Min Capture variant[] -> Immutable @@ -28,7 +28,7 @@ fn test_2_should_not_capture() { let variant = Some(2229); let c = #[rustc_capture_analysis] || { - //~^ First Pass analysis includes: + //~^ ERROR First Pass analysis includes: match variant { _ => {} } @@ -47,7 +47,7 @@ fn test_3_should_not_capture_single_variant() { let variant = SingleVariant::Points(1); let c = #[rustc_capture_analysis] || { - //~^ First Pass analysis includes: + //~^ ERROR First Pass analysis includes: match variant { SingleVariant::Points(_) => {} } @@ -61,8 +61,8 @@ fn test_6_should_capture_single_variant() { let variant = SingleVariant::Points(1); let c = #[rustc_capture_analysis] || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: match variant { //~^ NOTE: Capturing variant[] -> Immutable //~| NOTE: Capturing variant[(0, 0)] -> Immutable @@ -81,7 +81,7 @@ fn test_4_should_not_capture_array() { let array: [i32; 3] = [0; 3]; let c = #[rustc_capture_analysis] || { - //~^ First Pass analysis includes: + //~^ ERROR First Pass analysis includes: match array { [_,_,_] => {} } @@ -93,7 +93,7 @@ fn test_4_should_not_capture_array() { let array: &[i32; 3] = &[0; 3]; let c = #[rustc_capture_analysis] || { - //~^ First Pass analysis includes: + //~^ ERROR First Pass analysis includes: match array { [_, _, _] => {} } @@ -106,7 +106,7 @@ fn test_4_should_not_capture_array() { let f = &Foo(&[10; 3]); let c = #[rustc_capture_analysis] || { - //~^ First Pass analysis includes: + //~^ ERROR First Pass analysis includes: match f { Foo([_, _, _]) => () } @@ -128,8 +128,8 @@ fn test_5_should_capture_multi_variant() { let variant = MVariant::A; let c = #[rustc_capture_analysis] || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: match variant { //~^ NOTE: Capturing variant[] -> Immutable //~| NOTE: Min Capture variant[] -> Immutable @@ -146,8 +146,8 @@ fn test_7_should_capture_slice_len() { let slice: &[i32] = &[1, 2, 3]; let c = #[rustc_capture_analysis] || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: match slice { //~^ NOTE: Capturing slice[] -> Immutable //~| NOTE: Min Capture slice[] -> Immutable @@ -158,8 +158,8 @@ fn test_7_should_capture_slice_len() { c(); let c = #[rustc_capture_analysis] || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: match slice { //~^ NOTE: Capturing slice[] -> Immutable //~| NOTE: Min Capture slice[] -> Immutable @@ -170,8 +170,8 @@ fn test_7_should_capture_slice_len() { c(); let c = #[rustc_capture_analysis] || { - //~^ First Pass analysis includes: - //~| Min Capture analysis includes: + //~^ ERROR First Pass analysis includes: + //~| ERROR Min Capture analysis includes: match slice { //~^ NOTE: Capturing slice[] -> Immutable //~| NOTE: Min Capture slice[] -> Immutable @@ -187,7 +187,7 @@ fn test_8_capture_slice_wild() { let slice: &[i32] = &[1, 2, 3]; let c = #[rustc_capture_analysis] || { - //~^ First Pass analysis includes: + //~^ ERROR First Pass analysis includes: match slice { [..] => {}, _ => {} diff --git a/tests/ui/closures/2229_closure_analysis/move_closure.rs b/tests/ui/closures/2229_closure_analysis/move_closure.rs index b6690d06011..c681559f619 100644 --- a/tests/ui/closures/2229_closure_analysis/move_closure.rs +++ b/tests/ui/closures/2229_closure_analysis/move_closure.rs @@ -181,9 +181,9 @@ fn box_mut_1() { //~^ ERROR: attributes on expressions are experimental //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - //~| First Pass analysis includes: + //~| ERROR First Pass analysis includes: //~| NOTE: Capturing box_p_foo[Deref,Deref,(0, 0)] -> Mutable - //~| Min Capture analysis includes: + //~| ERROR Min Capture analysis includes: //~| NOTE: Min Capture box_p_foo[] -> ByValue } @@ -199,9 +199,9 @@ fn box_mut_2() { //~^ ERROR: attributes on expressions are experimental //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - //~| First Pass analysis includes: + //~| ERROR First Pass analysis includes: //~| NOTE: Capturing p_foo[Deref,Deref,(0, 0)] -> Mutable - //~| Min Capture analysis includes: + //~| ERROR Min Capture analysis includes: //~| NOTE: Min Capture p_foo[] -> ByValue } @@ -213,9 +213,9 @@ fn returned_closure_owns_copy_type_data() -> impl Fn() -> i32 { //~^ ERROR: attributes on expressions are experimental //~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - //~| First Pass analysis includes: + //~| ERROR First Pass analysis includes: //~| NOTE: Capturing x[] -> Immutable - //~| Min Capture analysis includes: + //~| ERROR Min Capture analysis includes: //~| NOTE: Min Capture x[] -> ByValue c diff --git a/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order2.rs b/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order2.rs index 4fc2e6c903a..a771b815702 100644 --- a/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order2.rs +++ b/tests/ui/closures/2229_closure_analysis/preserve_field_drop_order2.rs @@ -1,8 +1,8 @@ //@ run-pass //@ check-run-results //@ revisions: twenty_eighteen twenty_twentyone -//@ [twenty_eighteen]compile-flags: --edition 2018 -//@ [twenty_twentyone]compile-flags: --edition 2021 +//@ [twenty_eighteen] edition: 2018 +//@ [twenty_twentyone] edition: 2021 #[derive(Debug)] struct Dropable(&'static str); diff --git a/tests/ui/closures/binder/implicit-return.rs b/tests/ui/closures/binder/implicit-return.rs index d34e5721d91..9889d055a36 100644 --- a/tests/ui/closures/binder/implicit-return.rs +++ b/tests/ui/closures/binder/implicit-return.rs @@ -2,5 +2,5 @@ fn main() { let _f = for<'a> |_: &'a ()| {}; - //~^ implicit types in closure signatures are forbidden when `for<...>` is present + //~^ ERROR implicit types in closure signatures are forbidden when `for<...>` is present } diff --git a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.rs b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.rs index deb888ec286..f8e3b14f927 100644 --- a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.rs +++ b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.rs @@ -16,7 +16,7 @@ impl<'a, T> Foo<'a> for Wrap<T> where T: Fn(&'a i32) {} fn main() { needs_foo(|x| { - //[current]~^ implementation of `Foo` is not general enough + //[current]~^ ERROR implementation of `Foo` is not general enough //[next]~^^ ERROR type annotations needed x.to_string(); }); diff --git a/tests/ui/closures/wrong-closure-arg-suggestion-125325.rs b/tests/ui/closures/wrong-closure-arg-suggestion-125325.rs index ce575697cf6..c72d19e8481 100644 --- a/tests/ui/closures/wrong-closure-arg-suggestion-125325.rs +++ b/tests/ui/closures/wrong-closure-arg-suggestion-125325.rs @@ -21,9 +21,9 @@ fn func(_f: impl Fn()) -> usize { fn test_func(s: &S) -> usize { let mut x = (); s.assoc_func(|| x = ()); - //~^ cannot assign to `x`, as it is a captured variable in a `Fn` closure + //~^ ERROR cannot assign to `x`, as it is a captured variable in a `Fn` closure func(|| x = ()) - //~^ cannot assign to `x`, as it is a captured variable in a `Fn` closure + //~^ ERROR cannot assign to `x`, as it is a captured variable in a `Fn` closure } fn main() {} diff --git a/tests/ui/coercion/coerce-reborrow-multi-arg-fail.rs b/tests/ui/coercion/coerce-reborrow-multi-arg-fail.rs index 48be2d3146b..0a58f0897aa 100644 --- a/tests/ui/coercion/coerce-reborrow-multi-arg-fail.rs +++ b/tests/ui/coercion/coerce-reborrow-multi-arg-fail.rs @@ -2,5 +2,5 @@ fn test<T>(_a: T, _b: T) {} fn main() { test(&mut 7, &7); - //~^ mismatched types + //~^ ERROR mismatched types } diff --git a/tests/ui/coercion/mut-mut-wont-coerce.rs b/tests/ui/coercion/mut-mut-wont-coerce.rs index e99566461a2..33016e1e48a 100644 --- a/tests/ui/coercion/mut-mut-wont-coerce.rs +++ b/tests/ui/coercion/mut-mut-wont-coerce.rs @@ -33,7 +33,7 @@ fn make_foo(_: *mut *mut Foo) { fn main() { let mut result: SmartPtr<Foo> = SmartPtr(std::ptr::null_mut()); - make_foo(&mut &mut *result); //~ mismatched types + make_foo(&mut &mut *result); //~ ERROR mismatched types //~^ expected `*mut *mut Foo`, found `&mut &mut Foo` make_foo(out(&mut result)); // works, but makes one wonder why above coercion cannot happen } diff --git a/tests/ui/compiletest-self-test/trim-env-name.rs b/tests/ui/compiletest-self-test/trim-env-name.rs new file mode 100644 index 00000000000..0cb6efe9f76 --- /dev/null +++ b/tests/ui/compiletest-self-test/trim-env-name.rs @@ -0,0 +1,23 @@ +//@ edition: 2024 +//@ revisions: set unset +//@ run-pass +//@ ignore-cross-compile (assume that non-cross targets have working env vars) +//@ rustc-env: MY_RUSTC_ENV = my-rustc-value +//@ exec-env: MY_EXEC_ENV = my-exec-value +//@[unset] unset-rustc-env: MY_RUSTC_ENV +//@[unset] unset-exec-env: MY_EXEC_ENV + +// Check that compiletest trims whitespace from environment variable names +// specified in `rustc-env` and `exec-env` directives, so that +// `//@ exec-env: FOO=bar` sees the name as `FOO` and not ` FOO`. +// +// Values are currently not trimmed. +// +// Since this is a compiletest self-test, only run it on non-cross targets, +// to avoid having to worry about weird targets that don't support env vars. + +fn main() { + let is_set = cfg!(set); + assert_eq!(option_env!("MY_RUSTC_ENV"), is_set.then_some(" my-rustc-value")); + assert_eq!(std::env::var("MY_EXEC_ENV").ok().as_deref(), is_set.then_some(" my-exec-value")); +} diff --git a/tests/ui/conditional-compilation/cfg_accessible-not_sure.rs b/tests/ui/conditional-compilation/cfg_accessible-not_sure.rs index 2ac57f35674..7753b7d64fb 100644 --- a/tests/ui/conditional-compilation/cfg_accessible-not_sure.rs +++ b/tests/ui/conditional-compilation/cfg_accessible-not_sure.rs @@ -1,6 +1,6 @@ //@ revisions: edition2015 edition2021 -//@ [edition2015]compile-flags: --edition=2015 -//@ [edition2021]compile-flags: --edition=2021 +//@ [edition2015] edition: 2015 +//@ [edition2021] edition: 2021 #![feature(extern_types)] #![feature(cfg_accessible)] diff --git a/tests/ui/const-generics/adt_const_params/nested_bad_const_param_ty.rs b/tests/ui/const-generics/adt_const_params/nested_bad_const_param_ty.rs index 3a283442a0b..34ea143d254 100644 --- a/tests/ui/const-generics/adt_const_params/nested_bad_const_param_ty.rs +++ b/tests/ui/const-generics/adt_const_params/nested_bad_const_param_ty.rs @@ -4,18 +4,18 @@ use std::marker::ConstParamTy; #[derive(ConstParamTy)] -//~^ the trait `ConstParamTy_` cannot be implemented for this ty -//~| the trait `ConstParamTy_` cannot be implemented for this ty +//~^ ERROR the trait `ConstParamTy_` cannot be implemented for this ty +//~| ERROR the trait `ConstParamTy_` cannot be implemented for this ty struct Foo([*const u8; 1]); #[derive(ConstParamTy)] -//~^ the trait `ConstParamTy_` cannot be implemented for this ty -//~| the trait `ConstParamTy_` cannot be implemented for this ty +//~^ ERROR the trait `ConstParamTy_` cannot be implemented for this ty +//~| ERROR the trait `ConstParamTy_` cannot be implemented for this ty struct Foo2([*mut u8; 1]); #[derive(ConstParamTy)] -//~^ the trait `ConstParamTy_` cannot be implemented for this ty -//~| the trait `ConstParamTy_` cannot be implemented for this ty +//~^ ERROR the trait `ConstParamTy_` cannot be implemented for this ty +//~| ERROR the trait `ConstParamTy_` cannot be implemented for this ty struct Foo3([fn(); 1]); fn main() {} diff --git a/tests/ui/const-generics/defaults/mismatch.rs b/tests/ui/const-generics/defaults/mismatch.rs index ec131505ed7..3e35c2060b1 100644 --- a/tests/ui/const-generics/defaults/mismatch.rs +++ b/tests/ui/const-generics/defaults/mismatch.rs @@ -5,18 +5,18 @@ pub struct Example4<const N: usize = 13, const M: usize = 4>; fn main() { let e: Example<13> = (); - //~^ Error: mismatched types + //~^ ERROR mismatched types //~| expected struct `Example` let e: Example2<u32, 13> = (); - //~^ Error: mismatched types + //~^ ERROR mismatched types //~| expected struct `Example2` let e: Example3<13, u32> = (); - //~^ Error: mismatched types + //~^ ERROR mismatched types //~| expected struct `Example3` let e: Example3<7> = (); - //~^ Error: mismatched types + //~^ ERROR mismatched types //~| expected struct `Example3<7>` let e: Example4<7> = (); - //~^ Error: mismatched types + //~^ ERROR mismatched types //~| expected struct `Example4<7>` } diff --git a/tests/ui/const-generics/dont-evaluate-array-len-on-err-1.rs b/tests/ui/const-generics/dont-evaluate-array-len-on-err-1.rs index 6c4ee1af210..e7f050dae36 100644 --- a/tests/ui/const-generics/dont-evaluate-array-len-on-err-1.rs +++ b/tests/ui/const-generics/dont-evaluate-array-len-on-err-1.rs @@ -13,7 +13,7 @@ trait Foo { [Adt; std::mem::size_of::<Self::Assoc>()]: , { <[Adt; std::mem::size_of::<Self::Assoc>()] as Foo>::bar() - //~^ Error: the trait bound + //~^ ERROR the trait bound } fn bar() {} diff --git a/tests/ui/const-generics/early/invalid-const-arguments.rs b/tests/ui/const-generics/early/invalid-const-arguments.rs index 6619c975885..68e6b2ac458 100644 --- a/tests/ui/const-generics/early/invalid-const-arguments.rs +++ b/tests/ui/const-generics/early/invalid-const-arguments.rs @@ -4,7 +4,7 @@ struct A<const N: u8>; trait Foo {} impl Foo for A<N> {} //~^ ERROR cannot find type -//~| unresolved item provided when a constant +//~| ERROR unresolved item provided when a constant struct B<const N: u8>; impl<N> Foo for B<N> {} @@ -13,4 +13,4 @@ impl<N> Foo for B<N> {} struct C<const C: u8, const N: u8>; impl<const N: u8> Foo for C<N, T> {} //~^ ERROR cannot find type -//~| unresolved item provided when a constant +//~| ERROR unresolved item provided when a constant diff --git a/tests/ui/const-generics/generic_arg_infer/parend_infer.nogate.stderr b/tests/ui/const-generics/generic_arg_infer/parend_infer.nogate.stderr new file mode 100644 index 00000000000..d0a5da9676d --- /dev/null +++ b/tests/ui/const-generics/generic_arg_infer/parend_infer.nogate.stderr @@ -0,0 +1,53 @@ +error[E0658]: const arguments cannot yet be inferred with `_` + --> $DIR/parend_infer.rs:24:16 + | +LL | let c: Foo<_> = Foo::<1>; + | ^ + | + = note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: const arguments cannot yet be inferred with `_` + --> $DIR/parend_infer.rs:26:16 + | +LL | let c: Foo<(_)> = Foo::<1>; + | ^^^ + | + = note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: const arguments cannot yet be inferred with `_` + --> $DIR/parend_infer.rs:28:16 + | +LL | let c: Foo<(((_)))> = Foo::<1>; + | ^^^^^^^ + | + = note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: using `_` for array lengths is unstable + --> $DIR/parend_infer.rs:17:17 + | +LL | let b: [u8; (_)] = [1; (((((_)))))]; + | ^^^ + | + = note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: using `_` for array lengths is unstable + --> $DIR/parend_infer.rs:17:28 + | +LL | let b: [u8; (_)] = [1; (((((_)))))]; + | ^^^^^^^^^^^ + | + = note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/const-generics/generic_arg_infer/parend_infer.rs b/tests/ui/const-generics/generic_arg_infer/parend_infer.rs index 81c42183b38..3dc27a702de 100644 --- a/tests/ui/const-generics/generic_arg_infer/parend_infer.rs +++ b/tests/ui/const-generics/generic_arg_infer/parend_infer.rs @@ -1,7 +1,9 @@ -//@ check-pass +//@[gate] check-pass //@ revisions: gate nogate #![cfg_attr(gate, feature(generic_arg_infer))] +struct Foo<const N: usize>; + fn main() { // AST Types preserve parens for pretty printing reasons. This means // that this is parsed as a `TyKind::Paren(TyKind::Infer)`. Generic @@ -9,4 +11,20 @@ fn main() { // but `TyKind::Infer` wrapped in arbitrarily many `TyKind::Paren`. let a: Vec<(_)> = vec![1_u8]; let a: Vec<(((((_)))))> = vec![1_u8]; + + // AST Exprs similarly preserve parens for pretty printing reasons. + #[rustfmt::skip] + let b: [u8; (_)] = [1; (((((_)))))]; + //[nogate]~^ error: using `_` for array lengths is unstable + //[nogate]~| error: using `_` for array lengths is unstable + let b: [u8; 2] = b; + + // This is the same case as AST types as the parser doesn't distinguish between const + // and type args when they share syntax + let c: Foo<_> = Foo::<1>; + //[nogate]~^ error: const arguments cannot yet be inferred with `_` + let c: Foo<(_)> = Foo::<1>; + //[nogate]~^ error: const arguments cannot yet be inferred with `_` + let c: Foo<(((_)))> = Foo::<1>; + //[nogate]~^ error: const arguments cannot yet be inferred with `_` } diff --git a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.rs b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.rs index 7561ae2febb..33872ce7f0f 100644 --- a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.rs +++ b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.rs @@ -15,15 +15,15 @@ where // errors are bad but seems to be pre-existing issue #86198 assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as u128 }>>(); - //~^ Error: mismatched types - //~^^ Error: unconstrained generic constant + //~^ ERROR mismatched types + //~^^ ERROR unconstrained generic constant assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as _ }>>(); - //~^ Error: mismatched types - //~^^ Error: unconstrained generic constant + //~^ ERROR mismatched types + //~^^ ERROR unconstrained generic constant assert_impl::<HasCastInTraitImpl<13, { 12 as u128 }>>(); - //~^ Error: mismatched types + //~^ ERROR mismatched types assert_impl::<HasCastInTraitImpl<14, 13>>(); - //~^ Error: mismatched types + //~^ ERROR mismatched types } pub fn use_trait_impl_2<const N: usize>() where @@ -33,15 +33,15 @@ where // errors are bad but seems to be pre-existing issue #86198 assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as u128 }>>(); - //~^ Error: mismatched types - //~^^ Error: unconstrained generic constant + //~^ ERROR mismatched types + //~^^ ERROR unconstrained generic constant assert_impl::<HasCastInTraitImpl<{ N + 1 }, { N as _ }>>(); - //~^ Error: mismatched types - //~^^ Error: unconstrained generic constant + //~^ ERROR mismatched types + //~^^ ERROR unconstrained generic constant assert_impl::<HasCastInTraitImpl<13, { 12 as u128 }>>(); - //~^ Error: mismatched types + //~^ ERROR mismatched types assert_impl::<HasCastInTraitImpl<14, 13>>(); - //~^ Error: mismatched types + //~^ ERROR mismatched types } fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/const-generics-closure.rs b/tests/ui/const-generics/generic_const_exprs/const-generics-closure.rs new file mode 100644 index 00000000000..aad8cefe5d6 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/const-generics-closure.rs @@ -0,0 +1,13 @@ +// Regression test for issue #127424 + +fn bar() -> impl Into< + [u8; { + //~^ ERROR mismatched types [E0308] + let _ = for<'a, 'b> |x: &'a &'a Vec<&'b u32>, b: bool| -> &'a Vec<&'b u32> { *x }; + //~^ ERROR `for<...>` binders for closures are experimental [E0658] + }], +> { + [89] +} + +fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/const-generics-closure.stderr b/tests/ui/const-generics/generic_const_exprs/const-generics-closure.stderr new file mode 100644 index 00000000000..5410bbdc125 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/const-generics-closure.stderr @@ -0,0 +1,26 @@ +error[E0658]: `for<...>` binders for closures are experimental + --> $DIR/const-generics-closure.rs:6:17 + | +LL | let _ = for<'a, 'b> |x: &'a &'a Vec<&'b u32>, b: bool| -> &'a Vec<&'b u32> { *x }; + | ^^^^^^^^^^^ + | + = note: see issue #97362 <https://github.com/rust-lang/rust/issues/97362> for more information + = help: add `#![feature(closure_lifetime_binder)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = help: consider removing `for<...>` + +error[E0308]: mismatched types + --> $DIR/const-generics-closure.rs:4:10 + | +LL | [u8; { + | __________^ +LL | | +LL | | let _ = for<'a, 'b> |x: &'a &'a Vec<&'b u32>, b: bool| -> &'a Vec<&'b u32> { *x }; +LL | | +LL | | }], + | |_____^ expected `usize`, found `()` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0308, E0658. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/generic_const_exprs/issue-72787.rs b/tests/ui/const-generics/generic_const_exprs/issue-72787.rs index c3208786708..ea65b6d3fdf 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-72787.rs +++ b/tests/ui/const-generics/generic_const_exprs/issue-72787.rs @@ -9,8 +9,8 @@ pub trait True {} impl<const LHS: u32, const RHS: u32> True for IsLessOrEqual<LHS, RHS> where Condition<{ LHS <= RHS }>: True -//[min]~^ Error generic parameters may not be used in const operations -//[min]~| Error generic parameters may not be used in const operations +//[min]~^ ERROR generic parameters may not be used in const operations +//[min]~| ERROR generic parameters may not be used in const operations { } impl True for Condition<true> {} @@ -21,8 +21,8 @@ where IsLessOrEqual<I, 8>: True, IsLessOrEqual<J, 8>: True, IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, -//[min]~^ Error generic parameters may not be used in const operations -//[min]~| Error generic parameters may not be used in const operations +//[min]~^ ERROR generic parameters may not be used in const operations +//[min]~| ERROR generic parameters may not be used in const operations // Condition<{ 8 - I <= 8 - J }>: True, { fn print() { diff --git a/tests/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.rs b/tests/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.rs index 2fa9a71fbb3..f08b9ceffb9 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.rs +++ b/tests/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.rs @@ -14,7 +14,7 @@ trait Foo { [(); std::mem::size_of::<Self::Assoc>()]: , { Self::AssocInstance == [(); std::mem::size_of::<Self::Assoc>()]; - //~^ Error: mismatched types + //~^ ERROR mismatched types } } diff --git a/tests/ui/const-generics/issues/issue-68366.rs b/tests/ui/const-generics/issues/issue-68366.rs index d9d5e21857b..6f745b260b6 100644 --- a/tests/ui/const-generics/issues/issue-68366.rs +++ b/tests/ui/const-generics/issues/issue-68366.rs @@ -11,7 +11,7 @@ struct Collatz<const N: Option<usize>>; impl <const N: usize> Collatz<{Some(N)}> {} //~^ ERROR the const parameter -//[min]~^^ generic parameters may not be used in const operations +//[min]~^^ ERROR generic parameters may not be used in const operations //[full]~^^^ ERROR overly complex struct Foo; diff --git a/tests/ui/const-generics/issues/issue-74950.rs b/tests/ui/const-generics/issues/issue-74950.rs index f79676ccee8..150566e98c0 100644 --- a/tests/ui/const-generics/issues/issue-74950.rs +++ b/tests/ui/const-generics/issues/issue-74950.rs @@ -17,9 +17,9 @@ struct Inner; // - impl StructuralPartialEq #[derive(PartialEq, Eq)] struct Outer<const I: Inner>; -//[min]~^ `Inner` is forbidden -//[min]~| `Inner` is forbidden -//[min]~| `Inner` is forbidden -//[min]~| `Inner` is forbidden +//[min]~^ ERROR `Inner` is forbidden +//[min]~| ERROR `Inner` is forbidden +//[min]~| ERROR `Inner` is forbidden +//[min]~| ERROR `Inner` is forbidden fn main() {} diff --git a/tests/ui/const-generics/issues/issue-90318.rs b/tests/ui/const-generics/issues/issue-90318.rs index cebc1ce2142..317ddad49cd 100644 --- a/tests/ui/const-generics/issues/issue-90318.rs +++ b/tests/ui/const-generics/issues/issue-90318.rs @@ -12,7 +12,7 @@ impl True for If<true> {} fn consume<T: 'static>(_val: T) where If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, - //~^ overly complex generic constant + //~^ ERROR overly complex generic constant //~| ERROR: cannot call { } @@ -20,7 +20,7 @@ where fn test<T: 'static>() where If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, - //~^ overly complex generic constant + //~^ ERROR overly complex generic constant //~| ERROR: cannot call { } diff --git a/tests/ui/consts/async-block.rs b/tests/ui/consts/async-block.rs index 1211a150f7d..96881bc9134 100644 --- a/tests/ui/consts/async-block.rs +++ b/tests/ui/consts/async-block.rs @@ -10,9 +10,9 @@ use std::future::Future; // From <https://github.com/rust-lang/rust/issues/77361> const _: i32 = { core::mem::ManuallyDrop::new(async { 0 }); 4 }; -//[without_feature]~^ `async` block +//[without_feature]~^ ERROR `async` block static _FUT: &(dyn Future<Output = ()> + Sync) = &async {}; -//[without_feature]~^ `async` block +//[without_feature]~^ ERROR `async` block fn main() {} diff --git a/tests/ui/consts/const-array-oob-arith.rs b/tests/ui/consts/const-array-oob-arith.rs index 0f6e76768cd..8e5c56e0ea8 100644 --- a/tests/ui/consts/const-array-oob-arith.rs +++ b/tests/ui/consts/const-array-oob-arith.rs @@ -4,10 +4,10 @@ const VAL: i32 = ARR[IDX]; const BONG: [i32; (ARR[0] - 41) as usize] = [5]; const BLUB: [i32; (ARR[0] - 40) as usize] = [5]; //~^ ERROR: mismatched types -//~| expected an array +//~| NOTE expected an array const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99]; //~^ ERROR: mismatched types -//~| expected an array +//~| NOTE expected an array fn main() { let _ = VAL; diff --git a/tests/ui/consts/const-deref-ptr.rs b/tests/ui/consts/const-deref-ptr.rs index 2607d4de229..c80cb95ea93 100644 --- a/tests/ui/consts/const-deref-ptr.rs +++ b/tests/ui/consts/const-deref-ptr.rs @@ -3,6 +3,6 @@ fn main() { static C: u64 = unsafe {*(0xdeadbeef as *const u64)}; //~^ ERROR could not evaluate static initializer - //~| dangling pointer + //~| NOTE dangling pointer println!("{}", C); } diff --git a/tests/ui/consts/const-err-enum-discriminant.rs b/tests/ui/consts/const-err-enum-discriminant.rs index ebb3e551ba8..42165ff5346 100644 --- a/tests/ui/consts/const-err-enum-discriminant.rs +++ b/tests/ui/consts/const-err-enum-discriminant.rs @@ -7,7 +7,7 @@ union Foo { enum Bar { Boo = [unsafe { Foo { b: () }.a }; 4][3], //~^ ERROR evaluation of constant value failed - //~| uninitialized + //~| NOTE uninitialized } fn main() { diff --git a/tests/ui/consts/const-eval/assign-to-static-within-other-static.rs b/tests/ui/consts/const-eval/assign-to-static-within-other-static.rs index ecf97223f6a..30e40bd8be1 100644 --- a/tests/ui/consts/const-eval/assign-to-static-within-other-static.rs +++ b/tests/ui/consts/const-eval/assign-to-static-within-other-static.rs @@ -6,7 +6,7 @@ use std::cell::UnsafeCell; static mut FOO: u32 = 42; static BOO: () = unsafe { FOO = 5; - //~^ could not evaluate static initializer [E0080] + //~^ ERROR could not evaluate static initializer [E0080] }; fn main() {} diff --git a/tests/ui/consts/const-eval/const-eval-span.rs b/tests/ui/consts/const-eval/const-eval-span.rs index 1667c77d124..f1904c76b6c 100644 --- a/tests/ui/consts/const-eval/const-eval-span.rs +++ b/tests/ui/consts/const-eval/const-eval-span.rs @@ -8,7 +8,7 @@ const CONSTANT: S = S(0); enum E { V = CONSTANT, //~^ ERROR mismatched types - //~| expected `isize`, found `S` + //~| NOTE expected `isize`, found `S` } fn main() {} diff --git a/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs b/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs index ec5508a1e90..ca96cfd9d19 100644 --- a/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs +++ b/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs @@ -5,6 +5,6 @@ const Z: i32 = unsafe { *(&1 as *const i32) }; // bad, will thus error in miri const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR evaluation of constant value failed -//~| is a dangling pointer +//~| NOTE is a dangling pointer const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR evaluation of constant value failed -//~| is a dangling pointer +//~| NOTE is a dangling pointer diff --git a/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.rs b/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.rs index c6960fa7259..3a932343ddd 100644 --- a/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.rs +++ b/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.rs @@ -37,7 +37,7 @@ const OFFSET: () = unsafe { // fails. let field = &x.a; //~^ ERROR: evaluation of constant value failed - //~| does not have a known offset + //~| NOTE does not have a known offset }; fn main() {} diff --git a/tests/ui/consts/const-eval/partial_ptr_overwrite.rs b/tests/ui/consts/const-eval/partial_ptr_overwrite.rs index 1e99d84bba4..9438de5e3fe 100644 --- a/tests/ui/consts/const-eval/partial_ptr_overwrite.rs +++ b/tests/ui/consts/const-eval/partial_ptr_overwrite.rs @@ -5,7 +5,7 @@ const PARTIAL_OVERWRITE: () = { unsafe { let ptr: *mut _ = &mut p; *(ptr as *mut u8) = 123; //~ ERROR constant - //~| unable to overwrite parts of a pointer + //~| NOTE unable to overwrite parts of a pointer } let x = *p; }; diff --git a/tests/ui/consts/const-eval/ub-enum-overwrite.rs b/tests/ui/consts/const-eval/ub-enum-overwrite.rs index 69f1d01b2f3..e37c25718f8 100644 --- a/tests/ui/consts/const-eval/ub-enum-overwrite.rs +++ b/tests/ui/consts/const-eval/ub-enum-overwrite.rs @@ -10,7 +10,7 @@ const _: u8 = { e = E::B; unsafe { *p } //~^ ERROR evaluation of constant value failed - //~| uninitialized + //~| NOTE uninitialized }; fn main() {} diff --git a/tests/ui/consts/const-eval/ub-write-through-immutable.rs b/tests/ui/consts/const-eval/ub-write-through-immutable.rs index d3ae2d81884..795ac602a1c 100644 --- a/tests/ui/consts/const-eval/ub-write-through-immutable.rs +++ b/tests/ui/consts/const-eval/ub-write-through-immutable.rs @@ -8,14 +8,14 @@ const WRITE_AFTER_CAST: () = unsafe { let mut x = 0; let ptr = &x as *const i32 as *mut i32; *ptr = 0; //~ERROR: evaluation of constant value failed - //~| immutable + //~| NOTE immutable }; const WRITE_AFTER_TRANSMUTE: () = unsafe { let mut x = 0; let ptr: *mut i32 = mem::transmute(&x); *ptr = 0; //~ERROR: evaluation of constant value failed - //~| immutable + //~| NOTE immutable }; // it's okay when there is interior mutability; diff --git a/tests/ui/consts/const-eval/union-ice.rs b/tests/ui/consts/const-eval/union-ice.rs index 1db9470912d..8ce5f6d89a8 100644 --- a/tests/ui/consts/const-eval/union-ice.rs +++ b/tests/ui/consts/const-eval/union-ice.rs @@ -13,13 +13,13 @@ const UNION: DummyUnion = DummyUnion { field1: 1065353216 }; const FIELD3: Field3 = unsafe { UNION.field3 }; //~^ ERROR evaluation of constant value failed -//~| uninitialized +//~| NOTE uninitialized const FIELD_PATH: Struct = Struct { a: 42, b: unsafe { UNION.field3 }, //~^ ERROR evaluation of constant value failed - //~| uninitialized + //~| NOTE uninitialized }; struct Struct { @@ -32,7 +32,7 @@ const FIELD_PATH2: Struct2 = Struct2 { 21, unsafe { UNION.field3 }, //~^ ERROR evaluation of constant value failed - //~| uninitialized + //~| NOTE uninitialized 23, 24, ], diff --git a/tests/ui/consts/const-eval/union_promotion.rs b/tests/ui/consts/const-eval/union_promotion.rs index 18894c45fd8..3868b0b18b1 100644 --- a/tests/ui/consts/const-eval/union_promotion.rs +++ b/tests/ui/consts/const-eval/union_promotion.rs @@ -5,7 +5,7 @@ union Foo { } fn main() { - let x: &'static bool = &unsafe { //~ temporary value dropped while borrowed + let x: &'static bool = &unsafe { //~ ERROR temporary value dropped while borrowed Foo { a: &1 }.b == Foo { a: &2 }.b }; } diff --git a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs index a77ee293820..89a8d1429b4 100644 --- a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs +++ b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs @@ -8,11 +8,11 @@ const unsafe extern "C-unwind" fn bar() -> usize { fn main() { let a: [u8; foo()]; - //~^ call to unsafe function `foo` is unsafe and requires unsafe function or block + //~^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block foo(); //~^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block let b: [u8; bar()]; - //~^ call to unsafe function `bar` is unsafe and requires unsafe function or block + //~^ ERROR call to unsafe function `bar` is unsafe and requires unsafe function or block bar(); //~^ ERROR call to unsafe function `bar` is unsafe and requires unsafe function or block } diff --git a/tests/ui/consts/const-integer-bool-ops.rs b/tests/ui/consts/const-integer-bool-ops.rs index 35915a7a606..fbbd51adfe8 100644 --- a/tests/ui/consts/const-integer-bool-ops.rs +++ b/tests/ui/consts/const-integer-bool-ops.rs @@ -1,67 +1,67 @@ const X: usize = 42 && 39; //~^ ERROR mismatched types -//~| expected `bool`, found integer +//~| NOTE expected `bool`, found integer //~| ERROR mismatched types -//~| expected `bool`, found integer +//~| NOTE expected `bool`, found integer //~| ERROR mismatched types -//~| expected `usize`, found `bool` +//~| NOTE expected `usize`, found `bool` const ARR: [i32; X] = [99; 34]; const X1: usize = 42 || 39; //~^ ERROR mismatched types -//~| expected `bool`, found integer +//~| NOTE expected `bool`, found integer //~| ERROR mismatched types -//~| expected `bool`, found integer +//~| NOTE expected `bool`, found integer //~| ERROR mismatched types -//~| expected `usize`, found `bool` +//~| NOTE expected `usize`, found `bool` const ARR1: [i32; X1] = [99; 47]; const X2: usize = -42 || -39; //~^ ERROR mismatched types -//~| expected `bool`, found integer +//~| NOTE expected `bool`, found integer //~| ERROR mismatched types -//~| expected `bool`, found integer +//~| NOTE expected `bool`, found integer //~| ERROR mismatched types -//~| expected `usize`, found `bool` +//~| NOTE expected `usize`, found `bool` const ARR2: [i32; X2] = [99; 18446744073709551607]; const X3: usize = -42 && -39; //~^ ERROR mismatched types -//~| expected `bool`, found integer +//~| NOTE expected `bool`, found integer //~| ERROR mismatched types -//~| expected `bool`, found integer +//~| NOTE expected `bool`, found integer //~| ERROR mismatched types -//~| expected `usize`, found `bool` +//~| NOTE expected `usize`, found `bool` const ARR3: [i32; X3] = [99; 6]; const Y: usize = 42.0 == 42.0; //~^ ERROR mismatched types -//~| expected `usize`, found `bool` +//~| NOTE expected `usize`, found `bool` const ARRR: [i32; Y] = [99; 1]; const Y1: usize = 42.0 >= 42.0; //~^ ERROR mismatched types -//~| expected `usize`, found `bool` +//~| NOTE expected `usize`, found `bool` const ARRR1: [i32; Y1] = [99; 1]; const Y2: usize = 42.0 <= 42.0; //~^ ERROR mismatched types -//~| expected `usize`, found `bool` +//~| NOTE expected `usize`, found `bool` const ARRR2: [i32; Y2] = [99; 1]; const Y3: usize = 42.0 > 42.0; //~^ ERROR mismatched types -//~| expected `usize`, found `bool` +//~| NOTE expected `usize`, found `bool` const ARRR3: [i32; Y3] = [99; 0]; const Y4: usize = 42.0 < 42.0; //~^ ERROR mismatched types -//~| expected `usize`, found `bool` +//~| NOTE expected `usize`, found `bool` const ARRR4: [i32; Y4] = [99; 0]; const Y5: usize = 42.0 != 42.0; //~^ ERROR mismatched types -//~| expected `usize`, found `bool` +//~| NOTE expected `usize`, found `bool` const ARRR5: [i32; Y5] = [99; 0]; fn main() { diff --git a/tests/ui/consts/const-len-underflow-subspans.rs b/tests/ui/consts/const-len-underflow-subspans.rs index ed77e907842..5afb1bf89d0 100644 --- a/tests/ui/consts/const-len-underflow-subspans.rs +++ b/tests/ui/consts/const-len-underflow-subspans.rs @@ -7,5 +7,5 @@ const TWO: usize = 2; fn main() { let a: [i8; ONE - TWO] = unimplemented!(); //~^ ERROR evaluation of constant value failed - //~| attempt to compute `1_usize - 2_usize`, which would overflow + //~| NOTE attempt to compute `1_usize - 2_usize`, which would overflow } diff --git a/tests/ui/consts/const-slice-oob.rs b/tests/ui/consts/const-slice-oob.rs index 429b9782132..09202df72c0 100644 --- a/tests/ui/consts/const-slice-oob.rs +++ b/tests/ui/consts/const-slice-oob.rs @@ -1,6 +1,6 @@ const FOO: &'static[u32] = &[1, 2, 3]; const BAR: u32 = FOO[5]; -//~^ index out of bounds: the length is 3 but the index is 5 +//~^ NOTE index out of bounds: the length is 3 but the index is 5 //~| ERROR evaluation of constant value failed fn main() { diff --git a/tests/ui/consts/const-suggest-feature.rs b/tests/ui/consts/const-suggest-feature.rs index 0c940368976..dbb166dd6c5 100644 --- a/tests/ui/consts/const-suggest-feature.rs +++ b/tests/ui/consts/const-suggest-feature.rs @@ -1,4 +1,4 @@ -//@compile-flags: --edition 2018 +//@ edition: 2018 use std::cell::Cell; const WRITE: () = unsafe { diff --git a/tests/ui/consts/const_in_pattern/reject_non_structural.rs b/tests/ui/consts/const_in_pattern/reject_non_structural.rs index 39e5f732a89..6478bf9c6ee 100644 --- a/tests/ui/consts/const_in_pattern/reject_non_structural.rs +++ b/tests/ui/consts/const_in_pattern/reject_non_structural.rs @@ -93,6 +93,7 @@ fn main() { //~| NOTE constant of non-structural type trait Trait: Sized { const ASSOC: Option<Self>; } //~ NOTE constant defined here + //~^ NOTE impl Trait for NoDerive { const ASSOC: Option<NoDerive> = Some(NoDerive); } match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), }; //~^ ERROR constant of non-structural type `NoDerive` in a pattern diff --git a/tests/ui/consts/const_in_pattern/reject_non_structural.stderr b/tests/ui/consts/const_in_pattern/reject_non_structural.stderr index fa16d0b06a7..bf54d3d76ae 100644 --- a/tests/ui/consts/const_in_pattern/reject_non_structural.stderr +++ b/tests/ui/consts/const_in_pattern/reject_non_structural.stderr @@ -118,14 +118,14 @@ LL | impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: constant of non-structural type `NoDerive` in a pattern - --> $DIR/reject_non_structural.rs:97:28 + --> $DIR/reject_non_structural.rs:98:28 | LL | struct NoDerive; | --------------- `NoDerive` must be annotated with `#[derive(PartialEq)]` to be usable in patterns ... LL | trait Trait: Sized { const ASSOC: Option<Self>; } | ------------------ ------------------------- constant defined here -LL | impl Trait for NoDerive { const ASSOC: Option<NoDerive> = Some(NoDerive); } +... LL | match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), }; | ^^^^^^^^^^^^^^^ constant of non-structural type | @@ -136,7 +136,7 @@ LL | impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: constant of non-structural type `NoDerive` in a pattern - --> $DIR/reject_non_structural.rs:102:28 + --> $DIR/reject_non_structural.rs:103:28 | LL | struct NoDerive; | --------------- `NoDerive` must be annotated with `#[derive(PartialEq)]` to be usable in patterns @@ -153,7 +153,7 @@ LL | impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: constant of non-structural type `NoDerive` in a pattern - --> $DIR/reject_non_structural.rs:107:29 + --> $DIR/reject_non_structural.rs:108:29 | LL | struct NoDerive; | --------------- `NoDerive` must be annotated with `#[derive(PartialEq)]` to be usable in patterns diff --git a/tests/ui/consts/copy-intrinsic.rs b/tests/ui/consts/copy-intrinsic.rs index 08fbcc107e7..5ae46787800 100644 --- a/tests/ui/consts/copy-intrinsic.rs +++ b/tests/ui/consts/copy-intrinsic.rs @@ -32,7 +32,7 @@ const COPY_OOB_1: () = unsafe { copy_nonoverlapping(0x100 as *const i32, dangle, 0); // Non-zero-sized copy is not. copy_nonoverlapping(0x100 as *const i32, dangle, 1); //~ ERROR evaluation of constant value failed [E0080] - //~| got 0x100[noalloc] which is a dangling pointer + //~| NOTE got 0x100[noalloc] which is a dangling pointer }; const COPY_OOB_2: () = unsafe { let x = 0i32; @@ -41,20 +41,20 @@ const COPY_OOB_2: () = unsafe { copy_nonoverlapping(dangle, 0x100 as *mut i32, 0); // Non-zero-sized copy is not. copy_nonoverlapping(dangle, 0x100 as *mut i32, 1); //~ ERROR evaluation of constant value failed [E0080] - //~| +0x28 which is at or beyond the end of the allocation + //~| NOTE +0x28 which is at or beyond the end of the allocation }; const COPY_SIZE_OVERFLOW: () = unsafe { let x = 0; let mut y = 0; copy(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); //~ ERROR evaluation of constant value failed [E0080] - //~| overflow computing total size of `copy` + //~| NOTE overflow computing total size of `copy` }; const COPY_NONOVERLAPPING_SIZE_OVERFLOW: () = unsafe { let x = 0; let mut y = 0; - copy_nonoverlapping(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); //~ evaluation of constant value failed [E0080] - //~| overflow computing total size of `copy_nonoverlapping` + copy_nonoverlapping(&x, &mut y, 1usize << (mem::size_of::<usize>() * 8 - 1)); //~ ERROR evaluation of constant value failed [E0080] + //~| NOTE overflow computing total size of `copy_nonoverlapping` }; fn main() { diff --git a/tests/ui/consts/drop_zst.rs b/tests/ui/consts/drop_zst.rs index 40c66043f9f..daf8f1b0343 100644 --- a/tests/ui/consts/drop_zst.rs +++ b/tests/ui/consts/drop_zst.rs @@ -11,7 +11,7 @@ impl Drop for S { } const fn foo() { - let s = S; //~ destructor + let s = S; //~ ERROR destructor } fn main() {} diff --git a/tests/ui/consts/eval-enum.rs b/tests/ui/consts/eval-enum.rs index 551f10e66e3..fa9ad6736e2 100644 --- a/tests/ui/consts/eval-enum.rs +++ b/tests/ui/consts/eval-enum.rs @@ -1,9 +1,9 @@ enum Test { DivZero = 1/0, - //~^ attempt to divide `1_isize` by zero + //~^ NOTE attempt to divide `1_isize` by zero //~| ERROR evaluation of constant value failed RemZero = 1%0, - //~^ attempt to calculate the remainder of `1_isize` with a divisor of zero + //~^ NOTE attempt to calculate the remainder of `1_isize` with a divisor of zero //~| ERROR evaluation of constant value failed } diff --git a/tests/ui/consts/extra-const-ub/detect-extra-ub.rs b/tests/ui/consts/extra-const-ub/detect-extra-ub.rs index d2b157e03e7..481f2ff88df 100644 --- a/tests/ui/consts/extra-const-ub/detect-extra-ub.rs +++ b/tests/ui/consts/extra-const-ub/detect-extra-ub.rs @@ -28,32 +28,32 @@ enum UninhDiscriminant { const INVALID_BOOL: () = unsafe { let _x: bool = transmute(3u8); //[with_flag]~^ ERROR: evaluation of constant value failed - //[with_flag]~| invalid value + //[with_flag]~| NOTE invalid value }; const INVALID_PTR_IN_INT: () = unsafe { let _x: usize = transmute(&3u8); //[with_flag]~^ ERROR: evaluation of constant value failed - //[with_flag]~| invalid value + //[with_flag]~| NOTE invalid value }; const INVALID_PTR_IN_ENUM: () = unsafe { let _x: PtrSizedEnum = transmute(&3u8); //[with_flag]~^ ERROR: evaluation of constant value failed - //[with_flag]~| invalid value + //[with_flag]~| NOTE invalid value }; const INVALID_SLICE_TO_USIZE_TRANSMUTE: () = unsafe { let x: &[u8] = &[0; 32]; let _x: (usize, usize) = transmute(x); //[with_flag]~^ ERROR: evaluation of constant value failed - //[with_flag]~| invalid value + //[with_flag]~| NOTE invalid value }; const UNALIGNED_PTR: () = unsafe { let _x: &u32 = transmute(&[0u8; 4]); //[with_flag]~^ ERROR: evaluation of constant value failed - //[with_flag]~| invalid value + //[with_flag]~| NOTE invalid value }; const UNINHABITED_VARIANT: () = unsafe { @@ -61,7 +61,7 @@ const UNINHABITED_VARIANT: () = unsafe { // Not using transmute, we want to hit the ImmTy code path. let v = *addr_of!(data).cast::<UninhDiscriminant>(); //[with_flag]~^ ERROR: evaluation of constant value failed - //[with_flag]~| invalid value + //[with_flag]~| NOTE invalid value }; const PARTIAL_POINTER: () = unsafe { @@ -81,7 +81,7 @@ const PARTIAL_POINTER: () = unsafe { let mem = Align { p: mem, align: 0 }; let _val = *(&mem as *const Align as *const [*const u8; 2]); //[with_flag]~^ ERROR: evaluation of constant value failed - //[with_flag]~| invalid value + //[with_flag]~| NOTE invalid value }; // Regression tests for an ICE (related to <https://github.com/rust-lang/rust/issues/113988>). @@ -96,7 +96,7 @@ const OVERSIZED_REF: () = { unsafe { let slice: *const [u8] = transmute((1usize, usize::MAX)); let _val = &*slice; //[with_flag]~^ ERROR: evaluation of constant value failed - //[with_flag]~| slice is bigger than largest supported object + //[with_flag]~| NOTE slice is bigger than largest supported object } }; fn main() {} diff --git a/tests/ui/consts/issue-19244-2.rs b/tests/ui/consts/issue-19244-2.rs index c9a68b05c5b..87f8c1581a7 100644 --- a/tests/ui/consts/issue-19244-2.rs +++ b/tests/ui/consts/issue-19244-2.rs @@ -3,5 +3,5 @@ const STRUCT: MyStruct = MyStruct { field: 42 }; fn main() { let a: [isize; STRUCT.nonexistent_field]; - //~^ no field `nonexistent_field` on type `MyStruct` + //~^ ERROR no field `nonexistent_field` on type `MyStruct` } diff --git a/tests/ui/consts/min_const_fn/min_const_fn.rs b/tests/ui/consts/min_const_fn/min_const_fn.rs index e6d9d184e04..38ca10858b1 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn.rs +++ b/tests/ui/consts/min_const_fn/min_const_fn.rs @@ -34,13 +34,13 @@ const fn foo35(a: bool, b: bool) -> bool { a ^ b } struct Foo<T: ?Sized>(T); impl<T> Foo<T> { const fn new(t: T) -> Self { Foo(t) } - const fn into_inner(self) -> T { self.0 } //~ destructor of + const fn into_inner(self) -> T { self.0 } //~ ERROR destructor of const fn get(&self) -> &T { &self.0 } const fn get_mut(&mut self) -> &mut T { &mut self.0 } } impl<'a, T> Foo<T> { const fn new_lt(t: T) -> Self { Foo(t) } - const fn into_inner_lt(self) -> T { self.0 } //~ destructor of + const fn into_inner_lt(self) -> T { self.0 } //~ ERROR destructor of const fn get_lt(&self) -> &T { &self.0 } const fn get_mut_lt(&mut self) -> &mut T { &mut self.0 } } diff --git a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs index d6f07994e82..8f2bcd82c73 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs +++ b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![unstable(feature = "humans", reason = "who ever let humans program computers, we're apparently really bad at it", diff --git a/tests/ui/consts/miri_unleashed/ptr_arith.rs b/tests/ui/consts/miri_unleashed/ptr_arith.rs index 4e118322079..408aa5db24d 100644 --- a/tests/ui/consts/miri_unleashed/ptr_arith.rs +++ b/tests/ui/consts/miri_unleashed/ptr_arith.rs @@ -6,7 +6,7 @@ static PTR_INT_CAST: () = { let x = &0 as *const _ as usize; //~^ ERROR could not evaluate static initializer - //~| exposing pointers + //~| NOTE exposing pointers let _v = x == x; }; @@ -14,7 +14,7 @@ static PTR_INT_TRANSMUTE: () = unsafe { let x: usize = std::mem::transmute(&0); let _v = x + 0; //~^ ERROR could not evaluate static initializer - //~| unable to turn pointer into integer + //~| NOTE unable to turn pointer into integer }; // I'd love to test pointer comparison, but that is not possible since diff --git a/tests/ui/consts/missing_span_in_backtrace.stderr b/tests/ui/consts/missing_span_in_backtrace.stderr index 2f3a65302bd..aad3d76dd26 100644 --- a/tests/ui/consts/missing_span_in_backtrace.stderr +++ b/tests/ui/consts/missing_span_in_backtrace.stderr @@ -12,10 +12,10 @@ note: inside `swap_nonoverlapping::<MaybeUninit<u8>>` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `swap_nonoverlapping::compiletime::<MaybeUninit<u8>>` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `std::ptr::swap_nonoverlapping_simple_untyped::<MaybeUninit<u8>>` - --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL -note: inside `std::ptr::read::<MaybeUninit<MaybeUninit<u8>>>` +note: inside `std::ptr::swap_nonoverlapping_const::<MaybeUninit<u8>>` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `copy_nonoverlapping::<MaybeUninit<u8>>` + --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported = note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/consts/no-ice-from-static-in-const-issue-52060.rs b/tests/ui/consts/no-ice-from-static-in-const-issue-52060.rs index e0f9e462d32..e3cd8ec7d8a 100644 --- a/tests/ui/consts/no-ice-from-static-in-const-issue-52060.rs +++ b/tests/ui/consts/no-ice-from-static-in-const-issue-52060.rs @@ -4,6 +4,6 @@ static mut A: &'static [u32] = &[1]; static B: [u32; 1] = [0; unsafe { A.len() }]; //~^ ERROR: evaluation of constant value failed -//~| mutable global memory +//~| NOTE mutable global memory fn main() {} diff --git a/tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs b/tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs index 75765596fa1..e458a6f98ad 100644 --- a/tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs +++ b/tests/ui/consts/promoted_running_out_of_memory_issue-130687.rs @@ -12,6 +12,6 @@ pub struct Data([u8; (1 << 47) - 1]); const _: &'static Data = &Data([0; (1 << 47) - 1]); //~^ERROR: evaluation of constant value failed -//~| tried to allocate more memory than available to compiler +//~| NOTE tried to allocate more memory than available to compiler fn main() {} diff --git a/tests/ui/consts/promoted_size_overflow.rs b/tests/ui/consts/promoted_size_overflow.rs index 3d606905e78..ebd5ab06487 100644 --- a/tests/ui/consts/promoted_size_overflow.rs +++ b/tests/ui/consts/promoted_size_overflow.rs @@ -2,6 +2,6 @@ pub struct Data([u8; usize::MAX >> 2]); const _: &'static [Data] = &[]; //~^ERROR: evaluation of constant value failed -//~| too big for the target architecture +//~| NOTE too big for the target architecture fn main() {} diff --git a/tests/ui/consts/recursive-zst-static.rs b/tests/ui/consts/recursive-zst-static.rs index 53d32254a68..a52624fada8 100644 --- a/tests/ui/consts/recursive-zst-static.rs +++ b/tests/ui/consts/recursive-zst-static.rs @@ -10,7 +10,7 @@ static FOO: () = FOO; //~^ ERROR could not evaluate static initializer -static A: () = B; //~ cycle detected when evaluating initializer of static `A` +static A: () = B; //~ ERROR cycle detected when evaluating initializer of static `A` static B: () = A; fn main() { diff --git a/tests/ui/consts/slice-index-overflow-issue-130284.rs b/tests/ui/consts/slice-index-overflow-issue-130284.rs index 29900908256..6877ebe1476 100644 --- a/tests/ui/consts/slice-index-overflow-issue-130284.rs +++ b/tests/ui/consts/slice-index-overflow-issue-130284.rs @@ -6,7 +6,7 @@ const C: () = { // This used to ICE, but it should just report UB. let _ice = (*fat)[usize::MAX - 1]; //~^ERROR: constant value failed - //~| overflow + //~| NOTE overflow } }; diff --git a/tests/ui/consts/static-default-lifetime/elided-lifetime.rs b/tests/ui/consts/static-default-lifetime/elided-lifetime.rs index ccf63f86fcf..d60fe7d409a 100644 --- a/tests/ui/consts/static-default-lifetime/elided-lifetime.rs +++ b/tests/ui/consts/static-default-lifetime/elided-lifetime.rs @@ -16,7 +16,7 @@ impl Bar for Foo<'_> { const STATIC: &str = ""; //~^ ERROR `&` without an explicit lifetime name cannot be used here //~| WARN this was previously accepted by the compiler but is being phased out - //~| ERROR lifetime parameters or bounds on const `STATIC` do not match the trait declaration + //~| ERROR lifetime parameters or bounds on associated const `STATIC` do not match the trait declaration } fn main() {} diff --git a/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr b/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr index 33873f5c5a5..bb8365b0ae5 100644 --- a/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr +++ b/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr @@ -39,14 +39,14 @@ help: use the `'static` lifetime LL | const STATIC: &'static str = ""; | +++++++ -error[E0195]: lifetime parameters or bounds on const `STATIC` do not match the trait declaration +error[E0195]: lifetime parameters or bounds on associated const `STATIC` do not match the trait declaration --> $DIR/elided-lifetime.rs:16:17 | LL | const STATIC: &str; - | - lifetimes in impl do not match this const in trait + | - lifetimes in impl do not match this associated const in trait ... LL | const STATIC: &str = ""; - | ^ lifetimes do not match const in trait + | ^ lifetimes do not match associated const in trait error: aborting due to 3 previous errors diff --git a/tests/ui/consts/static-default-lifetime/static-trait-impl.rs b/tests/ui/consts/static-default-lifetime/static-trait-impl.rs index 1e12259e483..85746df146f 100644 --- a/tests/ui/consts/static-default-lifetime/static-trait-impl.rs +++ b/tests/ui/consts/static-default-lifetime/static-trait-impl.rs @@ -9,7 +9,7 @@ impl Bar<'_> for A { const STATIC: &str = ""; //~^ ERROR `&` without an explicit lifetime name cannot be used here //~| WARN this was previously accepted by the compiler but is being phased out - //~| ERROR lifetime parameters or bounds on const `STATIC` do not match the trait declaration + //~| ERROR lifetime parameters or bounds on associated const `STATIC` do not match the trait declaration } struct B; diff --git a/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr b/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr index 116f28e8484..38d24db1317 100644 --- a/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr +++ b/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr @@ -21,14 +21,14 @@ help: use the `'static` lifetime LL | const STATIC: &'static str = ""; | +++++++ -error[E0195]: lifetime parameters or bounds on const `STATIC` do not match the trait declaration +error[E0195]: lifetime parameters or bounds on associated const `STATIC` do not match the trait declaration --> $DIR/static-trait-impl.rs:9:17 | LL | const STATIC: &'a str; - | - lifetimes in impl do not match this const in trait + | - lifetimes in impl do not match this associated const in trait ... LL | const STATIC: &str = ""; - | ^ lifetimes do not match const in trait + | ^ lifetimes do not match associated const in trait error: aborting due to 2 previous errors diff --git a/tests/ui/coroutine/async-gen-deduce-yield.rs b/tests/ui/coroutine/async-gen-deduce-yield.rs index f85e4a52e9b..a9572ee9b0d 100644 --- a/tests/ui/coroutine/async-gen-deduce-yield.rs +++ b/tests/ui/coroutine/async-gen-deduce-yield.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2024 +//@ edition: 2024 //@ check-pass #![feature(async_iterator, gen_blocks)] diff --git a/tests/ui/coroutine/async-gen-yield-ty-is-unit.rs b/tests/ui/coroutine/async-gen-yield-ty-is-unit.rs index 583820c7aa3..53e3ce77f8a 100644 --- a/tests/ui/coroutine/async-gen-yield-ty-is-unit.rs +++ b/tests/ui/coroutine/async-gen-yield-ty-is-unit.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2024 +//@ edition: 2024 //@ check-pass #![feature(async_iterator, gen_blocks)] diff --git a/tests/ui/coroutine/auto-trait-regions.rs b/tests/ui/coroutine/auto-trait-regions.rs index 4c239f9ee76..1c7f0304ddb 100644 --- a/tests/ui/coroutine/auto-trait-regions.rs +++ b/tests/ui/coroutine/auto-trait-regions.rs @@ -43,8 +43,8 @@ fn main() { // Disallow impls which relates lifetimes in the coroutine interior let gen = #[coroutine] move || { let a = A(&mut true, &mut true, No); - //~^ temporary value dropped while borrowed - //~| temporary value dropped while borrowed + //~^ ERROR temporary value dropped while borrowed + //~| ERROR temporary value dropped while borrowed yield; assert_foo(a); }; diff --git a/tests/ui/coroutine/coroutine-with-nll.rs b/tests/ui/coroutine/coroutine-with-nll.rs index fa77ab4e049..44ead560cf8 100644 --- a/tests/ui/coroutine/coroutine-with-nll.rs +++ b/tests/ui/coroutine/coroutine-with-nll.rs @@ -6,7 +6,7 @@ fn main() { // The reference in `_a` is a Legal with NLL since it ends before the yield let _a = &mut true; let b = &mut true; - //~^ borrow may still be in use when coroutine yields + //~^ ERROR borrow may still be in use when coroutine yields yield (); println!("{}", b); }; diff --git a/tests/ui/coroutine/retain-resume-ref.rs b/tests/ui/coroutine/retain-resume-ref.rs index 6e688c33979..000e40d47fb 100644 --- a/tests/ui/coroutine/retain-resume-ref.rs +++ b/tests/ui/coroutine/retain-resume-ref.rs @@ -22,5 +22,5 @@ fn main() { let mut gen = Pin::new(&mut gen); gen.as_mut().resume(&mut thing); gen.as_mut().resume(&mut thing); - //~^ cannot borrow `thing` as mutable more than once at a time + //~^ ERROR cannot borrow `thing` as mutable more than once at a time } diff --git a/tests/ui/debuginfo/issue-105386-debuginfo-ub.rs b/tests/ui/debuginfo/issue-105386-debuginfo-ub.rs index 7b850f32b4b..e926a337659 100644 --- a/tests/ui/debuginfo/issue-105386-debuginfo-ub.rs +++ b/tests/ui/debuginfo/issue-105386-debuginfo-ub.rs @@ -1,5 +1,6 @@ //@ run-pass -//@ compile-flags: --edition 2021 -Copt-level=3 -Cdebuginfo=2 -Zmir-opt-level=3 +//@ compile-flags: -Copt-level=3 -Cdebuginfo=2 -Zmir-opt-level=3 +//@ edition: 2021 fn main() { TranslatorI.visit_pre(); diff --git a/tests/ui/deduplicate-diagnostics.duplicate.stderr b/tests/ui/deduplicate-diagnostics.duplicate.stderr index 0544b993278..48e2ba7b86a 100644 --- a/tests/ui/deduplicate-diagnostics.duplicate.stderr +++ b/tests/ui/deduplicate-diagnostics.duplicate.stderr @@ -26,6 +26,14 @@ LL | #[deny("literal")] | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 4 previous errors +error[E0452]: malformed lint attribute input + --> $DIR/deduplicate-diagnostics.rs:8:8 + | +LL | #[deny("literal")] + | ^^^^^^^^^ bad attribute argument + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0452`. diff --git a/tests/ui/deduplicate-diagnostics.rs b/tests/ui/deduplicate-diagnostics.rs index 54bd5dd5098..299c1f5f461 100644 --- a/tests/ui/deduplicate-diagnostics.rs +++ b/tests/ui/deduplicate-diagnostics.rs @@ -7,4 +7,5 @@ struct S; #[deny("literal")] //~ ERROR malformed lint attribute input //[duplicate]~| ERROR malformed lint attribute input + //[duplicate]~| ERROR malformed lint attribute input fn main() {} diff --git a/tests/ui/delegation/ice-issue-124347.rs b/tests/ui/delegation/ice-issue-124347.rs index b2b3c61a722..3e0a5b36ddc 100644 --- a/tests/ui/delegation/ice-issue-124347.rs +++ b/tests/ui/delegation/ice-issue-124347.rs @@ -4,7 +4,6 @@ // FIXME(fn_delegation): `recursive delegation` error should be emitted here trait Trait { reuse Trait::foo { &self.0 } - //~^ ERROR recursive delegation is not supported yet } reuse foo; diff --git a/tests/ui/delegation/ice-issue-124347.stderr b/tests/ui/delegation/ice-issue-124347.stderr index 74c4b5cd949..2955c044203 100644 --- a/tests/ui/delegation/ice-issue-124347.stderr +++ b/tests/ui/delegation/ice-issue-124347.stderr @@ -1,23 +1,17 @@ -error: recursive delegation is not supported yet - --> $DIR/ice-issue-124347.rs:6:18 - | -LL | reuse Trait::foo { &self.0 } - | ^^^ callee defined here - error[E0391]: cycle detected when computing generics of `foo` - --> $DIR/ice-issue-124347.rs:10:7 + --> $DIR/ice-issue-124347.rs:9:7 | LL | reuse foo; | ^^^ | = note: ...which immediately requires computing generics of `foo` again note: cycle used when checking that `foo` is well-formed - --> $DIR/ice-issue-124347.rs:10:7 + --> $DIR/ice-issue-124347.rs:9:7 | LL | reuse foo; | ^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/delegation/unsupported.stderr b/tests/ui/delegation/unsupported.stderr index 2b0bcf9d84e..cb14d9f459a 100644 --- a/tests/ui/delegation/unsupported.stderr +++ b/tests/ui/delegation/unsupported.stderr @@ -1,4 +1,4 @@ -error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>::{synthetic#0}` +error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>::{anon_assoc#0}` --> $DIR/unsupported.rs:22:25 | LL | reuse to_reuse::opaque_ret; @@ -9,7 +9,7 @@ note: ...which requires comparing an impl and trait method signature, inferring | LL | reuse to_reuse::opaque_ret; | ^^^^^^^^^^ - = note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>::{synthetic#0}`, completing the cycle + = note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>::{anon_assoc#0}`, completing the cycle note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>` is well-formed --> $DIR/unsupported.rs:21:5 | @@ -17,7 +17,7 @@ LL | impl ToReuse for u8 { | ^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::{synthetic#0}` +error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::{anon_assoc#0}` --> $DIR/unsupported.rs:25:24 | LL | reuse ToReuse::opaque_ret; @@ -28,7 +28,7 @@ note: ...which requires comparing an impl and trait method signature, inferring | LL | reuse ToReuse::opaque_ret; | ^^^^^^^^^^ - = note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::{synthetic#0}`, completing the cycle + = note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::{anon_assoc#0}`, completing the cycle note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>` is well-formed --> $DIR/unsupported.rs:24:5 | diff --git a/tests/ui/deprecation/try-macro-suggestion.rs b/tests/ui/deprecation/try-macro-suggestion.rs index 1e477ab9c88..0775f001100 100644 --- a/tests/ui/deprecation/try-macro-suggestion.rs +++ b/tests/ui/deprecation/try-macro-suggestion.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2018 +//@ edition: 2018 fn foo() -> Result<(), ()> { Ok(try!()); //~ ERROR use of deprecated `try` macro Ok(try!(Ok(()))) //~ ERROR use of deprecated `try` macro diff --git a/tests/ui/deref-patterns/gate.rs b/tests/ui/deref-patterns/gate.rs index ff50e30dea8..835fdf854d2 100644 --- a/tests/ui/deref-patterns/gate.rs +++ b/tests/ui/deref-patterns/gate.rs @@ -2,6 +2,6 @@ fn main() { match String::new() { "" | _ => {} - //~^ mismatched types + //~^ ERROR mismatched types } } diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.next.stderr index 90bb715a052..6170250992c 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.next.stderr @@ -1,12 +1,14 @@ -error[E0277]: the trait bound `&str: AsExpression<<SelectInt as Expression>::SqlType>` is not satisfied +error[E0277]: the trait bound `&str: AsExpression<Integer>` is not satisfied --> $DIR/as_expression.rs:56:21 | LL | SelectInt.check("bar"); - | ----- ^^^^^ the trait `AsExpression<<SelectInt as Expression>::SqlType>` is not implemented for `&str` + | ----- ^^^^^ the trait `AsExpression<Integer>` is not implemented for `&str` | | | required by a bound introduced by this call | - = help: the trait `AsExpression<Text>` is implemented for `&str` + = help: the trait `AsExpression<Integer>` is not implemented for `&str` + but trait `AsExpression<Text>` is implemented for it + = help: for that trait implementation, expected `Text`, found `Integer` note: required by a bound in `Foo::check` --> $DIR/as_expression.rs:47:12 | @@ -16,11 +18,11 @@ LL | where LL | T: AsExpression<Self::SqlType>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::check` -error[E0271]: type mismatch resolving `<SelectInt as Expression>::SqlType == Text` +error[E0271]: type mismatch resolving `Integer == Text` --> $DIR/as_expression.rs:56:5 | LL | SelectInt.check("bar"); - | ^^^^^^^^^^^^^^^^^^^^^^ expected `Text`, found `Integer` + | ^^^^^^^^^^^^^^^^^^^^^^ types differ error: aborting due to 2 previous errors diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs index 73a238ddf50..673adb82870 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs @@ -54,7 +54,6 @@ impl<T> Foo for T where T: Expression {} fn main() { SelectInt.check("bar"); - //[current]~^ ERROR the trait bound `&str: AsExpression<Integer>` is not satisfied - //[next]~^^ the trait bound `&str: AsExpression<<SelectInt as Expression>::SqlType>` is not satisfied - //[next]~| type mismatch + //~^ ERROR the trait bound `&str: AsExpression<Integer>` is not satisfied + //[next]~| ERROR type mismatch } diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/custom-on-unimplemented-diagnostic.rs b/tests/ui/diagnostic_namespace/on_unimplemented/custom-on-unimplemented-diagnostic.rs index 1173c939038..3bb0939b5f9 100644 --- a/tests/ui/diagnostic_namespace/on_unimplemented/custom-on-unimplemented-diagnostic.rs +++ b/tests/ui/diagnostic_namespace/on_unimplemented/custom-on-unimplemented-diagnostic.rs @@ -15,7 +15,7 @@ struct B; fn main() { B.request(); - //~^ my message [E0599] + //~^ ERROR my message [E0599] //~| my label //~| my note } diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs index c638681173d..b06f56bd66e 100644 --- a/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs +++ b/tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.rs @@ -8,8 +8,8 @@ note = "custom note" )] #[diagnostic::on_unimplemented(message = "fallback!!")] -//~^ `message` is ignored due to previous definition of `message` -//~| `message` is ignored due to previous definition of `message` +//~^ WARN `message` is ignored due to previous definition of `message` +//~| WARN `message` is ignored due to previous definition of `message` #[diagnostic::on_unimplemented(label = "fallback label")] #[diagnostic::on_unimplemented(note = "fallback note")] trait Foo {} diff --git a/tests/ui/did_you_mean/issue-38147-1.rs b/tests/ui/did_you_mean/issue-38147-1.rs index c068a1834f3..80f71b8b821 100644 --- a/tests/ui/did_you_mean/issue-38147-1.rs +++ b/tests/ui/did_you_mean/issue-38147-1.rs @@ -14,7 +14,7 @@ struct Foo<'a> { impl<'a> Foo<'a> { fn f(&self) { - self.s.push('x'); //~ cannot borrow `*self.s` as mutable, as it is behind a `&` reference + self.s.push('x'); //~ ERROR cannot borrow `*self.s` as mutable, as it is behind a `&` reference } } diff --git a/tests/ui/did_you_mean/issue-40006.rs b/tests/ui/did_you_mean/issue-40006.rs index fff31bfc85e..fcb86814c6e 100644 --- a/tests/ui/did_you_mean/issue-40006.rs +++ b/tests/ui/did_you_mean/issue-40006.rs @@ -35,5 +35,5 @@ impl S { } fn main() { - S.hello_method(); //~ no method named `hello_method` found + S.hello_method(); //~ ERROR no method named `hello_method` found } diff --git a/tests/ui/did_you_mean/issue-42764.rs b/tests/ui/did_you_mean/issue-42764.rs index eb96c248063..2766bb2c1b6 100644 --- a/tests/ui/did_you_mean/issue-42764.rs +++ b/tests/ui/did_you_mean/issue-42764.rs @@ -26,5 +26,5 @@ struct Context { wrapper: Wrapper } fn overton() { let _c = Context { wrapper: Payload{} }; //~^ ERROR mismatched types - //~| try wrapping the expression in `Wrapper` + //~| HELP try wrapping the expression in `Wrapper` } diff --git a/tests/ui/drop/drop-order-comparisons.e2021.stderr b/tests/ui/drop/drop-order-comparisons.e2021.stderr index 601b0a38412..0717a8c1b9b 100644 --- a/tests/ui/drop/drop-order-comparisons.e2021.stderr +++ b/tests/ui/drop/drop-order-comparisons.e2021.stderr @@ -31,39 +31,23 @@ LL | | }, e.mark(3), e.ok(4)); note: `#3` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `_v` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#2` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages note: the lint level is defined here --> $DIR/drop-order-comparisons.rs:28:25 @@ -95,21 +79,13 @@ LL | | }, e.mark(1), e.ok(4)); note: `#2` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages warning: relative drop order changing in Rust 2024 @@ -135,21 +111,13 @@ LL | | }, e.mark(1), e.ok(4)); note: `#2` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages warning: relative drop order changing in Rust 2024 @@ -175,21 +143,13 @@ LL | | }, e.mark(2), e.ok(3)); note: `#2` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages warning: relative drop order changing in Rust 2024 @@ -215,21 +175,13 @@ LL | | }, e.mark(2), e.ok(3)); note: `#2` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages warning: `if let` assigns a shorter lifetime since Edition 2024 @@ -245,12 +197,8 @@ LL | _ = (if let Ok(_) = e.ok(4).as_ref() { note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:127:5 | @@ -279,12 +227,8 @@ LL | _ = (if let Ok(_) = e.err(4).as_ref() {} else { note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:145:44 | @@ -312,12 +256,8 @@ LL | if let Ok(_) = e.err(4).as_ref() {} else { note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:247:43 | @@ -345,12 +285,8 @@ LL | if let true = e.err(9).is_ok() {} else { note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:352:41 | @@ -378,12 +314,8 @@ LL | if let Ok(_v) = e.err(8) {} else { note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:355:35 | @@ -411,12 +343,8 @@ LL | if let Ok(_) = e.err(7) {} else { note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:358:34 | @@ -444,12 +372,8 @@ LL | if let Ok(_) = e.err(6).as_ref() {} else { note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:361:43 | @@ -477,12 +401,8 @@ LL | if let Ok(_v) = e.err(5) {} else { note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:365:35 | @@ -510,12 +430,8 @@ LL | if let Ok(_) = e.err(4) {} else { note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:368:34 | @@ -543,12 +459,8 @@ LL | if let Ok(_) = e.err(4).as_ref() {} else { note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:571:1 | -LL | / impl<'b> Drop for LogDrop<'b> { -LL | | fn drop(&mut self) { -LL | | self.0.mark(self.1); -LL | | } -LL | | } - | |_^ +LL | impl<'b> Drop for LogDrop<'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/drop-order-comparisons.rs:404:43 | diff --git a/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr b/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr index 070ba1c6a4c..0d6974d516b 100644 --- a/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr +++ b/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr @@ -11,12 +11,8 @@ LL | if let Some(_value) = Droppy.get() { note: value invokes this custom destructor --> $DIR/lint-if-let-rescope-gated.rs:14:1 | -LL | / impl Drop for Droppy { -LL | | fn drop(&mut self) { -LL | | println!("dropped"); -LL | | } -LL | | } - | |_^ +LL | impl Drop for Droppy { + | ^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope-gated.rs:30:5 | diff --git a/tests/ui/drop/lint-if-let-rescope-with-macro.stderr b/tests/ui/drop/lint-if-let-rescope-with-macro.stderr index f1ca0ba57de..a0afb8eddb5 100644 --- a/tests/ui/drop/lint-if-let-rescope-with-macro.stderr +++ b/tests/ui/drop/lint-if-let-rescope-with-macro.stderr @@ -18,12 +18,8 @@ LL | | }; note: value invokes this custom destructor --> $DIR/lint-if-let-rescope-with-macro.rs:22:1 | -LL | / impl Drop for Droppy { -LL | | fn drop(&mut self) { -LL | | println!("dropped"); -LL | | } -LL | | } - | |_^ +LL | impl Drop for Droppy { + | ^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope-with-macro.rs:12:38 | diff --git a/tests/ui/drop/lint-if-let-rescope.stderr b/tests/ui/drop/lint-if-let-rescope.stderr index e95ec8fcea7..ca2416efcb1 100644 --- a/tests/ui/drop/lint-if-let-rescope.stderr +++ b/tests/ui/drop/lint-if-let-rescope.stderr @@ -11,12 +11,8 @@ LL | if let Some(_value) = droppy().get() { note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | -LL | / impl Drop for Droppy { -LL | | fn drop(&mut self) { -LL | | println!("dropped"); -LL | | } -LL | | } - | |_^ +LL | impl Drop for Droppy { + | ^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:32:5 | @@ -55,21 +51,13 @@ LL | } else if let Some(_value) = droppy().get() { note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | -LL | / impl Drop for Droppy { -LL | | fn drop(&mut self) { -LL | | println!("dropped"); -LL | | } -LL | | } - | |_^ +LL | impl Drop for Droppy { + | ^^^^^^^^^^^^^^^^^^^^ note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | -LL | / impl Drop for Droppy { -LL | | fn drop(&mut self) { -LL | | println!("dropped"); -LL | | } -LL | | } - | |_^ +LL | impl Drop for Droppy { + | ^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:42:5 | @@ -105,12 +93,8 @@ LL | } else if let Some(_value) = droppy().get() { note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | -LL | / impl Drop for Droppy { -LL | | fn drop(&mut self) { -LL | | println!("dropped"); -LL | | } -LL | | } - | |_^ +LL | impl Drop for Droppy { + | ^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:54:5 | @@ -140,12 +124,8 @@ LL | if let Some(1) = { if let Some(_value) = Droppy.get() { Some(1) } else note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | -LL | / impl Drop for Droppy { -LL | | fn drop(&mut self) { -LL | | println!("dropped"); -LL | | } -LL | | } - | |_^ +LL | impl Drop for Droppy { + | ^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:58:69 | @@ -170,12 +150,8 @@ LL | if (if let Some(_value) = droppy().get() { true } else { false }) { note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | -LL | / impl Drop for Droppy { -LL | | fn drop(&mut self) { -LL | | println!("dropped"); -LL | | } -LL | | } - | |_^ +LL | impl Drop for Droppy { + | ^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:72:53 | @@ -200,12 +176,8 @@ LL | } else if (((if let Some(_value) = droppy().get() { true } else { false note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | -LL | / impl Drop for Droppy { -LL | | fn drop(&mut self) { -LL | | println!("dropped"); -LL | | } -LL | | } - | |_^ +LL | impl Drop for Droppy { + | ^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:78:62 | @@ -230,12 +202,8 @@ LL | while (if let Some(_value) = droppy().get() { false } else { true }) { note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | -LL | / impl Drop for Droppy { -LL | | fn drop(&mut self) { -LL | | println!("dropped"); -LL | | } -LL | | } - | |_^ +LL | impl Drop for Droppy { + | ^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:90:57 | diff --git a/tests/ui/drop/lint-tail-expr-drop-order-borrowck.rs b/tests/ui/drop/lint-tail-expr-drop-order-borrowck.rs index 6f64d83f8a0..e8368b0a369 100644 --- a/tests/ui/drop/lint-tail-expr-drop-order-borrowck.rs +++ b/tests/ui/drop/lint-tail-expr-drop-order-borrowck.rs @@ -10,7 +10,7 @@ fn should_lint_with_potential_borrowck_err() { //~^ ERROR: relative drop order changing //~| WARN: this changes meaning in Rust 2024 //~| NOTE: this temporary value will be dropped at the end of the block - //~| borrow later used by call + //~| NOTE: borrow later used by call //~| NOTE: for more information, see } @@ -20,7 +20,7 @@ fn should_lint_with_unsafe_block() { //~^ ERROR: relative drop order changing //~| WARN: this changes meaning in Rust 2024 //~| NOTE: this temporary value will be dropped at the end of the block - //~| borrow later used by call + //~| NOTE: borrow later used by call //~| NOTE: for more information, see } @@ -32,7 +32,7 @@ fn should_lint_with_big_block() { //~^ ERROR: relative drop order changing //~| WARN: this changes meaning in Rust 2024 //~| NOTE: this temporary value will be dropped at the end of the block - //~| borrow later used here + //~| NOTE: borrow later used here //~| NOTE: for more information, see }) } @@ -44,7 +44,7 @@ fn another_temp_that_is_copy_in_arg() { //~^ ERROR: relative drop order changing //~| WARN: this changes meaning in Rust 2024 //~| NOTE: this temporary value will be dropped at the end of the block - //~| borrow later used by call + //~| NOTE: borrow later used by call //~| NOTE: for more information, see } diff --git a/tests/ui/drop/lint-tail-expr-drop-order.stderr b/tests/ui/drop/lint-tail-expr-drop-order.stderr index 6ff9b7c1268..e124e9874d0 100644 --- a/tests/ui/drop/lint-tail-expr-drop-order.stderr +++ b/tests/ui/drop/lint-tail-expr-drop-order.stderr @@ -21,17 +21,13 @@ LL | } note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | -LL | / impl Drop for LoudDropper { -... | -LL | | } - | |_^ +LL | impl Drop for LoudDropper { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: `x` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | -LL | / impl Drop for LoudDropper { -... | -LL | | } - | |_^ +LL | impl Drop for LoudDropper { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages note: the lint level is defined here --> $DIR/lint-tail-expr-drop-order.rs:6:9 @@ -62,17 +58,13 @@ LL | } note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | -LL | / impl Drop for LoudDropper { -... | -LL | | } - | |_^ +LL | impl Drop for LoudDropper { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: `x` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | -LL | / impl Drop for LoudDropper { -... | -LL | | } - | |_^ +LL | impl Drop for LoudDropper { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages error: relative drop order changing in Rust 2024 @@ -98,17 +90,13 @@ LL | } note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | -LL | / impl Drop for LoudDropper { -... | -LL | | } - | |_^ +LL | impl Drop for LoudDropper { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: `x` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | -LL | / impl Drop for LoudDropper { -... | -LL | | } - | |_^ +LL | impl Drop for LoudDropper { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages error: relative drop order changing in Rust 2024 @@ -134,10 +122,8 @@ LL | } note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | -LL | / impl Drop for LoudDropper { -... | -LL | | } - | |_^ +LL | impl Drop for LoudDropper { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages error: relative drop order changing in Rust 2024 @@ -185,17 +171,13 @@ LL | } note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | -LL | / impl Drop for LoudDropper { -... | -LL | | } - | |_^ +LL | impl Drop for LoudDropper { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: `x` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | -LL | / impl Drop for LoudDropper { -... | -LL | | } - | |_^ +LL | impl Drop for LoudDropper { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages error: relative drop order changing in Rust 2024 @@ -221,23 +203,13 @@ LL | } note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:193:5 | -LL | / impl Drop for LoudDropper3 { -LL | | -LL | | fn drop(&mut self) { -LL | | println!("loud drop"); -LL | | } -LL | | } - | |_____^ +LL | impl Drop for LoudDropper3 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `x` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:205:5 | -LL | / impl Drop for LoudDropper2 { -LL | | -LL | | fn drop(&mut self) { -LL | | println!("loud drop"); -LL | | } -LL | | } - | |_____^ +LL | impl Drop for LoudDropper2 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages error: relative drop order changing in Rust 2024 @@ -263,17 +235,13 @@ LL | )); note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | -LL | / impl Drop for LoudDropper { -... | -LL | | } - | |_^ +LL | impl Drop for LoudDropper { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: `_x` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | -LL | / impl Drop for LoudDropper { -... | -LL | | } - | |_^ +LL | impl Drop for LoudDropper { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages error: aborting due to 8 previous errors diff --git a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr index b0f971dd5ce..7bf452e2496 100644 --- a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr +++ b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr @@ -27,24 +27,18 @@ LL | } note: `#2` invokes this custom destructor --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1 | -LL | / impl std::ops::Drop for Drop { -LL | | fn drop(&mut self) {} -LL | | } - | |_^ +LL | impl std::ops::Drop for Drop { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1 | -LL | / impl std::ops::Drop for Drop { -LL | | fn drop(&mut self) {} -LL | | } - | |_^ +LL | impl std::ops::Drop for Drop { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `e` invokes this custom destructor --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1 | -LL | / impl std::ops::Drop for Drop { -LL | | fn drop(&mut self) {} -LL | | } - | |_^ +LL | impl std::ops::Drop for Drop { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages note: the lint level is defined here --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:6:9 diff --git a/tests/ui/duplicate/dupe-symbols-1.rs b/tests/ui/duplicate/dupe-symbols-1.rs index f49bf44a061..4e03d7c4ce5 100644 --- a/tests/ui/duplicate/dupe-symbols-1.rs +++ b/tests/ui/duplicate/dupe-symbols-1.rs @@ -10,5 +10,5 @@ pub fn a() { #[export_name="fail"] pub fn b() { -//~^ symbol `fail` is already defined +//~^ ERROR symbol `fail` is already defined } diff --git a/tests/ui/duplicate/dupe-symbols-2.rs b/tests/ui/duplicate/dupe-symbols-2.rs index 343c7131d1f..03fff570dff 100644 --- a/tests/ui/duplicate/dupe-symbols-2.rs +++ b/tests/ui/duplicate/dupe-symbols-2.rs @@ -13,6 +13,6 @@ pub mod a { pub mod b { #[no_mangle] pub extern "C" fn fail() { - //~^ symbol `fail` is already defined + //~^ ERROR symbol `fail` is already defined } } diff --git a/tests/ui/duplicate/dupe-symbols-3.rs b/tests/ui/duplicate/dupe-symbols-3.rs index 365ec182f53..41bbe517357 100644 --- a/tests/ui/duplicate/dupe-symbols-3.rs +++ b/tests/ui/duplicate/dupe-symbols-3.rs @@ -10,5 +10,5 @@ pub fn a() { #[no_mangle] pub fn fail() { -//~^ symbol `fail` is already defined +//~^ ERROR symbol `fail` is already defined } diff --git a/tests/ui/duplicate/dupe-symbols-5.rs b/tests/ui/duplicate/dupe-symbols-5.rs index 2ed803c1dda..4aaf2bd29c5 100644 --- a/tests/ui/duplicate/dupe-symbols-5.rs +++ b/tests/ui/duplicate/dupe-symbols-5.rs @@ -9,5 +9,5 @@ static HELLO: u8 = 0; #[export_name="fail"] pub fn b() { -//~^ symbol `fail` is already defined +//~^ ERROR symbol `fail` is already defined } diff --git a/tests/ui/duplicate/dupe-symbols-6.rs b/tests/ui/duplicate/dupe-symbols-6.rs index 9841be7365a..b3f430f51bb 100644 --- a/tests/ui/duplicate/dupe-symbols-6.rs +++ b/tests/ui/duplicate/dupe-symbols-6.rs @@ -8,4 +8,4 @@ static HELLO: u8 = 0; #[export_name="fail"] static HELLO_TWICE: u16 = 0; -//~^ symbol `fail` is already defined +//~^ ERROR symbol `fail` is already defined diff --git a/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr b/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr index 832e7ef4dc3..2cf244185e6 100644 --- a/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr +++ b/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr @@ -188,166 +188,6 @@ LL | fn parrot() -> &'static mut Trait { | +++++++ error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:52:16 - | -LL | fn foo(_: &Trait); - | ^^^^^ - | -help: use a new generic type parameter, constrained by `Trait` - | -LL - fn foo(_: &Trait); -LL + fn foo<T: Trait>(_: &T); - | -help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference - | -LL | fn foo(_: &impl Trait); - | ++++ -help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch - | -LL | fn foo(_: &dyn Trait); - | +++ - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:55:19 - | -LL | fn bar(_: &'a Trait); - | ^^^^^ - | -help: use a new generic type parameter, constrained by `Trait` - | -LL - fn bar(_: &'a Trait); -LL + fn bar<T: Trait>(_: &'a T); - | -help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference - | -LL | fn bar(_: &'a impl Trait); - | ++++ -help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch - | -LL | fn bar(_: &'a dyn Trait); - | +++ - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:59:22 - | -LL | fn alice<'a>(_: &Trait); - | ^^^^^ - | -help: use a new generic type parameter, constrained by `Trait` - | -LL - fn alice<'a>(_: &Trait); -LL + fn alice<'a, T: Trait>(_: &T); - | -help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference - | -LL | fn alice<'a>(_: &impl Trait); - | ++++ -help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch - | -LL | fn alice<'a>(_: &dyn Trait); - | +++ - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:62:23 - | -LL | fn bob<'a>(_: &'a Trait); - | ^^^^^ - | -help: use a new generic type parameter, constrained by `Trait` - | -LL - fn bob<'a>(_: &'a Trait); -LL + fn bob<'a, T: Trait>(_: &'a T); - | -help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference - | -LL | fn bob<'a>(_: &'a impl Trait); - | ++++ -help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch - | -LL | fn bob<'a>(_: &'a dyn Trait); - | +++ - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:65:18 - | -LL | fn cat() -> &Trait; - | ^^^^^ - | -help: use `impl Trait` to return an opaque type, as long as you return a single underlying type - | -LL | fn cat() -> &impl Trait; - | ++++ -help: alternatively, you can return an owned trait object - | -LL - fn cat() -> &Trait; -LL + fn cat() -> Box<dyn Trait>; - | - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:69:22 - | -LL | fn dog<'a>() -> &Trait { - | ^^^^^ - | -help: use `impl Trait` to return an opaque type, as long as you return a single underlying type - | -LL | fn dog<'a>() -> &impl Trait { - | ++++ -help: alternatively, you can return an owned trait object - | -LL - fn dog<'a>() -> &Trait { -LL + fn dog<'a>() -> Box<dyn Trait> { - | - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:75:24 - | -LL | fn kitten() -> &'a Trait { - | ^^^^^ - | -help: use `impl Trait` to return an opaque type, as long as you return a single underlying type - | -LL | fn kitten() -> &'a impl Trait { - | ++++ -help: alternatively, you can return an owned trait object - | -LL - fn kitten() -> &'a Trait { -LL + fn kitten() -> Box<dyn Trait> { - | - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:81:27 - | -LL | fn puppy<'a>() -> &'a Trait { - | ^^^^^ - | -help: use `impl Trait` to return an opaque type, as long as you return a single underlying type - | -LL | fn puppy<'a>() -> &'a impl Trait { - | ++++ -help: alternatively, you can return an owned trait object - | -LL - fn puppy<'a>() -> &'a Trait { -LL + fn puppy<'a>() -> Box<dyn Trait> { - | - -error[E0782]: expected a type, found a trait - --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:86:25 - | -LL | fn parrot() -> &mut Trait { - | ^^^^^ - | -help: use `impl Trait` to return an opaque type, as long as you return a single underlying type - | -LL | fn parrot() -> &mut impl Trait { - | ++++ -help: alternatively, you can return an owned trait object - | -LL - fn parrot() -> &mut Trait { -LL + fn parrot() -> Box<dyn Trait> { - | - -error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:93:12 | LL | fn foo(_: &Trait) {} @@ -667,6 +507,166 @@ LL - fn parrot() -> &mut Trait { LL + fn parrot() -> Box<dyn Trait> { | +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:52:16 + | +LL | fn foo(_: &Trait); + | ^^^^^ + | +help: use a new generic type parameter, constrained by `Trait` + | +LL - fn foo(_: &Trait); +LL + fn foo<T: Trait>(_: &T); + | +help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference + | +LL | fn foo(_: &impl Trait); + | ++++ +help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch + | +LL | fn foo(_: &dyn Trait); + | +++ + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:55:19 + | +LL | fn bar(_: &'a Trait); + | ^^^^^ + | +help: use a new generic type parameter, constrained by `Trait` + | +LL - fn bar(_: &'a Trait); +LL + fn bar<T: Trait>(_: &'a T); + | +help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference + | +LL | fn bar(_: &'a impl Trait); + | ++++ +help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch + | +LL | fn bar(_: &'a dyn Trait); + | +++ + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:59:22 + | +LL | fn alice<'a>(_: &Trait); + | ^^^^^ + | +help: use a new generic type parameter, constrained by `Trait` + | +LL - fn alice<'a>(_: &Trait); +LL + fn alice<'a, T: Trait>(_: &T); + | +help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference + | +LL | fn alice<'a>(_: &impl Trait); + | ++++ +help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch + | +LL | fn alice<'a>(_: &dyn Trait); + | +++ + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:62:23 + | +LL | fn bob<'a>(_: &'a Trait); + | ^^^^^ + | +help: use a new generic type parameter, constrained by `Trait` + | +LL - fn bob<'a>(_: &'a Trait); +LL + fn bob<'a, T: Trait>(_: &'a T); + | +help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference + | +LL | fn bob<'a>(_: &'a impl Trait); + | ++++ +help: alternatively, use a trait object to accept any type that implements `Trait`, accessing its methods at runtime using dynamic dispatch + | +LL | fn bob<'a>(_: &'a dyn Trait); + | +++ + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:65:18 + | +LL | fn cat() -> &Trait; + | ^^^^^ + | +help: use `impl Trait` to return an opaque type, as long as you return a single underlying type + | +LL | fn cat() -> &impl Trait; + | ++++ +help: alternatively, you can return an owned trait object + | +LL - fn cat() -> &Trait; +LL + fn cat() -> Box<dyn Trait>; + | + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:69:22 + | +LL | fn dog<'a>() -> &Trait { + | ^^^^^ + | +help: use `impl Trait` to return an opaque type, as long as you return a single underlying type + | +LL | fn dog<'a>() -> &impl Trait { + | ++++ +help: alternatively, you can return an owned trait object + | +LL - fn dog<'a>() -> &Trait { +LL + fn dog<'a>() -> Box<dyn Trait> { + | + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:75:24 + | +LL | fn kitten() -> &'a Trait { + | ^^^^^ + | +help: use `impl Trait` to return an opaque type, as long as you return a single underlying type + | +LL | fn kitten() -> &'a impl Trait { + | ++++ +help: alternatively, you can return an owned trait object + | +LL - fn kitten() -> &'a Trait { +LL + fn kitten() -> Box<dyn Trait> { + | + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:81:27 + | +LL | fn puppy<'a>() -> &'a Trait { + | ^^^^^ + | +help: use `impl Trait` to return an opaque type, as long as you return a single underlying type + | +LL | fn puppy<'a>() -> &'a impl Trait { + | ++++ +help: alternatively, you can return an owned trait object + | +LL - fn puppy<'a>() -> &'a Trait { +LL + fn puppy<'a>() -> Box<dyn Trait> { + | + +error[E0782]: expected a type, found a trait + --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:86:25 + | +LL | fn parrot() -> &mut Trait { + | ^^^^^ + | +help: use `impl Trait` to return an opaque type, as long as you return a single underlying type + | +LL | fn parrot() -> &mut impl Trait { + | ++++ +help: alternatively, you can return an owned trait object + | +LL - fn parrot() -> &mut Trait { +LL + fn parrot() -> Box<dyn Trait> { + | + error: aborting due to 42 previous errors Some errors have detailed explanations: E0106, E0261, E0782. diff --git a/tests/ui/dyn-compatibility/taint-const-eval.rs b/tests/ui/dyn-compatibility/taint-const-eval.rs index 7ea763e1846..64c4df611e6 100644 --- a/tests/ui/dyn-compatibility/taint-const-eval.rs +++ b/tests/ui/dyn-compatibility/taint-const-eval.rs @@ -5,8 +5,8 @@ trait Qux { } static FOO: &(dyn Qux + Sync) = "desc"; -//~^ the trait `Qux` is not dyn compatible -//~| the trait `Qux` is not dyn compatible -//~| the trait `Qux` is not dyn compatible +//~^ ERROR the trait `Qux` is not dyn compatible +//~| ERROR the trait `Qux` is not dyn compatible +//~| ERROR the trait `Qux` is not dyn compatible fn main() {} diff --git a/tests/ui/dyn-compatibility/trait-alias-self-projection.rs b/tests/ui/dyn-compatibility/trait-alias-self-projection.rs new file mode 100644 index 00000000000..0badb738809 --- /dev/null +++ b/tests/ui/dyn-compatibility/trait-alias-self-projection.rs @@ -0,0 +1,12 @@ +#![feature(trait_alias)] +trait B = Fn() -> Self; +type D = &'static dyn B; +//~^ ERROR E0411 + +fn a() -> D { + unreachable!(); +} + +fn main() { + _ = a(); +} diff --git a/tests/ui/dyn-compatibility/trait-alias-self-projection.stderr b/tests/ui/dyn-compatibility/trait-alias-self-projection.stderr new file mode 100644 index 00000000000..dccee02e9cd --- /dev/null +++ b/tests/ui/dyn-compatibility/trait-alias-self-projection.stderr @@ -0,0 +1,9 @@ +error[E0411]: `Self` is not allowed in type aliases + --> $DIR/trait-alias-self-projection.rs:3:19 + | +LL | type D = &'static dyn B; + | ^^^^^ `Self` is only available in impls, traits, and concrete type definitions + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0411`. diff --git a/tests/ui/dyn-star/async-block-dyn-star.rs b/tests/ui/dyn-star/async-block-dyn-star.rs index 9bffd6c6725..db133d94c91 100644 --- a/tests/ui/dyn-star/async-block-dyn-star.rs +++ b/tests/ui/dyn-star/async-block-dyn-star.rs @@ -4,6 +4,6 @@ //~^ WARN the feature `dyn_star` is incomplete static S: dyn* Send + Sync = async { 42 }; -//~^ needs to have the same ABI as a pointer +//~^ ERROR needs to have the same ABI as a pointer pub fn main() {} diff --git a/tests/ui/dyn-star/feature-gate-dyn_star.rs b/tests/ui/dyn-star/feature-gate-dyn_star.rs index 41eed71cdc3..b12fd7755be 100644 --- a/tests/ui/dyn-star/feature-gate-dyn_star.rs +++ b/tests/ui/dyn-star/feature-gate-dyn_star.rs @@ -3,7 +3,7 @@ /// dyn* is not necessarily the final surface syntax (if we have one at all), /// but for now we will support it to aid in writing tests independently. pub fn dyn_star_parameter(_: &dyn* Send) { - //~^ `dyn*` trait objects are experimental + //~^ ERROR `dyn*` trait objects are experimental } fn main() {} diff --git a/tests/ui/editions/never-type-fallback-breaking.e2021.fixed b/tests/ui/editions/never-type-fallback-breaking.e2021.fixed index 11ec273fc4b..8c11ab0791d 100644 --- a/tests/ui/editions/never-type-fallback-breaking.e2021.fixed +++ b/tests/ui/editions/never-type-fallback-breaking.e2021.fixed @@ -16,8 +16,8 @@ fn main() { } fn m() { - //[e2021]~^ this function depends on never type fallback being `()` - //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + //[e2021]~^ WARN this function depends on never type fallback being `()` + //[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! let x: () = match true { true => Default::default(), //[e2024]~^ error: the trait bound `!: Default` is not satisfied @@ -28,8 +28,8 @@ fn m() { } fn q() -> Option<()> { - //[e2021]~^ this function depends on never type fallback being `()` - //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + //[e2021]~^ WARN this function depends on never type fallback being `()` + //[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! fn deserialize<T: Default>() -> Option<T> { Some(T::default()) } @@ -45,8 +45,8 @@ fn help<'a: 'a, T: Into<()>, U>(_: U) -> Result<T, ()> { Err(()) } fn meow() -> Result<(), ()> { - //[e2021]~^ this function depends on never type fallback being `()` - //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + //[e2021]~^ WARN this function depends on never type fallback being `()` + //[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! help::<(), _>(1)?; //[e2024]~^ error: the trait bound `(): From<!>` is not satisfied Ok(()) @@ -57,8 +57,8 @@ pub fn takes_apit<T>(_y: impl Fn() -> T) -> Result<T, ()> { } pub fn fallback_return() -> Result<(), ()> { - //[e2021]~^ this function depends on never type fallback being `()` - //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + //[e2021]~^ WARN this function depends on never type fallback being `()` + //[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! takes_apit::<()>(|| Default::default())?; //[e2024]~^ error: the trait bound `!: Default` is not satisfied Ok(()) @@ -71,8 +71,8 @@ fn mk<T>() -> Result<T, ()> { fn takes_apit2(_x: impl Default) {} fn fully_apit() -> Result<(), ()> { - //[e2021]~^ this function depends on never type fallback being `()` - //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + //[e2021]~^ WARN this function depends on never type fallback being `()` + //[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! takes_apit2(mk::<()>()?); //[e2024]~^ error: the trait bound `!: Default` is not satisfied Ok(()) diff --git a/tests/ui/editions/never-type-fallback-breaking.rs b/tests/ui/editions/never-type-fallback-breaking.rs index daafc526eff..80974f83013 100644 --- a/tests/ui/editions/never-type-fallback-breaking.rs +++ b/tests/ui/editions/never-type-fallback-breaking.rs @@ -16,8 +16,8 @@ fn main() { } fn m() { - //[e2021]~^ this function depends on never type fallback being `()` - //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + //[e2021]~^ WARN this function depends on never type fallback being `()` + //[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! let x = match true { true => Default::default(), //[e2024]~^ error: the trait bound `!: Default` is not satisfied @@ -28,8 +28,8 @@ fn m() { } fn q() -> Option<()> { - //[e2021]~^ this function depends on never type fallback being `()` - //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + //[e2021]~^ WARN this function depends on never type fallback being `()` + //[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! fn deserialize<T: Default>() -> Option<T> { Some(T::default()) } @@ -45,8 +45,8 @@ fn help<'a: 'a, T: Into<()>, U>(_: U) -> Result<T, ()> { Err(()) } fn meow() -> Result<(), ()> { - //[e2021]~^ this function depends on never type fallback being `()` - //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + //[e2021]~^ WARN this function depends on never type fallback being `()` + //[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! help(1)?; //[e2024]~^ error: the trait bound `(): From<!>` is not satisfied Ok(()) @@ -57,8 +57,8 @@ pub fn takes_apit<T>(_y: impl Fn() -> T) -> Result<T, ()> { } pub fn fallback_return() -> Result<(), ()> { - //[e2021]~^ this function depends on never type fallback being `()` - //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + //[e2021]~^ WARN this function depends on never type fallback being `()` + //[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! takes_apit(|| Default::default())?; //[e2024]~^ error: the trait bound `!: Default` is not satisfied Ok(()) @@ -71,8 +71,8 @@ fn mk<T>() -> Result<T, ()> { fn takes_apit2(_x: impl Default) {} fn fully_apit() -> Result<(), ()> { - //[e2021]~^ this function depends on never type fallback being `()` - //[e2021]~| this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! + //[e2021]~^ WARN this function depends on never type fallback being `()` + //[e2021]~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! takes_apit2(mk()?); //[e2024]~^ error: the trait bound `!: Default` is not satisfied Ok(()) diff --git a/tests/ui/enum-discriminant/discriminant-ill-typed.rs b/tests/ui/enum-discriminant/discriminant-ill-typed.rs index 3cf0ea0e6b9..e3cbd01a1dd 100644 --- a/tests/ui/enum-discriminant/discriminant-ill-typed.rs +++ b/tests/ui/enum-discriminant/discriminant-ill-typed.rs @@ -14,7 +14,7 @@ fn f_i8() { Ok2, OhNo = 0_u8, //~^ ERROR mismatched types - //~| expected `i8`, found `u8` + //~| NOTE expected `i8`, found `u8` } let x = A::Ok; @@ -27,7 +27,7 @@ fn f_u8() { Ok2, OhNo = 0_i8, //~^ ERROR mismatched types - //~| expected `u8`, found `i8` + //~| NOTE expected `u8`, found `i8` } let x = A::Ok; @@ -40,7 +40,7 @@ fn f_i16() { Ok2, OhNo = 0_u16, //~^ ERROR mismatched types - //~| expected `i16`, found `u16` + //~| NOTE expected `i16`, found `u16` } let x = A::Ok; @@ -53,7 +53,7 @@ fn f_u16() { Ok2, OhNo = 0_i16, //~^ ERROR mismatched types - //~| expected `u16`, found `i16` + //~| NOTE expected `u16`, found `i16` } let x = A::Ok; @@ -66,7 +66,7 @@ fn f_i32() { Ok2, OhNo = 0_u32, //~^ ERROR mismatched types - //~| expected `i32`, found `u32` + //~| NOTE expected `i32`, found `u32` } let x = A::Ok; @@ -79,7 +79,7 @@ fn f_u32() { Ok2, OhNo = 0_i32, //~^ ERROR mismatched types - //~| expected `u32`, found `i32` + //~| NOTE expected `u32`, found `i32` } let x = A::Ok; @@ -92,7 +92,7 @@ fn f_i64() { Ok2, OhNo = 0_u64, //~^ ERROR mismatched types - //~| expected `i64`, found `u64` + //~| NOTE expected `i64`, found `u64` } let x = A::Ok; @@ -105,7 +105,7 @@ fn f_u64() { Ok2, OhNo = 0_i64, //~^ ERROR mismatched types - //~| expected `u64`, found `i64` + //~| NOTE expected `u64`, found `i64` } let x = A::Ok; diff --git a/tests/ui/ergonomic-clones/closure/multiple-use-variants.rs b/tests/ui/ergonomic-clones/closure/multiple-use-variants.rs new file mode 100644 index 00000000000..e2e9820a740 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/multiple-use-variants.rs @@ -0,0 +1,35 @@ +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +use std::clone::UseCloned; + +fn takes_val<T>(_: T) {} +fn takes_ref<'a, T>(_: &'a T) {} + +#[derive(Clone)] +struct Inner<'a, T>(&'a T); + +impl<'a, T> UseCloned for Inner<'a, T> where T: Clone {} + +fn main() { + let v = String::new(); + let inner = Inner(&v); + + let _ = use || { + takes_ref(inner.0); + takes_val(inner.0) + }; + let _ = use || { + takes_ref(inner.0); + takes_val(inner.0); + takes_val(inner.0); + takes_val(inner) + }; + let _ = use || { + takes_ref(inner.0); + takes_val(inner.0); + takes_val(inner); + takes_val(inner) + //~^ ERROR: use of moved value: `inner` [E0382] + }; +} diff --git a/tests/ui/ergonomic-clones/closure/multiple-use-variants.stderr b/tests/ui/ergonomic-clones/closure/multiple-use-variants.stderr new file mode 100644 index 00000000000..7b25ca9bba8 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/multiple-use-variants.stderr @@ -0,0 +1,13 @@ +error[E0382]: use of moved value: `inner` + --> $DIR/multiple-use-variants.rs:32:19 + | +LL | takes_val(inner); + | ----- value moved here +LL | takes_val(inner) + | ^^^^^ value used here after move + | + = note: move occurs because `inner` has type `Inner<'_, String>`, which does not implement the `Copy` trait + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/ergonomic-clones/closure/rfc2229-migration.fixed b/tests/ui/ergonomic-clones/closure/rfc2229-migration.fixed new file mode 100644 index 00000000000..fa83b53526a --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/rfc2229-migration.fixed @@ -0,0 +1,26 @@ +//@ run-rustfix +//@ edition:2018 +//@ check-pass +#![feature(ergonomic_clones)] +#![warn(rust_2021_compatibility)] +#![allow(incomplete_features)] + +#[derive(Debug)] +struct Foo(i32); +impl Drop for Foo { + fn drop(&mut self) { + println!("{:?} dropped", self.0); + } +} + +fn main() { + let a = (Foo(0), Foo(1)); + let f = use || { + let _ = &a; + //~^ HELP: add a dummy + //~| WARNING: drop order + let x = a.0; + println!("{:?}", x); + }; + f(); +} diff --git a/tests/ui/ergonomic-clones/closure/rfc2229-migration.rs b/tests/ui/ergonomic-clones/closure/rfc2229-migration.rs new file mode 100644 index 00000000000..4070e5c35a4 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/rfc2229-migration.rs @@ -0,0 +1,25 @@ +//@ run-rustfix +//@ edition:2018 +//@ check-pass +#![feature(ergonomic_clones)] +#![warn(rust_2021_compatibility)] +#![allow(incomplete_features)] + +#[derive(Debug)] +struct Foo(i32); +impl Drop for Foo { + fn drop(&mut self) { + println!("{:?} dropped", self.0); + } +} + +fn main() { + let a = (Foo(0), Foo(1)); + let f = use || { + //~^ HELP: add a dummy + //~| WARNING: drop order + let x = a.0; + println!("{:?}", x); + }; + f(); +} diff --git a/tests/ui/ergonomic-clones/closure/rfc2229-migration.stderr b/tests/ui/ergonomic-clones/closure/rfc2229-migration.stderr new file mode 100644 index 00000000000..b980be6cb86 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/rfc2229-migration.stderr @@ -0,0 +1,27 @@ +warning: changes to closure capture in Rust 2021 will affect drop order + --> $DIR/rfc2229-migration.rs:18:13 + | +LL | let f = use || { + | ^^^^^^ +... +LL | let x = a.0; + | --- in Rust 2018, this closure captures all of `a`, but in Rust 2021, it will only capture `a.0` +... +LL | } + | - in Rust 2018, `a` is dropped here, but in Rust 2021, only `a.0` will be dropped here as part of the closure + | + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html> +note: the lint level is defined here + --> $DIR/rfc2229-migration.rs:5:9 + | +LL | #![warn(rust_2021_compatibility)] + | ^^^^^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(rust_2021_incompatible_closure_captures)]` implied by `#[warn(rust_2021_compatibility)]` +help: add a dummy let to cause `a` to be fully captured + | +LL ~ let f = use || { +LL + let _ = &a; + | + +warning: 1 warning emitted + diff --git a/tests/ui/ergonomic-clones/closure/spawn-thread.edition2018.stderr b/tests/ui/ergonomic-clones/closure/spawn-thread.edition2018.stderr new file mode 100644 index 00000000000..ac8e1c5fa85 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/spawn-thread.edition2018.stderr @@ -0,0 +1,28 @@ +error[E0382]: use of moved value: `x` + --> $DIR/spawn-thread.rs:15:42 + | +LL | let x = (Arc::new("foo".to_owned()), Arc::new(vec![1, 2, 3]), Arc::new(1)); + | - move occurs because `x` has type `(Arc<String>, Arc<Vec<i32>>, Arc<i32>)`, which does not implement the `Copy` trait +LL | for _ in 0..10 { + | -------------- inside of this loop +LL | let handler = std::thread::spawn(use || { + | __________________________________________-^^^^^ +LL | | +LL | | drop((x.0, x.1, x.2)); + | | --- use occurs due to use in closure +LL | | }); + | |_________- value moved here, in previous iteration of loop + | +help: consider moving the expression out of the loop so it is only moved once + | +LL ~ let mut value = std::thread::spawn(use || { +LL + +LL + drop((x.0, x.1, x.2)); +LL + }); +LL ~ for _ in 0..10 { +LL ~ let handler = value; + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/ergonomic-clones/closure/spawn-thread.rs b/tests/ui/ergonomic-clones/closure/spawn-thread.rs new file mode 100644 index 00000000000..289d446c6e6 --- /dev/null +++ b/tests/ui/ergonomic-clones/closure/spawn-thread.rs @@ -0,0 +1,50 @@ +//@ revisions: edition2018 edition2024 +//@ [edition2018] edition: 2018 +//@ [edition2024] edition: 2024 +//@ [edition2024] check-pass + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +use std::sync::Arc; + +fn foo() { + // The type is a tuple and doesn't implement UseCloned + let x = (Arc::new("foo".to_owned()), Arc::new(vec![1, 2, 3]), Arc::new(1)); + for _ in 0..10 { + let handler = std::thread::spawn(use || { + //[edition2018]~^ ERROR use of moved value: `x` [E0382] + drop((x.0, x.1, x.2)); + }); + handler.join().unwrap(); + } +} + +fn bar() { + let x = Arc::new("foo".to_owned()); + let y = Arc::new(vec![1, 2, 3]); + let z = Arc::new(1); + + for _ in 0..10 { + let handler = std::thread::spawn(use || { + drop((x, y, z)); + }); + handler.join().unwrap(); + } +} + +fn baz() { + use std::sync::Arc; + use std::thread; + + let five = Arc::new(5); + + for _ in 0..10 { + let handler = thread::spawn(use || { + println!("{five:?}"); + }); + handler.join().unwrap(); + } +} + +fn main() {} diff --git a/tests/ui/ergonomic-clones/dotuse/block.rs b/tests/ui/ergonomic-clones/dotuse/block.rs new file mode 100644 index 00000000000..2e423c67d02 --- /dev/null +++ b/tests/ui/ergonomic-clones/dotuse/block.rs @@ -0,0 +1,11 @@ +//@ check-pass + +#![feature(ergonomic_clones)] +#![allow(incomplete_features)] + +fn use_block_test(x: i32) -> i32 { + let x = { let x = x + 1; x }.use; + x +} + +fn main() {} diff --git a/tests/ui/error-codes/E0063.rs b/tests/ui/error-codes/E0063.rs index 48c9c13f018..2ef09b0a426 100644 --- a/tests/ui/error-codes/E0063.rs +++ b/tests/ui/error-codes/E0063.rs @@ -32,7 +32,7 @@ fn main() { let x = PluralFoo {x: 1}; //~^ ERROR missing fields `y` and `z` in initializer of `PluralFoo` let y = TruncatedFoo{x:1}; - //~^ missing fields `a`, `b`, `y` and 1 other field in initializer of `TruncatedFoo` + //~^ ERROR missing fields `a`, `b`, `y` and 1 other field in initializer of `TruncatedFoo` let z = TruncatedPluralFoo{x:1}; //~^ ERROR missing fields `a`, `b`, `c` and 2 other fields in initializer of `TruncatedPluralFoo` } diff --git a/tests/ui/error-codes/E0092.rs b/tests/ui/error-codes/E0092.rs index ddaace98bd4..19a7c65a48e 100644 --- a/tests/ui/error-codes/E0092.rs +++ b/tests/ui/error-codes/E0092.rs @@ -1,7 +1,6 @@ #![feature(intrinsics)] -extern "rust-intrinsic" { - fn atomic_foo(); //~ ERROR E0092 -} -fn main() { -} +#[rustc_intrinsic] +unsafe fn atomic_foo(); //~ ERROR E0092 + +fn main() {} diff --git a/tests/ui/error-codes/E0092.stderr b/tests/ui/error-codes/E0092.stderr index 4ff2e6f077d..003c989fd59 100644 --- a/tests/ui/error-codes/E0092.stderr +++ b/tests/ui/error-codes/E0092.stderr @@ -1,8 +1,8 @@ error[E0092]: unrecognized atomic operation function: `foo` - --> $DIR/E0092.rs:3:5 + --> $DIR/E0092.rs:4:11 | -LL | fn atomic_foo(); - | ^^^^^^^^^^^^^^^^ unrecognized atomic operation +LL | unsafe fn atomic_foo(); + | ^^^^^^^^^^ unrecognized atomic operation error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0093.rs b/tests/ui/error-codes/E0093.rs index a2f0b1ae443..24df7a9a32b 100644 --- a/tests/ui/error-codes/E0093.rs +++ b/tests/ui/error-codes/E0093.rs @@ -1,8 +1,7 @@ #![feature(intrinsics)] -extern "rust-intrinsic" { - fn foo(); - //~^ ERROR E0093 -} -fn main() { -} +#[rustc_intrinsic] +unsafe fn foo(); +//~^ ERROR E0093 + +fn main() {} diff --git a/tests/ui/error-codes/E0093.stderr b/tests/ui/error-codes/E0093.stderr index 51c367b343a..d81bf53976a 100644 --- a/tests/ui/error-codes/E0093.stderr +++ b/tests/ui/error-codes/E0093.stderr @@ -1,8 +1,8 @@ error[E0093]: unrecognized intrinsic function: `foo` - --> $DIR/E0093.rs:3:5 + --> $DIR/E0093.rs:4:11 | -LL | fn foo(); - | ^^^^^^^^^ unrecognized intrinsic +LL | unsafe fn foo(); + | ^^^ unrecognized intrinsic | = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` diff --git a/tests/ui/error-codes/E0186.rs b/tests/ui/error-codes/E0186.rs index 83ef78ef2c0..9b507f9b988 100644 --- a/tests/ui/error-codes/E0186.rs +++ b/tests/ui/error-codes/E0186.rs @@ -1,12 +1,12 @@ trait Foo { - fn foo(&self); //~ `&self` used in trait + fn foo(&self); //~ NOTE `&self` used in trait } struct Bar; impl Foo for Bar { fn foo() {} //~ ERROR E0186 - //~^ expected `&self` in impl + //~^ NOTE expected `&self` in impl } fn main() { diff --git a/tests/ui/error-codes/E0261.rs b/tests/ui/error-codes/E0261.rs index f05e09aa0da..e37eab9501e 100644 --- a/tests/ui/error-codes/E0261.rs +++ b/tests/ui/error-codes/E0261.rs @@ -1,9 +1,9 @@ fn foo(x: &'a str) { } //~ ERROR E0261 - //~| undeclared lifetime + //~| NOTE undeclared lifetime struct Foo { x: &'a str, //~ ERROR E0261 - //~| undeclared lifetime + //~| NOTE undeclared lifetime } fn main() {} diff --git a/tests/ui/error-codes/E0262.rs b/tests/ui/error-codes/E0262.rs index 55264f1387f..460ea95148c 100644 --- a/tests/ui/error-codes/E0262.rs +++ b/tests/ui/error-codes/E0262.rs @@ -1,4 +1,4 @@ fn foo<'static>(x: &'static str) { } //~ ERROR E0262 - //~| 'static is a reserved lifetime name + //~| NOTE 'static is a reserved lifetime name fn main() {} diff --git a/tests/ui/error-codes/E0516.rs b/tests/ui/error-codes/E0516.rs index 834bb630989..f81b98cdadc 100644 --- a/tests/ui/error-codes/E0516.rs +++ b/tests/ui/error-codes/E0516.rs @@ -1,4 +1,4 @@ fn main() { let x: typeof(92) = 92; //~ ERROR E0516 - //~| reserved keyword + //~| NOTE reserved keyword } diff --git a/tests/ui/error-codes/E0597.rs b/tests/ui/error-codes/E0597.rs index 7217e351281..ebe42f54212 100644 --- a/tests/ui/error-codes/E0597.rs +++ b/tests/ui/error-codes/E0597.rs @@ -6,7 +6,7 @@ fn main() { let mut x = Foo { x: None }; let y = 0; x.x = Some(&y); - //~^ `y` does not live long enough [E0597] + //~^ ERROR `y` does not live long enough [E0597] } impl<'a> Drop for Foo<'a> { fn drop(&mut self) { } } diff --git a/tests/ui/error-codes/E0606.rs b/tests/ui/error-codes/E0606.rs index 6f6c6513846..2d430fcdc16 100644 --- a/tests/ui/error-codes/E0606.rs +++ b/tests/ui/error-codes/E0606.rs @@ -1,4 +1,4 @@ fn main() { let x = &(&0u8 as u8); //~ ERROR E0606 - x as u8; //~ casting `&u8` as `u8` is invalid [E0606] + x as u8; //~ ERROR casting `&u8` as `u8` is invalid [E0606] } diff --git a/tests/ui/error-codes/E0622.rs b/tests/ui/error-codes/E0622.rs deleted file mode 100644 index 08c6d171296..00000000000 --- a/tests/ui/error-codes/E0622.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![feature(intrinsics)] -extern "rust-intrinsic" { - pub static atomic_singlethreadfence_seqcst : unsafe extern "rust-intrinsic" fn(); - //~^ ERROR intrinsic must be a function [E0622] -} -fn main() { unsafe { atomic_singlethreadfence_seqcst(); } } diff --git a/tests/ui/error-codes/E0622.stderr b/tests/ui/error-codes/E0622.stderr deleted file mode 100644 index 739ec984fc6..00000000000 --- a/tests/ui/error-codes/E0622.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0622]: intrinsic must be a function - --> $DIR/E0622.rs:3:5 - | -LL | pub static atomic_singlethreadfence_seqcst : unsafe extern "rust-intrinsic" fn(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected a function - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0622`. diff --git a/tests/ui/extern/extern-main-issue-86110.rs b/tests/ui/extern/extern-main-issue-86110.rs index 83af7a14ccc..007d1371704 100644 --- a/tests/ui/extern/extern-main-issue-86110.rs +++ b/tests/ui/extern/extern-main-issue-86110.rs @@ -2,6 +2,6 @@ extern "C" { fn missing(); fn main(); - //~^ the `main` function cannot be declared in an `extern` block + //~^ ERROR the `main` function cannot be declared in an `extern` block fn missing2(); } diff --git a/tests/ui/extern/extern-with-type-bounds.rs b/tests/ui/extern/extern-with-type-bounds.rs deleted file mode 100644 index 3fbddfc99a6..00000000000 --- a/tests/ui/extern/extern-with-type-bounds.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![feature(intrinsics, rustc_attrs)] - -// 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. - fn size_of_val<T: Clone>(x: *const T) -> usize; - - // Unresolved bounds should still error. - fn align_of<T: NoSuchTrait>() -> usize; - //~^ ERROR cannot find trait `NoSuchTrait` in this scope -} - -fn main() {} diff --git a/tests/ui/extern/extern-with-type-bounds.stderr b/tests/ui/extern/extern-with-type-bounds.stderr deleted file mode 100644 index 893947e831f..00000000000 --- a/tests/ui/extern/extern-with-type-bounds.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0405]: cannot find trait `NoSuchTrait` in this scope - --> $DIR/extern-with-type-bounds.rs:17:20 - | -LL | fn align_of<T: NoSuchTrait>() -> usize; - | ^^^^^^^^^^^ not found in this scope - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0405`. diff --git a/tests/ui/extern/issue-112363-extern-item-where-clauses-debug-ice.rs b/tests/ui/extern/issue-112363-extern-item-where-clauses-debug-ice.rs index 17e08f511d7..6a4b7814ef1 100644 --- a/tests/ui/extern/issue-112363-extern-item-where-clauses-debug-ice.rs +++ b/tests/ui/extern/issue-112363-extern-item-where-clauses-debug-ice.rs @@ -1,10 +1,10 @@ extern "C" { type Item = [T] where [T]: Sized; - //~^ incorrect `type` inside `extern` block - //~| `type`s inside `extern` blocks cannot have `where` clauses - //~| cannot find type `T` in this scope - //~| cannot find type `T` in this scope - //~| extern types are experimental + //~^ ERROR incorrect `type` inside `extern` block + //~| ERROR `type`s inside `extern` blocks cannot have `where` clauses + //~| ERROR cannot find type `T` in this scope + //~| ERROR cannot find type `T` in this scope + //~| ERROR extern types are experimental } fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-abi.rs b/tests/ui/feature-gates/feature-gate-abi.rs index 2af623734ee..bafd3643788 100644 --- a/tests/ui/feature-gates/feature-gate-abi.rs +++ b/tests/ui/feature-gates/feature-gate-abi.rs @@ -8,19 +8,10 @@ extern crate minicore; use minicore::*; -// Functions -extern "rust-intrinsic" fn f1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in -extern "rust-intrinsic" fn f2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in extern "rust-call" fn f4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change // Methods in trait definition trait Tr { - extern "rust-intrinsic" fn m1(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in - extern "rust-intrinsic" fn m2(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in extern "rust-call" fn m4(_: ()); //~ ERROR extern "rust-call" ABI is experimental and subject to change extern "rust-call" fn dm4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change @@ -30,28 +21,16 @@ struct S; // Methods in trait impl impl Tr for S { - extern "rust-intrinsic" fn m1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in - extern "rust-intrinsic" fn m2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in extern "rust-call" fn m4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change } // Methods in inherent impl impl S { - extern "rust-intrinsic" fn im1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in - extern "rust-intrinsic" fn im2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail - //~^ ERROR intrinsic must be in extern "rust-call" fn im4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change } // Function pointer types -type A1 = extern "rust-intrinsic" fn(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail -type A2 = extern "rust-intrinsic" fn(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail type A4 = extern "rust-call" fn(_: ()); //~ ERROR extern "rust-call" ABI is experimental and subject to change // Foreign modules -extern "rust-intrinsic" {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail -extern "rust-intrinsic" {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail extern "rust-call" {} //~ ERROR extern "rust-call" ABI is experimental and subject to change diff --git a/tests/ui/feature-gates/feature-gate-abi.stderr b/tests/ui/feature-gates/feature-gate-abi.stderr index a974c0099cb..7897a60b34f 100644 --- a/tests/ui/feature-gates/feature-gate-abi.stderr +++ b/tests/ui/feature-gates/feature-gate-abi.stderr @@ -1,23 +1,5 @@ -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:12:8 - | -LL | extern "rust-intrinsic" fn f1() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:14:8 - | -LL | extern "rust-intrinsic" fn f2() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:16:8 + --> $DIR/feature-gate-abi.rs:11:8 | LL | extern "rust-call" fn f4(_: ()) {} | ^^^^^^^^^^^ @@ -26,26 +8,8 @@ LL | extern "rust-call" fn f4(_: ()) {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:20:12 - | -LL | extern "rust-intrinsic" fn m1(); - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:22:12 - | -LL | extern "rust-intrinsic" fn m2(); - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:24:12 + --> $DIR/feature-gate-abi.rs:15:12 | LL | extern "rust-call" fn m4(_: ()); | ^^^^^^^^^^^ @@ -55,7 +19,7 @@ LL | extern "rust-call" fn m4(_: ()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:26:12 + --> $DIR/feature-gate-abi.rs:17:12 | LL | extern "rust-call" fn dm4(_: ()) {} | ^^^^^^^^^^^ @@ -64,26 +28,8 @@ LL | extern "rust-call" fn dm4(_: ()) {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:33:12 - | -LL | extern "rust-intrinsic" fn m1() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:35:12 - | -LL | extern "rust-intrinsic" fn m2() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:37:12 + --> $DIR/feature-gate-abi.rs:24:12 | LL | extern "rust-call" fn m4(_: ()) {} | ^^^^^^^^^^^ @@ -92,26 +38,8 @@ LL | extern "rust-call" fn m4(_: ()) {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:42:12 - | -LL | extern "rust-intrinsic" fn im1() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:44:12 - | -LL | extern "rust-intrinsic" fn im2() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:46:12 + --> $DIR/feature-gate-abi.rs:29:12 | LL | extern "rust-call" fn im4(_: ()) {} | ^^^^^^^^^^^ @@ -120,26 +48,8 @@ LL | extern "rust-call" fn im4(_: ()) {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:50:18 - | -LL | type A1 = extern "rust-intrinsic" fn(); - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:51:18 - | -LL | type A2 = extern "rust-intrinsic" fn(); - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:52:18 + --> $DIR/feature-gate-abi.rs:33:18 | LL | type A4 = extern "rust-call" fn(_: ()); | ^^^^^^^^^^^ @@ -148,26 +58,8 @@ LL | type A4 = extern "rust-call" fn(_: ()); = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:55:8 - | -LL | extern "rust-intrinsic" {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:56:8 - | -LL | extern "rust-intrinsic" {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:57:8 + --> $DIR/feature-gate-abi.rs:36:8 | LL | extern "rust-call" {} | ^^^^^^^^^^^ @@ -176,54 +68,6 @@ LL | extern "rust-call" {} = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:20:32 - | -LL | extern "rust-intrinsic" fn m1(); - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:22:32 - | -LL | extern "rust-intrinsic" fn m2(); - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:12:33 - | -LL | extern "rust-intrinsic" fn f1() {} - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:14:33 - | -LL | extern "rust-intrinsic" fn f2() {} - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:33:37 - | -LL | extern "rust-intrinsic" fn m1() {} - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:35:37 - | -LL | extern "rust-intrinsic" fn m2() {} - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:42:38 - | -LL | extern "rust-intrinsic" fn im1() {} - | ^^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:44:38 - | -LL | extern "rust-intrinsic" fn im2() {} - | ^^ - -error: aborting due to 27 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-c_variadic.rs b/tests/ui/feature-gates/feature-gate-c_variadic.rs index 8b40c36c7db..f189f02a26d 100644 --- a/tests/ui/feature-gates/feature-gate-c_variadic.rs +++ b/tests/ui/feature-gates/feature-gate-c_variadic.rs @@ -1,4 +1,4 @@ #![crate_type="lib"] pub unsafe extern "C" fn test(_: i32, ap: ...) { } -//~^ C-variadic functions are unstable +//~^ ERROR C-variadic functions are unstable diff --git a/tests/ui/feature-gates/feature-gate-cfg-emscripten-wasm-eh.rs b/tests/ui/feature-gates/feature-gate-cfg-emscripten-wasm-eh.rs index cff98b43fe7..232061e239c 100644 --- a/tests/ui/feature-gates/feature-gate-cfg-emscripten-wasm-eh.rs +++ b/tests/ui/feature-gates/feature-gate-cfg-emscripten-wasm-eh.rs @@ -1,4 +1,4 @@ //@ compile-flags: --check-cfg=cfg(emscripten_wasm_eh) #[cfg(not(emscripten_wasm_eh))] -//~^ `cfg(emscripten_wasm_eh)` is experimental +//~^ ERROR `cfg(emscripten_wasm_eh)` is experimental fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-cfg-sanitizer_cfi.rs b/tests/ui/feature-gates/feature-gate-cfg-sanitizer_cfi.rs index 76d96de750a..1419a978138 100644 --- a/tests/ui/feature-gates/feature-gate-cfg-sanitizer_cfi.rs +++ b/tests/ui/feature-gates/feature-gate-cfg-sanitizer_cfi.rs @@ -1,9 +1,9 @@ #[cfg(sanitizer_cfi_generalize_pointers)] -//~^ `cfg(sanitizer_cfi_generalize_pointers)` is experimental +//~^ ERROR `cfg(sanitizer_cfi_generalize_pointers)` is experimental fn foo() {} #[cfg(sanitizer_cfi_normalize_integers)] -//~^ `cfg(sanitizer_cfi_normalize_integers)` is experimental +//~^ ERROR `cfg(sanitizer_cfi_normalize_integers)` is experimental fn bar() {} fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-cfg_sanitize.rs b/tests/ui/feature-gates/feature-gate-cfg_sanitize.rs index c3e7cc9ed8a..0933f43e76b 100644 --- a/tests/ui/feature-gates/feature-gate-cfg_sanitize.rs +++ b/tests/ui/feature-gates/feature-gate-cfg_sanitize.rs @@ -1,3 +1,3 @@ #[cfg(not(sanitize = "thread"))] -//~^ `cfg(sanitize)` is experimental +//~^ ERROR `cfg(sanitize)` is experimental fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-closure_track_caller.rs b/tests/ui/feature-gates/feature-gate-closure_track_caller.rs index d90fb765a23..d7cfc13cae5 100644 --- a/tests/ui/feature-gates/feature-gate-closure_track_caller.rs +++ b/tests/ui/feature-gates/feature-gate-closure_track_caller.rs @@ -3,7 +3,7 @@ #![feature(coroutines)] fn main() { - let _closure = #[track_caller] || {}; //~ `#[track_caller]` on closures - let _coroutine = #[coroutine] #[track_caller] || { yield; }; //~ `#[track_caller]` on closures - let _future = #[track_caller] async {}; //~ `#[track_caller]` on closures + let _closure = #[track_caller] || {}; //~ ERROR `#[track_caller]` on closures + let _coroutine = #[coroutine] #[track_caller] || { yield; }; //~ ERROR `#[track_caller]` on closures + let _future = #[track_caller] async {}; //~ ERROR `#[track_caller]` on closures } diff --git a/tests/ui/feature-gates/feature-gate-custom_mir.rs b/tests/ui/feature-gates/feature-gate-custom_mir.rs index e100df08ee7..4d713c524b3 100644 --- a/tests/ui/feature-gates/feature-gate-custom_mir.rs +++ b/tests/ui/feature-gates/feature-gate-custom_mir.rs @@ -1,13 +1,13 @@ #![feature(core_intrinsics)] extern crate core; -use core::intrinsics::mir::*; //~ custom_mir +use core::intrinsics::mir::*; //~ ERROR custom_mir #[custom_mir(dialect = "built")] //~ ERROR the `#[custom_mir]` attribute is just used for the Rust test suite pub fn foo(_x: i32) -> i32 { mir! { { - Return() //~ custom_mir + Return() //~ ERROR custom_mir } } } diff --git a/tests/ui/feature-gates/feature-gate-freeze-impls.rs b/tests/ui/feature-gates/feature-gate-freeze-impls.rs index c14c9494874..401095dd83b 100644 --- a/tests/ui/feature-gates/feature-gate-freeze-impls.rs +++ b/tests/ui/feature-gates/feature-gate-freeze-impls.rs @@ -5,11 +5,11 @@ use std::marker::Freeze; struct Foo; unsafe impl Freeze for Foo {} -//~^ explicit impls for the `Freeze` trait are not permitted +//~^ ERROR explicit impls for the `Freeze` trait are not permitted struct Bar; impl !Freeze for Bar {} -//~^ explicit impls for the `Freeze` trait are not permitted +//~^ ERROR explicit impls for the `Freeze` trait are not permitted fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-intrinsics.rs b/tests/ui/feature-gates/feature-gate-intrinsics.rs index 65806a0223e..b7ebba67272 100644 --- a/tests/ui/feature-gates/feature-gate-intrinsics.rs +++ b/tests/ui/feature-gates/feature-gate-intrinsics.rs @@ -1,8 +1,5 @@ -extern "rust-intrinsic" { //~ ERROR "rust-intrinsic" ABI is an implementation detail - fn bar(); //~ ERROR unrecognized intrinsic function: `bar` -} - -extern "rust-intrinsic" fn baz() {} //~ ERROR "rust-intrinsic" ABI is an implementation detail -//~^ ERROR intrinsic must be in +#[rustc_intrinsic] +//~^ ERROR the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items +fn bar(); fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-intrinsics.stderr b/tests/ui/feature-gates/feature-gate-intrinsics.stderr index 97246f05258..a7a725883a9 100644 --- a/tests/ui/feature-gates/feature-gate-intrinsics.stderr +++ b/tests/ui/feature-gates/feature-gate-intrinsics.stderr @@ -1,36 +1,12 @@ -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-intrinsics.rs:1:8 +error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items + --> $DIR/feature-gate-intrinsics.rs:1:1 | -LL | extern "rust-intrinsic" { - | ^^^^^^^^^^^^^^^^ +LL | #[rustc_intrinsic] + | ^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-intrinsics.rs:5:8 - | -LL | extern "rust-intrinsic" fn baz() {} - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(intrinsics)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0093]: unrecognized intrinsic function: `bar` - --> $DIR/feature-gate-intrinsics.rs:2:5 - | -LL | fn bar(); - | ^^^^^^^^^ unrecognized intrinsic - | - = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-intrinsics.rs:5:34 - | -LL | extern "rust-intrinsic" fn baz() {} - | ^^ - -error: aborting due to 4 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0093, E0658. -For more information about an error, try `rustc --explain E0093`. +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-naked_functions.rs b/tests/ui/feature-gates/feature-gate-naked_functions.rs index abb55b9a557..77a67e0696e 100644 --- a/tests/ui/feature-gates/feature-gate-naked_functions.rs +++ b/tests/ui/feature-gates/feature-gate-naked_functions.rs @@ -4,7 +4,7 @@ use std::arch::naked_asm; //~^ ERROR use of unstable library feature `naked_functions` #[naked] -//~^ the `#[naked]` attribute is an experimental feature +//~^ ERROR the `#[naked]` attribute is an experimental feature extern "C" fn naked() { naked_asm!("") //~^ ERROR use of unstable library feature `naked_functions` @@ -12,7 +12,7 @@ extern "C" fn naked() { } #[naked] -//~^ the `#[naked]` attribute is an experimental feature +//~^ ERROR the `#[naked]` attribute is an experimental feature extern "C" fn naked_2() -> isize { naked_asm!("") //~^ ERROR use of unstable library feature `naked_functions` diff --git a/tests/ui/feature-gates/feature-gate-new_range.rs b/tests/ui/feature-gates/feature-gate-new_range.rs index ecb73546d6a..32eeb0424b6 100644 --- a/tests/ui/feature-gates/feature-gate-new_range.rs +++ b/tests/ui/feature-gates/feature-gate-new_range.rs @@ -2,9 +2,9 @@ fn main() { let a: core::range::RangeFrom<u8> = 1..; - //~^ mismatched types + //~^ ERROR mismatched types let b: core::range::Range<u8> = 2..3; - //~^ mismatched types + //~^ ERROR mismatched types let c: core::range::RangeInclusive<u8> = 4..=5; - //~^ mismatched types + //~^ ERROR mismatched types } diff --git a/tests/ui/feature-gates/feature-gate-no_sanitize.rs b/tests/ui/feature-gates/feature-gate-no_sanitize.rs index 66a9263e13a..5ac014f1c5b 100644 --- a/tests/ui/feature-gates/feature-gate-no_sanitize.rs +++ b/tests/ui/feature-gates/feature-gate-no_sanitize.rs @@ -1,4 +1,4 @@ #[no_sanitize(address)] -//~^ the `#[no_sanitize]` attribute is an experimental feature +//~^ ERROR the `#[no_sanitize]` attribute is an experimental feature fn main() { } diff --git a/tests/ui/feature-gates/feature-gate-rustc_const_unstable.rs b/tests/ui/feature-gates/feature-gate-rustc_const_unstable.rs index d7daaaaa101..522db1643fd 100644 --- a/tests/ui/feature-gates/feature-gate-rustc_const_unstable.rs +++ b/tests/ui/feature-gates/feature-gate-rustc_const_unstable.rs @@ -1,6 +1,6 @@ // Test internal const fn feature gate. -#[rustc_const_unstable(feature="fzzzzzt")] //~ stability attributes may not be used outside +#[rustc_const_unstable(feature="fzzzzzt")] //~ ERROR stability attributes may not be used outside pub const fn bazinga() {} fn main() { diff --git a/tests/ui/feature-gates/feature-gate-super-let.rs b/tests/ui/feature-gates/feature-gate-super-let.rs index cfe92a42669..7be08003913 100644 --- a/tests/ui/feature-gates/feature-gate-super-let.rs +++ b/tests/ui/feature-gates/feature-gate-super-let.rs @@ -2,3 +2,10 @@ fn main() { super let a = 1; //~^ ERROR `super let` is experimental } + +// Check that it also isn't accepted in cfg'd out code. +#[cfg(any())] +fn a() { + super let a = 1; + //~^ ERROR `super let` is experimental +} diff --git a/tests/ui/feature-gates/feature-gate-super-let.stderr b/tests/ui/feature-gates/feature-gate-super-let.stderr index a64e1b374f9..4d088594f6d 100644 --- a/tests/ui/feature-gates/feature-gate-super-let.stderr +++ b/tests/ui/feature-gates/feature-gate-super-let.stderr @@ -8,6 +8,16 @@ LL | super let a = 1; = help: add `#![feature(super_let)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 1 previous error +error[E0658]: `super let` is experimental + --> $DIR/feature-gate-super-let.rs:9:5 + | +LL | super let a = 1; + | ^^^^^ + | + = note: see issue #139076 <https://github.com/rust-lang/rust/issues/139076> for more information + = help: add `#![feature(super_let)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-try_blocks.rs b/tests/ui/feature-gates/feature-gate-try_blocks.rs index f565dd014de..90816293624 100644 --- a/tests/ui/feature-gates/feature-gate-try_blocks.rs +++ b/tests/ui/feature-gates/feature-gate-try_blocks.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2018 +//@ edition: 2018 pub fn main() { let try_result: Option<_> = try { //~ ERROR `try` expression is experimental diff --git a/tests/ui/feature-gates/feature-gate-yeet_expr-in-cfg.rs b/tests/ui/feature-gates/feature-gate-yeet_expr-in-cfg.rs index 33fda822baa..a32ebed8dde 100644 --- a/tests/ui/feature-gates/feature-gate-yeet_expr-in-cfg.rs +++ b/tests/ui/feature-gates/feature-gate-yeet_expr-in-cfg.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2021 +//@ edition: 2021 pub fn demo() -> Option<i32> { #[cfg(FALSE)] diff --git a/tests/ui/feature-gates/feature-gate-yeet_expr.rs b/tests/ui/feature-gates/feature-gate-yeet_expr.rs index 12cc17e1cc8..6604f496917 100644 --- a/tests/ui/feature-gates/feature-gate-yeet_expr.rs +++ b/tests/ui/feature-gates/feature-gate-yeet_expr.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2018 +//@ edition: 2018 pub fn demo() -> Option<i32> { do yeet //~ ERROR `do yeet` expression is experimental diff --git a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs index 2328798d74c..44c0f1130f0 100644 --- a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs +++ b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs @@ -5,9 +5,9 @@ fn main() { let a = &[1, 2, 3]; println!("{}", { - extern "rust-intrinsic" { //~ ERROR "rust-intrinsic" ABI is an implementation detail - fn atomic_fence(); - } + #[rustc_intrinsic] //~ ERROR the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items + unsafe fn atomic_fence(); + atomic_fence(); //~ ERROR: is unsafe 42 }); diff --git a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr index 86f88fdff5f..aaaaeece67a 100644 --- a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr +++ b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr @@ -1,13 +1,13 @@ -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gated-feature-in-macro-arg.rs:8:16 +error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items + --> $DIR/feature-gated-feature-in-macro-arg.rs:8:9 | -LL | extern "rust-intrinsic" { - | ^^^^^^^^^^^^^^^^ +LL | #[rustc_intrinsic] + | ^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0133]: call to unsafe function `main::atomic_fence` is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `atomic_fence` is unsafe and requires unsafe function or block --> $DIR/feature-gated-feature-in-macro-arg.rs:11:9 | LL | atomic_fence(); diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs index a196b8ecdb3..d07201ebbd1 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs @@ -174,16 +174,16 @@ mod macro_use { mod inner { #![macro_use] } #[macro_use] fn f() { } - //~^ `#[macro_use]` only has an effect + //~^ WARN `#[macro_use]` only has an effect #[macro_use] struct S; - //~^ `#[macro_use]` only has an effect + //~^ WARN `#[macro_use]` only has an effect #[macro_use] type T = S; - //~^ `#[macro_use]` only has an effect + //~^ WARN `#[macro_use]` only has an effect #[macro_use] impl S { } - //~^ `#[macro_use]` only has an effect + //~^ WARN `#[macro_use]` only has an effect } #[macro_export] diff --git a/tests/ui/fn/param-mismatch-foreign.rs b/tests/ui/fn/param-mismatch-foreign.rs index 2ab2bf95448..eebca29d6c9 100644 --- a/tests/ui/fn/param-mismatch-foreign.rs +++ b/tests/ui/fn/param-mismatch-foreign.rs @@ -1,6 +1,7 @@ extern "C" { fn foo(x: i32, y: u32, z: i32); //~^ NOTE function defined here + //~| NOTE } fn main() { diff --git a/tests/ui/fn/param-mismatch-foreign.stderr b/tests/ui/fn/param-mismatch-foreign.stderr index 835e0a3343e..fff3283cbb6 100644 --- a/tests/ui/fn/param-mismatch-foreign.stderr +++ b/tests/ui/fn/param-mismatch-foreign.stderr @@ -1,5 +1,5 @@ error[E0061]: this function takes 3 arguments but 2 arguments were supplied - --> $DIR/param-mismatch-foreign.rs:7:5 + --> $DIR/param-mismatch-foreign.rs:8:5 | LL | foo(1i32, 2i32); | ^^^ ---- argument #2 of type `u32` is missing diff --git a/tests/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.rs b/tests/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.rs index 7f1625c9265..97cf3e9d51c 100644 --- a/tests/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.rs +++ b/tests/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.rs @@ -5,7 +5,7 @@ extern "C" { fn f() { - //~^ incorrect function inside `extern` block + //~^ ERROR incorrect function inside `extern` block fn g() {} } } diff --git a/tests/ui/foreign/issue-91370-foreign-fn-block-impl.rs b/tests/ui/foreign/issue-91370-foreign-fn-block-impl.rs index e8634de86ea..23e08e01e6a 100644 --- a/tests/ui/foreign/issue-91370-foreign-fn-block-impl.rs +++ b/tests/ui/foreign/issue-91370-foreign-fn-block-impl.rs @@ -3,7 +3,7 @@ extern "C" { //~^ `extern` blocks define existing foreign functions fn f() { - //~^ incorrect function inside `extern` block + //~^ ERROR incorrect function inside `extern` block //~| cannot have a body impl Copy for u8 {} } diff --git a/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.rs b/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.rs index 5f2e134109e..6ba3c4c65d0 100644 --- a/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.rs +++ b/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.rs @@ -13,7 +13,7 @@ fn cmp_eq<'a, 'b, A: Scalar, B: Scalar, O: Scalar>(a: A::RefType<'a>, b: B::RefT fn build_expression<A: Scalar, B: Scalar, O: Scalar>( ) -> impl Fn(A::RefType<'_>, B::RefType<'_>) -> O { - //[next]~^^ expected a `Fn(<A as Scalar>::RefType<'_>, <B as Scalar>::RefType<'_>)` closure + //[next]~^^ ERROR expected a `Fn(<A as Scalar>::RefType<'_>, <B as Scalar>::RefType<'_>)` closure cmp_eq //~^ ERROR type annotations needed } diff --git a/tests/ui/generic-associated-types/bugs/hrtb-implied-3.rs b/tests/ui/generic-associated-types/bugs/hrtb-implied-3.rs index bc9e6c8aea8..8f2b5bf8f52 100644 --- a/tests/ui/generic-associated-types/bugs/hrtb-implied-3.rs +++ b/tests/ui/generic-associated-types/bugs/hrtb-implied-3.rs @@ -17,7 +17,7 @@ where fn fails(iter: &str) { trivial_bound(iter); - //~^ borrowed data escapes + //~^ ERROR borrowed data escapes } fn main() {} diff --git a/tests/ui/generic-associated-types/collectivity-regression.rs b/tests/ui/generic-associated-types/collectivity-regression.rs index 54154f9d1fc..d499a9ca858 100644 --- a/tests/ui/generic-associated-types/collectivity-regression.rs +++ b/tests/ui/generic-associated-types/collectivity-regression.rs @@ -11,7 +11,7 @@ where for<'a> T: Get<Value<'a> = ()>, { || { - //~^ `T` does not live long enough + //~^ ERROR `T` does not live long enough // // FIXME(#98437). This regressed at some point and // probably should work. diff --git a/tests/ui/generic-associated-types/const_params_have_right_type.stderr b/tests/ui/generic-associated-types/const_params_have_right_type.stderr index 78992112a7c..a3d3a66a05c 100644 --- a/tests/ui/generic-associated-types/const_params_have_right_type.stderr +++ b/tests/ui/generic-associated-types/const_params_have_right_type.stderr @@ -1,4 +1,4 @@ -error[E0053]: type `Foo` has an incompatible generic parameter for trait `Trait` +error[E0053]: associated type `Foo` has an incompatible generic parameter for trait `Trait` --> $DIR/const_params_have_right_type.rs:6:14 | LL | trait Trait { diff --git a/tests/ui/generic-associated-types/gat-in-trait-path.rs b/tests/ui/generic-associated-types/gat-in-trait-path.rs index 24cae213e0a..7523803eacf 100644 --- a/tests/ui/generic-associated-types/gat-in-trait-path.rs +++ b/tests/ui/generic-associated-types/gat-in-trait-path.rs @@ -20,11 +20,11 @@ impl<T> Foo for Fooer<T> { } fn f(_arg : Box<dyn for<'a> Foo<A<'a> = &'a ()>>) {} -//~^ the trait `Foo` is not dyn compatible +//~^ ERROR the trait `Foo` is not dyn compatible fn main() { let foo = Fooer(5); f(Box::new(foo)); - //~^ the trait `Foo` is not dyn compatible - //~| the trait `Foo` is not dyn compatible + //~^ ERROR the trait `Foo` is not dyn compatible + //~| ERROR the trait `Foo` is not dyn compatible } diff --git a/tests/ui/generic-associated-types/issue-102114.current.stderr b/tests/ui/generic-associated-types/issue-102114.current.stderr index 03471d08d74..5aace1eeaa2 100644 --- a/tests/ui/generic-associated-types/issue-102114.current.stderr +++ b/tests/ui/generic-associated-types/issue-102114.current.stderr @@ -1,4 +1,4 @@ -error[E0049]: type `B` has 1 type parameter but its trait declaration has 0 type parameters +error[E0049]: associated type `B` has 1 type parameter but its trait declaration has 0 type parameters --> $DIR/issue-102114.rs:15:12 | LL | type B<'b>; diff --git a/tests/ui/generic-associated-types/issue-102114.next.stderr b/tests/ui/generic-associated-types/issue-102114.next.stderr index 03471d08d74..5aace1eeaa2 100644 --- a/tests/ui/generic-associated-types/issue-102114.next.stderr +++ b/tests/ui/generic-associated-types/issue-102114.next.stderr @@ -1,4 +1,4 @@ -error[E0049]: type `B` has 1 type parameter but its trait declaration has 0 type parameters +error[E0049]: associated type `B` has 1 type parameter but its trait declaration has 0 type parameters --> $DIR/issue-102114.rs:15:12 | LL | type B<'b>; diff --git a/tests/ui/generic-associated-types/issue-74816.rs b/tests/ui/generic-associated-types/issue-74816.rs index e2f4ddc7485..6ec0b326173 100644 --- a/tests/ui/generic-associated-types/issue-74816.rs +++ b/tests/ui/generic-associated-types/issue-74816.rs @@ -11,7 +11,7 @@ trait Trait1 { trait Trait2 { type Associated: Trait1 = Self; //~^ ERROR: the trait bound `Self: Trait1` is not satisfied - //~| the size for values of type `Self` cannot be known + //~| ERROR the size for values of type `Self` cannot be known } impl Trait2 for () {} diff --git a/tests/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.rs b/tests/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.rs index 1c94067029d..f913efd7577 100644 --- a/tests/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.rs +++ b/tests/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.rs @@ -12,7 +12,7 @@ pub trait B { impl B for () { // `'a` doesn't match implicit `'static`: suggest `'_` - type T<'a> = Box<dyn A + 'a>; //~ incompatible lifetime on type + type T<'a> = Box<dyn A + 'a>; //~ ERROR incompatible lifetime on type } trait C {} @@ -22,7 +22,7 @@ pub trait D { } impl D for () { // `'a` doesn't match explicit `'static`: we *should* suggest removing `'static` - type T<'a> = Box<dyn A + 'a>; //~ incompatible lifetime on type + type T<'a> = Box<dyn A + 'a>; //~ ERROR incompatible lifetime on type } trait E {} @@ -32,7 +32,7 @@ pub trait F { } impl F for () { // `'a` doesn't match explicit `'static`: suggest `'_` - type T<'a> = (Box<dyn A + 'a>, Box<dyn A + 'a>); //~ incompatible lifetime on type + type T<'a> = (Box<dyn A + 'a>, Box<dyn A + 'a>); //~ ERROR incompatible lifetime on type } fn main() {} diff --git a/tests/ui/generic-associated-types/issue-86787.rs b/tests/ui/generic-associated-types/issue-86787.rs index 88cdd472696..43c193b91d0 100644 --- a/tests/ui/generic-associated-types/issue-86787.rs +++ b/tests/ui/generic-associated-types/issue-86787.rs @@ -8,7 +8,7 @@ enum Either<L, R> { pub trait HasChildrenOf { type T; type TRef<'a>; - //~^ missing required + //~^ ERROR missing required fn ref_children<'a>(&'a self) -> Vec<Self::TRef<'a>>; fn take_children(self) -> Vec<Self::T>; diff --git a/tests/ui/generic-associated-types/issue-88360.fixed b/tests/ui/generic-associated-types/issue-88360.fixed index 2ebc459f197..f24a86b240b 100644 --- a/tests/ui/generic-associated-types/issue-88360.fixed +++ b/tests/ui/generic-associated-types/issue-88360.fixed @@ -14,7 +14,7 @@ where { fn copy(&self) -> Self::Gat<'_> where T: Copy { self.test() - //~^ mismatched types + //~^ ERROR mismatched types } } diff --git a/tests/ui/generic-associated-types/issue-88360.rs b/tests/ui/generic-associated-types/issue-88360.rs index 011061dd861..12c18061d04 100644 --- a/tests/ui/generic-associated-types/issue-88360.rs +++ b/tests/ui/generic-associated-types/issue-88360.rs @@ -14,7 +14,7 @@ where { fn copy(&self) -> Self::Gat<'_> where T: Copy { *self.test() - //~^ mismatched types + //~^ ERROR mismatched types } } diff --git a/tests/ui/generic-associated-types/missing-where-clause-on-trait.rs b/tests/ui/generic-associated-types/missing-where-clause-on-trait.rs index c8a92466311..5354421f4b9 100644 --- a/tests/ui/generic-associated-types/missing-where-clause-on-trait.rs +++ b/tests/ui/generic-associated-types/missing-where-clause-on-trait.rs @@ -5,7 +5,7 @@ trait Foo { } impl Foo for () { type Assoc<'a, 'b> = () where 'a: 'b; - //~^ impl has stricter requirements than trait + //~^ ERROR impl has stricter requirements than trait } fn main() {} diff --git a/tests/ui/generic-associated-types/parameter_number_and_kind_impl.rs b/tests/ui/generic-associated-types/parameter_number_and_kind_impl.rs index c1381025ac2..a39a7aacc7b 100644 --- a/tests/ui/generic-associated-types/parameter_number_and_kind_impl.rs +++ b/tests/ui/generic-associated-types/parameter_number_and_kind_impl.rs @@ -12,11 +12,11 @@ struct Fooy; impl Foo for Fooy { type A = u32; - //~^ ERROR lifetime parameters or bounds on type `A` do not match the trait declaration + //~^ ERROR lifetime parameters or bounds on associated type `A` do not match the trait declaration type B<'a, T> = Vec<T>; //~^ ERROR type `B` has 1 type parameter but its trait declaration has 0 type parameters type C<'a> = u32; - //~^ ERROR lifetime parameters or bounds on type `C` do not match the trait declaration + //~^ ERROR lifetime parameters or bounds on associated type `C` do not match the trait declaration } struct Fooer; @@ -25,7 +25,7 @@ impl Foo for Fooer { type A<T> = u32; //~^ ERROR type `A` has 1 type parameter but its trait declaration has 0 type parameters type B<'a> = u32; - //~^ ERROR lifetime parameters or bounds on type `B` do not match the trait declaration + //~^ ERROR lifetime parameters or bounds on associated type `B` do not match the trait declaration type C<T> = T; //~^ ERROR type `C` has 1 type parameter but its trait declaration has 0 type parameters } diff --git a/tests/ui/generic-associated-types/parameter_number_and_kind_impl.stderr b/tests/ui/generic-associated-types/parameter_number_and_kind_impl.stderr index fdd6d305ab2..f7c4a07589c 100644 --- a/tests/ui/generic-associated-types/parameter_number_and_kind_impl.stderr +++ b/tests/ui/generic-associated-types/parameter_number_and_kind_impl.stderr @@ -1,13 +1,13 @@ -error[E0195]: lifetime parameters or bounds on type `A` do not match the trait declaration +error[E0195]: lifetime parameters or bounds on associated type `A` do not match the trait declaration --> $DIR/parameter_number_and_kind_impl.rs:14:11 | LL | type A<'a>; - | ---- lifetimes in impl do not match this type in trait + | ---- lifetimes in impl do not match this associated type in trait ... LL | type A = u32; - | ^ lifetimes do not match type in trait + | ^ lifetimes do not match associated type in trait -error[E0049]: type `B` has 1 type parameter but its trait declaration has 0 type parameters +error[E0049]: associated type `B` has 1 type parameter but its trait declaration has 0 type parameters --> $DIR/parameter_number_and_kind_impl.rs:16:12 | LL | type B<'a, 'b>; @@ -20,16 +20,16 @@ LL | type B<'a, T> = Vec<T>; | | | found 1 type parameter -error[E0195]: lifetime parameters or bounds on type `C` do not match the trait declaration +error[E0195]: lifetime parameters or bounds on associated type `C` do not match the trait declaration --> $DIR/parameter_number_and_kind_impl.rs:18:11 | LL | type C; - | - lifetimes in impl do not match this type in trait + | - lifetimes in impl do not match this associated type in trait ... LL | type C<'a> = u32; - | ^^^^ lifetimes do not match type in trait + | ^^^^ lifetimes do not match associated type in trait -error[E0049]: type `A` has 1 type parameter but its trait declaration has 0 type parameters +error[E0049]: associated type `A` has 1 type parameter but its trait declaration has 0 type parameters --> $DIR/parameter_number_and_kind_impl.rs:25:12 | LL | type A<'a>; @@ -38,16 +38,16 @@ LL | type A<'a>; LL | type A<T> = u32; | ^ found 1 type parameter -error[E0195]: lifetime parameters or bounds on type `B` do not match the trait declaration +error[E0195]: lifetime parameters or bounds on associated type `B` do not match the trait declaration --> $DIR/parameter_number_and_kind_impl.rs:27:11 | LL | type B<'a, 'b>; - | -------- lifetimes in impl do not match this type in trait + | -------- lifetimes in impl do not match this associated type in trait ... LL | type B<'a> = u32; - | ^^^^ lifetimes do not match type in trait + | ^^^^ lifetimes do not match associated type in trait -error[E0049]: type `C` has 1 type parameter but its trait declaration has 0 type parameters +error[E0049]: associated type `C` has 1 type parameter but its trait declaration has 0 type parameters --> $DIR/parameter_number_and_kind_impl.rs:29:12 | LL | type C; diff --git a/tests/ui/generic-associated-types/self-outlives-lint.rs b/tests/ui/generic-associated-types/self-outlives-lint.rs index 699b3a8c509..2e58a72fb5c 100644 --- a/tests/ui/generic-associated-types/self-outlives-lint.rs +++ b/tests/ui/generic-associated-types/self-outlives-lint.rs @@ -5,7 +5,7 @@ use std::fmt::Debug; // We have a `&'a self`, so we need a `Self: 'a` trait Iterable { type Item<'x>; - //~^ missing required + //~^ ERROR missing required fn iter<'a>(&'a self) -> Self::Item<'a>; } @@ -21,7 +21,7 @@ impl<T> Iterable for T { // We have a `&'a T`, so we need a `T: 'x` trait Deserializer<T> { type Out<'x>; - //~^ missing required + //~^ ERROR missing required fn deserialize<'a>(&self, input: &'a T) -> Self::Out<'a>; } @@ -35,14 +35,14 @@ impl<T> Deserializer<T> for () { // We have a `&'b T` and a `'b: 'a`, so it is implied that `T: 'a`. Therefore, we need a `T: 'x` trait Deserializer2<T> { type Out<'x>; - //~^ missing required + //~^ ERROR missing required fn deserialize2<'a, 'b: 'a>(&self, input1: &'b T) -> Self::Out<'a>; } // We have a `&'a T` and a `&'b U`, so we need a `T: 'x` and a `U: 'y` trait Deserializer3<T, U> { type Out<'x, 'y>; - //~^ missing required + //~^ ERROR missing required fn deserialize2<'a, 'b>(&self, input: &'a T, input2: &'b U) -> Self::Out<'a, 'b>; } @@ -57,7 +57,7 @@ struct Wrap<T>(T); // We pass `Wrap<T>` and we see `&'z Wrap<T>`, so we require `D: 'x` trait Des { type Out<'x, D>; - //~^ missing required + //~^ ERROR missing required fn des<'z, T>(&self, data: &'z Wrap<T>) -> Self::Out<'z, Wrap<T>>; } /* @@ -73,7 +73,7 @@ impl Des for () { // implied bound that `T: 'z`, so we require `D: 'x` trait Des2 { type Out<'x, D>; - //~^ missing required + //~^ ERROR missing required fn des<'z, T>(&self, data: &'z Wrap<T>) -> Self::Out<'z, T>; } /* @@ -88,7 +88,7 @@ impl Des2 for () { // We see `&'z T`, so we require `D: 'x` trait Des3 { type Out<'x, D>; - //~^ missing required + //~^ ERROR missing required fn des<'z, T>(&self, data: &'z T) -> Self::Out<'z, T>; } /* @@ -110,7 +110,7 @@ trait NoGat<'a> { // FIXME: we require two bounds (`where Self: 'a, Self: 'b`) when we should only require one trait TraitLifetime<'a> { type Bar<'b>; - //~^ missing required + //~^ ERROR missing required fn method(&'a self) -> Self::Bar<'a>; } @@ -118,14 +118,14 @@ trait TraitLifetime<'a> { // FIXME: we require two bounds (`where Self: 'a, Self: 'b`) when we should only require one trait TraitLifetimeWhere<'a> where Self: 'a { type Bar<'b>; - //~^ missing required + //~^ ERROR missing required fn method(&'a self) -> Self::Bar<'a>; } // Explicit bound instead of implicit; we want to still error trait ExplicitBound { type Bar<'b>; - //~^ missing required + //~^ ERROR missing required fn method<'b>(&self, token: &'b ()) -> Self::Bar<'b> where Self: 'b; } @@ -138,15 +138,15 @@ trait NotInReturn { // We obviously error for `Iterator`, but we should also error for `Item` trait IterableTwo { type Item<'a>; - //~^ missing required + //~^ ERROR missing required type Iterator<'a>: Iterator<Item = Self::Item<'a>>; - //~^ missing required + //~^ ERROR missing required fn iter<'a>(&'a self) -> Self::Iterator<'a>; } trait IterableTwoWhere { type Item<'a>; - //~^ missing required + //~^ ERROR missing required type Iterator<'a>: Iterator<Item = Self::Item<'a>> where Self: 'a; fn iter<'a>(&'a self) -> Self::Iterator<'a>; } @@ -155,7 +155,7 @@ trait IterableTwoWhere { // because of `&'x &'y`, so we require that `'b: 'a`. trait RegionOutlives { type Bar<'a, 'b>; - //~^ missing required + //~^ ERROR missing required fn foo<'x, 'y>(&self, input: &'x &'y ()) -> Self::Bar<'x, 'y>; } @@ -171,7 +171,7 @@ impl Foo for () { // Similar to the above, except with explicit bounds trait ExplicitRegionOutlives<'ctx> { type Fut<'out>; - //~^ missing required + //~^ ERROR missing required fn test<'out>(ctx: &'ctx i32) -> Self::Fut<'out> where @@ -211,7 +211,7 @@ trait StaticReturnAndTakes<'a> { // We require bounds when the GAT appears in the inputs trait Input { type Item<'a>; - //~^ missing required + //~^ ERROR missing required fn takes_item<'a>(&'a self, item: Self::Item<'a>); } diff --git a/tests/ui/generic-associated-types/trait-objects.rs b/tests/ui/generic-associated-types/trait-objects.rs index ed324b562e1..256cfee4c80 100644 --- a/tests/ui/generic-associated-types/trait-objects.rs +++ b/tests/ui/generic-associated-types/trait-objects.rs @@ -6,10 +6,10 @@ trait StreamingIterator { } fn min_size(x: &mut dyn for<'a> StreamingIterator<Item<'a> = &'a i32>) -> usize { - //~^ the trait `StreamingIterator` is not dyn compatible + //~^ ERROR the trait `StreamingIterator` is not dyn compatible x.size_hint().0 - //~^ the trait `StreamingIterator` is not dyn compatible - //~| the trait `StreamingIterator` is not dyn compatible + //~^ ERROR the trait `StreamingIterator` is not dyn compatible + //~| ERROR the trait `StreamingIterator` is not dyn compatible } fn main() {} diff --git a/tests/ui/generic-associated-types/type-param-defaults.rs b/tests/ui/generic-associated-types/type-param-defaults.rs index a9c8c5c12d9..eea54c46073 100644 --- a/tests/ui/generic-associated-types/type-param-defaults.rs +++ b/tests/ui/generic-associated-types/type-param-defaults.rs @@ -4,17 +4,17 @@ trait Trait { type Assoc<T = u32>; - //~^ defaults for type parameters are only allowed + //~^ ERROR defaults for type parameters are only allowed } impl Trait for () { type Assoc<T = u32> = u64; - //~^ defaults for type parameters are only allowed + //~^ ERROR defaults for type parameters are only allowed } impl Trait for u32 { type Assoc<T = u32> = T; - //~^ defaults for type parameters are only allowed + //~^ ERROR defaults for type parameters are only allowed } trait Other {} diff --git a/tests/ui/generic-const-items/assoc-const-missing-type.rs b/tests/ui/generic-const-items/assoc-const-missing-type.rs index 0c94a4262ef..dde47cf993e 100644 --- a/tests/ui/generic-const-items/assoc-const-missing-type.rs +++ b/tests/ui/generic-const-items/assoc-const-missing-type.rs @@ -14,7 +14,7 @@ impl Trait for () { //~| ERROR mismatched types const Q = ""; //~^ ERROR missing type for `const` item - //~| ERROR lifetime parameters or bounds on const `Q` do not match the trait declaration + //~| ERROR lifetime parameters or bounds on associated const `Q` do not match the trait declaration } fn main() {} diff --git a/tests/ui/generic-const-items/assoc-const-missing-type.stderr b/tests/ui/generic-const-items/assoc-const-missing-type.stderr index 5af119dffa7..9f6db575ec2 100644 --- a/tests/ui/generic-const-items/assoc-const-missing-type.stderr +++ b/tests/ui/generic-const-items/assoc-const-missing-type.stderr @@ -15,14 +15,14 @@ error: missing type for `const` item LL | const K<T> = (); | ^ help: provide a type for the associated constant: `()` -error[E0195]: lifetime parameters or bounds on const `Q` do not match the trait declaration +error[E0195]: lifetime parameters or bounds on associated const `Q` do not match the trait declaration --> $DIR/assoc-const-missing-type.rs:15:12 | LL | const Q<'a>: &'a str; - | ---- lifetimes in impl do not match this const in trait + | ---- lifetimes in impl do not match this associated const in trait ... LL | const Q = ""; - | ^ lifetimes do not match const in trait + | ^ lifetimes do not match associated const in trait error: missing type for `const` item --> $DIR/assoc-const-missing-type.rs:15:12 diff --git a/tests/ui/generic-const-items/compare-impl-item.rs b/tests/ui/generic-const-items/compare-impl-item.rs index 21c958a0abe..b301cd0dae0 100644 --- a/tests/ui/generic-const-items/compare-impl-item.rs +++ b/tests/ui/generic-const-items/compare-impl-item.rs @@ -22,7 +22,7 @@ impl<P> Trait<P> for () { const D<const N: u16>: u16 = N; //~^ ERROR const `D` has an incompatible generic parameter for trait `Trait` const E: &'static () = &(); - //~^ ERROR lifetime parameters or bounds on const `E` do not match the trait declaration + //~^ ERROR lifetime parameters or bounds on associated const `E` do not match the trait declaration const F: usize = 1024 where diff --git a/tests/ui/generic-const-items/compare-impl-item.stderr b/tests/ui/generic-const-items/compare-impl-item.stderr index 3bf28e9da60..f7e3ff6501b 100644 --- a/tests/ui/generic-const-items/compare-impl-item.stderr +++ b/tests/ui/generic-const-items/compare-impl-item.stderr @@ -1,4 +1,4 @@ -error[E0049]: const `A` has 1 type parameter but its trait declaration has 0 type parameters +error[E0049]: associated const `A` has 1 type parameter but its trait declaration has 0 type parameters --> $DIR/compare-impl-item.rs:16:13 | LL | const A: (); @@ -7,7 +7,7 @@ LL | const A: (); LL | const A<T>: () = (); | ^ found 1 type parameter -error[E0049]: const `B` has 1 const parameter but its trait declaration has 2 const parameters +error[E0049]: associated const `B` has 1 const parameter but its trait declaration has 2 const parameters --> $DIR/compare-impl-item.rs:18:13 | LL | const B<const K: u64, const Q: u64>: u64; @@ -18,7 +18,7 @@ LL | const B<const K: u64, const Q: u64>: u64; LL | const B<const K: u64>: u64 = 0; | ^^^^^^^^^^^^ found 1 const parameter -error[E0049]: const `C` has 0 type parameters but its trait declaration has 1 type parameter +error[E0049]: associated const `C` has 0 type parameters but its trait declaration has 1 type parameter --> $DIR/compare-impl-item.rs:20:13 | LL | const C<T>: T; @@ -27,7 +27,7 @@ LL | const C<T>: T; LL | const C<'a>: &'a str = ""; | ^^ found 0 type parameters -error[E0053]: const `D` has an incompatible generic parameter for trait `Trait` +error[E0053]: associated const `D` has an incompatible generic parameter for trait `Trait` --> $DIR/compare-impl-item.rs:22:13 | LL | trait Trait<P> { @@ -42,14 +42,14 @@ LL | impl<P> Trait<P> for () { LL | const D<const N: u16>: u16 = N; | ^^^^^^^^^^^^ found const parameter of type `u16` -error[E0195]: lifetime parameters or bounds on const `E` do not match the trait declaration +error[E0195]: lifetime parameters or bounds on associated const `E` do not match the trait declaration --> $DIR/compare-impl-item.rs:24:12 | LL | const E<'a>: &'a (); - | ---- lifetimes in impl do not match this const in trait + | ---- lifetimes in impl do not match this associated const in trait ... LL | const E: &'static () = &(); - | ^ lifetimes do not match const in trait + | ^ lifetimes do not match associated const in trait error[E0276]: impl has stricter requirements than trait --> $DIR/compare-impl-item.rs:29:12 diff --git a/tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.rs b/tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.rs index a7b0ca6fe4a..f2c873f3edf 100644 --- a/tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.rs +++ b/tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.rs @@ -1,6 +1,6 @@ fn main() { let xs = [13, 1, 5, 2, 3, 1, 21, 8]; let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs; - //~^ `X..` patterns in slices are experimental + //~^ ERROR `X..` patterns in slices are experimental //~| ERROR: refutable pattern } diff --git a/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem0.rs b/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem0.rs index aa2690f3777..7bd1c100dc4 100644 --- a/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem0.rs +++ b/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem0.rs @@ -8,7 +8,7 @@ fn main() { // What if we wanted to pull this apart without individually binding a, b, and c? let [first_three @ ..3, rest @ 2..] = xs; - //~^ pattern requires 2 elements but array has 8 + //~^ ERROR pattern requires 2 elements but array has 8 // This is somewhat unintuitive and makes slice patterns exceedingly verbose. // We want to stabilize half-open RangeFrom (`X..`) patterns // but without banning us from using them for a more efficient slice pattern syntax. diff --git a/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.rs b/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.rs index 60b056fbcb6..12ceaa8c878 100644 --- a/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.rs +++ b/tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.rs @@ -2,6 +2,6 @@ fn main() { let xs = [13, 1, 5, 2, 3, 1, 21, 8]; let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs; - //~^ `X..` patterns in slices are experimental + //~^ ERROR `X..` patterns in slices are experimental //~| ERROR: refutable pattern } diff --git a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.current.stderr b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.current.stderr index 7b9fd6bb4c5..c8394575e71 100644 --- a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.current.stderr +++ b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.current.stderr @@ -13,7 +13,7 @@ LL | fn projection_bound<T: for<'a> Trait<'a, Assoc = usize>>() {} | ^^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/candidate-from-env-universe-err-project.rs:53:30 + --> $DIR/candidate-from-env-universe-err-project.rs:52:30 | LL | let _higher_ranked_norm: for<'a> fn(<T as Trait<'a>>::Assoc) = |_| (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other @@ -22,7 +22,7 @@ LL | let _higher_ranked_norm: for<'a> fn(<T as Trait<'a>>::Assoc) = |_| (); found associated type `<T as Trait<'a>>::Assoc` error[E0308]: mismatched types - --> $DIR/candidate-from-env-universe-err-project.rs:53:30 + --> $DIR/candidate-from-env-universe-err-project.rs:52:30 | LL | let _higher_ranked_norm: for<'a> fn(<T as Trait<'a>>::Assoc) = |_| (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other diff --git a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.next.stderr b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.next.stderr index 6e0ec5620da..468dc3b082e 100644 --- a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.next.stderr +++ b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.next.stderr @@ -22,38 +22,20 @@ note: required by a bound in `projection_bound` LL | fn projection_bound<T: for<'a> Trait<'a, Assoc = usize>>() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `projection_bound` -error[E0271]: type mismatch resolving `<T as Trait<'a>>::Assoc == usize` - --> $DIR/candidate-from-env-universe-err-project.rs:38:24 - | -LL | projection_bound::<T>(); - | ^ type mismatch resolving `<T as Trait<'a>>::Assoc == usize` - | -note: types differ - --> $DIR/candidate-from-env-universe-err-project.rs:14:18 - | -LL | type Assoc = usize; - | ^^^^^ -note: required by a bound in `projection_bound` - --> $DIR/candidate-from-env-universe-err-project.rs:18:42 - | -LL | fn projection_bound<T: for<'a> Trait<'a, Assoc = usize>>() {} - | ^^^^^^^^^^^^^ required by this bound in `projection_bound` - error: higher-ranked subtype error - --> $DIR/candidate-from-env-universe-err-project.rs:53:30 + --> $DIR/candidate-from-env-universe-err-project.rs:52:30 | LL | let _higher_ranked_norm: for<'a> fn(<T as Trait<'a>>::Assoc) = |_| (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: higher-ranked subtype error - --> $DIR/candidate-from-env-universe-err-project.rs:53:30 + --> $DIR/candidate-from-env-universe-err-project.rs:52:30 | LL | let _higher_ranked_norm: for<'a> fn(<T as Trait<'a>>::Assoc) = |_| (); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0271, E0277. -For more information about an error, try `rustc --explain E0271`. +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.rs b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.rs index a77d87f6fa7..d70e3922382 100644 --- a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.rs +++ b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.rs @@ -36,9 +36,8 @@ fn function2<T: Trait<'static, Assoc = usize>>() { // does not use the leak check when trying the where-bound, causing us // to prefer it over the impl, resulting in a placeholder error. projection_bound::<T>(); - //[next]~^ ERROR type mismatch resolving `<T as Trait<'a>>::Assoc == usize` - //[next]~| ERROR the trait bound `for<'a> T: Trait<'a>` is not satisfied - //[current]~^^^ ERROR mismatched types + //[next]~^ ERROR the trait bound `for<'a> T: Trait<'a>` is not satisfied + //[current]~^^ ERROR mismatched types } fn function3<T: Trait<'static, Assoc = usize>>() { diff --git a/tests/ui/higher-ranked/trait-bounds/issue-95034.rs b/tests/ui/higher-ranked/trait-bounds/issue-95034.rs index 53b28c2bea4..f33469796c2 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-95034.rs +++ b/tests/ui/higher-ranked/trait-bounds/issue-95034.rs @@ -1,5 +1,6 @@ //@ check-pass -//@ compile-flags: --edition=2021 --crate-type=lib +//@ compile-flags: --crate-type=lib +//@ edition: 2021 use std::{ future::Future, diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.rs b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.rs index d84e30f4984..10bfc954a47 100644 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.rs +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.rs @@ -23,7 +23,7 @@ impl WithDefault for () { //f(()); // Going through another generic function works fine. call(f, ()); - //~^ expected a + //~^ ERROR expected a } } diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr index 64707642eeb..36264b0d997 100644 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr @@ -6,8 +6,8 @@ LL | call(f, ()); | | | required by a bound introduced by this call | - = note: expected a closure with arguments `((),)` - found a closure with arguments `(<_ as ATC<'a>>::Type,)` + = note: expected a closure with signature `for<'a> fn(<_ as ATC<'a>>::Type)` + found a closure with signature `fn(())` note: this is a known limitation of the trait solver that will be lifted in the future --> $DIR/issue-62529-3.rs:25:14 | diff --git a/tests/ui/illegal-sized-bound/regular.rs b/tests/ui/illegal-sized-bound/regular.rs index 7abd27ef983..b5a4cbf10ec 100644 --- a/tests/ui/illegal-sized-bound/regular.rs +++ b/tests/ui/illegal-sized-bound/regular.rs @@ -4,7 +4,7 @@ pub trait MutTrait { fn function(&mut self) where Self: Sized; - //~^ this has a `Sized` requirement + //~^ NOTE this has a `Sized` requirement } impl MutTrait for MutType { @@ -17,7 +17,7 @@ pub trait Trait { fn function(&self) where Self: Sized; - //~^ this has a `Sized` requirement + //~^ NOTE this has a `Sized` requirement } impl Trait for Type { diff --git a/tests/ui/impl-trait/auto-trait-contains-err.rs b/tests/ui/impl-trait/auto-trait-contains-err.rs index d7f094211d7..8a2ebe301f1 100644 --- a/tests/ui/impl-trait/auto-trait-contains-err.rs +++ b/tests/ui/impl-trait/auto-trait-contains-err.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition=2021 +//@ edition: 2021 use std::future::Future; diff --git a/tests/ui/impl-trait/call_method_ambiguous.rs b/tests/ui/impl-trait/call_method_ambiguous.rs index 8fd6f727b73..6bcafc8ce14 100644 --- a/tests/ui/impl-trait/call_method_ambiguous.rs +++ b/tests/ui/impl-trait/call_method_ambiguous.rs @@ -24,7 +24,7 @@ where fn foo(n: usize, m: &mut ()) -> impl Get + use<'_> { if n > 0 { let mut iter = foo(n - 1, m); - //[next]~^ type annotations needed + //[next]~^ ERROR type annotations needed assert_eq!(iter.get(), 1); } m diff --git a/tests/ui/impl-trait/call_method_on_inherent_impl.rs b/tests/ui/impl-trait/call_method_on_inherent_impl.rs index 17f7cad660d..0e333c3260a 100644 --- a/tests/ui/impl-trait/call_method_on_inherent_impl.rs +++ b/tests/ui/impl-trait/call_method_on_inherent_impl.rs @@ -16,7 +16,7 @@ where fn my_foo() -> impl std::fmt::Debug { if false { let x = my_foo(); - //[next]~^ type annotations needed + //[next]~^ ERROR type annotations needed x.my_debug(); } () diff --git a/tests/ui/impl-trait/call_method_on_inherent_impl_ref.rs b/tests/ui/impl-trait/call_method_on_inherent_impl_ref.rs index abe60e5e45a..4e4098b37f9 100644 --- a/tests/ui/impl-trait/call_method_on_inherent_impl_ref.rs +++ b/tests/ui/impl-trait/call_method_on_inherent_impl_ref.rs @@ -15,9 +15,9 @@ where fn my_foo() -> impl std::fmt::Debug { if false { let x = my_foo(); - //[next]~^ type annotations needed + //[next]~^ ERROR type annotations needed x.my_debug(); - //[current]~^ no method named `my_debug` found + //[current]~^ ERROR no method named `my_debug` found } () } @@ -25,7 +25,7 @@ fn my_foo() -> impl std::fmt::Debug { fn my_bar() -> impl std::fmt::Debug { if false { let x = &my_bar(); - //[next]~^ type annotations needed + //[next]~^ ERROR type annotations needed x.my_debug(); } () diff --git a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.current.stderr b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.current.stderr index c76415d8114..341262ac85b 100644 --- a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.current.stderr +++ b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.current.stderr @@ -4,7 +4,7 @@ error[E0407]: method `line_stream` is not a member of trait `X` LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `X` -error[E0049]: type `LineStream` has 0 type parameters but its trait declaration has 1 type parameter +error[E0049]: associated type `LineStream` has 0 type parameters but its trait declaration has 1 type parameter --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:25:21 | LL | type LineStream<'a, Repr> diff --git a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr index 4d72490ff95..9632d2ce624 100644 --- a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr +++ b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.next.stderr @@ -4,7 +4,7 @@ error[E0407]: method `line_stream` is not a member of trait `X` LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `X` -error[E0049]: type `LineStream` has 0 type parameters but its trait declaration has 1 type parameter +error[E0049]: associated type `LineStream` has 0 type parameters but its trait declaration has 1 type parameter --> $DIR/ice-unexpected-param-type-whensubstituting-in-region-112823.rs:25:21 | LL | type LineStream<'a, Repr> diff --git a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs index a5a37dbb210..0b507ed948a 100644 --- a/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs +++ b/tests/ui/impl-trait/ice-unexpected-param-type-whensubstituting-in-region-112823.rs @@ -27,7 +27,7 @@ impl X for Y { //~| ERROR: unconstrained opaque type type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>; fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {} - //~^ method `line_stream` is not a member of trait `X` + //~^ ERROR method `line_stream` is not a member of trait `X` //[current]~^^ ERROR `()` is not a future //[next]~^^^ ERROR type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> == ()` //[next]~| ERROR type mismatch resolving `<Y as X>::LineStreamFut<'a, Repr> normalizes-to _` diff --git a/tests/ui/impl-trait/impl-generic-mismatch.rs b/tests/ui/impl-trait/impl-generic-mismatch.rs index fb8bde0d081..f05e01716c3 100644 --- a/tests/ui/impl-trait/impl-generic-mismatch.rs +++ b/tests/ui/impl-trait/impl-generic-mismatch.rs @@ -6,7 +6,7 @@ trait Foo { impl Foo for () { fn foo<U: Debug>(&self, _: &U) { } - //~^ Error method `foo` has incompatible signature for trait + //~^ ERROR method `foo` has incompatible signature for trait } trait Bar { @@ -15,7 +15,7 @@ trait Bar { impl Bar for () { fn bar(&self, _: &impl Debug) { } - //~^ Error method `bar` has incompatible signature for trait + //~^ ERROR method `bar` has incompatible signature for trait } trait Baz { @@ -24,7 +24,7 @@ trait Baz { impl Baz for () { fn baz<T: Debug>(&self, _: &impl Debug, _: &T) { } - //~^ Error method `baz` has incompatible signature for trait + //~^ ERROR method `baz` has incompatible signature for trait } // With non-local trait (#49841): @@ -35,7 +35,7 @@ struct X; impl Hash for X { fn hash(&self, hasher: &mut impl Hasher) {} - //~^ Error method `hash` has incompatible signature for trait + //~^ ERROR method `hash` has incompatible signature for trait } fn main() {} diff --git a/tests/ui/impl-trait/implicit-capture-late.rs b/tests/ui/impl-trait/implicit-capture-late.rs index 13cbcd66f8d..57a00357c71 100644 --- a/tests/ui/impl-trait/implicit-capture-late.rs +++ b/tests/ui/impl-trait/implicit-capture-late.rs @@ -6,7 +6,7 @@ use std::ops::Deref; -fn foo(x: Vec<i32>) -> Box<dyn for<'a> Deref<Target = impl ?Sized>> { //~ ['a: o] +fn foo(x: Vec<i32>) -> Box<dyn for<'a> Deref<Target = impl ?Sized>> { //~ ERROR ['a: o] //~^ ERROR cannot capture higher-ranked lifetime Box::new(x) } diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err.rs b/tests/ui/impl-trait/in-trait/default-body-type-err.rs index ac7a50a365e..0cd59bf0feb 100644 --- a/tests/ui/impl-trait/in-trait/default-body-type-err.rs +++ b/tests/ui/impl-trait/in-trait/default-body-type-err.rs @@ -2,7 +2,7 @@ use std::ops::Deref; pub trait Foo { fn lol(&self) -> impl Deref<Target = String> { - //~^ type mismatch resolving `<&i32 as Deref>::Target == String` + //~^ ERROR type mismatch resolving `<&i32 as Deref>::Target == String` &1i32 } } diff --git a/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr b/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr index fc3efb44ac7..a9dfac274d5 100644 --- a/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr +++ b/tests/ui/impl-trait/in-trait/doesnt-satisfy.stderr @@ -6,11 +6,11 @@ LL | fn bar() -> () {} | = help: the trait `std::fmt::Display` is not implemented for `()` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `Foo::{synthetic#0}` +note: required by a bound in `Foo::{anon_assoc#0}` --> $DIR/doesnt-satisfy.rs:2:22 | LL | fn bar() -> impl std::fmt::Display; - | ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::{synthetic#0}` + | ^^^^^^^^^^^^^^^^^ required by this bound in `Foo::{anon_assoc#0}` error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/dump.rs b/tests/ui/impl-trait/in-trait/dump.rs index 20b0e60702f..da3cfd099b5 100644 --- a/tests/ui/impl-trait/in-trait/dump.rs +++ b/tests/ui/impl-trait/in-trait/dump.rs @@ -8,7 +8,7 @@ trait Foo { } fn hello<'s, T: Foo>(x: &'s T) -> impl Sized + use<'s, T> { -//~^ ERROR <T as Foo>::{synthetic#0}<'s/#1> +//~^ ERROR <T as Foo>::{anon_assoc#0}<'s/#1> x.hello() } diff --git a/tests/ui/impl-trait/in-trait/dump.stderr b/tests/ui/impl-trait/in-trait/dump.stderr index 95805840385..15b6f186ced 100644 --- a/tests/ui/impl-trait/in-trait/dump.stderr +++ b/tests/ui/impl-trait/in-trait/dump.stderr @@ -1,4 +1,4 @@ -error: <T as Foo>::{synthetic#0}<'s/#1> +error: <T as Foo>::{anon_assoc#0}<'s/#1> --> $DIR/dump.rs:10:35 | LL | fn hello<'s, T: Foo>(x: &'s T) -> impl Sized + use<'s, T> { diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr index 5cb80386b35..6571ce2d5f0 100644 --- a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr +++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.stderr @@ -14,11 +14,11 @@ LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> { | ^^^^^^^^^^^^ the trait `Foo<char>` is not implemented for `impl Foo<u8>` | = help: the trait `Foo<char>` is implemented for `Bar` -note: required by a bound in `Foo::{synthetic#0}` +note: required by a bound in `Foo::{anon_assoc#0}` --> $DIR/return-dont-satisfy-bounds.rs:2:30 | LL | fn foo<F2>(self) -> impl Foo<T>; - | ^^^^^^ required by this bound in `Foo::{synthetic#0}` + | ^^^^^^ required by this bound in `Foo::{anon_assoc#0}` error[E0277]: the trait bound `Bar: Foo<u8>` is not satisfied --> $DIR/return-dont-satisfy-bounds.rs:8:34 diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs index 7a3a59d37c6..65c4542e235 100644 --- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs +++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.rs @@ -6,7 +6,7 @@ impl Extend for () { fn extend<'a: 'a>(s: &'a str) -> (Option<&'static &'a ()>, &'static str) where 'a: 'static, - //~^ impl has stricter requirements than trait + //~^ ERROR impl has stricter requirements than trait { (None, s) } diff --git a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs index ab21dae7dc5..7dc747bffba 100644 --- a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs +++ b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs @@ -8,7 +8,7 @@ pub trait Iterable { impl<'a, I: 'a + Iterable> Iterable for &'a I { type Item = u32; - //~^ ERROR lifetime parameters or bounds on type `Item` do not match the trait declaration + //~^ ERROR lifetime parameters or bounds on associated type `Item` do not match the trait declaration fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missing>> {} //~^ ERROR binding for associated type `Item` references lifetime `'missing` diff --git a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr index d8a2eef94a1..eaa320455bb 100644 --- a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr +++ b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr @@ -12,17 +12,17 @@ LL | fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missin | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0195]: lifetime parameters or bounds on type `Item` do not match the trait declaration +error[E0195]: lifetime parameters or bounds on associated type `Item` do not match the trait declaration --> $DIR/span-bug-issue-121457.rs:10:14 | LL | type Item<'a> - | ---- lifetimes in impl do not match this type in trait + | ---- lifetimes in impl do not match this associated type in trait LL | where LL | Self: 'a; | -- this bound might be missing in the impl ... LL | type Item = u32; - | ^ lifetimes do not match type in trait + | ^ lifetimes do not match associated type in trait error[E0277]: `()` is not an iterator --> $DIR/span-bug-issue-121457.rs:13:23 diff --git a/tests/ui/impl-trait/in-trait/variance.rs b/tests/ui/impl-trait/in-trait/variance.rs index c0f569c690a..f0b8c05b2d7 100644 --- a/tests/ui/impl-trait/in-trait/variance.rs +++ b/tests/ui/impl-trait/in-trait/variance.rs @@ -4,22 +4,22 @@ trait Foo<'i> { fn implicit_capture_early<'a: 'a>() -> impl Sized {} - //~^ [Self: o, 'i: o, 'a: *, 'i: o, 'a: o] + //~^ ERROR [Self: o, 'i: o, 'a: *, 'i: o, 'a: o] fn explicit_capture_early<'a: 'a>() -> impl Sized + use<'i, 'a, Self> {} - //~^ [Self: o, 'i: o, 'a: *, 'i: o, 'a: o] + //~^ ERROR [Self: o, 'i: o, 'a: *, 'i: o, 'a: o] fn not_captured_early<'a: 'a>() -> impl Sized + use<'i, Self> {} - //~^ [Self: o, 'i: o, 'a: *, 'i: o] + //~^ ERROR [Self: o, 'i: o, 'a: *, 'i: o] fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {} - //~^ [Self: o, 'i: o, 'i: o, 'a: o] + //~^ ERROR [Self: o, 'i: o, 'i: o, 'a: o] fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + use<'i, 'a, Self> {} - //~^ [Self: o, 'i: o, 'i: o, 'a: o] + //~^ ERROR [Self: o, 'i: o, 'i: o, 'a: o] fn not_captured_late<'a>(_: &'a ()) -> impl Sized + use<'i, Self> {} - //~^ [Self: o, 'i: o, 'i: o] + //~^ ERROR [Self: o, 'i: o, 'i: o] } fn main() {} diff --git a/tests/ui/impl-trait/issues/issue-54600.rs b/tests/ui/impl-trait/issues/issue-54600.rs index 62bfd7cd968..b349c47328b 100644 --- a/tests/ui/impl-trait/issues/issue-54600.rs +++ b/tests/ui/impl-trait/issues/issue-54600.rs @@ -2,6 +2,6 @@ use std::fmt::Debug; fn main() { let x: Option<impl Debug> = Some(44_u32); - //~^ `impl Trait` is not allowed in the type of variable bindings + //~^ ERROR `impl Trait` is not allowed in the type of variable bindings println!("{:?}", x); } diff --git a/tests/ui/impl-trait/issues/issue-54840.rs b/tests/ui/impl-trait/issues/issue-54840.rs index 65257d2f7f1..85372863035 100644 --- a/tests/ui/impl-trait/issues/issue-54840.rs +++ b/tests/ui/impl-trait/issues/issue-54840.rs @@ -3,5 +3,5 @@ use std::ops::Add; fn main() { let i: i32 = 0; let j: &impl Add = &i; - //~^ `impl Trait` is not allowed in the type of variable bindings + //~^ ERROR `impl Trait` is not allowed in the type of variable bindings } diff --git a/tests/ui/impl-trait/issues/issue-58504.rs b/tests/ui/impl-trait/issues/issue-58504.rs index 856e1297e58..57119671680 100644 --- a/tests/ui/impl-trait/issues/issue-58504.rs +++ b/tests/ui/impl-trait/issues/issue-58504.rs @@ -8,5 +8,5 @@ fn mk_gen() -> impl Coroutine<Return=!, Yield=()> { fn main() { let gens: [impl Coroutine<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ]; - //~^ `impl Trait` is not allowed in the type of variable bindings + //~^ ERROR `impl Trait` is not allowed in the type of variable bindings } diff --git a/tests/ui/impl-trait/issues/issue-58956.rs b/tests/ui/impl-trait/issues/issue-58956.rs index a59de2379d8..8fb69aca9bc 100644 --- a/tests/ui/impl-trait/issues/issue-58956.rs +++ b/tests/ui/impl-trait/issues/issue-58956.rs @@ -5,9 +5,9 @@ impl Lam for B {} pub struct Wrap<T>(T); const _A: impl Lam = { - //~^ `impl Trait` is not allowed in const types + //~^ ERROR `impl Trait` is not allowed in const types let x: Wrap<impl Lam> = Wrap(B); - //~^ `impl Trait` is not allowed in the type of variable bindings + //~^ ERROR `impl Trait` is not allowed in the type of variable bindings x.0 }; diff --git a/tests/ui/impl-trait/issues/issue-70971.rs b/tests/ui/impl-trait/issues/issue-70971.rs index 2f2c2e8f441..e7b51e0e6db 100644 --- a/tests/ui/impl-trait/issues/issue-70971.rs +++ b/tests/ui/impl-trait/issues/issue-70971.rs @@ -1,4 +1,4 @@ fn main() { let x : (impl Copy,) = (true,); - //~^ `impl Trait` is not allowed in the type of variable bindings + //~^ ERROR `impl Trait` is not allowed in the type of variable bindings } diff --git a/tests/ui/impl-trait/issues/issue-79099.rs b/tests/ui/impl-trait/issues/issue-79099.rs index 757e61fb631..c2bad59045b 100644 --- a/tests/ui/impl-trait/issues/issue-79099.rs +++ b/tests/ui/impl-trait/issues/issue-79099.rs @@ -1,8 +1,8 @@ struct Bug { V1: [(); { let f: impl core::future::Future<Output = u8> = async { 1 }; - //~^ `impl Trait` is not allowed in the type of variable bindings - //~| expected identifier + //~^ ERROR `impl Trait` is not allowed in the type of variable bindings + //~| ERROR expected identifier 1 }], } diff --git a/tests/ui/impl-trait/issues/issue-84919.rs b/tests/ui/impl-trait/issues/issue-84919.rs index 0f911ba23ae..1012024f21e 100644 --- a/tests/ui/impl-trait/issues/issue-84919.rs +++ b/tests/ui/impl-trait/issues/issue-84919.rs @@ -3,7 +3,7 @@ impl Trait for () {} fn foo<'a: 'a>() { let _x: impl Trait = (); - //~^ `impl Trait` is not allowed in the type of variable bindings + //~^ ERROR `impl Trait` is not allowed in the type of variable bindings } fn main() {} diff --git a/tests/ui/impl-trait/issues/issue-86642.rs b/tests/ui/impl-trait/issues/issue-86642.rs index 74be8779d44..2feb045abee 100644 --- a/tests/ui/impl-trait/issues/issue-86642.rs +++ b/tests/ui/impl-trait/issues/issue-86642.rs @@ -1,5 +1,5 @@ static x: impl Fn(&str) -> Result<&str, ()> = move |source| { - //~^ `impl Trait` is not allowed in static types + //~^ ERROR `impl Trait` is not allowed in static types let res = (move |source| Ok(source))(source); let res = res.or((move |source| Ok(source))(source)); res diff --git a/tests/ui/impl-trait/issues/issue-87295.rs b/tests/ui/impl-trait/issues/issue-87295.rs index a765e14884b..d8d1b462ca3 100644 --- a/tests/ui/impl-trait/issues/issue-87295.rs +++ b/tests/ui/impl-trait/issues/issue-87295.rs @@ -14,5 +14,5 @@ impl<F> Struct<F> { fn main() { let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(()); - //~^ `impl Trait` is not allowed in the type of variable bindings + //~^ ERROR `impl Trait` is not allowed in the type of variable bindings } diff --git a/tests/ui/impl-trait/issues/issue-99348-impl-compatibility.rs b/tests/ui/impl-trait/issues/issue-99348-impl-compatibility.rs index e19230b44b4..4937794b040 100644 --- a/tests/ui/impl-trait/issues/issue-99348-impl-compatibility.rs +++ b/tests/ui/impl-trait/issues/issue-99348-impl-compatibility.rs @@ -6,7 +6,7 @@ type Tait = impl Sized; impl Foo for Concrete { type Item = Concrete; - //~^ type mismatch resolving + //~^ ERROR type mismatch resolving } impl Bar for Concrete { diff --git a/tests/ui/impl-trait/method-resolution4.rs b/tests/ui/impl-trait/method-resolution4.rs index 5c8813ed792..90e7850cad5 100644 --- a/tests/ui/impl-trait/method-resolution4.rs +++ b/tests/ui/impl-trait/method-resolution4.rs @@ -11,7 +11,7 @@ fn foo(b: bool) -> impl Iterator<Item = ()> { if b { foo(false).next().unwrap(); - //[next]~^ type annotations needed + //[next]~^ ERROR type annotations needed } std::iter::empty() } diff --git a/tests/ui/impl-trait/nested_impl_trait.rs b/tests/ui/impl-trait/nested_impl_trait.rs index 760102794c3..3e985b5dcca 100644 --- a/tests/ui/impl-trait/nested_impl_trait.rs +++ b/tests/ui/impl-trait/nested_impl_trait.rs @@ -9,7 +9,7 @@ fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x } fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {} //~^ ERROR nested `impl Trait` is not allowed -//~| `impl Trait` is not allowed in `fn` pointer +//~| ERROR `impl Trait` is not allowed in `fn` pointer fn bad_in_arg_position(_: impl Into<impl Debug>) { } //~^ ERROR nested `impl Trait` is not allowed diff --git a/tests/ui/impl-trait/recursive-in-exhaustiveness.current.stderr b/tests/ui/impl-trait/recursive-in-exhaustiveness.current.stderr new file mode 100644 index 00000000000..42dbc7c9160 --- /dev/null +++ b/tests/ui/impl-trait/recursive-in-exhaustiveness.current.stderr @@ -0,0 +1,56 @@ +warning: function cannot return without recursing + --> $DIR/recursive-in-exhaustiveness.rs:17:1 + | +LL | fn build<T>(x: T) -> impl Sized { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing +LL | +LL | let (x,) = (build(x),); + | -------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + = note: `#[warn(unconditional_recursion)]` on by default + +warning: function cannot return without recursing + --> $DIR/recursive-in-exhaustiveness.rs:27:1 + | +LL | fn build2<T>(x: T) -> impl Sized { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing +... +LL | let (x,) = (build2(x),); + | --------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error[E0720]: cannot resolve opaque type + --> $DIR/recursive-in-exhaustiveness.rs:27:23 + | +LL | fn build2<T>(x: T) -> impl Sized { + | ^^^^^^^^^^ recursive opaque type +... +LL | (build2(x),) + | ------------ returning here with type `(impl Sized,)` + +warning: function cannot return without recursing + --> $DIR/recursive-in-exhaustiveness.rs:40:1 + | +LL | fn build3<T>(x: T) -> impl Sized { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing +LL | +LL | let (x,) = (build3((x,)),); + | ------------ recursive call site + | + = help: a `loop` may express intention better if this is on purpose + +error[E0792]: expected generic type parameter, found `(T,)` + --> $DIR/recursive-in-exhaustiveness.rs:49:5 + | +LL | fn build3<T>(x: T) -> impl Sized { + | - this generic parameter must be used with a generic type parameter +... +LL | build3(x) + | ^^^^^^^^^ + +error: aborting due to 2 previous errors; 3 warnings emitted + +Some errors have detailed explanations: E0720, E0792. +For more information about an error, try `rustc --explain E0720`. diff --git a/tests/ui/impl-trait/recursive-in-exhaustiveness.next.stderr b/tests/ui/impl-trait/recursive-in-exhaustiveness.next.stderr new file mode 100644 index 00000000000..4c3d5aa8fb8 --- /dev/null +++ b/tests/ui/impl-trait/recursive-in-exhaustiveness.next.stderr @@ -0,0 +1,80 @@ +error[E0284]: type annotations needed: cannot satisfy `impl Sized == _` + --> $DIR/recursive-in-exhaustiveness.rs:19:17 + | +LL | let (x,) = (build(x),); + | ^^^^^^^^ cannot satisfy `impl Sized == _` + +error[E0271]: type mismatch resolving `build2<(_,)>::{opaque#0} normalizes-to _` + --> $DIR/recursive-in-exhaustiveness.rs:31:6 + | +LL | (build2(x),) + | ^^^^^^^^^ types differ + +error[E0271]: type mismatch resolving `build2<(_,)>::{opaque#0} normalizes-to _` + --> $DIR/recursive-in-exhaustiveness.rs:31:5 + | +LL | (build2(x),) + | ^^^^^^^^^^^^ types differ + +error[E0277]: the size for values of type `(impl Sized,)` cannot be known at compilation time + --> $DIR/recursive-in-exhaustiveness.rs:31:5 + | +LL | (build2(x),) + | ^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(impl Sized,)` + = note: tuples must have a statically known size to be initialized + +error[E0271]: type mismatch resolving `build3<(T,)>::{opaque#0} normalizes-to _` + --> $DIR/recursive-in-exhaustiveness.rs:42:17 + | +LL | let (x,) = (build3((x,)),); + | ^^^^^^^^^^^^ types differ + +error[E0277]: the size for values of type `(impl Sized,)` cannot be known at compilation time + --> $DIR/recursive-in-exhaustiveness.rs:42:16 + | +LL | let (x,) = (build3((x,)),); + | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(impl Sized,)` + = note: tuples must have a statically known size to be initialized + +error[E0308]: mismatched types + --> $DIR/recursive-in-exhaustiveness.rs:42:16 + | +LL | fn build3<T>(x: T) -> impl Sized { + | ---------- the found opaque type +LL | +LL | let (x,) = (build3((x,)),); + | ^^^^^^^^^^^^^^^ types differ + | + = note: expected type `_` + found tuple `(impl Sized,)` + +error[E0271]: type mismatch resolving `build3<(T,)>::{opaque#0} normalizes-to _` + --> $DIR/recursive-in-exhaustiveness.rs:42:17 + | +LL | let (x,) = (build3((x,)),); + | ^^^^^^^^^^^^ types differ + | + = note: the return type of a function must have a statically known size + +error[E0271]: type mismatch resolving `build3<(T,)>::{opaque#0} normalizes-to _` + --> $DIR/recursive-in-exhaustiveness.rs:42:16 + | +LL | let (x,) = (build3((x,)),); + | ^^^^^^^^^^^^^^^ types differ + +error[E0271]: type mismatch resolving `build3<(T,)>::{opaque#0} normalizes-to _` + --> $DIR/recursive-in-exhaustiveness.rs:42:17 + | +LL | let (x,) = (build3((x,)),); + | ^^^^^^^^^^^^ types differ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 10 previous errors + +Some errors have detailed explanations: E0271, E0277, E0284, E0308. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/impl-trait/recursive-in-exhaustiveness.rs b/tests/ui/impl-trait/recursive-in-exhaustiveness.rs new file mode 100644 index 00000000000..58944533686 --- /dev/null +++ b/tests/ui/impl-trait/recursive-in-exhaustiveness.rs @@ -0,0 +1,53 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +// Test several spicy non-trivial recursive opaque definitions inferred from HIR typeck +// don't cause stack overflows in exhaustiveness code, which currently reveals opaques +// manually in a way that is not overflow aware. +// +// These should eventually be outright rejected, but today (some) non-trivial recursive +// opaque definitions are accepted, and changing that requires an FCP, so for now just +// make sure we don't stack overflow :^) + +// Opaque<T> = Opaque<Opaque<T>> +// +// We unfortunately accept this today, and due to how opaque type relating is implemented +// in the NLL type relation, this defines `Opaque<T> = T`. +fn build<T>(x: T) -> impl Sized { + //[current]~^ WARN function cannot return without recursing + let (x,) = (build(x),); + //[next]~^ ERROR type annotations needed + build(x) +} + +// Opaque<T> = (Opaque<T>,) +// +// Not allowed today. Detected as recursive. +fn build2<T>(x: T) -> impl Sized { + //[current]~^ ERROR cannot resolve opaque type + //[current]~| WARN function cannot return without recursing + let (x,) = (build2(x),); + (build2(x),) + //[next]~^ ERROR type mismatch resolving + //[next]~| ERROR type mismatch resolving + //[next]~| ERROR the size for values of type +} + +// Opaque<T> = Opaque<(T,)> +// +// Not allowed today. Detected as not defining. +fn build3<T>(x: T) -> impl Sized { + //[current]~^ WARN function cannot return without recursing + let (x,) = (build3((x,)),); + //[next]~^ ERROR type mismatch resolving + //[next]~| ERROR type mismatch resolving + //[next]~| ERROR type mismatch resolving + //[next]~| ERROR type mismatch resolving + //[next]~| ERROR the size for values of type + //[next]~| ERROR mismatched types + build3(x) + //[current]~^ ERROR expected generic type parameter, found `(T,)` +} + +fn main() {} diff --git a/tests/ui/impl-trait/variance.rs b/tests/ui/impl-trait/variance.rs index bde3a886a4d..e73e0c623aa 100644 --- a/tests/ui/impl-trait/variance.rs +++ b/tests/ui/impl-trait/variance.rs @@ -9,15 +9,15 @@ trait Captures<'a> {} impl<T> Captures<'_> for T {} fn not_captured_early<'a: 'a>() -> impl Sized {} -//[old]~^ ['a: *] -//[e2024]~^^ ['a: *, 'a: o] +//[old]~^ ERROR ['a: *] +//[e2024]~^^ ERROR ['a: *, 'a: o] -fn captured_early<'a: 'a>() -> impl Sized + Captures<'a> {} //~ ['a: *, 'a: o] +fn captured_early<'a: 'a>() -> impl Sized + Captures<'a> {} //~ ERROR ['a: *, 'a: o] fn not_captured_late<'a>(_: &'a ()) -> impl Sized {} -//[old]~^ [] -//[e2024]~^^ ['a: o] +//[old]~^ ERROR [] +//[e2024]~^^ ERROR ['a: o] -fn captured_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} //~ ['a: o] +fn captured_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} //~ ERROR ['a: o] fn main() {} diff --git a/tests/ui/implied-bounds/implied-bounds-on-trait-hierarchy-1.rs b/tests/ui/implied-bounds/implied-bounds-on-trait-hierarchy-1.rs index b532a110a1c..83803646a2d 100644 --- a/tests/ui/implied-bounds/implied-bounds-on-trait-hierarchy-1.rs +++ b/tests/ui/implied-bounds/implied-bounds-on-trait-hierarchy-1.rs @@ -32,7 +32,7 @@ fn main() { { let x = "Hello World".to_string(); subs_to_soup((x.as_str(), &mut d)); - //~^ does not live long enough + //~^ ERROR does not live long enough } println!("{}", d); } diff --git a/tests/ui/implied-bounds/issue-100690.stderr b/tests/ui/implied-bounds/issue-100690.stderr index 4964dccd551..d00895d8fc9 100644 --- a/tests/ui/implied-bounds/issue-100690.stderr +++ b/tests/ui/implied-bounds/issue-100690.stderr @@ -6,8 +6,8 @@ LL | real_dispatch(f) | | | required by a bound introduced by this call | - = note: expected a closure with arguments `(&mut UIView<'a, _>,)` - found a closure with arguments `(&mut UIView<'_, _>,)` + = note: expected a closure with signature `for<'a, 'b> fn(&'a mut UIView<'b, _>)` + found a closure with signature `fn(&mut UIView<'a, _>)` note: required by a bound in `real_dispatch` --> $DIR/issue-100690.rs:8:8 | diff --git a/tests/ui/implied-bounds/overflow.rs b/tests/ui/implied-bounds/overflow.rs new file mode 100644 index 00000000000..7c36998dd4d --- /dev/null +++ b/tests/ui/implied-bounds/overflow.rs @@ -0,0 +1,11 @@ +trait Tailed<'a>: 'a { + type Tail: Tailed<'a>; +} + +struct List<'a, T: Tailed<'a>> { + //~^ ERROR overflow computing implied lifetime bounds for `List` + next: Box<List<'a, T::Tail>>, + node: &'a T, +} + +fn main() {} diff --git a/tests/ui/implied-bounds/overflow.stderr b/tests/ui/implied-bounds/overflow.stderr new file mode 100644 index 00000000000..2e5a9ab141c --- /dev/null +++ b/tests/ui/implied-bounds/overflow.stderr @@ -0,0 +1,8 @@ +error: overflow computing implied lifetime bounds for `List` + --> $DIR/overflow.rs:5:1 + | +LL | struct List<'a, T: Tailed<'a>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/implied-bounds/sod_service_chain.rs b/tests/ui/implied-bounds/sod_service_chain.rs index 032483e1be4..73dce2fce24 100644 --- a/tests/ui/implied-bounds/sod_service_chain.rs +++ b/tests/ui/implied-bounds/sod_service_chain.rs @@ -27,17 +27,17 @@ pub struct ServiceChainBuilder<P: Service, S: Service<Input = P::Output>> { } impl<P: Service, S: Service<Input = P::Output>> ServiceChainBuilder<P, S> { pub fn next<NS: Service<Input = S::Output>>( - //~^ the associated type + //~^ ERROR the associated type + //~| ERROR the associated type + //~| ERROR the associated type //~| the associated type //~| the associated type //~| the associated type - //~| the associated type - //~| the associated type - //~| may not live long enough + //~| ERROR may not live long enough self, ) -> ServiceChainBuilder<ServiceChain<P, S>, NS> { - //~^ the associated type - //~| the associated type + //~^ ERROR the associated type + //~| ERROR the associated type //~| the associated type //~| the associated type panic!(); diff --git a/tests/ui/imports/import-from-missing.rs b/tests/ui/imports/import-from-missing.rs index 8eae700208f..1dcc3a90133 100644 --- a/tests/ui/imports/import-from-missing.rs +++ b/tests/ui/imports/import-from-missing.rs @@ -1,5 +1,5 @@ use spam::{ham, eggs}; //~ ERROR unresolved import `spam::eggs` [E0432] - //~^ no `eggs` in `spam` + //~^ NOTE no `eggs` in `spam` mod spam { pub fn ham() { } diff --git a/tests/ui/imports/import2.rs b/tests/ui/imports/import2.rs index 036d6bc07e2..731ccb6f41c 100644 --- a/tests/ui/imports/import2.rs +++ b/tests/ui/imports/import2.rs @@ -1,5 +1,5 @@ use baz::zed::bar; //~ ERROR unresolved import `baz::zed` [E0432] - //~^ could not find `zed` in `baz` + //~^ NOTE could not find `zed` in `baz` mod baz {} mod zed { diff --git a/tests/ui/imports/issue-13404.rs b/tests/ui/imports/issue-13404.rs index c5af827d50c..b6e5804abac 100644 --- a/tests/ui/imports/issue-13404.rs +++ b/tests/ui/imports/issue-13404.rs @@ -1,6 +1,6 @@ use a::f; use b::f; //~ ERROR: unresolved import `b::f` [E0432] - //~^ no `f` in `b` + //~^ NOTE no `f` in `b` mod a { pub fn f() {} } mod b { } diff --git a/tests/ui/imports/issue-2937.rs b/tests/ui/imports/issue-2937.rs index 335df5c07e2..7ca6ffb479e 100644 --- a/tests/ui/imports/issue-2937.rs +++ b/tests/ui/imports/issue-2937.rs @@ -1,5 +1,5 @@ use m::f as x; //~ ERROR unresolved import `m::f` [E0432] - //~^ no `f` in `m` + //~^ NOTE no `f` in `m` mod m {} diff --git a/tests/ui/imports/issue-32833.rs b/tests/ui/imports/issue-32833.rs index 379eedde726..8f82eb68c1f 100644 --- a/tests/ui/imports/issue-32833.rs +++ b/tests/ui/imports/issue-32833.rs @@ -1,5 +1,5 @@ use bar::Foo; //~ ERROR unresolved import `bar::Foo` [E0432] - //~^ no `Foo` in `bar` + //~^ NOTE no `Foo` in `bar` mod bar { use Foo; } diff --git a/tests/ui/imports/issue-8208.rs b/tests/ui/imports/issue-8208.rs index 1c566938f9d..997d4d227b3 100644 --- a/tests/ui/imports/issue-8208.rs +++ b/tests/ui/imports/issue-8208.rs @@ -1,14 +1,14 @@ use self::*; //~ ERROR: unresolved import `self::*` [E0432] - //~^ cannot glob-import a module into itself + //~^ NOTE cannot glob-import a module into itself mod foo { use foo::*; //~ ERROR: unresolved import `foo::*` [E0432] - //~^ cannot glob-import a module into itself + //~^ NOTE cannot glob-import a module into itself mod bar { use super::bar::*; //~^ ERROR: unresolved import `super::bar::*` [E0432] - //~| cannot glob-import a module into itself + //~| NOTE cannot glob-import a module into itself } } diff --git a/tests/ui/imports/redundant-import-extern-prelude.rs b/tests/ui/imports/redundant-import-extern-prelude.rs index 0064eaa9318..b573b8fc610 100644 --- a/tests/ui/imports/redundant-import-extern-prelude.rs +++ b/tests/ui/imports/redundant-import-extern-prelude.rs @@ -5,7 +5,8 @@ // See also the discussion in <https://github.com/rust-lang/rust/pull/122954>. -//@ compile-flags: --extern aux_issue_121915 --edition 2018 +//@ compile-flags: --extern aux_issue_121915 +//@ edition: 2018 //@ aux-build: aux-issue-121915.rs #[deny(redundant_imports)] diff --git a/tests/ui/imports/redundant-import-extern-prelude.stderr b/tests/ui/imports/redundant-import-extern-prelude.stderr index 6d2518c1284..06cce7e1725 100644 --- a/tests/ui/imports/redundant-import-extern-prelude.stderr +++ b/tests/ui/imports/redundant-import-extern-prelude.stderr @@ -1,11 +1,11 @@ error: the item `aux_issue_121915` is imported redundantly - --> $DIR/redundant-import-extern-prelude.rs:14:9 + --> $DIR/redundant-import-extern-prelude.rs:15:9 | LL | use aux_issue_121915; | ^^^^^^^^^^^^^^^^ the item `aux_issue_121915` is already defined by the extern prelude | note: the lint level is defined here - --> $DIR/redundant-import-extern-prelude.rs:11:8 + --> $DIR/redundant-import-extern-prelude.rs:12:8 | LL | #[deny(redundant_imports)] | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/imports/redundant-import-issue-121915-2015.rs b/tests/ui/imports/redundant-import-issue-121915-2015.rs index dc499bc40b6..7108776757e 100644 --- a/tests/ui/imports/redundant-import-issue-121915-2015.rs +++ b/tests/ui/imports/redundant-import-issue-121915-2015.rs @@ -1,4 +1,5 @@ -//@ compile-flags: --extern aux_issue_121915 --edition 2015 +//@ compile-flags: --extern aux_issue_121915 +//@ edition: 2015 //@ aux-build: aux-issue-121915.rs extern crate aux_issue_121915; diff --git a/tests/ui/imports/redundant-import-issue-121915-2015.stderr b/tests/ui/imports/redundant-import-issue-121915-2015.stderr index f4e9f604896..367a4f1cd15 100644 --- a/tests/ui/imports/redundant-import-issue-121915-2015.stderr +++ b/tests/ui/imports/redundant-import-issue-121915-2015.stderr @@ -1,5 +1,5 @@ error: the item `aux_issue_121915` is imported redundantly - --> $DIR/redundant-import-issue-121915-2015.rs:8:9 + --> $DIR/redundant-import-issue-121915-2015.rs:9:9 | LL | extern crate aux_issue_121915; | ------------------------------ the item `aux_issue_121915` is already imported here @@ -8,7 +8,7 @@ LL | use aux_issue_121915; | ^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/redundant-import-issue-121915-2015.rs:6:8 + --> $DIR/redundant-import-issue-121915-2015.rs:7:8 | LL | #[deny(redundant_imports)] | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/imports/suggest-remove-issue-121315.rs b/tests/ui/imports/suggest-remove-issue-121315.rs index ee3ceb6e3a3..3c036b843fd 100644 --- a/tests/ui/imports/suggest-remove-issue-121315.rs +++ b/tests/ui/imports/suggest-remove-issue-121315.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2021 +//@ edition: 2021 #![deny(unused_imports, redundant_imports)] #![allow(dead_code)] diff --git a/tests/ui/inline-const/in-pat-recovery.rs b/tests/ui/inline-const/in-pat-recovery.rs index 0d912af0981..e9e60116ff4 100644 --- a/tests/ui/inline-const/in-pat-recovery.rs +++ b/tests/ui/inline-const/in-pat-recovery.rs @@ -4,7 +4,7 @@ fn main() { match 1 { const { 1 + 7 } => {} - //~^ `inline_const_pat` has been removed + //~^ ERROR `inline_const_pat` has been removed 2 => {} _ => {} } diff --git a/tests/ui/inline-const/using-late-bound-from-closure.rs b/tests/ui/inline-const/using-late-bound-from-closure.rs index 2b12b2e26a2..cb3dfd95739 100644 --- a/tests/ui/inline-const/using-late-bound-from-closure.rs +++ b/tests/ui/inline-const/using-late-bound-from-closure.rs @@ -7,7 +7,7 @@ fn foo() { const { let awd = (); let _: &'a () = &awd; - //~^ `awd` does not live long enough + //~^ ERROR `awd` does not live long enough }; b }; diff --git a/tests/ui/intrinsics/always-extern.rs b/tests/ui/intrinsics/always-extern.rs deleted file mode 100644 index 0afd8353455..00000000000 --- a/tests/ui/intrinsics/always-extern.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(intrinsics)] - -trait Foo { - extern "rust-intrinsic" fn foo(&self); //~ ERROR intrinsic must -} - -impl Foo for () { - extern "rust-intrinsic" fn foo(&self) { //~ ERROR intrinsic must - } -} - -extern "rust-intrinsic" fn hello() {//~ ERROR intrinsic must - //~^ ERROR unrecognized intrinsic function: `hello` -} - -fn main() { -} diff --git a/tests/ui/intrinsics/always-extern.stderr b/tests/ui/intrinsics/always-extern.stderr deleted file mode 100644 index 44b889c6faa..00000000000 --- a/tests/ui/intrinsics/always-extern.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/always-extern.rs:4:32 - | -LL | extern "rust-intrinsic" fn foo(&self); - | ^^^ - -error[E0093]: unrecognized intrinsic function: `hello` - --> $DIR/always-extern.rs:12:28 - | -LL | extern "rust-intrinsic" fn hello() { - | ^^^^^ unrecognized intrinsic - | - = help: if you're adding an intrinsic, be sure to update `check_intrinsic_type` - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/always-extern.rs:8:43 - | -LL | extern "rust-intrinsic" fn foo(&self) { - | ___________________________________________^ -LL | | } - | |_____^ - -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/always-extern.rs:12:36 - | -LL | extern "rust-intrinsic" fn hello() { - | ____________________________________^ -LL | | -LL | | } - | |_^ - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0093`. diff --git a/tests/ui/intrinsics/auxiliary/cci_intrinsic.rs b/tests/ui/intrinsics/auxiliary/cci_intrinsic.rs index f3b9d569ce3..1014ac6f560 100644 --- a/tests/ui/intrinsics/auxiliary/cci_intrinsic.rs +++ b/tests/ui/intrinsics/auxiliary/cci_intrinsic.rs @@ -1,14 +1,11 @@ #![feature(intrinsics)] pub mod rusti { - extern "rust-intrinsic" { - pub fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T; - } + #[rustc_intrinsic] + pub unsafe fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T; } #[inline(always)] pub fn atomic_xchg_seqcst(dst: *mut isize, src: isize) -> isize { - unsafe { - rusti::atomic_xchg_seqcst(dst, src) - } + unsafe { rusti::atomic_xchg_seqcst(dst, src) } } diff --git a/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs b/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs index 5520430e140..e9f9270de87 100644 --- a/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs +++ b/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs @@ -1,7 +1,8 @@ fn main() { read_via_copy(); + //~^ ERROR call to unsafe function `read_via_copy` is unsafe and requires unsafe function or block } -extern "rust-intrinsic" fn read_via_copy() {} -//~^ ERROR "rust-intrinsic" ABI is an implementation detail -//~| ERROR intrinsic must be in `extern "rust-intrinsic" { ... }` block +#[rustc_intrinsic] +//~^ ERROR the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items +unsafe fn read_via_copy() {} diff --git a/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr b/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr index c6682693f74..6711c77a11e 100644 --- a/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr +++ b/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr @@ -1,18 +1,21 @@ -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/incorrect-read_via_copy-defn.rs:5:8 +error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items + --> $DIR/incorrect-read_via_copy-defn.rs:6:1 | -LL | extern "rust-intrinsic" fn read_via_copy() {} - | ^^^^^^^^^^^^^^^^ +LL | #[rustc_intrinsic] + | ^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/incorrect-read_via_copy-defn.rs:5:44 +error[E0133]: call to unsafe function `read_via_copy` is unsafe and requires unsafe function or block + --> $DIR/incorrect-read_via_copy-defn.rs:2:5 | -LL | extern "rust-intrinsic" fn read_via_copy() {} - | ^^ +LL | read_via_copy(); + | ^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0133, E0658. +For more information about an error, try `rustc --explain E0133`. diff --git a/tests/ui/intrinsics/incorrect-transmute.rs b/tests/ui/intrinsics/incorrect-transmute.rs index 15d1ab939ed..25fbc7a92ee 100644 --- a/tests/ui/intrinsics/incorrect-transmute.rs +++ b/tests/ui/intrinsics/incorrect-transmute.rs @@ -1,7 +1,8 @@ fn main() { transmute(); // does not ICE + //~^ ERROR call to unsafe function `transmute` is unsafe and requires unsafe function or block } -extern "rust-intrinsic" fn transmute() {} -//~^ ERROR "rust-intrinsic" ABI is an implementation detail -//~| ERROR intrinsic must be in `extern "rust-intrinsic" { ... }` block +#[rustc_intrinsic] +//~^ ERROR the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items +unsafe fn transmute() {} diff --git a/tests/ui/intrinsics/incorrect-transmute.stderr b/tests/ui/intrinsics/incorrect-transmute.stderr index 99dfb9847ff..6145a11c4ae 100644 --- a/tests/ui/intrinsics/incorrect-transmute.stderr +++ b/tests/ui/intrinsics/incorrect-transmute.stderr @@ -1,18 +1,21 @@ -error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/incorrect-transmute.rs:5:8 +error[E0658]: the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items + --> $DIR/incorrect-transmute.rs:6:1 | -LL | extern "rust-intrinsic" fn transmute() {} - | ^^^^^^^^^^^^^^^^ +LL | #[rustc_intrinsic] + | ^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(intrinsics)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/incorrect-transmute.rs:5:40 +error[E0133]: call to unsafe function `transmute` is unsafe and requires unsafe function or block + --> $DIR/incorrect-transmute.rs:2:5 | -LL | extern "rust-intrinsic" fn transmute() {} - | ^^ +LL | transmute(); // does not ICE + | ^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0133, E0658. +For more information about an error, try `rustc --explain E0133`. diff --git a/tests/ui/intrinsics/intrinsic-atomics.rs b/tests/ui/intrinsics/intrinsic-atomics.rs index 4ad267e3ddb..6bc3f8d884d 100644 --- a/tests/ui/intrinsics/intrinsic-atomics.rs +++ b/tests/ui/intrinsics/intrinsic-atomics.rs @@ -2,33 +2,51 @@ #![feature(intrinsics)] mod rusti { - extern "rust-intrinsic" { - pub fn atomic_cxchg_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchg_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchg_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchgweak_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchgweak_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchgweak_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool); - - pub fn atomic_load_seqcst<T>(src: *const T) -> T; - pub fn atomic_load_acquire<T>(src: *const T) -> T; - - pub fn atomic_store_seqcst<T>(dst: *mut T, val: T); - pub fn atomic_store_release<T>(dst: *mut T, val: T); - - pub fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xchg_acquire<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xchg_release<T>(dst: *mut T, src: T) -> T; - - pub fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xadd_acquire<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xadd_release<T>(dst: *mut T, src: T) -> T; - - pub fn atomic_xsub_seqcst<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xsub_acquire<T>(dst: *mut T, src: T) -> T; - pub fn atomic_xsub_release<T>(dst: *mut T, src: T) -> T; - } + #[rustc_intrinsic] + pub unsafe fn atomic_cxchg_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool); + #[rustc_intrinsic] + pub unsafe fn atomic_cxchg_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool); + #[rustc_intrinsic] + pub unsafe fn atomic_cxchg_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool); + + #[rustc_intrinsic] + pub unsafe fn atomic_cxchgweak_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool); + #[rustc_intrinsic] + pub unsafe fn atomic_cxchgweak_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool); + #[rustc_intrinsic] + pub unsafe fn atomic_cxchgweak_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool); + + #[rustc_intrinsic] + pub unsafe fn atomic_load_seqcst<T>(src: *const T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_load_acquire<T>(src: *const T) -> T; + + #[rustc_intrinsic] + pub unsafe fn atomic_store_seqcst<T>(dst: *mut T, val: T); + #[rustc_intrinsic] + pub unsafe fn atomic_store_release<T>(dst: *mut T, val: T); + + #[rustc_intrinsic] + pub unsafe fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_xchg_acquire<T>(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_xchg_release<T>(dst: *mut T, src: T) -> T; + + #[rustc_intrinsic] + pub unsafe fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_xadd_acquire<T>(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_xadd_release<T>(dst: *mut T, src: T) -> T; + + #[rustc_intrinsic] + pub unsafe fn atomic_xsub_seqcst<T>(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_xsub_acquire<T>(dst: *mut T, src: T) -> T; + #[rustc_intrinsic] + pub unsafe fn atomic_xsub_release<T>(dst: *mut T, src: T) -> T; } pub fn main() { @@ -39,9 +57,9 @@ pub fn main() { *x = 5; assert_eq!(rusti::atomic_load_acquire(&*x), 5); - rusti::atomic_store_seqcst(&mut *x,3); + rusti::atomic_store_seqcst(&mut *x, 3); assert_eq!(*x, 3); - rusti::atomic_store_release(&mut *x,1); + rusti::atomic_store_release(&mut *x, 1); assert_eq!(*x, 1); assert_eq!(rusti::atomic_cxchg_seqcst_seqcst(&mut *x, 1, 2), (1, true)); diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs index 76b6a8c8395..fdb25a3ae3f 100644 --- a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs +++ b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs @@ -3,13 +3,13 @@ const RAW_EQ_PADDING: bool = unsafe { std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16)) //~^ ERROR evaluation of constant value failed -//~| requires initialized memory +//~| NOTE requires initialized memory }; const RAW_EQ_PTR: bool = unsafe { std::intrinsics::raw_eq(&(&0), &(&1)) //~^ ERROR evaluation of constant value failed -//~| unable to turn pointer into integer +//~| NOTE unable to turn pointer into integer }; const RAW_EQ_NOT_ALIGNED: bool = unsafe { @@ -17,7 +17,7 @@ const RAW_EQ_NOT_ALIGNED: bool = unsafe { let aref = &*arr.as_ptr().cast::<i32>(); std::intrinsics::raw_eq(aref, aref) //~^ ERROR evaluation of constant value failed -//~| alignment +//~| NOTE alignment }; pub fn main() { diff --git a/tests/ui/intrinsics/invalid-ABI-rust-intrinsic.rs b/tests/ui/intrinsics/invalid-ABI-rust-intrinsic.rs new file mode 100644 index 00000000000..4b777deb8b5 --- /dev/null +++ b/tests/ui/intrinsics/invalid-ABI-rust-intrinsic.rs @@ -0,0 +1,19 @@ +#![feature(intrinsics)] + +trait Foo { + extern "rust-intrinsic" fn foo(&self); //~ ERROR invalid ABI +} + +impl Foo for () { + extern "rust-intrinsic" fn foo(&self) { //~ ERROR invalid ABI + } +} + +extern "rust-intrinsic" fn hello() { //~ ERROR invalid ABI +} + +extern "rust-intrinsic" { + //~^ ERROR invalid ABI +} + +fn main() {} diff --git a/tests/ui/intrinsics/invalid-ABI-rust-intrinsic.stderr b/tests/ui/intrinsics/invalid-ABI-rust-intrinsic.stderr new file mode 100644 index 00000000000..fc8bf62915b --- /dev/null +++ b/tests/ui/intrinsics/invalid-ABI-rust-intrinsic.stderr @@ -0,0 +1,35 @@ +error[E0703]: invalid ABI: found `rust-intrinsic` + --> $DIR/invalid-ABI-rust-intrinsic.rs:4:12 + | +LL | extern "rust-intrinsic" fn foo(&self); + | ^^^^^^^^^^^^^^^^ invalid ABI + | + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions + +error[E0703]: invalid ABI: found `rust-intrinsic` + --> $DIR/invalid-ABI-rust-intrinsic.rs:8:12 + | +LL | extern "rust-intrinsic" fn foo(&self) { + | ^^^^^^^^^^^^^^^^ invalid ABI + | + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions + +error[E0703]: invalid ABI: found `rust-intrinsic` + --> $DIR/invalid-ABI-rust-intrinsic.rs:12:8 + | +LL | extern "rust-intrinsic" fn hello() { + | ^^^^^^^^^^^^^^^^ invalid ABI + | + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions + +error[E0703]: invalid ABI: found `rust-intrinsic` + --> $DIR/invalid-ABI-rust-intrinsic.rs:15:8 + | +LL | extern "rust-intrinsic" { + | ^^^^^^^^^^^^^^^^ invalid ABI + | + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0703`. diff --git a/tests/ui/intrinsics/issue-28575.rs b/tests/ui/intrinsics/issue-28575.rs index 141136d25b2..841bc45138a 100644 --- a/tests/ui/intrinsics/issue-28575.rs +++ b/tests/ui/intrinsics/issue-28575.rs @@ -2,6 +2,7 @@ extern "C" { pub static FOO: extern "rust-intrinsic" fn(); + //~^ ERROR invalid ABI } fn main() { diff --git a/tests/ui/intrinsics/issue-28575.stderr b/tests/ui/intrinsics/issue-28575.stderr index 8a7816f231f..09c52aa4c99 100644 --- a/tests/ui/intrinsics/issue-28575.stderr +++ b/tests/ui/intrinsics/issue-28575.stderr @@ -1,11 +1,20 @@ +error[E0703]: invalid ABI: found `rust-intrinsic` + --> $DIR/issue-28575.rs:4:28 + | +LL | pub static FOO: extern "rust-intrinsic" fn(); + | ^^^^^^^^^^^^^^^^ invalid ABI + | + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions + error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/issue-28575.rs:8:5 + --> $DIR/issue-28575.rs:9:5 | LL | FOO() | ^^^ use of extern static | = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior -error: aborting due to 1 previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0133`. +Some errors have detailed explanations: E0133, E0703. +For more information about an error, try `rustc --explain E0133`. diff --git a/tests/ui/intrinsics/safe-intrinsic-mismatch.rs b/tests/ui/intrinsics/safe-intrinsic-mismatch.rs index 915a23b5905..4c301f9dbb0 100644 --- a/tests/ui/intrinsics/safe-intrinsic-mismatch.rs +++ b/tests/ui/intrinsics/safe-intrinsic-mismatch.rs @@ -1,13 +1,14 @@ #![feature(intrinsics)] #![feature(rustc_attrs)] -extern "rust-intrinsic" { - fn size_of<T>() -> usize; //~ ERROR intrinsic safety mismatch - //~^ ERROR intrinsic safety mismatch -} +#[rustc_intrinsic] +unsafe fn size_of<T>() -> usize; +//~^ ERROR intrinsic safety mismatch +//~| ERROR intrinsic has wrong type #[rustc_intrinsic] -const fn assume(_b: bool) {} //~ ERROR intrinsic safety mismatch +const fn assume(_b: bool) {} +//~^ ERROR intrinsic safety mismatch //~| ERROR intrinsic has wrong type #[rustc_intrinsic] diff --git a/tests/ui/intrinsics/safe-intrinsic-mismatch.stderr b/tests/ui/intrinsics/safe-intrinsic-mismatch.stderr index aa4f294232d..04f6daeced2 100644 --- a/tests/ui/intrinsics/safe-intrinsic-mismatch.stderr +++ b/tests/ui/intrinsics/safe-intrinsic-mismatch.stderr @@ -1,16 +1,17 @@ error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of` - --> $DIR/safe-intrinsic-mismatch.rs:5:5 + --> $DIR/safe-intrinsic-mismatch.rs:5:1 | -LL | fn size_of<T>() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | unsafe fn size_of<T>() -> usize; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of` - --> $DIR/safe-intrinsic-mismatch.rs:5:5 +error[E0308]: intrinsic has wrong type + --> $DIR/safe-intrinsic-mismatch.rs:5:18 | -LL | fn size_of<T>() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | unsafe fn size_of<T>() -> usize; + | ^^^ expected safe fn, found unsafe fn | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + = note: expected signature `fn() -> _` + found signature `unsafe fn() -> _` error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `assume` --> $DIR/safe-intrinsic-mismatch.rs:10:1 @@ -28,13 +29,13 @@ LL | const fn assume(_b: bool) {} found signature `fn(_)` error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `const_deallocate` - --> $DIR/safe-intrinsic-mismatch.rs:14:1 + --> $DIR/safe-intrinsic-mismatch.rs:15:1 | LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: intrinsic has wrong type - --> $DIR/safe-intrinsic-mismatch.rs:14:26 + --> $DIR/safe-intrinsic-mismatch.rs:15:26 | LL | const fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {} | ^ expected unsafe fn, found safe fn diff --git a/tests/ui/invalid-compile-flags/crate-type-flag.rs b/tests/ui/invalid-compile-flags/crate-type-flag.rs index 8ccce97f7bf..61b35cf8c64 100644 --- a/tests/ui/invalid-compile-flags/crate-type-flag.rs +++ b/tests/ui/invalid-compile-flags/crate-type-flag.rs @@ -3,8 +3,6 @@ //! //! This test does not try to check if the output artifacts are valid. -// FIXME(#132309): add a proper `supports-crate-type` directive. - // Single valid crate types should pass //@ revisions: lib rlib staticlib dylib cdylib bin proc_dash_macro @@ -17,19 +15,18 @@ //@[staticlib] compile-flags: --crate-type=staticlib //@[staticlib] check-pass -//@[dylib] ignore-musl (dylib is supported, but musl libc is statically linked by default) -//@[dylib] ignore-wasm (dylib is not supported) +//@[dylib] needs-crate-type: dylib //@[dylib] compile-flags: --crate-type=dylib //@[dylib] check-pass -//@[cdylib] ignore-musl (cdylib is supported, but musl libc is statically linked by default) +//@[cdylib] needs-crate-type: cdylib //@[cdylib] compile-flags: --crate-type=cdylib //@[cdylib] check-pass //@[bin] compile-flags: --crate-type=bin //@[bin] check-pass -//@[proc_dash_macro] ignore-wasm (proc-macro is not supported) +//@[proc_dash_macro] needs-crate-type: proc-macro //@[proc_dash_macro] needs-unwind (panic=abort causes warning to be emitted) //@[proc_dash_macro] compile-flags: --crate-type=proc-macro //@[proc_dash_macro] check-pass diff --git a/tests/ui/invalid/invalid-rustc_legacy_const_generics-issue-123077.rs b/tests/ui/invalid/invalid-rustc_legacy_const_generics-issue-123077.rs index 8d854c6c237..f3a15a58f26 100644 --- a/tests/ui/invalid/invalid-rustc_legacy_const_generics-issue-123077.rs +++ b/tests/ui/invalid/invalid-rustc_legacy_const_generics-issue-123077.rs @@ -6,26 +6,26 @@ const fn foo<const U: i32>() -> i32 { fn main() { std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, || ()); - //~^ invalid argument to a legacy const generic + //~^ ERROR invalid argument to a legacy const generic std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, 5 + || ()); - //~^ invalid argument to a legacy const generic + //~^ ERROR invalid argument to a legacy const generic std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, foo::<{ 1 + 2 }>()); - //~^ invalid argument to a legacy const generic + //~^ ERROR invalid argument to a legacy const generic std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, foo::<3>()); - //~^ invalid argument to a legacy const generic + //~^ ERROR invalid argument to a legacy const generic std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, &const {}); - //~^ invalid argument to a legacy const generic + //~^ ERROR invalid argument to a legacy const generic std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, { struct F(); - //~^ invalid argument to a legacy const generic + //~^ ERROR invalid argument to a legacy const generic 1 }); std::arch::x86_64::_mm_inserti_si64(loop {}, loop {}, || (), 1 + || ()); - //~^ invalid argument to a legacy const generic + //~^ ERROR invalid argument to a legacy const generic } diff --git a/tests/ui/invalid_dispatch_from_dyn_impls.rs b/tests/ui/invalid_dispatch_from_dyn_impls.rs index 972465d7197..b1d4b261bab 100644 --- a/tests/ui/invalid_dispatch_from_dyn_impls.rs +++ b/tests/ui/invalid_dispatch_from_dyn_impls.rs @@ -20,7 +20,7 @@ struct MultiplePointers<T: ?Sized>{ } impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T> -//~^ implementing `DispatchFromDyn` does not allow multiple fields to be coerced +//~^ ERROR implementing `DispatchFromDyn` does not allow multiple fields to be coerced where T: Unsize<U>, {} diff --git a/tests/ui/issues/issue-11004.rs b/tests/ui/issues/issue-11004.rs index 09d5476dbe6..714fa51ba23 100644 --- a/tests/ui/issues/issue-11004.rs +++ b/tests/ui/issues/issue-11004.rs @@ -4,8 +4,8 @@ struct A { x: i32, y: f64 } #[cfg(not(FALSE))] unsafe fn access(n:*mut A) -> (i32, f64) { - let x : i32 = n.x; //~ no field `x` on type `*mut A` - let y : f64 = n.y; //~ no field `y` on type `*mut A` + let x : i32 = n.x; //~ ERROR no field `x` on type `*mut A` + let y : f64 = n.y; //~ ERROR no field `y` on type `*mut A` (x, y) } diff --git a/tests/ui/issues/issue-14721.rs b/tests/ui/issues/issue-14721.rs index a5c47dd8cb3..c015a6bab08 100644 --- a/tests/ui/issues/issue-14721.rs +++ b/tests/ui/issues/issue-14721.rs @@ -1,4 +1,4 @@ fn main() { let foo = "str"; - println!("{}", foo.desc); //~ no field `desc` on type `&str` + println!("{}", foo.desc); //~ ERROR no field `desc` on type `&str` } diff --git a/tests/ui/issues/issue-17740.rs b/tests/ui/issues/issue-17740.rs index 3b868555fc5..574d3662b4f 100644 --- a/tests/ui/issues/issue-17740.rs +++ b/tests/ui/issues/issue-17740.rs @@ -4,11 +4,11 @@ struct Foo<'a> { impl <'a> Foo<'a>{ fn bar(self: &mut Foo) { - //~^ mismatched `self` parameter type + //~^ ERROR mismatched `self` parameter type //~| expected struct `Foo<'a>` //~| found struct `Foo<'_>` //~| lifetime mismatch - //~| mismatched `self` parameter type + //~| ERROR mismatched `self` parameter type //~| expected struct `Foo<'a>` //~| found struct `Foo<'_>` //~| lifetime mismatch diff --git a/tests/ui/issues/issue-23253.rs b/tests/ui/issues/issue-23253.rs index 22b55c28581..b285cb81ee2 100644 --- a/tests/ui/issues/issue-23253.rs +++ b/tests/ui/issues/issue-23253.rs @@ -2,5 +2,5 @@ enum Foo { Bar } fn main() { Foo::Bar.a; - //~^ no field `a` on type `Foo` + //~^ ERROR no field `a` on type `Foo` } diff --git a/tests/ui/issues/issue-24363.rs b/tests/ui/issues/issue-24363.rs index 34726fba9c6..f358b8b9017 100644 --- a/tests/ui/issues/issue-24363.rs +++ b/tests/ui/issues/issue-24363.rs @@ -1,5 +1,5 @@ fn main() { - 1.create_a_type_error[ //~ `{integer}` is a primitive type and therefore doesn't have fields + 1.create_a_type_error[ //~ ERROR `{integer}` is a primitive type and therefore doesn't have fields ()+() //~ ERROR cannot add // ^ ensure that we typeck the inner expression ^ ]; diff --git a/tests/ui/issues/issue-24365.rs b/tests/ui/issues/issue-24365.rs index eca104b6f1d..da195116047 100644 --- a/tests/ui/issues/issue-24365.rs +++ b/tests/ui/issues/issue-24365.rs @@ -7,13 +7,13 @@ pub enum Foo { } fn test(a: Foo) { - println!("{}", a.b); //~ no field `b` on type `Foo` + println!("{}", a.b); //~ ERROR no field `b` on type `Foo` } fn main() { let x = Attribute::Code { attr_name_idx: 42, }; - let z = (&x).attr_name_idx; //~ no field `attr_name_idx` on type `&Attribute` - let y = x.attr_name_idx; //~ no field `attr_name_idx` on type `Attribute` + let z = (&x).attr_name_idx; //~ ERROR no field `attr_name_idx` on type `&Attribute` + let y = x.attr_name_idx; //~ ERROR no field `attr_name_idx` on type `Attribute` } diff --git a/tests/ui/issues/issue-27008.rs b/tests/ui/issues/issue-27008.rs index adf8e779e0a..20aa4f282c7 100644 --- a/tests/ui/issues/issue-27008.rs +++ b/tests/ui/issues/issue-27008.rs @@ -3,5 +3,5 @@ struct S; fn main() { let b = [0; S]; //~^ ERROR mismatched types - //~| expected `usize`, found `S` + //~| NOTE expected `usize`, found `S` } diff --git a/tests/ui/issues/issue-2848.rs b/tests/ui/issues/issue-2848.rs index 34181acdd05..8499459cec2 100644 --- a/tests/ui/issues/issue-2848.rs +++ b/tests/ui/issues/issue-2848.rs @@ -11,8 +11,8 @@ mod bar { fn main() { use bar::foo::{alpha, charlie}; match alpha { - alpha | beta => {} //~ ERROR variable `beta` is not bound in all patterns - //~^ ERROR: `beta` is named the same as one of the variants + alpha | beta => {} //~ ERROR variable `beta` is not bound in all patterns + //~^ ERROR `beta` is named the same as one of the variants charlie => {} } } diff --git a/tests/ui/issues/issue-31011.rs b/tests/ui/issues/issue-31011.rs index 4dead04c2ca..86fe16f48e2 100644 --- a/tests/ui/issues/issue-31011.rs +++ b/tests/ui/issues/issue-31011.rs @@ -1,7 +1,7 @@ macro_rules! log { ( $ctx:expr, $( $args:expr),* ) => { if $ctx.trace { - //~^ no field `trace` on type `&T` + //~^ ERROR no field `trace` on type `&T` println!( $( $args, )* ); } } diff --git a/tests/ui/issues/issue-51102.rs b/tests/ui/issues/issue-51102.rs index 41446cd29b0..b5ddc7221d0 100644 --- a/tests/ui/issues/issue-51102.rs +++ b/tests/ui/issues/issue-51102.rs @@ -11,7 +11,7 @@ fn main() { match simple { SimpleStruct { state: 0, - //~^ struct `SimpleStruct` does not have a field named `state` [E0026] + //~^ ERROR struct `SimpleStruct` does not have a field named `state` [E0026] .. } => (), } diff --git a/tests/ui/issues/issue-69130.rs b/tests/ui/issues/issue-69130.rs index 9552e8ec2a8..90dffc99db7 100644 --- a/tests/ui/issues/issue-69130.rs +++ b/tests/ui/issues/issue-69130.rs @@ -3,5 +3,5 @@ enum F { M (§& u8)} //~^ ERROR unknown start of token -//~| missing lifetime specifier +//~| ERROR missing lifetime specifier fn main() {} diff --git a/tests/ui/issues/issue-87199.rs b/tests/ui/issues/issue-87199.rs index 6664119e579..4e4e35c6a71 100644 --- a/tests/ui/issues/issue-87199.rs +++ b/tests/ui/issues/issue-87199.rs @@ -17,5 +17,5 @@ fn ret() -> impl Iterator<Item = ()> + ?Send { std::iter::empty() } fn main() { ref_arg::<i32>(&5); ref_arg::<[i32]>(&[5]); - //~^ the size for values of type `[i32]` cannot be known + //~^ ERROR the size for values of type `[i32]` cannot be known } diff --git a/tests/ui/issues/issue-8761.rs b/tests/ui/issues/issue-8761.rs index 1453c3d757f..5883bb96695 100644 --- a/tests/ui/issues/issue-8761.rs +++ b/tests/ui/issues/issue-8761.rs @@ -1,10 +1,10 @@ enum Foo { A = 1i64, //~^ ERROR mismatched types - //~| expected `isize`, found `i64` + //~| NOTE expected `isize`, found `i64` B = 2u8 //~^ ERROR mismatched types - //~| expected `isize`, found `u8` + //~| NOTE expected `isize`, found `u8` } fn main() {} diff --git a/tests/ui/iterators/float_iterator_hint.rs b/tests/ui/iterators/float_iterator_hint.rs index a3335ca41f7..9e7a10ca497 100644 --- a/tests/ui/iterators/float_iterator_hint.rs +++ b/tests/ui/iterators/float_iterator_hint.rs @@ -3,7 +3,7 @@ fn main() { for i in 0.2 { //~^ ERROR `{float}` is not an iterator - //~| `{float}` is not an iterator + //~| NOTE `{float}` is not an iterator //~| NOTE in this expansion of desugaring of `for` loop //~| NOTE in this expansion of desugaring of `for` loop //~| NOTE in this expansion of desugaring of `for` loop diff --git a/tests/ui/label/label_break_value_desugared_break.rs b/tests/ui/label/label_break_value_desugared_break.rs index b7e7fd47c27..17ef1ba6d24 100644 --- a/tests/ui/label/label_break_value_desugared_break.rs +++ b/tests/ui/label/label_break_value_desugared_break.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![feature(try_blocks)] //@ run-pass diff --git a/tests/ui/layout/post-mono-layout-cycle.rs b/tests/ui/layout/post-mono-layout-cycle.rs index 6753c01267e..841fc30a50b 100644 --- a/tests/ui/layout/post-mono-layout-cycle.rs +++ b/tests/ui/layout/post-mono-layout-cycle.rs @@ -1,5 +1,5 @@ //@ build-fail -//~^ cycle detected when computing layout of `Wrapper<()>` +//~^ ERROR cycle detected when computing layout of `Wrapper<()>` trait Trait { type Assoc; diff --git a/tests/ui/let-else/issue-102317.rs b/tests/ui/let-else/issue-102317.rs index d94410e10a8..5afcacfc3aa 100644 --- a/tests/ui/let-else/issue-102317.rs +++ b/tests/ui/let-else/issue-102317.rs @@ -1,6 +1,7 @@ // issue #102317 //@ build-pass -//@ compile-flags: --edition 2021 -C opt-level=3 -Zvalidate-mir +//@ compile-flags: -C opt-level=3 -Zvalidate-mir +//@ edition: 2021 struct SegmentJob; diff --git a/tests/ui/lifetimes/conflicting-bounds.rs b/tests/ui/lifetimes/conflicting-bounds.rs index f37f163dbb6..62240792afd 100644 --- a/tests/ui/lifetimes/conflicting-bounds.rs +++ b/tests/ui/lifetimes/conflicting-bounds.rs @@ -1,4 +1,4 @@ -//~ type annotations needed: cannot satisfy `Self: Gen<'source>` +//~ ERROR type annotations needed: cannot satisfy `Self: Gen<'source>` pub trait Gen<'source> { type Output; diff --git a/tests/ui/lifetimes/issue-83737-binders-across-types.rs b/tests/ui/lifetimes/issue-83737-binders-across-types.rs index d20c84dae3f..6f399381294 100644 --- a/tests/ui/lifetimes/issue-83737-binders-across-types.rs +++ b/tests/ui/lifetimes/issue-83737-binders-across-types.rs @@ -1,5 +1,5 @@ //@ build-pass -//@ compile-flags: --edition 2018 +//@ edition: 2018 //@ compile-flags: --crate-type rlib use std::future::Future; diff --git a/tests/ui/lifetimes/issue-83737-erasing-bound-vars.rs b/tests/ui/lifetimes/issue-83737-erasing-bound-vars.rs index 466bcdc6be0..dcc8c7e94ba 100644 --- a/tests/ui/lifetimes/issue-83737-erasing-bound-vars.rs +++ b/tests/ui/lifetimes/issue-83737-erasing-bound-vars.rs @@ -1,5 +1,5 @@ //@ build-pass -//@ compile-flags: --edition 2018 +//@ edition: 2018 //@ compile-flags: --crate-type rlib use std::future::Future; diff --git a/tests/ui/lifetimes/issue-83753-invalid-associated-type-supertrait-hrtb.rs b/tests/ui/lifetimes/issue-83753-invalid-associated-type-supertrait-hrtb.rs index 78069e682c1..4aa212bb4bd 100644 --- a/tests/ui/lifetimes/issue-83753-invalid-associated-type-supertrait-hrtb.rs +++ b/tests/ui/lifetimes/issue-83753-invalid-associated-type-supertrait-hrtb.rs @@ -3,6 +3,6 @@ struct Foo {} impl Foo { fn bar(foo: Foo<Target = usize>) {} - //~^ associated item constraints are not allowed here + //~^ ERROR associated item constraints are not allowed here } fn main() {} diff --git a/tests/ui/lifetimes/issue-83907-invalid-fn-like-path.rs b/tests/ui/lifetimes/issue-83907-invalid-fn-like-path.rs index 4e093bb2e17..4f4e2cda946 100644 --- a/tests/ui/lifetimes/issue-83907-invalid-fn-like-path.rs +++ b/tests/ui/lifetimes/issue-83907-invalid-fn-like-path.rs @@ -1,7 +1,7 @@ //@ check-fail static STATIC_VAR_FIVE: &One(); -//~^ cannot find type -//~| free static item without body +//~^ ERROR cannot find type +//~| ERROR free static item without body fn main() {} diff --git a/tests/ui/lifetimes/no_lending_iterators.rs b/tests/ui/lifetimes/no_lending_iterators.rs index 21395475fb3..b3e8ad08ba1 100644 --- a/tests/ui/lifetimes/no_lending_iterators.rs +++ b/tests/ui/lifetimes/no_lending_iterators.rs @@ -25,7 +25,7 @@ impl Bar for usize { impl Bar for isize { type Item<'a> = &'a isize; - //~^ ERROR 27:14: 27:18: lifetime parameters or bounds on type `Item` do not match the trait declaration [E0195] + //~^ ERROR 27:14: 27:18: lifetime parameters or bounds on associated type `Item` do not match the trait declaration [E0195] fn poke(&mut self, item: Self::Item) { self += *item; diff --git a/tests/ui/lifetimes/no_lending_iterators.stderr b/tests/ui/lifetimes/no_lending_iterators.stderr index 9ceaef2f9b1..340ef935885 100644 --- a/tests/ui/lifetimes/no_lending_iterators.stderr +++ b/tests/ui/lifetimes/no_lending_iterators.stderr @@ -16,14 +16,14 @@ error: in the trait associated type is declared without lifetime parameters, so LL | type Item = &usize; | ^ this lifetime must come from the implemented type -error[E0195]: lifetime parameters or bounds on type `Item` do not match the trait declaration +error[E0195]: lifetime parameters or bounds on associated type `Item` do not match the trait declaration --> $DIR/no_lending_iterators.rs:27:14 | LL | type Item; - | - lifetimes in impl do not match this type in trait + | - lifetimes in impl do not match this associated type in trait ... LL | type Item<'a> = &'a isize; - | ^^^^ lifetimes do not match type in trait + | ^^^^ lifetimes do not match associated type in trait error: aborting due to 3 previous errors diff --git a/tests/ui/limits/huge-static.rs b/tests/ui/limits/huge-static.rs index 4709b46e59d..4c3641ac7d4 100644 --- a/tests/ui/limits/huge-static.rs +++ b/tests/ui/limits/huge-static.rs @@ -18,9 +18,9 @@ impl TooBigArray { static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new(); //~^ ERROR could not evaluate static initializer -//~| too big +//~| NOTE too big static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE]; //~^ ERROR could not evaluate static initializer -//~| too big +//~| NOTE too big fn main() { } diff --git a/tests/ui/linkage-attr/issue-12133-3.rs b/tests/ui/linkage-attr/issue-12133-3.rs index 473d5774c16..df1b0b2f728 100644 --- a/tests/ui/linkage-attr/issue-12133-3.rs +++ b/tests/ui/linkage-attr/issue-12133-3.rs @@ -2,8 +2,7 @@ //@ aux-build:issue-12133-rlib.rs //@ aux-build:issue-12133-dylib.rs //@ aux-build:issue-12133-dylib2.rs -//@ ignore-wasm32 no dylib support -//@ ignore-musl +//@ needs-crate-type: dylib //@ needs-dynamic-linking diff --git a/tests/ui/lint/internal_features.rs b/tests/ui/lint/internal_features.rs index 32ce9540cb3..6456078a5c2 100644 --- a/tests/ui/lint/internal_features.rs +++ b/tests/ui/lint/internal_features.rs @@ -4,8 +4,7 @@ //~^ ERROR: internal //~| ERROR: internal -extern "rust-intrinsic" { - fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize); -} +#[rustc_intrinsic] +unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize); fn main() {} diff --git a/tests/ui/lint/large_assignments/inline_mir.rs b/tests/ui/lint/large_assignments/inline_mir.rs new file mode 100644 index 00000000000..fc27b8ff244 --- /dev/null +++ b/tests/ui/lint/large_assignments/inline_mir.rs @@ -0,0 +1,24 @@ +#![feature(large_assignments)] +#![deny(large_assignments)] +#![move_size_limit = "1000"] + +//! Tests that with `-Zinline-mir`, we do NOT get an error that points to the +//! implementation of `UnsafeCell` since that is not actionable by the user: +//! +//! ```text +//! error: moving 9999 bytes +//! --> /rustc/FAKE_PREFIX/library/core/src/cell.rs:2054:9 +//! | +//! = note: value moved from here +//! ``` +//! +//! We want the diagnostics to point to the relevant user code. + +//@ build-fail +//@ compile-flags: -Zmir-opt-level=1 -Zinline-mir + +pub fn main() { + let data = [10u8; 9999]; + let cell = std::cell::UnsafeCell::new(data); //~ ERROR large_assignments + std::hint::black_box(cell); +} diff --git a/tests/ui/lint/large_assignments/inline_mir.stderr b/tests/ui/lint/large_assignments/inline_mir.stderr new file mode 100644 index 00000000000..d9010e24d03 --- /dev/null +++ b/tests/ui/lint/large_assignments/inline_mir.stderr @@ -0,0 +1,15 @@ +error: moving 9999 bytes + --> $DIR/inline_mir.rs:22:16 + | +LL | let cell = std::cell::UnsafeCell::new(data); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ value moved from here + | + = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` +note: the lint level is defined here + --> $DIR/inline_mir.rs:2:9 + | +LL | #![deny(large_assignments)] + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/lint-attr-everywhere-early.rs b/tests/ui/lint/lint-attr-everywhere-early.rs index ae32ec426f2..7ca127d066f 100644 --- a/tests/ui/lint/lint-attr-everywhere-early.rs +++ b/tests/ui/lint/lint-attr-everywhere-early.rs @@ -40,7 +40,7 @@ struct Associated; impl Associated { #![deny(unsafe_code)] - fn inherent_denied_from_inner() { unsafe {} } //~ usage of an `unsafe` block + fn inherent_denied_from_inner() { unsafe {} } //~ ERROR usage of an `unsafe` block #[deny(while_true)] fn inherent_fn() { while true {} } //~ ERROR denote infinite loops with diff --git a/tests/ui/lint/lints-in-foreign-macros.rs b/tests/ui/lint/lints-in-foreign-macros.rs index 49e83bae642..31b59f4943a 100644 --- a/tests/ui/lint/lints-in-foreign-macros.rs +++ b/tests/ui/lint/lints-in-foreign-macros.rs @@ -1,7 +1,7 @@ //@ aux-build:lints-in-foreign-macros.rs //@ check-pass -#![warn(unused_imports)] //~ missing documentation for the crate [missing_docs] +#![warn(unused_imports)] //~ WARN missing documentation for the crate [missing_docs] #![warn(missing_docs)] #[macro_use] diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.cdylib_.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.cdylib_.stderr index 1192b690e29..a9c01886744 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.cdylib_.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.cdylib_.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:36:18 + --> $DIR/lint-non-snake-case-crate.rs:35:18 | LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate.rs:38:9 + --> $DIR/lint-non-snake-case-crate.rs:37:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.dylib_.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.dylib_.stderr index 1192b690e29..a9c01886744 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.dylib_.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.dylib_.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:36:18 + --> $DIR/lint-non-snake-case-crate.rs:35:18 | LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate.rs:38:9 + --> $DIR/lint-non-snake-case-crate.rs:37:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.lib_.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.lib_.stderr index 1192b690e29..a9c01886744 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.lib_.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.lib_.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:36:18 + --> $DIR/lint-non-snake-case-crate.rs:35:18 | LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate.rs:38:9 + --> $DIR/lint-non-snake-case-crate.rs:37:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.proc_macro_.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.proc_macro_.stderr index 1192b690e29..a9c01886744 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.proc_macro_.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.proc_macro_.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:36:18 + --> $DIR/lint-non-snake-case-crate.rs:35:18 | LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate.rs:38:9 + --> $DIR/lint-non-snake-case-crate.rs:37:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rlib_.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rlib_.stderr index 1192b690e29..a9c01886744 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rlib_.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rlib_.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:36:18 + --> $DIR/lint-non-snake-case-crate.rs:35:18 | LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate.rs:38:9 + --> $DIR/lint-non-snake-case-crate.rs:37:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs index 6f701cd27c6..a63e9c5ddf2 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs @@ -10,28 +10,27 @@ // But should fire on non-binary crates. -// FIXME(#132309): dylib crate type is not supported on wasm; we need a proper -// supports-crate-type directive. Also, needs-dynamic-linking should rule out -// musl since it supports neither dylibs nor cdylibs. -//@[dylib_] ignore-wasm -//@[dylib_] ignore-musl -//@[cdylib_] ignore-musl - -//@[dylib_] needs-dynamic-linking +//@[cdylib_] compile-flags: --crate-type=cdylib //@[cdylib_] needs-dynamic-linking -//@[proc_macro_] force-host -//@[proc_macro_] no-prefer-dynamic +//@[cdylib_] needs-crate-type: cdylib -//@[cdylib_] compile-flags: --crate-type=cdylib //@[dylib_] compile-flags: --crate-type=dylib +//@[dylib_] needs-dynamic-linking +//@[dylib_] needs-crate-type: dylib + //@[lib_] compile-flags: --crate-type=lib + +//@[proc_macro_] force-host +//@[proc_macro_] no-prefer-dynamic //@[proc_macro_] compile-flags: --crate-type=proc-macro +// The compiler may emit a warning that causes stderr output that contains a warning this test does +// not wish to check. +//@[proc_macro_] needs-unwind +//@[proc_macro_] needs-crate-type: proc-macro + //@[rlib_] compile-flags: --crate-type=rlib -//@[staticlib_] compile-flags: --crate-type=staticlib -// The compiler may emit a warning that causes stderr output -// that contains a warning this test does not wish to check. -//@[proc_macro_] needs-unwind +//@[staticlib_] compile-flags: --crate-type=staticlib #![crate_name = "NonSnakeCase"] //[cdylib_,dylib_,lib_,proc_macro_,rlib_,staticlib_]~^ ERROR crate `NonSnakeCase` should have a snake case name diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.staticlib_.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.staticlib_.stderr index 1192b690e29..a9c01886744 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.staticlib_.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-crate.staticlib_.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name - --> $DIR/lint-non-snake-case-crate.rs:36:18 + --> $DIR/lint-non-snake-case-crate.rs:35:18 | LL | #![crate_name = "NonSnakeCase"] | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: the lint level is defined here - --> $DIR/lint-non-snake-case-crate.rs:38:9 + --> $DIR/lint-non-snake-case-crate.rs:37:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.rs b/tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.rs index a51452f0695..787b8999a10 100644 --- a/tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.rs +++ b/tests/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.rs @@ -1,6 +1,6 @@ #![deny(uncommon_codepoints)] -const µ: f64 = 0.000001; //~ identifier contains a non normalized (NFKC) character: 'µ' +const µ: f64 = 0.000001; //~ ERROR identifier contains a non normalized (NFKC) character: 'µ' //~| WARNING should have an upper case name fn dijkstra() {} diff --git a/tests/ui/lint/unknown-lints/other.rs b/tests/ui/lint/unknown-lints/other.rs index f917bff6d60..25333584916 100644 --- a/tests/ui/lint/unknown-lints/other.rs +++ b/tests/ui/lint/unknown-lints/other.rs @@ -1,4 +1,4 @@ -//@ ignore-test +//@ ignore-test (auxiliary) // Companion to allow-in-other-module.rs diff --git a/tests/ui/lint/unqualified_local_imports.rs b/tests/ui/lint/unqualified_local_imports.rs index 9de71471342..b7036f9c68e 100644 --- a/tests/ui/lint/unqualified_local_imports.rs +++ b/tests/ui/lint/unqualified_local_imports.rs @@ -1,4 +1,4 @@ -//@compile-flags: --edition 2018 +//@ edition: 2018 #![feature(unqualified_local_imports)] #![deny(unqualified_local_imports)] diff --git a/tests/ui/lint/unused-borrows.rs b/tests/ui/lint/unused-borrows.rs index 4518522ae00..07d783382fa 100644 --- a/tests/ui/lint/unused-borrows.rs +++ b/tests/ui/lint/unused-borrows.rs @@ -4,24 +4,24 @@ fn foo(_: i32) -> bool { todo!() } fn bar() -> &'static i32 { &42; - //~^ unused + //~^ ERROR unused &mut foo(42); - //~^ unused + //~^ ERROR unused &&42; - //~^ unused + //~^ ERROR unused &&mut 42; - //~^ unused + //~^ ERROR unused &mut &42; - //~^ unused + //~^ ERROR unused let _result = foo(4) && foo(2); // Misplaced semi-colon (perhaps due to reordering of lines) && foo(42); - //~^ unused + //~^ ERROR unused let _ = &42; // ok diff --git a/tests/ui/lint/unused/issue-70041.rs b/tests/ui/lint/unused/issue-70041.rs index 817dfe82114..890ba378263 100644 --- a/tests/ui/lint/unused/issue-70041.rs +++ b/tests/ui/lint/unused/issue-70041.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition=2018 +//@ edition: 2018 //@ run-pass macro_rules! regex { diff --git a/tests/ui/lint/unused/must_use-unit.rs b/tests/ui/lint/unused/must_use-unit.rs index 4dd4798abb7..171ae3257b6 100644 --- a/tests/ui/lint/unused/must_use-unit.rs +++ b/tests/ui/lint/unused/must_use-unit.rs @@ -10,7 +10,7 @@ fn bar() -> ! { } fn main() { - foo(); //~ unused return value of `foo` + foo(); //~ ERROR unused return value of `foo` - bar(); //~ unused return value of `bar` + bar(); //~ ERROR unused return value of `bar` } diff --git a/tests/ui/lint/unused/useless-comment.rs b/tests/ui/lint/unused/useless-comment.rs index 7d2e5ab6f2b..4ec52f20747 100644 --- a/tests/ui/lint/unused/useless-comment.rs +++ b/tests/ui/lint/unused/useless-comment.rs @@ -13,7 +13,7 @@ fn foo() { /// a //~ ERROR unused doc comment let x = 12; - /// multi-line //~ unused doc comment + /// multi-line //~ ERROR unused doc comment /// doc comment /// that is unused match x { diff --git a/tests/ui/macros/expr_2021_cargo_fix_edition.fixed b/tests/ui/macros/expr_2021_cargo_fix_edition.fixed index 061a4b98033..c0d27609358 100644 --- a/tests/ui/macros/expr_2021_cargo_fix_edition.fixed +++ b/tests/ui/macros/expr_2021_cargo_fix_edition.fixed @@ -1,6 +1,6 @@ //@ run-rustfix //@ check-pass -//@ compile-flags: --edition=2021 +//@ edition: 2021 #![warn(edition_2024_expr_fragment_specifier)] macro_rules! m { diff --git a/tests/ui/macros/expr_2021_cargo_fix_edition.rs b/tests/ui/macros/expr_2021_cargo_fix_edition.rs index cd9cd965fad..b2c16fc7041 100644 --- a/tests/ui/macros/expr_2021_cargo_fix_edition.rs +++ b/tests/ui/macros/expr_2021_cargo_fix_edition.rs @@ -1,6 +1,6 @@ //@ run-rustfix //@ check-pass -//@ compile-flags: --edition=2021 +//@ edition: 2021 #![warn(edition_2024_expr_fragment_specifier)] macro_rules! m { diff --git a/tests/ui/macros/failed-to-reparse-issue-139445.rs b/tests/ui/macros/failed-to-reparse-issue-139445.rs new file mode 100644 index 00000000000..babe26b9d29 --- /dev/null +++ b/tests/ui/macros/failed-to-reparse-issue-139445.rs @@ -0,0 +1,6 @@ +fn main() { + assert_eq!(3, 'a,) + //~^ ERROR expected `while`, `for`, `loop` or `{` after a label + //~| ERROR expected `while`, `for`, `loop` or `{` after a label + //~| ERROR expected expression, found `` +} diff --git a/tests/ui/macros/failed-to-reparse-issue-139445.stderr b/tests/ui/macros/failed-to-reparse-issue-139445.stderr new file mode 100644 index 00000000000..6f7d88fb344 --- /dev/null +++ b/tests/ui/macros/failed-to-reparse-issue-139445.stderr @@ -0,0 +1,24 @@ +error: expected `while`, `for`, `loop` or `{` after a label + --> $DIR/failed-to-reparse-issue-139445.rs:2:21 + | +LL | assert_eq!(3, 'a,) + | ^ expected `while`, `for`, `loop` or `{` after a label + +error: expected `while`, `for`, `loop` or `{` after a label + --> $DIR/failed-to-reparse-issue-139445.rs:2:5 + | +LL | assert_eq!(3, 'a,) + | ^^^^^^^^^^^^^^^^^^ expected `while`, `for`, `loop` or `{` after a label + | + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: expected expression, found `` + --> $DIR/failed-to-reparse-issue-139445.rs:2:5 + | +LL | assert_eq!(3, 'a,) + | ^^^^^^^^^^^^^^^^^^ expected expression + | + = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 3 previous errors + diff --git a/tests/ui/macros/issue-42954.fixed b/tests/ui/macros/issue-42954.fixed index acfc36e2bff..b1d4e0a56a6 100644 --- a/tests/ui/macros/issue-42954.fixed +++ b/tests/ui/macros/issue-42954.fixed @@ -4,7 +4,7 @@ macro_rules! is_plainly_printable { ($i: ident) => { - ($i as u32) < 0 //~ `<` is interpreted as a start of generic arguments + ($i as u32) < 0 //~ ERROR `<` is interpreted as a start of generic arguments }; } diff --git a/tests/ui/macros/issue-42954.rs b/tests/ui/macros/issue-42954.rs index 91362946f84..29e2aa3a682 100644 --- a/tests/ui/macros/issue-42954.rs +++ b/tests/ui/macros/issue-42954.rs @@ -4,7 +4,7 @@ macro_rules! is_plainly_printable { ($i: ident) => { - $i as u32 < 0 //~ `<` is interpreted as a start of generic arguments + $i as u32 < 0 //~ ERROR `<` is interpreted as a start of generic arguments }; } diff --git a/tests/ui/macros/issue-88228.rs b/tests/ui/macros/issue-88228.rs index 48b405264fe..b4195a92557 100644 --- a/tests/ui/macros/issue-88228.rs +++ b/tests/ui/macros/issue-88228.rs @@ -13,7 +13,7 @@ struct A; #[derive(println)] //~^ ERROR cannot find derive macro `println` -//~|`println` is in scope, but it is a function-like macro +//~| NOTE `println` is in scope, but it is a function-like macro struct B; fn main() { diff --git a/tests/ui/macros/no-close-delim-issue-139248.rs b/tests/ui/macros/no-close-delim-issue-139248.rs new file mode 100644 index 00000000000..86583b2724e --- /dev/null +++ b/tests/ui/macros/no-close-delim-issue-139248.rs @@ -0,0 +1,14 @@ +// This code caused a "no close delim when reparsing Expr" ICE in #139248. + +macro_rules! m { + (static a : () = $e:expr) => { + static a : () = $e; + //~^ ERROR macro expansion ends with an incomplete expression: expected expression + } +} + +m! { static a : () = (if b) } +//~^ ERROR expected `{`, found `)` +//~| ERROR expected `{`, found `)` + +fn main() {} diff --git a/tests/ui/macros/no-close-delim-issue-139248.stderr b/tests/ui/macros/no-close-delim-issue-139248.stderr new file mode 100644 index 00000000000..6ed41ae9b46 --- /dev/null +++ b/tests/ui/macros/no-close-delim-issue-139248.stderr @@ -0,0 +1,33 @@ +error: expected `{`, found `)` + --> $DIR/no-close-delim-issue-139248.rs:10:27 + | +LL | m! { static a : () = (if b) } + | ^ expected `{` + | +note: the `if` expression is missing a block after this condition + --> $DIR/no-close-delim-issue-139248.rs:10:26 + | +LL | m! { static a : () = (if b) } + | ^ + +error: expected `{`, found `)` + --> $DIR/no-close-delim-issue-139248.rs:10:27 + | +LL | m! { static a : () = (if b) } + | ^ expected `{` + | +note: the `if` expression is missing a block after this condition + --> $DIR/no-close-delim-issue-139248.rs:10:26 + | +LL | m! { static a : () = (if b) } + | ^ + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: macro expansion ends with an incomplete expression: expected expression + --> $DIR/no-close-delim-issue-139248.rs:5:28 + | +LL | static a : () = $e; + | ^ expected expression + +error: aborting due to 3 previous errors + diff --git a/tests/ui/macros/reparse-expr-issue-139495.rs b/tests/ui/macros/reparse-expr-issue-139495.rs new file mode 100644 index 00000000000..38d24573a53 --- /dev/null +++ b/tests/ui/macros/reparse-expr-issue-139495.rs @@ -0,0 +1,7 @@ +macro_rules! m { + ($abi : expr) => { extern $abi } //~ ERROR expected expression, found keyword `extern` +} + +fn main() { + m!(-2) +} diff --git a/tests/ui/macros/reparse-expr-issue-139495.stderr b/tests/ui/macros/reparse-expr-issue-139495.stderr new file mode 100644 index 00000000000..73a8ed87ba0 --- /dev/null +++ b/tests/ui/macros/reparse-expr-issue-139495.stderr @@ -0,0 +1,13 @@ +error: expected expression, found keyword `extern` + --> $DIR/reparse-expr-issue-139495.rs:2:22 + | +LL | ($abi : expr) => { extern $abi } + | ^^^^^^ expected expression +... +LL | m!(-2) + | ------ in this macro invocation + | + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 1 previous error + diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs index 40033f546d3..3490d3efc59 100644 --- a/tests/ui/macros/stringify.rs +++ b/tests/ui/macros/stringify.rs @@ -515,6 +515,8 @@ fn test_meta() { #[test] fn test_pat() { + // PatKind::Missing: untestable in isolation. + // PatKind::Wild c1!(pat, [ _ ], "_"); diff --git a/tests/ui/match/intended-binding-pattern-is-const.rs b/tests/ui/match/intended-binding-pattern-is-const.rs index 95c8119cdb9..12a8e2c18bc 100644 --- a/tests/ui/match/intended-binding-pattern-is-const.rs +++ b/tests/ui/match/intended-binding-pattern-is-const.rs @@ -1,8 +1,8 @@ fn main() { match 1 { //~ ERROR non-exhaustive patterns - //~^ patterns `i32::MIN..=3_i32` and `5_i32..=i32::MAX` not covered - //~| the matched value is of type `i32` - x => {} //~ this pattern doesn't introduce a new catch-all binding + //~^ NOTE patterns `i32::MIN..=3_i32` and `5_i32..=i32::MAX` not covered + //~| NOTE the matched value is of type `i32` + x => {} //~ NOTE this pattern doesn't introduce a new catch-all binding //~^ HELP ensure that all possible cases are being handled //~| HELP if you meant to introduce a binding, use a different name } diff --git a/tests/ui/match/postfix-match/pf-match-exhaustiveness.rs b/tests/ui/match/postfix-match/pf-match-exhaustiveness.rs index f4cac46f7cd..cbd35482d22 100644 --- a/tests/ui/match/postfix-match/pf-match-exhaustiveness.rs +++ b/tests/ui/match/postfix-match/pf-match-exhaustiveness.rs @@ -1,7 +1,7 @@ #![feature(postfix_match)] fn main() { - Some(1).match { //~ non-exhaustive patterns + Some(1).match { //~ ERROR non-exhaustive patterns None => {}, } } diff --git a/tests/ui/methods/bad-wf-when-selecting-method.rs b/tests/ui/methods/bad-wf-when-selecting-method.rs index 638d1ffa982..1f1a10f4204 100644 --- a/tests/ui/methods/bad-wf-when-selecting-method.rs +++ b/tests/ui/methods/bad-wf-when-selecting-method.rs @@ -12,7 +12,7 @@ fn test<T>(t: T) { Wrapper(t).needs_sized(); //~^ ERROR the trait bound `T: Wf` is not satisfied //~| ERROR the trait bound `T: Wf` is not satisfied - //~| the method `needs_sized` exists for struct `Wrapper<T, _>`, but its trait bounds were not satisfied + //~| ERROR the method `needs_sized` exists for struct `Wrapper<T, _>`, but its trait bounds were not satisfied } fn main() {} diff --git a/tests/ui/methods/disambiguate-associated-function-first-arg.rs b/tests/ui/methods/disambiguate-associated-function-first-arg.rs index 4c8192fc14b..c88be842481 100644 --- a/tests/ui/methods/disambiguate-associated-function-first-arg.rs +++ b/tests/ui/methods/disambiguate-associated-function-first-arg.rs @@ -45,5 +45,5 @@ impl<T> TraitB for T { fn test() { S.f(); - //~^ multiple applicable items in scope + //~^ ERROR multiple applicable items in scope } diff --git a/tests/ui/methods/issues/issue-90315.rs b/tests/ui/methods/issues/issue-90315.rs index fbecaf9b971..3a82454b7b4 100644 --- a/tests/ui/methods/issues/issue-90315.rs +++ b/tests/ui/methods/issues/issue-90315.rs @@ -3,7 +3,7 @@ fn main() { let arr = &[0, 1, 2, 3]; for _i in 0..arr.len().rev() { //~^ ERROR can't call method - //~| surround the range in parentheses + //~| HELP surround the range in parentheses // The above error used to say “the method `rev` exists for type `usize`”. // This regression test ensures it doesn't say that any more. } diff --git a/tests/ui/mir/enable_passes_validation.rs b/tests/ui/mir/enable_passes_validation.rs index b97ddfba37f..99b1ba528b0 100644 --- a/tests/ui/mir/enable_passes_validation.rs +++ b/tests/ui/mir/enable_passes_validation.rs @@ -19,7 +19,7 @@ fn main() {} //[unprefixed]~? ERROR incorrect value `CheckAlignment` for unstable option `mir-enable-passes` //[mixed]~? WARN MIR pass `ThisPassDoesNotExist` is unknown and will be ignored //[mixed]~? WARN MIR pass `ThisPassDoesNotExist` is unknown and will be ignored -//[all_unknown]~? MIR pass `ThisPass` is unknown and will be ignored -//[all_unknown]~? MIR pass `DoesNotExist` is unknown and will be ignored -//[all_unknown]~? MIR pass `ThisPass` is unknown and will be ignored -//[all_unknown]~? MIR pass `DoesNotExist` is unknown and will be ignored +//[all_unknown]~? WARN MIR pass `ThisPass` is unknown and will be ignored +//[all_unknown]~? WARN MIR pass `DoesNotExist` is unknown and will be ignored +//[all_unknown]~? WARN MIR pass `ThisPass` is unknown and will be ignored +//[all_unknown]~? WARN MIR pass `DoesNotExist` is unknown and will be ignored diff --git a/tests/ui/mir/issue-105809.rs b/tests/ui/mir/issue-105809.rs index e7a8fb65268..a46dcf350ad 100644 --- a/tests/ui/mir/issue-105809.rs +++ b/tests/ui/mir/issue-105809.rs @@ -1,7 +1,8 @@ // Non-regression test ICE from issue #105809 and duplicates. //@ build-pass: the ICE is during codegen -//@ compile-flags: --edition 2018 -Zmir-opt-level=1 +//@ compile-flags: -Zmir-opt-level=1 +//@ edition: 2018 use std::{future::Future, pin::Pin}; diff --git a/tests/ui/mismatched_types/assignment-operator-unimplemented.rs b/tests/ui/mismatched_types/assignment-operator-unimplemented.rs index 21df464d5e4..04a379bbd04 100644 --- a/tests/ui/mismatched_types/assignment-operator-unimplemented.rs +++ b/tests/ui/mismatched_types/assignment-operator-unimplemented.rs @@ -3,5 +3,5 @@ struct Foo; fn main() { let mut a = Foo; let ref b = Foo; - a += *b; //~ Error: binary assignment operation `+=` cannot be applied to type `Foo` + a += *b; //~ ERROR binary assignment operation `+=` cannot be applied to type `Foo` } diff --git a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.next.stderr b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.next.stderr index b7161310619..7912ed4d707 100644 --- a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.next.stderr +++ b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.next.stderr @@ -7,8 +7,8 @@ LL | let _ = (-10..=10).find(|x: i32| x.signum() == 0); | required by a bound introduced by this call | = help: the trait `for<'a> FnMut(&'a <std::ops::RangeInclusive<{integer}> as Iterator>::Item)` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:6:29: 6:37}` - = note: expected a closure with arguments `(i32,)` - found a closure with arguments `(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item,)` + = note: expected a closure with signature `for<'a> fn(&'a <std::ops::RangeInclusive<{integer}> as Iterator>::Item)` + found a closure with signature `fn(i32)` note: required by a bound in `find` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL @@ -27,8 +27,8 @@ LL | let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0); | required by a bound introduced by this call | = help: the trait `for<'a> FnMut(&'a <std::ops::RangeInclusive<{integer}> as Iterator>::Item)` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:9:29: 9:40}` - = note: expected a closure with arguments `(&&&i32,)` - found a closure with arguments `(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item,)` + = note: expected a closure with signature `for<'a> fn(&'a <std::ops::RangeInclusive<{integer}> as Iterator>::Item)` + found a closure with signature `fn(&&&i32)` note: required by a bound in `find` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL diff --git a/tests/ui/mismatched_types/closure-mismatch.stderr b/tests/ui/mismatched_types/closure-mismatch.current.stderr index 802110c6511..378fe83ea89 100644 --- a/tests/ui/mismatched_types/closure-mismatch.stderr +++ b/tests/ui/mismatched_types/closure-mismatch.current.stderr @@ -1,5 +1,5 @@ error: implementation of `FnOnce` is not general enough - --> $DIR/closure-mismatch.rs:8:5 + --> $DIR/closure-mismatch.rs:12:5 | LL | baz(|_| ()); | ^^^^^^^^^^^ implementation of `FnOnce` is not general enough @@ -8,7 +8,7 @@ LL | baz(|_| ()); = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` error: implementation of `Fn` is not general enough - --> $DIR/closure-mismatch.rs:8:5 + --> $DIR/closure-mismatch.rs:12:5 | LL | baz(|_| ()); | ^^^^^^^^^^^ implementation of `Fn` is not general enough @@ -17,7 +17,7 @@ LL | baz(|_| ()); = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2` error: implementation of `FnOnce` is not general enough - --> $DIR/closure-mismatch.rs:11:5 + --> $DIR/closure-mismatch.rs:16:5 | LL | baz(|x| ()); | ^^^^^^^^^^^ implementation of `FnOnce` is not general enough @@ -26,7 +26,7 @@ LL | baz(|x| ()); = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` error: implementation of `Fn` is not general enough - --> $DIR/closure-mismatch.rs:11:5 + --> $DIR/closure-mismatch.rs:16:5 | LL | baz(|x| ()); | ^^^^^^^^^^^ implementation of `Fn` is not general enough diff --git a/tests/ui/mismatched_types/closure-mismatch.next.stderr b/tests/ui/mismatched_types/closure-mismatch.next.stderr new file mode 100644 index 00000000000..6b4620aa8d1 --- /dev/null +++ b/tests/ui/mismatched_types/closure-mismatch.next.stderr @@ -0,0 +1,67 @@ +error[E0277]: the trait bound `{closure@$DIR/closure-mismatch.rs:12:9: 12:12}: Foo` is not satisfied + --> $DIR/closure-mismatch.rs:12:9 + | +LL | baz(|_| ()); + | --- ^^^^^^ unsatisfied trait bound + | | + | required by a bound introduced by this call + | + = help: the trait `for<'a> FnOnce(&'a ())` is not implemented for closure `{closure@$DIR/closure-mismatch.rs:12:9: 12:12}` + = note: expected a closure with signature `for<'a> fn(&'a ())` + found a closure with signature `fn(&())` +note: this is a known limitation of the trait solver that will be lifted in the future + --> $DIR/closure-mismatch.rs:12:9 + | +LL | baz(|_| ()); + | ----^^^---- + | | | + | | the trait solver is unable to infer the generic types that should be inferred from this argument + | add turbofish arguments to this call to specify the types manually, even if it's redundant +note: required for `{closure@$DIR/closure-mismatch.rs:12:9: 12:12}` to implement `Foo` + --> $DIR/closure-mismatch.rs:7:18 + | +LL | impl<T: Fn(&())> Foo for T {} + | ------- ^^^ ^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `baz` + --> $DIR/closure-mismatch.rs:9:11 + | +LL | fn baz<T: Foo>(_: T) {} + | ^^^ required by this bound in `baz` + +error[E0277]: the trait bound `{closure@$DIR/closure-mismatch.rs:16:9: 16:12}: Foo` is not satisfied + --> $DIR/closure-mismatch.rs:16:9 + | +LL | baz(|x| ()); + | --- ^^^^^^ unsatisfied trait bound + | | + | required by a bound introduced by this call + | + = help: the trait `for<'a> FnOnce(&'a ())` is not implemented for closure `{closure@$DIR/closure-mismatch.rs:16:9: 16:12}` + = note: expected a closure with signature `for<'a> fn(&'a ())` + found a closure with signature `fn(&())` +note: this is a known limitation of the trait solver that will be lifted in the future + --> $DIR/closure-mismatch.rs:16:9 + | +LL | baz(|x| ()); + | ----^^^---- + | | | + | | the trait solver is unable to infer the generic types that should be inferred from this argument + | add turbofish arguments to this call to specify the types manually, even if it's redundant +note: required for `{closure@$DIR/closure-mismatch.rs:16:9: 16:12}` to implement `Foo` + --> $DIR/closure-mismatch.rs:7:18 + | +LL | impl<T: Fn(&())> Foo for T {} + | ------- ^^^ ^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `baz` + --> $DIR/closure-mismatch.rs:9:11 + | +LL | fn baz<T: Foo>(_: T) {} + | ^^^ required by this bound in `baz` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/mismatched_types/closure-mismatch.rs b/tests/ui/mismatched_types/closure-mismatch.rs index efaed4dc1b9..1a24c760a6a 100644 --- a/tests/ui/mismatched_types/closure-mismatch.rs +++ b/tests/ui/mismatched_types/closure-mismatch.rs @@ -1,3 +1,7 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + trait Foo {} impl<T: Fn(&())> Foo for T {} @@ -6,9 +10,11 @@ fn baz<T: Foo>(_: T) {} fn main() { baz(|_| ()); - //~^ ERROR implementation of `FnOnce` is not general enough - //~| ERROR implementation of `Fn` is not general enough + //[current]~^ ERROR implementation of `FnOnce` is not general enough + //[current]~| ERROR implementation of `Fn` is not general enough + //[next]~^^^ ERROR Foo` is not satisfied baz(|x| ()); - //~^ ERROR implementation of `FnOnce` is not general enough - //~| ERROR implementation of `Fn` is not general enough + //[current]~^ ERROR implementation of `FnOnce` is not general enough + //[current]~| ERROR implementation of `Fn` is not general enough + //[next]~^^^ ERROR Foo` is not satisfied } diff --git a/tests/ui/mismatched_types/similar_paths_primitive.rs b/tests/ui/mismatched_types/similar_paths_primitive.rs index a58fe68b863..b20ca80ac07 100644 --- a/tests/ui/mismatched_types/similar_paths_primitive.rs +++ b/tests/ui/mismatched_types/similar_paths_primitive.rs @@ -4,8 +4,9 @@ struct bool; //~ NOTE the other `bool` is defined in the current crate struct str; //~ NOTE the other `str` is defined in the current crate fn foo(_: bool) {} //~ NOTE function defined here + //~^ NOTE fn bar(_: &str) {} //~ NOTE function defined here - + //~^ NOTE fn main() { foo(true); //~^ ERROR mismatched types [E0308] diff --git a/tests/ui/mismatched_types/similar_paths_primitive.stderr b/tests/ui/mismatched_types/similar_paths_primitive.stderr index cf26234dba8..9c1aa0d7105 100644 --- a/tests/ui/mismatched_types/similar_paths_primitive.stderr +++ b/tests/ui/mismatched_types/similar_paths_primitive.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/similar_paths_primitive.rs:10:9 + --> $DIR/similar_paths_primitive.rs:11:9 | LL | foo(true); | --- ^^^^ expected `bool`, found a different `bool` @@ -20,7 +20,7 @@ LL | fn foo(_: bool) {} | ^^^ ------- error[E0308]: mismatched types - --> $DIR/similar_paths_primitive.rs:16:9 + --> $DIR/similar_paths_primitive.rs:17:9 | LL | bar("hello"); | --- ^^^^^^^ expected `str`, found a different `str` @@ -35,7 +35,7 @@ note: the other `str` is defined in the current crate LL | struct str; | ^^^^^^^^^^ note: function defined here - --> $DIR/similar_paths_primitive.rs:7:4 + --> $DIR/similar_paths_primitive.rs:8:4 | LL | fn bar(_: &str) {} | ^^^ ------- diff --git a/tests/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.fixed b/tests/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.fixed index cf923362ad8..04e0fcca32d 100644 --- a/tests/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.fixed +++ b/tests/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.fixed @@ -16,6 +16,6 @@ fn main() { match Blah::A(1, 1, 2) { Blah::A(_, x, y) | Blah::B(x, y) => {} //~^ ERROR mismatched types - //~| variable `y` is bound inconsistently across alternatives separated by `|` + //~| ERROR variable `y` is bound inconsistently across alternatives separated by `|` } } diff --git a/tests/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.rs b/tests/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.rs index dc556f6576a..dd6329c9090 100644 --- a/tests/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.rs +++ b/tests/ui/mismatched_types/suggest-adding-or-removing-ref-for-binding-pattern.rs @@ -16,6 +16,6 @@ fn main() { match Blah::A(1, 1, 2) { Blah::A(_, x, y) | Blah::B(x, ref y) => {} //~^ ERROR mismatched types - //~| variable `y` is bound inconsistently across alternatives separated by `|` + //~| ERROR variable `y` is bound inconsistently across alternatives separated by `|` } } diff --git a/tests/ui/modules/issue-107649.rs b/tests/ui/modules/issue-107649.rs index af5758d7985..f93fb07e17a 100644 --- a/tests/ui/modules/issue-107649.rs +++ b/tests/ui/modules/issue-107649.rs @@ -102,5 +102,5 @@ fn main() { (); (); (); - dbg!(lib::Dummy); //~ Error: `Dummy` doesn't implement `Debug` + dbg!(lib::Dummy); //~ ERROR `Dummy` doesn't implement `Debug` } diff --git a/tests/ui/moves/moves-based-on-type-tuple.rs b/tests/ui/moves/moves-based-on-type-tuple.rs index 2e67d8f8a69..c9951a93022 100644 --- a/tests/ui/moves/moves-based-on-type-tuple.rs +++ b/tests/ui/moves/moves-based-on-type-tuple.rs @@ -2,7 +2,7 @@ fn dup(x: Box<isize>) -> Box<(Box<isize>,Box<isize>)> { Box::new((x, x)) - //~^ use of moved value: `x` [E0382] + //~^ ERROR use of moved value: `x` [E0382] } fn main() { diff --git a/tests/ui/moves/nested-loop-moved-value-wrong-continue.rs b/tests/ui/moves/nested-loop-moved-value-wrong-continue.rs index 0235b291df5..87800d314ed 100644 --- a/tests/ui/moves/nested-loop-moved-value-wrong-continue.rs +++ b/tests/ui/moves/nested-loop-moved-value-wrong-continue.rs @@ -9,6 +9,8 @@ fn foo() { //~| NOTE inside of this loop //~| HELP consider moving the expression out of the loop //~| NOTE in this expansion of desugaring of `for` loop + //~| NOTE + //~| NOTE baz.push(foo); //~^ NOTE value moved here //~| HELP consider cloning the value @@ -30,17 +32,19 @@ fn main() { for foo in foos { //~^ NOTE this reinitialization might get skipped //~| NOTE move occurs because `foo` has type `String` + //~| NOTE for bar in &bars { //~^ NOTE inside of this loop //~| HELP consider moving the expression out of the loop //~| NOTE in this expansion of desugaring of `for` loop + //~| NOTE if foo == *bar { baz.push(foo); //~^ NOTE value moved here //~| HELP consider cloning the value continue; //~^ NOTE verify that your loop breaking logic is correct - //~| NOTE this `continue` advances the loop at line 33 + //~| NOTE this `continue` advances the loop at line 36 } } qux.push(foo); diff --git a/tests/ui/moves/nested-loop-moved-value-wrong-continue.stderr b/tests/ui/moves/nested-loop-moved-value-wrong-continue.stderr index cf863ff8af1..6ef1a4193b1 100644 --- a/tests/ui/moves/nested-loop-moved-value-wrong-continue.stderr +++ b/tests/ui/moves/nested-loop-moved-value-wrong-continue.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `foo` - --> $DIR/nested-loop-moved-value-wrong-continue.rs:19:14 + --> $DIR/nested-loop-moved-value-wrong-continue.rs:21:14 | LL | for foo in foos { for bar in &bars { if foo == *bar { | --- ---------------- inside of this loop @@ -14,13 +14,13 @@ LL | qux.push(foo); | ^^^ value used here after move | note: verify that your loop breaking logic is correct - --> $DIR/nested-loop-moved-value-wrong-continue.rs:15:9 + --> $DIR/nested-loop-moved-value-wrong-continue.rs:17:9 | LL | for foo in foos { for bar in &bars { if foo == *bar { | --------------- ---------------- ... LL | continue; - | ^^^^^^^^ this `continue` advances the loop at $DIR/nested-loop-moved-value-wrong-continue.rs:6:23: 18:8 + | ^^^^^^^^ this `continue` advances the loop at $DIR/nested-loop-moved-value-wrong-continue.rs:6:23: 20:8 help: consider moving the expression out of the loop so it is only moved once | LL ~ for foo in foos { let mut value = baz.push(foo); @@ -36,7 +36,7 @@ LL | baz.push(foo.clone()); | ++++++++ error[E0382]: use of moved value: `foo` - --> $DIR/nested-loop-moved-value-wrong-continue.rs:46:18 + --> $DIR/nested-loop-moved-value-wrong-continue.rs:50:18 | LL | for foo in foos { | --- @@ -54,7 +54,7 @@ LL | qux.push(foo); | ^^^ value used here after move | note: verify that your loop breaking logic is correct - --> $DIR/nested-loop-moved-value-wrong-continue.rs:41:17 + --> $DIR/nested-loop-moved-value-wrong-continue.rs:45:17 | LL | for foo in foos { | --------------- @@ -63,7 +63,7 @@ LL | for bar in &bars { | ---------------- ... LL | continue; - | ^^^^^^^^ this `continue` advances the loop at line 33 + | ^^^^^^^^ this `continue` advances the loop at line 36 help: consider moving the expression out of the loop so it is only moved once | LL ~ let mut value = baz.push(foo); diff --git a/tests/ui/moves/use_of_moved_value_clone_suggestions.rs b/tests/ui/moves/use_of_moved_value_clone_suggestions.rs index d5c8d4e6bdf..9a0a397a733 100644 --- a/tests/ui/moves/use_of_moved_value_clone_suggestions.rs +++ b/tests/ui/moves/use_of_moved_value_clone_suggestions.rs @@ -1,6 +1,6 @@ // `Rc` is not ever `Copy`, we should not suggest adding `T: Copy` constraint fn duplicate_rc<T>(t: std::rc::Rc<T>) -> (std::rc::Rc<T>, std::rc::Rc<T>) { - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn main() {} diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed b/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed index a5e0dd819b4..53d9cb20b3d 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.fixed @@ -4,27 +4,27 @@ fn duplicate_t<T: Copy>(t: T) -> (T, T) { //~^ HELP consider restricting type parameter `T` //~| HELP if `T` implemented `Clone`, you could clone the value - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_opt<T: Copy>(t: Option<T>) -> (Option<T>, Option<T>) { //~^ HELP consider restricting type parameter `T` - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_tup1<T: Copy>(t: (T,)) -> ((T,), (T,)) { //~^ HELP consider restricting type parameter `T` - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_tup2<A: Copy, B: Copy>(t: (A, B)) -> ((A, B), (A, B)) { //~^ HELP consider restricting type parameters - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) { //~^ HELP consider restricting type parameter `T` - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } struct S<T>(T); @@ -42,7 +42,7 @@ trait B {} // Test where bounds are added with different bound placements fn duplicate_custom_1<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) where { //~^ HELP consider restricting type parameter `T` - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_custom_2<T>(t: S<T>) -> (S<T>, S<T>) @@ -50,7 +50,7 @@ where T: A + Copy + Trait, //~^ HELP consider further restricting { - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_custom_3<T>(t: S<T>) -> (S<T>, S<T>) @@ -59,7 +59,7 @@ where //~^ HELP consider further restricting T: B, { - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_custom_4<T: A + Copy + Trait>(t: S<T>) -> (S<T>, S<T>) @@ -67,14 +67,14 @@ fn duplicate_custom_4<T: A + Copy + Trait>(t: S<T>) -> (S<T>, S<T>) where T: B, { - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } #[rustfmt::skip] fn existing_colon<T: Copy>(t: T) { //~^ HELP consider restricting type parameter `T` //~| HELP if `T` implemented `Clone`, you could clone the value - [t, t]; //~ use of moved value: `t` + [t, t]; //~ ERROR use of moved value: `t` } fn existing_colon_in_where<T>(t: T) //~ HELP if `T` implemented `Clone`, you could clone the value @@ -82,7 +82,7 @@ where T:, T: Copy //~^ HELP consider further restricting type parameter `T` { - [t, t]; //~ use of moved value: `t` + [t, t]; //~ ERROR use of moved value: `t` } fn main() {} diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.rs b/tests/ui/moves/use_of_moved_value_copy_suggestions.rs index 60ca03ed698..c8cfc80cd82 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.rs +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.rs @@ -4,27 +4,27 @@ fn duplicate_t<T>(t: T) -> (T, T) { //~^ HELP consider restricting type parameter `T` //~| HELP if `T` implemented `Clone`, you could clone the value - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_opt<T>(t: Option<T>) -> (Option<T>, Option<T>) { //~^ HELP consider restricting type parameter `T` - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_tup1<T>(t: (T,)) -> ((T,), (T,)) { //~^ HELP consider restricting type parameter `T` - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_tup2<A, B>(t: (A, B)) -> ((A, B), (A, B)) { //~^ HELP consider restricting type parameters - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_custom<T>(t: S<T>) -> (S<T>, S<T>) { //~^ HELP consider restricting type parameter `T` - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } struct S<T>(T); @@ -42,7 +42,7 @@ trait B {} // Test where bounds are added with different bound placements fn duplicate_custom_1<T>(t: S<T>) -> (S<T>, S<T>) where { //~^ HELP consider restricting type parameter `T` - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_custom_2<T>(t: S<T>) -> (S<T>, S<T>) @@ -50,7 +50,7 @@ where T: A, //~^ HELP consider further restricting { - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_custom_3<T>(t: S<T>) -> (S<T>, S<T>) @@ -59,7 +59,7 @@ where //~^ HELP consider further restricting T: B, { - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } fn duplicate_custom_4<T: A>(t: S<T>) -> (S<T>, S<T>) @@ -67,14 +67,14 @@ fn duplicate_custom_4<T: A>(t: S<T>) -> (S<T>, S<T>) where T: B, { - (t, t) //~ use of moved value: `t` + (t, t) //~ ERROR use of moved value: `t` } #[rustfmt::skip] fn existing_colon<T:>(t: T) { //~^ HELP consider restricting type parameter `T` //~| HELP if `T` implemented `Clone`, you could clone the value - [t, t]; //~ use of moved value: `t` + [t, t]; //~ ERROR use of moved value: `t` } fn existing_colon_in_where<T>(t: T) //~ HELP if `T` implemented `Clone`, you could clone the value @@ -82,7 +82,7 @@ where T:, //~^ HELP consider further restricting type parameter `T` { - [t, t]; //~ use of moved value: `t` + [t, t]; //~ ERROR use of moved value: `t` } fn main() {} diff --git a/tests/ui/never_type/fallback-closure-wrap.rs b/tests/ui/never_type/fallback-closure-wrap.rs index e7f7d5aae3f..106b82b5f78 100644 --- a/tests/ui/never_type/fallback-closure-wrap.rs +++ b/tests/ui/never_type/fallback-closure-wrap.rs @@ -17,7 +17,7 @@ use std::marker::PhantomData; fn main() { let error = Closure::wrap(Box::new(move || { panic!("Can't connect to server."); - //[fallback]~^ to return `()`, but it returns `!` + //[fallback]~^ ERROR to return `()`, but it returns `!` }) as Box<dyn FnMut()>); } diff --git a/tests/ui/nll/borrowed-match-issue-45045.rs b/tests/ui/nll/borrowed-match-issue-45045.rs index 978eeb868ed..a252dc817ca 100644 --- a/tests/ui/nll/borrowed-match-issue-45045.rs +++ b/tests/ui/nll/borrowed-match-issue-45045.rs @@ -10,7 +10,7 @@ fn main() { let f = &mut e; let g = f; match e { - //~^ cannot use `e` because it was mutably borrowed [E0503] + //~^ ERROR cannot use `e` because it was mutably borrowed [E0503] Xyz::A => println!("a"), Xyz::B => println!("b"), }; diff --git a/tests/ui/nll/issue-48697.rs b/tests/ui/nll/issue-48697.rs index 16e29ab2a8a..8cb5fc36949 100644 --- a/tests/ui/nll/issue-48697.rs +++ b/tests/ui/nll/issue-48697.rs @@ -4,7 +4,7 @@ fn foo(x: &i32) -> &i32 { let z = 4; let f = &|y| y; let k = f(&z); - f(x) //~ cannot return value referencing local variable + f(x) //~ ERROR cannot return value referencing local variable } fn main() {} diff --git a/tests/ui/nll/issue-54779-anon-static-lifetime.rs b/tests/ui/nll/issue-54779-anon-static-lifetime.rs index 6b8fa608ebb..49e4180fe8c 100644 --- a/tests/ui/nll/issue-54779-anon-static-lifetime.rs +++ b/tests/ui/nll/issue-54779-anon-static-lifetime.rs @@ -29,7 +29,7 @@ impl DebugWith<dyn DebugContext> for Foo { fmt: &mut std::fmt::Formatter<'_>, ) -> std::fmt::Result { let Foo { bar } = self; - bar.debug_with(cx); //~ borrowed data escapes outside of method + bar.debug_with(cx); //~ ERROR borrowed data escapes outside of method Ok(()) } } diff --git a/tests/ui/nll/member-constraints/nested-impl-trait-fail.rs b/tests/ui/nll/member-constraints/nested-impl-trait-fail.rs index d676c967f30..0bf32a2624f 100644 --- a/tests/ui/nll/member-constraints/nested-impl-trait-fail.rs +++ b/tests/ui/nll/member-constraints/nested-impl-trait-fail.rs @@ -15,8 +15,8 @@ where 's: 'b, { [a] - //~^ E0700 - //~| E0700 + //~^ ERROR E0700 + //~| ERROR E0700 } // Same as the above but with late-bound regions. @@ -26,8 +26,8 @@ fn fail_late_bound<'s, 'a, 'b>( _: &'b &'s u8, ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> { [a] - //~^ E0700 - //~| E0700 + //~^ ERROR E0700 + //~| ERROR E0700 } fn main() {} diff --git a/tests/ui/no_std/simple-runs.rs b/tests/ui/no_std/simple-runs.rs new file mode 100644 index 00000000000..8931ac7ed11 --- /dev/null +++ b/tests/ui/no_std/simple-runs.rs @@ -0,0 +1,41 @@ +//! Check that `no_std` binaries can link and run without depending on `libstd`. + +//@ run-pass +//@ compile-flags: -Cpanic=abort +//@ ignore-wasm different `main` convention + +#![no_std] +#![no_main] + +use core::ffi::{c_char, c_int}; +use core::panic::PanicInfo; + +// # Linux +// +// Linking `libc` is required by crt1.o, otherwise the linker fails with: +// > /usr/bin/ld: in function `_start': undefined reference to `__libc_start_main' +// +// # Apple +// +// Linking `libSystem` is required, otherwise the linker fails with: +// > ld: dynamic executables or dylibs must link with libSystem.dylib +// +// With the new linker introduced in Xcode 15, the error is instead: +// > Undefined symbols: "dyld_stub_binder", referenced from: <initial-undefines> +// +// This _can_ be worked around by raising the deployment target with +// MACOSX_DEPLOYMENT_TARGET=13.0, though it's a bit hard to test that while +// still allowing the test suite to support running with older Xcode versions. +#[cfg_attr(all(not(target_vendor = "apple"), unix), link(name = "c"))] +#[cfg_attr(target_vendor = "apple", link(name = "System"))] +extern "C" {} + +#[panic_handler] +fn panic_handler(_info: &PanicInfo<'_>) -> ! { + loop {} +} + +#[no_mangle] +extern "C" fn main(_argc: c_int, _argv: *const *const c_char) -> c_int { + 0 +} diff --git a/tests/ui/nonscalar-cast.fixed b/tests/ui/nonscalar-cast.fixed index f6154222ca2..cb5591dbb9d 100644 --- a/tests/ui/nonscalar-cast.fixed +++ b/tests/ui/nonscalar-cast.fixed @@ -12,5 +12,5 @@ impl From<Foo> for isize { } fn main() { - println!("{}", isize::from(Foo { x: 1 })); //~ non-primitive cast: `Foo` as `isize` [E0605] + println!("{}", isize::from(Foo { x: 1 })); //~ ERROR non-primitive cast: `Foo` as `isize` [E0605] } diff --git a/tests/ui/nonscalar-cast.rs b/tests/ui/nonscalar-cast.rs index 71e7c43a1db..27429b44cd0 100644 --- a/tests/ui/nonscalar-cast.rs +++ b/tests/ui/nonscalar-cast.rs @@ -12,5 +12,5 @@ impl From<Foo> for isize { } fn main() { - println!("{}", Foo { x: 1 } as isize); //~ non-primitive cast: `Foo` as `isize` [E0605] + println!("{}", Foo { x: 1 } as isize); //~ ERROR non-primitive cast: `Foo` as `isize` [E0605] } diff --git a/tests/ui/offset-of/offset-of-self.rs b/tests/ui/offset-of/offset-of-self.rs index e5730b8cf6c..0a6de2ebbb3 100644 --- a/tests/ui/offset-of/offset-of-self.rs +++ b/tests/ui/offset-of/offset-of-self.rs @@ -15,8 +15,8 @@ impl S { offset_of!(Self, v) } fn v_offs_wrong_syntax() { - offset_of!(Self, Self::v); //~ offset_of expects dot-separated field and variant names - offset_of!(S, Self); //~ no field `Self` on type `S` + offset_of!(Self, Self::v); //~ ERROR offset_of expects dot-separated field and variant names + offset_of!(S, Self); //~ ERROR no field `Self` on type `S` } fn offs_in_c() -> usize { offset_of!(C<Self>, w) @@ -48,6 +48,6 @@ fn main() { offset_of!(self::S, v); offset_of!(Self, v); //~ ERROR cannot find type `Self` in this scope - offset_of!(S, self); //~ no field `self` on type `S` - offset_of!(S, v.self); //~ no field `self` on type `u8` + offset_of!(S, self); //~ ERROR no field `self` on type `S` + offset_of!(S, v.self); //~ ERROR no field `self` on type `u8` } diff --git a/tests/ui/offset-of/offset-of-tuple.rs b/tests/ui/offset-of/offset-of-tuple.rs index db00fe05583..e8447249441 100644 --- a/tests/ui/offset-of/offset-of-tuple.rs +++ b/tests/ui/offset-of/offset-of-tuple.rs @@ -11,7 +11,7 @@ fn main() { offset_of!((u8, u8), +1); //~ ERROR no rules expected offset_of!((u8, u8), -1); //~ ERROR offset_of expects dot-separated field and variant names offset_of!((u8, u8), 1.); //~ ERROR offset_of expects dot-separated field and variant names - offset_of!((u8, u8), 1 .); //~ unexpected token: `)` + offset_of!((u8, u8), 1 .); //~ ERROR unexpected token: `)` builtin # offset_of((u8, u8), 1e2); //~ ERROR no field `1e2` builtin # offset_of((u8, u8), _0); //~ ERROR no field `_0` builtin # offset_of((u8, u8), 01); //~ ERROR no field `01` diff --git a/tests/ui/on-unimplemented/bad-annotation.rs b/tests/ui/on-unimplemented/bad-annotation.rs index 4c6610f8864..3f0f69749bf 100644 --- a/tests/ui/on-unimplemented/bad-annotation.rs +++ b/tests/ui/on-unimplemented/bad-annotation.rs @@ -25,39 +25,39 @@ trait BadAnnotation2<A,B> {} #[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{}>`"] -//~^ only named generic parameters are allowed +//~^ ERROR only named generic parameters are allowed trait BadAnnotation3<A,B> {} #[rustc_on_unimplemented(lorem="")] -//~^ this attribute must have a valid +//~^ ERROR this attribute must have a valid trait BadAnnotation4 {} #[rustc_on_unimplemented(lorem(ipsum(dolor)))] -//~^ this attribute must have a valid +//~^ ERROR this attribute must have a valid trait BadAnnotation5 {} #[rustc_on_unimplemented(message="x", message="y")] -//~^ this attribute must have a valid +//~^ ERROR this attribute must have a valid trait BadAnnotation6 {} #[rustc_on_unimplemented(message="x", on(desugared, message="y"))] -//~^ this attribute must have a valid +//~^ ERROR this attribute must have a valid trait BadAnnotation7 {} #[rustc_on_unimplemented(on(), message="y")] -//~^ empty `on`-clause +//~^ ERROR empty `on`-clause trait BadAnnotation8 {} #[rustc_on_unimplemented(on="x", message="y")] -//~^ this attribute must have a valid +//~^ ERROR this attribute must have a valid trait BadAnnotation9 {} #[rustc_on_unimplemented(on(x="y"), message="y")] trait BadAnnotation10 {} #[rustc_on_unimplemented(on(desugared, on(desugared, message="x")), message="y")] -//~^ this attribute must have a valid +//~^ ERROR this attribute must have a valid trait BadAnnotation11 {} pub fn main() { diff --git a/tests/ui/or-patterns/inner-or-pat.rs b/tests/ui/or-patterns/inner-or-pat.rs index 4d136de0053..6c7968df726 100644 --- a/tests/ui/or-patterns/inner-or-pat.rs +++ b/tests/ui/or-patterns/inner-or-pat.rs @@ -49,7 +49,7 @@ fn hey() { match x { x @ ("foo" | "bar") | (x @ "red" | (x @ "blue" | "red")) => { - //[or4]~^ variable `x` is not bound in all patterns + //[or4]~^ ERROR variable `x` is not bound in all patterns } _ => (), } diff --git a/tests/ui/or-patterns/while-parsing-this-or-pattern.rs b/tests/ui/or-patterns/while-parsing-this-or-pattern.rs index b9bfb8638b2..b034a52ac94 100644 --- a/tests/ui/or-patterns/while-parsing-this-or-pattern.rs +++ b/tests/ui/or-patterns/while-parsing-this-or-pattern.rs @@ -3,7 +3,7 @@ fn main() { match Some(42) { Some(42) | .=. => {} //~ ERROR expected pattern, found `.` - //~^ while parsing this or-pattern starting here + //~^ NOTE while parsing this or-pattern starting here //~| NOTE expected pattern } } diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-1.rs b/tests/ui/panic-handler/panic-handler-bad-signature-1.rs index 8f42f3a8897..71911afaa84 100644 --- a/tests/ui/panic-handler/panic-handler-bad-signature-1.rs +++ b/tests/ui/panic-handler/panic-handler-bad-signature-1.rs @@ -7,4 +7,4 @@ use core::panic::PanicInfo; #[panic_handler] fn panic(info: PanicInfo) -> () {} -//~^ `#[panic_handler]` function has wrong type [E0308] +//~^ ERROR `#[panic_handler]` function has wrong type [E0308] diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-2.rs b/tests/ui/panic-handler/panic-handler-bad-signature-2.rs index 79ad4598e10..9c0130eff21 100644 --- a/tests/ui/panic-handler/panic-handler-bad-signature-2.rs +++ b/tests/ui/panic-handler/panic-handler-bad-signature-2.rs @@ -7,7 +7,7 @@ use core::panic::PanicInfo; #[panic_handler] fn panic(info: &'static PanicInfo) -> ! -//~^ #[panic_handler]` function has wrong type [E0308] +//~^ ERROR #[panic_handler]` function has wrong type [E0308] { loop {} } diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-3.rs b/tests/ui/panic-handler/panic-handler-bad-signature-3.rs index 1c6e2e2ff49..14c8c7c63b7 100644 --- a/tests/ui/panic-handler/panic-handler-bad-signature-3.rs +++ b/tests/ui/panic-handler/panic-handler-bad-signature-3.rs @@ -6,6 +6,6 @@ use core::panic::PanicInfo; #[panic_handler] -fn panic() -> ! { //~ #[panic_handler]` function has wrong type [E0308] +fn panic() -> ! { //~ ERROR #[panic_handler]` function has wrong type [E0308] loop {} } diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-5.rs b/tests/ui/panic-handler/panic-handler-bad-signature-5.rs index d7ee8f25b11..a2a0e46ec68 100644 --- a/tests/ui/panic-handler/panic-handler-bad-signature-5.rs +++ b/tests/ui/panic-handler/panic-handler-bad-signature-5.rs @@ -7,7 +7,7 @@ use core::panic::PanicInfo; #[panic_handler] fn panic(info: &PanicInfo<'static>) -> ! -//~^ #[panic_handler]` function has wrong type [E0308] +//~^ ERROR #[panic_handler]` function has wrong type [E0308] { loop {} } diff --git a/tests/ui/panic-runtime/abort-link-to-unwind-dylib.rs b/tests/ui/panic-runtime/abort-link-to-unwind-dylib.rs index 8b782413f6a..a691ceb566b 100644 --- a/tests/ui/panic-runtime/abort-link-to-unwind-dylib.rs +++ b/tests/ui/panic-runtime/abort-link-to-unwind-dylib.rs @@ -1,9 +1,7 @@ //@ build-fail //@ compile-flags:-C panic=abort -C prefer-dynamic //@ needs-unwind -//@ ignore-musl - no dylibs here -//@ ignore-emscripten -//@ ignore-sgx no dynamic lib support +//@ needs-crate-type: dylib // This is a test where the local crate, compiled with `panic=abort`, links to // the standard library **dynamically** which is already linked against diff --git a/tests/ui/panic-runtime/two-panic-runtimes.rs b/tests/ui/panic-runtime/two-panic-runtimes.rs index 15c08cbe30d..7add07ef600 100644 --- a/tests/ui/panic-runtime/two-panic-runtimes.rs +++ b/tests/ui/panic-runtime/two-panic-runtimes.rs @@ -1,7 +1,6 @@ // ignore-tidy-linelength //@ build-fail -//@ compile-flags: --error-format=human -//@ error-pattern: cannot link together two panic runtimes: panic_runtime_unwind and panic_runtime_unwind2 +//@ dont-require-annotations:ERROR //@ dont-check-compiler-stderr //@ aux-build:panic-runtime-unwind.rs //@ aux-build:panic-runtime-unwind2.rs @@ -16,7 +15,8 @@ extern crate panic_runtime_lang_items; fn main() {} -// FIXME: The second and third errors are target-dependent. -//FIXME~? ERROR cannot link together two panic runtimes: panic_runtime_unwind and panic_runtime_unwind2 +//~? ERROR cannot link together two panic runtimes: panic_runtime_unwind and panic_runtime_unwind2 +// FIXME: These errors are target-dependent, could be served by some "optional error" annotation +// instead of `dont-require-annotations`. //FIXME~? ERROR the linked panic runtime `panic_runtime_unwind2` is not compiled with this crate's panic strategy `abort` //FIXME~? ERROR the crate `panic_runtime_unwind` requires panic strategy `unwind` which is incompatible with this crate's strategy of `abort` diff --git a/tests/ui/panic-runtime/want-abort-got-unwind.rs b/tests/ui/panic-runtime/want-abort-got-unwind.rs index ed61c2613df..1ae2e623f10 100644 --- a/tests/ui/panic-runtime/want-abort-got-unwind.rs +++ b/tests/ui/panic-runtime/want-abort-got-unwind.rs @@ -1,7 +1,6 @@ // ignore-tidy-linelength //@ build-fail -//@ compile-flags: --error-format=human -//@ error-pattern: the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort` +//@ dont-require-annotations:ERROR //@ dont-check-compiler-stderr //@ aux-build:panic-runtime-unwind.rs //@ compile-flags:-C panic=abort @@ -10,7 +9,8 @@ extern crate panic_runtime_unwind; fn main() {} -// FIXME: The first and third errors are target-dependent. +//~? ERROR the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort` +// FIXME: These errors are target-dependent, could be served by some "optional error" annotation +// instead of `dont-require-annotations`. //FIXME~? ERROR cannot link together two panic runtimes: panic_unwind and panic_runtime_unwind -//FIXME~? ERROR the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort` //FIXME~? ERROR the crate `panic_unwind` requires panic strategy `unwind` which is incompatible with this crate's strategy of `abort` diff --git a/tests/ui/panic-runtime/want-abort-got-unwind2.rs b/tests/ui/panic-runtime/want-abort-got-unwind2.rs index 504fd779e09..dc4d3ea86d8 100644 --- a/tests/ui/panic-runtime/want-abort-got-unwind2.rs +++ b/tests/ui/panic-runtime/want-abort-got-unwind2.rs @@ -1,7 +1,6 @@ // ignore-tidy-linelength //@ build-fail -//@ compile-flags: --error-format=human -//@ error-pattern: the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort` +//@ dont-require-annotations:ERROR //@ dont-check-compiler-stderr //@ aux-build:panic-runtime-unwind.rs //@ aux-build:wants-panic-runtime-unwind.rs @@ -11,7 +10,8 @@ extern crate wants_panic_runtime_unwind; fn main() {} -// FIXME: The first and third errors are target-dependent. +//~? ERROR the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort` +// FIXME: These errors are target-dependent, could be served by some "optional error" annotation +// instead of `dont-require-annotations`. //FIXME~? ERROR cannot link together two panic runtimes: panic_unwind and panic_runtime_unwind -//FIXME~? ERROR the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort` //FIXME~? ERROR the crate `panic_unwind` requires panic strategy `unwind` which is incompatible with this crate's strategy of `abort` diff --git a/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.rs b/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.rs index b23cb9ce917..73d173022f6 100644 --- a/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.rs +++ b/tests/ui/parallel-rustc/cache-after-waiting-issue-111528.rs @@ -10,7 +10,7 @@ pub fn a() { #[export_name="fail"] pub fn b() { -//~^ Error symbol `fail` is already defined +//~^ ERROR symbol `fail` is already defined } fn main() {} diff --git a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs index 41a7de03d4b..acd608e27c6 100644 --- a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs +++ b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs @@ -8,4 +8,4 @@ macro_rules! foo { () { // >>>>>>> 7a4f13c blah blah blah } -} //~ this file contains an unclosed delimiter +} //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr index b33f2b5d1b8..a5558352b69 100644 --- a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr +++ b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/unclosed-delims-in-macro.rs:11:48 + --> $DIR/unclosed-delims-in-macro.rs:11:54 | LL | macro_rules! foo { | - unclosed delimiter @@ -8,7 +8,7 @@ LL | () { | - this delimiter might not be properly closed... ... LL | } - | - ^ + | - ^ | | | ...as it matches this but it has different indentation diff --git a/tests/ui/parser/diff-markers/unclosed-delims.rs b/tests/ui/parser/diff-markers/unclosed-delims.rs index 827c1eebb9d..daf2a9bac98 100644 --- a/tests/ui/parser/diff-markers/unclosed-delims.rs +++ b/tests/ui/parser/diff-markers/unclosed-delims.rs @@ -9,4 +9,4 @@ mod tests { fn test2() { >>>>>>> 7a4f13c blah blah blah } -} //~ this file contains an unclosed delimiter +} //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/diff-markers/unclosed-delims.stderr b/tests/ui/parser/diff-markers/unclosed-delims.stderr index b2541aa47ba..cb083a043b8 100644 --- a/tests/ui/parser/diff-markers/unclosed-delims.stderr +++ b/tests/ui/parser/diff-markers/unclosed-delims.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/unclosed-delims.rs:12:48 + --> $DIR/unclosed-delims.rs:12:54 | LL | mod tests { | - unclosed delimiter @@ -8,7 +8,7 @@ LL | fn test1() { | - this delimiter might not be properly closed... ... LL | } - | - ^ + | - ^ | | | ...as it matches this but it has different indentation diff --git a/tests/ui/parser/do-catch-suggests-try.rs b/tests/ui/parser/do-catch-suggests-try.rs index f64568d06e9..fcd55ce4059 100644 --- a/tests/ui/parser/do-catch-suggests-try.rs +++ b/tests/ui/parser/do-catch-suggests-try.rs @@ -3,7 +3,7 @@ fn main() { let _: Option<()> = do catch {}; //~^ ERROR found removed `do catch` syntax - //~| replace with the new syntax + //~| HELP replace with the new syntax //~| following RFC #2388, the new non-placeholder syntax is `try` let _recovery_witness: () = 1; //~ ERROR mismatched types diff --git a/tests/ui/parser/float-field.rs b/tests/ui/parser/float-field.rs index 59fefee26aa..9bf4d90fb46 100644 --- a/tests/ui/parser/float-field.rs +++ b/tests/ui/parser/float-field.rs @@ -39,11 +39,11 @@ fn main() { { s.0x1.1; } //~ ERROR hexadecimal float literal is not supported //~| ERROR unexpected token: `0x1.1` - //~| expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.1` + //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.1` { s.0x1.1e1; } //~ ERROR hexadecimal float literal is not supported //~| ERROR unexpected token: `0x1.1e1` - //~| expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.1e1` + //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `0x1.1e1` { s.0x1e+; } //~ ERROR expected expression, found `;` diff --git a/tests/ui/parser/impl-parsing-2.rs b/tests/ui/parser/impl-parsing-2.rs new file mode 100644 index 00000000000..7a71217b21c --- /dev/null +++ b/tests/ui/parser/impl-parsing-2.rs @@ -0,0 +1,4 @@ +impl ! {} // OK + +default unsafe FAIL //~ ERROR expected item, found keyword `unsafe` +//~^ ERROR `default` is not followed by an item diff --git a/tests/ui/parser/impl-parsing-2.stderr b/tests/ui/parser/impl-parsing-2.stderr new file mode 100644 index 00000000000..45e2c428242 --- /dev/null +++ b/tests/ui/parser/impl-parsing-2.stderr @@ -0,0 +1,18 @@ +error: `default` is not followed by an item + --> $DIR/impl-parsing-2.rs:3:1 + | +LL | default unsafe FAIL + | ^^^^^^^ the `default` qualifier + | + = note: only `fn`, `const`, `type`, or `impl` items may be prefixed by `default` + +error: expected item, found keyword `unsafe` + --> $DIR/impl-parsing-2.rs:3:9 + | +LL | default unsafe FAIL + | ^^^^^^ expected item + | + = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/impl-parsing.rs b/tests/ui/parser/impl-parsing.rs index 80ce8885570..7692a81dd42 100644 --- a/tests/ui/parser/impl-parsing.rs +++ b/tests/ui/parser/impl-parsing.rs @@ -2,9 +2,4 @@ impl ! {} // OK impl ! where u8: Copy {} // OK impl Trait Type {} //~ ERROR missing `for` in a trait impl -impl Trait .. {} //~ ERROR missing `for` in a trait impl impl ?Sized for Type {} //~ ERROR expected a trait, found type -impl ?Sized for .. {} //~ ERROR expected a trait, found type - -default unsafe FAIL //~ ERROR expected item, found keyword `unsafe` -//~^ ERROR `default` is not followed by an item diff --git a/tests/ui/parser/impl-parsing.stderr b/tests/ui/parser/impl-parsing.stderr index 6a24a9453e6..b2512120dc8 100644 --- a/tests/ui/parser/impl-parsing.stderr +++ b/tests/ui/parser/impl-parsing.stderr @@ -9,44 +9,11 @@ help: add `for` here LL | impl Trait for Type {} | +++ -error: missing `for` in a trait impl - --> $DIR/impl-parsing.rs:5:11 - | -LL | impl Trait .. {} - | ^ - | -help: add `for` here - | -LL | impl Trait for .. {} - | +++ - error: expected a trait, found type - --> $DIR/impl-parsing.rs:6:6 + --> $DIR/impl-parsing.rs:5:6 | LL | impl ?Sized for Type {} | ^^^^^^ -error: expected a trait, found type - --> $DIR/impl-parsing.rs:7:6 - | -LL | impl ?Sized for .. {} - | ^^^^^^ - -error: `default` is not followed by an item - --> $DIR/impl-parsing.rs:9:1 - | -LL | default unsafe FAIL - | ^^^^^^^ the `default` qualifier - | - = note: only `fn`, `const`, `type`, or `impl` items may be prefixed by `default` - -error: expected item, found keyword `unsafe` - --> $DIR/impl-parsing.rs:9:9 - | -LL | default unsafe FAIL - | ^^^^^^ expected item - | - = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> - -error: aborting due to 6 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/parser/intersection-patterns-1.fixed b/tests/ui/parser/intersection-patterns-1.fixed index f63d57472cf..8ade795f7ee 100644 --- a/tests/ui/parser/intersection-patterns-1.fixed +++ b/tests/ui/parser/intersection-patterns-1.fixed @@ -16,8 +16,8 @@ fn main() { match s { y @ Some(x) => {} //~^ ERROR pattern on wrong side of `@` - //~| pattern on the left, should be on the right - //~| binding on the right, should be on the left + //~| NOTE pattern on the left, should be on the right + //~| NOTE binding on the right, should be on the left //~| HELP switch the order //~| SUGGESTION y @ Some(x) _ => {} @@ -26,8 +26,8 @@ fn main() { match 2 { e @ 1..=5 => {} //~^ ERROR pattern on wrong side of `@` - //~| pattern on the left, should be on the right - //~| binding on the right, should be on the left + //~| NOTE pattern on the left, should be on the right + //~| NOTE binding on the right, should be on the left //~| HELP switch the order //~| SUGGESTION e @ 1..=5 _ => {} diff --git a/tests/ui/parser/intersection-patterns-1.rs b/tests/ui/parser/intersection-patterns-1.rs index 3a457659aac..b5a7892fd1c 100644 --- a/tests/ui/parser/intersection-patterns-1.rs +++ b/tests/ui/parser/intersection-patterns-1.rs @@ -16,8 +16,8 @@ fn main() { match s { Some(x) @ y => {} //~^ ERROR pattern on wrong side of `@` - //~| pattern on the left, should be on the right - //~| binding on the right, should be on the left + //~| NOTE pattern on the left, should be on the right + //~| NOTE binding on the right, should be on the left //~| HELP switch the order //~| SUGGESTION y @ Some(x) _ => {} @@ -26,8 +26,8 @@ fn main() { match 2 { 1 ..= 5 @ e => {} //~^ ERROR pattern on wrong side of `@` - //~| pattern on the left, should be on the right - //~| binding on the right, should be on the left + //~| NOTE pattern on the left, should be on the right + //~| NOTE binding on the right, should be on the left //~| HELP switch the order //~| SUGGESTION e @ 1..=5 _ => {} diff --git a/tests/ui/parser/intersection-patterns-2.rs b/tests/ui/parser/intersection-patterns-2.rs index 408415e87ef..387127fc4d9 100644 --- a/tests/ui/parser/intersection-patterns-2.rs +++ b/tests/ui/parser/intersection-patterns-2.rs @@ -12,8 +12,8 @@ fn main() { match s { Some(x) @ Some(y) => {} //~^ ERROR left-hand side of `@` must be a binding - //~| interpreted as a pattern, not a binding - //~| also a pattern + //~| NOTE interpreted as a pattern, not a binding + //~| NOTE also a pattern //~| NOTE bindings are `x`, `mut x`, `ref x`, and `ref mut x` _ => {} } diff --git a/tests/ui/parser/issues/issue-101477-enum.fixed b/tests/ui/parser/issues/issue-101477-enum.fixed index 92c2b7c470f..7fd08b65929 100644 --- a/tests/ui/parser/issues/issue-101477-enum.fixed +++ b/tests/ui/parser/issues/issue-101477-enum.fixed @@ -4,7 +4,7 @@ enum Demo { A = 1, B = 2 //~ ERROR unexpected `==` - //~^ expected item, found `==` + //~^ ERROR expected item, found `==` } fn main() {} diff --git a/tests/ui/parser/issues/issue-101477-enum.rs b/tests/ui/parser/issues/issue-101477-enum.rs index 21d377384d3..2e9d6b25c14 100644 --- a/tests/ui/parser/issues/issue-101477-enum.rs +++ b/tests/ui/parser/issues/issue-101477-enum.rs @@ -4,7 +4,7 @@ enum Demo { A = 1, B == 2 //~ ERROR unexpected `==` - //~^ expected item, found `==` + //~^ ERROR expected item, found `==` } fn main() {} diff --git a/tests/ui/parser/issues/issue-102806.rs b/tests/ui/parser/issues/issue-102806.rs index ba297bdc967..5ee8c5c1e3d 100644 --- a/tests/ui/parser/issues/issue-102806.rs +++ b/tests/ui/parser/issues/issue-102806.rs @@ -15,7 +15,7 @@ fn pz(v: V3) { //~^ ERROR expected `..` let _ = V3 { z: 0.0, ... }; - //~^ expected identifier + //~^ ERROR expected identifier //~| ERROR missing fields `x` and `y` in initializer of `V3` let V3 { z: val, ... } = v; diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs index e6235b1e892..c137e136335 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs +++ b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs @@ -10,5 +10,6 @@ const async const fn test() {} //~| ERROR functions cannot be both `const` and `async` //~| NOTE `const` because of this //~| NOTE `async` because of this +//~| NOTE fn main() {} diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs index 40f993eafbb..49a49d337c4 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs +++ b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs @@ -15,5 +15,6 @@ async unsafe const fn test() {} //~| ERROR functions cannot be both `const` and `async` //~| NOTE `const` because of this //~| NOTE `async` because of this +//~| NOTE fn main() {} diff --git a/tests/ui/parser/issues/issue-89574.rs b/tests/ui/parser/issues/issue-89574.rs index 276abfe7110..4d28ad051df 100644 --- a/tests/ui/parser/issues/issue-89574.rs +++ b/tests/ui/parser/issues/issue-89574.rs @@ -1,5 +1,5 @@ fn main() { const EMPTY_ARRAY = []; - //~^ missing type for `const` item + //~^ ERROR missing type for `const` item //~| ERROR type annotations needed } diff --git a/tests/ui/parser/issues/issue-93867.rs b/tests/ui/parser/issues/issue-93867.rs index 50744792391..192b1581896 100644 --- a/tests/ui/parser/issues/issue-93867.rs +++ b/tests/ui/parser/issues/issue-93867.rs @@ -5,6 +5,6 @@ pub struct Entry<'a, K, V> { pub fn entry<'a, K, V>() -> Entry<'a K, V> { // ^ missing comma -//~^^ expected one of `,` or `>`, found `K` +//~^^ ERROR expected one of `,` or `>`, found `K` unimplemented!() } diff --git a/tests/ui/parser/keyword-try-as-identifier-edition2018.rs b/tests/ui/parser/keyword-try-as-identifier-edition2018.rs index 27452f4d45e..795f32059f2 100644 --- a/tests/ui/parser/keyword-try-as-identifier-edition2018.rs +++ b/tests/ui/parser/keyword-try-as-identifier-edition2018.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2018 +//@ edition: 2018 fn main() { let try = "foo"; //~ error: expected identifier, found reserved keyword `try` diff --git a/tests/ui/parser/macro/macro-expand-to-field.rs b/tests/ui/parser/macro/macro-expand-to-field.rs index ccdcf013cd2..f5100a5d700 100644 --- a/tests/ui/parser/macro/macro-expand-to-field.rs +++ b/tests/ui/parser/macro/macro-expand-to-field.rs @@ -49,7 +49,7 @@ enum EnumVariantField { field!(oopsies:()), //~^ NOTE macros cannot expand to struct fields //~| ERROR unexpected token: `!` - //~| unexpected token after this + //~| NOTE unexpected token after this field!(oopsies2:()), }, } diff --git a/tests/ui/parser/raw/issue-70677-panic-on-unterminated-raw-str-at-eof.rs b/tests/ui/parser/raw/issue-70677-panic-on-unterminated-raw-str-at-eof.rs index bdfc29a3d57..b7afb8fff81 100644 --- a/tests/ui/parser/raw/issue-70677-panic-on-unterminated-raw-str-at-eof.rs +++ b/tests/ui/parser/raw/issue-70677-panic-on-unterminated-raw-str-at-eof.rs @@ -2,4 +2,4 @@ // the last byte in the file (including not having a trailing newline) // Prior to the fix you get the error: 'expected item, found `r" ...`' // because the string being unterminated wasn't properly detected. -r" //~ unterminated raw string +r" //~ ERROR unterminated raw string diff --git a/tests/ui/parser/raw/raw-byte-string-eof.rs b/tests/ui/parser/raw/raw-byte-string-eof.rs index b74907b72b0..d62aa332c2f 100644 --- a/tests/ui/parser/raw/raw-byte-string-eof.rs +++ b/tests/ui/parser/raw/raw-byte-string-eof.rs @@ -1,3 +1,3 @@ pub fn main() { - br##"a"#; //~ unterminated raw string + br##"a"#; //~ ERROR unterminated raw string } diff --git a/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.rs b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.rs index b6611e6273d..1f19f4b9c06 100644 --- a/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.rs +++ b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.rs @@ -6,7 +6,7 @@ fn foo2<T: fn(i32)>(_: T) {} fn main() { foo(|| ()); - //~^ mismatched types + //~^ ERROR mismatched types foo2(|_: ()| {}); - //~^ type mismatch in closure arguments + //~^ ERROR type mismatch in closure arguments } diff --git a/tests/ui/parser/require-parens-for-chained-comparison.rs b/tests/ui/parser/require-parens-for-chained-comparison.rs index 916f1b83db2..21a908923f2 100644 --- a/tests/ui/parser/require-parens-for-chained-comparison.rs +++ b/tests/ui/parser/require-parens-for-chained-comparison.rs @@ -27,7 +27,7 @@ fn main() { //~| ERROR invalid label name f<'_>(); - //~^ comparison operators cannot be chained + //~^ ERROR comparison operators cannot be chained //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments //~| ERROR expected //~| HELP add `'` to close the char literal diff --git a/tests/ui/parser/shebang/issue-71471-ignore-tidy.rs b/tests/ui/parser/shebang/issue-71471-ignore-tidy.rs index e9bff91f1e8..858c06048cc 100644 --- a/tests/ui/parser/shebang/issue-71471-ignore-tidy.rs +++ b/tests/ui/parser/shebang/issue-71471-ignore-tidy.rs @@ -1,4 +1,4 @@ -#!B //~ expected `[`, found `B` +#!B //~ ERROR expected `[`, found `B` //@ reference: input.shebang diff --git a/tests/ui/parser/shebang/shebang-must-start-file.rs b/tests/ui/parser/shebang/shebang-must-start-file.rs index f91e32f744e..f956cff3b08 100644 --- a/tests/ui/parser/shebang/shebang-must-start-file.rs +++ b/tests/ui/parser/shebang/shebang-must-start-file.rs @@ -1,5 +1,5 @@ // something on the first line for tidy -#!/bin/bash //~ expected `[`, found `/` +#!/bin/bash //~ ERROR expected `[`, found `/` //@ reference: input.shebang diff --git a/tests/ui/pattern/non-structural-match-types-cycle-err.rs b/tests/ui/pattern/non-structural-match-types-cycle-err.rs new file mode 100644 index 00000000000..a8e494c35b0 --- /dev/null +++ b/tests/ui/pattern/non-structural-match-types-cycle-err.rs @@ -0,0 +1,24 @@ +//@ edition:2021 + +struct AnyOption<T>(T); +impl<T> AnyOption<T> { + const NONE: Option<T> = None; +} + +// This is an unfortunate side-effect of borrowchecking nested items +// together with their parent. Evaluating the `AnyOption::<_>::NONE` +// pattern for exhaustiveness checking relies on the layout of the +// async block. This layout relies on `optimized_mir` of the nested +// item which is now borrowck'd together with its parent. As +// borrowck of the parent requires us to have already lowered the match, +// this is a query cycle. + +fn uwu() {} +fn defines() { + match Some(async {}) { + AnyOption::<_>::NONE => {} + //~^ ERROR cycle detected when building THIR for `defines` + _ => {} + } +} +fn main() {} diff --git a/tests/ui/pattern/non-structural-match-types-cycle-err.stderr b/tests/ui/pattern/non-structural-match-types-cycle-err.stderr new file mode 100644 index 00000000000..2f4ac63fc57 --- /dev/null +++ b/tests/ui/pattern/non-structural-match-types-cycle-err.stderr @@ -0,0 +1,64 @@ +error[E0391]: cycle detected when building THIR for `defines` + --> $DIR/non-structural-match-types-cycle-err.rs:19:9 + | +LL | AnyOption::<_>::NONE => {} + | ^^^^^^^^^^^^^^^^^^^^ + | +note: ...which requires evaluating type-level constant... + --> $DIR/non-structural-match-types-cycle-err.rs:5:5 + | +LL | const NONE: Option<T> = None; + | ^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires const-evaluating + checking `<impl at $DIR/non-structural-match-types-cycle-err.rs:4:1: 4:21>::NONE`... + --> $DIR/non-structural-match-types-cycle-err.rs:5:5 + | +LL | const NONE: Option<T> = None; + | ^^^^^^^^^^^^^^^^^^^^^ + = note: ...which requires computing layout of `core::option::Option<{async block@$DIR/non-structural-match-types-cycle-err.rs:18:16: 18:21}>`... + = note: ...which requires computing layout of `{async block@$DIR/non-structural-match-types-cycle-err.rs:18:16: 18:21}`... +note: ...which requires optimizing MIR for `defines::{closure#0}`... + --> $DIR/non-structural-match-types-cycle-err.rs:18:16 + | +LL | match Some(async {}) { + | ^^^^^ +note: ...which requires elaborating drops for `defines::{closure#0}`... + --> $DIR/non-structural-match-types-cycle-err.rs:18:16 + | +LL | match Some(async {}) { + | ^^^^^ +note: ...which requires borrow-checking `defines`... + --> $DIR/non-structural-match-types-cycle-err.rs:17:1 + | +LL | fn defines() { + | ^^^^^^^^^^^^ +note: ...which requires promoting constants in MIR for `defines`... + --> $DIR/non-structural-match-types-cycle-err.rs:17:1 + | +LL | fn defines() { + | ^^^^^^^^^^^^ +note: ...which requires checking if `defines` contains FFI-unwind calls... + --> $DIR/non-structural-match-types-cycle-err.rs:17:1 + | +LL | fn defines() { + | ^^^^^^^^^^^^ +note: ...which requires building MIR for `defines`... + --> $DIR/non-structural-match-types-cycle-err.rs:17:1 + | +LL | fn defines() { + | ^^^^^^^^^^^^ +note: ...which requires match-checking `defines`... + --> $DIR/non-structural-match-types-cycle-err.rs:17:1 + | +LL | fn defines() { + | ^^^^^^^^^^^^ + = note: ...which again requires building THIR for `defines`, completing the cycle +note: cycle used when unsafety-checking `defines` + --> $DIR/non-structural-match-types-cycle-err.rs:17:1 + | +LL | fn defines() { + | ^^^^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/pattern/non-structural-match-types.rs b/tests/ui/pattern/non-structural-match-types.rs index 5869767c936..a5ff7fcdb5e 100644 --- a/tests/ui/pattern/non-structural-match-types.rs +++ b/tests/ui/pattern/non-structural-match-types.rs @@ -1,6 +1,4 @@ //@ edition:2021 -#![feature(const_async_blocks)] - struct AnyOption<T>(T); impl<T> AnyOption<T> { const NONE: Option<T> = None; @@ -19,11 +17,5 @@ fn defines() { //~^ ERROR constant of non-structural type _ => {} } - - match Some(async {}) { - AnyOption::<_>::NONE => {} - //~^ ERROR constant of non-structural type - _ => {} - } } fn main() {} diff --git a/tests/ui/pattern/non-structural-match-types.stderr b/tests/ui/pattern/non-structural-match-types.stderr index da675a9f3ff..3b74ffe7cb7 100644 --- a/tests/ui/pattern/non-structural-match-types.stderr +++ b/tests/ui/pattern/non-structural-match-types.stderr @@ -1,5 +1,5 @@ error: constant of non-structural type `Option<fn() {uwu}>` in a pattern - --> $DIR/non-structural-match-types.rs:12:9 + --> $DIR/non-structural-match-types.rs:10:9 | LL | impl<T> AnyOption<T> { | -------------------- @@ -11,8 +11,8 @@ LL | AnyOption::<_>::NONE => {} | = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details -error: constant of non-structural type `Option<{closure@$DIR/non-structural-match-types.rs:17:16: 17:18}>` in a pattern - --> $DIR/non-structural-match-types.rs:18:9 +error: constant of non-structural type `Option<{closure@$DIR/non-structural-match-types.rs:15:16: 15:18}>` in a pattern + --> $DIR/non-structural-match-types.rs:16:9 | LL | impl<T> AnyOption<T> { | -------------------- @@ -24,19 +24,5 @@ LL | AnyOption::<_>::NONE => {} | = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details -error: constant of non-structural type `Option<{async block@$DIR/non-structural-match-types.rs:23:16: 23:21}>` in a pattern - --> $DIR/non-structural-match-types.rs:24:9 - | -LL | impl<T> AnyOption<T> { - | -------------------- -LL | const NONE: Option<T> = None; - | --------------------- constant defined here -... -LL | AnyOption::<_>::NONE => {} - | ^^^^^^^^^^^^^^^^^^^^ constant of non-structural type - | - = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details - = note: `ResumeTy` must be annotated with `#[derive(PartialEq)]` to be usable in patterns - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/patkind-ref-binding-issue-114896.fixed b/tests/ui/pattern/patkind-ref-binding-issue-114896.fixed index 086a119eb77..2eeca4bdb7a 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-114896.fixed +++ b/tests/ui/pattern/patkind-ref-binding-issue-114896.fixed @@ -5,6 +5,6 @@ fn main() { fn x(a: &char) { let &(mut b) = a; b.make_ascii_uppercase(); -//~^ cannot borrow `b` as mutable, as it is not declared as mutable + //~^ ERROR cannot borrow `b` as mutable, as it is not declared as mutable } } diff --git a/tests/ui/pattern/patkind-ref-binding-issue-114896.rs b/tests/ui/pattern/patkind-ref-binding-issue-114896.rs index b4d6b72c01f..f074246b782 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-114896.rs +++ b/tests/ui/pattern/patkind-ref-binding-issue-114896.rs @@ -5,6 +5,6 @@ fn main() { fn x(a: &char) { let &b = a; b.make_ascii_uppercase(); -//~^ cannot borrow `b` as mutable, as it is not declared as mutable + //~^ ERROR cannot borrow `b` as mutable, as it is not declared as mutable } } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs index 621ca7cc792..c171dcf0ca6 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/borrowck-errors.rs @@ -13,14 +13,14 @@ /// to fail in HIR typeck on stable. As such, they need to be separate from the other tests. fn errors_caught_in_hir_typeck_on_stable() { let [&x] = &[&mut 0]; - //[stable2021]~^ mismatched types + //[stable2021]~^ ERROR mismatched types //[stable2021]~| types differ in mutability //[classic2024]~^^^ ERROR: cannot move out of type #[cfg(any(classic2021, structural2021))] let _: u32 = x; #[cfg(structural2024)] let _: &u32 = x; let [&x] = &mut [&mut 0]; - //[stable2021]~^ mismatched types + //[stable2021]~^ ERROR mismatched types //[stable2021]~| types differ in mutability //[classic2024]~^^^ ERROR: cannot move out of type #[cfg(any(classic2021, structural2021))] let _: u32 = x; @@ -34,7 +34,7 @@ pub fn main() { } let &ref mut x = &0; - //~^ cannot borrow data in a `&` reference as mutable [E0596] + //~^ ERROR cannot borrow data in a `&` reference as mutable [E0596] // For 2021 edition, this is also a regression test for #136223 // since the maximum mutability is downgraded during the pattern check process. diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.rs index c8e988ad76d..94691e77bd8 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.rs @@ -28,6 +28,6 @@ pub fn main() { let [&mut mut x] = &[&mut 0]; //[classic2024]~^ ERROR: mismatched types //[classic2024]~| cannot match inherited `&` with `&mut` pattern - //[structural2024]~^^^ binding cannot be both mutable and by-reference + //[structural2024]~^^^ ERROR binding cannot be both mutable and by-reference #[cfg(any(stable2021, classic2021, structural2021))] { x = 0 } } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs index 62c1c28022b..877b10dcfd5 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs @@ -30,63 +30,63 @@ pub fn main() { #[cfg(any(classic2024, structural2024))] let _: &u32 = x; } if let Some(Some(&&x)) = &Some(Some(&0)) { - //[stable2021,classic2021,structural2021]~^ mismatched types + //[stable2021,classic2021,structural2021]~^ ERROR mismatched types //[stable2021,classic2021,structural2021]~| expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: u32 = x; } // Tests for eating a lone inherited reference if let Some(Some(&x)) = &Some(&Some(0)) { - //[stable2021]~^ mismatched types + //[stable2021]~^ ERROR mismatched types //[stable2021]~| expected integer, found `&_` #[cfg(any(classic2021, structural2021, classic2024, structural2024))] let _: u32 = x; } if let Some(&Some(x)) = &Some(Some(0)) { - //[stable2021]~^ mismatched types + //[stable2021]~^ ERROR mismatched types //[stable2021]~| expected `Option<{integer}>`, found `&_` #[cfg(any(classic2021, structural2021, classic2024, structural2024))] let _: u32 = x; } if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { - //[stable2021]~^ mismatched types + //[stable2021]~^ ERROR mismatched types //[stable2021]~| expected integer, found `&mut _` #[cfg(any(classic2021, structural2021, classic2024, structural2024))] let _: u32 = x; } // Tests for `&` patterns matching real `&mut` reference types if let Some(&Some(&x)) = Some(&Some(&mut 0)) { - //[stable2021]~^ mismatched types + //[stable2021]~^ ERROR mismatched types //[stable2021]~| types differ in mutability #[cfg(any(classic2021, structural2021, classic2024, structural2024))] let _: u32 = x; } // Tests for eating only one layer and also eating a lone inherited reference if let Some(&Some(&x)) = &Some(&Some(0)) { - //[stable2021,classic2021,structural2021]~^ mismatched types + //[stable2021,classic2021,structural2021]~^ ERROR mismatched types //[stable2021,classic2021,structural2021]~| expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: u32 = x; } // Tests for `&` matching a lone inherited possibly-`&mut` reference if let Some(&Some(Some(&x))) = &Some(Some(&mut Some(0))) { - //[stable2021]~^ mismatched types + //[stable2021]~^ ERROR mismatched types //[stable2021]~| expected `Option<&mut Option<{integer}>>`, found `&_` #[cfg(any(classic2021, structural2021, classic2024, structural2024))] let _: u32 = x; } if let Some(&Some(x)) = &mut Some(Some(0)) { - //[stable2021]~^ mismatched types + //[stable2021]~^ ERROR mismatched types //[stable2021]~| expected `Option<{integer}>`, found `&_` #[cfg(any(classic2021, structural2021, classic2024, structural2024))] let _: u32 = x; } // Tests eating one layer, eating a lone inherited ref, and `&` eating `&mut` (realness varies) if let Some(&Some(&x)) = &Some(&mut Some(0)) { - //[stable2021,classic2021,structural2021]~^ mismatched types + //[stable2021,classic2021,structural2021]~^ ERROR mismatched types //[stable2021]~| types differ in mutability //[classic2021,structural2021]~| expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: u32 = x; } if let Some(&Some(&x)) = &mut Some(&Some(0)) { - //[stable2021,classic2021,structural2021]~^ mismatched types + //[stable2021,classic2021,structural2021]~^ ERROR mismatched types //[stable2021,classic2021,structural2021]~| expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: u32 = x; } @@ -94,46 +94,46 @@ pub fn main() { // Tests for eat-inner and eat-both rulesets matching on the outer reference if matching on the // inner reference causes a mutability mismatch. i.e. tests for "fallback-to-outer" deref rules. let [&mut x] = &mut [&0]; - //[stable2021]~^ mismatched types + //[stable2021]~^ ERROR mismatched types //[stable2021]~| types differ in mutability #[cfg(any(classic2021, structural2021))] let _: u32 = x; #[cfg(any(classic2024, structural2024))] let _: &u32 = x; let [&mut ref x] = &mut [&0]; - //[stable2021]~^ mismatched types + //[stable2021]~^ ERROR mismatched types //[stable2021]~| types differ in mutability #[cfg(any(classic2021, structural2021))] let _: &u32 = x; #[cfg(any(classic2024, structural2024))] let _: &&u32 = x; fn borrowck_error_on_structural2021() { let [&mut ref mut x] = &mut [&0]; - //[stable2021]~^ mismatched types + //[stable2021]~^ ERROR mismatched types //[stable2021]~| types differ in mutability - //[classic2021,structural2021]~^^^ cannot borrow data in a `&` reference as mutable + //[classic2021,structural2021]~^^^ ERROR cannot borrow data in a `&` reference as mutable #[cfg(any(classic2024, structural2024))] let _: &mut &u32 = x; } borrowck_error_on_structural2021(); let [&mut mut x] = &mut [&0]; - //[stable2021]~^ mismatched types + //[stable2021]~^ ERROR mismatched types //[stable2021]~| types differ in mutability #[cfg(any(classic2021, structural2021))] let _: u32 = x; #[cfg(any(classic2024, structural2024))] let _: &u32 = x; let [&mut &x] = &mut [&0]; - //[stable2021,classic2021,structural2021]~^ mismatched types + //[stable2021,classic2021,structural2021]~^ ERROR mismatched types //[stable2021]~| types differ in mutability //[classic2021,structural2021]~| expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: u32 = x; let [&mut &ref x] = &mut [&0]; - //[stable2021,classic2021,structural2021]~^ mismatched types + //[stable2021,classic2021,structural2021]~^ ERROR mismatched types //[stable2021]~| types differ in mutability //[classic2021,structural2021]~| expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: &u32 = x; let [&mut &(mut x)] = &mut [&0]; - //[stable2021,classic2021,structural2021]~^ mismatched types + //[stable2021,classic2021,structural2021]~^ ERROR mismatched types //[stable2021]~| types differ in mutability //[classic2021,structural2021]~| expected integer, found `&_` #[cfg(any(classic2024, structural2024))] let _: u32 = x; diff --git a/tests/ui/pattern/usefulness/doc-hidden-fields.rs b/tests/ui/pattern/usefulness/doc-hidden-fields.rs index 549e0d1af55..a3c3740b34a 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-fields.rs +++ b/tests/ui/pattern/usefulness/doc-hidden-fields.rs @@ -13,14 +13,14 @@ struct InCrate { fn main() { let HiddenStruct { one, two } = HiddenStruct::default(); - //~^ pattern requires `..` due to inaccessible fields + //~^ ERROR pattern requires `..` due to inaccessible fields let HiddenStruct { one } = HiddenStruct::default(); - //~^ pattern does not mention field `two` and inaccessible fields + //~^ ERROR pattern does not mention field `two` and inaccessible fields let HiddenStruct { one, hide } = HiddenStruct::default(); - //~^ pattern does not mention field `two` + //~^ ERROR pattern does not mention field `two` let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; - //~^ pattern does not mention field `im_hidden` + //~^ ERROR pattern does not mention field `im_hidden` } diff --git a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.rs b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.rs index 56842917f50..4bbdc7b139f 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.rs +++ b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.rs @@ -16,28 +16,28 @@ fn main() { HiddenEnum::A => {} HiddenEnum::B => {} } - //~^^^^ non-exhaustive patterns: `_` not covered + //~^^^^ ERROR non-exhaustive patterns: `_` not covered match HiddenEnum::A { HiddenEnum::A => {} HiddenEnum::C => {} } - //~^^^^ non-exhaustive patterns: `HiddenEnum::B` not covered + //~^^^^ ERROR non-exhaustive patterns: `HiddenEnum::B` not covered match HiddenEnum::A { HiddenEnum::A => {} } - //~^^^ non-exhaustive patterns: `HiddenEnum::B` and `_` not covered + //~^^^ ERROR non-exhaustive patterns: `HiddenEnum::B` and `_` not covered match None { None => {} Some(HiddenEnum::A) => {} } - //~^^^^ non-exhaustive patterns: `Some(HiddenEnum::B)` and `Some(_)` not covered + //~^^^^ ERROR non-exhaustive patterns: `Some(HiddenEnum::B)` and `Some(_)` not covered match InCrate::A { InCrate::A => {} InCrate::B => {} } - //~^^^^ non-exhaustive patterns: `InCrate::C` not covered + //~^^^^ ERROR non-exhaustive patterns: `InCrate::C` not covered } diff --git a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs index d0a8a10f2f3..4a7b2c956fc 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs +++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.rs @@ -24,12 +24,12 @@ enum E { //~| NOTE not covered //~| NOTE not covered C - //~^ not covered - //~| not covered - //~| not covered - //~| not covered - //~| not covered - //~| not covered + //~^ NOTE not covered + //~| NOTE not covered + //~| NOTE not covered + //~| NOTE not covered + //~| NOTE not covered + //~| NOTE not covered } fn by_val(e: E) { @@ -42,7 +42,7 @@ fn by_val(e: E) { let E::A = e; //~^ ERROR refutable pattern in local binding - //~| patterns `E::B` and `E::C` not covered + //~| NOTE patterns `E::B` and `E::C` not covered //~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with //~| NOTE for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html //~| NOTE the matched value is of type `E` @@ -51,14 +51,14 @@ fn by_val(e: E) { fn by_ref_once(e: &E) { match e { //~^ ERROR non-exhaustive patterns - //~| patterns `&E::B` and `&E::C` not covered + //~| NOTE patterns `&E::B` and `&E::C` not covered //~| NOTE the matched value is of type `&E` E::A => {} } let E::A = e; //~^ ERROR refutable pattern in local binding - //~| patterns `&E::B` and `&E::C` not covered + //~| NOTE patterns `&E::B` and `&E::C` not covered //~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with //~| NOTE for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html //~| NOTE the matched value is of type `&E` @@ -67,14 +67,14 @@ fn by_ref_once(e: &E) { fn by_ref_thrice(e: & &mut &E) { match e { //~^ ERROR non-exhaustive patterns - //~| patterns `&&mut &E::B` and `&&mut &E::C` not covered + //~| NOTE patterns `&&mut &E::B` and `&&mut &E::C` not covered //~| NOTE the matched value is of type `&&mut &E` E::A => {} } let E::A = e; //~^ ERROR refutable pattern in local binding - //~| patterns `&&mut &E::B` and `&&mut &E::C` not covered + //~| NOTE patterns `&&mut &E::B` and `&&mut &E::C` not covered //~| NOTE `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with //~| NOTE for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html //~| NOTE the matched value is of type `&&mut &E` @@ -93,7 +93,7 @@ enum Opt { fn ref_pat(e: Opt) { match e { //~^ ERROR non-exhaustive patterns - //~| pattern `Opt::None` not covered + //~| NOTE pattern `Opt::None` not covered //~| NOTE the matched value is of type `Opt` Opt::Some(ref _x) => {} } diff --git a/tests/ui/pattern/usefulness/stable-gated-fields.rs b/tests/ui/pattern/usefulness/stable-gated-fields.rs index 61b202b77f6..7be2722daac 100644 --- a/tests/ui/pattern/usefulness/stable-gated-fields.rs +++ b/tests/ui/pattern/usefulness/stable-gated-fields.rs @@ -6,10 +6,10 @@ use unstable::UnstableStruct; fn main() { let UnstableStruct { stable } = UnstableStruct::default(); - //~^ pattern does not mention field `stable2` and inaccessible fields + //~^ ERROR pattern does not mention field `stable2` and inaccessible fields let UnstableStruct { stable, stable2 } = UnstableStruct::default(); - //~^ pattern requires `..` due to inaccessible fields + //~^ ERROR pattern requires `..` due to inaccessible fields // OK: stable field is matched let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); diff --git a/tests/ui/pattern/usefulness/stable-gated-patterns.rs b/tests/ui/pattern/usefulness/stable-gated-patterns.rs index 5ceffbf0923..d5848344154 100644 --- a/tests/ui/pattern/usefulness/stable-gated-patterns.rs +++ b/tests/ui/pattern/usefulness/stable-gated-patterns.rs @@ -8,11 +8,11 @@ fn main() { match UnstableEnum::Stable { UnstableEnum::Stable => {} } - //~^^^ non-exhaustive patterns: `UnstableEnum::Stable2` and `_` not covered + //~^^^ ERROR non-exhaustive patterns: `UnstableEnum::Stable2` and `_` not covered match UnstableEnum::Stable { UnstableEnum::Stable => {} UnstableEnum::Stable2 => {} } - //~^^^^ non-exhaustive patterns: `_` not covered + //~^^^^ ERROR non-exhaustive patterns: `_` not covered } diff --git a/tests/ui/pattern/usefulness/unstable-gated-fields.rs b/tests/ui/pattern/usefulness/unstable-gated-fields.rs index e6a4494867a..08b46283f65 100644 --- a/tests/ui/pattern/usefulness/unstable-gated-fields.rs +++ b/tests/ui/pattern/usefulness/unstable-gated-fields.rs @@ -8,10 +8,10 @@ use unstable::UnstableStruct; fn main() { let UnstableStruct { stable, stable2, } = UnstableStruct::default(); - //~^ pattern does not mention field `unstable` + //~^ ERROR pattern does not mention field `unstable` let UnstableStruct { stable, unstable, } = UnstableStruct::default(); - //~^ pattern does not mention field `stable2` + //~^ ERROR pattern does not mention field `stable2` // OK: stable field is matched let UnstableStruct { stable, stable2, unstable } = UnstableStruct::default(); diff --git a/tests/ui/pattern/usefulness/unstable-gated-patterns.rs b/tests/ui/pattern/usefulness/unstable-gated-patterns.rs index e6db495a149..3acc0738bbc 100644 --- a/tests/ui/pattern/usefulness/unstable-gated-patterns.rs +++ b/tests/ui/pattern/usefulness/unstable-gated-patterns.rs @@ -11,7 +11,7 @@ fn main() { UnstableEnum::Stable => {} UnstableEnum::Stable2 => {} } - //~^^^^ non-exhaustive patterns: `UnstableEnum::Unstable` not covered + //~^^^^ ERROR non-exhaustive patterns: `UnstableEnum::Unstable` not covered // Ok: all variants are explicitly matched match UnstableEnum::Stable { diff --git a/tests/ui/precondition-checks/read.rs b/tests/ui/precondition-checks/read.rs index ab9921a0cee..d5ab7773987 100644 --- a/tests/ui/precondition-checks/read.rs +++ b/tests/ui/precondition-checks/read.rs @@ -2,7 +2,7 @@ //@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes //@ error-pattern: unsafe precondition(s) violated: ptr::read requires //@ revisions: null misaligned -//@ ignore-test +//@ ignore-test (unimplemented) use std::ptr; diff --git a/tests/ui/precondition-checks/write.rs b/tests/ui/precondition-checks/write.rs index f76e776fcf3..5d6b9586fad 100644 --- a/tests/ui/precondition-checks/write.rs +++ b/tests/ui/precondition-checks/write.rs @@ -2,7 +2,7 @@ //@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes //@ error-pattern: unsafe precondition(s) violated: ptr::write requires //@ revisions: null misaligned -//@ ignore-test +//@ ignore-test (unimplemented) use std::ptr; diff --git a/tests/ui/precondition-checks/write_bytes.rs b/tests/ui/precondition-checks/write_bytes.rs index 3f64be9d1ee..be4f5a089f0 100644 --- a/tests/ui/precondition-checks/write_bytes.rs +++ b/tests/ui/precondition-checks/write_bytes.rs @@ -2,7 +2,7 @@ //@ compile-flags: -Copt-level=3 -Cdebug-assertions=no -Zub-checks=yes //@ error-pattern: unsafe precondition(s) violated: ptr::write requires //@ revisions: null misaligned -//@ ignore-test +//@ ignore-test (unimplemented) use std::ptr; diff --git a/tests/ui/print-calling-conventions.stdout b/tests/ui/print-calling-conventions.stdout index 539b2d5dee4..feee8cc3aa9 100644 --- a/tests/ui/print-calling-conventions.stdout +++ b/tests/ui/print-calling-conventions.stdout @@ -19,7 +19,6 @@ riscv-interrupt-m riscv-interrupt-s rust-call rust-cold -rust-intrinsic stdcall stdcall-unwind system diff --git a/tests/ui/privacy/privacy3.rs b/tests/ui/privacy/privacy3.rs index 2bb3c1b3c61..ec213285b40 100644 --- a/tests/ui/privacy/privacy3.rs +++ b/tests/ui/privacy/privacy3.rs @@ -22,7 +22,7 @@ fn test1() { //~^ ERROR requires `sized` lang_item use bar::gpriv; //~^ ERROR unresolved import `bar::gpriv` [E0432] - //~| no `gpriv` in `bar` + //~| NOTE no `gpriv` in `bar` // This should pass because the compiler will insert a fake name binding // for `gpriv` diff --git a/tests/ui/proc-macro/issue-50493.rs b/tests/ui/proc-macro/issue-50493.rs index e23f1f7c7d8..4a88eee2185 100644 --- a/tests/ui/proc-macro/issue-50493.rs +++ b/tests/ui/proc-macro/issue-50493.rs @@ -5,7 +5,7 @@ extern crate issue_50493; #[derive(Derive)] struct Restricted { - pub(in restricted) field: usize, //~ visibilities can only be restricted to ancestor modules + pub(in restricted) field: usize, //~ ERROR visibilities can only be restricted to ancestor modules } mod restricted {} diff --git a/tests/ui/proc-macro/issue-91800.rs b/tests/ui/proc-macro/issue-91800.rs index bc78bcacfd0..8cecfad32b5 100644 --- a/tests/ui/proc-macro/issue-91800.rs +++ b/tests/ui/proc-macro/issue-91800.rs @@ -6,11 +6,14 @@ extern crate issue_91800_macro; #[derive(MyTrait)] //~^ ERROR macros that expand to items must be delimited with braces or followed by a semicolon //~| ERROR proc-macro derive produced unparsable tokens +//~| ERROR #[attribute_macro] //~^ ERROR macros that expand to items must be delimited with braces or followed by a semicolon +//~| ERROR struct MyStruct; fn_macro! {} //~^ ERROR macros that expand to items must be delimited with braces or followed by a semicolon +//~| ERROR fn main() {} diff --git a/tests/ui/proc-macro/issue-91800.stderr b/tests/ui/proc-macro/issue-91800.stderr index d831d62e919..63ebc0a552e 100644 --- a/tests/ui/proc-macro/issue-91800.stderr +++ b/tests/ui/proc-macro/issue-91800.stderr @@ -21,7 +21,7 @@ LL | #[derive(MyTrait)] = note: this error originates in the derive macro `MyTrait` (in Nightly builds, run with -Z macro-backtrace for more info) error: macros that expand to items must be delimited with braces or followed by a semicolon - --> $DIR/issue-91800.rs:9:1 + --> $DIR/issue-91800.rs:10:1 | LL | #[attribute_macro] | ^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | #[attribute_macro] = note: this error originates in the attribute macro `attribute_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: - --> $DIR/issue-91800.rs:9:1 + --> $DIR/issue-91800.rs:10:1 | LL | #[attribute_macro] | ^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL | #[attribute_macro] = note: this error originates in the attribute macro `attribute_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: macros that expand to items must be delimited with braces or followed by a semicolon - --> $DIR/issue-91800.rs:13:1 + --> $DIR/issue-91800.rs:15:1 | LL | fn_macro! {} | ^^^^^^^^^^^^ @@ -45,7 +45,7 @@ LL | fn_macro! {} = note: this error originates in the macro `fn_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: - --> $DIR/issue-91800.rs:13:1 + --> $DIR/issue-91800.rs:15:1 | LL | fn_macro! {} | ^^^^^^^^^^^^ diff --git a/tests/ui/proc-macro/pub-at-crate-root.rs b/tests/ui/proc-macro/pub-at-crate-root.rs index 32e4999a71b..b8de66967b1 100644 --- a/tests/ui/proc-macro/pub-at-crate-root.rs +++ b/tests/ui/proc-macro/pub-at-crate-root.rs @@ -5,7 +5,7 @@ extern crate proc_macro; -pub mod a { //~ `proc-macro` crate types currently cannot export any items +pub mod a { //~ ERROR `proc-macro` crate types currently cannot export any items use proc_macro::TokenStream; #[proc_macro_derive(B)] diff --git a/tests/ui/process/win-command-curdir-no-verbatim.rs b/tests/ui/process/win-command-curdir-no-verbatim.rs new file mode 100644 index 00000000000..99943e1c8ab --- /dev/null +++ b/tests/ui/process/win-command-curdir-no-verbatim.rs @@ -0,0 +1,36 @@ +// Test that windows verbatim paths in `Command::current_dir` are converted to +// non-verbatim paths before passing to the subprocess. + +//@ run-pass +//@ only-windows +//@ needs-subprocess + +use std::env; +use std::process::Command; + +fn main() { + if env::args().skip(1).any(|s| s == "--child") { + child(); + } else { + parent(); + } +} + +fn parent() { + let exe = env::current_exe().unwrap(); + let dir = env::current_dir().unwrap(); + let status = Command::new(&exe) + .arg("--child") + .current_dir(dir.canonicalize().unwrap()) + .spawn() + .unwrap() + .wait() + .unwrap(); + assert_eq!(status.code(), Some(0)); +} + +fn child() { + let current_dir = env::current_dir().unwrap(); + let current_dir = current_dir.as_os_str().as_encoded_bytes(); + assert!(!current_dir.starts_with(br"\\?\")); +} diff --git a/tests/ui/pub/pub-restricted.rs b/tests/ui/pub/pub-restricted.rs index bcd21082f75..2aa24121335 100644 --- a/tests/ui/pub/pub-restricted.rs +++ b/tests/ui/pub/pub-restricted.rs @@ -1,8 +1,8 @@ mod a {} -pub (a) fn afn() {} //~ incorrect visibility restriction -pub (b) fn bfn() {} //~ incorrect visibility restriction -pub (crate::a) fn cfn() {} //~ incorrect visibility restriction +pub (a) fn afn() {} //~ ERROR incorrect visibility restriction +pub (b) fn bfn() {} //~ ERROR incorrect visibility restriction +pub (crate::a) fn cfn() {} //~ ERROR incorrect visibility restriction pub fn privfn() {} mod x { @@ -19,7 +19,7 @@ mod y { pub (super) s: usize, valid_private: usize, pub (in y) valid_in_x: usize, - pub (a) invalid: usize, //~ incorrect visibility restriction + pub (a) invalid: usize, //~ ERROR incorrect visibility restriction pub (in x) non_parent_invalid: usize, //~ ERROR visibilities can only be restricted } } @@ -28,4 +28,4 @@ fn main() {} // test multichar names mod xyz {} -pub (xyz) fn xyz() {} //~ incorrect visibility restriction +pub (xyz) fn xyz() {} //~ ERROR incorrect visibility restriction diff --git a/tests/ui/repr/attr-usage-repr.rs b/tests/ui/repr/attr-usage-repr.rs index d8515a12e05..cbf99f16e03 100644 --- a/tests/ui/repr/attr-usage-repr.rs +++ b/tests/ui/repr/attr-usage-repr.rs @@ -45,7 +45,7 @@ enum EInt { B, } -#[repr()] //~ attribute should be applied to a struct, enum, function, associated function, or union [E0517] +#[repr()] //~ ERROR attribute should be applied to a struct, enum, function, associated function, or union [E0517] type SirThisIsAType = i32; #[repr()] diff --git a/tests/ui/resolve/crate-called-as-function.rs b/tests/ui/resolve/crate-called-as-function.rs index e8f52c0c029..30922d923f4 100644 --- a/tests/ui/resolve/crate-called-as-function.rs +++ b/tests/ui/resolve/crate-called-as-function.rs @@ -1,3 +1,3 @@ fn main() { - ::foo() //~ cannot find external crate `foo` in the crate root + ::foo() //~ ERROR cannot find external crate `foo` in the crate root } diff --git a/tests/ui/resolve/dont-compute-arg-names-for-non-fn.rs b/tests/ui/resolve/dont-compute-arg-names-for-non-fn.rs index 20bbbff8fd2..4053ccdfbf1 100644 --- a/tests/ui/resolve/dont-compute-arg-names-for-non-fn.rs +++ b/tests/ui/resolve/dont-compute-arg-names-for-non-fn.rs @@ -3,7 +3,7 @@ extern crate foreign_trait_with_assoc; use foreign_trait_with_assoc::Foo; -// Make sure we don't try to call `fn_arg_names` on a non-fn item. +// Make sure we don't try to call `fn_arg_idents` on a non-fn item. impl Foo for Bar {} //~^ ERROR cannot find type `Bar` in this scope diff --git a/tests/ui/resolve/issue-118295.rs b/tests/ui/resolve/issue-118295.rs index 37a49baee80..d8c6310300a 100644 --- a/tests/ui/resolve/issue-118295.rs +++ b/tests/ui/resolve/issue-118295.rs @@ -1,11 +1,11 @@ macro_rules! {} //~^ ERROR cannot find macro `macro_rules` in this scope //~| NOTE maybe you have forgotten to define a name for this `macro_rules!` -//~| put a macro name here +//~| NOTE put a macro name here macro_rules!{} //~^ ERROR cannot find macro `macro_rules` in this scope //~| NOTE maybe you have forgotten to define a name for this `macro_rules!` -//~| put a macro name here +//~| NOTE put a macro name here fn main() {} diff --git a/tests/ui/resolve/tool-import.rs b/tests/ui/resolve/tool-import.rs index bde375a2c49..951505b92a0 100644 --- a/tests/ui/resolve/tool-import.rs +++ b/tests/ui/resolve/tool-import.rs @@ -1,7 +1,7 @@ //@ edition: 2018 use clippy::time::Instant; -//~^ `clippy` is a tool module +//~^ ERROR `clippy` is a tool module fn main() { Instant::now(); diff --git a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs index ecd3f588119..7216b0294dc 100644 --- a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs +++ b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs @@ -4,15 +4,15 @@ struct A { impl A { fn new(cofig: String) -> Self { - Self { config } //~ Error cannot find value `config` in this scope + Self { config } //~ ERROR cannot find value `config` in this scope } fn do_something(cofig: String) { - println!("{config}"); //~ Error cannot find value `config` in this scope + println!("{config}"); //~ ERROR cannot find value `config` in this scope } fn self_is_available(self, cofig: String) { - println!("{config}"); //~ Error cannot find value `config` in this scope + println!("{config}"); //~ ERROR cannot find value `config` in this scope } } diff --git a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr index f1f53e300ab..400969c279e 100644 --- a/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr +++ b/tests/ui/rfcs/rfc-1937-termination-trait/issue-103052-2.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `Something: Termination` is not satisfied LL | fn main() -> Something { | ^^^^^^^^^ the trait `Termination` is not implemented for `Something` | -note: required by a bound in `Main::{synthetic#0}` +note: required by a bound in `Main::{anon_assoc#0}` --> $DIR/issue-103052-2.rs:3:27 | LL | fn main() -> impl std::process::Termination; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Main::{synthetic#0}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Main::{anon_assoc#0}` error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs index 5809e56fb7b..ba800e315b1 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/omitted-patterns.rs @@ -63,14 +63,14 @@ fn main() { } match non_enum { - //~^ some variants are not matched explicitly + //~^ ERROR some variants are not matched explicitly NonExhaustiveEnum::Unit => {} NonExhaustiveEnum::Tuple(_) => {} _ => {} } match non_enum { - //~^ some variants are not matched explicitly + //~^ ERROR some variants are not matched explicitly NonExhaustiveEnum::Unit | NonExhaustiveEnum::Struct { .. } => {} _ => {} } @@ -91,7 +91,7 @@ fn main() { _ => {} } match (non_enum, true) { - //~^ some variants are not matched explicitly + //~^ ERROR some variants are not matched explicitly (NonExhaustiveEnum::Unit, true) => {} (NonExhaustiveEnum::Tuple(_), false) => {} _ => {} @@ -104,14 +104,14 @@ fn main() { _ => {} } match (true, non_enum) { - //~^ some variants are not matched explicitly + //~^ ERROR some variants are not matched explicitly (true, NonExhaustiveEnum::Unit) => {} (false, NonExhaustiveEnum::Tuple(_)) => {} _ => {} } match Some(non_enum) { - //~^ some variants are not matched explicitly + //~^ ERROR some variants are not matched explicitly Some(NonExhaustiveEnum::Unit) => {} Some(NonExhaustiveEnum::Tuple(_)) => {} _ => {} @@ -127,7 +127,7 @@ fn main() { } match NestedNonExhaustive::B { - //~^ some variants are not matched explicitly + //~^ ERROR some variants are not matched explicitly NestedNonExhaustive::A(NonExhaustiveEnum::Unit) => {} NestedNonExhaustive::A(_) => {} NestedNonExhaustive::B => {} @@ -138,17 +138,17 @@ fn main() { VariantNonExhaustive::Baz(_, _) => {} VariantNonExhaustive::Bar { x, .. } => {} } - //~^^ some fields are not explicitly listed + //~^^ ERROR some fields are not explicitly listed let FunctionalRecord { first_field, second_field, .. } = FunctionalRecord::default(); - //~^ some fields are not explicitly listed + //~^ ERROR some fields are not explicitly listed // Ok: this is local let Foo { a, b, .. } = Foo::default(); let NestedStruct { bar: NormalStruct { first_field, .. }, .. } = NestedStruct::default(); - //~^ some fields are not explicitly listed - //~^^ some fields are not explicitly listed + //~^ ERROR some fields are not explicitly listed + //~^^ ERROR some fields are not explicitly listed // Ok: this tests https://github.com/rust-lang/rust/issues/89382 let MixedVisFields { a, b, .. } = MixedVisFields::default(); @@ -182,7 +182,7 @@ fn main() { if let NonExhaustiveEnum::Tuple(_) = non_enum {} match UnstableEnum::Stable { - //~^ some variants are not matched explicitly + //~^ ERROR some variants are not matched explicitly UnstableEnum::Stable => {} UnstableEnum::Stable2 => {} _ => {} @@ -204,19 +204,19 @@ fn main() { } match OnlyUnstableEnum::Unstable { - //~^ some variants are not matched explicitly + //~^ ERROR some variants are not matched explicitly OnlyUnstableEnum::Unstable => {} _ => {} } let OnlyUnstableStruct { unstable, .. } = OnlyUnstableStruct::new(); - //~^ some fields are not explicitly listed + //~^ ERROR some fields are not explicitly listed // OK: both unstable fields are matched with feature on let OnlyUnstableStruct { unstable, unstable2, .. } = OnlyUnstableStruct::new(); let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); - //~^ some fields are not explicitly listed + //~^ ERROR some fields are not explicitly listed // OK: both unstable and stable fields are matched with feature on let UnstableStruct { stable, stable2, unstable, .. } = UnstableStruct::default(); @@ -226,11 +226,11 @@ fn main() { // Ok: missing patterns will be blocked by the pattern being refutable let local_refutable @ NonExhaustiveEnum::Unit = NonExhaustiveEnum::Unit; - //~^ refutable pattern in local binding + //~^ ERROR refutable pattern in local binding // Check that matching on a reference results in a correct diagnostic match &non_enum { - //~^ some variants are not matched explicitly + //~^ ERROR some variants are not matched explicitly //~| pattern `&NonExhaustiveEnum::Struct { .. }` not covered NonExhaustiveEnum::Unit => {} NonExhaustiveEnum::Tuple(_) => {} @@ -238,21 +238,21 @@ fn main() { } match (true, &non_enum) { - //~^ some variants are not matched explicitly + //~^ ERROR some variants are not matched explicitly //~| patterns `(_, &NonExhaustiveEnum::Tuple(_))` and `(_, &NonExhaustiveEnum::Struct { .. })` not covered (true, NonExhaustiveEnum::Unit) => {} _ => {} } match (&non_enum, true) { - //~^ some variants are not matched explicitly + //~^ ERROR some variants are not matched explicitly //~| patterns `(&NonExhaustiveEnum::Tuple(_), _)` and `(&NonExhaustiveEnum::Struct { .. }, _)` not covered (NonExhaustiveEnum::Unit, true) => {} _ => {} } match Some(&non_enum) { - //~^ some variants are not matched explicitly + //~^ ERROR some variants are not matched explicitly //~| pattern `Some(&NonExhaustiveEnum::Struct { .. })` not covered Some(NonExhaustiveEnum::Unit | NonExhaustiveEnum::Tuple(_)) => {} _ => {} diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs index 6d3072f3ddd..6e064251b72 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/stable-omitted-patterns.rs @@ -19,7 +19,7 @@ fn main() { #[deny(non_exhaustive_omitted_patterns)] match UnstableEnum::Stable { - //~^ some variants are not matched explicitly + //~^ ERROR some variants are not matched explicitly UnstableEnum::Stable => {} _ => {} } @@ -37,7 +37,7 @@ fn main() { #[warn(non_exhaustive_omitted_patterns)] let UnstableStruct { stable, .. } = UnstableStruct::default(); - //~^ some fields are not explicitly listed + //~^ WARN some fields are not explicitly listed // OK: stable field is matched #[warn(non_exhaustive_omitted_patterns)] diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.rs b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.rs index 8b491ee4e30..038f53034ab 100644 --- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.rs +++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-enum-not-wf.rs @@ -33,7 +33,7 @@ enum RefIndirect<'a, T> { enum RefDouble<'a, 'b, T> { RefDoubleVariant1(&'a RequireOutlives<'b, T>), - //~^ the parameter type `T` may not live long enough [E0309] + //~^ ERROR the parameter type `T` may not live long enough [E0309] } fn main() {} diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/extern_block_nonascii_forbidden.rs b/tests/ui/rfcs/rfc-2457-non-ascii-idents/extern_block_nonascii_forbidden.rs index ad682540430..1d064ec5403 100644 --- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/extern_block_nonascii_forbidden.rs +++ b/tests/ui/rfcs/rfc-2457-non-ascii-idents/extern_block_nonascii_forbidden.rs @@ -1,9 +1,9 @@ #![feature(extern_types)] extern "C" { - type 一; //~ items in `extern` blocks cannot use non-ascii identifiers - fn 二(); //~ items in `extern` blocks cannot use non-ascii identifiers - static 三: usize; //~ items in `extern` blocks cannot use non-ascii identifiers + type 一; //~ ERROR items in `extern` blocks cannot use non-ascii identifiers + fn 二(); //~ ERROR items in `extern` blocks cannot use non-ascii identifiers + static 三: usize; //~ ERROR items in `extern` blocks cannot use non-ascii identifiers } fn main() {} diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.rs b/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.rs index e949e2319c1..90a7347f6a1 100644 --- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.rs +++ b/tests/ui/rfcs/rfc-2457-non-ascii-idents/mod_file_nonascii_forbidden.rs @@ -1,4 +1,4 @@ -mod řųśť; //~ trying to load file for -//~^ file not found for +mod řųśť; //~ ERROR trying to load file for +//~^ ERROR file not found for fn main() {} diff --git a/tests/ui/rfcs/rfc-2457-non-ascii-idents/no_mangle_nonascii_forbidden.rs b/tests/ui/rfcs/rfc-2457-non-ascii-idents/no_mangle_nonascii_forbidden.rs index f4c126a6e02..dc36c7539e9 100644 --- a/tests/ui/rfcs/rfc-2457-non-ascii-idents/no_mangle_nonascii_forbidden.rs +++ b/tests/ui/rfcs/rfc-2457-non-ascii-idents/no_mangle_nonascii_forbidden.rs @@ -1,11 +1,11 @@ #[no_mangle] -pub fn řųśť() {} //~ `#[no_mangle]` requires ASCII identifier +pub fn řųśť() {} //~ ERROR `#[no_mangle]` requires ASCII identifier pub struct Foo; impl Foo { #[no_mangle] - pub fn řųśť() {} //~ `#[no_mangle]` requires ASCII identifier + pub fn řųśť() {} //~ ERROR `#[no_mangle]` requires ASCII identifier } trait Bar { @@ -14,7 +14,7 @@ trait Bar { impl Bar for Foo { #[no_mangle] - fn řųśť() {} //~ `#[no_mangle]` requires ASCII identifier + fn řųśť() {} //~ ERROR `#[no_mangle]` requires ASCII identifier } fn main() {} diff --git a/tests/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.rs b/tests/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.rs index f1a54ee5867..3de88fcaecb 100644 --- a/tests/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.rs +++ b/tests/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.rs @@ -6,7 +6,7 @@ struct P<T> { impl<T> P<T> { fn y(&self, y: f64) -> Self { P{y, .. self.clone() } } - //~^ mismatched types [E0308] + //~^ ERROR mismatched types [E0308] } fn main() {} diff --git a/tests/ui/rust-2018/edition-lint-nested-paths.fixed b/tests/ui/rust-2018/edition-lint-nested-paths.fixed index 742732ebc49..93ccb2fe6af 100644 --- a/tests/ui/rust-2018/edition-lint-nested-paths.fixed +++ b/tests/ui/rust-2018/edition-lint-nested-paths.fixed @@ -4,9 +4,9 @@ use crate::foo::{a, b}; //~^ ERROR absolute paths must start with -//~| this is accepted in the current edition +//~| WARN this is accepted in the current edition //~| ERROR absolute paths must start with -//~| this is accepted in the current edition +//~| WARN this is accepted in the current edition mod foo { pub(crate) fn a() {} @@ -21,9 +21,9 @@ fn main() { { use crate::foo::{self as x, c}; //~^ ERROR absolute paths must start with - //~| this is accepted in the current edition + //~| WARN this is accepted in the current edition //~| ERROR absolute paths must start with - //~| this is accepted in the current edition + //~| WARN this is accepted in the current edition x::a(); c(); } diff --git a/tests/ui/rust-2018/edition-lint-nested-paths.rs b/tests/ui/rust-2018/edition-lint-nested-paths.rs index 861ca521bb7..1c1d21dbab9 100644 --- a/tests/ui/rust-2018/edition-lint-nested-paths.rs +++ b/tests/ui/rust-2018/edition-lint-nested-paths.rs @@ -4,9 +4,9 @@ use foo::{a, b}; //~^ ERROR absolute paths must start with -//~| this is accepted in the current edition +//~| WARN this is accepted in the current edition //~| ERROR absolute paths must start with -//~| this is accepted in the current edition +//~| WARN this is accepted in the current edition mod foo { pub(crate) fn a() {} @@ -21,9 +21,9 @@ fn main() { { use foo::{self as x, c}; //~^ ERROR absolute paths must start with - //~| this is accepted in the current edition + //~| WARN this is accepted in the current edition //~| ERROR absolute paths must start with - //~| this is accepted in the current edition + //~| WARN this is accepted in the current edition x::a(); c(); } diff --git a/tests/ui/rust-2021/future-prelude-collision-generic-trait.fixed b/tests/ui/rust-2021/future-prelude-collision-generic-trait.fixed index ea104011873..129fdaeaeb2 100644 --- a/tests/ui/rust-2021/future-prelude-collision-generic-trait.fixed +++ b/tests/ui/rust-2021/future-prelude-collision-generic-trait.fixed @@ -23,7 +23,7 @@ where fn try_into(&self) -> Result<&U, i32> { <U as PyTryFrom<'_, _>>::try_from(self) //~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021 - //~| this is accepted in the current edition (Rust 2018) + //~| WARN this is accepted in the current edition (Rust 2018) } } diff --git a/tests/ui/rust-2021/future-prelude-collision-generic-trait.rs b/tests/ui/rust-2021/future-prelude-collision-generic-trait.rs index ce7dd2fdac7..4e4d5d0d667 100644 --- a/tests/ui/rust-2021/future-prelude-collision-generic-trait.rs +++ b/tests/ui/rust-2021/future-prelude-collision-generic-trait.rs @@ -23,7 +23,7 @@ where fn try_into(&self) -> Result<&U, i32> { U::try_from(self) //~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021 - //~| this is accepted in the current edition (Rust 2018) + //~| WARN this is accepted in the current edition (Rust 2018) } } diff --git a/tests/ui/rust-2021/future-prelude-collision-generic.fixed b/tests/ui/rust-2021/future-prelude-collision-generic.fixed index 3546b1aef6c..bb852832456 100644 --- a/tests/ui/rust-2021/future-prelude-collision-generic.fixed +++ b/tests/ui/rust-2021/future-prelude-collision-generic.fixed @@ -27,11 +27,11 @@ impl std::iter::FromIterator<i32> for Generic<'static, i32> { fn main() { <Generic<'_, _> as MyFromIter>::from_iter(1); //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021 - //~| this is accepted in the current edition (Rust 2018) + //~| WARN this is accepted in the current edition (Rust 2018) <Generic::<'static, i32> as MyFromIter>::from_iter(1); //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021 - //~| this is accepted in the current edition (Rust 2018) + //~| WARN this is accepted in the current edition (Rust 2018) <Generic::<'_, _> as MyFromIter>::from_iter(1); //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021 - //~| this is accepted in the current edition (Rust 2018) + //~| WARN this is accepted in the current edition (Rust 2018) } diff --git a/tests/ui/rust-2021/future-prelude-collision-generic.rs b/tests/ui/rust-2021/future-prelude-collision-generic.rs index 1ae5e8fce23..bcaced88763 100644 --- a/tests/ui/rust-2021/future-prelude-collision-generic.rs +++ b/tests/ui/rust-2021/future-prelude-collision-generic.rs @@ -27,11 +27,11 @@ impl std::iter::FromIterator<i32> for Generic<'static, i32> { fn main() { Generic::from_iter(1); //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021 - //~| this is accepted in the current edition (Rust 2018) + //~| WARN this is accepted in the current edition (Rust 2018) Generic::<'static, i32>::from_iter(1); //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021 - //~| this is accepted in the current edition (Rust 2018) + //~| WARN this is accepted in the current edition (Rust 2018) Generic::<'_, _>::from_iter(1); //~^ WARNING trait-associated function `from_iter` will become ambiguous in Rust 2021 - //~| this is accepted in the current edition (Rust 2018) + //~| WARN this is accepted in the current edition (Rust 2018) } diff --git a/tests/ui/rust-2024/reserved-guarded-strings.rs b/tests/ui/rust-2024/reserved-guarded-strings.rs index ae68d34cb86..ae4bd670fca 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings.rs +++ b/tests/ui/rust-2024/reserved-guarded-strings.rs @@ -46,13 +46,13 @@ fn main() { //~^ ERROR prefix `blah` is unknown //~| ERROR invalid string literal - demo2!(## "foo"); //~ reserved multi-hash token is forbidden - demo3!("foo"###); //~ reserved multi-hash token is forbidden - demo3!(### "foo"); //~ reserved multi-hash token is forbidden - demo3!(## "foo"#); //~ reserved multi-hash token is forbidden + demo2!(## "foo"); //~ ERROR reserved multi-hash token is forbidden + demo3!("foo"###); //~ ERROR reserved multi-hash token is forbidden + demo3!(### "foo"); //~ ERROR reserved multi-hash token is forbidden + demo3!(## "foo"#); //~ ERROR reserved multi-hash token is forbidden demo5!(### "foo"###); - //~^ reserved multi-hash token is forbidden - //~| reserved multi-hash token is forbidden + //~^ ERROR reserved multi-hash token is forbidden + //~| ERROR reserved multi-hash token is forbidden demo1!(#""); //~ ERROR invalid string literal demo1!(#""#); //~ ERROR invalid string literal diff --git a/tests/ui/sanitizer/cfi/assoc-ty-lifetime-issue-123053.rs b/tests/ui/sanitizer/cfi/assoc-ty-lifetime-issue-123053.rs index dd604b6bf7d..f4f383e008a 100644 --- a/tests/ui/sanitizer/cfi/assoc-ty-lifetime-issue-123053.rs +++ b/tests/ui/sanitizer/cfi/assoc-ty-lifetime-issue-123053.rs @@ -2,7 +2,8 @@ // trait object type to fail, causing an ICE. // //@ needs-sanitizer-cfi -//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi --edition=2021 +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ edition: 2021 //@ no-prefer-dynamic //@ only-x86_64-unknown-linux-gnu //@ build-pass diff --git a/tests/ui/sanitizer/cfi/coroutine.rs b/tests/ui/sanitizer/cfi/coroutine.rs index 3ad896afd00..39a754f1036 100644 --- a/tests/ui/sanitizer/cfi/coroutine.rs +++ b/tests/ui/sanitizer/cfi/coroutine.rs @@ -26,7 +26,7 @@ use std::async_iter::AsyncIterator; #[test] fn general_coroutine() { - let mut coro = #[coroutine] |x: i32| { + let coro = #[coroutine] |x: i32| { yield x; "done" }; diff --git a/tests/ui/sanitizer/issue-111184-cfi-coroutine-witness.rs b/tests/ui/sanitizer/issue-111184-cfi-coroutine-witness.rs index e5b1e032257..7d0c73c2841 100644 --- a/tests/ui/sanitizer/issue-111184-cfi-coroutine-witness.rs +++ b/tests/ui/sanitizer/issue-111184-cfi-coroutine-witness.rs @@ -2,7 +2,8 @@ // encode_ty and caused the compiler to ICE. // //@ needs-sanitizer-cfi -//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi --edition=2021 +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ edition: 2021 //@ no-prefer-dynamic //@ only-x86_64-unknown-linux-gnu //@ build-pass diff --git a/tests/ui/self/arbitrary_self_type_infinite_recursion.rs b/tests/ui/self/arbitrary_self_type_infinite_recursion.rs index 6fbf35c0b86..79ca7079c42 100644 --- a/tests/ui/self/arbitrary_self_type_infinite_recursion.rs +++ b/tests/ui/self/arbitrary_self_type_infinite_recursion.rs @@ -10,15 +10,15 @@ struct Content; impl Content { fn method(self: MySmartPtr<Self>) { // note self type - //~^ reached the recursion limit - //~| reached the recursion limit - //~| invalid `self` parameter type + //~^ ERROR reached the recursion limit + //~| ERROR reached the recursion limit + //~| ERROR invalid `self` parameter type } } fn main() { let p = MySmartPtr(Content); p.method(); - //~^ reached the recursion limit - //~| no method named `method` + //~^ ERROR reached the recursion limit + //~| ERROR no method named `method` } diff --git a/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.rs b/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.rs index b5a8992542b..2fb7aed970e 100644 --- a/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.rs +++ b/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.rs @@ -6,16 +6,16 @@ struct Foo; impl Foo { async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } type Alias<T> = Pin<T>; impl Foo { async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg } - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn main() {} diff --git a/tests/ui/simd/empty-simd-vector-in-operand.rs b/tests/ui/simd/empty-simd-vector-in-operand.rs index 2a2a6c0737d..813222c8a2e 100644 --- a/tests/ui/simd/empty-simd-vector-in-operand.rs +++ b/tests/ui/simd/empty-simd-vector-in-operand.rs @@ -10,6 +10,6 @@ struct A(); fn main() { unsafe { std::arch::asm!("{}", in(xmm_reg) A()); - //~^ use of empty SIMD vector `A` + //~^ ERROR use of empty SIMD vector `A` } } diff --git a/tests/ui/simd/intrinsic/generic-elements-pass.rs b/tests/ui/simd/intrinsic/generic-elements-pass.rs index 4dc2e4d5a80..e4d47cdb381 100644 --- a/tests/ui/simd/intrinsic/generic-elements-pass.rs +++ b/tests/ui/simd/intrinsic/generic-elements-pass.rs @@ -1,8 +1,10 @@ //@ run-pass -#![feature(repr_simd, core_intrinsics)] +#![feature(repr_simd, intrinsics, core_intrinsics)] -use std::intrinsics::simd::{simd_extract, simd_insert, simd_shuffle}; +use std::intrinsics::simd::{ + simd_extract, simd_extract_dyn, simd_insert, simd_insert_dyn, simd_shuffle, +}; #[repr(simd)] #[derive(Copy, Clone, Debug, PartialEq)] @@ -70,6 +72,41 @@ fn main() { all_eq!(simd_extract(x8, 6), 86); all_eq!(simd_extract(x8, 7), 87); } + unsafe { + all_eq!(simd_insert_dyn(x2, 0, 100), i32x2([100, 21])); + all_eq!(simd_insert_dyn(x2, 1, 100), i32x2([20, 100])); + + all_eq!(simd_insert_dyn(x4, 0, 100), i32x4([100, 41, 42, 43])); + all_eq!(simd_insert_dyn(x4, 1, 100), i32x4([40, 100, 42, 43])); + all_eq!(simd_insert_dyn(x4, 2, 100), i32x4([40, 41, 100, 43])); + all_eq!(simd_insert_dyn(x4, 3, 100), i32x4([40, 41, 42, 100])); + + all_eq!(simd_insert_dyn(x8, 0, 100), i32x8([100, 81, 82, 83, 84, 85, 86, 87])); + all_eq!(simd_insert_dyn(x8, 1, 100), i32x8([80, 100, 82, 83, 84, 85, 86, 87])); + all_eq!(simd_insert_dyn(x8, 2, 100), i32x8([80, 81, 100, 83, 84, 85, 86, 87])); + all_eq!(simd_insert_dyn(x8, 3, 100), i32x8([80, 81, 82, 100, 84, 85, 86, 87])); + all_eq!(simd_insert_dyn(x8, 4, 100), i32x8([80, 81, 82, 83, 100, 85, 86, 87])); + all_eq!(simd_insert_dyn(x8, 5, 100), i32x8([80, 81, 82, 83, 84, 100, 86, 87])); + all_eq!(simd_insert_dyn(x8, 6, 100), i32x8([80, 81, 82, 83, 84, 85, 100, 87])); + all_eq!(simd_insert_dyn(x8, 7, 100), i32x8([80, 81, 82, 83, 84, 85, 86, 100])); + + all_eq!(simd_extract_dyn(x2, 0), 20); + all_eq!(simd_extract_dyn(x2, 1), 21); + + all_eq!(simd_extract_dyn(x4, 0), 40); + all_eq!(simd_extract_dyn(x4, 1), 41); + all_eq!(simd_extract_dyn(x4, 2), 42); + all_eq!(simd_extract_dyn(x4, 3), 43); + + all_eq!(simd_extract_dyn(x8, 0), 80); + all_eq!(simd_extract_dyn(x8, 1), 81); + all_eq!(simd_extract_dyn(x8, 2), 82); + all_eq!(simd_extract_dyn(x8, 3), 83); + all_eq!(simd_extract_dyn(x8, 4), 84); + all_eq!(simd_extract_dyn(x8, 5), 85); + all_eq!(simd_extract_dyn(x8, 6), 86); + all_eq!(simd_extract_dyn(x8, 7), 87); + } let y2 = i32x2([120, 121]); let y4 = i32x4([140, 141, 142, 143]); diff --git a/tests/ui/simd/monomorphize-shuffle-index.rs b/tests/ui/simd/monomorphize-shuffle-index.rs index 3a074dfd432..a56f2ea1452 100644 --- a/tests/ui/simd/monomorphize-shuffle-index.rs +++ b/tests/ui/simd/monomorphize-shuffle-index.rs @@ -34,7 +34,7 @@ trait Shuffle<const N: usize> { return simd_shuffle(a, b, Self::I); #[cfg(generic)] return simd_shuffle_const_generic::<_, _, { &Self::I.0 }>(a, b); - //[generic]~^ overly complex generic constant + //[generic]~^ ERROR overly complex generic constant #[cfg(generic_with_fn)] return simd_shuffle_const_generic::<_, _, { Self::J }>(a, b); } diff --git a/tests/ui/stability-attribute/generics-default-stability.rs b/tests/ui/stability-attribute/generics-default-stability.rs index e1b3971f70c..400e22a8e6c 100644 --- a/tests/ui/stability-attribute/generics-default-stability.rs +++ b/tests/ui/stability-attribute/generics-default-stability.rs @@ -69,30 +69,30 @@ fn main() { let _ = STRUCT4; let _: Struct4<isize> = Struct4 { field: 1 }; - //~^ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] - //~^^ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] - //~^^^ use of deprecated field `unstable_generic_param::Struct4::field`: test [deprecated] + //~^ WARN use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] + //~^^ WARN use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] + //~^^^ WARN use of deprecated field `unstable_generic_param::Struct4::field`: test [deprecated] let _ = STRUCT4; - let _: Struct4 = STRUCT4; //~ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] - let _: Struct4<usize> = STRUCT4; //~ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] + let _: Struct4 = STRUCT4; //~ WARN use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] + let _: Struct4<usize> = STRUCT4; //~ WARN use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] let _: Struct4<isize> = Struct4 { field: 0 }; - //~^ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] - //~^^ use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] - //~^^^ use of deprecated field `unstable_generic_param::Struct4::field`: test [deprecated] + //~^ WARN use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] + //~^^ WARN use of deprecated struct `unstable_generic_param::Struct4`: test [deprecated] + //~^^^ WARN use of deprecated field `unstable_generic_param::Struct4::field`: test [deprecated] let _ = STRUCT5; let _: Struct5<isize> = Struct5 { field: 1 }; //~ ERROR use of unstable library feature `unstable_default` - //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] - //~^^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] - //~^^^ use of deprecated field `unstable_generic_param::Struct5::field`: test [deprecated] + //~^ WARN use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] + //~^^ WARN use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] + //~^^^ WARN use of deprecated field `unstable_generic_param::Struct5::field`: test [deprecated] let _ = STRUCT5; - let _: Struct5 = STRUCT5; //~ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] + let _: Struct5 = STRUCT5; //~ WARN use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] let _: Struct5<usize> = STRUCT5; //~ ERROR use of unstable library feature `unstable_default` - //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] + //~^ WARN use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] let _: Struct5<isize> = Struct5 { field: 0 }; //~ ERROR use of unstable library feature `unstable_default` - //~^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] - //~^^ use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] - //~^^^ use of deprecated field `unstable_generic_param::Struct5::field`: test [deprecated] + //~^ WARN use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] + //~^^ WARN use of deprecated struct `unstable_generic_param::Struct5`: test [deprecated] + //~^^^ WARN use of deprecated field `unstable_generic_param::Struct5::field`: test [deprecated] let _: Struct6<isize> = Struct6 { field: 1 }; // ok let _: Struct6<isize> = Struct6 { field: 0 }; // ok @@ -145,26 +145,26 @@ fn main() { let _ = ALIAS4; let _: Alias4<isize> = Alias4::Some(1); - //~^ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated] - //~^^ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated] + //~^ WARN use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated] + //~^^ WARN use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated] let _ = ALIAS4; - let _: Alias4 = ALIAS4; //~ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated] - let _: Alias4<usize> = ALIAS4; //~ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated] + let _: Alias4 = ALIAS4; //~ WARN use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated] + let _: Alias4<usize> = ALIAS4; //~ WARN use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated] let _: Alias4<isize> = Alias4::Some(0); - //~^ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated] - //~^^ use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated] + //~^ WARN use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated] + //~^^ WARN use of deprecated type alias `unstable_generic_param::Alias4`: test [deprecated] let _ = ALIAS5; let _: Alias5<isize> = Alias5::Some(1); //~ ERROR use of unstable library feature `unstable_default` - //~^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] - //~^^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] + //~^ WARN use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] + //~^^ WARN use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] let _ = ALIAS5; - let _: Alias5 = ALIAS5; //~ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] + let _: Alias5 = ALIAS5; //~ WARN use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] let _: Alias5<usize> = ALIAS5; //~ ERROR use of unstable library feature `unstable_default` - //~^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] + //~^ WARN use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] let _: Alias5<isize> = Alias5::Some(0); //~ ERROR use of unstable library feature `unstable_default` - //~^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] - //~^^ use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] + //~^ WARN use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] + //~^^ WARN use of deprecated type alias `unstable_generic_param::Alias5`: test [deprecated] let _: Alias6<isize> = Alias6::Some(1); // ok let _: Alias6<isize> = Alias6::Some(0); // ok @@ -217,26 +217,26 @@ fn main() { let _ = ENUM4; let _: Enum4<isize> = Enum4::Some(1); - //~^ use of deprecated tuple variant `unstable_generic_param::Enum4::Some`: test [deprecated] - //~^^ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated] + //~^ WARN use of deprecated tuple variant `unstable_generic_param::Enum4::Some`: test [deprecated] + //~^^ WARN use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated] let _ = ENUM4; - let _: Enum4 = ENUM4; //~ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated] - let _: Enum4<usize> = ENUM4; //~ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated] + let _: Enum4 = ENUM4; //~ WARN use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated] + let _: Enum4<usize> = ENUM4; //~ WARN use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated] let _: Enum4<isize> = Enum4::Some(0); - //~^ use of deprecated tuple variant `unstable_generic_param::Enum4::Some`: test [deprecated] - //~^^ use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated] + //~^ WARN use of deprecated tuple variant `unstable_generic_param::Enum4::Some`: test [deprecated] + //~^^ WARN use of deprecated enum `unstable_generic_param::Enum4`: test [deprecated] let _ = ENUM5; let _: Enum5<isize> = Enum5::Some(1); //~ ERROR use of unstable library feature `unstable_default` - //~^ use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test [deprecated] - //~^^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated] + //~^ WARN use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test [deprecated] + //~^^ WARN use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated] let _ = ENUM5; - let _: Enum5 = ENUM5; //~ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated] + let _: Enum5 = ENUM5; //~ WARN use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated] let _: Enum5<usize> = ENUM5; //~ ERROR use of unstable library feature `unstable_default` - //~^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated] + //~^ WARN use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated] let _: Enum5<isize> = Enum5::Some(0); //~ ERROR use of unstable library feature `unstable_default` - //~^ use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test [deprecated] - //~^^ use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated] + //~^ WARN use of deprecated tuple variant `unstable_generic_param::Enum5::Some`: test [deprecated] + //~^^ WARN use of deprecated enum `unstable_generic_param::Enum5`: test [deprecated] let _: Enum6<isize> = Enum6::Some(1); // ok let _: Enum6<isize> = Enum6::Some(0); // ok diff --git a/tests/ui/static/bad-const-type.rs b/tests/ui/static/bad-const-type.rs index 24fd67ecbaa..d4e6352d7c1 100644 --- a/tests/ui/static/bad-const-type.rs +++ b/tests/ui/static/bad-const-type.rs @@ -1,4 +1,4 @@ static i: String = 10; //~^ ERROR mismatched types -//~| expected `String`, found integer +//~| NOTE expected `String`, found integer fn main() { println!("{}", i); } diff --git a/tests/ui/stats/input-stats.stderr b/tests/ui/stats/input-stats.stderr index 24e38948647..b369af62f87 100644 --- a/tests/ui/stats/input-stats.stderr +++ b/tests/ui/stats/input-stats.stderr @@ -5,25 +5,25 @@ ast-stats-1 Crate 40 ( 0.6%) 1 40 ast-stats-1 GenericArgs 40 ( 0.6%) 1 40 ast-stats-1 - AngleBracketed 40 ( 0.6%) 1 ast-stats-1 ExprField 48 ( 0.7%) 1 48 -ast-stats-1 Attribute 64 ( 1.0%) 2 32 +ast-stats-1 Attribute 64 ( 0.9%) 2 32 ast-stats-1 - DocComment 32 ( 0.5%) 1 ast-stats-1 - Normal 32 ( 0.5%) 1 ast-stats-1 WherePredicate 72 ( 1.1%) 1 72 ast-stats-1 - BoundPredicate 72 ( 1.1%) 1 ast-stats-1 ForeignItem 80 ( 1.2%) 1 80 ast-stats-1 - Fn 80 ( 1.2%) 1 -ast-stats-1 Local 80 ( 1.2%) 1 80 ast-stats-1 Arm 96 ( 1.4%) 2 48 +ast-stats-1 Local 96 ( 1.4%) 1 96 ast-stats-1 FnDecl 120 ( 1.8%) 5 24 ast-stats-1 Param 160 ( 2.4%) 4 40 ast-stats-1 Stmt 160 ( 2.4%) 5 32 ast-stats-1 - Let 32 ( 0.5%) 1 ast-stats-1 - MacCall 32 ( 0.5%) 1 ast-stats-1 - Expr 96 ( 1.4%) 3 -ast-stats-1 Block 192 ( 2.9%) 6 32 +ast-stats-1 Block 192 ( 2.8%) 6 32 ast-stats-1 FieldDef 208 ( 3.1%) 2 104 ast-stats-1 Variant 208 ( 3.1%) 2 104 -ast-stats-1 AssocItem 320 ( 4.8%) 4 80 +ast-stats-1 AssocItem 320 ( 4.7%) 4 80 ast-stats-1 - Fn 160 ( 2.4%) 2 ast-stats-1 - Type 160 ( 2.4%) 2 ast-stats-1 GenericBound 352 ( 5.2%) 4 88 @@ -33,7 +33,7 @@ ast-stats-1 Pat 504 ( 7.5%) 7 72 ast-stats-1 - Struct 72 ( 1.1%) 1 ast-stats-1 - Wild 72 ( 1.1%) 1 ast-stats-1 - Ident 360 ( 5.3%) 5 -ast-stats-1 Expr 576 ( 8.6%) 8 72 +ast-stats-1 Expr 576 ( 8.5%) 8 72 ast-stats-1 - Match 72 ( 1.1%) 1 ast-stats-1 - Path 72 ( 1.1%) 1 ast-stats-1 - Struct 72 ( 1.1%) 1 @@ -41,8 +41,8 @@ ast-stats-1 - Lit 144 ( 2.1%) 2 ast-stats-1 - Block 216 ( 3.2%) 3 ast-stats-1 PathSegment 744 (11.0%) 31 24 ast-stats-1 Ty 896 (13.3%) 14 64 -ast-stats-1 - Ptr 64 ( 1.0%) 1 -ast-stats-1 - Ref 64 ( 1.0%) 1 +ast-stats-1 - Ptr 64 ( 0.9%) 1 +ast-stats-1 - Ref 64 ( 0.9%) 1 ast-stats-1 - ImplicitSelf 128 ( 1.9%) 2 ast-stats-1 - Path 640 ( 9.5%) 10 ast-stats-1 Item 1_296 (19.2%) 9 144 @@ -53,7 +53,7 @@ ast-stats-1 - Trait 144 ( 2.1%) 1 ast-stats-1 - Fn 288 ( 4.3%) 2 ast-stats-1 - Use 432 ( 6.4%) 3 ast-stats-1 ---------------------------------------------------------------- -ast-stats-1 Total 6_736 116 +ast-stats-1 Total 6_752 116 ast-stats-1 ast-stats-2 POST EXPANSION AST STATS ast-stats-2 Name Accumulated Size Count Item Size @@ -66,8 +66,8 @@ ast-stats-2 WherePredicate 72 ( 1.0%) 1 72 ast-stats-2 - BoundPredicate 72 ( 1.0%) 1 ast-stats-2 ForeignItem 80 ( 1.1%) 1 80 ast-stats-2 - Fn 80 ( 1.1%) 1 -ast-stats-2 Local 80 ( 1.1%) 1 80 ast-stats-2 Arm 96 ( 1.3%) 2 48 +ast-stats-2 Local 96 ( 1.3%) 1 96 ast-stats-2 FnDecl 120 ( 1.6%) 5 24 ast-stats-2 InlineAsm 120 ( 1.6%) 1 120 ast-stats-2 Attribute 128 ( 1.7%) 4 32 @@ -84,14 +84,14 @@ ast-stats-2 Variant 208 ( 2.8%) 2 104 ast-stats-2 AssocItem 320 ( 4.3%) 4 80 ast-stats-2 - Fn 160 ( 2.2%) 2 ast-stats-2 - Type 160 ( 2.2%) 2 -ast-stats-2 GenericBound 352 ( 4.8%) 4 88 -ast-stats-2 - Trait 352 ( 4.8%) 4 +ast-stats-2 GenericBound 352 ( 4.7%) 4 88 +ast-stats-2 - Trait 352 ( 4.7%) 4 ast-stats-2 GenericParam 480 ( 6.5%) 5 96 ast-stats-2 Pat 504 ( 6.8%) 7 72 ast-stats-2 - Struct 72 ( 1.0%) 1 ast-stats-2 - Wild 72 ( 1.0%) 1 ast-stats-2 - Ident 360 ( 4.9%) 5 -ast-stats-2 Expr 648 ( 8.8%) 9 72 +ast-stats-2 Expr 648 ( 8.7%) 9 72 ast-stats-2 - InlineAsm 72 ( 1.0%) 1 ast-stats-2 - Match 72 ( 1.0%) 1 ast-stats-2 - Path 72 ( 1.0%) 1 @@ -113,7 +113,7 @@ ast-stats-2 - Trait 144 ( 1.9%) 1 ast-stats-2 - Fn 288 ( 3.9%) 2 ast-stats-2 - Use 576 ( 7.8%) 4 ast-stats-2 ---------------------------------------------------------------- -ast-stats-2 Total 7_400 127 +ast-stats-2 Total 7_416 127 ast-stats-2 hir-stats HIR STATS hir-stats Name Accumulated Size Count Item Size @@ -126,11 +126,11 @@ hir-stats TraitItemRef 56 ( 0.6%) 2 28 hir-stats GenericArg 64 ( 0.7%) 4 16 hir-stats - Type 16 ( 0.2%) 1 hir-stats - Lifetime 48 ( 0.5%) 3 -hir-stats Local 64 ( 0.7%) 1 64 hir-stats Param 64 ( 0.7%) 2 32 hir-stats Body 72 ( 0.8%) 3 24 hir-stats ImplItemRef 72 ( 0.8%) 2 36 hir-stats InlineAsm 72 ( 0.8%) 1 72 +hir-stats Local 72 ( 0.8%) 1 72 hir-stats WherePredicate 72 ( 0.8%) 3 24 hir-stats - BoundPredicate 72 ( 0.8%) 3 hir-stats Arm 80 ( 0.9%) 2 40 @@ -143,8 +143,8 @@ hir-stats Attribute 128 ( 1.4%) 4 32 hir-stats FieldDef 128 ( 1.4%) 2 64 hir-stats GenericArgs 144 ( 1.6%) 3 48 hir-stats Variant 144 ( 1.6%) 2 72 -hir-stats GenericBound 256 ( 2.9%) 4 64 -hir-stats - Trait 256 ( 2.9%) 4 +hir-stats GenericBound 256 ( 2.8%) 4 64 +hir-stats - Trait 256 ( 2.8%) 4 hir-stats Block 288 ( 3.2%) 6 48 hir-stats Pat 360 ( 4.0%) 5 72 hir-stats - Struct 72 ( 0.8%) 1 @@ -156,7 +156,7 @@ hir-stats Ty 720 ( 8.0%) 15 48 hir-stats - Ptr 48 ( 0.5%) 1 hir-stats - Ref 48 ( 0.5%) 1 hir-stats - Path 624 ( 6.9%) 13 -hir-stats Expr 768 ( 8.6%) 12 64 +hir-stats Expr 768 ( 8.5%) 12 64 hir-stats - InlineAsm 64 ( 0.7%) 1 hir-stats - Match 64 ( 0.7%) 1 hir-stats - Path 64 ( 0.7%) 1 @@ -174,5 +174,5 @@ hir-stats - Use 352 ( 3.9%) 4 hir-stats Path 1_240 (13.8%) 31 40 hir-stats PathSegment 1_920 (21.4%) 40 48 hir-stats ---------------------------------------------------------------- -hir-stats Total 8_980 180 +hir-stats Total 8_988 180 hir-stats diff --git a/tests/ui/structs/default-field-values/failures.rs b/tests/ui/structs/default-field-values/failures.rs index 1e94eecb4f8..4461302e841 100644 --- a/tests/ui/structs/default-field-values/failures.rs +++ b/tests/ui/structs/default-field-values/failures.rs @@ -1,4 +1,4 @@ -#![feature(default_field_values)] + #![feature(default_field_values)] #[derive(Debug)] pub struct S; @@ -50,7 +50,8 @@ enum E { fn main () { let _ = Foo { .. }; // ok let _ = Foo::default(); // ok - let _ = Bar { .. }; //~ ERROR mandatory field + let _ = Bar { .. }; //~ ERROR missing field + let _ = Bar { baz: 0, .. }; //~ ERROR missing field let _ = Bar::default(); // silenced let _ = Bar { bar: S, .. }; // ok let _ = Qux::<4> { .. }; diff --git a/tests/ui/structs/default-field-values/failures.stderr b/tests/ui/structs/default-field-values/failures.stderr index 58f7baee4b2..21c9bfb44b4 100644 --- a/tests/ui/structs/default-field-values/failures.stderr +++ b/tests/ui/structs/default-field-values/failures.stderr @@ -27,14 +27,20 @@ LL + #[derive(Default)] LL | pub struct S; | -error: missing mandatory field `bar` - --> $DIR/failures.rs:53:21 +error: missing field `bar` in initializer + --> $DIR/failures.rs:53:19 | LL | let _ = Bar { .. }; - | ^ + | ^ fields that do not have a defaulted value must be provided explicitly + +error: missing field `bar` in initializer + --> $DIR/failures.rs:54:27 + | +LL | let _ = Bar { baz: 0, .. }; + | ^ fields that do not have a defaulted value must be provided explicitly error[E0308]: mismatched types - --> $DIR/failures.rs:57:17 + --> $DIR/failures.rs:58:17 | LL | let _ = Rak(..); | --- ^^ expected `i32`, found `RangeFull` @@ -47,19 +53,19 @@ note: tuple struct defined here LL | pub struct Rak(i32 = 42); | ^^^ help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals; it is instead interpreted as a `std::ops::RangeFull` literal - --> $DIR/failures.rs:57:17 + --> $DIR/failures.rs:58:17 | LL | let _ = Rak(..); | ^^ error[E0061]: this struct takes 1 argument but 2 arguments were supplied - --> $DIR/failures.rs:59:13 + --> $DIR/failures.rs:60:13 | LL | let _ = Rak(0, ..); | ^^^ -- unexpected argument #2 of type `RangeFull` | help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals; it is instead interpreted as a `std::ops::RangeFull` literal - --> $DIR/failures.rs:59:20 + --> $DIR/failures.rs:60:20 | LL | let _ = Rak(0, ..); | ^^ @@ -75,13 +81,13 @@ LL + let _ = Rak(0); | error[E0061]: this struct takes 1 argument but 2 arguments were supplied - --> $DIR/failures.rs:61:13 + --> $DIR/failures.rs:62:13 | LL | let _ = Rak(.., 0); | ^^^ -- unexpected argument #1 of type `RangeFull` | help: you might have meant to use `..` to skip providing a value for expected fields, but this is only supported on non-tuple struct literals; it is instead interpreted as a `std::ops::RangeFull` literal - --> $DIR/failures.rs:61:17 + --> $DIR/failures.rs:62:17 | LL | let _ = Rak(.., 0); | ^^ @@ -96,7 +102,7 @@ LL - let _ = Rak(.., 0); LL + let _ = Rak(0); | -error: aborting due to 7 previous errors +error: aborting due to 8 previous errors Some errors have detailed explanations: E0061, E0277, E0308. For more information about an error, try `rustc --explain E0061`. diff --git a/tests/ui/structs/struct-missing-comma.fixed b/tests/ui/structs/struct-missing-comma.fixed index 800128f503b..cd02f61f1a4 100644 --- a/tests/ui/structs/struct-missing-comma.fixed +++ b/tests/ui/structs/struct-missing-comma.fixed @@ -2,7 +2,7 @@ //@ run-rustfix pub struct S { - pub foo: u32, //~ expected `,`, or `}`, found keyword `pub` + pub foo: u32, //~ ERROR expected `,`, or `}`, found keyword `pub` // ~^ HELP try adding a comma: ',' pub bar: u32 } diff --git a/tests/ui/structs/struct-missing-comma.rs b/tests/ui/structs/struct-missing-comma.rs index b9d8c9eb303..84944519fba 100644 --- a/tests/ui/structs/struct-missing-comma.rs +++ b/tests/ui/structs/struct-missing-comma.rs @@ -2,7 +2,7 @@ //@ run-rustfix pub struct S { - pub foo: u32 //~ expected `,`, or `}`, found keyword `pub` + pub foo: u32 //~ ERROR expected `,`, or `}`, found keyword `pub` // ~^ HELP try adding a comma: ',' pub bar: u32 } diff --git a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.rs b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.rs index dd2fe79731e..ab5815e23a6 100644 --- a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.rs +++ b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.rs @@ -22,7 +22,7 @@ fn main() { //~| ERROR pattern does not mention field `b` [E0027] Foo::Baz { bb: "" } => (), //~^ ERROR variant `Foo::Baz` does not have a field named `bb` [E0026] - //~| pattern does not mention field `a` [E0027] + //~| ERROR pattern does not mention field `a` [E0027] _ => (), } } diff --git a/tests/ui/suggestions/derive-trait-for-method-call.rs b/tests/ui/suggestions/derive-trait-for-method-call.rs index b5ce0078c9b..beac2414842 100644 --- a/tests/ui/suggestions/derive-trait-for-method-call.rs +++ b/tests/ui/suggestions/derive-trait-for-method-call.rs @@ -26,19 +26,19 @@ impl<X: Clone + Default + , Y: Clone + Default> Foo<X, Y> { fn test1() { let x = Foo(Enum::First, CloneEnum::First); let y = x.test(); - //~^the method `test` exists for struct `Foo<Enum, CloneEnum>`, but its trait bounds were not satisfied [E0599] + //~^ ERROR the method `test` exists for struct `Foo<Enum, CloneEnum>`, but its trait bounds were not satisfied [E0599] } fn test2() { let x = Foo(Struct{}, CloneStruct{}); let y = x.test(); - //~^the method `test` exists for struct `Foo<Struct, CloneStruct>`, but its trait bounds were not satisfied [E0599] + //~^ ERROR the method `test` exists for struct `Foo<Struct, CloneStruct>`, but its trait bounds were not satisfied [E0599] } fn test3() { let x = Foo(Vec::<Enum>::new(), Instant::now()); let y = x.test(); - //~^the method `test` exists for struct `Foo<Vec<Enum>, Instant>`, but its trait bounds were not satisfied [E0599] + //~^ ERROR the method `test` exists for struct `Foo<Vec<Enum>, Instant>`, but its trait bounds were not satisfied [E0599] } fn main() {} diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr index 7b0fd979991..e189012d15c 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr @@ -26,6 +26,20 @@ help: `A` is dyn-incompatible, use `impl A` to return an opaque type, as long as LL | fn f(a: A) -> impl A; | ++++ +error: associated item referring to unboxed trait object for its own trait + --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:4:13 + | +LL | trait A: Sized { + | - in this trait +LL | fn f(a: A) -> A; + | ^ ^ + | +help: you might have meant to use `Self` to refer to the implementing type + | +LL - fn f(a: A) -> A; +LL + fn f(a: Self) -> Self; + | + error[E0782]: expected a type, found a trait --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:10:13 | @@ -54,6 +68,20 @@ help: `B` is dyn-incompatible, use `impl B` to return an opaque type, as long as LL | fn f(b: B) -> impl B; | ++++ +error: associated item referring to unboxed trait object for its own trait + --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:10:13 + | +LL | trait B { + | - in this trait +LL | fn f(b: B) -> B; + | ^ ^ + | +help: you might have meant to use `Self` to refer to the implementing type + | +LL - fn f(b: B) -> B; +LL + fn f(b: Self) -> Self; + | + error[E0782]: expected a type, found a trait --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:16:20 | @@ -83,34 +111,6 @@ LL | fn f(&self, c: C) -> impl C; | ++++ error: associated item referring to unboxed trait object for its own trait - --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:4:13 - | -LL | trait A: Sized { - | - in this trait -LL | fn f(a: A) -> A; - | ^ ^ - | -help: you might have meant to use `Self` to refer to the implementing type - | -LL - fn f(a: A) -> A; -LL + fn f(a: Self) -> Self; - | - -error: associated item referring to unboxed trait object for its own trait - --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:10:13 - | -LL | trait B { - | - in this trait -LL | fn f(b: B) -> B; - | ^ ^ - | -help: you might have meant to use `Self` to refer to the implementing type - | -LL - fn f(b: B) -> B; -LL + fn f(b: Self) -> Self; - | - -error: associated item referring to unboxed trait object for its own trait --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:16:20 | LL | trait C { diff --git a/tests/ui/suggestions/enum-method-probe.fixed b/tests/ui/suggestions/enum-method-probe.fixed index 611be9911d9..e097fa8cc1d 100644 --- a/tests/ui/suggestions/enum-method-probe.fixed +++ b/tests/ui/suggestions/enum-method-probe.fixed @@ -1,4 +1,4 @@ -//@ compile-flags: --edition=2021 +//@ edition: 2021 //@ run-rustfix #![allow(unused)] diff --git a/tests/ui/suggestions/enum-method-probe.rs b/tests/ui/suggestions/enum-method-probe.rs index e183ebd25f2..665ee7d0aaa 100644 --- a/tests/ui/suggestions/enum-method-probe.rs +++ b/tests/ui/suggestions/enum-method-probe.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition=2021 +//@ edition: 2021 //@ run-rustfix #![allow(unused)] diff --git a/tests/ui/suggestions/field-has-method.rs b/tests/ui/suggestions/field-has-method.rs index 980000151e2..d28b6ba546c 100644 --- a/tests/ui/suggestions/field-has-method.rs +++ b/tests/ui/suggestions/field-has-method.rs @@ -17,7 +17,7 @@ struct InferOk<T> { fn foo(i: InferOk<Ty>) { let k = i.kind(); - //~^ no method named `kind` found for struct `InferOk` in the current scope + //~^ ERROR no method named `kind` found for struct `InferOk` in the current scope } fn main() {} diff --git a/tests/ui/suggestions/inner_type.fixed b/tests/ui/suggestions/inner_type.fixed index cfea66b57ec..3dc939d6b5c 100644 --- a/tests/ui/suggestions/inner_type.fixed +++ b/tests/ui/suggestions/inner_type.fixed @@ -1,4 +1,4 @@ -//@ compile-flags: --edition=2021 +//@ edition: 2021 //@ run-rustfix pub struct Struct<T> { diff --git a/tests/ui/suggestions/inner_type.rs b/tests/ui/suggestions/inner_type.rs index 5fedf3f256e..81a05c25311 100644 --- a/tests/ui/suggestions/inner_type.rs +++ b/tests/ui/suggestions/inner_type.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition=2021 +//@ edition: 2021 //@ run-rustfix pub struct Struct<T> { diff --git a/tests/ui/suggestions/issue-101465.rs b/tests/ui/suggestions/issue-101465.rs index 8e42e2c2224..3ec4e816054 100644 --- a/tests/ui/suggestions/issue-101465.rs +++ b/tests/ui/suggestions/issue-101465.rs @@ -18,7 +18,7 @@ fn foo() -> impl Tr { match true { true => B, false => C, - //~^ `match` arms have incompatible types + //~^ ERROR `match` arms have incompatible types } } diff --git a/tests/ui/suggestions/issue-103646.rs b/tests/ui/suggestions/issue-103646.rs index f679640c5dc..d8b06d663af 100644 --- a/tests/ui/suggestions/issue-103646.rs +++ b/tests/ui/suggestions/issue-103646.rs @@ -5,7 +5,7 @@ trait Cat { fn uwu<T: Cat>(c: T) { c.nya(); //~^ ERROR no method named `nya` found for type parameter `T` in the current scope - //~| Suggestion T::nya() + //~| SUGGESTION T::nya() } fn main() {} diff --git a/tests/ui/suggestions/issue-116434-2015.stderr b/tests/ui/suggestions/issue-116434-2015.stderr index e7b8cd2f101..07a254432a2 100644 --- a/tests/ui/suggestions/issue-116434-2015.stderr +++ b/tests/ui/suggestions/issue-116434-2015.stderr @@ -13,19 +13,6 @@ LL | fn foo() -> dyn Clone; | +++ warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-116434-2015.rs:18:20 - | -LL | fn handle() -> DbHandle; - | ^^^^^^^^ - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> -help: if this is a dyn-compatible trait, use `dyn` - | -LL | fn handle() -> dyn DbHandle; - | +++ - -warning: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-116434-2015.rs:3:17 | LL | fn foo() -> Clone; @@ -61,6 +48,19 @@ LL | fn handle() -> DbHandle; | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> +help: if this is a dyn-compatible trait, use `dyn` + | +LL | fn handle() -> dyn DbHandle; + | +++ + +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/issue-116434-2015.rs:18:20 + | +LL | fn handle() -> DbHandle; + | ^^^^^^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/suggestions/issue-81839.rs b/tests/ui/suggestions/issue-81839.rs index 3971aa9fe84..99a03c175b3 100644 --- a/tests/ui/suggestions/issue-81839.rs +++ b/tests/ui/suggestions/issue-81839.rs @@ -8,7 +8,7 @@ async fn test(ans: &str, num: i32, cx: &issue_81839::Test) -> u32 { 1 => { cx.answer_str("hi"); } - _ => cx.answer_str("hi"), //~ `match` arms have incompatible types + _ => cx.answer_str("hi"), //~ ERROR `match` arms have incompatible types } 1 diff --git a/tests/ui/suggestions/issue-86667.rs b/tests/ui/suggestions/issue-86667.rs index 1f37e9a5f6d..cc5b878b632 100644 --- a/tests/ui/suggestions/issue-86667.rs +++ b/tests/ui/suggestions/issue-86667.rs @@ -1,7 +1,7 @@ // Regression test for #86667, where a garbled suggestion was issued for // a missing named lifetime parameter. -//@ compile-flags: --edition 2018 +//@ edition: 2018 async fn a(s1: &str, s2: &str) -> &str { //~^ ERROR: missing lifetime specifier [E0106] diff --git a/tests/ui/suggestions/partialeq_suggest_swap.rs b/tests/ui/suggestions/partialeq_suggest_swap.rs index ee5583a5488..090f17f2fe2 100644 --- a/tests/ui/suggestions/partialeq_suggest_swap.rs +++ b/tests/ui/suggestions/partialeq_suggest_swap.rs @@ -7,5 +7,5 @@ impl PartialEq<i32> for T { } fn main() { - 4i32 == T(4); //~ mismatched types [E0308] + 4i32 == T(4); //~ ERROR mismatched types [E0308] } diff --git a/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.rs b/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.rs index 2ebbed3c740..a54493e5922 100644 --- a/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.rs +++ b/tests/ui/suggestions/partialeq_suggest_swap_on_e0277.rs @@ -7,5 +7,5 @@ impl PartialEq<String> for T { } fn main() { - String::from("Girls Band Cry") == T(String::from("Girls Band Cry")); //~ can't compare `String` with `T` [E0277] + String::from("Girls Band Cry") == T(String::from("Girls Band Cry")); //~ ERROR can't compare `String` with `T` [E0277] } diff --git a/tests/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.fixed b/tests/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.fixed index 3b739312942..735c09438e2 100644 --- a/tests/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.fixed +++ b/tests/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.fixed @@ -10,6 +10,6 @@ fn bar(bar: &usize) { } fn main() { - foo(&mut Default::default()); //~ the trait bound `&mut usize: Default` is not satisfied - bar(&Default::default()); //~ the trait bound `&usize: Default` is not satisfied + foo(&mut Default::default()); //~ ERROR the trait bound `&mut usize: Default` is not satisfied + bar(&Default::default()); //~ ERROR the trait bound `&usize: Default` is not satisfied } diff --git a/tests/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.rs b/tests/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.rs index 7fc870946b9..7364c59fd92 100644 --- a/tests/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.rs +++ b/tests/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.rs @@ -10,6 +10,6 @@ fn bar(bar: &usize) { } fn main() { - foo(Default::default()); //~ the trait bound `&mut usize: Default` is not satisfied - bar(Default::default()); //~ the trait bound `&usize: Default` is not satisfied + foo(Default::default()); //~ ERROR the trait bound `&mut usize: Default` is not satisfied + bar(Default::default()); //~ ERROR the trait bound `&usize: Default` is not satisfied } diff --git a/tests/ui/suggestions/suggest-let-for-assignment.fixed b/tests/ui/suggestions/suggest-let-for-assignment.fixed index 80b9333827e..6d40f74a0d8 100644 --- a/tests/ui/suggestions/suggest-let-for-assignment.fixed +++ b/tests/ui/suggestions/suggest-let-for-assignment.fixed @@ -7,10 +7,10 @@ fn main() { let x = "x"; //~ ERROR cannot find value `x` in this scope println!("x: {}", x); //~ ERROR cannot find value `x` in this scope - let some_variable = 6; //~ cannot find value `let_some_variable` in this scope + let some_variable = 6; //~ ERROR cannot find value `let_some_variable` in this scope println!("some_variable: {}", some_variable); //~ ERROR cannot find value `some_variable` in this scope - let other_variable = 6; //~ cannot find value `letother_variable` in this scope + let other_variable = 6; //~ ERROR cannot find value `letother_variable` in this scope println!("other_variable: {}", other_variable); //~ ERROR cannot find value `other_variable` in this scope if x == "x" { diff --git a/tests/ui/suggestions/suggest-let-for-assignment.rs b/tests/ui/suggestions/suggest-let-for-assignment.rs index 22560083d34..aeb22a0ded0 100644 --- a/tests/ui/suggestions/suggest-let-for-assignment.rs +++ b/tests/ui/suggestions/suggest-let-for-assignment.rs @@ -7,10 +7,10 @@ fn main() { x = "x"; //~ ERROR cannot find value `x` in this scope println!("x: {}", x); //~ ERROR cannot find value `x` in this scope - let_some_variable = 6; //~ cannot find value `let_some_variable` in this scope + let_some_variable = 6; //~ ERROR cannot find value `let_some_variable` in this scope println!("some_variable: {}", some_variable); //~ ERROR cannot find value `some_variable` in this scope - letother_variable = 6; //~ cannot find value `letother_variable` in this scope + letother_variable = 6; //~ ERROR cannot find value `letother_variable` in this scope println!("other_variable: {}", other_variable); //~ ERROR cannot find value `other_variable` in this scope if x == "x" { diff --git a/tests/ui/suggestions/suggest-null-ptr.fixed b/tests/ui/suggestions/suggest-null-ptr.fixed index 55c90859c83..97a628f8662 100644 --- a/tests/ui/suggestions/suggest-null-ptr.fixed +++ b/tests/ui/suggestions/suggest-null-ptr.fixed @@ -16,16 +16,16 @@ extern "C" { fn main() { unsafe { foo(std::ptr::null()); - //~^ mismatched types [E0308] - //~| if you meant to create a null pointer, use `std::ptr::null()` + //~^ ERROR mismatched types [E0308] + //~| HELP if you meant to create a null pointer, use `std::ptr::null()` foo_mut(std::ptr::null_mut()); - //~^ mismatched types [E0308] - //~| if you meant to create a null pointer, use `std::ptr::null_mut()` + //~^ ERROR mismatched types [E0308] + //~| HELP if you meant to create a null pointer, use `std::ptr::null_mut()` usize(std::ptr::null()); - //~^ mismatched types [E0308] - //~| if you meant to create a null pointer, use `std::ptr::null()` + //~^ ERROR mismatched types [E0308] + //~| HELP if you meant to create a null pointer, use `std::ptr::null()` usize_mut(std::ptr::null_mut()); - //~^ mismatched types [E0308] - //~| if you meant to create a null pointer, use `std::ptr::null_mut()` + //~^ ERROR mismatched types [E0308] + //~| HELP if you meant to create a null pointer, use `std::ptr::null_mut()` } } diff --git a/tests/ui/suggestions/suggest-null-ptr.rs b/tests/ui/suggestions/suggest-null-ptr.rs index f4f1269d512..46ace90c8ae 100644 --- a/tests/ui/suggestions/suggest-null-ptr.rs +++ b/tests/ui/suggestions/suggest-null-ptr.rs @@ -16,16 +16,16 @@ extern "C" { fn main() { unsafe { foo(0); - //~^ mismatched types [E0308] - //~| if you meant to create a null pointer, use `std::ptr::null()` + //~^ ERROR mismatched types [E0308] + //~| HELP if you meant to create a null pointer, use `std::ptr::null()` foo_mut(0); - //~^ mismatched types [E0308] - //~| if you meant to create a null pointer, use `std::ptr::null_mut()` + //~^ ERROR mismatched types [E0308] + //~| HELP if you meant to create a null pointer, use `std::ptr::null_mut()` usize(0); - //~^ mismatched types [E0308] - //~| if you meant to create a null pointer, use `std::ptr::null()` + //~^ ERROR mismatched types [E0308] + //~| HELP if you meant to create a null pointer, use `std::ptr::null()` usize_mut(0); - //~^ mismatched types [E0308] - //~| if you meant to create a null pointer, use `std::ptr::null_mut()` + //~^ ERROR mismatched types [E0308] + //~| HELP if you meant to create a null pointer, use `std::ptr::null_mut()` } } diff --git a/tests/ui/suggestions/types/dont-suggest-path-names.rs b/tests/ui/suggestions/types/dont-suggest-path-names.rs index d160e49cd03..dfd671bfe55 100644 --- a/tests/ui/suggestions/types/dont-suggest-path-names.rs +++ b/tests/ui/suggestions/types/dont-suggest-path-names.rs @@ -5,11 +5,11 @@ struct Select<F, I>(F, I); fn select<F, I>(filter: F) -> Select<F, I> {} -//~^ 7:31: 7:43: mismatched types [E0308] +//~^ ERROR mismatched types [E0308] fn parser1() { let lit = select(|x| match x { - //~^ 11:23: 11:24: type annotations needed [E0282] + //~^ ERROR type annotations needed [E0282] _ => (), }); } diff --git a/tests/ui/super-let.borrowck.stderr b/tests/ui/super-let.borrowck.stderr new file mode 100644 index 00000000000..01ef29d8758 --- /dev/null +++ b/tests/ui/super-let.borrowck.stderr @@ -0,0 +1,174 @@ +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/super-let.rs:30:28 + | +LL | super let b = DropMe(&mut x); + | ------ `x` is borrowed here +... +LL | #[cfg(borrowck)] { x = true; } + | ^^^^^^^^ `x` is assigned to here but it was already borrowed +... +LL | } + | - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe` + +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/super-let.rs:46:28 + | +LL | super let b = &DropMe(&mut x); + | -------------- + | | | + | | `x` is borrowed here + | a temporary with access to the borrow is created here ... +... +LL | #[cfg(borrowck)] { x = true; } + | ^^^^^^^^ `x` is assigned to here but it was already borrowed +... +LL | } + | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe` + +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/super-let.rs:64:32 + | +LL | super let b = identity(&DropMe(&mut x)); + | -------------- + | | | + | | `x` is borrowed here + | a temporary with access to the borrow is created here ... +LL | #[cfg(borrowck)] { x = true; } + | ^^^^^^^^ `x` is assigned to here but it was already borrowed +... +LL | }; + | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe` + +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/super-let.rs:87:36 + | +LL | super let b = identity(&DropMe(&mut x)); + | -------------- + | | | + | | `x` is borrowed here + | a temporary with access to the borrow is created here ... +... +LL | #[cfg(borrowck)] { x = true; } + | ^^^^^^^^ `x` is assigned to here but it was already borrowed +... +LL | )); + | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe` + +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/super-let.rs:107:28 + | +LL | super let b = DropMe(&mut x); + | ------ `x` is borrowed here +... +LL | #[cfg(borrowck)] { x = true; } + | ^^^^^^^^ `x` is assigned to here but it was already borrowed +... +LL | } + | - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe` + +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/super-let.rs:125:28 + | +LL | super let b = DropMe(&mut x); + | ------ `x` is borrowed here +... +LL | #[cfg(borrowck)] { x = true; } + | ^^^^^^^^ `x` is assigned to here but it was already borrowed +... +LL | } + | - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe` + +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/super-let.rs:143:28 + | +LL | super let b = DropMe(&mut x); + | ------ `x` is borrowed here +... +LL | #[cfg(borrowck)] { x = true; } + | ^^^^^^^^ `x` is assigned to here but it was already borrowed +... +LL | } + | - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe` + +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/super-let.rs:159:28 + | +LL | b = DropMe(&mut x); + | ------ `x` is borrowed here +... +LL | #[cfg(borrowck)] { x = true; } + | ^^^^^^^^ `x` is assigned to here but it was already borrowed +LL | drop(a); + | - borrow later used here + +error[E0716]: temporary value dropped while borrowed + --> $DIR/super-let.rs:172:33 + | +LL | #[cfg(borrowck)] { a = &String::from("asdf"); }; + | ^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement + | | + | creates a temporary value which is freed while still in use +... +LL | let _ = a; + | - borrow later used here + | + = note: consider using a `let` binding to create a longer lived value + +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/super-let.rs:206:28 + | +LL | super let d = &DropMe(&mut x); + | -------------- + | | | + | | `x` is borrowed here + | a temporary with access to the borrow is created here ... +... +LL | #[cfg(borrowck)] { x = true; } + | ^^^^^^^^ `x` is assigned to here but it was already borrowed +... +LL | } + | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe` + +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/super-let.rs:227:32 + | +LL | super let d = identity(&DropMe(&mut x)); + | -------------- + | | | + | | `x` is borrowed here + | a temporary with access to the borrow is created here ... +... +LL | #[cfg(borrowck)] { x = true; } + | ^^^^^^^^ `x` is assigned to here but it was already borrowed +... +LL | }; + | - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe` + +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/super-let.rs:246:28 + | +LL | super let b = DropMe(&mut x); + | ------ `x` is borrowed here +... +LL | #[cfg(borrowck)] { x = true; } + | ^^^^^^^^ `x` is assigned to here but it was already borrowed +... +LL | } + | - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe` + +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/super-let.rs:263:28 + | +LL | let dropme = Some(DropMe(&mut x)); + | ------ `x` is borrowed here +... +LL | #[cfg(borrowck)] { x = true; } + | ^^^^^^^^ `x` is assigned to here but it was already borrowed +... +LL | } + | - borrow might be used here, when `x` is dropped and runs the `Drop` code for type `DropMe` + +error: aborting due to 13 previous errors + +Some errors have detailed explanations: E0506, E0716. +For more information about an error, try `rustc --explain E0506`. diff --git a/tests/ui/super-let.rs b/tests/ui/super-let.rs new file mode 100644 index 00000000000..380470f792f --- /dev/null +++ b/tests/ui/super-let.rs @@ -0,0 +1,286 @@ +// Check in two ways: +// - borrowck: Check with borrow checking errors when things are alive and dead. +// - runtime: Check with a mutable bool if things are dropped on time. +// +//@ revisions: runtime borrowck +//@ [runtime] run-pass +//@ [borrowck] check-fail + +#![allow(dropping_references)] +#![feature(super_let, stmt_expr_attributes)] + +use std::convert::identity; + +struct DropMe<'a>(&'a mut bool); + +impl Drop for DropMe<'_> { + fn drop(&mut self) { + *self.0 = true; + } +} + +// Check that a super let variable lives as long as the result of a block. +fn extended_variable() { + let mut x = false; + { + let a = { + super let b = DropMe(&mut x); + &b + }; + #[cfg(borrowck)] { x = true; } //[borrowck]~ ERROR borrowed + drop(a); + // DropMe is still alive here... + } + // ... but not here. + assert_eq!(x, true) // ok +} + +// Check that the init expression of a super let is subject to (temporary) lifetime extension. +fn extended_temporary() { + let mut x = false; + { + let a = { + super let b = &DropMe(&mut x); + b + }; + #[cfg(borrowck)] { x = true; } //[borrowck]~ ERROR borrowed + drop(a); + // DropMe is still alive here... + } + // ... but not here. + assert_eq!(x, true); // ok +} + +// Check that even non-extended temporaries live until the end of the block, +// but (unlike extended temporaries) not beyond that. +// +// This is necessary for things like select(pin!(identity(&temp()))) to work. +fn non_extended() { + let mut x = false; + { + let _a = { + // Use identity() to supress temporary lifetime extension. + super let b = identity(&DropMe(&mut x)); + #[cfg(borrowck)] { x = true; } //[borrowck]~ ERROR borrowed + b + // DropMe is still alive here... + }; + // ... but not here. + assert_eq!(x, true); // ok + } +} + +// Check that even non-extended temporaries live until the end of the block, +// but (unlike extended temporaries) not beyond that. +// +// This is necessary for things like select(pin!(identity(&temp()))) to work. +fn non_extended_in_expression() { + let mut x = false; + { + identity(( + { + // Use identity() to supress temporary lifetime extension. + super let b = identity(&DropMe(&mut x)); + b + }, + { + #[cfg(borrowck)] { x = true; } //[borrowck]~ ERROR borrowed + // DropMe is still alive here... + } + )); + // ... but not here. + assert_eq!(x, true); // ok + } +} + +// Check `super let` in a match arm. +fn match_arm() { + let mut x = false; + { + let a = match Some(123) { + Some(_) => { + super let b = DropMe(&mut x); + &b + } + None => unreachable!(), + }; + #[cfg(borrowck)] { x = true; } //[borrowck]~ ERROR borrowed + drop(a); + // DropMe is still alive here... + } + // ... but not here. + assert_eq!(x, true); // ok +} + +// Check `super let` in an if body. +fn if_body() { + let mut x = false; + { + let a = if true { + super let b = DropMe(&mut x); + &b + } else { + unreachable!() + }; + #[cfg(borrowck)] { x = true; } //[borrowck]~ ERROR borrowed + drop(a); + // DropMe is still alive here... + } + // ... but not here. + assert_eq!(x, true); // ok +} + +// Check `super let` in an else body. +fn else_body() { + let mut x = false; + { + let a = if false { + unreachable!() + } else { + super let b = DropMe(&mut x); + &b + }; + #[cfg(borrowck)] { x = true; } //[borrowck]~ ERROR borrowed + drop(a); + // DropMe is still alive here... + } + // ... but not here. + assert_eq!(x, true); // ok +} + +fn without_initializer() { + let mut x = false; + { + let a = { + super let b; + b = DropMe(&mut x); + b + }; + #[cfg(borrowck)] { x = true; } //[borrowck]~ ERROR borrowed + drop(a); + // DropMe is still alive here... + } + // ... but not here. + assert_eq!(x, true); +} + +// Assignment isn't special, even when assigning to a `super let` variable. +fn assignment() { + let mut x = false; + { + super let a; + #[cfg(borrowck)] { a = &String::from("asdf"); }; //[borrowck]~ ERROR dropped while borrowed + #[cfg(runtime)] { a = drop(&DropMe(&mut x)); } // Temporary dropped at the `;` as usual. + assert_eq!(x, true); + let _ = a; + } +} + +// `super let mut` should work just fine. +fn mutable() { + let mut x = false; + { + let a = { + super let mut b = None; + &mut b + }; + *a = Some(DropMe(&mut x)); + } + assert_eq!(x, true); +} + +// Temporary lifetime extension should recurse through `super let`s. +fn multiple_levels() { + let mut x = false; + { + let a = { + super let b = { + super let c = { + super let d = &DropMe(&mut x); + d + }; + c + }; + b + }; + #[cfg(borrowck)] { x = true; } //[borrowck]~ ERROR borrowed + drop(a); + // DropMe is still alive here... + } + // ... but not here. + assert_eq!(x, true); +} + +// Non-extended temporaries should be dropped at the +// end of the first parent statement that isn't `super`. +fn multiple_levels_but_no_extension() { + let mut x = false; + { + let _a = { + super let b = { + super let c = { + super let d = identity(&DropMe(&mut x)); + d + }; + c + }; + #[cfg(borrowck)] { x = true; } //[borrowck]~ ERROR borrowed + b + // DropMe is still alive here... + }; + // ... but not here. + assert_eq!(x, true); + } +} + +// Check for potential weird interactions with `let else`. +fn super_let_and_let_else() { + let mut x = false; + { + let a = 'a: { + let Some(_) = Some(123) else { unreachable!() }; + super let b = DropMe(&mut x); + let None = Some(123) else { break 'a &b }; + unreachable!() + }; + #[cfg(borrowck)] { x = true; } //[borrowck]~ ERROR borrowed + // DropMe is still alive here... + drop(a); + } + // ... but not here. + assert_eq!(x, true); +} + +// Check if `super let .. else ..;` works. +fn super_let_else() { + let mut x = false; + { + let a = { + let dropme = Some(DropMe(&mut x)); + super let Some(x) = dropme else { unreachable!() }; + &x + }; + #[cfg(borrowck)] { x = true; } //[borrowck]~ ERROR borrowed + // DropMe is still alive here... + drop(a); + } + // ... but not here. + assert_eq!(x, true); +} + +fn main() { + extended_variable(); + extended_temporary(); + non_extended(); + non_extended_in_expression(); + match_arm(); + if_body(); + else_body(); + without_initializer(); + assignment(); + mutable(); + multiple_levels(); + multiple_levels_but_no_extension(); + super_let_and_let_else(); + super_let_else(); +} diff --git a/tests/ui/tool-attributes/tool_lints.rs b/tests/ui/tool-attributes/tool_lints.rs index ef27532f6de..9e4aa7a939a 100644 --- a/tests/ui/tool-attributes/tool_lints.rs +++ b/tests/ui/tool-attributes/tool_lints.rs @@ -1,4 +1,5 @@ #[warn(foo::bar)] //~^ ERROR unknown tool name `foo` found in scoped lint: `foo::bar` //~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar` +//~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar` fn main() {} diff --git a/tests/ui/tool-attributes/tool_lints.stderr b/tests/ui/tool-attributes/tool_lints.stderr index f1d825caba1..eee0a9784ec 100644 --- a/tests/ui/tool-attributes/tool_lints.stderr +++ b/tests/ui/tool-attributes/tool_lints.stderr @@ -15,6 +15,15 @@ LL | #[warn(foo::bar)] = help: add `#![register_tool(foo)]` to the crate root = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 2 previous errors +error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar` + --> $DIR/tool_lints.rs:1:8 + | +LL | #[warn(foo::bar)] + | ^^^ + | + = help: add `#![register_tool(foo)]` to the crate root + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0710`. diff --git a/tests/ui/tool-attributes/unknown-lint-tool-name.rs b/tests/ui/tool-attributes/unknown-lint-tool-name.rs index 59fc56d820e..84ab7c1944a 100644 --- a/tests/ui/tool-attributes/unknown-lint-tool-name.rs +++ b/tests/ui/tool-attributes/unknown-lint-tool-name.rs @@ -4,4 +4,5 @@ #[allow(foo::bar)] //~ ERROR unknown tool name `foo` found in scoped lint: `foo::bar` //~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar` + //~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar` fn main() {} diff --git a/tests/ui/tool-attributes/unknown-lint-tool-name.stderr b/tests/ui/tool-attributes/unknown-lint-tool-name.stderr index 5d99777a14a..91baf882737 100644 --- a/tests/ui/tool-attributes/unknown-lint-tool-name.stderr +++ b/tests/ui/tool-attributes/unknown-lint-tool-name.stderr @@ -41,6 +41,15 @@ LL | #![deny(foo::bar)] = help: add `#![register_tool(foo)]` to the crate root = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 5 previous errors +error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar` + --> $DIR/unknown-lint-tool-name.rs:5:9 + | +LL | #[allow(foo::bar)] + | ^^^ + | + = help: add `#![register_tool(foo)]` to the crate root + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0710`. diff --git a/tests/ui/trait-bounds/mismatch-fn-trait.stderr b/tests/ui/trait-bounds/mismatch-fn-trait.stderr index 519aa9ea3f3..051e660c2d1 100644 --- a/tests/ui/trait-bounds/mismatch-fn-trait.stderr +++ b/tests/ui/trait-bounds/mismatch-fn-trait.stderr @@ -6,8 +6,8 @@ LL | take(f) | | | required by a bound introduced by this call | - = note: expected a closure with arguments `(u32,)` - found a closure with arguments `(i32,)` + = note: expected a closure with signature `fn(i32)` + found a closure with signature `fn(u32)` note: required by a bound in `take` --> $DIR/mismatch-fn-trait.rs:1:18 | @@ -68,8 +68,8 @@ LL | take(f) | required by a bound introduced by this call | = note: `impl FnOnce(u32)` implements `FnOnce`, but it must implement `FnMut`, which is more general - = note: expected a closure with arguments `(u32,)` - found a closure with arguments `(i32,)` + = note: expected a closure with signature `fn(i32)` + found a closure with signature `fn(u32)` note: required by a bound in `take` --> $DIR/mismatch-fn-trait.rs:1:18 | diff --git a/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs b/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs index 0b1f9ab57c9..39ca19fc3a5 100644 --- a/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs +++ b/tests/ui/traits/alias/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs @@ -11,5 +11,5 @@ impl<I: IteratorAlias> Foo<I> { } fn main() { - Foo::<()>::f() //~ trait bounds were not satisfied + Foo::<()>::f() //~ ERROR trait bounds were not satisfied } diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs index 1359eb6cb87..891cc32e7b7 100644 --- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs +++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs @@ -11,5 +11,5 @@ fn f<T: for<'r> X<'r> + ?Sized>() { fn main() { f::<dyn for<'x> X<'x, F = i32>>(); - //~^ expected a `FnOnce(&i32)` closure, found `i32` + //~^ ERROR expected a `FnOnce(&i32)` closure, found `i32` } diff --git a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-5.rs b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-5.rs index 7d733ad26b7..829a40c64e6 100644 --- a/tests/ui/traits/associated_type_bound/check-trait-object-bounds-5.rs +++ b/tests/ui/traits/associated_type_bound/check-trait-object-bounds-5.rs @@ -21,7 +21,7 @@ fn is_obj<T: ?Sized + Obj>(_: &T) {} fn f(x: &dyn Obj<U = i32, V = i64>) { is_obj(x) - //~^ type mismatch resolving `<i32 as Is>::T == i64` + //~^ ERROR type mismatch resolving `<i32 as Is>::T == i64` } fn main() {} diff --git a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.rs b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.rs index dc1e719bded..e53b87274d3 100644 --- a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.rs +++ b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.rs @@ -5,9 +5,9 @@ use std::ops::FromResidual; impl<T> const FromResidual for T { //~^ ERROR const `impl` for trait `FromResidual` which is not marked with `#[const_trait]` - //~| type parameter `T` must be used as the type parameter for some local type + //~| ERROR type parameter `T` must be used as the type parameter for some local type fn from_residual(t: T) -> _ { - //~^ the placeholder `_` is not allowed + //~^ ERROR the placeholder `_` is not allowed t } } diff --git a/tests/ui/traits/const-traits/staged-api.rs b/tests/ui/traits/const-traits/staged-api.rs index 8dd7226fc29..bf09a5f7803 100644 --- a/tests/ui/traits/const-traits/staged-api.rs +++ b/tests/ui/traits/const-traits/staged-api.rs @@ -96,12 +96,12 @@ trait S {} // implied stable impl const U for u8 {} -//~^ const stability on the impl does not match the const stability on the trait +//~^ ERROR const stability on the impl does not match the const stability on the trait #[rustc_const_stable(since = "0.0.0", feature = "beef2")] impl const U for u16 {} -//~^ const stability on the impl does not match the const stability on the trait -//~| trait implementations cannot be const stable yet +//~^ ERROR const stability on the impl does not match the const stability on the trait +//~| ERROR trait implementations cannot be const stable yet #[rustc_const_unstable(feature = "beef", issue = "none")] impl const U for u32 {} @@ -111,10 +111,10 @@ impl const S for u8 {} #[rustc_const_stable(since = "0.0.0", feature = "beef2")] impl const S for u16 {} -//~^ trait implementations cannot be const stable yet +//~^ ERROR trait implementations cannot be const stable yet #[rustc_const_unstable(feature = "beef", issue = "none")] impl const S for u32 {} -//~^ const stability on the impl does not match the const stability on the trait +//~^ ERROR const stability on the impl does not match the const stability on the trait fn main() {} diff --git a/tests/ui/traits/const-traits/unsatisfied-const-trait-bound.stderr b/tests/ui/traits/const-traits/unsatisfied-const-trait-bound.stderr index be761e49ba0..03e26615d7e 100644 --- a/tests/ui/traits/const-traits/unsatisfied-const-trait-bound.stderr +++ b/tests/ui/traits/const-traits/unsatisfied-const-trait-bound.stderr @@ -6,30 +6,134 @@ LL | #![feature(const_trait_impl, generic_const_exprs)] | = help: remove one of these features -error[E0277]: the trait bound `T: const Trait` is not satisfied - --> $DIR/unsatisfied-const-trait-bound.rs:29:37 +error[E0391]: cycle detected when evaluating type-level constant + --> $DIR/unsatisfied-const-trait-bound.rs:29:35 | LL | fn accept0<T: Trait>(_: Container<{ T::make() }>) {} - | ^ + | ^^^^^^^^^^^^^ + | +note: ...which requires const-evaluating + checking `accept0::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:29:35 + | +LL | fn accept0<T: Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires caching mir of `accept0::{constant#0}` for CTFE... + --> $DIR/unsatisfied-const-trait-bound.rs:29:35 + | +LL | fn accept0<T: Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires elaborating drops for `accept0::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:29:35 + | +LL | fn accept0<T: Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires borrow-checking `accept0::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:29:35 + | +LL | fn accept0<T: Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires promoting constants in MIR for `accept0::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:29:35 + | +LL | fn accept0<T: Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires const checking `accept0::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:29:35 + | +LL | fn accept0<T: Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires building MIR for `accept0::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:29:35 + | +LL | fn accept0<T: Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires building an abstract representation for `accept0::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:29:35 + | +LL | fn accept0<T: Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires building THIR for `accept0::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:29:35 + | +LL | fn accept0<T: Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires type-checking `accept0::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:29:35 + | +LL | fn accept0<T: Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ + = note: ...which again requires evaluating type-level constant, completing the cycle +note: cycle used when checking that `accept0` is well-formed + --> $DIR/unsatisfied-const-trait-bound.rs:29:1 + | +LL | fn accept0<T: Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error[E0277]: the trait bound `T: const Trait` is not satisfied - --> $DIR/unsatisfied-const-trait-bound.rs:33:50 +error[E0391]: cycle detected when caching mir of `accept1::{constant#0}` for CTFE + --> $DIR/unsatisfied-const-trait-bound.rs:33:48 | LL | const fn accept1<T: ~const Trait>(_: Container<{ T::make() }>) {} - | ^ - -error[E0277]: the trait bound `Ty: const Trait` is not satisfied - --> $DIR/unsatisfied-const-trait-bound.rs:22:15 + | ^^^^^^^^^^^^^ + | +note: ...which requires elaborating drops for `accept1::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:33:48 + | +LL | const fn accept1<T: ~const Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires borrow-checking `accept1::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:33:48 + | +LL | const fn accept1<T: ~const Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires promoting constants in MIR for `accept1::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:33:48 + | +LL | const fn accept1<T: ~const Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires const checking `accept1::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:33:48 + | +LL | const fn accept1<T: ~const Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires building MIR for `accept1::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:33:48 | -LL | require::<Ty>(); - | ^^ +LL | const fn accept1<T: ~const Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires building an abstract representation for `accept1::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:33:48 + | +LL | const fn accept1<T: ~const Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires building THIR for `accept1::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:33:48 | -note: required by a bound in `require` - --> $DIR/unsatisfied-const-trait-bound.rs:8:15 +LL | const fn accept1<T: ~const Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires type-checking `accept1::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:33:48 + | +LL | const fn accept1<T: ~const Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires evaluating type-level constant... + --> $DIR/unsatisfied-const-trait-bound.rs:33:48 | -LL | fn require<T: const Trait>() {} - | ^^^^^^^^^^^ required by this bound in `require` +LL | const fn accept1<T: ~const Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ +note: ...which requires const-evaluating + checking `accept1::{constant#0}`... + --> $DIR/unsatisfied-const-trait-bound.rs:33:48 + | +LL | const fn accept1<T: ~const Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ + = note: ...which again requires caching mir of `accept1::{constant#0}` for CTFE, completing the cycle +note: cycle used when const-evaluating + checking `accept1::{constant#0}` + --> $DIR/unsatisfied-const-trait-bound.rs:33:48 + | +LL | const fn accept1<T: ~const Trait>(_: Container<{ T::make() }>) {} + | ^^^^^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/traits/copy-is-not-modulo-regions.rs b/tests/ui/traits/copy-is-not-modulo-regions.rs index 1e7d2d9c691..2efbeb4889d 100644 --- a/tests/ui/traits/copy-is-not-modulo-regions.rs +++ b/tests/ui/traits/copy-is-not-modulo-regions.rs @@ -11,7 +11,7 @@ struct Bar<'lt>(Foo<'lt>); #[cfg(not_static)] impl<'any> Copy for Bar<'any> {} -//[not_static]~^ the trait `Copy` cannot be implemented for this type +//[not_static]~^ ERROR the trait `Copy` cannot be implemented for this type #[cfg(yes_static)] impl<'any> Copy for Bar<'static> {} diff --git a/tests/ui/traits/default-method/rustc_must_implement_one_of.rs b/tests/ui/traits/default-method/rustc_must_implement_one_of.rs index 5ba2f5ce334..a77f1d5e608 100644 --- a/tests/ui/traits/default-method/rustc_must_implement_one_of.rs +++ b/tests/ui/traits/default-method/rustc_must_implement_one_of.rs @@ -39,6 +39,6 @@ impl Equal for T2 { } impl Equal for T3 {} -//~^ not all trait items implemented, missing one of: `eq`, `neq` +//~^ ERROR not all trait items implemented, missing one of: `eq`, `neq` fn main() {} diff --git a/tests/ui/traits/default-method/rustc_must_implement_one_of_duplicates.rs b/tests/ui/traits/default-method/rustc_must_implement_one_of_duplicates.rs index 8db5fa615c0..1e91b060792 100644 --- a/tests/ui/traits/default-method/rustc_must_implement_one_of_duplicates.rs +++ b/tests/ui/traits/default-method/rustc_must_implement_one_of_duplicates.rs @@ -1,15 +1,15 @@ #![feature(rustc_attrs)] #[rustc_must_implement_one_of(a, a)] -//~^ functions names are duplicated +//~^ ERROR functions names are duplicated trait Trait { fn a() {} } #[rustc_must_implement_one_of(b, a, a, c, b, c)] -//~^ functions names are duplicated -//~| functions names are duplicated -//~| functions names are duplicated +//~^ ERROR functions names are duplicated +//~| ERROR functions names are duplicated +//~| ERROR functions names are duplicated trait Trait1 { fn a() {} fn b() {} diff --git a/tests/ui/traits/default-method/rustc_must_implement_one_of_gated.rs b/tests/ui/traits/default-method/rustc_must_implement_one_of_gated.rs index ec2995872de..27e70556b7a 100644 --- a/tests/ui/traits/default-method/rustc_must_implement_one_of_gated.rs +++ b/tests/ui/traits/default-method/rustc_must_implement_one_of_gated.rs @@ -1,5 +1,5 @@ #[rustc_must_implement_one_of(eq, neq)] -//~^ the `#[rustc_must_implement_one_of]` attribute is used to change minimal complete definition of a trait, it's currently in experimental form and should be changed before being exposed outside of the std +//~^ ERROR the `#[rustc_must_implement_one_of]` attribute is used to change minimal complete definition of a trait, it's currently in experimental form and should be changed before being exposed outside of the std trait Equal { fn eq(&self, other: &Self) -> bool { !self.neq(other) diff --git a/tests/ui/traits/default-method/rustc_must_implement_one_of_misuse.rs b/tests/ui/traits/default-method/rustc_must_implement_one_of_misuse.rs index b1b91966c8d..9b2e489c542 100644 --- a/tests/ui/traits/default-method/rustc_must_implement_one_of_misuse.rs +++ b/tests/ui/traits/default-method/rustc_must_implement_one_of_misuse.rs @@ -1,46 +1,46 @@ #![feature(rustc_attrs)] #[rustc_must_implement_one_of(a, b)] -//~^ function not found in this trait -//~| function not found in this trait +//~^ ERROR function not found in this trait +//~| ERROR function not found in this trait trait Tr0 {} #[rustc_must_implement_one_of(a, b)] -//~^ function not found in this trait +//~^ ERROR function not found in this trait trait Tr1 { fn a() {} } #[rustc_must_implement_one_of(a)] -//~^ the `#[rustc_must_implement_one_of]` attribute must be used with at least 2 args +//~^ ERROR the `#[rustc_must_implement_one_of]` attribute must be used with at least 2 args trait Tr2 { fn a() {} } #[rustc_must_implement_one_of] -//~^ malformed `rustc_must_implement_one_of` attribute input +//~^ ERROR malformed `rustc_must_implement_one_of` attribute input trait Tr3 {} #[rustc_must_implement_one_of(A, B)] trait Tr4 { - const A: u8 = 1; //~ not a function + const A: u8 = 1; //~ ERROR not a function - type B; //~ not a function + type B; //~ ERROR not a function } #[rustc_must_implement_one_of(a, b)] trait Tr5 { - fn a(); //~ function doesn't have a default implementation + fn a(); //~ ERROR function doesn't have a default implementation - fn b(); //~ function doesn't have a default implementation + fn b(); //~ ERROR function doesn't have a default implementation } #[rustc_must_implement_one_of(abc, xyz)] -//~^ attribute should be applied to a trait +//~^ ERROR attribute should be applied to a trait fn function() {} #[rustc_must_implement_one_of(abc, xyz)] -//~^ attribute should be applied to a trait +//~^ ERROR attribute should be applied to a trait struct Struct {} fn main() {} diff --git a/tests/ui/traits/default_auto_traits/maybe-bounds-in-traits.rs b/tests/ui/traits/default_auto_traits/maybe-bounds-in-traits.rs index 761f22d1be5..4cb38bc8e79 100644 --- a/tests/ui/traits/default_auto_traits/maybe-bounds-in-traits.rs +++ b/tests/ui/traits/default_auto_traits/maybe-bounds-in-traits.rs @@ -97,7 +97,7 @@ mod methods { fn mut_leak_foo(&mut self) {} // there is no relax bound on corresponding Receiver impl fn mut_maybe_leak_foo(&mut self) where Self: ?Leak {} - //~^ `&mut Self` cannot be used as the type of `self` without the `arbitrary_self_types` + //~^ ERROR `&mut Self` cannot be used as the type of `self` without the `arbitrary_self_types` } impl Trait for NonLeakS {} diff --git a/tests/ui/traits/dont-suggest-impl-as-closure-arg.rs b/tests/ui/traits/dont-suggest-impl-as-closure-arg.rs new file mode 100644 index 00000000000..68e234b0f20 --- /dev/null +++ b/tests/ui/traits/dont-suggest-impl-as-closure-arg.rs @@ -0,0 +1,5 @@ +// Suggestion to use impl trait in closure parameter is invalid, see issue 138932 +fn main() { + let c = |f: dyn Fn()| f(); + //~^ ERROR: the size for values of type `(dyn Fn() + 'static)` cannot be known at compilation time +} diff --git a/tests/ui/traits/dont-suggest-impl-as-closure-arg.stderr b/tests/ui/traits/dont-suggest-impl-as-closure-arg.stderr new file mode 100644 index 00000000000..8218990503c --- /dev/null +++ b/tests/ui/traits/dont-suggest-impl-as-closure-arg.stderr @@ -0,0 +1,16 @@ +error[E0277]: the size for values of type `(dyn Fn() + 'static)` cannot be known at compilation time + --> $DIR/dont-suggest-impl-as-closure-arg.rs:3:17 + | +LL | let c = |f: dyn Fn()| f(); + | ^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn Fn() + 'static)` + = help: unsized fn params are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | let c = |f: &dyn Fn()| f(); + | + + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/dyn-drop-principal-with-projections.rs b/tests/ui/traits/dyn-drop-principal-with-projections.rs new file mode 100644 index 00000000000..912061847c6 --- /dev/null +++ b/tests/ui/traits/dyn-drop-principal-with-projections.rs @@ -0,0 +1,13 @@ +//@ check-pass + +trait Tr { + type Assoc; +} + +impl Tr for () { + type Assoc = (); +} + +fn main() { + let x = &() as &(dyn Tr<Assoc = ()> + Send) as &dyn Send; +} diff --git a/tests/ui/traits/issue-106072.rs b/tests/ui/traits/issue-106072.rs index d75c26642c6..d4566831221 100644 --- a/tests/ui/traits/issue-106072.rs +++ b/tests/ui/traits/issue-106072.rs @@ -1,6 +1,6 @@ #[derive(Clone)] -//~^ expected a type, found a trait -//~| expected a type, found a trait +//~^ ERROR expected a type, found a trait +//~| ERROR expected a type, found a trait struct Foo; -trait Foo {} //~ the name `Foo` is defined multiple times +trait Foo {} //~ ERROR the name `Foo` is defined multiple times fn main() {} diff --git a/tests/ui/traits/issue-85360-eval-obligation-ice.rs b/tests/ui/traits/issue-85360-eval-obligation-ice.rs index 931879a6722..f7c49049e2d 100644 --- a/tests/ui/traits/issue-85360-eval-obligation-ice.rs +++ b/tests/ui/traits/issue-85360-eval-obligation-ice.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition=2021 +//@ edition: 2021 #![feature(rustc_attrs)] diff --git a/tests/ui/traits/next-solver/async.fail.stderr b/tests/ui/traits/next-solver/async.fail.stderr index bc89842d16a..a76a10d20ee 100644 --- a/tests/ui/traits/next-solver/async.fail.stderr +++ b/tests/ui/traits/next-solver/async.fail.stderr @@ -1,8 +1,8 @@ -error[E0271]: expected `{async block@$DIR/async.rs:12:17: 12:22}` to be a future that resolves to `i32`, but it resolves to `()` +error[E0271]: type mismatch resolving `() == i32` --> $DIR/async.rs:12:17 | LL | needs_async(async {}); - | ----------- ^^^^^^^^ expected `i32`, found `()` + | ----------- ^^^^^^^^ types differ | | | required by a bound introduced by this call | diff --git a/tests/ui/traits/next-solver/async.rs b/tests/ui/traits/next-solver/async.rs index fded7743547..34c0ed02eeb 100644 --- a/tests/ui/traits/next-solver/async.rs +++ b/tests/ui/traits/next-solver/async.rs @@ -10,7 +10,7 @@ fn needs_async(_: impl Future<Output = i32>) {} #[cfg(fail)] fn main() { needs_async(async {}); - //[fail]~^ ERROR expected `{async block@$DIR/async.rs:12:17: 12:22}` to be a future that resolves to `i32`, but it resolves to `()` + //[fail]~^ ERROR type mismatch resolving `() == i32` } #[cfg(pass)] diff --git a/tests/ui/traits/next-solver/builtin-fn-must-return-sized.rs b/tests/ui/traits/next-solver/builtin-fn-must-return-sized.rs index f8926b24e3f..fbe801aedcd 100644 --- a/tests/ui/traits/next-solver/builtin-fn-must-return-sized.rs +++ b/tests/ui/traits/next-solver/builtin-fn-must-return-sized.rs @@ -13,5 +13,5 @@ fn foo<F: Fn<T>, T: Tuple>(f: Option<F>, t: T) { fn main() { foo::<fn() -> str, _>(None, ()); - //~^ the size for values of type `str` cannot be known at compilation time + //~^ ERROR the size for values of type `str` cannot be known at compilation time } diff --git a/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs index 840a4eb648c..6da08619b47 100644 --- a/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs +++ b/tests/ui/traits/next-solver/diagnostics/point-at-failing-nested.rs @@ -20,5 +20,5 @@ impl Constrain for () { fn needs_foo<T: Foo>() {} fn main() { needs_foo::<()>(); - //~^ the trait bound `(): Foo` is not satisfied + //~^ ERROR the trait bound `(): Foo` is not satisfied } diff --git a/tests/ui/traits/next-solver/gat-wf.rs b/tests/ui/traits/next-solver/gat-wf.rs index ff6e2665ef3..cd4b96b3a58 100644 --- a/tests/ui/traits/next-solver/gat-wf.rs +++ b/tests/ui/traits/next-solver/gat-wf.rs @@ -10,7 +10,7 @@ trait Foo { } impl Foo for &() { - type T<'a> = (); //~ the type `&()` does not fulfill the required lifetime + type T<'a> = (); //~ ERROR the type `&()` does not fulfill the required lifetime } fn main() {} diff --git a/tests/ui/traits/next-solver/more-object-bound.rs b/tests/ui/traits/next-solver/more-object-bound.rs index 3d3fdc926f6..1dad1903a64 100644 --- a/tests/ui/traits/next-solver/more-object-bound.rs +++ b/tests/ui/traits/next-solver/more-object-bound.rs @@ -10,7 +10,7 @@ trait Trait: SuperTrait<A = <Self as SuperTrait>::B> {} fn transmute<A, B>(x: A) -> B { foo::<A, B, dyn Trait<A = A, B = B>>(x) - //~^ ERROR type mismatch resolving `<dyn Trait<A = A, B = B> as SuperTrait>::A == B` + //~^ ERROR type mismatch resolving `A == B` } fn foo<A, B, T: ?Sized>(x: T::A) -> B diff --git a/tests/ui/traits/next-solver/more-object-bound.stderr b/tests/ui/traits/next-solver/more-object-bound.stderr index 39849d4c865..d04376cc9c6 100644 --- a/tests/ui/traits/next-solver/more-object-bound.stderr +++ b/tests/ui/traits/next-solver/more-object-bound.stderr @@ -1,17 +1,9 @@ -error[E0271]: type mismatch resolving `<dyn Trait<A = A, B = B> as SuperTrait>::A == B` +error[E0271]: type mismatch resolving `A == B` --> $DIR/more-object-bound.rs:12:5 | -LL | fn transmute<A, B>(x: A) -> B { - | - - expected type parameter - | | - | found type parameter LL | foo::<A, B, dyn Trait<A = A, B = B>>(x) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `B`, found type parameter `A` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ | - = note: expected type parameter `B` - found type parameter `A` - = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound - = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters = note: required because it appears within the type `dyn Trait<A = A, B = B>` note: required by a bound in `foo` --> $DIR/more-object-bound.rs:18:8 diff --git a/tests/ui/traits/next-solver/object-soundness-requires-generalization.rs b/tests/ui/traits/next-solver/object-soundness-requires-generalization.rs index 11a2617ad42..3ef6bea4fd5 100644 --- a/tests/ui/traits/next-solver/object-soundness-requires-generalization.rs +++ b/tests/ui/traits/next-solver/object-soundness-requires-generalization.rs @@ -1,5 +1,5 @@ //@ compile-flags: -Znext-solver -//@ ignore-test +//@ ignore-test (see #114196) trait Trait { type Gat<'lt>; diff --git a/tests/ui/traits/next-solver/opaques/ambig-in-mir-typeck.rs b/tests/ui/traits/next-solver/opaques/ambig-in-mir-typeck.rs index e5208e3e47d..198e6199e92 100644 --- a/tests/ui/traits/next-solver/opaques/ambig-in-mir-typeck.rs +++ b/tests/ui/traits/next-solver/opaques/ambig-in-mir-typeck.rs @@ -1,7 +1,8 @@ // Regression test for #132335. This previously ICE'd due to ambiguity // in MIR typeck. -//@ compile-flags: -Znext-solver=globally --crate-type lib --edition=2018 +//@ compile-flags: -Znext-solver=globally --crate-type lib +//@ edition: 2018 //@ check-pass use core::future::Future; use core::pin::Pin; diff --git a/tests/ui/traits/next-solver/opaques/revealing-use-in-nested-body.rs b/tests/ui/traits/next-solver/opaques/revealing-use-in-nested-body.rs index 8388751fea6..b79926eebda 100644 --- a/tests/ui/traits/next-solver/opaques/revealing-use-in-nested-body.rs +++ b/tests/ui/traits/next-solver/opaques/revealing-use-in-nested-body.rs @@ -3,7 +3,7 @@ // of the async block. This caused borrowck of the recursive // call to ICE. -//@ compile-flags: --edition=2021 +//@ edition: 2021 //@ check-pass async fn test() { Box::pin(test()).await; diff --git a/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.rs b/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.rs index 94a9484ecdc..b2a8c8cb4ae 100644 --- a/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.rs +++ b/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.rs @@ -13,7 +13,7 @@ fn needs_bar<S: Bar>() {} fn test<T: Foo1<Assoc1 = <T as Foo2>::Assoc2> + Foo2<Assoc2 = <T as Foo1>::Assoc1>>() { needs_bar::<T::Assoc1>(); - //~^ ERROR the trait bound `<T as Foo1>::Assoc1: Bar` is not satisfied + //~^ ERROR the trait bound `<T as Foo2>::Assoc2: Bar` is not satisfied } fn main() {} diff --git a/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.stderr b/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.stderr index 6f5111a6193..c4be47e3520 100644 --- a/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.stderr +++ b/tests/ui/traits/next-solver/overflow/recursive-self-normalization-2.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `<T as Foo1>::Assoc1: Bar` is not satisfied +error[E0277]: the trait bound `<T as Foo2>::Assoc2: Bar` is not satisfied --> $DIR/recursive-self-normalization-2.rs:15:17 | LL | needs_bar::<T::Assoc1>(); - | ^^^^^^^^^ the trait `Bar` is not implemented for `<T as Foo1>::Assoc1` + | ^^^^^^^^^ the trait `Bar` is not implemented for `<T as Foo2>::Assoc2` | note: required by a bound in `needs_bar` --> $DIR/recursive-self-normalization-2.rs:12:17 @@ -11,7 +11,7 @@ LL | fn needs_bar<S: Bar>() {} | ^^^ required by this bound in `needs_bar` help: consider further restricting the associated type | -LL | fn test<T: Foo1<Assoc1 = <T as Foo2>::Assoc2> + Foo2<Assoc2 = <T as Foo1>::Assoc1>>() where <T as Foo1>::Assoc1: Bar { +LL | fn test<T: Foo1<Assoc1 = <T as Foo2>::Assoc2> + Foo2<Assoc2 = <T as Foo1>::Assoc1>>() where <T as Foo2>::Assoc2: Bar { | ++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.rs b/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.rs new file mode 100644 index 00000000000..74c23a59bee --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.rs @@ -0,0 +1,18 @@ +// Make sure not to construct predicates with escaping bound vars in `diagnostic_hir_wf_check`. +// Regression test for <https://github.com/rust-lang/rust/issues/139330>. + +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +trait A<T: ?Sized> {} +impl<T: ?Sized> A<T> for () {} + +trait B {} +struct W<T: B>(T); + +fn b() -> (W<()>, impl for<C> A<C>) { (W(()), ()) } +//~^ ERROR the trait bound `(): B` is not satisfied +//~| ERROR the trait bound `(): B` is not satisfied +//~| ERROR the trait bound `(): B` is not satisfied + +fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.stderr b/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.stderr new file mode 100644 index 00000000000..df99f4a67ab --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.stderr @@ -0,0 +1,65 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/diagnostic-hir-wf-check.rs:4:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: the trait bound `(): B` is not satisfied + --> $DIR/diagnostic-hir-wf-check.rs:13:12 + | +LL | fn b() -> (W<()>, impl for<C> A<C>) { (W(()), ()) } + | ^^^^^ the trait `B` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/diagnostic-hir-wf-check.rs:10:1 + | +LL | trait B {} + | ^^^^^^^ +note: required by a bound in `W` + --> $DIR/diagnostic-hir-wf-check.rs:11:13 + | +LL | struct W<T: B>(T); + | ^ required by this bound in `W` + +error[E0277]: the trait bound `(): B` is not satisfied + --> $DIR/diagnostic-hir-wf-check.rs:13:42 + | +LL | fn b() -> (W<()>, impl for<C> A<C>) { (W(()), ()) } + | - ^^ the trait `B` is not implemented for `()` + | | + | required by a bound introduced by this call + | +help: this trait has no implementations, consider adding one + --> $DIR/diagnostic-hir-wf-check.rs:10:1 + | +LL | trait B {} + | ^^^^^^^ +note: required by a bound in `W` + --> $DIR/diagnostic-hir-wf-check.rs:11:13 + | +LL | struct W<T: B>(T); + | ^ required by this bound in `W` + +error[E0277]: the trait bound `(): B` is not satisfied + --> $DIR/diagnostic-hir-wf-check.rs:13:40 + | +LL | fn b() -> (W<()>, impl for<C> A<C>) { (W(()), ()) } + | ^^^^^ the trait `B` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/diagnostic-hir-wf-check.rs:10:1 + | +LL | trait B {} + | ^^^^^^^ +note: required by a bound in `W` + --> $DIR/diagnostic-hir-wf-check.rs:11:13 + | +LL | struct W<T: B>(T); + | ^ required by this bound in `W` + +error: aborting due to 3 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder-in-constraint.rs b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder-in-constraint.rs index 2a301788525..aff81207a93 100644 --- a/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder-in-constraint.rs +++ b/tests/ui/traits/non_lifetime_binders/type-alias-impl-trait/non-lifetime-binder-in-constraint.rs @@ -6,7 +6,7 @@ trait Trait<T: ?Sized> {} fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> { //~^ ERROR associated type `Assoc` not found for `Trait` //~| ERROR associated type `Assoc` not found for `Trait` - //~| the trait bound `{integer}: Trait<()>` is not satisfied + //~| ERROR the trait bound `{integer}: Trait<()>` is not satisfied //~| ERROR cannot capture late-bound type parameter in nested `impl Trait` 16 } diff --git a/tests/ui/traits/object/suggestion-trait-object-issue-139174.rs b/tests/ui/traits/object/suggestion-trait-object-issue-139174.rs index f8fa410b7d4..50851a5b0f8 100644 --- a/tests/ui/traits/object/suggestion-trait-object-issue-139174.rs +++ b/tests/ui/traits/object/suggestion-trait-object-issue-139174.rs @@ -1,4 +1,4 @@ -//@compile-flags: --edition 2021 +//@ edition: 2021 fn f<'a>(x: Box<dyn Fn() -> Option<usize + 'a>>) -> usize { //~^ ERROR expected trait, found builtin type `usize` diff --git a/tests/ui/traits/object/vs-lifetime.rs b/tests/ui/traits/object/vs-lifetime.rs index d3e6c0b217c..52385b26384 100644 --- a/tests/ui/traits/object/vs-lifetime.rs +++ b/tests/ui/traits/object/vs-lifetime.rs @@ -7,7 +7,7 @@ fn main() { // `'static` is a lifetime argument, `'static +` is a type argument let _: S<'static, u8>; let _: S<'static, dyn 'static +>; - //~^ at least one trait is required for an object type + //~^ ERROR at least one trait is required for an object type let _: S<'static, 'static>; //~^ ERROR struct takes 1 lifetime argument but 2 lifetime arguments were supplied //~| ERROR struct takes 1 generic argument but 0 generic arguments were supplied diff --git a/tests/ui/traits/trivial-unsized-projection-2.bad.stderr b/tests/ui/traits/trivial-unsized-projection-2.bad.stderr new file mode 100644 index 00000000000..bf8d3c40cf6 --- /dev/null +++ b/tests/ui/traits/trivial-unsized-projection-2.bad.stderr @@ -0,0 +1,54 @@ +error[E0277]: the size for values of type `[()]` cannot be known at compilation time + --> $DIR/trivial-unsized-projection-2.rs:22:12 + | +LL | const FOO: <Tail as Bad>::Assert = todo!(); + | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: within `Tail`, the trait `Sized` is not implemented for `[()]` +note: required because it appears within the type `Tail` + --> $DIR/trivial-unsized-projection-2.rs:17:8 + | +LL | struct Tail([()]); + | ^^^^ +note: required by a bound in `Bad::Assert` + --> $DIR/trivial-unsized-projection-2.rs:14:15 + | +LL | type Assert + | ------ required by a bound in this associated type +LL | where +LL | Self: Sized; + | ^^^^^ required by this bound in `Bad::Assert` +help: consider relaxing the implicit `Sized` restriction + | +LL | type Assert: ?Sized + | ++++++++ + +error[E0277]: the size for values of type `[()]` cannot be known at compilation time + --> $DIR/trivial-unsized-projection-2.rs:22:12 + | +LL | const FOO: <Tail as Bad>::Assert = todo!(); + | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: within `Tail`, the trait `Sized` is not implemented for `[()]` +note: required because it appears within the type `Tail` + --> $DIR/trivial-unsized-projection-2.rs:17:8 + | +LL | struct Tail([()]); + | ^^^^ +note: required by a bound in `Bad::Assert` + --> $DIR/trivial-unsized-projection-2.rs:14:15 + | +LL | type Assert + | ------ required by a bound in this associated type +LL | where +LL | Self: Sized; + | ^^^^^ required by this bound in `Bad::Assert` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider relaxing the implicit `Sized` restriction + | +LL | type Assert: ?Sized + | ++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/trivial-unsized-projection-2.bad_new.stderr b/tests/ui/traits/trivial-unsized-projection-2.bad_new.stderr new file mode 100644 index 00000000000..bf8d3c40cf6 --- /dev/null +++ b/tests/ui/traits/trivial-unsized-projection-2.bad_new.stderr @@ -0,0 +1,54 @@ +error[E0277]: the size for values of type `[()]` cannot be known at compilation time + --> $DIR/trivial-unsized-projection-2.rs:22:12 + | +LL | const FOO: <Tail as Bad>::Assert = todo!(); + | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: within `Tail`, the trait `Sized` is not implemented for `[()]` +note: required because it appears within the type `Tail` + --> $DIR/trivial-unsized-projection-2.rs:17:8 + | +LL | struct Tail([()]); + | ^^^^ +note: required by a bound in `Bad::Assert` + --> $DIR/trivial-unsized-projection-2.rs:14:15 + | +LL | type Assert + | ------ required by a bound in this associated type +LL | where +LL | Self: Sized; + | ^^^^^ required by this bound in `Bad::Assert` +help: consider relaxing the implicit `Sized` restriction + | +LL | type Assert: ?Sized + | ++++++++ + +error[E0277]: the size for values of type `[()]` cannot be known at compilation time + --> $DIR/trivial-unsized-projection-2.rs:22:12 + | +LL | const FOO: <Tail as Bad>::Assert = todo!(); + | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: within `Tail`, the trait `Sized` is not implemented for `[()]` +note: required because it appears within the type `Tail` + --> $DIR/trivial-unsized-projection-2.rs:17:8 + | +LL | struct Tail([()]); + | ^^^^ +note: required by a bound in `Bad::Assert` + --> $DIR/trivial-unsized-projection-2.rs:14:15 + | +LL | type Assert + | ------ required by a bound in this associated type +LL | where +LL | Self: Sized; + | ^^^^^ required by this bound in `Bad::Assert` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider relaxing the implicit `Sized` restriction + | +LL | type Assert: ?Sized + | ++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/trivial-unsized-projection-2.rs b/tests/ui/traits/trivial-unsized-projection-2.rs new file mode 100644 index 00000000000..af4e12f6f90 --- /dev/null +++ b/tests/ui/traits/trivial-unsized-projection-2.rs @@ -0,0 +1,34 @@ +//@ revisions: good bad good_new bad_new +//@[good_new] compile-flags: -Znext-solver +//@[bad_new] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[good] check-pass +//@[good_new] check-pass + +#![feature(trivial_bounds)] +#![allow(trivial_bounds)] + +trait Bad { + type Assert + where + Self: Sized; +} + +struct Tail([()]); + +impl Bad for Tail {} + +#[cfg(any(bad, bad_new))] +const FOO: <Tail as Bad>::Assert = todo!(); +//[bad]~^ ERROR the size for values of type `[()]` cannot be known at compilation time +//[bad]~| ERROR the size for values of type `[()]` cannot be known at compilation time +//[bad_new]~^^^ ERROR the size for values of type `[()]` cannot be known at compilation time +//[bad_new]~| ERROR the size for values of type `[()]` cannot be known at compilation time + +#[cfg(any(good, good_new))] +// Well-formed in trivially false param-env +fn foo() where Tail: Sized { + let _: <Tail as Bad>::Assert; +} + +fn main() {} diff --git a/tests/ui/traits/trivial-unsized-projection-in-coherence.rs b/tests/ui/traits/trivial-unsized-projection-in-coherence.rs new file mode 100644 index 00000000000..4407d544b4e --- /dev/null +++ b/tests/ui/traits/trivial-unsized-projection-in-coherence.rs @@ -0,0 +1,45 @@ +// Make sure we don't treat missing associated items as rigid +// during coherence, even if we know they've got an impossible +// `Sized`-bound. As we check whether the self type is definitely +// not `Sized` outside of coherence, this check can be incomplete. +// +// In this test we only use `impl<T> Overlap<u32> for T` to normalize +// the field of `MaybeUnsized<T, u32>` when checking whether it's +// definitely not `Sized`. However, for `MaybeUnsized<u32, u32>` we +// could also use `impl<U> Overlap<U> for u32` for normalization, which +// would result in a `Sized` type. cc #139000 + +struct MaybeUnsized<T: Overlap<U>, U>(<T as Overlap<U>>::MaybeUnsized); + +trait ReqSized { + type Missing1 + where + Self: Sized; + type Missing2 + where + Self: Sized; +} +impl<T> ReqSized for MaybeUnsized<T, u32> {} + +struct W<T: ?Sized>(T); +trait Eq<T> {} +impl<T> Eq<T> for W<T> {} + +trait RelateReqSized {} +impl<T: ReqSized> RelateReqSized for T where W<T::Missing1>: Eq<T::Missing2> {} + +trait Overlap<U> { + type MaybeUnsized: ?Sized; +} +impl<T> Overlap<u32> for T { + type MaybeUnsized = str; +} +impl<U> Overlap<U> for u32 +//~^ ERROR conflicting implementations of trait `Overlap<u32>` for type `u32` +where + MaybeUnsized<U, u32>: RelateReqSized, +{ + type MaybeUnsized = u32; +} + +fn main() {} diff --git a/tests/ui/traits/trivial-unsized-projection-in-coherence.stderr b/tests/ui/traits/trivial-unsized-projection-in-coherence.stderr new file mode 100644 index 00000000000..52fca9479ca --- /dev/null +++ b/tests/ui/traits/trivial-unsized-projection-in-coherence.stderr @@ -0,0 +1,15 @@ +error[E0119]: conflicting implementations of trait `Overlap<u32>` for type `u32` + --> $DIR/trivial-unsized-projection-in-coherence.rs:37:1 + | +LL | impl<T> Overlap<u32> for T { + | -------------------------- first implementation here +... +LL | / impl<U> Overlap<U> for u32 +LL | | +LL | | where +LL | | MaybeUnsized<U, u32>: RelateReqSized, + | |_________________________________________^ conflicting implementation for `u32` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/trivial-unsized-projection.bad.stderr b/tests/ui/traits/trivial-unsized-projection.bad.stderr new file mode 100644 index 00000000000..4aea63329b3 --- /dev/null +++ b/tests/ui/traits/trivial-unsized-projection.bad.stderr @@ -0,0 +1,44 @@ +error[E0277]: the size for values of type `[()]` cannot be known at compilation time + --> $DIR/trivial-unsized-projection.rs:20:12 + | +LL | const FOO: <[()] as Bad>::Assert = todo!(); + | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[()]` +note: required by a bound in `Bad::Assert` + --> $DIR/trivial-unsized-projection.rs:14:15 + | +LL | type Assert + | ------ required by a bound in this associated type +LL | where +LL | Self: Sized; + | ^^^^^ required by this bound in `Bad::Assert` +help: consider relaxing the implicit `Sized` restriction + | +LL | type Assert: ?Sized + | ++++++++ + +error[E0277]: the size for values of type `[()]` cannot be known at compilation time + --> $DIR/trivial-unsized-projection.rs:20:12 + | +LL | const FOO: <[()] as Bad>::Assert = todo!(); + | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[()]` +note: required by a bound in `Bad::Assert` + --> $DIR/trivial-unsized-projection.rs:14:15 + | +LL | type Assert + | ------ required by a bound in this associated type +LL | where +LL | Self: Sized; + | ^^^^^ required by this bound in `Bad::Assert` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider relaxing the implicit `Sized` restriction + | +LL | type Assert: ?Sized + | ++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/trivial-unsized-projection.bad_new.stderr b/tests/ui/traits/trivial-unsized-projection.bad_new.stderr new file mode 100644 index 00000000000..4aea63329b3 --- /dev/null +++ b/tests/ui/traits/trivial-unsized-projection.bad_new.stderr @@ -0,0 +1,44 @@ +error[E0277]: the size for values of type `[()]` cannot be known at compilation time + --> $DIR/trivial-unsized-projection.rs:20:12 + | +LL | const FOO: <[()] as Bad>::Assert = todo!(); + | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[()]` +note: required by a bound in `Bad::Assert` + --> $DIR/trivial-unsized-projection.rs:14:15 + | +LL | type Assert + | ------ required by a bound in this associated type +LL | where +LL | Self: Sized; + | ^^^^^ required by this bound in `Bad::Assert` +help: consider relaxing the implicit `Sized` restriction + | +LL | type Assert: ?Sized + | ++++++++ + +error[E0277]: the size for values of type `[()]` cannot be known at compilation time + --> $DIR/trivial-unsized-projection.rs:20:12 + | +LL | const FOO: <[()] as Bad>::Assert = todo!(); + | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[()]` +note: required by a bound in `Bad::Assert` + --> $DIR/trivial-unsized-projection.rs:14:15 + | +LL | type Assert + | ------ required by a bound in this associated type +LL | where +LL | Self: Sized; + | ^^^^^ required by this bound in `Bad::Assert` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: consider relaxing the implicit `Sized` restriction + | +LL | type Assert: ?Sized + | ++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/trivial-unsized-projection.rs b/tests/ui/traits/trivial-unsized-projection.rs new file mode 100644 index 00000000000..62ff25fb7ac --- /dev/null +++ b/tests/ui/traits/trivial-unsized-projection.rs @@ -0,0 +1,32 @@ +//@ revisions: good bad good_new bad_new +//@[good_new] compile-flags: -Znext-solver +//@[bad_new] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[good] check-pass +//@[good_new] check-pass + +#![feature(trivial_bounds)] +#![allow(trivial_bounds)] + +trait Bad { + type Assert + where + Self: Sized; +} + +impl Bad for [()] {} + +#[cfg(any(bad, bad_new))] +const FOO: <[()] as Bad>::Assert = todo!(); +//[bad]~^ ERROR the size for values of type `[()]` cannot be known at compilation time +//[bad]~| ERROR the size for values of type `[()]` cannot be known at compilation time +//[bad_new]~^^^ ERROR the size for values of type `[()]` cannot be known at compilation time +//[bad_new]~| ERROR the size for values of type `[()]` cannot be known at compilation time + +#[cfg(any(good, good_new))] +// Well-formed in trivially false param-env +fn foo() where [()]: Sized { + let _: <[()] as Bad>::Assert; +} + +fn main() {} diff --git a/tests/ui/transmutability/issue-101739-1.rs b/tests/ui/transmutability/issue-101739-1.rs index 4fde120e2be..b801e235540 100644 --- a/tests/ui/transmutability/issue-101739-1.rs +++ b/tests/ui/transmutability/issue-101739-1.rs @@ -6,7 +6,7 @@ mod assert { pub fn is_transmutable<Src, const ASSUME_ALIGNMENT: bool>() where Dst: TransmuteFrom<Src, ASSUME_ALIGNMENT>, //~ ERROR cannot find type `Dst` in this scope - //~| the constant `ASSUME_ALIGNMENT` is not of type `Assume` + //~| ERROR the constant `ASSUME_ALIGNMENT` is not of type `Assume` { } } diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs index b8828c59d35..e004f2cf4fe 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs @@ -15,5 +15,5 @@ mod assert { fn should_gracefully_handle_unknown_dst() { struct Src; - assert::is_transmutable::<Src, Dst>(); //~ cannot find type + assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot find type } diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst_field.rs b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst_field.rs index 2285d2f532e..081d1bf11ec 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst_field.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst_field.rs @@ -15,12 +15,12 @@ mod assert { fn should_gracefully_handle_unknown_dst_field() { #[repr(C)] struct Src; - #[repr(C)] struct Dst(Missing); //~ cannot find type + #[repr(C)] struct Dst(Missing); //~ ERROR cannot find type assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot be safely transmuted } fn should_gracefully_handle_unknown_dst_ref_field() { #[repr(C)] struct Src(&'static Src); - #[repr(C)] struct Dst(&'static Missing); //~ cannot find type + #[repr(C)] struct Dst(&'static Missing); //~ ERROR cannot find type assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot be safely transmuted } diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.rs b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.rs index 10ba7a61b87..0aca4acd0a3 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.rs @@ -15,5 +15,5 @@ mod assert { fn should_gracefully_handle_unknown_src() { #[repr(C)] struct Dst; - assert::is_transmutable::<Src, Dst>(); //~ cannot find type + assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot find type } diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs index 598e04971e2..ee09651d741 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs @@ -14,13 +14,13 @@ mod assert { } fn should_gracefully_handle_unknown_src_field() { - #[repr(C)] struct Src(Missing); //~ cannot find type + #[repr(C)] struct Src(Missing); //~ ERROR cannot find type #[repr(C)] struct Dst(); assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot be safely transmuted } fn should_gracefully_handle_unknown_src_ref_field() { - #[repr(C)] struct Src(&'static Missing); //~ cannot find type + #[repr(C)] struct Src(&'static Missing); //~ ERROR cannot find type #[repr(C)] struct Dst(&'static Dst); assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot be safely transmuted } diff --git a/tests/ui/transmutability/transmute-higher-ranked.rs b/tests/ui/transmutability/transmute-higher-ranked.rs new file mode 100644 index 00000000000..f0fe02a7908 --- /dev/null +++ b/tests/ui/transmutability/transmute-higher-ranked.rs @@ -0,0 +1,18 @@ +// Ensure we don't ICE when transmuting higher-ranked types via a +// higher-ranked transmute goal. + +//@ check-pass + +#![feature(transmutability)] + +use std::mem::TransmuteFrom; + +pub fn transmute() +where + for<'a> &'a &'a i32: TransmuteFrom<&'a &'a u32>, +{ +} + +fn main() { + transmute(); +} diff --git a/tests/ui/try-block/issue-45124.rs b/tests/ui/try-block/issue-45124.rs index e9e0e767efa..26e1736faac 100644 --- a/tests/ui/try-block/issue-45124.rs +++ b/tests/ui/try-block/issue-45124.rs @@ -1,6 +1,6 @@ //@ run-pass #![allow(unreachable_code)] -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-block-bad-lifetime.rs b/tests/ui/try-block/try-block-bad-lifetime.rs index bfff757a2df..9b45b0d9559 100644 --- a/tests/ui/try-block/try-block-bad-lifetime.rs +++ b/tests/ui/try-block/try-block-bad-lifetime.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-block-bad-type.rs b/tests/ui/try-block/try-block-bad-type.rs index 71eb832dd4e..00cd0af127c 100644 --- a/tests/ui/try-block/try-block-bad-type.rs +++ b/tests/ui/try-block/try-block-bad-type.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-block-catch.rs b/tests/ui/try-block/try-block-catch.rs index c3aa442ba66..170d5bab3e5 100644 --- a/tests/ui/try-block/try-block-catch.rs +++ b/tests/ui/try-block/try-block-catch.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-block-in-edition2015.rs b/tests/ui/try-block/try-block-in-edition2015.rs index 423269df12d..4ebe2d31b81 100644 --- a/tests/ui/try-block/try-block-in-edition2015.rs +++ b/tests/ui/try-block/try-block-in-edition2015.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2015 +//@ edition: 2015 pub fn main() { let try_result: Option<_> = try { diff --git a/tests/ui/try-block/try-block-in-match-arm.rs b/tests/ui/try-block/try-block-in-match-arm.rs index cecbf724916..703b1c54bbb 100644 --- a/tests/ui/try-block/try-block-in-match-arm.rs +++ b/tests/ui/try-block/try-block-in-match-arm.rs @@ -1,5 +1,5 @@ //@ check-pass -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-block-in-match.rs b/tests/ui/try-block/try-block-in-match.rs index 5c62f41efdb..63a32000f62 100644 --- a/tests/ui/try-block/try-block-in-match.rs +++ b/tests/ui/try-block/try-block-in-match.rs @@ -1,5 +1,5 @@ //@ run-pass -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-block-in-return.rs b/tests/ui/try-block/try-block-in-return.rs index ee5ca696b6d..7dc023b90db 100644 --- a/tests/ui/try-block/try-block-in-return.rs +++ b/tests/ui/try-block/try-block-in-return.rs @@ -1,5 +1,5 @@ //@ run-pass -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-block-in-while.rs b/tests/ui/try-block/try-block-in-while.rs index 88a97136c59..d6232546cea 100644 --- a/tests/ui/try-block/try-block-in-while.rs +++ b/tests/ui/try-block/try-block-in-while.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-block-maybe-bad-lifetime.rs b/tests/ui/try-block/try-block-maybe-bad-lifetime.rs index 52ec0c44a05..14adee8944f 100644 --- a/tests/ui/try-block/try-block-maybe-bad-lifetime.rs +++ b/tests/ui/try-block/try-block-maybe-bad-lifetime.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-block-opt-init.rs b/tests/ui/try-block/try-block-opt-init.rs index fbe7f90d030..55ac5b4a37c 100644 --- a/tests/ui/try-block/try-block-opt-init.rs +++ b/tests/ui/try-block/try-block-opt-init.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-block-type-error.rs b/tests/ui/try-block/try-block-type-error.rs index 79cdb7a2e48..4e482b40140 100644 --- a/tests/ui/try-block/try-block-type-error.rs +++ b/tests/ui/try-block/try-block-type-error.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-block-unreachable-code-lint.rs b/tests/ui/try-block/try-block-unreachable-code-lint.rs index 62c74b76d59..9135882a57b 100644 --- a/tests/ui/try-block/try-block-unreachable-code-lint.rs +++ b/tests/ui/try-block/try-block-unreachable-code-lint.rs @@ -1,6 +1,6 @@ // Test unreachable_code lint for `try {}` block ok-wrapping. See issues #54165, #63324. -//@ compile-flags: --edition 2018 +//@ edition: 2018 //@ check-pass #![feature(try_blocks)] #![warn(unreachable_code)] diff --git a/tests/ui/try-block/try-block-unused-delims.fixed b/tests/ui/try-block/try-block-unused-delims.fixed index 348eb8f7965..4769c45d38c 100644 --- a/tests/ui/try-block/try-block-unused-delims.fixed +++ b/tests/ui/try-block/try-block-unused-delims.fixed @@ -1,5 +1,5 @@ //@ check-pass -//@ compile-flags: --edition 2018 +//@ edition: 2018 //@ run-rustfix #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-block-unused-delims.rs b/tests/ui/try-block/try-block-unused-delims.rs index f119e1074f6..0520d1d620f 100644 --- a/tests/ui/try-block/try-block-unused-delims.rs +++ b/tests/ui/try-block/try-block-unused-delims.rs @@ -1,5 +1,5 @@ //@ check-pass -//@ compile-flags: --edition 2018 +//@ edition: 2018 //@ run-rustfix #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-block.rs b/tests/ui/try-block/try-block.rs index 7520cbaad37..3fa0d2ba0f2 100644 --- a/tests/ui/try-block/try-block.rs +++ b/tests/ui/try-block/try-block.rs @@ -2,7 +2,7 @@ #![allow(non_camel_case_types)] #![allow(dead_code)] -//@ compile-flags: --edition 2018 +//@ edition: 2018 #![feature(try_blocks)] diff --git a/tests/ui/try-block/try-is-identifier-edition2015.rs b/tests/ui/try-block/try-is-identifier-edition2015.rs index 54bd049442f..99f4d206859 100644 --- a/tests/ui/try-block/try-is-identifier-edition2015.rs +++ b/tests/ui/try-block/try-is-identifier-edition2015.rs @@ -1,7 +1,7 @@ //@ run-pass #![allow(non_camel_case_types)] -//@ compile-flags: --edition 2015 +//@ edition: 2015 fn main() { let try = 2; diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage2.rs b/tests/ui/type-alias-impl-trait/auto-trait-leakage2.rs index 6132eef0db5..0b60640272b 100644 --- a/tests/ui/type-alias-impl-trait/auto-trait-leakage2.rs +++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage2.rs @@ -4,8 +4,8 @@ use std::rc::Rc; type Foo = impl std::fmt::Debug; //~ NOTE appears within the type -//~^ within this `Foo` -//~| expansion of desugaring +//~^ NOTE within this `Foo` +//~| NOTE expansion of desugaring #[define_opaque(Foo)] pub fn foo() -> Foo { @@ -13,8 +13,8 @@ pub fn foo() -> Foo { } fn is_send<T: Send>(_: T) {} -//~^ required by this bound -//~| required by a bound +//~^ NOTE required by this bound +//~| NOTE required by a bound fn main() { is_send(foo()); diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection.rs b/tests/ui/type-alias-impl-trait/constrain_in_projection.rs index 64b9c583ca2..62a105611b0 100644 --- a/tests/ui/type-alias-impl-trait/constrain_in_projection.rs +++ b/tests/ui/type-alias-impl-trait/constrain_in_projection.rs @@ -23,8 +23,8 @@ impl Trait<()> for Foo { #[define_opaque(Bar)] fn bop() { let x = <Foo as Trait<Bar>>::Assoc::default(); - //[current]~^ `Foo: Trait<Bar>` is not satisfied - //[current]~| `Foo: Trait<Bar>` is not satisfied + //[current]~^ ERROR `Foo: Trait<Bar>` is not satisfied + //[current]~| ERROR `Foo: Trait<Bar>` is not satisfied } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs b/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs index 4f3f6d37eff..f69fd5747b6 100644 --- a/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs +++ b/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition=2021 +//@ edition: 2021 //@ build-pass #![feature(type_alias_impl_trait)] diff --git a/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.rs b/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.rs index cad1cbf61a2..736a9dfb490 100644 --- a/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.rs +++ b/tests/ui/type-alias-impl-trait/cross_inference_pattern_bug_no_type.rs @@ -1,4 +1,5 @@ -//@ compile-flags: --edition=2021 --crate-type=lib +//@ compile-flags: --crate-type=lib +//@ edition: 2021 //@ rustc-env:RUST_BACKTRACE=0 //@ check-pass diff --git a/tests/ui/type-alias-impl-trait/declared_but_not_defined_in_scope.rs b/tests/ui/type-alias-impl-trait/declared_but_not_defined_in_scope.rs index 5bda5f0fcea..2c538853e7b 100644 --- a/tests/ui/type-alias-impl-trait/declared_but_not_defined_in_scope.rs +++ b/tests/ui/type-alias-impl-trait/declared_but_not_defined_in_scope.rs @@ -9,5 +9,5 @@ mod boo { fn bomp() -> boo::Boo { "" - //~^ mismatched types + //~^ ERROR mismatched types } 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 d01cc7ff04e..febe1df81ae 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 @@ -13,6 +13,6 @@ fn two<T: Debug, U: Debug>(t: T, _: U) -> Two<T, U> { #[define_opaque(Two)] fn three<T: Debug, U: Debug>(_: T, u: U) -> Two<T, U> { - //~^ concrete type differs + //~^ ERROR concrete type differs (u, 4u32) } diff --git a/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr b/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr index 13f5d8b8ea6..c58d919c4b1 100644 --- a/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr +++ b/tests/ui/type-alias-impl-trait/impl-trait-in-type-alias-with-bad-substs.stderr @@ -1,4 +1,4 @@ -error[E0049]: type `Baz` has 1 type parameter but its trait declaration has 0 type parameters +error[E0049]: associated type `Baz` has 1 type parameter but its trait declaration has 0 type parameters --> $DIR/impl-trait-in-type-alias-with-bad-substs.rs:19:14 | LL | type Baz<'a>; diff --git a/tests/ui/type-alias-impl-trait/issue-104817.rs b/tests/ui/type-alias-impl-trait/issue-104817.rs index 13bbfa12a67..01935407e2b 100644 --- a/tests/ui/type-alias-impl-trait/issue-104817.rs +++ b/tests/ui/type-alias-impl-trait/issue-104817.rs @@ -15,6 +15,6 @@ fn mk_opaque() -> OpaqueType { trait AnotherTrait {} impl<T: Send> AnotherTrait for T {} impl AnotherTrait for OpaqueType {} -//[stock]~^ conflicting implementations of trait `AnotherTrait` +//[stock]~^ ERROR conflicting implementations of trait `AnotherTrait` fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-53598.rs b/tests/ui/type-alias-impl-trait/issue-53598.rs index 3262c69cf5a..d8eee3218ed 100644 --- a/tests/ui/type-alias-impl-trait/issue-53598.rs +++ b/tests/ui/type-alias-impl-trait/issue-53598.rs @@ -17,7 +17,7 @@ impl Foo for S2 { type Item = impl Debug; fn foo<T: Debug>(_: T) -> Self::Item { - //~^ Error type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias + //~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias S::<T>(Default::default()) } } diff --git a/tests/ui/type-alias-impl-trait/issue-93411.rs b/tests/ui/type-alias-impl-trait/issue-93411.rs index 11cbb876631..614d2d0471b 100644 --- a/tests/ui/type-alias-impl-trait/issue-93411.rs +++ b/tests/ui/type-alias-impl-trait/issue-93411.rs @@ -2,7 +2,7 @@ // this test used to stack overflow due to infinite recursion. //@ check-pass -//@ compile-flags: --edition=2018 +//@ edition: 2018 use std::future::Future; diff --git a/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs b/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs index 08f3c404bed..7f0f6a214aa 100644 --- a/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs +++ b/tests/ui/type-alias-impl-trait/issue-96572-unconstrained.rs @@ -1,7 +1,7 @@ #![feature(type_alias_impl_trait)] //@ check-pass //@ revisions: default edition2021 -//@[edition2021] compile-flags: --edition 2021 +//@[edition2021]edition: 2021 fn main() { type T = impl Copy; diff --git a/tests/ui/type-alias-impl-trait/not_well_formed.rs b/tests/ui/type-alias-impl-trait/not_well_formed.rs index bd4477dbf0f..f8f7f8a20e9 100644 --- a/tests/ui/type-alias-impl-trait/not_well_formed.rs +++ b/tests/ui/type-alias-impl-trait/not_well_formed.rs @@ -9,8 +9,8 @@ trait TraitWithAssoc { } type Foo<V> = impl Trait<V::Assoc>; -//~^ associated type `Assoc` not found for `V` -//~| associated type `Assoc` not found for `V` +//~^ ERROR associated type `Assoc` not found for `V` +//~| ERROR associated type `Assoc` not found for `V` trait Trait<U> {} diff --git a/tests/ui/type-alias-impl-trait/structural-match-no-leak.rs b/tests/ui/type-alias-impl-trait/structural-match-no-leak.rs index a20ae814908..37cb2322175 100644 --- a/tests/ui/type-alias-impl-trait/structural-match-no-leak.rs +++ b/tests/ui/type-alias-impl-trait/structural-match-no-leak.rs @@ -14,7 +14,7 @@ const LEAK_FREE: Bar = leak_free(); fn leak_free_test() { match LEAK_FREE { LEAK_FREE => (), - //~^ `Bar` cannot be used in patterns + //~^ ERROR `Bar` cannot be used in patterns _ => (), } } diff --git a/tests/ui/type-alias-impl-trait/structural-match.rs b/tests/ui/type-alias-impl-trait/structural-match.rs index 68a95560a46..e922ffb74a5 100644 --- a/tests/ui/type-alias-impl-trait/structural-match.rs +++ b/tests/ui/type-alias-impl-trait/structural-match.rs @@ -15,7 +15,7 @@ const VALUE: Foo = value(); fn test() { match VALUE { VALUE => (), - //~^ `Foo` cannot be used in patterns + //~^ ERROR `Foo` cannot be used in patterns _ => (), } } diff --git a/tests/ui/type-alias-impl-trait/variance.rs b/tests/ui/type-alias-impl-trait/variance.rs index ecd7158223c..d9140695dae 100644 --- a/tests/ui/type-alias-impl-trait/variance.rs +++ b/tests/ui/type-alias-impl-trait/variance.rs @@ -5,17 +5,17 @@ trait Captures<'a> {} impl<T> Captures<'_> for T {} -type NotCapturedEarly<'a> = impl Sized; //~ ['a: *, 'a: o] +type NotCapturedEarly<'a> = impl Sized; //~ ERROR ['a: *, 'a: o] //~^ ERROR: unconstrained opaque type -type CapturedEarly<'a> = impl Sized + Captures<'a>; //~ ['a: *, 'a: o] +type CapturedEarly<'a> = impl Sized + Captures<'a>; //~ ERROR ['a: *, 'a: o] //~^ ERROR: unconstrained opaque type -type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; //~ ['a: *, 'a: o, 'b: o] +type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; //~ ERROR ['a: *, 'a: o, 'b: o] //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type //~| ERROR: unconstrained opaque type -type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>; //~ ['a: *, 'a: o, 'b: o] +type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>; //~ ERROR ['a: *, 'a: o, 'b: o] //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type //~| ERROR: unconstrained opaque type @@ -31,24 +31,24 @@ trait Foo<'i> { } impl<'i> Foo<'i> for &'i () { - type ImplicitCapture<'a> = impl Sized; //~ ['i: *, 'a: *, 'i: o, 'a: o] + type ImplicitCapture<'a> = impl Sized; //~ ERROR ['i: *, 'a: *, 'i: o, 'a: o] //~^ ERROR: unconstrained opaque type - type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ['i: *, 'a: *, 'i: o, 'a: o] + type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ERROR ['i: *, 'a: *, 'i: o, 'a: o] //~^ ERROR: unconstrained opaque type - type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ['i: *, 'a: *, 'i: o, 'a: o] + type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ERROR ['i: *, 'a: *, 'i: o, 'a: o] //~^ ERROR: unconstrained opaque type } impl<'i> Foo<'i> for () { - type ImplicitCapture<'a> = impl Sized; //~ ['i: *, 'a: *, 'i: o, 'a: o] + type ImplicitCapture<'a> = impl Sized; //~ ERROR ['i: *, 'a: *, 'i: o, 'a: o] //~^ ERROR: unconstrained opaque type - type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ['i: *, 'a: *, 'i: o, 'a: o] + type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ERROR ['i: *, 'a: *, 'i: o, 'a: o] //~^ ERROR: unconstrained opaque type - type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ['i: *, 'a: *, 'i: o, 'a: o] + type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ERROR ['i: *, 'a: *, 'i: o, 'a: o] //~^ ERROR: unconstrained opaque type } @@ -59,15 +59,15 @@ impl<'a> Nesting<'a> for &'a () { type Output = &'a (); } type NestedDeeply<'a> = - impl Nesting< //~ ['a: *, 'a: o] + impl Nesting< //~ ERROR ['a: *, 'a: o] 'a, - Output = impl Nesting< //~ ['a: *, 'a: o] + Output = impl Nesting< //~ ERROR ['a: *, 'a: o] 'a, - Output = impl Nesting< //~ ['a: *, 'a: o] + Output = impl Nesting< //~ ERROR ['a: *, 'a: o] 'a, - Output = impl Nesting< //~ ['a: *, 'a: o] + Output = impl Nesting< //~ ERROR ['a: *, 'a: o] 'a, - Output = impl Nesting<'a> //~ ['a: *, 'a: o] + Output = impl Nesting<'a> //~ ERROR ['a: *, 'a: o] > >, >, diff --git a/tests/ui/type/issue-103271.rs b/tests/ui/type/issue-103271.rs index 7cd76286a92..98cfaaf5cff 100644 --- a/tests/ui/type/issue-103271.rs +++ b/tests/ui/type/issue-103271.rs @@ -1,15 +1,15 @@ fn main() { let iter_fun = <&[u32]>::iter; //~^ ERROR no function or associated item named `iter` found for reference `&[u32]` in the current scope [E0599] - //~| function or associated item not found in `&[u32]` + //~| NOTE function or associated item not found in `&[u32]` //~| HELP the function `iter` is implemented on `[u32]` for item in iter_fun(&[1,1]) { let x: &u32 = item; assert_eq!(x, &1); } let iter_fun2 = <(&[u32])>::iter; - //~^ no function or associated item named `iter` found for reference `&[u32]` in the current scope [E0599] - //~| function or associated item not found in `&[u32]` + //~^ ERROR no function or associated item named `iter` found for reference `&[u32]` in the current scope [E0599] + //~| NOTE function or associated item not found in `&[u32]` //~| HELP the function `iter` is implemented on `[u32]` for item2 in iter_fun2(&[1,1]) { let x: &u32 = item2; diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types.rs b/tests/ui/type/pattern_types/feature-gate-pattern_types.rs index b4f4bd656f5..a51741675bb 100644 --- a/tests/ui/type/pattern_types/feature-gate-pattern_types.rs +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types.rs @@ -3,13 +3,13 @@ use std::pat::pattern_type; type NonNullU32 = pattern_type!(u32 is 1..); -//~^ use of unstable library feature `pattern_type_macro` +//~^ ERROR use of unstable library feature `pattern_type_macro` type Percent = pattern_type!(u32 is 0..=100); -//~^ use of unstable library feature `pattern_type_macro` +//~^ ERROR use of unstable library feature `pattern_type_macro` type Negative = pattern_type!(i32 is ..=0); -//~^ use of unstable library feature `pattern_type_macro` +//~^ ERROR use of unstable library feature `pattern_type_macro` type Positive = pattern_type!(i32 is 0..); -//~^ use of unstable library feature `pattern_type_macro` +//~^ ERROR use of unstable library feature `pattern_type_macro` type Always = pattern_type!(Option<u32> is Some(_)); -//~^ use of unstable library feature `pattern_type_macro` +//~^ ERROR use of unstable library feature `pattern_type_macro` //~| ERROR pattern not supported in pattern types diff --git a/tests/ui/type/pattern_types/literals.rs b/tests/ui/type/pattern_types/literals.rs index 7fd630dab3a..b2a83a2a8bd 100644 --- a/tests/ui/type/pattern_types/literals.rs +++ b/tests/ui/type/pattern_types/literals.rs @@ -7,7 +7,7 @@ use std::pat::pattern_type; fn out_of_range() -> pattern_type!(u32 is 1..) { 0 - //~^ mismatched types + //~^ ERROR mismatched types } fn at_range_start() -> pattern_type!(u32 is 1..) { @@ -34,7 +34,7 @@ fn positive_lit_in_range_of_signed() -> pattern_type!(i8 is -5..5) { fn negative_lit_at_range_start() -> pattern_type!(i8 is -5..5) { -5 - //~^ mismatched types + //~^ ERROR mismatched types } fn positive_lit_at_range_end() -> pattern_type!(i8 is -5..5) { @@ -43,22 +43,22 @@ fn positive_lit_at_range_end() -> pattern_type!(i8 is -5..5) { fn lit_one_beyond_range_end() -> pattern_type!(i8 is -5..5) { 5 - //~^ mismatched types + //~^ ERROR mismatched types } fn wrong_lit_kind() -> pattern_type!(u32 is 1..) { '3' - //~^ mismatched types + //~^ ERROR mismatched types } fn char_lit_in_range() -> pattern_type!(char is 'a'..'z') { 'b' - //~^ mismatched types + //~^ ERROR mismatched types } fn char_lit_out_of_range() -> pattern_type!(char is 'a'..'z') { 'A' - //~^ mismatched types + //~^ ERROR mismatched types } fn lit_at_unsigned_range_inclusive_end() -> pattern_type!(u32 is 0..=1) { @@ -71,12 +71,12 @@ fn single_element_range() -> pattern_type!(u32 is 0..=0) { fn lit_oob_single_element_range() -> pattern_type!(u32 is 0..=0) { 1 - //~^ mismatched types + //~^ ERROR mismatched types } fn lit_oob_single_element_range_exclusive() -> pattern_type!(u32 is 0..1) { 1 - //~^ mismatched types + //~^ ERROR mismatched types } fn single_element_range_exclusive() -> pattern_type!(u32 is 0..1) { @@ -84,53 +84,53 @@ fn single_element_range_exclusive() -> pattern_type!(u32 is 0..1) { } fn empty_range_at_base_type_min() -> pattern_type!(u32 is 0..0) { - //~^ evaluation of constant value failed + //~^ ERROR evaluation of constant value failed 0 } fn empty_range_at_base_type_min2() -> pattern_type!(u32 is 0..0) { - //~^ evaluation of constant value failed + //~^ ERROR evaluation of constant value failed 1 } fn empty_range() -> pattern_type!(u32 is 1..1) { 0 - //~^ mismatched types + //~^ ERROR mismatched types } fn empty_range2() -> pattern_type!(u32 is 1..1) { 1 - //~^ mismatched types + //~^ ERROR mismatched types } fn wraparound_range_at_base_ty_end() -> pattern_type!(u32 is 1..0) { - //~^ evaluation of constant value failed + //~^ ERROR evaluation of constant value failed 1 } fn wraparound_range_at_base_ty_end2() -> pattern_type!(u32 is 1..0) { - //~^ evaluation of constant value failed + //~^ ERROR evaluation of constant value failed 0 } fn wraparound_range_at_base_ty_end3() -> pattern_type!(u32 is 1..0) { - //~^ evaluation of constant value failed + //~^ ERROR evaluation of constant value failed 2 } fn wraparound_range() -> pattern_type!(u32 is 2..1) { 1 - //~^ mismatched types + //~^ ERROR mismatched types } fn lit_in_wraparound_range() -> pattern_type!(u32 is 2..1) { 0 - //~^ mismatched types + //~^ ERROR mismatched types } fn lit_at_wraparound_range_start() -> pattern_type!(u32 is 2..1) { 2 - //~^ mismatched types + //~^ ERROR mismatched types } fn main() {} diff --git a/tests/ui/typeck/attempted-access-non-fatal.rs b/tests/ui/typeck/attempted-access-non-fatal.rs index 15deb9e2f60..ba391cfa486 100644 --- a/tests/ui/typeck/attempted-access-non-fatal.rs +++ b/tests/ui/typeck/attempted-access-non-fatal.rs @@ -1,10 +1,10 @@ // Check that bogus field access is non-fatal fn main() { let x = 0; - let _ = x.foo; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] - let _ = x.bar; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] - let _ = 0.f; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] - let _ = 2.l; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] - let _ = 12.F; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] - let _ = 34.L; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = x.foo; //~ ERROR `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = x.bar; //~ ERROR `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = 0.f; //~ ERROR `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = 2.l; //~ ERROR `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = 12.F; //~ ERROR `{integer}` is a primitive type and therefore doesn't have fields [E0610] + let _ = 34.L; //~ ERROR `{integer}` is a primitive type and therefore doesn't have fields [E0610] } diff --git a/tests/ui/typeck/autoderef-with-param-env-error.rs b/tests/ui/typeck/autoderef-with-param-env-error.rs index ec96c61c63e..d68f2d492ff 100644 --- a/tests/ui/typeck/autoderef-with-param-env-error.rs +++ b/tests/ui/typeck/autoderef-with-param-env-error.rs @@ -1,7 +1,7 @@ fn foo() where T: Send, - //~^ cannot find type `T` in this scope + //~^ ERROR cannot find type `T` in this scope { let s = "abc".to_string(); } diff --git a/tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-a.rs b/tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-a.rs new file mode 100644 index 00000000000..87d83663626 --- /dev/null +++ b/tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-a.rs @@ -0,0 +1,5 @@ +//@ edition: 2021 + +pub trait Foo { + fn foo(); +} diff --git a/tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-b.rs b/tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-b.rs new file mode 100644 index 00000000000..9e90e0f0b35 --- /dev/null +++ b/tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-b.rs @@ -0,0 +1,14 @@ +// ignore-tidy-linelength +//@ edition: 2021 +//@ aux-crate:suggest_trait_reexported_as_not_doc_visible_a=suggest-trait-reexported-as-not-doc-visible-a.rs + +pub struct Bar; + +impl __DocHidden::Foo for Bar { + fn foo() {} +} + +#[doc(hidden)] +pub mod __DocHidden { + pub use suggest_trait_reexported_as_not_doc_visible_a::Foo; +} diff --git a/tests/ui/typeck/issue-46112.rs b/tests/ui/typeck/issue-46112.rs index cc8029771d6..a3fe03b17c1 100644 --- a/tests/ui/typeck/issue-46112.rs +++ b/tests/ui/typeck/issue-46112.rs @@ -6,4 +6,4 @@ extern crate xcrate_issue_46112_rexport_core; fn test(r: Result<Option<()>, &'static str>) { } fn main() { test(Ok(())); } -//~^ mismatched types +//~^ ERROR mismatched types diff --git a/tests/ui/typeck/issue-65611.rs b/tests/ui/typeck/issue-65611.rs index 7645311496d..0dae75927a8 100644 --- a/tests/ui/typeck/issue-65611.rs +++ b/tests/ui/typeck/issue-65611.rs @@ -58,6 +58,5 @@ fn main() { let mut buffer = ArrayVec::new(); let x = buffer.last().unwrap().0.clone(); //~^ ERROR type annotations needed - //~| ERROR no field `0` on type `&_` buffer.reverse(); } diff --git a/tests/ui/typeck/issue-65611.stderr b/tests/ui/typeck/issue-65611.stderr index 2278450a6d8..52f0f0cffff 100644 --- a/tests/ui/typeck/issue-65611.stderr +++ b/tests/ui/typeck/issue-65611.stderr @@ -4,13 +4,6 @@ error[E0282]: type annotations needed LL | let x = buffer.last().unwrap().0.clone(); | ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `T` -error[E0609]: no field `0` on type `&_` - --> $DIR/issue-65611.rs:59:36 - | -LL | let x = buffer.last().unwrap().0.clone(); - | ^ unknown field - -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -Some errors have detailed explanations: E0282, E0609. -For more information about an error, try `rustc --explain E0282`. +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/typeck/issue-79040.rs b/tests/ui/typeck/issue-79040.rs index f8e38e7867d..fe8dc453461 100644 --- a/tests/ui/typeck/issue-79040.rs +++ b/tests/ui/typeck/issue-79040.rs @@ -1,6 +1,6 @@ fn main() { const FOO = "hello" + 1; //~^ ERROR cannot add `{integer}` to `&str` - //~| missing type for `const` item + //~| ERROR missing type for `const` item println!("{}", FOO); } diff --git a/tests/ui/typeck/issue-83693.rs b/tests/ui/typeck/issue-83693.rs index 02a0bb30d7c..68a1416517a 100644 --- a/tests/ui/typeck/issue-83693.rs +++ b/tests/ui/typeck/issue-83693.rs @@ -8,7 +8,7 @@ impl F { fn call() { <Self as Fn(&TestResult)>::call //~^ ERROR: cannot find type `TestResult` in this scope [E0412] - //~| associated item constraints are not allowed here [E0229] + //~| ERROR associated item constraints are not allowed here [E0229] } } diff --git a/tests/ui/typeck/no-type-for-node-ice.rs b/tests/ui/typeck/no-type-for-node-ice.rs index d0cfdbf504d..ed56272e63c 100644 --- a/tests/ui/typeck/no-type-for-node-ice.rs +++ b/tests/ui/typeck/no-type-for-node-ice.rs @@ -1,5 +1,5 @@ // Related issues: #20401, #20506, #20614, #20752, #20829, #20846, #20885, #20886 fn main() { - "".homura[""]; //~ no field `homura` on type `&'static str` + "".homura[""]; //~ ERROR no field `homura` on type `&'static str` } diff --git a/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.rs b/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.rs new file mode 100644 index 00000000000..3cb775e85ac --- /dev/null +++ b/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.rs @@ -0,0 +1,11 @@ +// ignore-tidy-linelength +//@ edition: 2021 +//@ aux-crate:suggest_trait_reexported_as_not_doc_visible_a=suggest-trait-reexported-as-not-doc-visible-a.rs +//@ aux-crate:suggest_trait_reexported_as_not_doc_visible_b=suggest-trait-reexported-as-not-doc-visible-b.rs + +use suggest_trait_reexported_as_not_doc_visible_b::Bar; + +fn main() { + Bar::foo(); + //~^ ERROR: no function or associated item named `foo` found for struct `Bar` in the current scope [E0599] +} diff --git a/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.stderr b/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.stderr new file mode 100644 index 00000000000..9128ee68444 --- /dev/null +++ b/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.stderr @@ -0,0 +1,15 @@ +error[E0599]: no function or associated item named `foo` found for struct `Bar` in the current scope + --> $DIR/suggest-trait-reexported-as-not-doc-visible.rs:9:10 + | +LL | Bar::foo(); + | ^^^ function or associated item not found in `Bar` + | + = help: items from traits can only be used if the trait is in scope +help: trait `Foo` which provides `foo` is implemented but not in scope; perhaps you want to import it + | +LL + use suggest_trait_reexported_as_not_doc_visible_a::Foo; + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr index 2a4a5a62ab4..7184244f5dc 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr @@ -439,6 +439,18 @@ LL | fn fn_test13(x: _) -> (i32, _) { (x, x) } | | not allowed in type signatures | help: replace with the correct return type: `(i32, i32)` +error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs + --> $DIR/typeck_type_placeholder_item.rs:154:21 + | +LL | struct BadStruct<_>(_); + | ^ not allowed in type signatures + | +help: use type parameters instead + | +LL - struct BadStruct<_>(_); +LL + struct BadStruct<T>(T); + | + error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:140:31 | @@ -515,18 +527,6 @@ LL - fn assoc_fn_test3() -> _; LL + fn assoc_fn_test3<T>() -> T; | -error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs - --> $DIR/typeck_type_placeholder_item.rs:154:21 - | -LL | struct BadStruct<_>(_); - | ^ not allowed in type signatures - | -help: use type parameters instead - | -LL - struct BadStruct<_>(_); -LL + struct BadStruct<T>(T); - | - error[E0121]: the placeholder `_` is not allowed within types on item signatures for implementations --> $DIR/typeck_type_placeholder_item.rs:159:15 | diff --git a/tests/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs b/tests/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs index 6765da42132..c57e665724b 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs +++ b/tests/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs @@ -15,6 +15,6 @@ fn doit<T,F>(val: T, f: &F) pub fn main() { doit(0, &|x, y| { x.set(y); - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough }); } diff --git a/tests/ui/uninhabited/uninhabited-irrefutable.rs b/tests/ui/uninhabited/uninhabited-irrefutable.rs index cbaa9896003..3f7414e596b 100644 --- a/tests/ui/uninhabited/uninhabited-irrefutable.rs +++ b/tests/ui/uninhabited/uninhabited-irrefutable.rs @@ -29,7 +29,7 @@ fn main() { let x: Foo = Foo::D(123, 456); let Foo::D(_y, _z) = x; //~^ ERROR refutable pattern in local binding - //~| `Foo::A(_)` not covered + //~| NOTE `Foo::A(_)` not covered //~| NOTE `let` bindings require an "irrefutable pattern" //~| NOTE for more information //~| NOTE pattern `Foo::A(_)` is currently uninhabited diff --git a/tests/ui/unpretty/expanded-exhaustive.rs b/tests/ui/unpretty/expanded-exhaustive.rs index 31af323ecda..4d1f12e3490 100644 --- a/tests/ui/unpretty/expanded-exhaustive.rs +++ b/tests/ui/unpretty/expanded-exhaustive.rs @@ -574,6 +574,11 @@ mod items { } mod patterns { + /// PatKind::Missing + fn pat_missing() { + let _: fn(u32, T, &str); + } + /// PatKind::Wild fn pat_wild() { let _; diff --git a/tests/ui/unpretty/expanded-exhaustive.stdout b/tests/ui/unpretty/expanded-exhaustive.stdout index 19ae66f7a07..d8da941a340 100644 --- a/tests/ui/unpretty/expanded-exhaustive.stdout +++ b/tests/ui/unpretty/expanded-exhaustive.stdout @@ -363,6 +363,7 @@ mod expressions { + { builtin # offset_of(T, field) }; } /// ExprKind::MacCall @@ -517,6 +518,8 @@ mod items { } } mod patterns { + /// PatKind::Missing + fn pat_missing() { let _: fn(u32, T, &str); } /// PatKind::Wild fn pat_wild() { let _; } /// PatKind::Ident diff --git a/tests/ui/unsafe-binders/lifetime-resolution.rs b/tests/ui/unsafe-binders/lifetime-resolution.rs index b352acfadf2..d2431540119 100644 --- a/tests/ui/unsafe-binders/lifetime-resolution.rs +++ b/tests/ui/unsafe-binders/lifetime-resolution.rs @@ -9,7 +9,7 @@ fn foo<'a>() { fn inner<'b>() { let outer: unsafe<> &'a &'b (); - //~^ can't use generic parameters from outer item + //~^ ERROR can't use generic parameters from outer item } } diff --git a/tests/ui/unsafe/unsafe-unstable-const-fn.rs b/tests/ui/unsafe/unsafe-unstable-const-fn.rs index 5398721484a..dd1fd846377 100644 --- a/tests/ui/unsafe/unsafe-unstable-const-fn.rs +++ b/tests/ui/unsafe/unsafe-unstable-const-fn.rs @@ -5,7 +5,7 @@ #[rustc_const_unstable(feature = "const_foo", issue = "none")] const fn unstable(a: *const i32, b: i32) -> bool { *a == b - //~^ dereference of raw pointer is unsafe + //~^ ERROR dereference of raw pointer is unsafe } fn main() {} diff --git a/tests/ui/unsized-locals/issue-30276-feature-flagged.rs b/tests/ui/unsized-locals/issue-30276-feature-flagged.rs index 635d34f8229..8b5b321ec49 100644 --- a/tests/ui/unsized-locals/issue-30276-feature-flagged.rs +++ b/tests/ui/unsized-locals/issue-30276-feature-flagged.rs @@ -5,4 +5,5 @@ struct Test([i32]); fn main() { let _x: fn(_) -> Test = Test; -} //~^the size for values of type `[i32]` cannot be known at compilation time + //~^ ERROR the size for values of type `[i32]` cannot be known at compilation time +} diff --git a/tests/ui/unsized-locals/issue-30276.rs b/tests/ui/unsized-locals/issue-30276.rs index 9c4bf062a40..6b67ebbec1c 100644 --- a/tests/ui/unsized-locals/issue-30276.rs +++ b/tests/ui/unsized-locals/issue-30276.rs @@ -2,4 +2,5 @@ struct Test([i32]); fn main() { let _x: fn(_) -> Test = Test; -} //~^the size for values of type `[i32]` cannot be known at compilation time + //~^ ERROR the size for values of type `[i32]` cannot be known at compilation time +} diff --git a/tests/ui/use/auxiliary/extern-use-primitive-type-lib.rs b/tests/ui/use/auxiliary/extern-use-primitive-type-lib.rs index 18aa329ae36..c21eea743e9 100644 --- a/tests/ui/use/auxiliary/extern-use-primitive-type-lib.rs +++ b/tests/ui/use/auxiliary/extern-use-primitive-type-lib.rs @@ -1,3 +1,3 @@ -//@ compile-flags: --edition=2018 +//@ edition: 2018 pub use u32; diff --git a/tests/ui/use/use-keyword.rs b/tests/ui/use/use-keyword.rs index 840cddcb907..95f30365167 100644 --- a/tests/ui/use/use-keyword.rs +++ b/tests/ui/use/use-keyword.rs @@ -7,10 +7,10 @@ mod a { //~^ ERROR `self` imports are only allowed within a { } list use super as B; //~^ ERROR unresolved import `super` [E0432] - //~| no `super` in the root + //~| NOTE no `super` in the root use super::{self as C}; //~^ ERROR unresolved import `super` [E0432] - //~| no `super` in the root + //~| NOTE no `super` in the root } } diff --git a/tests/ui/use/use-mod/use-mod-2.rs b/tests/ui/use/use-mod/use-mod-2.rs index 9373a62ba36..57ff135c4d8 100644 --- a/tests/ui/use/use-mod/use-mod-2.rs +++ b/tests/ui/use/use-mod/use-mod-2.rs @@ -1,11 +1,11 @@ mod foo { use self::{self}; //~^ ERROR unresolved import `self` [E0432] - //~| no `self` in the root + //~| NOTE no `self` in the root use super::{self}; //~^ ERROR unresolved import `super` [E0432] - //~| no `super` in the root + //~| NOTE no `super` in the root } fn main() {} diff --git a/tests/ui/variance/variance-btree-invariant-types.rs b/tests/ui/variance/variance-btree-invariant-types.rs index 09c93d0013c..9e457c7fae8 100644 --- a/tests/ui/variance/variance-btree-invariant-types.rs +++ b/tests/ui/variance/variance-btree-invariant-types.rs @@ -2,78 +2,78 @@ use std::collections::btree_map::{IterMut, OccupiedEntry, RangeMut, VacantEntry} fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) -> OccupiedEntry<'a, &'new (), ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) -> OccupiedEntry<'a, (), &'new ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) -> OccupiedEntry<'a, &'static (), ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) -> OccupiedEntry<'a, (), &'static ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) -> VacantEntry<'a, &'new (), ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) -> VacantEntry<'a, (), &'new ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) -> VacantEntry<'a, &'static (), ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>) -> VacantEntry<'a, (), &'static ()> { v - //~^ lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr index 3b4de0753af..59eef0c6327 100644 --- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr @@ -53,6 +53,12 @@ LL | trait Trait<const N: Trait = bar> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information +error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:12 + | +LL | fn fnc<const N: Trait = u32>(&self) -> Trait { + | ^^^^^^^^^^^^^^^^^^^^ + warning: trait objects without an explicit `dyn` are deprecated --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:44 | @@ -66,12 +72,6 @@ help: if this is a dyn-compatible trait, use `dyn` LL | fn fnc<const N: Trait = u32>(&self) -> dyn Trait { | +++ -error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:12 - | -LL | fn fnc<const N: Trait = u32>(&self) -> Trait { - | ^^^^^^^^^^^^^^^^^^^^ - warning: trait objects without an explicit `dyn` are deprecated --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:6:21 | diff --git a/tests/ui/wf/issue-95665.rs b/tests/ui/wf/issue-95665.rs index 67923cbb2d6..422ffd11ee3 100644 --- a/tests/ui/wf/issue-95665.rs +++ b/tests/ui/wf/issue-95665.rs @@ -12,7 +12,7 @@ pub struct Struct<T: Trait> { extern "C" { static VAR: Struct<u8>; - //~^ 14:17: 14:27: the trait bound `u8: Trait` is not satisfied [E0277] + //~^ ERROR the trait bound `u8: Trait` is not satisfied [E0277] } fn main() {} diff --git a/tests/ui/wf/wf-normalization-sized.rs b/tests/ui/wf/wf-normalization-sized.rs index 80b2c8803ff..5396cc8b32a 100644 --- a/tests/ui/wf/wf-normalization-sized.rs +++ b/tests/ui/wf/wf-normalization-sized.rs @@ -17,10 +17,10 @@ impl<T: ?Sized> WellUnformed for T { } const _: <[[[[[[u8]]]]]] as WellUnformed>::RequestNormalize = (); -//[next]~^ the size for values of type `[[[[[u8]]]]]` cannot be known at compilation time -//[next]~| the size for values of type `[[[[[u8]]]]]` cannot be known at compilation time +//[next]~^ ERROR the size for values of type `[[[[[u8]]]]]` cannot be known at compilation time +//[next]~| ERROR the size for values of type `[[[[[u8]]]]]` cannot be known at compilation time const _: <Vec<str> as WellUnformed>::RequestNormalize = (); -//[next]~^ the size for values of type `str` cannot be known at compilation time -//[next]~| the size for values of type `str` cannot be known at compilation time +//[next]~^ ERROR the size for values of type `str` cannot be known at compilation time +//[next]~| ERROR the size for values of type `str` cannot be known at compilation time fn main() {} |
