diff options
Diffstat (limited to 'src/test')
904 files changed, 10066 insertions, 4916 deletions
diff --git a/src/test/assembly/asm/aarch64-el2vmsa.rs b/src/test/assembly/asm/aarch64-el2vmsa.rs new file mode 100644 index 00000000000..1908ffb8ff3 --- /dev/null +++ b/src/test/assembly/asm/aarch64-el2vmsa.rs @@ -0,0 +1,37 @@ +// assembly-output: emit-asm +// compile-flags: --target aarch64-unknown-linux-gnu +// needs-llvm-components: aarch64 + +#![feature(no_core, lang_items, rustc_attrs)] +#![crate_type = "rlib"] +#![no_core] + +#[rustc_builtin_macro] +macro_rules! asm { + () => {}; +} + +#[lang = "sized"] +trait Sized {} + +// CHECK-LABEL: ttbr0_el2: +#[no_mangle] +pub fn ttbr0_el2() { + // CHECK: //APP + // CHECK-NEXT: msr TTBR0_EL2, x0 + // CHECK-NEXT: //NO_APP + unsafe { + asm!("msr ttbr0_el2, x0"); + } +} + +// CHECK-LABEL: vttbr_el2: +#[no_mangle] +pub fn vttbr_el2() { + // CHECK: //APP + // CHECK-NEXT: msr VTTBR_EL2, x0 + // CHECK-NEXT: //NO_APP + unsafe { + asm!("msr vttbr_el2, x0"); + } +} diff --git a/src/test/assembly/sparc-struct-abi.rs b/src/test/assembly/sparc-struct-abi.rs index 6a898b2974a..6309dd420ff 100644 --- a/src/test/assembly/sparc-struct-abi.rs +++ b/src/test/assembly/sparc-struct-abi.rs @@ -44,12 +44,16 @@ pub unsafe extern "C" fn callee(arg: Franta) { tst_use(arg.b); tst_use(arg.c); tst_use(arg.d); + tail_call_avoidance_fn(); } extern "C" { fn opaque_callee(arg: Franta, intarg: i32); fn tst_use(arg: f32); fn clobber(); + // This exists so that post-https://reviews.llvm.org/D138741 LLVM doesn't + // tail-call away some of our assertions. + fn tail_call_avoidance_fn(); } #[no_mangle] @@ -62,4 +66,5 @@ pub unsafe extern "C" fn caller() { // CHECK: call opaque_callee // CHECK: mov 3, %o2 opaque_callee(Franta { a: 1.0, b: 2.0, c: 3.0, d: 4.0 }, 3); + tail_call_avoidance_fn(); } diff --git a/src/test/codegen/catch-unwind.rs b/src/test/codegen/catch-unwind.rs index 3ea3a24bfae..b90ef104ce7 100644 --- a/src/test/codegen/catch-unwind.rs +++ b/src/test/codegen/catch-unwind.rs @@ -8,6 +8,8 @@ // On riscv the closure is another function, placed before fn foo so CHECK can't // find it // ignore-riscv64 FIXME +// On s390x the closure is also in another function +// ignore-s390x FIXME #![crate_type = "lib"] #![feature(c_unwind)] diff --git a/src/test/codegen/dllimports/main.rs b/src/test/codegen/dllimports/main.rs index bb3134e81c9..ab599992ffd 100644 --- a/src/test/codegen/dllimports/main.rs +++ b/src/test/codegen/dllimports/main.rs @@ -1,17 +1,6 @@ // This test is for *-windows-msvc only. -// ignore-android -// ignore-dragonfly -// ignore-emscripten -// ignore-freebsd +// only-windows // ignore-gnu -// ignore-haiku -// ignore-ios -// ignore-linux -// ignore-macos -// ignore-netbsd -// ignore-openbsd -// ignore-solaris -// ignore-sgx no dynamic linking // aux-build:dummy.rs // aux-build:wrapper.rs diff --git a/src/test/codegen/enum-match.rs b/src/test/codegen/enum-match.rs index efab189fd7b..44f1b408d21 100644 --- a/src/test/codegen/enum-match.rs +++ b/src/test/codegen/enum-match.rs @@ -34,11 +34,8 @@ pub enum Enum1 { // CHECK: define i8 @match1{{.*}} // CHECK-NEXT: start: -// CHECK-NEXT: %1 = icmp ugt i8 %0, 1 -// CHECK-NEXT: %2 = zext i8 %0 to i64 -// CHECK-NEXT: %3 = add nsw i64 %2, -1 -// CHECK-NEXT: %_2 = select i1 %1, i64 %3, i64 0 -// CHECK-NEXT: switch i64 %_2, label {{.*}} [ +// CHECK-NEXT: %1 = {{.*}}call i8 @llvm.usub.sat.i8(i8 %0, i8 1) +// CHECK-NEXT: switch i8 %1, label {{.*}} [ #[no_mangle] pub fn match1(e: Enum1) -> u8 { use Enum1::*; diff --git a/src/test/codegen/issue-105386-ub-in-debuginfo.rs b/src/test/codegen/issue-105386-ub-in-debuginfo.rs new file mode 100644 index 00000000000..d54ac9e33bc --- /dev/null +++ b/src/test/codegen/issue-105386-ub-in-debuginfo.rs @@ -0,0 +1,22 @@ +// compile-flags: --crate-type=lib -O -Cdebuginfo=2 -Cno-prepopulate-passes +// min-llvm-version: 15.0 # this test uses opaque pointer notation +#![feature(stmt_expr_attributes)] + +pub struct S([usize; 8]); + +#[no_mangle] +pub fn outer_function(x: S, y: S) -> usize { + (#[inline(always)]|| { + let _z = x; + y.0[0] + })() +} + +// Check that we do not attempt to load from the spilled arg before it is assigned to +// when generating debuginfo. +// CHECK-LABEL: @outer_function +// CHECK: [[spill:%.*]] = alloca %"[closure@{{.*.rs}}:9:23: 9:25]" +// CHECK-NOT: [[ptr_tmp:%.*]] = getelementptr inbounds %"[closure@{{.*.rs}}:9:23: 9:25]", ptr [[spill]] +// CHECK-NOT: [[load:%.*]] = load ptr, ptr +// CHECK: call void @llvm.lifetime.start{{.*}}({{.*}}, ptr [[spill]]) +// CHECK: call void @llvm.memcpy{{.*}}(ptr {{align .*}} [[spill]], ptr {{align .*}} %x diff --git a/src/test/codegen/naked-nocoverage.rs b/src/test/codegen/naked-nocoverage.rs new file mode 100644 index 00000000000..91a6260bf2a --- /dev/null +++ b/src/test/codegen/naked-nocoverage.rs @@ -0,0 +1,19 @@ +// Checks that naked functions are not instrumented by -Cinstrument-coverage. +// Regression test for issue #105170. +// +// needs-asm-support +// needs-profiler-support +// compile-flags: -Cinstrument-coverage +#![crate_type = "lib"] +#![feature(naked_functions)] +use std::arch::asm; + +#[naked] +#[no_mangle] +pub unsafe extern "C" fn f() { + // CHECK: define void @f() + // CHECK-NEXT: start: + // CHECK-NEXT: call void asm + // CHECK-NEXT: unreachable + asm!("", options(noreturn)); +} diff --git a/src/test/codegen/panic-abort-windows.rs b/src/test/codegen/panic-abort-windows.rs index 9ee4bfc4711..2ee29762dcd 100644 --- a/src/test/codegen/panic-abort-windows.rs +++ b/src/test/codegen/panic-abort-windows.rs @@ -1,16 +1,5 @@ -// This test is for *-windows-msvc only. -// ignore-android -// ignore-dragonfly -// ignore-emscripten -// ignore-freebsd -// ignore-haiku -// ignore-ios -// ignore-linux -// ignore-macos -// ignore-netbsd -// ignore-openbsd -// ignore-solaris -// ignore-sgx +// This test is for *-windows only. +// only-windows // compile-flags: -C no-prepopulate-passes -C panic=abort -O diff --git a/src/test/codegen/pgo-counter-bias.rs b/src/test/codegen/pgo-counter-bias.rs new file mode 100644 index 00000000000..28caa7f4aa3 --- /dev/null +++ b/src/test/codegen/pgo-counter-bias.rs @@ -0,0 +1,10 @@ +// Test that __llvm_profile_counter_bias does not get internalized by lto. + +// ignore-macos -runtime-counter-relocation not honored on Mach-O +// compile-flags: -Cprofile-generate -Cllvm-args=-runtime-counter-relocation -Clto=fat +// needs-profiler-support +// no-prefer-dynamic + +// CHECK: @__llvm_profile_counter_bias = {{.*}}global + +pub fn main() {} diff --git a/src/test/codegen/remap_path_prefix/main.rs b/src/test/codegen/remap_path_prefix/main.rs index 9bef743ddcb..78ebbccfce1 100644 --- a/src/test/codegen/remap_path_prefix/main.rs +++ b/src/test/codegen/remap_path_prefix/main.rs @@ -12,7 +12,7 @@ mod aux_mod; include!("aux_mod.rs"); // Here we check that the expansion of the file!() macro is mapped. -// CHECK: @alloc2 = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }>, align 1 +// CHECK: @alloc2 = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }> pub static FILE_PATH: &'static str = file!(); fn main() { diff --git a/src/test/codegen/repr-transparent-aggregates-1.rs b/src/test/codegen/repr-transparent-aggregates-1.rs index 9d18c5f03c6..f733de12b35 100644 --- a/src/test/codegen/repr-transparent-aggregates-1.rs +++ b/src/test/codegen/repr-transparent-aggregates-1.rs @@ -8,6 +8,7 @@ // ignore-powerpc // ignore-powerpc64 // ignore-riscv64 see codegen/riscv-abi +// ignore-s390x // ignore-windows // See repr-transparent.rs diff --git a/src/test/codegen/repr-transparent.rs b/src/test/codegen/repr-transparent.rs index c68ba8460cb..4f2313ce47a 100644 --- a/src/test/codegen/repr-transparent.rs +++ b/src/test/codegen/repr-transparent.rs @@ -2,6 +2,7 @@ // ignore-riscv64 riscv64 has an i128 type used with test_Vector // see codegen/riscv-abi for riscv functiona call tests +// ignore-s390x s390x with default march passes vector types per reference #![crate_type="lib"] #![feature(repr_simd, transparent_unions)] diff --git a/src/test/codegen/sanitizer-kcfi-add-kcfi-flag.rs b/src/test/codegen/sanitizer-kcfi-add-kcfi-flag.rs new file mode 100644 index 00000000000..c2eb852aec3 --- /dev/null +++ b/src/test/codegen/sanitizer-kcfi-add-kcfi-flag.rs @@ -0,0 +1,11 @@ +// Verifies that "kcfi" module flag is added. +// +// needs-sanitizer-kcfi +// compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi + +#![crate_type="lib"] + +pub fn foo() { +} + +// CHECK: !{{[0-9]+}} = !{i32 4, !"kcfi", i32 1} diff --git a/src/test/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs b/src/test/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs new file mode 100644 index 00000000000..0afd9727517 --- /dev/null +++ b/src/test/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs @@ -0,0 +1,47 @@ +// Verifies that KCFI type metadata for functions are emitted. +// +// revisions: aarch64 x86_64 +// [aarch64] compile-flags: --target aarch64-unknown-none +// [aarch64] needs-llvm-components: aarch64 +// [x86_64] compile-flags: --target x86_64-unknown-none +// [x86_64] needs-llvm-components: +// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi + +#![crate_type="lib"] +#![feature(no_core, lang_items)] +#![no_core] + +#[lang="sized"] +trait Sized { } +#[lang="copy"] +trait Copy { } + +impl Copy for i32 {} + +pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { + // CHECK-LABEL: define{{.*}}foo + // FIXME(rcvalle): Change <unknown kind #36> to !kcfi_type when Rust is updated to LLVM 16 + // CHECK-SAME: {{.*}}!<unknown kind #36> ![[TYPE1:[0-9]+]] + // CHECK: call i32 %f(i32 %arg){{.*}}[ "kcfi"(i32 -1666898348) ] + f(arg) +} + +pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 { + // CHECK-LABEL: define{{.*}}bar + // FIXME(rcvalle): Change <unknown kind #36> to !kcfi_type when Rust is updated to LLVM 16 + // CHECK-SAME: {{.*}}!<unknown kind #36> ![[TYPE2:[0-9]+]] + // CHECK: call i32 %f(i32 %arg1, i32 %arg2){{.*}}[ "kcfi"(i32 -1789026986) ] + f(arg1, arg2) +} + +pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 { + // CHECK-LABEL: define{{.*}}baz + // FIXME(rcvalle): Change <unknown kind #36> to !kcfi_type when Rust is updated to LLVM 16 + // CHECK-SAME: {{.*}}!<unknown kind #36> ![[TYPE3:[0-9]+]] + // CHECK: call i32 %f(i32 %arg1, i32 %arg2, i32 %arg3){{.*}}[ "kcfi"(i32 1248878270) ] + f(arg1, arg2, arg3) +} + +// CHECK: ![[TYPE1]] = !{i32 653723426} +// CHECK: ![[TYPE2]] = !{i32 412174924} +// CHECK: ![[TYPE3]] = !{i32 -636668840} diff --git a/src/test/codegen/uninit-consts.rs b/src/test/codegen/uninit-consts.rs index 4c07740b356..98a6761f8ab 100644 --- a/src/test/codegen/uninit-consts.rs +++ b/src/test/codegen/uninit-consts.rs @@ -14,7 +14,7 @@ pub struct PartiallyUninit { // CHECK: [[FULLY_UNINIT:@[0-9]+]] = private unnamed_addr constant <{ [10 x i8] }> undef -// CHECK: [[PARTIALLY_UNINIT:@[0-9]+]] = private unnamed_addr constant <{ [4 x i8], [12 x i8] }> <{ [4 x i8] c"\EF\BE\AD\DE", [12 x i8] undef }>, align 4 +// CHECK: [[PARTIALLY_UNINIT:@[0-9]+]] = private unnamed_addr constant <{ [4 x i8], [12 x i8] }> <{ [4 x i8] c"{{\\EF\\BE\\AD\\DE|\\DE\\AD\\BE\\EF}}", [12 x i8] undef }>, align 4 // This shouldn't contain undef, since it contains more chunks // than the default value of uninit_const_chunk_threshold. diff --git a/src/test/incremental/hashes/loop_expressions.rs b/src/test/incremental/hashes/loop_expressions.rs index a12cd0d021e..ada541e644a 100644 --- a/src/test/incremental/hashes/loop_expressions.rs +++ b/src/test/incremental/hashes/loop_expressions.rs @@ -187,9 +187,9 @@ pub fn change_continue_label() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, typeck")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, typeck, optimized_mir")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail6")] pub fn change_continue_label() { let mut _x = 0; diff --git a/src/test/incremental/hashes/while_let_loops.rs b/src/test/incremental/hashes/while_let_loops.rs index f81855e42be..88fd4d89b28 100644 --- a/src/test/incremental/hashes/while_let_loops.rs +++ b/src/test/incremental/hashes/while_let_loops.rs @@ -158,9 +158,9 @@ pub fn change_break_label() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail6")] pub fn change_break_label() { let mut _x = 0; @@ -210,9 +210,9 @@ pub fn change_continue_label() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail6")] pub fn change_continue_label() { let mut _x = 0; diff --git a/src/test/incremental/hashes/while_loops.rs b/src/test/incremental/hashes/while_loops.rs index e432cf8fe4c..9b4d23757b8 100644 --- a/src/test/incremental/hashes/while_loops.rs +++ b/src/test/incremental/hashes/while_loops.rs @@ -158,9 +158,9 @@ pub fn change_break_label() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail6")] pub fn change_break_label() { let mut _x = 0; @@ -212,9 +212,9 @@ pub fn change_continue_label() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail6")] pub fn change_continue_label() { let mut _x = 0; diff --git a/src/test/mir-opt/76803_regression.encode.SimplifyBranchSame.diff b/src/test/mir-opt/76803_regression.encode.SimplifyBranchSame.diff index 57e298625f9..9780332d8bf 100644 --- a/src/test/mir-opt/76803_regression.encode.SimplifyBranchSame.diff +++ b/src/test/mir-opt/76803_regression.encode.SimplifyBranchSame.diff @@ -8,7 +8,7 @@ bb0: { _2 = discriminant(_1); // scope 0 at $DIR/76803_regression.rs:+1:11: +1:12 - switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/76803_regression.rs:+1:5: +1:12 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/76803_regression.rs:+1:5: +1:12 } bb1: { diff --git a/src/test/mir-opt/bool_compare.opt1.InstCombine.diff b/src/test/mir-opt/bool_compare.opt1.InstCombine.diff index 9c5a9fa9abb..0af5d82d315 100644 --- a/src/test/mir-opt/bool_compare.opt1.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt1.InstCombine.diff @@ -14,7 +14,7 @@ - _2 = Ne(move _3, const true); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 } bb1: { diff --git a/src/test/mir-opt/bool_compare.opt2.InstCombine.diff b/src/test/mir-opt/bool_compare.opt2.InstCombine.diff index 58c52c4b7d7..f5d1febd991 100644 --- a/src/test/mir-opt/bool_compare.opt2.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt2.InstCombine.diff @@ -14,7 +14,7 @@ - _2 = Ne(const true, move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 } bb1: { diff --git a/src/test/mir-opt/bool_compare.opt3.InstCombine.diff b/src/test/mir-opt/bool_compare.opt3.InstCombine.diff index 676428c95c1..e7432adac7d 100644 --- a/src/test/mir-opt/bool_compare.opt3.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt3.InstCombine.diff @@ -14,7 +14,7 @@ - _2 = Eq(move _3, const false); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 } bb1: { diff --git a/src/test/mir-opt/bool_compare.opt4.InstCombine.diff b/src/test/mir-opt/bool_compare.opt4.InstCombine.diff index addfcd769a5..6b3e27772f7 100644 --- a/src/test/mir-opt/bool_compare.opt4.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt4.InstCombine.diff @@ -14,7 +14,7 @@ - _2 = Eq(const false, move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 } bb1: { diff --git a/src/test/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir b/src/test/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir new file mode 100644 index 00000000000..20dd251e7e3 --- /dev/null +++ b/src/test/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir @@ -0,0 +1,22 @@ +// MIR for `arbitrary_let` after built + +fn arbitrary_let(_1: i32) -> i32 { + let mut _0: i32; // return place in scope 0 at $DIR/arbitrary_let.rs:+0:29: +0:32 + let mut _2: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + _2 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + goto -> bb2; // scope 0 at $DIR/arbitrary_let.rs:+4:13: +4:25 + } + + bb1: { + _0 = _3; // scope 0 at $DIR/arbitrary_let.rs:+7:13: +7:20 + return; // scope 0 at $DIR/arbitrary_let.rs:+8:13: +8:21 + } + + bb2: { + _3 = _2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + goto -> bb1; // scope 0 at $DIR/arbitrary_let.rs:+12:13: +12:24 + } +} diff --git a/src/test/mir-opt/building/custom/arbitrary_let.rs b/src/test/mir-opt/building/custom/arbitrary_let.rs new file mode 100644 index 00000000000..776df3151ff --- /dev/null +++ b/src/test/mir-opt/building/custom/arbitrary_let.rs @@ -0,0 +1,28 @@ +#![feature(custom_mir, core_intrinsics)] + +extern crate core; +use core::intrinsics::mir::*; +use core::ptr::{addr_of, addr_of_mut}; + +// EMIT_MIR arbitrary_let.arbitrary_let.built.after.mir +#[custom_mir(dialect = "built")] +fn arbitrary_let(x: i32) -> i32 { + mir!( + { + let y = x; + Goto(second) + } + third = { + RET = z; + Return() + } + second = { + let z = y; + Goto(third) + } + ) +} + +fn main() { + assert_eq!(arbitrary_let(5), 5); +} diff --git a/src/test/mir-opt/building/custom/consts.consts.built.after.mir b/src/test/mir-opt/building/custom/consts.consts.built.after.mir new file mode 100644 index 00000000000..ba753cfc20c --- /dev/null +++ b/src/test/mir-opt/building/custom/consts.consts.built.after.mir @@ -0,0 +1,22 @@ +// MIR for `consts` after built + +fn consts() -> () { + let mut _0: (); // return place in scope 0 at $DIR/consts.rs:+0:27: +0:27 + let mut _1: u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _2: i8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: u32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _4: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _5: fn() {consts::<10>}; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + _1 = const 5_u8; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _2 = const _; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _3 = const C; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _4 = const _; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _5 = consts::<10>; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + // mir::Constant + // + span: $DIR/consts.rs:16:18: 16:30 + // + literal: Const { ty: fn() {consts::<10>}, val: Value(<ZST>) } + return; // scope 0 at $DIR/consts.rs:+7:9: +7:17 + } +} diff --git a/src/test/mir-opt/building/custom/consts.rs b/src/test/mir-opt/building/custom/consts.rs new file mode 100644 index 00000000000..ff4fe1a9324 --- /dev/null +++ b/src/test/mir-opt/building/custom/consts.rs @@ -0,0 +1,36 @@ +#![feature(custom_mir, core_intrinsics, inline_const)] + +extern crate core; +use core::intrinsics::mir::*; + +const D: i32 = 5; + +// EMIT_MIR consts.consts.built.after.mir +#[custom_mir(dialect = "built")] +fn consts<const C: u32>() { + mir!({ + let _a = 5_u8; + let _b = const { 5_i8 }; + let _c = C; + let _d = D; + let _e = consts::<10>; + Return() + }) +} + +static S: i32 = 5; +static mut T: i32 = 10; +// EMIT_MIR consts.statics.built.after.mir +#[custom_mir(dialect = "built")] +fn statics() { + mir!({ + let _a: &i32 = Static(S); + let _b: *mut i32 = StaticMut(T); + Return() + }) +} + +fn main() { + consts::<5>(); + statics(); +} diff --git a/src/test/mir-opt/building/custom/consts.statics.built.after.mir b/src/test/mir-opt/building/custom/consts.statics.built.after.mir new file mode 100644 index 00000000000..ee768e263ec --- /dev/null +++ b/src/test/mir-opt/building/custom/consts.statics.built.after.mir @@ -0,0 +1,27 @@ +// MIR for `statics` after built + +fn statics() -> () { + let mut _0: (); // return place in scope 0 at $DIR/consts.rs:+0:14: +0:14 + let mut _1: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _2: *mut i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + _1 = const {alloc1: &i32}; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + // mir::Constant + // + span: $DIR/consts.rs:27:31: 27:32 + // + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) } + _2 = const {alloc2: *mut i32}; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + // mir::Constant + // + span: $DIR/consts.rs:28:38: 28:39 + // + literal: Const { ty: *mut i32, val: Value(Scalar(alloc2)) } + return; // scope 0 at $DIR/consts.rs:+4:9: +4:17 + } +} + +alloc2 (static: T, size: 4, align: 4) { + 0a 00 00 00 │ .... +} + +alloc1 (static: S, size: 4, align: 4) { + 05 00 00 00 │ .... +} diff --git a/src/test/mir-opt/building/custom/references.immut_ref.built.after.mir b/src/test/mir-opt/building/custom/references.immut_ref.built.after.mir index 4a5ddde4081..4d38d45c0f4 100644 --- a/src/test/mir-opt/building/custom/references.immut_ref.built.after.mir +++ b/src/test/mir-opt/building/custom/references.immut_ref.built.after.mir @@ -5,10 +5,10 @@ fn immut_ref(_1: &i32) -> &i32 { let mut _2: *const i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL bb0: { - _2 = &raw const (*_1); // scope 0 at $DIR/references.rs:+0:1: +0:34 - Retag([raw] _2); // scope 0 at $DIR/references.rs:+0:1: +0:34 - _0 = &(*_2); // scope 0 at $DIR/references.rs:+0:1: +0:34 - Retag(_0); // scope 0 at $DIR/references.rs:+0:1: +0:34 - return; // scope 0 at $DIR/references.rs:+0:1: +0:34 + _2 = &raw const (*_1); // scope 0 at $DIR/references.rs:+5:13: +5:29 + Retag([raw] _2); // scope 0 at $DIR/references.rs:+6:13: +6:24 + _0 = &(*_2); // scope 0 at $DIR/references.rs:+7:13: +7:23 + Retag(_0); // scope 0 at $DIR/references.rs:+8:13: +8:23 + return; // scope 0 at $DIR/references.rs:+9:13: +9:21 } } diff --git a/src/test/mir-opt/building/custom/references.mut_ref.built.after.mir b/src/test/mir-opt/building/custom/references.mut_ref.built.after.mir index ec8509f69d1..01bc8a9cd35 100644 --- a/src/test/mir-opt/building/custom/references.mut_ref.built.after.mir +++ b/src/test/mir-opt/building/custom/references.mut_ref.built.after.mir @@ -5,10 +5,10 @@ fn mut_ref(_1: &mut i32) -> &mut i32 { let mut _2: *mut i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL bb0: { - _2 = &raw mut (*_1); // scope 0 at $DIR/references.rs:+0:1: +0:40 - Retag([raw] _2); // scope 0 at $DIR/references.rs:+0:1: +0:40 - _0 = &mut (*_2); // scope 0 at $DIR/references.rs:+0:1: +0:40 - Retag(_0); // scope 0 at $DIR/references.rs:+0:1: +0:40 - return; // scope 0 at $DIR/references.rs:+0:1: +0:40 + _2 = &raw mut (*_1); // scope 0 at $DIR/references.rs:+5:13: +5:33 + Retag([raw] _2); // scope 0 at $DIR/references.rs:+6:13: +6:24 + _0 = &mut (*_2); // scope 0 at $DIR/references.rs:+7:13: +7:26 + Retag(_0); // scope 0 at $DIR/references.rs:+8:13: +8:23 + return; // scope 0 at $DIR/references.rs:+9:13: +9:21 } } diff --git a/src/test/mir-opt/building/custom/simple_assign.simple.built.after.mir b/src/test/mir-opt/building/custom/simple_assign.simple.built.after.mir index a5a2834c2e1..d7560fde69c 100644 --- a/src/test/mir-opt/building/custom/simple_assign.simple.built.after.mir +++ b/src/test/mir-opt/building/custom/simple_assign.simple.built.after.mir @@ -6,13 +6,13 @@ fn simple(_1: i32) -> i32 { let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL bb0: { - _2 = _1; // scope 0 at $DIR/simple_assign.rs:+0:1: +0:29 - goto -> bb1; // scope 0 at $DIR/simple_assign.rs:+0:1: +0:29 + _2 = _1; // scope 0 at $DIR/simple_assign.rs:+6:13: +6:22 + goto -> bb1; // scope 0 at $DIR/simple_assign.rs:+7:13: +7:23 } bb1: { - _3 = move _2; // scope 0 at $DIR/simple_assign.rs:+0:1: +0:29 - _0 = _3; // scope 0 at $DIR/simple_assign.rs:+0:1: +0:29 - return; // scope 0 at $DIR/simple_assign.rs:+0:1: +0:29 + _3 = move _2; // scope 0 at $DIR/simple_assign.rs:+11:13: +11:32 + _0 = _3; // scope 0 at $DIR/simple_assign.rs:+12:13: +12:24 + return; // scope 0 at $DIR/simple_assign.rs:+13:13: +13:21 } } diff --git a/src/test/mir-opt/building/custom/simple_assign.simple_ref.built.after.mir b/src/test/mir-opt/building/custom/simple_assign.simple_ref.built.after.mir index 6c90f0130a2..2b0e8f1047b 100644 --- a/src/test/mir-opt/building/custom/simple_assign.simple_ref.built.after.mir +++ b/src/test/mir-opt/building/custom/simple_assign.simple_ref.built.after.mir @@ -4,7 +4,7 @@ fn simple_ref(_1: &mut i32) -> &mut i32 { let mut _0: &mut i32; // return place in scope 0 at $DIR/simple_assign.rs:+0:35: +0:43 bb0: { - _0 = move _1; // scope 0 at $DIR/simple_assign.rs:+0:1: +0:43 - return; // scope 0 at $DIR/simple_assign.rs:+0:1: +0:43 + _0 = move _1; // scope 0 at $DIR/simple_assign.rs:+2:9: +2:22 + return; // scope 0 at $DIR/simple_assign.rs:+3:9: +3:17 } } diff --git a/src/test/mir-opt/building/issue_101867.main.built.after.mir b/src/test/mir-opt/building/issue_101867.main.built.after.mir index 0ebd840cf2d..628a33f1020 100644 --- a/src/test/mir-opt/building/issue_101867.main.built.after.mir +++ b/src/test/mir-opt/building/issue_101867.main.built.after.mir @@ -27,7 +27,7 @@ fn main() -> () { StorageLive(_5); // scope 1 at $DIR/issue_101867.rs:+2:14: +2:15 FakeRead(ForMatchedPlace(None), _1); // scope 1 at $DIR/issue_101867.rs:+2:19: +2:20 _6 = discriminant(_1); // scope 1 at $DIR/issue_101867.rs:+2:19: +2:20 - switchInt(move _6) -> [1_isize: bb4, otherwise: bb3]; // scope 1 at $DIR/issue_101867.rs:+2:9: +2:16 + switchInt(move _6) -> [1: bb4, otherwise: bb3]; // scope 1 at $DIR/issue_101867.rs:+2:9: +2:16 } bb1: { diff --git a/src/test/mir-opt/building/issue_49232.main.built.after.mir b/src/test/mir-opt/building/issue_49232.main.built.after.mir index 9182bcaa21f..de5e4c0f6ed 100644 --- a/src/test/mir-opt/building/issue_49232.main.built.after.mir +++ b/src/test/mir-opt/building/issue_49232.main.built.after.mir @@ -25,7 +25,7 @@ fn main() -> () { StorageLive(_3); // scope 0 at $DIR/issue_49232.rs:+3:19: +3:23 _3 = const true; // scope 0 at $DIR/issue_49232.rs:+3:19: +3:23 FakeRead(ForMatchedPlace(None), _3); // scope 0 at $DIR/issue_49232.rs:+3:19: +3:23 - switchInt(_3) -> [false: bb3, otherwise: bb4]; // scope 0 at $DIR/issue_49232.rs:+3:13: +3:23 + switchInt(_3) -> [0: bb3, otherwise: bb4]; // scope 0 at $DIR/issue_49232.rs:+3:13: +3:23 } bb3: { diff --git a/src/test/mir-opt/building/match_false_edges.full_tested_match.built.after.mir b/src/test/mir-opt/building/match_false_edges.full_tested_match.built.after.mir index 9a190c3d60e..cb36bc64da6 100644 --- a/src/test/mir-opt/building/match_false_edges.full_tested_match.built.after.mir +++ b/src/test/mir-opt/building/match_false_edges.full_tested_match.built.after.mir @@ -28,7 +28,7 @@ fn full_tested_match() -> () { _2 = Option::<i32>::Some(const 42_i32); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27 FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27 _3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27 - switchInt(move _3) -> [0_isize: bb1, 1_isize: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:27 + switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:27 } bb1: { @@ -60,7 +60,7 @@ fn full_tested_match() -> () { } bb6: { - switchInt(move _7) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27 + switchInt(move _7) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27 } bb7: { diff --git a/src/test/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir b/src/test/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir index 1c9953e7efc..7f8755faac6 100644 --- a/src/test/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir +++ b/src/test/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir @@ -28,7 +28,7 @@ fn full_tested_match2() -> () { _2 = Option::<i32>::Some(const 42_i32); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27 FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27 _3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27 - switchInt(move _3) -> [0_isize: bb1, 1_isize: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:27 + switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:27 } bb1: { @@ -66,7 +66,7 @@ fn full_tested_match2() -> () { } bb6: { - switchInt(move _7) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27 + switchInt(move _7) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27 } bb7: { diff --git a/src/test/mir-opt/building/match_false_edges.main.built.after.mir b/src/test/mir-opt/building/match_false_edges.main.built.after.mir index 08c67d39d78..e8b93f4371e 100644 --- a/src/test/mir-opt/building/match_false_edges.main.built.after.mir +++ b/src/test/mir-opt/building/match_false_edges.main.built.after.mir @@ -39,7 +39,7 @@ fn main() -> () { _2 = Option::<i32>::Some(const 1_i32); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26 FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26 _4 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26 - switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26 + switchInt(move _4) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26 } bb1: { @@ -56,7 +56,7 @@ fn main() -> () { bb4: { _3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26 - switchInt(move _3) -> [1_isize: bb6, otherwise: bb5]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26 + switchInt(move _3) -> [1: bb6, otherwise: bb5]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26 } bb5: { @@ -87,7 +87,7 @@ fn main() -> () { } bb9: { - switchInt(move _8) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28 + switchInt(move _8) -> [0: bb11, otherwise: bb10]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28 } bb10: { @@ -134,7 +134,7 @@ fn main() -> () { } bb15: { - switchInt(move _12) -> [false: bb17, otherwise: bb16]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29 + switchInt(move _12) -> [0: bb17, otherwise: bb16]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29 } bb16: { diff --git a/src/test/mir-opt/building/simple_match.match_bool.built.after.mir b/src/test/mir-opt/building/simple_match.match_bool.built.after.mir index a4516026c3b..aa2fd46320e 100644 --- a/src/test/mir-opt/building/simple_match.match_bool.built.after.mir +++ b/src/test/mir-opt/building/simple_match.match_bool.built.after.mir @@ -6,7 +6,7 @@ fn match_bool(_1: bool) -> usize { bb0: { FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/simple_match.rs:+1:11: +1:12 - switchInt(_1) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/simple_match.rs:+1:5: +1:12 + switchInt(_1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/simple_match.rs:+1:5: +1:12 } bb1: { diff --git a/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff b/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff index fade2d0bc6e..a717d1bbd12 100644 --- a/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff +++ b/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff @@ -11,9 +11,9 @@ bb0: { - StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _3 = discriminant(_1); // scope 0 at $DIR/const_goto.rs:+1:17: +1:20 -- switchInt(move _3) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- switchInt(move _3) -> [1: bb2, 2: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _2 = discriminant(_1); // scope 0 at $DIR/const_goto.rs:+1:17: +1:20 -+ switchInt(move _2) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL ++ switchInt(move _2) -> [1: bb2, 2: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb1: { @@ -29,7 +29,7 @@ - } - - bb3: { -- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- switchInt(move _2) -> [0: bb5, otherwise: bb4]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb4: { diff --git a/src/test/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff b/src/test/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff index 623297aeba5..24be8c9b868 100644 --- a/src/test/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff +++ b/src/test/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff @@ -10,7 +10,7 @@ StorageLive(_1); // scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:11: +6:6 StorageLive(_2); // scope 0 at $DIR/const_goto_const_eval_fail.rs:+2:15: +2:16 _2 = const A; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+2:15: +2:16 - switchInt(_2) -> [1_i32: bb2, 2_i32: bb2, 3_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+2:9: +2:16 + switchInt(_2) -> [1: bb2, 2: bb2, 3: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+2:9: +2:16 } bb1: { @@ -21,11 +21,11 @@ bb2: { _1 = const B; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+3:26: +3:27 - goto -> bb3; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+3:26: +3:27 -+ switchInt(_1) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:5: +6:6 ++ switchInt(_1) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:5: +6:6 } bb3: { -- switchInt(_1) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:5: +6:6 +- switchInt(_1) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:+1:5: +6:6 - } - - bb4: { diff --git a/src/test/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff b/src/test/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff index 81c356cb1db..f5457725943 100644 --- a/src/test/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff +++ b/src/test/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff @@ -23,10 +23,10 @@ - StorageLive(_5); // scope 0 at $DIR/const_goto_storage.rs:+2:21: +2:52 - StorageLive(_6); // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28 - _6 = const true; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28 -- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28 +- switchInt(move _6) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28 + StorageLive(_2); // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28 + _2 = const true; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28 -+ switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28 ++ switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:+2:24: +2:28 } bb1: { @@ -41,7 +41,7 @@ - - bb3: { - StorageDead(_6); // scope 0 at $DIR/const_goto_storage.rs:+2:51: +2:52 -- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_storage.rs:+2:21: +2:52 +- switchInt(move _5) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_storage.rs:+2:21: +2:52 - } - - bb4: { @@ -56,7 +56,7 @@ - - bb6: { - StorageDead(_5); // scope 0 at $DIR/const_goto_storage.rs:+2:75: +2:76 -- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/const_goto_storage.rs:+2:18: +2:76 +- switchInt(move _4) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/const_goto_storage.rs:+2:18: +2:76 - } - - bb7: { @@ -70,7 +70,7 @@ - } - - bb9: { -- switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/const_goto_storage.rs:+2:15: +6:10 +- switchInt(move _3) -> [0: bb11, otherwise: bb10]; // scope 0 at $DIR/const_goto_storage.rs:+2:15: +6:10 - } - - bb10: { diff --git a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff b/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff index 8b3b9d0a4c1..147670f8a91 100644 --- a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff +++ b/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff @@ -9,8 +9,8 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21 _1 = const _; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21 -- switchInt(move _1) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21 -+ switchInt(const false) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21 +- switchInt(move _1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21 ++ switchInt(const false) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/control_flow_simplification.rs:+1:8: +1:21 } bb1: { diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff index 6b29bb59c40..b4dccecc672 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff @@ -21,13 +21,13 @@ ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 - _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 +- switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 + _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 ++ switchInt(const 1_isize) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 } bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 + switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 } bb2: { diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff index 6b29bb59c40..b4dccecc672 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff @@ -21,13 +21,13 @@ ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:+1:34: +1:44 - _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 +- switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 + _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 ++ switchInt(const 1_isize) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 } bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 + switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:+1:21: +1:31 } bb2: { diff --git a/src/test/mir-opt/const_prop/switch_int.main.ConstProp.diff b/src/test/mir-opt/const_prop/switch_int.main.ConstProp.diff index 9d7c2784d8b..ddc1a4493db 100644 --- a/src/test/mir-opt/const_prop/switch_int.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/switch_int.main.ConstProp.diff @@ -8,8 +8,8 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/switch_int.rs:+1:11: +1:12 _1 = const 1_i32; // scope 0 at $DIR/switch_int.rs:+1:11: +1:12 -- switchInt(_1) -> [1_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 -+ switchInt(const 1_i32) -> [1_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 +- switchInt(_1) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 ++ switchInt(const 1_i32) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 } bb1: { diff --git a/src/test/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff b/src/test/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff index 74f9eafe420..09c47ee6e83 100644 --- a/src/test/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff +++ b/src/test/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/switch_int.rs:+1:11: +1:12 _1 = const 1_i32; // scope 0 at $DIR/switch_int.rs:+1:11: +1:12 -- switchInt(const 1_i32) -> [1_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 +- switchInt(const 1_i32) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 + goto -> bb2; // scope 0 at $DIR/switch_int.rs:+1:5: +1:12 } diff --git a/src/test/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot b/src/test/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot index fd21b14af25..c4d389b2d76 100644 --- a/src/test/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot +++ b/src/test/mir-opt/coverage_graphviz.main.InstrumentCoverage.0.dot @@ -7,7 +7,7 @@ digraph Cov_0_3 { bcb1__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb1</td></tr><tr><td align="left" balign="left">Expression(bcb0 + bcb3) at 10:5-11:17<br align="left"/> 11:12-11:17: @2.Call: _2 = bar() -> [return: bb3, unwind: bb6]</td></tr><tr><td align="left" balign="left">bb1: FalseUnwind<br align="left"/>bb2: Call</td></tr><tr><td align="left" balign="left">bb3: SwitchInt</td></tr></table>>]; bcb0__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb0</td></tr><tr><td align="left" balign="left"></td></tr><tr><td align="left" balign="left">Counter(bcb0) at 9:1-9:11<br align="left"/> </td></tr><tr><td align="left" balign="left">bb0: Goto</td></tr></table>>]; bcb3__Cov_0_3 -> bcb1__Cov_0_3 [label=<>]; - bcb1__Cov_0_3 -> bcb3__Cov_0_3 [label=<false>]; + bcb1__Cov_0_3 -> bcb3__Cov_0_3 [label=<0>]; bcb1__Cov_0_3 -> bcb2__Cov_0_3 [label=<otherwise>]; bcb0__Cov_0_3 -> bcb1__Cov_0_3 [label=<>]; } diff --git a/src/test/mir-opt/dataflow-const-prop/enum.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/enum.main.DataflowConstProp.diff index 2ced794e628..fce18fae436 100644 --- a/src/test/mir-opt/dataflow-const-prop/enum.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/enum.main.DataflowConstProp.diff @@ -28,7 +28,7 @@ discriminant(_1) = 0; // scope 0 at $DIR/enum.rs:+1:13: +1:21 StorageLive(_2); // scope 1 at $DIR/enum.rs:+2:9: +2:10 _3 = discriminant(_1); // scope 1 at $DIR/enum.rs:+2:19: +2:20 - switchInt(move _3) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 1 at $DIR/enum.rs:+2:13: +2:20 + switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 1 at $DIR/enum.rs:+2:13: +2:20 } bb1: { diff --git a/src/test/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff index 26808c70fbf..32489b4bd6b 100644 --- a/src/test/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff @@ -42,8 +42,8 @@ + _4 = const 1_i32; // scope 1 at $DIR/if.rs:+2:16: +2:17 + _3 = const true; // scope 1 at $DIR/if.rs:+2:16: +2:22 StorageDead(_4); // scope 1 at $DIR/if.rs:+2:21: +2:22 -- switchInt(move _3) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22 -+ switchInt(const true) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22 +- switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22 ++ switchInt(const true) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if.rs:+2:16: +2:22 } bb1: { @@ -73,8 +73,8 @@ + _9 = const 1_i32; // scope 3 at $DIR/if.rs:+5:16: +5:17 + _8 = const true; // scope 3 at $DIR/if.rs:+5:16: +5:22 StorageDead(_9); // scope 3 at $DIR/if.rs:+5:21: +5:22 -- switchInt(move _8) -> [false: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22 -+ switchInt(const true) -> [false: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22 +- switchInt(move _8) -> [0: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22 ++ switchInt(const true) -> [0: bb5, otherwise: bb4]; // scope 3 at $DIR/if.rs:+5:16: +5:22 } bb4: { diff --git a/src/test/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff b/src/test/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff index 881d80f7c03..5a87884977c 100644 --- a/src/test/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff +++ b/src/test/mir-opt/dataflow-const-prop/issue_81605.f.DataflowConstProp.diff @@ -10,8 +10,8 @@ StorageLive(_1); // scope 0 at $DIR/issue_81605.rs:+1:9: +1:33 StorageLive(_2); // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16 _2 = const true; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16 -+ switchInt(const true) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16 +- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16 ++ switchInt(const true) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/issue_81605.rs:+1:12: +1:16 } bb1: { diff --git a/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff b/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff index 61d24c3b517..80f8905adc9 100644 --- a/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff +++ b/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff @@ -37,8 +37,8 @@ } bb2: { -- switchInt(move _5) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17 -+ switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17 +- switchInt(move _5) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17 ++ switchInt(move _4) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:+3:11: +3:17 } bb3: { diff --git a/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff b/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff index fb18089e040..210d3849e18 100644 --- a/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff +++ b/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff @@ -12,7 +12,7 @@ bb0: { StorageLive(_3); // scope 0 at $DIR/deaggregator_test_enum_2.rs:+1:8: +1:9 _3 = _1; // scope 0 at $DIR/deaggregator_test_enum_2.rs:+1:8: +1:9 - switchInt(move _3) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/deaggregator_test_enum_2.rs:+1:8: +1:9 + switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/deaggregator_test_enum_2.rs:+1:8: +1:9 } bb1: { diff --git a/src/test/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff b/src/test/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff index 995611f0e96..3b1f81175cb 100644 --- a/src/test/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff +++ b/src/test/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff @@ -28,44 +28,44 @@ _7 = Len((*_2)); // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37 _8 = const 4_usize; // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37 _9 = Ge(move _7, move _8); // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37 - switchInt(move _9) -> [false: bb6, otherwise: bb2]; // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37 + switchInt(move _9) -> [0: bb6, otherwise: bb2]; // scope 0 at $DIR/deduplicate_blocks.rs:+2:9: +2:37 } bb2: { - switchInt((*_2)[0 of 4]) -> [47_u8: bb3, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 + switchInt((*_2)[0 of 4]) -> [47: bb3, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 } bb3: { - switchInt((*_2)[1 of 4]) -> [47_u8: bb4, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 + switchInt((*_2)[1 of 4]) -> [47: bb4, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 } bb4: { - switchInt((*_2)[2 of 4]) -> [47_u8: bb5, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 + switchInt((*_2)[2 of 4]) -> [47: bb5, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 } bb5: { -- switchInt((*_2)[3 of 4]) -> [47_u8: bb11, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 -+ switchInt((*_2)[3 of 4]) -> [47_u8: bb10, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 +- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 ++ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 } bb6: { _4 = Len((*_2)); // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31 _5 = const 3_usize; // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31 _6 = Ge(move _4, move _5); // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31 - switchInt(move _6) -> [false: bb10, otherwise: bb7]; // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31 + switchInt(move _6) -> [0: bb10, otherwise: bb7]; // scope 0 at $DIR/deduplicate_blocks.rs:+3:9: +3:31 } bb7: { - switchInt((*_2)[0 of 3]) -> [47_u8: bb8, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 + switchInt((*_2)[0 of 3]) -> [47: bb8, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 } bb8: { - switchInt((*_2)[1 of 3]) -> [47_u8: bb9, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 + switchInt((*_2)[1 of 3]) -> [47: bb9, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 } bb9: { -- switchInt((*_2)[2 of 3]) -> [47_u8: bb12, 33_u8: bb13, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 -+ switchInt((*_2)[2 of 3]) -> [47_u8: bb11, 33_u8: bb11, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 +- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 ++ switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10]; // scope 0 at $DIR/deduplicate_blocks.rs:+1:5: +1:23 } bb10: { diff --git a/src/test/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir b/src/test/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir index 5b185082d4d..9597a0c835f 100644 --- a/src/test/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir +++ b/src/test/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir @@ -17,7 +17,7 @@ fn foo(_1: Option<String>) -> i32 { _7 = const false; // scope 0 at $DIR/string.rs:+1:11: +1:12 _7 = const true; // scope 0 at $DIR/string.rs:+1:11: +1:12 _5 = discriminant(_1); // scope 0 at $DIR/string.rs:+1:11: +1:12 - switchInt(move _5) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/string.rs:+1:5: +1:12 + switchInt(move _5) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/string.rs:+1:5: +1:12 } bb1: { @@ -47,7 +47,7 @@ fn foo(_1: Option<String>) -> i32 { } bb4: { - switchInt(move _4) -> [false: bb1, otherwise: bb5]; // scope 0 at $DIR/string.rs:+2:14: +2:17 + switchInt(move _4) -> [0: bb1, otherwise: bb5]; // scope 0 at $DIR/string.rs:+2:14: +2:17 } bb5: { @@ -69,6 +69,6 @@ fn foo(_1: Option<String>) -> i32 { } bb9: { - switchInt(_7) -> [false: bb7, otherwise: bb8]; // scope 0 at $DIR/string.rs:+5:1: +5:2 + switchInt(_7) -> [0: bb7, otherwise: bb8]; // scope 0 at $DIR/string.rs:+5:1: +5:2 } } diff --git a/src/test/mir-opt/derefer_complex_case.main.Derefer.diff b/src/test/mir-opt/derefer_complex_case.main.Derefer.diff index 713d56c3836..fa3eeedc40f 100644 --- a/src/test/mir-opt/derefer_complex_case.main.Derefer.diff +++ b/src/test/mir-opt/derefer_complex_case.main.Derefer.diff @@ -62,7 +62,7 @@ bb3: { StorageDead(_8); // scope 1 at $DIR/derefer_complex_case.rs:+1:25: +1:26 _10 = discriminant(_7); // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 - switchInt(move _10) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 + switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 1 at $DIR/derefer_complex_case.rs:+1:17: +1:26 } bb4: { diff --git a/src/test/mir-opt/derefer_terminator_test.main.Derefer.diff b/src/test/mir-opt/derefer_terminator_test.main.Derefer.diff index 60f7b9d5607..ab2388d1323 100644 --- a/src/test/mir-opt/derefer_terminator_test.main.Derefer.diff +++ b/src/test/mir-opt/derefer_terminator_test.main.Derefer.diff @@ -54,11 +54,11 @@ _6 = &_7; // scope 2 at $DIR/derefer_terminator_test.rs:+3:18: +3:21 _5 = &_6; // scope 2 at $DIR/derefer_terminator_test.rs:+3:17: +3:21 _4 = &_5; // scope 2 at $DIR/derefer_terminator_test.rs:+3:15: +3:22 -- switchInt((*(*(*(*_4))))) -> [false: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 +- switchInt((*(*(*(*_4))))) -> [0: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 + _10 = deref_copy (*_4); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 + _11 = deref_copy (*_10); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 + _12 = deref_copy (*_11); // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 -+ switchInt((*_12)) -> [false: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 ++ switchInt((*_12)) -> [0: bb3, otherwise: bb4]; // scope 2 at $DIR/derefer_terminator_test.rs:+3:5: +3:22 } bb3: { diff --git a/src/test/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff index 5fa7013d5ca..9c729663265 100644 --- a/src/test/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff @@ -37,7 +37,7 @@ } bb2: { - switchInt(move _3) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/branch.rs:+3:16: +3:22 + switchInt(move _3) -> [0: bb4, otherwise: bb3]; // scope 1 at $DIR/branch.rs:+3:16: +3:22 } bb3: { diff --git a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff index 89d8106ae3c..98a02ee38dd 100644 --- a/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff @@ -31,13 +31,13 @@ StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17 StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17 _7 = discriminant((_3.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17 -- switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 +- switchInt(move _7) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + _10 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + _11 = Ne(_7, move _10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 -+ switchInt(move _11) -> [false: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 ++ switchInt(move _11) -> [0: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 } bb1: { @@ -49,7 +49,7 @@ bb2: { - _6 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17 -- switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 +- switchInt(move _6) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 - } - - bb3: { @@ -72,7 +72,7 @@ + + bb4: { + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 -+ switchInt(_7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 ++ switchInt(_7) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 } } diff --git a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff index 1a9efa93003..aa75c44b809 100644 --- a/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff @@ -32,18 +32,18 @@ StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17 StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17 _8 = discriminant((_3.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17 -- switchInt(move _8) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 +- switchInt(move _8) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + _11 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + StorageLive(_12); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + _12 = Ne(_8, move _11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 -+ switchInt(move _12) -> [false: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 ++ switchInt(move _12) -> [0: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 } bb1: { - _6 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17 -- switchInt(move _6) -> [0_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 +- switchInt(move _6) -> [0: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 - } - - bb2: { @@ -55,7 +55,7 @@ - bb3: { - _7 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17 -- switchInt(move _7) -> [1_isize: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 +- switchInt(move _7) -> [1: bb4, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 - } - - bb4: { @@ -86,7 +86,7 @@ + + bb5: { + StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 -+ switchInt(_8) -> [0_isize: bb3, 1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 ++ switchInt(_8) -> [0: bb3, 1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 } } diff --git a/src/test/mir-opt/early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff index 309a72ae58b..cea6ff7cd05 100644 --- a/src/test/mir-opt/early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff @@ -31,13 +31,13 @@ StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17 StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch.rs:+1:16: +1:17 _7 = discriminant((_3.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17 -- switchInt(move _7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 +- switchInt(move _7) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + StorageLive(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + _10 = discriminant((_3.1: std::option::Option<bool>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + StorageLive(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + _11 = Ne(_7, move _10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 + StorageDead(_10); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 -+ switchInt(move _11) -> [false: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 ++ switchInt(move _11) -> [0: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 } bb1: { @@ -49,7 +49,7 @@ bb2: { - _6 = discriminant((_3.1: std::option::Option<bool>)); // scope 0 at $DIR/early_otherwise_branch.rs:+1:11: +1:17 -- switchInt(move _6) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 +- switchInt(move _6) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 - } - - bb3: { @@ -72,7 +72,7 @@ + + bb4: { + StorageDead(_11); // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 -+ switchInt(_7) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 ++ switchInt(_7) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch.rs:+1:5: +1:17 } } diff --git a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff index 9574f32f7f0..b90d70ce43a 100644 --- a/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff @@ -42,13 +42,13 @@ StorageDead(_6); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:19: +1:20 StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:19: +1:20 _10 = discriminant((_4.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:11: +1:20 -- switchInt(move _10) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 +- switchInt(move _10) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 + StorageLive(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 + _14 = discriminant((_4.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 + StorageLive(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 + _15 = Ne(_10, move _14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 + StorageDead(_14); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 -+ switchInt(move _15) -> [false: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 ++ switchInt(move _15) -> [0: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 } bb1: { @@ -61,13 +61,13 @@ bb2: { - _9 = discriminant((_4.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:11: +1:20 -- switchInt(move _9) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 +- switchInt(move _9) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 - } - - bb3: { _8 = discriminant((_4.2: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:11: +1:20 -- switchInt(move _8) -> [1_isize: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 -+ switchInt(move _8) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 +- switchInt(move _8) -> [1: bb4, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 ++ switchInt(move _8) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 } - bb4: { @@ -94,7 +94,7 @@ + + bb5: { + StorageDead(_15); // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 -+ switchInt(_10) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 ++ switchInt(_10) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_3_element_tuple.rs:+1:5: +1:20 } } diff --git a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff index 6bc025bb5b2..9edd1a39f45 100644 --- a/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff @@ -80,13 +80,13 @@ StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:23: +5:24 _34 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _11 = discriminant((*_34)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - switchInt(move _11) -> [0_isize: bb1, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 + switchInt(move _11) -> [0: bb1, 1: bb3, 2: bb4, 3: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } bb1: { _35 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _7 = discriminant((*_35)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - switchInt(move _7) -> [0_isize: bb6, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 + switchInt(move _7) -> [0: bb6, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } bb2: { @@ -104,19 +104,19 @@ bb3: { _36 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _8 = discriminant((*_36)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 + switchInt(move _8) -> [1: bb7, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } bb4: { _37 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _9 = discriminant((*_37)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 + switchInt(move _9) -> [2: bb8, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } bb5: { _38 = deref_copy (_4.1: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 _10 = discriminant((*_38)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24 - switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 + switchInt(move _10) -> [3: bb9, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24 } bb6: { diff --git a/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff index 321f57951b4..82d8b2fc5a4 100644 --- a/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff @@ -38,12 +38,12 @@ StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:16: +1:17 StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:16: +1:17 _8 = discriminant((_3.0: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:11: +1:17 - switchInt(move _8) -> [0_isize: bb1, 1_isize: bb4, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17 + switchInt(move _8) -> [0: bb1, 1: bb4, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17 } bb1: { _6 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:11: +1:17 - switchInt(move _6) -> [0_isize: bb2, 1_isize: bb7, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17 + switchInt(move _6) -> [0: bb2, 1: bb7, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17 } bb2: { @@ -57,7 +57,7 @@ bb4: { _7 = discriminant((_3.1: std::option::Option<u32>)); // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:11: +1:17 - switchInt(move _7) -> [0_isize: bb6, 1_isize: bb5, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17 + switchInt(move _7) -> [0: bb6, 1: bb5, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_noopt.rs:+1:5: +1:17 } bb5: { diff --git a/src/test/mir-opt/early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff index 8b556acb2c4..a3fa2529b18 100644 --- a/src/test/mir-opt/early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff @@ -14,7 +14,7 @@ bb0: { _3 = discriminant(_1); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+1:11: +1:12 - switchInt(move _3) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+1:5: +1:12 + switchInt(move _3) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+1:5: +1:12 } bb1: { @@ -24,7 +24,7 @@ bb2: { _4 = discriminant((*_2)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+3:26: +3:28 - switchInt(move _4) -> [1_isize: bb4, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+3:20: +3:28 + switchInt(move _4) -> [1: bb4, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:+3:20: +3:28 } bb3: { diff --git a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff index 659aed18f04..6d0224b547f 100644 --- a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff @@ -12,13 +12,13 @@ bb0: { _3 = discriminant((*_1)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31 - switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31 + switchInt(move _3) -> [1: bb1, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31 } bb1: { _4 = deref_copy (((*_1) as Some).0: &E<'_>); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31 _2 = discriminant((*_4)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31 - switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31 + switchInt(move _2) -> [1: bb2, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:+1:12: +1:31 } bb2: { diff --git a/src/test/mir-opt/equal_true.opt.InstCombine.diff b/src/test/mir-opt/equal_true.opt.InstCombine.diff index 89982308e71..8b542a7c19d 100644 --- a/src/test/mir-opt/equal_true.opt.InstCombine.diff +++ b/src/test/mir-opt/equal_true.opt.InstCombine.diff @@ -14,7 +14,7 @@ - _2 = Eq(move _3, const true); // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 + _2 = move _3; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 StorageDead(_3); // scope 0 at $DIR/equal_true.rs:+1:16: +1:17 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 } bb1: { diff --git a/src/test/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir b/src/test/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir index 08481777ed4..ab955049965 100644 --- a/src/test/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir @@ -19,7 +19,7 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 { bb0: { FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/exponential_or.rs:+1:11: +1:12 - switchInt((_1.0: u32)) -> [1_u32: bb2, 4_u32: bb2, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:15: +2:20 + switchInt((_1.0: u32)) -> [1: bb2, 4: bb2, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:15: +2:20 } bb1: { @@ -29,31 +29,31 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 { bb2: { _2 = discriminant((_1.2: std::option::Option<i32>)); // scope 0 at $DIR/exponential_or.rs:+2:37: +2:55 - switchInt(move _2) -> [0_isize: bb4, 1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:37: +2:55 + switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:37: +2:55 } bb3: { - switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1_i32: bb4, 8_i32: bb4, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:37: +2:55 + switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1: bb4, 8: bb4, otherwise: bb1]; // scope 0 at $DIR/exponential_or.rs:+2:37: +2:55 } bb4: { _5 = Le(const 6_u32, (_1.3: u32)); // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67 - switchInt(move _5) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67 + switchInt(move _5) -> [0: bb6, otherwise: bb5]; // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67 } bb5: { _6 = Le((_1.3: u32), const 9_u32); // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67 - switchInt(move _6) -> [false: bb6, otherwise: bb8]; // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67 + switchInt(move _6) -> [0: bb6, otherwise: bb8]; // scope 0 at $DIR/exponential_or.rs:+2:62: +2:67 } bb6: { _3 = Le(const 13_u32, (_1.3: u32)); // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77 - switchInt(move _3) -> [false: bb1, otherwise: bb7]; // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77 + switchInt(move _3) -> [0: bb1, otherwise: bb7]; // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77 } bb7: { _4 = Le((_1.3: u32), const 16_u32); // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77 - switchInt(move _4) -> [false: bb1, otherwise: bb8]; // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77 + switchInt(move _4) -> [0: bb1, otherwise: bb8]; // scope 0 at $DIR/exponential_or.rs:+2:70: +2:77 } bb8: { diff --git a/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff index 6ab63e82e35..c1c2cde71ab 100644 --- a/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff +++ b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff @@ -47,7 +47,7 @@ bb1: { StorageDead(_5); // scope 0 at $DIR/funky_arms.rs:+4:36: +4:37 StorageLive(_6); // scope 1 at $DIR/funky_arms.rs:+8:9: +8:13 - switchInt(_4) -> [false: bb3, otherwise: bb2]; // scope 1 at $DIR/funky_arms.rs:+8:16: +8:32 + switchInt(_4) -> [0: bb3, otherwise: bb2]; // scope 1 at $DIR/funky_arms.rs:+8:16: +8:32 } bb2: { @@ -75,7 +75,7 @@ bb5: { StorageDead(_8); // scope 3 at $DIR/funky_arms.rs:+13:44: +13:45 _9 = discriminant(_7); // scope 3 at $DIR/funky_arms.rs:+13:12: +13:27 - switchInt(move _9) -> [1_isize: bb6, otherwise: bb8]; // scope 3 at $DIR/funky_arms.rs:+13:12: +13:27 + switchInt(move _9) -> [1: bb6, otherwise: bb8]; // scope 3 at $DIR/funky_arms.rs:+13:12: +13:27 } bb6: { diff --git a/src/test/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir b/src/test/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir index c3b08bf0648..a8e090020c3 100644 --- a/src/test/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir +++ b/src/test/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.mir @@ -29,7 +29,7 @@ fn main::{closure#0}(_1: *mut [generator@$DIR/generator_drop_cleanup.rs:10:15: 1 bb0: { _8 = discriminant((*_1)); // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 - switchInt(move _8) -> [0_u32: bb7, 3_u32: bb10, otherwise: bb11]; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 + switchInt(move _8) -> [0: bb7, 3: bb10, otherwise: bb11]; // scope 0 at $DIR/generator_drop_cleanup.rs:+0:15: +3:6 } bb1: { diff --git a/src/test/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir b/src/test/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir index fee6da2c635..b3d3c768a5d 100644 --- a/src/test/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir +++ b/src/test/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir @@ -32,7 +32,7 @@ fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator_tiny.rs:19:16: 19:24 bb0: { _11 = discriminant((*(_1.0: &mut [generator@$DIR/generator_tiny.rs:19:16: 19:24]))); // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6 - switchInt(move _11) -> [0_u32: bb1, 3_u32: bb5, otherwise: bb6]; // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6 + switchInt(move _11) -> [0: bb1, 3: bb5, otherwise: bb6]; // scope 0 at $DIR/generator_tiny.rs:+0:16: +6:6 } bb1: { diff --git a/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff index 94180d20343..de4235c9e9e 100644 --- a/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff @@ -9,7 +9,7 @@ bb0: { StorageLive(_2); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 _2 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 } bb1: { diff --git a/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff index b22c7eac622..754c6579af0 100644 --- a/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff @@ -13,7 +13,7 @@ _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 _2 = Eq(move _3, const -42f32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:18 StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:17: +1:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:18 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:18 } bb1: { diff --git a/src/test/mir-opt/if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff index cc0995f99cf..ff23839e291 100644 --- a/src/test/mir-opt/if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff @@ -20,10 +20,10 @@ _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:13: +1:14 - _2 = Eq(move _3, const 17_i8); // scope 0 at $DIR/if_condition_int.rs:+1:13: +1:20 - StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:19: +1:20 -- switchInt(_2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if_condition_int.rs:+2:5: +2:12 +- switchInt(_2) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/if_condition_int.rs:+2:5: +2:12 + _2 = Eq(_3, const 17_i8); // scope 0 at $DIR/if_condition_int.rs:+1:13: +1:20 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:19: +1:20 -+ switchInt(move _3) -> [17_i8: bb1, otherwise: bb2]; // scope 1 at $DIR/if_condition_int.rs:+2:5: +2:12 ++ switchInt(move _3) -> [17: bb1, otherwise: bb2]; // scope 1 at $DIR/if_condition_int.rs:+2:5: +2:12 } bb1: { diff --git a/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff index 801ea040203..5964d76a4b9 100644 --- a/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff @@ -13,10 +13,10 @@ _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 - _2 = Eq(move _3, const 'x'); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 - StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 +- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16 -+ switchInt(move _3) -> ['x': bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 ++ switchInt(move _3) -> [120: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 } bb1: { diff --git a/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff index 4297f4d6466..98918cc743c 100644 --- a/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff @@ -13,10 +13,10 @@ _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 - _2 = Eq(move _3, const 42_i8); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 - StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 +- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 -+ switchInt(move _3) -> [42_i8: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 ++ switchInt(move _3) -> [42: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 } bb1: { diff --git a/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff index 8fb794abbd4..db38140b8d0 100644 --- a/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff @@ -15,10 +15,10 @@ _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 - _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 - StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 +- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 -+ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 ++ switchInt(move _3) -> [42: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 } bb1: { @@ -34,10 +34,10 @@ _5 = _1; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:16 - _4 = Ne(move _5, const 21_u32); // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22 - StorageDead(_5); // scope 0 at $DIR/if_condition_int.rs:+3:21: +3:22 -- switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22 +- switchInt(move _4) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22 + nop; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22 + nop; // scope 0 at $DIR/if_condition_int.rs:+3:21: +3:22 -+ switchInt(move _5) -> [21_u32: bb4, otherwise: bb3]; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22 ++ switchInt(move _5) -> [21: bb4, otherwise: bb3]; // scope 0 at $DIR/if_condition_int.rs:+3:15: +3:22 } bb3: { diff --git a/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff index 992253ea780..1a1ac4caafa 100644 --- a/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff @@ -13,10 +13,10 @@ _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 - _2 = Eq(move _3, const -42_i32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 - StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 +- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:15: +1:16 -+ switchInt(move _3) -> [-42_i32: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 ++ switchInt(move _3) -> [4294967254: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:16 } bb1: { diff --git a/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff index 7cea9472d3a..fc3f50227dc 100644 --- a/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff @@ -13,10 +13,10 @@ _3 = _1; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:9 - _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 - StorageDead(_3); // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 +- switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 + nop; // scope 0 at $DIR/if_condition_int.rs:+1:14: +1:15 -+ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 ++ switchInt(move _3) -> [42: bb1, otherwise: bb2]; // scope 0 at $DIR/if_condition_int.rs:+1:8: +1:15 } bb1: { diff --git a/src/test/mir-opt/inline/cycle.g.Inline.diff b/src/test/mir-opt/inline/cycle.g.Inline.diff index 5f3ee467c88..afe157ccd7f 100644 --- a/src/test/mir-opt/inline/cycle.g.Inline.diff +++ b/src/test/mir-opt/inline/cycle.g.Inline.diff @@ -10,8 +10,6 @@ + let _3: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 + let mut _4: &fn() {main}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6 + let mut _5: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 -+ scope 2 (inlined <fn() {main} as Fn<()>>::call - shim(fn() {main})) { // at $DIR/cycle.rs:6:5: 6:8 -+ } + } bb0: { @@ -29,7 +27,10 @@ + StorageLive(_4); // scope 1 at $DIR/cycle.rs:6:5: 6:6 + _4 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6 + StorageLive(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 -+ _3 = move (*_4)() -> [return: bb4, unwind: bb2]; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ _3 = <fn() {main} as Fn<()>>::call(move _4, move _5) -> [return: bb2, unwind: bb3]; // scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ // mir::Constant ++ // + span: $DIR/cycle.rs:6:5: 6:6 ++ // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a fn() {main}, ()) -> <fn() {main} as FnOnce<()>>::Output {<fn() {main} as Fn<()>>::call}, val: Value(<ZST>) } } bb1: { @@ -39,19 +40,19 @@ return; // scope 0 at $DIR/cycle.rs:+2:2: +2:2 + } + -+ bb2 (cleanup): { -+ drop(_2) -> bb3; // scope 1 at $DIR/cycle.rs:7:1: 7:2 ++ bb2: { ++ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:7: 6:8 ++ StorageDead(_4); // scope 1 at $DIR/cycle.rs:6:7: 6:8 ++ StorageDead(_3); // scope 1 at $DIR/cycle.rs:6:8: 6:9 ++ drop(_2) -> bb1; // scope 1 at $DIR/cycle.rs:7:1: 7:2 + } + + bb3 (cleanup): { -+ resume; // scope 1 at $DIR/cycle.rs:5:1: 7:2 ++ drop(_2) -> bb4; // scope 1 at $DIR/cycle.rs:7:1: 7:2 + } + -+ bb4: { -+ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:7: 6:8 -+ StorageDead(_4); // scope 1 at $DIR/cycle.rs:6:7: 6:8 -+ StorageDead(_3); // scope 1 at $DIR/cycle.rs:6:8: 6:9 -+ drop(_2) -> bb1; // scope 1 at $DIR/cycle.rs:7:1: 7:2 ++ bb4 (cleanup): { ++ resume; // scope 1 at $DIR/cycle.rs:5:1: 7:2 } } diff --git a/src/test/mir-opt/inline/cycle.main.Inline.diff b/src/test/mir-opt/inline/cycle.main.Inline.diff index 8b4099b9d9f..bd89e09ecd1 100644 --- a/src/test/mir-opt/inline/cycle.main.Inline.diff +++ b/src/test/mir-opt/inline/cycle.main.Inline.diff @@ -10,18 +10,6 @@ + let _3: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 + let mut _4: &fn() {g}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6 + let mut _5: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 -+ scope 2 (inlined <fn() {g} as Fn<()>>::call - shim(fn() {g})) { // at $DIR/cycle.rs:6:5: 6:8 -+ scope 3 (inlined g) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL -+ let mut _6: fn() {main}; // in scope 3 at $DIR/cycle.rs:12:5: 12:12 -+ scope 4 (inlined f::<fn() {main}>) { // at $DIR/cycle.rs:12:5: 12:12 -+ debug g => _6; // in scope 4 at $DIR/cycle.rs:5:6: 5:7 -+ let _7: (); // in scope 4 at $DIR/cycle.rs:6:5: 6:8 -+ let mut _8: &fn() {main}; // in scope 4 at $DIR/cycle.rs:6:5: 6:6 -+ scope 5 (inlined <fn() {main} as Fn<()>>::call - shim(fn() {main})) { // at $DIR/cycle.rs:6:5: 6:8 -+ } -+ } -+ } -+ } + } bb0: { @@ -39,11 +27,10 @@ + StorageLive(_4); // scope 1 at $DIR/cycle.rs:6:5: 6:6 + _4 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6 + StorageLive(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 -+ StorageLive(_6); // scope 3 at $DIR/cycle.rs:12:5: 12:12 -+ StorageLive(_7); // scope 4 at $DIR/cycle.rs:6:5: 6:8 -+ StorageLive(_8); // scope 4 at $DIR/cycle.rs:6:5: 6:6 -+ _8 = &_6; // scope 4 at $DIR/cycle.rs:6:5: 6:6 -+ _7 = move (*_8)() -> [return: bb4, unwind: bb2]; // scope 5 at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ _3 = <fn() {g} as Fn<()>>::call(move _4, move _5) -> [return: bb2, unwind: bb3]; // scope 1 at $DIR/cycle.rs:6:5: 6:8 ++ // mir::Constant ++ // + span: $DIR/cycle.rs:6:5: 6:6 ++ // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a fn() {g}, ()) -> <fn() {g} as FnOnce<()>>::Output {<fn() {g} as Fn<()>>::call}, val: Value(<ZST>) } } bb1: { @@ -53,22 +40,19 @@ return; // scope 0 at $DIR/cycle.rs:+2:2: +2:2 + } + -+ bb2 (cleanup): { -+ drop(_2) -> bb3; // scope 1 at $DIR/cycle.rs:7:1: 7:2 ++ bb2: { ++ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:7: 6:8 ++ StorageDead(_4); // scope 1 at $DIR/cycle.rs:6:7: 6:8 ++ StorageDead(_3); // scope 1 at $DIR/cycle.rs:6:8: 6:9 ++ drop(_2) -> bb1; // scope 1 at $DIR/cycle.rs:7:1: 7:2 + } + + bb3 (cleanup): { -+ resume; // scope 1 at $DIR/cycle.rs:5:1: 7:2 ++ drop(_2) -> bb4; // scope 1 at $DIR/cycle.rs:7:1: 7:2 + } + -+ bb4: { -+ StorageDead(_8); // scope 4 at $DIR/cycle.rs:6:7: 6:8 -+ StorageDead(_7); // scope 4 at $DIR/cycle.rs:6:8: 6:9 -+ StorageDead(_6); // scope 3 at $DIR/cycle.rs:12:5: 12:12 -+ StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:7: 6:8 -+ StorageDead(_4); // scope 1 at $DIR/cycle.rs:6:7: 6:8 -+ StorageDead(_3); // scope 1 at $DIR/cycle.rs:6:8: 6:9 -+ drop(_2) -> bb1; // scope 1 at $DIR/cycle.rs:7:1: 7:2 ++ bb4 (cleanup): { ++ resume; // scope 1 at $DIR/cycle.rs:5:1: 7:2 } } diff --git a/src/test/mir-opt/inline/exponential_runtime.main.Inline.diff b/src/test/mir-opt/inline/exponential_runtime.main.Inline.diff new file mode 100644 index 00000000000..d9fd7b324c7 --- /dev/null +++ b/src/test/mir-opt/inline/exponential_runtime.main.Inline.diff @@ -0,0 +1,50 @@ +- // MIR for `main` before Inline ++ // MIR for `main` after Inline + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/exponential_runtime.rs:+0:11: +0:11 + let _1: (); // in scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ scope 1 (inlined <() as G>::call) { // at $DIR/exponential_runtime.rs:86:5: 86:22 ++ let _2: (); // in scope 1 at $DIR/exponential_runtime.rs:73:9: 73:25 ++ let _3: (); // in scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ let _4: (); // in scope 1 at $DIR/exponential_runtime.rs:75:9: 75:25 ++ } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 +- _1 = <() as G>::call() -> bb1; // scope 0 at $DIR/exponential_runtime.rs:+1:5: +1:22 ++ StorageLive(_2); // scope 1 at $DIR/exponential_runtime.rs:73:9: 73:25 ++ _2 = <() as F>::call() -> bb1; // scope 1 at $DIR/exponential_runtime.rs:73:9: 73:25 + // mir::Constant +- // + span: $DIR/exponential_runtime.rs:86:5: 86:20 +- // + literal: Const { ty: fn() {<() as G>::call}, val: Value(<ZST>) } ++ // + span: $DIR/exponential_runtime.rs:73:9: 73:23 ++ // + literal: Const { ty: fn() {<() as F>::call}, val: Value(<ZST>) } + } + + bb1: { ++ StorageDead(_2); // scope 1 at $DIR/exponential_runtime.rs:73:25: 73:26 ++ StorageLive(_3); // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ _3 = <() as F>::call() -> bb2; // scope 1 at $DIR/exponential_runtime.rs:74:9: 74:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:74:9: 74:23 ++ // + literal: Const { ty: fn() {<() as F>::call}, val: Value(<ZST>) } ++ } ++ ++ bb2: { ++ StorageDead(_3); // scope 1 at $DIR/exponential_runtime.rs:74:25: 74:26 ++ StorageLive(_4); // scope 1 at $DIR/exponential_runtime.rs:75:9: 75:25 ++ _4 = <() as F>::call() -> bb3; // scope 1 at $DIR/exponential_runtime.rs:75:9: 75:25 ++ // mir::Constant ++ // + span: $DIR/exponential_runtime.rs:75:9: 75:23 ++ // + literal: Const { ty: fn() {<() as F>::call}, val: Value(<ZST>) } ++ } ++ ++ bb3: { ++ StorageDead(_4); // scope 1 at $DIR/exponential_runtime.rs:75:25: 75:26 + StorageDead(_1); // scope 0 at $DIR/exponential_runtime.rs:+1:22: +1:23 + _0 = const (); // scope 0 at $DIR/exponential_runtime.rs:+0:11: +2:2 + return; // scope 0 at $DIR/exponential_runtime.rs:+2:2: +2:2 + } + } + diff --git a/src/test/mir-opt/inline/exponential_runtime.rs b/src/test/mir-opt/inline/exponential_runtime.rs new file mode 100644 index 00000000000..d9219d76a98 --- /dev/null +++ b/src/test/mir-opt/inline/exponential_runtime.rs @@ -0,0 +1,87 @@ +// Checks that code with exponential runtime does not have exponential behavior in inlining. + +trait A { + fn call(); +} + +trait B { + fn call(); +} +impl<T: A> B for T { + #[inline] + fn call() { + <T as A>::call(); + <T as A>::call(); + <T as A>::call(); + } +} + +trait C { + fn call(); +} +impl<T: B> C for T { + #[inline] + fn call() { + <T as B>::call(); + <T as B>::call(); + <T as B>::call(); + } +} + +trait D { + fn call(); +} +impl<T: C> D for T { + #[inline] + fn call() { + <T as C>::call(); + <T as C>::call(); + <T as C>::call(); + } +} + +trait E { + fn call(); +} +impl<T: D> E for T { + #[inline] + fn call() { + <T as D>::call(); + <T as D>::call(); + <T as D>::call(); + } +} + +trait F { + fn call(); +} +impl<T: E> F for T { + #[inline] + fn call() { + <T as E>::call(); + <T as E>::call(); + <T as E>::call(); + } +} + +trait G { + fn call(); +} +impl<T: F> G for T { + #[inline] + fn call() { + <T as F>::call(); + <T as F>::call(); + <T as F>::call(); + } +} + +impl A for () { + #[inline(never)] + fn call() {} +} + +// EMIT_MIR exponential_runtime.main.Inline.diff +fn main() { + <() as G>::call(); +} diff --git a/src/test/mir-opt/inline/inline_cycle.one.Inline.diff b/src/test/mir-opt/inline/inline_cycle.one.Inline.diff index 5510cd7bc8c..f54a1a747d4 100644 --- a/src/test/mir-opt/inline/inline_cycle.one.Inline.diff +++ b/src/test/mir-opt/inline/inline_cycle.one.Inline.diff @@ -5,20 +5,17 @@ let mut _0: (); // return place in scope 0 at $DIR/inline_cycle.rs:+0:10: +0:10 let _1: (); // in scope 0 at $DIR/inline_cycle.rs:+1:5: +1:24 + scope 1 (inlined <C as Call>::call) { // at $DIR/inline_cycle.rs:14:5: 14:24 -+ scope 2 (inlined <A<C> as Call>::call) { // at $DIR/inline_cycle.rs:43:9: 43:23 -+ scope 3 (inlined <B<C> as Call>::call) { // at $DIR/inline_cycle.rs:28:9: 28:31 -+ } -+ } + } bb0: { StorageLive(_1); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:24 - _1 = <C as Call>::call() -> bb1; // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:24 -+ _1 = <C as Call>::call() -> bb1; // scope 3 at $DIR/inline_cycle.rs:36:9: 36:28 ++ _1 = <A<C> as Call>::call() -> bb1; // scope 1 at $DIR/inline_cycle.rs:43:9: 43:23 // mir::Constant - // + span: $DIR/inline_cycle.rs:14:5: 14:22 -+ // + span: $DIR/inline_cycle.rs:36:9: 36:26 - // + literal: Const { ty: fn() {<C as Call>::call}, val: Value(<ZST>) } +- // + literal: Const { ty: fn() {<C as Call>::call}, val: Value(<ZST>) } ++ // + span: $DIR/inline_cycle.rs:43:9: 43:21 ++ // + literal: Const { ty: fn() {<A<C> as Call>::call}, val: Value(<ZST>) } } bb1: { diff --git a/src/test/mir-opt/inline/inline_cycle.two.Inline.diff b/src/test/mir-opt/inline/inline_cycle.two.Inline.diff index ab1ea0e3b2c..a940848c269 100644 --- a/src/test/mir-opt/inline/inline_cycle.two.Inline.diff +++ b/src/test/mir-opt/inline/inline_cycle.two.Inline.diff @@ -9,11 +9,6 @@ + debug f => _2; // in scope 1 at $DIR/inline_cycle.rs:53:22: 53:23 + let _3: (); // in scope 1 at $DIR/inline_cycle.rs:54:5: 54:8 + let mut _4: (); // in scope 1 at $DIR/inline_cycle.rs:54:5: 54:8 -+ scope 2 (inlined <fn() {f} as FnOnce<()>>::call_once - shim(fn() {f})) { // at $DIR/inline_cycle.rs:54:5: 54:8 -+ scope 3 (inlined f) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL -+ let _5: (); // in scope 3 at $DIR/inline_cycle.rs:59:5: 59:12 -+ } -+ } + } bb0: { @@ -23,23 +18,19 @@ + _2 = f; // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 // mir::Constant - // + span: $DIR/inline_cycle.rs:49:5: 49:9 -+ // + span: $DIR/inline_cycle.rs:49:10: 49:11 -+ // + literal: Const { ty: fn() {f}, val: Value(<ZST>) } +- // + literal: Const { ty: fn(fn() {f}) {call::<fn() {f}>}, val: Value(<ZST>) } +- // mir::Constant + // + span: $DIR/inline_cycle.rs:49:10: 49:11 + // + literal: Const { ty: fn() {f}, val: Value(<ZST>) } + StorageLive(_3); // scope 1 at $DIR/inline_cycle.rs:54:5: 54:8 + StorageLive(_4); // scope 1 at $DIR/inline_cycle.rs:54:5: 54:8 -+ StorageLive(_5); // scope 3 at $DIR/inline_cycle.rs:59:5: 59:12 -+ _5 = call::<fn() {f}>(f) -> bb1; // scope 3 at $DIR/inline_cycle.rs:59:5: 59:12 ++ _3 = <fn() {f} as FnOnce<()>>::call_once(move _2, move _4) -> bb1; // scope 1 at $DIR/inline_cycle.rs:54:5: 54:8 + // mir::Constant -+ // + span: $DIR/inline_cycle.rs:59:5: 59:9 - // + literal: Const { ty: fn(fn() {f}) {call::<fn() {f}>}, val: Value(<ZST>) } - // mir::Constant -- // + span: $DIR/inline_cycle.rs:49:10: 49:11 -+ // + span: $DIR/inline_cycle.rs:59:10: 59:11 - // + literal: Const { ty: fn() {f}, val: Value(<ZST>) } ++ // + span: $DIR/inline_cycle.rs:54:5: 54:6 ++ // + literal: Const { ty: extern "rust-call" fn(fn() {f}, ()) -> <fn() {f} as FnOnce<()>>::Output {<fn() {f} as FnOnce<()>>::call_once}, val: Value(<ZST>) } } bb1: { -+ StorageDead(_5); // scope 3 at $DIR/inline_cycle.rs:59:12: 59:13 + StorageDead(_4); // scope 1 at $DIR/inline_cycle.rs:54:7: 54:8 + StorageDead(_3); // scope 1 at $DIR/inline_cycle.rs:54:8: 54:9 + StorageDead(_2); // scope 0 at $DIR/inline_cycle.rs:+1:5: +1:12 diff --git a/src/test/mir-opt/inline/inline_cycle_generic.main.Inline.diff b/src/test/mir-opt/inline/inline_cycle_generic.main.Inline.diff index 52debab4dd1..04de3e61e5f 100644 --- a/src/test/mir-opt/inline/inline_cycle_generic.main.Inline.diff +++ b/src/test/mir-opt/inline/inline_cycle_generic.main.Inline.diff @@ -6,21 +6,18 @@ let _1: (); // in scope 0 at $DIR/inline_cycle_generic.rs:+1:5: +1:24 + scope 1 (inlined <C as Call>::call) { // at $DIR/inline_cycle_generic.rs:9:5: 9:24 + scope 2 (inlined <B<A> as Call>::call) { // at $DIR/inline_cycle_generic.rs:38:9: 38:31 -+ scope 3 (inlined <A as Call>::call) { // at $DIR/inline_cycle_generic.rs:31:9: 31:28 -+ scope 4 (inlined <B<C> as Call>::call) { // at $DIR/inline_cycle_generic.rs:23:9: 23:31 -+ } -+ } + } + } bb0: { StorageLive(_1); // scope 0 at $DIR/inline_cycle_generic.rs:+1:5: +1:24 - _1 = <C as Call>::call() -> bb1; // scope 0 at $DIR/inline_cycle_generic.rs:+1:5: +1:24 -+ _1 = <C as Call>::call() -> bb1; // scope 4 at $DIR/inline_cycle_generic.rs:31:9: 31:28 ++ _1 = <A as Call>::call() -> bb1; // scope 2 at $DIR/inline_cycle_generic.rs:31:9: 31:28 // mir::Constant - // + span: $DIR/inline_cycle_generic.rs:9:5: 9:22 +- // + literal: Const { ty: fn() {<C as Call>::call}, val: Value(<ZST>) } + // + span: $DIR/inline_cycle_generic.rs:31:9: 31:26 - // + literal: Const { ty: fn() {<C as Call>::call}, val: Value(<ZST>) } ++ // + literal: Const { ty: fn() {<A as Call>::call}, val: Value(<ZST>) } } bb1: { diff --git a/src/test/mir-opt/inline/inline_diverging.g.Inline.diff b/src/test/mir-opt/inline/inline_diverging.g.Inline.diff index 1e703a8fd2b..b787a19f4b2 100644 --- a/src/test/mir-opt/inline/inline_diverging.g.Inline.diff +++ b/src/test/mir-opt/inline/inline_diverging.g.Inline.diff @@ -19,7 +19,7 @@ _3 = _1; // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:9 _2 = Gt(move _3, const 0_i32); // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13 StorageDead(_3); // scope 0 at $DIR/inline_diverging.rs:+1:12: +1:13 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/inline_diverging.rs:+1:8: +1:13 } bb1: { diff --git a/src/test/mir-opt/inline/inline_diverging.h.Inline.diff b/src/test/mir-opt/inline/inline_diverging.h.Inline.diff index 75a6ab37008..a01bcf1645b 100644 --- a/src/test/mir-opt/inline/inline_diverging.h.Inline.diff +++ b/src/test/mir-opt/inline/inline_diverging.h.Inline.diff @@ -19,14 +19,6 @@ + scope 3 { + debug b => _9; // in scope 3 at $DIR/inline_diverging.rs:28:9: 28:10 + } -+ scope 6 (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) { // at $DIR/inline_diverging.rs:28:13: 28:16 -+ scope 7 (inlined sleep) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL -+ } -+ } -+ } -+ scope 4 (inlined <fn() -> ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) { // at $DIR/inline_diverging.rs:27:13: 27:16 -+ scope 5 (inlined sleep) { // at $SRC_DIR/core/src/ops/function.rs:LL:COL -+ } + } + } @@ -46,11 +38,51 @@ + StorageLive(_4); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 + _4 = &_2; // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 + StorageLive(_5); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16 -+ goto -> bb1; // scope 5 at $DIR/inline_diverging.rs:39:5: 39:12 ++ _3 = <fn() -> ! {sleep} as Fn<()>>::call(move _4, move _5) -> [return: bb1, unwind: bb5]; // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16 ++ // mir::Constant ++ // + span: $DIR/inline_diverging.rs:27:13: 27:14 ++ // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a fn() -> ! {sleep}, ()) -> <fn() -> ! {sleep} as FnOnce<()>>::Output {<fn() -> ! {sleep} as Fn<()>>::call}, val: Value(<ZST>) } + } + + bb1: { -+ goto -> bb1; // scope 5 at $DIR/inline_diverging.rs:39:5: 39:12 ++ StorageDead(_5); // scope 1 at $DIR/inline_diverging.rs:27:15: 27:16 ++ StorageDead(_4); // scope 1 at $DIR/inline_diverging.rs:27:15: 27:16 ++ StorageLive(_6); // scope 2 at $DIR/inline_diverging.rs:28:13: 28:14 ++ _6 = &_2; // scope 2 at $DIR/inline_diverging.rs:28:13: 28:14 ++ StorageLive(_7); // scope 2 at $DIR/inline_diverging.rs:28:13: 28:16 ++ _9 = <fn() -> ! {sleep} as Fn<()>>::call(move _6, move _7) -> [return: bb2, unwind: bb4]; // scope 2 at $DIR/inline_diverging.rs:28:13: 28:16 ++ // mir::Constant ++ // + span: $DIR/inline_diverging.rs:28:13: 28:14 ++ // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a fn() -> ! {sleep}, ()) -> <fn() -> ! {sleep} as FnOnce<()>>::Output {<fn() -> ! {sleep} as Fn<()>>::call}, val: Value(<ZST>) } ++ } ++ ++ bb2: { ++ StorageDead(_7); // scope 2 at $DIR/inline_diverging.rs:28:15: 28:16 ++ StorageDead(_6); // scope 2 at $DIR/inline_diverging.rs:28:15: 28:16 ++ StorageLive(_8); // scope 3 at $DIR/inline_diverging.rs:29:6: 29:7 ++ _8 = move _3; // scope 3 at $DIR/inline_diverging.rs:29:6: 29:7 ++ Deinit(_1); // scope 3 at $DIR/inline_diverging.rs:29:5: 29:11 ++ (_1.0: !) = move _8; // scope 3 at $DIR/inline_diverging.rs:29:5: 29:11 ++ (_1.1: !) = move _9; // scope 3 at $DIR/inline_diverging.rs:29:5: 29:11 ++ StorageDead(_8); // scope 3 at $DIR/inline_diverging.rs:29:10: 29:11 ++ StorageDead(_3); // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 ++ drop(_2) -> bb3; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 ++ } ++ ++ bb3: { ++ unreachable; // scope 0 at $DIR/inline_diverging.rs:30:2: 30:2 ++ } ++ ++ bb4 (cleanup): { ++ drop(_3) -> bb5; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 ++ } ++ ++ bb5 (cleanup): { ++ drop(_2) -> bb6; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 ++ } ++ ++ bb6 (cleanup): { ++ resume; // scope 1 at $DIR/inline_diverging.rs:26:1: 30:2 } } diff --git a/src/test/mir-opt/inline/inline_generator.main.Inline.diff b/src/test/mir-opt/inline/inline_generator.main.Inline.diff index 91bff3d3234..bd21405f14b 100644 --- a/src/test/mir-opt/inline/inline_generator.main.Inline.diff +++ b/src/test/mir-opt/inline/inline_generator.main.Inline.diff @@ -72,7 +72,7 @@ + _7 = const false; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46 + _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 + _9 = discriminant((*_10)); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 -+ switchInt(move _9) -> [0_u32: bb3, 1_u32: bb8, 3_u32: bb7, otherwise: bb9]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ switchInt(move _9) -> [0: bb3, 1: bb8, 3: bb7, otherwise: bb9]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 } - bb3: { @@ -92,7 +92,7 @@ + + bb3: { + StorageLive(_8); // scope 6 at $DIR/inline_generator.rs:15:17: 15:39 -+ switchInt(move _7) -> [false: bb5, otherwise: bb4]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21 ++ switchInt(move _7) -> [0: bb5, otherwise: bb4]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21 + } + + bb4: { diff --git a/src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir b/src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir index 75af20d482d..60149ff3606 100644 --- a/src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir +++ b/src/test/mir-opt/inline/inline_retag.bar.Inline.after.mir @@ -38,9 +38,7 @@ fn bar() -> bool { // + literal: Const { ty: &i32, val: Unevaluated(bar, [], Some(promoted[1])) } Retag(_10); // scope 1 at $DIR/inline_retag.rs:+2:7: +2:9 _4 = &(*_10); // scope 1 at $DIR/inline_retag.rs:+2:7: +2:9 - Retag(_4); // scope 1 at $DIR/inline_retag.rs:+2:7: +2:9 _3 = &(*_4); // scope 1 at $DIR/inline_retag.rs:+2:7: +2:9 - Retag(_3); // scope 1 at $DIR/inline_retag.rs:+2:7: +2:9 StorageLive(_6); // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14 StorageLive(_7); // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14 _9 = const _; // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14 @@ -49,9 +47,7 @@ fn bar() -> bool { // + literal: Const { ty: &i32, val: Unevaluated(bar, [], Some(promoted[0])) } Retag(_9); // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14 _7 = &(*_9); // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14 - Retag(_7); // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14 _6 = &(*_7); // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14 - Retag(_6); // scope 1 at $DIR/inline_retag.rs:+2:11: +2:14 Retag(_3); // scope 2 at $DIR/inline_retag.rs:16:8: 16:9 Retag(_6); // scope 2 at $DIR/inline_retag.rs:16:17: 16:18 StorageLive(_11); // scope 2 at $DIR/inline_retag.rs:17:5: 17:7 diff --git a/src/test/mir-opt/inline/inline_shims.drop.Inline.diff b/src/test/mir-opt/inline/inline_shims.drop.Inline.diff index 7a54beca233..36ddb189e0d 100644 --- a/src/test/mir-opt/inline/inline_shims.drop.Inline.diff +++ b/src/test/mir-opt/inline/inline_shims.drop.Inline.diff @@ -39,7 +39,7 @@ + StorageLive(_6); // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40 + StorageLive(_7); // scope 2 at $DIR/inline_shims.rs:+2:14: +2:40 + _6 = discriminant((*_5)); // scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL -+ switchInt(move _6) -> [0_isize: bb2, otherwise: bb3]; // scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL ++ switchInt(move _6) -> [0: bb2, otherwise: bb3]; // scope 3 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL } bb2: { diff --git a/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff b/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff index 81d5528231d..2f6f5f87efc 100644 --- a/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff +++ b/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff @@ -26,7 +26,7 @@ } bb3: { - switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at /the/src/instrument_coverage.rs:+2:12: +2:17 + switchInt(move _2) -> [0: bb5, otherwise: bb4]; // scope 0 at /the/src/instrument_coverage.rs:+2:12: +2:17 } bb4: { diff --git a/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir b/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir index 82210081832..b0d5b291b6c 100644 --- a/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir @@ -26,7 +26,7 @@ fn main() -> () { StorageLive(_3); // scope 1 at $DIR/issue_38669.rs:+3:9: +5:10 StorageLive(_4); // scope 1 at $DIR/issue_38669.rs:+3:12: +3:24 _4 = _1; // scope 1 at $DIR/issue_38669.rs:+3:12: +3:24 - switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/issue_38669.rs:+3:12: +3:24 + switchInt(move _4) -> [0: bb4, otherwise: bb3]; // scope 1 at $DIR/issue_38669.rs:+3:12: +3:24 } bb3: { diff --git a/src/test/mir-opt/issue_41110.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue_41110.main.ElaborateDrops.after.mir index c573ad5a8e4..c2ea3ac502f 100644 --- a/src/test/mir-opt/issue_41110.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue_41110.main.ElaborateDrops.after.mir @@ -65,6 +65,6 @@ fn main() -> () { } bb8 (cleanup): { - switchInt(_5) -> [false: bb6, otherwise: bb7]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 + switchInt(_5) -> [0: bb6, otherwise: bb7]; // scope 0 at $DIR/issue_41110.rs:+1:27: +1:28 } } diff --git a/src/test/mir-opt/issue_41110.test.ElaborateDrops.after.mir b/src/test/mir-opt/issue_41110.test.ElaborateDrops.after.mir index 470b0323281..82989c3f071 100644 --- a/src/test/mir-opt/issue_41110.test.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue_41110.test.ElaborateDrops.after.mir @@ -96,6 +96,6 @@ fn test() -> () { } bb14 (cleanup): { - switchInt(_6) -> [false: bb10, otherwise: bb13]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 + switchInt(_6) -> [0: bb10, otherwise: bb13]; // scope 0 at $DIR/issue_41110.rs:+5:1: +5:2 } } diff --git a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir index 73372c97bea..00504273245 100644 --- a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir @@ -33,7 +33,7 @@ fn main() -> () { } bb1: { - switchInt(move _2) -> [false: bb7, otherwise: bb2]; // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14 + switchInt(move _2) -> [0: bb7, otherwise: bb2]; // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14 } bb2: { @@ -52,7 +52,7 @@ fn main() -> () { bb4: { StorageDead(_3); // scope 1 at $DIR/issue_41888.rs:+3:19: +3:20 _5 = discriminant(_1); // scope 2 at $DIR/issue_41888.rs:+4:16: +4:24 - switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 2 at $DIR/issue_41888.rs:+4:16: +4:24 + switchInt(move _5) -> [0: bb5, otherwise: bb6]; // scope 2 at $DIR/issue_41888.rs:+4:16: +4:24 } bb5: { @@ -134,19 +134,19 @@ fn main() -> () { bb19: { _10 = discriminant(_1); // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 - switchInt(move _10) -> [0_isize: bb15, otherwise: bb17]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + switchInt(move _10) -> [0: bb15, otherwise: bb17]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 } bb20: { - switchInt(_7) -> [false: bb15, otherwise: bb19]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + switchInt(_7) -> [0: bb15, otherwise: bb19]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 } bb21 (cleanup): { _11 = discriminant(_1); // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 - switchInt(move _11) -> [0_isize: bb16, otherwise: bb18]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + switchInt(move _11) -> [0: bb16, otherwise: bb18]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 } bb22 (cleanup): { - switchInt(_7) -> [false: bb12, otherwise: bb21]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 + switchInt(_7) -> [0: bb12, otherwise: bb21]; // scope 0 at $DIR/issue_41888.rs:+9:1: +9:2 } } diff --git a/src/test/mir-opt/issue_62289.test.ElaborateDrops.before.mir b/src/test/mir-opt/issue_62289.test.ElaborateDrops.before.mir index 6969a66ac19..adfa3a7733b 100644 --- a/src/test/mir-opt/issue_62289.test.ElaborateDrops.before.mir +++ b/src/test/mir-opt/issue_62289.test.ElaborateDrops.before.mir @@ -52,7 +52,7 @@ fn test() -> Option<Box<u32>> { bb2: { StorageDead(_7); // scope 0 at $DIR/issue_62289.rs:+1:19: +1:20 _8 = discriminant(_6); // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20 - switchInt(move _8) -> [0_isize: bb3, 1_isize: bb5, otherwise: bb4]; // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20 + switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4]; // scope 0 at $DIR/issue_62289.rs:+1:15: +1:20 } bb3: { diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff index b88cdfcbc96..17b81633991 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff @@ -116,7 +116,7 @@ StorageDead(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _15 = Not(move _16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _15) -> [false: bb5, otherwise: bb4]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _15) -> [0: bb5, otherwise: bb4]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb4: { diff --git a/src/test/mir-opt/issue_99325.main.built.after.mir b/src/test/mir-opt/issue_99325.main.built.after.mir index 3db40412b2e..3e035c18db8 100644 --- a/src/test/mir-opt/issue_99325.main.built.after.mir +++ b/src/test/mir-opt/issue_99325.main.built.after.mir @@ -109,7 +109,7 @@ fn main() -> () { StorageDead(_12); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _10 = Not(move _11); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_11); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _10) -> [false: bb4, otherwise: bb3]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _10) -> [0: bb4, otherwise: bb3]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb3: { @@ -218,7 +218,7 @@ fn main() -> () { StorageDead(_33); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _31 = Not(move _32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _31) -> [false: bb13, otherwise: bb12]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _31) -> [0: bb13, otherwise: bb12]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb12: { diff --git a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir index 5a2f4feff35..e0d6b58f229 100644 --- a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir +++ b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir @@ -47,7 +47,7 @@ fn num_to_digit(_1: char) -> u32 { bb2: { _7 = discriminant(_2); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - switchInt(move _7) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _7) -> [0: bb6, 1: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL } bb3: { @@ -66,7 +66,7 @@ fn num_to_digit(_1: char) -> u32 { StorageDead(_4); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL StorageDead(_5); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL StorageDead(_3); // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23 - switchInt(move _9) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23 + switchInt(move _9) -> [1: bb1, otherwise: bb3]; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23 } bb6: { diff --git a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index 87066cc62c0..1c69a6232d6 100644 --- a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -32,15 +32,15 @@ bb1: { StorageDead(_3); // scope 2 at $DIR/issue_75439.rs:+2:52: +2:53 - switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 + switchInt(_2[0 of 4]) -> [0: bb2, otherwise: bb8]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 } bb2: { - switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 + switchInt(_2[1 of 4]) -> [0: bb3, otherwise: bb8]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 } bb3: { - switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 + switchInt(_2[2 of 4]) -> [0: bb5, 4294901760: bb6, otherwise: bb8]; // scope 3 at $DIR/issue_75439.rs:+4:12: +4:30 } bb4: { diff --git a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir index 5981ab885f9..4ee2dae49b3 100644 --- a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir +++ b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir @@ -16,7 +16,7 @@ fn main() -> () { StorageLive(_1); // scope 0 at $DIR/loop_test.rs:+4:5: +6:6 StorageLive(_2); // scope 0 at $DIR/loop_test.rs:+4:8: +4:12 _2 = const true; // scope 0 at $DIR/loop_test.rs:+4:8: +4:12 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/loop_test.rs:+4:8: +4:12 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/loop_test.rs:+4:8: +4:12 } bb1: { diff --git a/src/test/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff b/src/test/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff index 049bbeac867..9bc7060e958 100644 --- a/src/test/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff +++ b/src/test/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff @@ -38,7 +38,7 @@ _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 - switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 + switchInt(move _3) -> [0: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 } bb2: { diff --git a/src/test/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff b/src/test/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff index 40ec01eeb41..cf427cfd1e6 100644 --- a/src/test/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff +++ b/src/test/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff @@ -41,7 +41,7 @@ _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:+1:26: +1:27 - switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 + switchInt(move _3) -> [0: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:+1:8: +1:27 } bb2: { diff --git a/src/test/mir-opt/lower_array_len_e2e.array_bound.PreCodegen.after.mir b/src/test/mir-opt/lower_array_len_e2e.array_bound.PreCodegen.after.mir index 9b1b07f38fc..701c2ad705a 100644 --- a/src/test/mir-opt/lower_array_len_e2e.array_bound.PreCodegen.after.mir +++ b/src/test/mir-opt/lower_array_len_e2e.array_bound.PreCodegen.after.mir @@ -19,7 +19,7 @@ fn array_bound(_1: usize, _2: &[u8; N]) -> u8 { _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27 StorageDead(_5); // scope 0 at $DIR/lower_array_len_e2e.rs:+1:26: +1:27 StorageDead(_4); // scope 0 at $DIR/lower_array_len_e2e.rs:+1:26: +1:27 - switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27 + switchInt(move _3) -> [0: bb3, otherwise: bb1]; // scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27 } bb1: { diff --git a/src/test/mir-opt/lower_array_len_e2e.array_bound_mut.PreCodegen.after.mir b/src/test/mir-opt/lower_array_len_e2e.array_bound_mut.PreCodegen.after.mir index 29e379777b0..0440cfce289 100644 --- a/src/test/mir-opt/lower_array_len_e2e.array_bound_mut.PreCodegen.after.mir +++ b/src/test/mir-opt/lower_array_len_e2e.array_bound_mut.PreCodegen.after.mir @@ -22,7 +22,7 @@ fn array_bound_mut(_1: usize, _2: &mut [u8; N]) -> u8 { _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27 StorageDead(_5); // scope 0 at $DIR/lower_array_len_e2e.rs:+1:26: +1:27 StorageDead(_4); // scope 0 at $DIR/lower_array_len_e2e.rs:+1:26: +1:27 - switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27 + switchInt(move _3) -> [0: bb3, otherwise: bb1]; // scope 0 at $DIR/lower_array_len_e2e.rs:+1:8: +1:27 } bb1: { diff --git a/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff b/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff index 5f5d6e68fdc..2b0370cf358 100644 --- a/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff +++ b/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff @@ -33,7 +33,7 @@ _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:27 StorageDead(_5); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27 StorageDead(_4); // scope 0 at $DIR/lower_slice_len.rs:+1:26: +1:27 - switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:27 + switchInt(move _3) -> [0: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_slice_len.rs:+1:8: +1:27 } bb2: { diff --git a/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff index d3db3b18271..84e4d35f908 100644 --- a/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff +++ b/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff @@ -32,18 +32,18 @@ bb0: { - FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_arm_scopes.rs:+1:11: +1:16 -- switchInt((_2.0: bool)) -> [false: bb1, otherwise: bb2]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 -+ switchInt((_2.0: bool)) -> [false: bb5, otherwise: bb1]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 +- switchInt((_2.0: bool)) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 ++ switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 } bb1: { - falseEdge -> [real: bb8, imaginary: bb3]; // scope 0 at $DIR/match_arm_scopes.rs:+2:9: +2:22 -+ switchInt((_2.1: bool)) -> [false: bb10, otherwise: bb2]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 ++ switchInt((_2.1: bool)) -> [0: bb10, otherwise: bb2]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 } bb2: { -- switchInt((_2.1: bool)) -> [false: bb3, otherwise: bb4]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 -+ switchInt((_2.0: bool)) -> [false: bb3, otherwise: bb17]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 +- switchInt((_2.1: bool)) -> [0: bb3, otherwise: bb4]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 ++ switchInt((_2.0: bool)) -> [0: bb3, otherwise: bb17]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 } bb3: { @@ -51,7 +51,7 @@ - } - - bb4: { -- switchInt((_2.0: bool)) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 +- switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb5]; // scope 0 at $DIR/match_arm_scopes.rs:+1:5: +1:16 - } - - bb5: { @@ -85,8 +85,8 @@ StorageLive(_9); // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 StorageLive(_10); // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 _10 = _1; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 -- switchInt(move _10) -> [false: bb10, otherwise: bb9]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 -+ switchInt(move _10) -> [false: bb7, otherwise: bb6]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 +- switchInt(move _10) -> [0: bb10, otherwise: bb9]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 ++ switchInt(move _10) -> [0: bb7, otherwise: bb6]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 } - bb9: { @@ -101,8 +101,8 @@ - bb10: { + bb7: { _9 = (*_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:70: +2:71 -- switchInt(move _9) -> [false: bb12, otherwise: bb11]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 -+ switchInt(move _9) -> [false: bb9, otherwise: bb8]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 +- switchInt(move _9) -> [0: bb12, otherwise: bb11]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 ++ switchInt(move _9) -> [0: bb9, otherwise: bb8]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 } - bb11: { @@ -142,8 +142,8 @@ StorageLive(_12); // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 StorageLive(_13); // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 _13 = _1; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 -- switchInt(move _13) -> [false: bb15, otherwise: bb14]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 -+ switchInt(move _13) -> [false: bb12, otherwise: bb11]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 +- switchInt(move _13) -> [0: bb15, otherwise: bb14]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 ++ switchInt(move _13) -> [0: bb12, otherwise: bb11]; // scope 0 at $DIR/match_arm_scopes.rs:+2:45: +2:49 } - bb14: { @@ -158,8 +158,8 @@ - bb15: { + bb12: { _12 = (*_6); // scope 0 at $DIR/match_arm_scopes.rs:+2:70: +2:71 -- switchInt(move _12) -> [false: bb17, otherwise: bb16]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 -+ switchInt(move _12) -> [false: bb14, otherwise: bb13]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 +- switchInt(move _12) -> [0: bb17, otherwise: bb16]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 ++ switchInt(move _12) -> [0: bb14, otherwise: bb13]; // scope 0 at $DIR/match_arm_scopes.rs:+2:42: +2:73 } - bb16: { diff --git a/src/test/mir-opt/match_test.main.SimplifyCfg-initial.after.mir b/src/test/mir-opt/match_test.main.SimplifyCfg-initial.after.mir index b184ffc404e..d51dbf4258c 100644 --- a/src/test/mir-opt/match_test.main.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/match_test.main.SimplifyCfg-initial.after.mir @@ -28,12 +28,12 @@ fn main() -> () { StorageLive(_3); // scope 2 at $DIR/match_test.rs:+6:5: +11:6 FakeRead(ForMatchedPlace(None), _1); // scope 2 at $DIR/match_test.rs:+6:11: +6:12 _6 = Le(const 0_i32, _1); // scope 2 at $DIR/match_test.rs:+7:9: +7:14 - switchInt(move _6) -> [false: bb4, otherwise: bb1]; // scope 2 at $DIR/match_test.rs:+7:9: +7:14 + switchInt(move _6) -> [0: bb4, otherwise: bb1]; // scope 2 at $DIR/match_test.rs:+7:9: +7:14 } bb1: { _7 = Lt(_1, const 10_i32); // scope 2 at $DIR/match_test.rs:+7:9: +7:14 - switchInt(move _7) -> [false: bb4, otherwise: bb2]; // scope 2 at $DIR/match_test.rs:+7:9: +7:14 + switchInt(move _7) -> [0: bb4, otherwise: bb2]; // scope 2 at $DIR/match_test.rs:+7:9: +7:14 } bb2: { @@ -47,12 +47,12 @@ fn main() -> () { bb4: { _4 = Le(const 10_i32, _1); // scope 2 at $DIR/match_test.rs:+8:9: +8:16 - switchInt(move _4) -> [false: bb7, otherwise: bb5]; // scope 2 at $DIR/match_test.rs:+8:9: +8:16 + switchInt(move _4) -> [0: bb7, otherwise: bb5]; // scope 2 at $DIR/match_test.rs:+8:9: +8:16 } bb5: { _5 = Le(_1, const 20_i32); // scope 2 at $DIR/match_test.rs:+8:9: +8:16 - switchInt(move _5) -> [false: bb7, otherwise: bb6]; // scope 2 at $DIR/match_test.rs:+8:9: +8:16 + switchInt(move _5) -> [0: bb7, otherwise: bb6]; // scope 2 at $DIR/match_test.rs:+8:9: +8:16 } bb6: { @@ -60,7 +60,7 @@ fn main() -> () { } bb7: { - switchInt(_1) -> [-1_i32: bb8, otherwise: bb3]; // scope 2 at $DIR/match_test.rs:+6:5: +6:12 + switchInt(_1) -> [4294967295: bb8, otherwise: bb3]; // scope 2 at $DIR/match_test.rs:+6:5: +6:12 } bb8: { @@ -71,7 +71,7 @@ fn main() -> () { _8 = &shallow _1; // scope 2 at $DIR/match_test.rs:+6:11: +6:12 StorageLive(_9); // scope 2 at $DIR/match_test.rs:+7:18: +7:19 _9 = _2; // scope 2 at $DIR/match_test.rs:+7:18: +7:19 - switchInt(move _9) -> [false: bb11, otherwise: bb10]; // scope 2 at $DIR/match_test.rs:+7:18: +7:19 + switchInt(move _9) -> [0: bb11, otherwise: bb10]; // scope 2 at $DIR/match_test.rs:+7:18: +7:19 } bb10: { diff --git a/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff b/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff index f9eeb1ea5b9..be91b0bfe68 100644 --- a/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff +++ b/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff @@ -33,7 +33,7 @@ StorageLive(_4); // scope 2 at $DIR/matches_reduce_branches.rs:+3:9: +3:10 StorageLive(_5); // scope 3 at $DIR/matches_reduce_branches.rs:+4:9: +4:10 StorageLive(_6); // scope 4 at $DIR/matches_reduce_branches.rs:+6:5: +21:6 -- switchInt(_1) -> [7_i32: bb2, otherwise: bb1]; // scope 4 at $DIR/matches_reduce_branches.rs:+6:5: +6:12 +- switchInt(_1) -> [7: bb2, otherwise: bb1]; // scope 4 at $DIR/matches_reduce_branches.rs:+6:5: +6:12 - } - - bb1: { diff --git a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff index 0b40b3be8bd..aa8092ece66 100644 --- a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff +++ b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff @@ -11,12 +11,12 @@ bb0: { StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _3 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:+1:17: +1:20 -- switchInt(move _3) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_4); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _4 = move _3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _2 = Eq(_4, const 0_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_4); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -+ switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL ++ switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb1: { @@ -30,7 +30,7 @@ - } - - bb3: { -- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- switchInt(move _2) -> [0: bb5, otherwise: bb4]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb4: { diff --git a/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff b/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff index b8c7722cd37..193104dd30e 100644 --- a/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff +++ b/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff @@ -26,7 +26,7 @@ StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 _6 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 -- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 +- switchInt(move _6) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 - } - - bb1: { @@ -45,7 +45,7 @@ + _5 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+2:45: +2:50 + StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:+2:51: +2:52 -- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 +- switchInt(move _5) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 - } - - bb4: { @@ -64,7 +64,7 @@ + _4 = Ne(_8, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+2:69: +2:74 + StorageDead(_8); // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:+2:75: +2:76 -- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 +- switchInt(move _4) -> [0: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 - } - - bb7: { @@ -78,7 +78,7 @@ - } - - bb9: { -- switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 +- switchInt(move _3) -> [0: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 - } - - bb10: { diff --git a/src/test/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff b/src/test/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff index 1b4dddc1d43..3766d99a43b 100644 --- a/src/test/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff +++ b/src/test/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff @@ -8,7 +8,7 @@ bb0: { _2 = discriminant(_1); // scope 0 at $DIR/matches_u8.rs:+1:11: +1:12 - switchInt(move _2) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/matches_u8.rs:+1:5: +1:12 + switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/matches_u8.rs:+1:5: +1:12 } bb1: { diff --git a/src/test/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff b/src/test/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff index 6e734852e1a..b5146cd539f 100644 --- a/src/test/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff +++ b/src/test/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff @@ -8,7 +8,7 @@ bb0: { _2 = discriminant(_1); // scope 0 at $DIR/matches_u8.rs:+1:11: +1:12 - switchInt(move _2) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/matches_u8.rs:+1:5: +1:12 + switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/matches_u8.rs:+1:5: +1:12 } bb1: { diff --git a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir index 3e3fda6141a..8e6564a38b0 100644 --- a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir +++ b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir @@ -62,7 +62,7 @@ fn main() -> () { FakeRead(ForLet(None), _6); // bb1[4]: scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10 StorageLive(_7); // bb1[5]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12 _7 = const ConstValue(Scalar(0x01): bool); // bb1[6]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12 - switchInt(move _7) -> [ConstValue(Scalar(0x00): bool): bb4, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12 + switchInt(move _7) -> [0: bb4, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12 } bb2: { diff --git a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir index 39a53702a4c..74d44c6741a 100644 --- a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir +++ b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir @@ -62,7 +62,7 @@ fn main() -> () { FakeRead(ForLet(None), _6); // bb1[4]: scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10 StorageLive(_7); // bb1[5]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12 _7 = const ConstValue(Scalar(0x01): bool); // bb1[6]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12 - switchInt(move _7) -> [ConstValue(Scalar(0x00): bool): bb4, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12 + switchInt(move _7) -> [0: bb4, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region_subtyping_basic.rs:+4:8: +4:12 } bb2: { diff --git a/src/test/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir index e708255cea4..69327b7afac 100644 --- a/src/test/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.mir @@ -15,7 +15,7 @@ fn unwrap(_1: Option<T>) -> T { bb0: { _2 = discriminant(_1); // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+1:11: +1:14 - switchInt(move _2) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+1:5: +1:14 + switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 0 at $DIR/no_drop_for_inactive_variant.rs:+1:5: +1:14 } bb1: { diff --git a/src/test/mir-opt/not_equal_false.opt.InstCombine.diff b/src/test/mir-opt/not_equal_false.opt.InstCombine.diff index 5009d090668..b558c35ac1e 100644 --- a/src/test/mir-opt/not_equal_false.opt.InstCombine.diff +++ b/src/test/mir-opt/not_equal_false.opt.InstCombine.diff @@ -14,7 +14,7 @@ - _2 = Ne(move _3, const false); // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 + _2 = move _3; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 StorageDead(_3); // scope 0 at $DIR/not_equal_false.rs:+1:17: +1:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 } bb1: { diff --git a/src/test/mir-opt/remove_fake_borrows.match_guard.CleanupNonCodegenStatements.diff b/src/test/mir-opt/remove_fake_borrows.match_guard.CleanupNonCodegenStatements.diff index 243a54b6a84..bb5920b28ca 100644 --- a/src/test/mir-opt/remove_fake_borrows.match_guard.CleanupNonCodegenStatements.diff +++ b/src/test/mir-opt/remove_fake_borrows.match_guard.CleanupNonCodegenStatements.diff @@ -16,7 +16,7 @@ - FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 + nop; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 _3 = discriminant(_1); // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 - switchInt(move _3) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/remove_fake_borrows.rs:+1:5: +1:12 + switchInt(move _3) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/remove_fake_borrows.rs:+1:5: +1:12 } bb1: { @@ -25,7 +25,7 @@ } bb2: { - switchInt((*(*((_1 as Some).0: &&i32)))) -> [0_i32: bb3, otherwise: bb1]; // scope 0 at $DIR/remove_fake_borrows.rs:+1:5: +1:12 + switchInt((*(*((_1 as Some).0: &&i32)))) -> [0: bb3, otherwise: bb1]; // scope 0 at $DIR/remove_fake_borrows.rs:+1:5: +1:12 } bb3: { @@ -43,7 +43,7 @@ + nop; // scope 0 at $DIR/remove_fake_borrows.rs:+1:11: +1:12 StorageLive(_8); // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 _8 = _2; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 - switchInt(move _8) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 + switchInt(move _8) -> [0: bb6, otherwise: bb5]; // scope 0 at $DIR/remove_fake_borrows.rs:+2:20: +2:21 } bb5: { diff --git a/src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff b/src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff index 188aa556490..ed1d0b87f60 100644 --- a/src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff +++ b/src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff @@ -63,7 +63,7 @@ bb3: { - StorageDead(_8); // scope 2 at $DIR/remove_storage_markers.rs:+2:18: +2:19 _10 = discriminant(_7); // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 - switchInt(move _10) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 + switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 2 at $DIR/remove_storage_markers.rs:+2:14: +2:19 } bb4: { diff --git a/src/test/mir-opt/remove_zsts.get_union.PreCodegen.after.mir b/src/test/mir-opt/remove_zsts.get_union.PreCodegen.after.mir new file mode 100644 index 00000000000..12e914e25e0 --- /dev/null +++ b/src/test/mir-opt/remove_zsts.get_union.PreCodegen.after.mir @@ -0,0 +1,10 @@ +// MIR for `get_union` after PreCodegen + +fn get_union() -> Foo { + let mut _0: Foo; // return place in scope 0 at $DIR/remove_zsts.rs:+0:19: +0:22 + + bb0: { + Deinit(_0); // scope 0 at $DIR/remove_zsts.rs:+1:5: +1:18 + return; // scope 0 at $DIR/remove_zsts.rs:+2:2: +2:2 + } +} diff --git a/src/test/mir-opt/remove_zsts.get_union.RemoveZsts.diff b/src/test/mir-opt/remove_zsts.get_union.RemoveZsts.diff new file mode 100644 index 00000000000..169b7b1054b --- /dev/null +++ b/src/test/mir-opt/remove_zsts.get_union.RemoveZsts.diff @@ -0,0 +1,19 @@ +- // MIR for `get_union` before RemoveZsts ++ // MIR for `get_union` after RemoveZsts + + fn get_union() -> Foo { + let mut _0: Foo; // return place in scope 0 at $DIR/remove_zsts.rs:+0:19: +0:22 + let mut _1: (); // in scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16 + + bb0: { + StorageLive(_1); // scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16 +- Deinit(_1); // scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16 ++ nop; // scope 0 at $DIR/remove_zsts.rs:+1:14: +1:16 + Deinit(_0); // scope 0 at $DIR/remove_zsts.rs:+1:5: +1:18 +- (_0.0: ()) = move _1; // scope 0 at $DIR/remove_zsts.rs:+1:5: +1:18 ++ nop; // scope 0 at $DIR/remove_zsts.rs:+1:5: +1:18 + StorageDead(_1); // scope 0 at $DIR/remove_zsts.rs:+1:17: +1:18 + return; // scope 0 at $DIR/remove_zsts.rs:+2:2: +2:2 + } + } + diff --git a/src/test/mir-opt/remove_zsts.rs b/src/test/mir-opt/remove_zsts.rs new file mode 100644 index 00000000000..1cf7ad6e366 --- /dev/null +++ b/src/test/mir-opt/remove_zsts.rs @@ -0,0 +1,14 @@ +union Foo { + x: (), + y: u64, +} + +// EMIT_MIR remove_zsts.get_union.RemoveZsts.diff +// EMIT_MIR remove_zsts.get_union.PreCodegen.after.mir +fn get_union() -> Foo { + Foo { x: () } +} + +fn main() { + get_union(); +} diff --git a/src/test/mir-opt/remove_zsts_dont_touch_unions.get_union.RemoveZsts.after.mir b/src/test/mir-opt/remove_zsts_dont_touch_unions.get_union.RemoveZsts.after.mir deleted file mode 100644 index 7d9e6046202..00000000000 --- a/src/test/mir-opt/remove_zsts_dont_touch_unions.get_union.RemoveZsts.after.mir +++ /dev/null @@ -1,15 +0,0 @@ -// MIR for `get_union` after RemoveZsts - -fn get_union() -> Foo { - let mut _0: Foo; // return place in scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:+0:19: +0:22 - let mut _1: (); // in scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:+1:14: +1:16 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:+1:14: +1:16 - nop; // scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:+1:14: +1:16 - Deinit(_0); // scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:+1:5: +1:18 - (_0.0: ()) = move _1; // scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:+1:5: +1:18 - StorageDead(_1); // scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:+1:17: +1:18 - return; // scope 0 at $DIR/remove_zsts_dont_touch_unions.rs:+2:2: +2:2 - } -} diff --git a/src/test/mir-opt/remove_zsts_dont_touch_unions.rs b/src/test/mir-opt/remove_zsts_dont_touch_unions.rs deleted file mode 100644 index 8b9de9b4d65..00000000000 --- a/src/test/mir-opt/remove_zsts_dont_touch_unions.rs +++ /dev/null @@ -1,19 +0,0 @@ -// unit-test: RemoveZsts - -// Ensure RemoveZsts doesn't remove ZST assignments to union fields, -// which causes problems in Miri. - -union Foo { - x: (), - y: u64, -} - -// EMIT_MIR remove_zsts_dont_touch_unions.get_union.RemoveZsts.after.mir -fn get_union() -> Foo { - Foo { x: () } -} - - -fn main() { - get_union(); -} diff --git a/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir index fe57e32a7ac..19b726e7484 100644 --- a/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir @@ -68,9 +68,7 @@ fn array_casts() -> () { StorageLive(_3); // scope 1 at $DIR/retag.rs:+2:13: +2:19 StorageLive(_4); // scope 1 at $DIR/retag.rs:+2:13: +2:19 _4 = &mut _1; // scope 1 at $DIR/retag.rs:+2:13: +2:19 - Retag(_4); // scope 1 at $DIR/retag.rs:+2:13: +2:19 _3 = &raw mut (*_4); // scope 1 at $DIR/retag.rs:+2:13: +2:19 - Retag([raw] _3); // scope 1 at $DIR/retag.rs:+2:13: +2:19 _2 = move _3 as *mut usize (Pointer(ArrayToPointer)); // scope 1 at $DIR/retag.rs:+2:13: +2:33 StorageDead(_3); // scope 1 at $DIR/retag.rs:+2:32: +2:33 StorageDead(_4); // scope 1 at $DIR/retag.rs:+2:33: +2:34 @@ -96,9 +94,7 @@ fn array_casts() -> () { StorageLive(_10); // scope 4 at $DIR/retag.rs:+6:13: +6:15 StorageLive(_11); // scope 4 at $DIR/retag.rs:+6:13: +6:15 _11 = &_8; // scope 4 at $DIR/retag.rs:+6:13: +6:15 - Retag(_11); // scope 4 at $DIR/retag.rs:+6:13: +6:15 _10 = &raw const (*_11); // scope 4 at $DIR/retag.rs:+6:13: +6:15 - Retag([raw] _10); // scope 4 at $DIR/retag.rs:+6:13: +6:15 _9 = move _10 as *const usize (Pointer(ArrayToPointer)); // scope 4 at $DIR/retag.rs:+6:13: +6:31 StorageDead(_10); // scope 4 at $DIR/retag.rs:+6:30: +6:31 StorageDead(_11); // scope 4 at $DIR/retag.rs:+6:31: +6:32 @@ -119,7 +115,6 @@ fn array_casts() -> () { StorageDead(_17); // scope 6 at $DIR/retag.rs:+7:33: +7:34 _15 = (*_16); // scope 6 at $DIR/retag.rs:+7:25: +7:34 _14 = &_15; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_14); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _35 = const _; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant @@ -127,7 +122,6 @@ fn array_casts() -> () { // + literal: Const { ty: &usize, val: Unevaluated(array_casts, [], Some(promoted[0])) } Retag(_35); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _18 = &(*_35); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL Deinit(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_13.0: &usize) = move _14; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_13.1: &usize) = move _18; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -151,7 +145,7 @@ fn array_casts() -> () { StorageDead(_24); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _22 = Not(move _23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _22) -> [false: bb4, otherwise: bb3]; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _22) -> [0: bb4, otherwise: bb3]; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb3: { @@ -164,15 +158,11 @@ fn array_casts() -> () { StorageLive(_30); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _31 = &(*_20); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _30 = &(*_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_30); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_32); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _33 = &(*_21); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _32 = &(*_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_32); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL Deinit(_34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL discriminant(_34) = 0; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/src/test/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir b/src/test/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir index cdc413c568f..14f297e948b 100644 --- a/src/test/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir +++ b/src/test/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.mir @@ -6,7 +6,6 @@ fn std::ptr::drop_in_place(_1: *mut Test) -> () { let mut _3: (); // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 bb0: { - Retag([raw] _1); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 _2 = &mut (*_1); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 _3 = <Test as Drop>::drop(move _2) -> bb1; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 // mir::Constant diff --git a/src/test/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir index 96fc7e6493a..9e5c119a2b2 100644 --- a/src/test/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag.main-{closure#0}.SimplifyCfg-elaborate-drops.after.mir @@ -15,7 +15,6 @@ fn main::{closure#0}(_1: &[closure@main::{closure#0}], _2: &i32) -> &i32 { _3 = _2; // scope 0 at $DIR/retag.rs:+1:18: +1:19 Retag(_3); // scope 0 at $DIR/retag.rs:+1:18: +1:19 _0 = &(*_2); // scope 1 at $DIR/retag.rs:+2:9: +2:10 - Retag(_0); // scope 1 at $DIR/retag.rs:+2:9: +2:10 StorageDead(_3); // scope 0 at $DIR/retag.rs:+3:5: +3:6 return; // scope 0 at $DIR/retag.rs:+3:6: +3:6 } diff --git a/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir index 81225b44ebf..b853e450541 100644 --- a/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.mir @@ -65,13 +65,10 @@ fn main() -> () { Deinit(_5); // scope 1 at $DIR/retag.rs:+3:17: +3:24 (_5.0: i32) = const 0_i32; // scope 1 at $DIR/retag.rs:+3:17: +3:24 _4 = &_5; // scope 1 at $DIR/retag.rs:+3:17: +3:36 - Retag(_4); // scope 1 at $DIR/retag.rs:+3:17: +3:36 StorageLive(_6); // scope 1 at $DIR/retag.rs:+3:29: +3:35 StorageLive(_7); // scope 1 at $DIR/retag.rs:+3:29: +3:35 _7 = &mut _1; // scope 1 at $DIR/retag.rs:+3:29: +3:35 - Retag(_7); // scope 1 at $DIR/retag.rs:+3:29: +3:35 _6 = &mut (*_7); // scope 1 at $DIR/retag.rs:+3:29: +3:35 - Retag([2phase] _6); // scope 1 at $DIR/retag.rs:+3:29: +3:35 _3 = Test::foo(move _4, move _6) -> [return: bb1, unwind: bb8]; // scope 1 at $DIR/retag.rs:+3:17: +3:36 // mir::Constant // + span: $DIR/retag.rs:33:25: 33:28 @@ -93,7 +90,6 @@ fn main() -> () { _9 = move _3; // scope 2 at $DIR/retag.rs:+4:19: +4:20 Retag(_9); // scope 2 at $DIR/retag.rs:+4:19: +4:20 _8 = &mut (*_9); // scope 2 at $DIR/retag.rs:+4:19: +4:20 - Retag(_8); // scope 2 at $DIR/retag.rs:+4:19: +4:20 StorageDead(_9); // scope 2 at $DIR/retag.rs:+4:22: +4:23 StorageLive(_10); // scope 3 at $DIR/retag.rs:+5:13: +5:14 _10 = move _8; // scope 3 at $DIR/retag.rs:+5:17: +5:18 @@ -101,7 +97,6 @@ fn main() -> () { StorageLive(_11); // scope 4 at $DIR/retag.rs:+7:13: +7:15 StorageLive(_12); // scope 4 at $DIR/retag.rs:+7:18: +7:29 _12 = &raw mut (*_10); // scope 4 at $DIR/retag.rs:+7:18: +7:19 - Retag([raw] _12); // scope 4 at $DIR/retag.rs:+7:18: +7:19 _11 = _12; // scope 4 at $DIR/retag.rs:+7:18: +7:29 StorageDead(_12); // scope 4 at $DIR/retag.rs:+7:29: +7:30 _2 = const (); // scope 1 at $DIR/retag.rs:+2:5: +8:6 @@ -122,9 +117,7 @@ fn main() -> () { StorageLive(_17); // scope 6 at $DIR/retag.rs:+15:16: +15:18 StorageLive(_18); // scope 6 at $DIR/retag.rs:+15:16: +15:18 _18 = &_1; // scope 6 at $DIR/retag.rs:+15:16: +15:18 - Retag(_18); // scope 6 at $DIR/retag.rs:+15:16: +15:18 _17 = &(*_18); // scope 6 at $DIR/retag.rs:+15:16: +15:18 - Retag(_17); // scope 6 at $DIR/retag.rs:+15:16: +15:18 _15 = move _16(move _17) -> bb3; // scope 6 at $DIR/retag.rs:+15:14: +15:19 } @@ -139,7 +132,6 @@ fn main() -> () { Deinit(_21); // scope 7 at $DIR/retag.rs:+18:5: +18:12 (_21.0: i32) = const 0_i32; // scope 7 at $DIR/retag.rs:+18:5: +18:12 _20 = &_21; // scope 7 at $DIR/retag.rs:+18:5: +18:24 - Retag(_20); // scope 7 at $DIR/retag.rs:+18:5: +18:24 StorageLive(_22); // scope 7 at $DIR/retag.rs:+18:21: +18:23 StorageLive(_23); // scope 7 at $DIR/retag.rs:+18:21: +18:23 _28 = const _; // scope 7 at $DIR/retag.rs:+18:21: +18:23 @@ -148,9 +140,7 @@ fn main() -> () { // + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) } Retag(_28); // scope 7 at $DIR/retag.rs:+18:21: +18:23 _23 = &(*_28); // scope 7 at $DIR/retag.rs:+18:21: +18:23 - Retag(_23); // scope 7 at $DIR/retag.rs:+18:21: +18:23 _22 = &(*_23); // scope 7 at $DIR/retag.rs:+18:21: +18:23 - Retag(_22); // scope 7 at $DIR/retag.rs:+18:21: +18:23 _19 = Test::foo_shr(move _20, move _22) -> [return: bb4, unwind: bb7]; // scope 7 at $DIR/retag.rs:+18:5: +18:24 // mir::Constant // + span: $DIR/retag.rs:48:13: 48:20 @@ -171,7 +161,6 @@ fn main() -> () { StorageLive(_25); // scope 7 at $DIR/retag.rs:+21:9: +21:11 StorageLive(_26); // scope 7 at $DIR/retag.rs:+21:14: +21:28 _26 = &raw const (*_15); // scope 7 at $DIR/retag.rs:+21:14: +21:16 - Retag([raw] _26); // scope 7 at $DIR/retag.rs:+21:14: +21:16 _25 = _26; // scope 7 at $DIR/retag.rs:+21:14: +21:28 StorageDead(_26); // scope 7 at $DIR/retag.rs:+21:28: +21:29 StorageLive(_27); // scope 8 at $DIR/retag.rs:+23:5: +23:18 diff --git a/src/test/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir index 08fd655ae29..4b50205fa80 100644 --- a/src/test/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.mir @@ -11,9 +11,7 @@ fn <impl at $DIR/retag.rs:12:1: 12:10>::foo(_1: &Test, _2: &mut i32) -> &mut i32 Retag([fn entry] _2); // scope 0 at $DIR/retag.rs:+0:23: +0:24 StorageLive(_3); // scope 0 at $DIR/retag.rs:+1:9: +1:10 _3 = &mut (*_2); // scope 0 at $DIR/retag.rs:+1:9: +1:10 - Retag(_3); // scope 0 at $DIR/retag.rs:+1:9: +1:10 _0 = &mut (*_3); // scope 0 at $DIR/retag.rs:+1:9: +1:10 - Retag(_0); // scope 0 at $DIR/retag.rs:+1:9: +1:10 StorageDead(_3); // scope 0 at $DIR/retag.rs:+2:5: +2:6 return; // scope 0 at $DIR/retag.rs:+2:6: +2:6 } diff --git a/src/test/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff b/src/test/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff index f25b3ce724b..6ae16bdb5b8 100644 --- a/src/test/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff +++ b/src/test/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff @@ -22,9 +22,6 @@ let mut _18: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL scope 9 { debug e => _16; // in scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - scope 10 (inlined <i32 as From<i32>>::from) { // at $SRC_DIR/core/src/result.rs:LL:COL - debug t => _18; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL - } } } } @@ -56,14 +53,14 @@ StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 _4 = _1; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 _10 = discriminant(_4); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -- switchInt(move _10) -> [0_isize: bb7, 1_isize: bb5, otherwise: bb6]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -+ switchInt(move _10) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL +- switchInt(move _10) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL ++ switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL } bb1: { - StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 -- switchInt(move _5) -> [0_isize: bb2, 1_isize: bb4, otherwise: bb3]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 +- switchInt(move _5) -> [0: bb2, 1: bb4, otherwise: bb3]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - } - - bb2: { @@ -95,18 +92,11 @@ StorageLive(_17); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL StorageLive(_18); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL _18 = move _16; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - _17 = move _18; // scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL - StorageDead(_18); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - Deinit(_0); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - ((_0 as Err).0: i32) = move _17; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - discriminant(_0) = 1; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_17); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_16); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_8); // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10 - StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:10: +1:11 - StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:+2:1: +2:2 - return; // scope 0 at $DIR/separate_const_switch.rs:+2:2: +2:2 +- _17 = <i32 as From<i32>>::from(move _18) -> bb8; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL ++ _17 = <i32 as From<i32>>::from(move _18) -> bb7; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/result.rs:LL:COL + // + literal: Const { ty: fn(i32) -> i32 {<i32 as From<i32>>::from}, val: Value(<ZST>) } } - bb5: { @@ -128,7 +118,7 @@ - goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL + StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 + _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 -+ switchInt(move _5) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 ++ switchInt(move _5) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 } - bb6: { @@ -150,7 +140,22 @@ - goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL + StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 + _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 -+ switchInt(move _5) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 ++ switchInt(move _5) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 + } + +- bb8: { ++ bb7: { + StorageDead(_18); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL + Deinit(_0); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL + ((_0 as Err).0: i32) = move _17; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL + discriminant(_0) = 1; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL + StorageDead(_17); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL + StorageDead(_16); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + StorageDead(_8); // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10 + StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 + StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:10: +1:11 + StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:+2:1: +2:2 + return; // scope 0 at $DIR/separate_const_switch.rs:+2:2: +2:2 } } diff --git a/src/test/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff b/src/test/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff index 43797908136..8cc0c6a1835 100644 --- a/src/test/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff +++ b/src/test/mir-opt/separate_const_switch.too_complex.SeparateConstSwitch.diff @@ -30,7 +30,7 @@ bb0: { StorageLive(_2); // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 _3 = discriminant(_1); // scope 0 at $DIR/separate_const_switch.rs:+6:15: +6:16 - switchInt(move _3) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+6:9: +6:16 + switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+6:9: +6:16 } bb1: { @@ -45,7 +45,7 @@ StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:+8:43: +8:44 - goto -> bb4; // scope 0 at $DIR/separate_const_switch.rs:+8:43: +8:44 + _8 = discriminant(_2); // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 -+ switchInt(move _8) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 0 at $DIR/separate_const_switch.rs:+5:5: +10:6 ++ switchInt(move _8) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 0 at $DIR/separate_const_switch.rs:+5:5: +10:6 } bb2: { @@ -67,8 +67,8 @@ - - bb4: { _8 = discriminant(_2); // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 -- switchInt(move _8) -> [0_isize: bb7, 1_isize: bb5, otherwise: bb6]; // scope 0 at $DIR/separate_const_switch.rs:+5:5: +10:6 -+ switchInt(move _8) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 0 at $DIR/separate_const_switch.rs:+5:5: +10:6 +- switchInt(move _8) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 0 at $DIR/separate_const_switch.rs:+5:5: +10:6 ++ switchInt(move _8) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 0 at $DIR/separate_const_switch.rs:+5:5: +10:6 } - bb5: { diff --git a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff index e068b81bc3b..8eb1aa1f3b3 100644 --- a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff +++ b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff @@ -25,9 +25,9 @@ } - bb3: { -- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17 +- switchInt(move _2) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17 + bb2: { -+ switchInt(move _2) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17 ++ switchInt(move _2) -> [0: bb4, otherwise: bb3]; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17 } - bb4: { diff --git a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff index f693798eb94..1e66b1f703e 100644 --- a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff +++ b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff @@ -26,7 +26,7 @@ } bb3: { - switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17 + switchInt(move _2) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/simplify_cfg.rs:+2:12: +2:17 } bb4: { diff --git a/src/test/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff b/src/test/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff index 9b1bea2704b..aea01147443 100644 --- a/src/test/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff +++ b/src/test/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff @@ -9,7 +9,7 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/simplify_if.rs:+1:8: +1:13 _1 = const false; // scope 0 at $DIR/simplify_if.rs:+1:8: +1:13 -- switchInt(const false) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/simplify_if.rs:+1:8: +1:13 +- switchInt(const false) -> [0: bb3, otherwise: bb1]; // scope 0 at $DIR/simplify_if.rs:+1:8: +1:13 + goto -> bb3; // scope 0 at $DIR/simplify_if.rs:+1:8: +1:13 } diff --git a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff index 8feddcef2ce..a2b55229303 100644 --- a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff @@ -29,12 +29,12 @@ StorageDead(_3); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:68: +1:69 StorageDead(_2); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:68: +1:69 _5 = discriminant((_1.0: std::option::Option<u8>)); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27 - switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27 + switchInt(move _5) -> [1: bb1, otherwise: bb3]; // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27 } bb1: { _4 = discriminant((_1.1: std::option::Option<T>)); // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27 - switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27 + switchInt(move _4) -> [0: bb2, otherwise: bb3]; // scope 1 at $DIR/simplify_locals_fixedpoint.rs:+1:12: +1:27 } bb2: { diff --git a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff index 6e7294003af..9ec138dd82f 100644 --- a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff @@ -18,7 +18,7 @@ - _5 = const false; // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+1:11: +1:12 - _5 = const true; // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+1:11: +1:12 _2 = discriminant(_1); // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+1:11: +1:12 - switchInt(move _2) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+1:5: +1:12 + switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_locals_removes_unused_discriminant_reads.rs:+1:5: +1:12 } bb1: { diff --git a/src/test/mir-opt/simplify_match.main.ConstProp.diff b/src/test/mir-opt/simplify_match.main.ConstProp.diff index e4f9a4c12d9..f00ac5716a7 100644 --- a/src/test/mir-opt/simplify_match.main.ConstProp.diff +++ b/src/test/mir-opt/simplify_match.main.ConstProp.diff @@ -16,8 +16,8 @@ - _1 = _2; // scope 1 at $DIR/simplify_match.rs:+1:28: +1:29 + _1 = const false; // scope 1 at $DIR/simplify_match.rs:+1:28: +1:29 StorageDead(_2); // scope 0 at $DIR/simplify_match.rs:+1:30: +1:31 -- switchInt(_1) -> [false: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_match.rs:+1:5: +1:31 -+ switchInt(const false) -> [false: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_match.rs:+1:5: +1:31 +- switchInt(_1) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_match.rs:+1:5: +1:31 ++ switchInt(const false) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_match.rs:+1:5: +1:31 } bb1: { diff --git a/src/test/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir b/src/test/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir index 31ccf14549c..391b00effac 100644 --- a/src/test/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir +++ b/src/test/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir @@ -37,7 +37,7 @@ fn std::ptr::drop_in_place(_1: *mut [String]) -> () { bb4 (cleanup): { _6 = Eq(_4, _3); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _6) -> [false: bb3, otherwise: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + switchInt(move _6) -> [0: bb3, otherwise: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 } bb5: { @@ -48,7 +48,7 @@ fn std::ptr::drop_in_place(_1: *mut [String]) -> () { bb6: { _8 = Eq(_4, _3); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _8) -> [false: bb5, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + switchInt(move _8) -> [0: bb5, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 } bb7: { @@ -68,7 +68,7 @@ fn std::ptr::drop_in_place(_1: *mut [String]) -> () { bb10 (cleanup): { _12 = Eq(_9, _10); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _12) -> [false: bb9, otherwise: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + switchInt(move _12) -> [0: bb9, otherwise: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 } bb11: { @@ -79,7 +79,7 @@ fn std::ptr::drop_in_place(_1: *mut [String]) -> () { bb12: { _14 = Eq(_9, _10); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _14) -> [false: bb11, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + switchInt(move _14) -> [0: bb11, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 } bb13: { @@ -96,6 +96,6 @@ fn std::ptr::drop_in_place(_1: *mut [String]) -> () { bb15: { _2 = SizeOf(std::string::String); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 _3 = Len((*_1)); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _2) -> [0_usize: bb8, otherwise: bb14]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 + switchInt(move _2) -> [0: bb8, otherwise: bb14]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 } } diff --git a/src/test/mir-opt/sroa.enums.ScalarReplacementOfAggregates.diff b/src/test/mir-opt/sroa.enums.ScalarReplacementOfAggregates.diff index 7c7e87c32a2..a5488c1ec7b 100644 --- a/src/test/mir-opt/sroa.enums.ScalarReplacementOfAggregates.diff +++ b/src/test/mir-opt/sroa.enums.ScalarReplacementOfAggregates.diff @@ -21,7 +21,7 @@ discriminant(_2) = 1; // scope 1 at $DIR/sroa.rs:+1:22: +1:29 StorageDead(_3); // scope 1 at $DIR/sroa.rs:+1:28: +1:29 _4 = discriminant(_2); // scope 1 at $DIR/sroa.rs:+1:12: +1:19 - switchInt(move _4) -> [1_isize: bb1, otherwise: bb2]; // scope 1 at $DIR/sroa.rs:+1:12: +1:19 + switchInt(move _4) -> [1: bb1, otherwise: bb2]; // scope 1 at $DIR/sroa.rs:+1:12: +1:19 } bb1: { diff --git a/src/test/mir-opt/try_identity_e2e.new.PreCodegen.after.mir b/src/test/mir-opt/try_identity_e2e.new.PreCodegen.after.mir index 30185f3ffab..b254bfeb7c9 100644 --- a/src/test/mir-opt/try_identity_e2e.new.PreCodegen.after.mir +++ b/src/test/mir-opt/try_identity_e2e.new.PreCodegen.after.mir @@ -26,7 +26,7 @@ fn new(_1: Result<T, E>) -> Result<T, E> { bb0: { StorageLive(_2); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10 _3 = discriminant(_1); // scope 0 at $DIR/try_identity_e2e.rs:+3:19: +3:20 - switchInt(move _3) -> [0_isize: bb2, 1_isize: bb1, otherwise: bb4]; // scope 0 at $DIR/try_identity_e2e.rs:+3:13: +3:20 + switchInt(move _3) -> [0: bb2, 1: bb1, otherwise: bb4]; // scope 0 at $DIR/try_identity_e2e.rs:+3:13: +3:20 } bb1: { @@ -35,7 +35,7 @@ fn new(_1: Result<T, E>) -> Result<T, E> { ((_2 as Break).0: E) = move _5; // scope 2 at $DIR/try_identity_e2e.rs:+5:27: +5:48 discriminant(_2) = 1; // scope 2 at $DIR/try_identity_e2e.rs:+5:27: +5:48 _6 = discriminant(_2); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10 - switchInt(move _6) -> [0_isize: bb5, 1_isize: bb3, otherwise: bb4]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +7:10 + switchInt(move _6) -> [0: bb5, 1: bb3, otherwise: bb4]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +7:10 } bb2: { @@ -44,7 +44,7 @@ fn new(_1: Result<T, E>) -> Result<T, E> { ((_2 as Continue).0: T) = move _4; // scope 1 at $DIR/try_identity_e2e.rs:+4:26: +4:50 discriminant(_2) = 0; // scope 1 at $DIR/try_identity_e2e.rs:+4:26: +4:50 _6 = discriminant(_2); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10 - switchInt(move _6) -> [0_isize: bb5, 1_isize: bb3, otherwise: bb4]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +7:10 + switchInt(move _6) -> [0: bb5, 1: bb3, otherwise: bb4]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +7:10 } bb3: { diff --git a/src/test/mir-opt/try_identity_e2e.old.PreCodegen.after.mir b/src/test/mir-opt/try_identity_e2e.old.PreCodegen.after.mir index 2a9c7408c66..cdbc0681cb8 100644 --- a/src/test/mir-opt/try_identity_e2e.old.PreCodegen.after.mir +++ b/src/test/mir-opt/try_identity_e2e.old.PreCodegen.after.mir @@ -15,7 +15,7 @@ fn old(_1: Result<T, E>) -> Result<T, E> { bb0: { _2 = discriminant(_1); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +2:16 - switchInt(move _2) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +2:16 + switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +2:16 } bb1: { diff --git a/src/test/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir b/src/test/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir index 4aa5ba007f1..39ec0527759 100644 --- a/src/test/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir +++ b/src/test/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir @@ -18,7 +18,7 @@ fn main() -> () { Deinit(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19 discriminant(_2) = 2; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19 _3 = discriminant(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19 - switchInt(move _3) -> [2_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:5: +1:19 + switchInt(move _3) -> [2: bb1, otherwise: bb2]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:5: +1:19 } bb1: { @@ -36,7 +36,7 @@ fn main() -> () { Deinit(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 discriminant(_7) = 0; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 _8 = discriminant(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 - switchInt(move _8) -> [4_isize: bb5, 5_isize: bb3, otherwise: bb4]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +7:19 + switchInt(move _8) -> [4: bb5, 5: bb3, otherwise: bb4]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +7:19 } bb2: { diff --git a/src/test/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff b/src/test/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff index c3d356aedb2..598413a1d82 100644 --- a/src/test/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff +++ b/src/test/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff @@ -19,8 +19,8 @@ Deinit(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19 discriminant(_2) = 2; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19 _3 = discriminant(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:11: +1:19 -- switchInt(move _3) -> [0_isize: bb3, 1_isize: bb4, 2_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:5: +1:19 -+ switchInt(move _3) -> [2_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:5: +1:19 +- switchInt(move _3) -> [0: bb3, 1: bb4, 2: bb1, otherwise: bb2]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:5: +1:19 ++ switchInt(move _3) -> [2: bb1, otherwise: bb2]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+1:5: +1:19 } bb1: { @@ -65,7 +65,7 @@ Deinit(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 discriminant(_7) = 0; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 _8 = discriminant(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:11: +7:19 - switchInt(move _8) -> [4_isize: bb8, 5_isize: bb6, otherwise: bb7]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +7:19 + switchInt(move _8) -> [4: bb8, 5: bb6, otherwise: bb7]; // scope 0 at $DIR/uninhabited_enum_branching.rs:+7:5: +7:19 } bb6: { diff --git a/src/test/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir b/src/test/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir index ec5612ad767..c8cd6f6c1ea 100644 --- a/src/test/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir +++ b/src/test/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir @@ -32,7 +32,7 @@ fn main() -> () { StorageLive(_4); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22 _4 = &(_1.1: Test1); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22 _5 = discriminant((*_4)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22 - switchInt(move _5) -> [2_isize: bb3, 3_isize: bb1, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:5: +3:22 + switchInt(move _5) -> [2: bb3, 3: bb1, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:5: +3:22 } bb1: { @@ -66,7 +66,7 @@ fn main() -> () { StorageDead(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+8:6: +8:7 StorageLive(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +15:6 _10 = discriminant((_1.1: Test1)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:11: +10:21 - switchInt(move _10) -> [2_isize: bb7, 3_isize: bb5, otherwise: bb6]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21 + switchInt(move _10) -> [2: bb7, 3: bb5, otherwise: bb6]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21 } bb5: { diff --git a/src/test/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff b/src/test/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff index 77b358a4801..2aee6d2681d 100644 --- a/src/test/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff +++ b/src/test/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff @@ -33,8 +33,8 @@ StorageLive(_4); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22 _4 = &(_1.1: Test1); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22 _5 = discriminant((*_4)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:11: +3:22 -- switchInt(move _5) -> [0_isize: bb3, 1_isize: bb4, 2_isize: bb5, 3_isize: bb1, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:5: +3:22 -+ switchInt(move _5) -> [2_isize: bb5, 3_isize: bb1, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:5: +3:22 +- switchInt(move _5) -> [0: bb3, 1: bb4, 2: bb5, 3: bb1, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:5: +3:22 ++ switchInt(move _5) -> [2: bb5, 3: bb1, otherwise: bb2]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+3:5: +3:22 } bb1: { @@ -87,8 +87,8 @@ StorageDead(_3); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+8:6: +8:7 StorageLive(_9); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +15:6 _10 = discriminant((_1.1: Test1)); // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:11: +10:21 -- switchInt(move _10) -> [0_isize: bb9, 1_isize: bb10, 2_isize: bb11, 3_isize: bb7, otherwise: bb8]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21 -+ switchInt(move _10) -> [2_isize: bb11, 3_isize: bb7, otherwise: bb8]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21 +- switchInt(move _10) -> [0: bb9, 1: bb10, 2: bb11, 3: bb7, otherwise: bb8]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21 ++ switchInt(move _10) -> [2: bb11, 3: bb7, otherwise: bb8]; // scope 1 at $DIR/uninhabited_enum_branching2.rs:+10:5: +10:21 } bb7: { diff --git a/src/test/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff b/src/test/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff index 11d93fca7e0..58e085dd041 100644 --- a/src/test/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff +++ b/src/test/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff @@ -8,8 +8,8 @@ bb0: { _2 = discriminant(_1); // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:11: +1:12 -- switchInt(move _2) -> [1_isize: bb3, 2_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:5: +1:12 -+ switchInt(move _2) -> [1_isize: bb3, 2_isize: bb2, otherwise: bb5]; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:5: +1:12 +- switchInt(move _2) -> [1: bb3, 2: bb2, otherwise: bb1]; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:5: +1:12 ++ switchInt(move _2) -> [1: bb3, 2: bb2, otherwise: bb5]; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:5: +1:12 } bb1: { diff --git a/src/test/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff b/src/test/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff index a7f8321ae34..e765851eb78 100644 --- a/src/test/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff +++ b/src/test/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff @@ -8,8 +8,8 @@ bb0: { _2 = discriminant(_1); // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:11: +1:12 -- switchInt(move _2) -> [0_isize: bb2, 1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:5: +1:12 -+ switchInt(move _2) -> [1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:5: +1:12 +- switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1]; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:5: +1:12 ++ switchInt(move _2) -> [1: bb3, otherwise: bb1]; // scope 0 at $DIR/uninhabited_fallthrough_elimination.rs:+1:5: +1:12 } bb1: { diff --git a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff index 9cd4b8ccf33..848bff1d492 100644 --- a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff @@ -27,8 +27,8 @@ bb1: { _2 = discriminant(_1); // scope 1 at $DIR/unreachable.rs:+1:12: +1:20 -- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable.rs:+1:12: +1:20 -+ switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/unreachable.rs:+1:12: +1:20 +- switchInt(move _2) -> [1: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable.rs:+1:12: +1:20 ++ switchInt(move _2) -> [1: bb2, otherwise: bb3]; // scope 1 at $DIR/unreachable.rs:+1:12: +1:20 } bb2: { @@ -38,7 +38,7 @@ - StorageLive(_5); // scope 2 at $DIR/unreachable.rs:+4:9: +8:10 - StorageLive(_6); // scope 2 at $DIR/unreachable.rs:+4:12: +4:16 - _6 = const true; // scope 2 at $DIR/unreachable.rs:+4:12: +4:16 -- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable.rs:+4:12: +4:16 +- switchInt(move _6) -> [0: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable.rs:+4:12: +4:16 + unreachable; // scope 2 at $DIR/unreachable.rs:+4:12: +4:16 } diff --git a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff index afd6b00aac3..fb778470e53 100644 --- a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff @@ -29,7 +29,7 @@ bb1: { _3 = discriminant(_2); // scope 2 at $DIR/unreachable_diverging.rs:+2:12: +2:22 - switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 2 at $DIR/unreachable_diverging.rs:+2:12: +2:22 + switchInt(move _3) -> [1: bb2, otherwise: bb6]; // scope 2 at $DIR/unreachable_diverging.rs:+2:12: +2:22 } bb2: { @@ -38,7 +38,7 @@ StorageLive(_5); // scope 2 at $DIR/unreachable_diverging.rs:+3:9: +5:10 StorageLive(_6); // scope 2 at $DIR/unreachable_diverging.rs:+3:12: +3:13 _6 = _1; // scope 2 at $DIR/unreachable_diverging.rs:+3:12: +3:13 - switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable_diverging.rs:+3:12: +3:13 + switchInt(move _6) -> [0: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable_diverging.rs:+3:12: +3:13 } bb3: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff index eef7011149d..984ef476e10 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff @@ -24,13 +24,13 @@ Deinit(_3); // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32 discriminant(_3) = 0; // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32 - _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 +- switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 + _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 -+ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 ++ switchInt(const 0_isize) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 } bb1: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 + switchInt(((_3 as Some).0: u32)) -> [0: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 } bb2: { diff --git a/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir b/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir index 68aa3e5db32..1556c240dc5 100644 --- a/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir +++ b/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir @@ -24,7 +24,7 @@ fn while_loop(_1: bool) -> () { bb2: { StorageDead(_3); // scope 0 at $DIR/while_storage.rs:+1:21: +1:22 - switchInt(move _2) -> [false: bb7, otherwise: bb3]; // scope 0 at $DIR/while_storage.rs:+1:11: +1:22 + switchInt(move _2) -> [0: bb7, otherwise: bb3]; // scope 0 at $DIR/while_storage.rs:+1:11: +1:22 } bb3: { @@ -39,7 +39,7 @@ fn while_loop(_1: bool) -> () { bb4: { StorageDead(_5); // scope 0 at $DIR/while_storage.rs:+2:22: +2:23 - switchInt(move _4) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/while_storage.rs:+2:12: +2:23 + switchInt(move _4) -> [0: bb6, otherwise: bb5]; // scope 0 at $DIR/while_storage.rs:+2:12: +2:23 } bb5: { diff --git a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index 2c4309fbe66..3aa57d58908 100644 --- a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -67,7 +67,7 @@ impl CodegenBackend for TheBackend { if crate_type != CrateType::Rlib { sess.fatal(&format!("Crate type is {:?}", crate_type)); } - let output_name = out_filename(sess, crate_type, &outputs, &*crate_name.as_str()); + let output_name = out_filename(sess, crate_type, &outputs, crate_name); let mut out_file = ::std::fs::File::create(output_name).unwrap(); write!(out_file, "This has been \"compiled\" successfully.").unwrap(); } diff --git a/src/test/run-make/coverage-reports/Makefile b/src/test/run-make/coverage-reports/Makefile index 436aebf1174..d06cd9c6a54 100644 --- a/src/test/run-make/coverage-reports/Makefile +++ b/src/test/run-make/coverage-reports/Makefile @@ -80,7 +80,7 @@ ifdef RUSTC_BLESS_TEST rm -f expected_* endif -include clear_expected_if_blessed +-include clear_expected_if_blessed %: $(SOURCEDIR)/lib/%.rs # Compile the test library with coverage instrumentation diff --git a/src/test/run-make/issue-71519/Makefile b/src/test/run-make/issue-71519/Makefile index 16d9a56e6bf..57497f52053 100644 --- a/src/test/run-make/issue-71519/Makefile +++ b/src/test/run-make/issue-71519/Makefile @@ -2,6 +2,7 @@ include ../../run-make-fulldeps/tools.mk # ignore-msvc # needs-rust-lld +# ignore-s390x lld does not yet support s390x as target all: RUSTC_LOG=rustc_codegen_ssa::back::link=info $(RUSTC) -Z gcc-ld=lld -C link-args=-Wl,-v main.rs 2> $(TMPDIR)/output.txt $(CGREP) -e "^LLD [0-9]+\.[0-9]+\.[0-9]+" < $(TMPDIR)/output.txt diff --git a/src/test/run-make/macos-deployment-target/Makefile b/src/test/run-make/macos-deployment-target/Makefile new file mode 100644 index 00000000000..70fca043653 --- /dev/null +++ b/src/test/run-make/macos-deployment-target/Makefile @@ -0,0 +1,21 @@ +# only-macos +# +# Check that a set deployment target actually makes it to the linker. +# This is important since its a compatibility hazard. The linker will +# generate load commands differently based on what minimum OS it can assume. + +include ../../run-make-fulldeps/tools.mk + +ifeq ($(strip $(shell uname -m)),arm64) + GREP_PATTERN = "minos 11.0" +else + GREP_PATTERN = "version 10.9" +endif + +OUT_FILE=$(TMPDIR)/with_deployment_target.dylib +all: + env MACOSX_DEPLOYMENT_TARGET=10.9 $(RUSTC) with_deployment_target.rs -o $(OUT_FILE) +# XXX: The check is for either the x86_64 minimum OR the aarch64 minimum (M1 starts at macOS 11). +# They also use different load commands, so we let that change with each too. The aarch64 check +# isn't as robust as the x86 one, but testing both seems unneeded. + vtool -show-build $(OUT_FILE) | $(CGREP) -e $(GREP_PATTERN) diff --git a/src/test/run-make/macos-deployment-target/with_deployment_target.rs b/src/test/run-make/macos-deployment-target/with_deployment_target.rs new file mode 100644 index 00000000000..342fe0ecbcf --- /dev/null +++ b/src/test/run-make/macos-deployment-target/with_deployment_target.rs @@ -0,0 +1,4 @@ +#![crate_type = "cdylib"] + +#[allow(dead_code)] +fn something_and_nothing() {} diff --git a/src/test/rustdoc-gui/basic.goml b/src/test/rustdoc-gui/basic.goml deleted file mode 100644 index 60292835bc0..00000000000 --- a/src/test/rustdoc-gui/basic.goml +++ /dev/null @@ -1,4 +0,0 @@ -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -assert: ("#functions") -goto: "./struct.Foo.html" -assert: ("div.item-decl") diff --git a/src/test/rustdoc-gui/docblock-big-code-mobile.goml b/src/test/rustdoc-gui/docblock-big-code-mobile.goml index 9f8df44d762..3ce921c2c91 100644 --- a/src/test/rustdoc-gui/docblock-big-code-mobile.goml +++ b/src/test/rustdoc-gui/docblock-big-code-mobile.goml @@ -7,3 +7,7 @@ show-text: true // We need to enable text draw to be able to have the "real" siz // Little explanations for this test: if the text wasn't displayed on two lines, it would take // around 20px (which is the font size). assert-property: (".docblock p > code", {"offsetHeight": "44"}) + +// Same check, but where the long code block is also a link +goto: "file://" + |DOC_PATH| + "/test_docs/long_code_block_link/index.html" +assert-property: (".docblock p > a > code", {"offsetHeight": "44"}) diff --git a/src/test/rustdoc-gui/docblock-code-block-line-number.goml b/src/test/rustdoc-gui/docblock-code-block-line-number.goml index fec21ad35c3..b094c483876 100644 --- a/src/test/rustdoc-gui/docblock-code-block-line-number.goml +++ b/src/test/rustdoc-gui/docblock-code-block-line-number.goml @@ -33,7 +33,9 @@ assert-css: ("#settings", {"display": "block"}) click: "input#line-numbers" wait-for: 100 // wait-for-false does not exist assert-false: "pre.example-line-numbers" +assert-local-storage: {"rustdoc-line-numbers": "false" } // Finally, turn it on again. click: "input#line-numbers" wait-for: "pre.example-line-numbers" +assert-local-storage: {"rustdoc-line-numbers": "true" } diff --git a/src/test/rustdoc-gui/docblock-table.goml b/src/test/rustdoc-gui/docblock-table.goml index 4e316ce0bcb..8645c1b1949 100644 --- a/src/test/rustdoc-gui/docblock-table.goml +++ b/src/test/rustdoc-gui/docblock-table.goml @@ -2,3 +2,50 @@ goto: "file://" + |DOC_PATH| + "/test_docs/doc_block_table/struct.DocBlockTable. compare-elements-css: (".impl-items .docblock table th", ".top-doc .docblock table th", ["border"]) compare-elements-css: (".impl-items .docblock table td", ".top-doc .docblock table td", ["border"]) + +define-function: ( + "check-colors", + (theme, border_color, zebra_stripe_color), + [ + ("local-storage", {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}), + ("reload"), + ("assert-css", (".top-doc .docblock table tbody tr:nth-child(1)", { + "background-color": "rgba(0, 0, 0, 0)", + })), + ("assert-css", (".top-doc .docblock table tbody tr:nth-child(2)", { + "background-color": |zebra_stripe_color|, + })), + ("assert-css", (".top-doc .docblock table tbody tr:nth-child(3)", { + "background-color": "rgba(0, 0, 0, 0)", + })), + ("assert-css", (".top-doc .docblock table tbody tr:nth-child(4)", { + "background-color": |zebra_stripe_color|, + })), + ("assert-css", (".top-doc .docblock table td", { + "border-style": "solid", + "border-width": "1px", + "border-color": |border_color|, + })), + ("assert-css", (".top-doc .docblock table th", { + "border-style": "solid", + "border-width": "1px", + "border-color": |border_color|, + })), + ] +) + +call-function: ("check-colors", { + "theme": "dark", + "border_color": "rgb(224, 224, 224)", + "zebra_stripe_color": "rgb(42, 42, 42)", +}) +call-function: ("check-colors", { + "theme": "ayu", + "border_color": "rgb(92, 103, 115)", + "zebra_stripe_color": "rgb(25, 31, 38)", +}) +call-function: ("check-colors", { + "theme": "light", + "border_color": "rgb(224, 224, 224)", + "zebra_stripe_color": "rgb(245, 245, 245)", +}) diff --git a/src/test/rustdoc-gui/enum-variants.goml b/src/test/rustdoc-gui/enum-variants.goml index 230abb236bd..8dfc49285f2 100644 --- a/src/test/rustdoc-gui/enum-variants.goml +++ b/src/test/rustdoc-gui/enum-variants.goml @@ -3,3 +3,8 @@ goto: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html" assert-css: (".variants > .variant", {"margin": "0px 0px 12px"}) assert-css: (".variants > .docblock", {"margin": "0px 0px 32px 24px"}) + +assert-css: ( + "details.non-exhaustive > summary", + {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'}, +) diff --git a/src/test/rustdoc-gui/impl-doc.goml b/src/test/rustdoc-gui/impl-doc.goml new file mode 100644 index 00000000000..7322032b3f5 --- /dev/null +++ b/src/test/rustdoc-gui/impl-doc.goml @@ -0,0 +1,9 @@ +// A docblock on an impl must have a margin to separate it from the contents. +goto: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithImplDoc.html" + +// The text is about 24px tall, so if there's a margin, then their position will be >24px apart +compare-elements-position-near-false: ( + "#implementations-list > .implementors-toggle > .docblock > p", + "#implementations-list > .implementors-toggle > .impl-items", + {"y": 24} +) diff --git a/src/test/rustdoc-gui/method-margins.goml b/src/test/rustdoc-gui/method-margins.goml index 397bcd40b36..ed36bcdec17 100644 --- a/src/test/rustdoc-gui/method-margins.goml +++ b/src/test/rustdoc-gui/method-margins.goml @@ -1,3 +1,4 @@ +// This test ensures that the margins on methods are coherent inside an impl block. goto: "file://" + |DOC_PATH| + "/test_docs/trait_members/struct.HasTrait.html#impl-TraitMembers-for-HasTrait" assert-count: ("#trait-implementations-list > .rustdoc-toggle", 1) diff --git a/src/test/rustdoc-gui/scrape-examples-button-focus.goml b/src/test/rustdoc-gui/scrape-examples-button-focus.goml index 2a263a87a47..bba518db099 100644 --- a/src/test/rustdoc-gui/scrape-examples-button-focus.goml +++ b/src/test/rustdoc-gui/scrape-examples-button-focus.goml @@ -1,4 +1,19 @@ goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html" + +// The next/prev buttons vertically scroll the code viewport between examples +store-property: (initialScrollTop, ".scraped-example-list > .scraped-example pre", "scrollTop") +focus: ".scraped-example-list > .scraped-example .next" +press-key: "Enter" +assert-property-false: (".scraped-example-list > .scraped-example pre", { + "scrollTop": |initialScrollTop| +}) +focus: ".scraped-example-list > .scraped-example .prev" +press-key: "Enter" +assert-property: (".scraped-example-list > .scraped-example pre", { + "scrollTop": |initialScrollTop| +}) + +// The expand button increases the scrollHeight of the minimized code viewport store-property: (smallOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight") assert-property-false: (".scraped-example-list > .scraped-example pre", { "scrollHeight": |smallOffsetHeight| diff --git a/src/test/rustdoc-gui/scrape-examples-fonts.goml b/src/test/rustdoc-gui/scrape-examples-fonts.goml new file mode 100644 index 00000000000..b7d7f4ccb4a --- /dev/null +++ b/src/test/rustdoc-gui/scrape-examples-fonts.goml @@ -0,0 +1,8 @@ +goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" + +store-value: (font, '"Fira Sans", Arial, NanumBarunGothic, sans-serif') + +wait-for-css: (".scraped-example-title", {"font-family": |font|}) +wait-for-css: (".more-examples-toggle summary", {"font-family": |font|}) +wait-for-css: (".more-examples-toggle .hide-more", {"font-family": |font|}) +wait-for-css: (".example-links a", {"font-family": |font|}) diff --git a/src/test/rustdoc-gui/scrape-examples-toggle.goml b/src/test/rustdoc-gui/scrape-examples-toggle.goml new file mode 100644 index 00000000000..ee720afb788 --- /dev/null +++ b/src/test/rustdoc-gui/scrape-examples-toggle.goml @@ -0,0 +1,14 @@ +goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" + +// Clicking "More examples..." will open additional examples +assert-attribute-false: (".more-examples-toggle", {"open": ""}) +click: ".more-examples-toggle" +assert-attribute: (".more-examples-toggle", {"open": ""}) + +// Toggling all docs will close additional examples +click: "#toggle-all-docs" +assert-attribute-false: (".more-examples-toggle", {"open": ""}) + +// After re-opening the docs, the additional examples should stay closed +click: "#toggle-all-docs" +assert-attribute-false: (".more-examples-toggle", {"open": ""}) diff --git a/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-1.rs b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-1.rs new file mode 100644 index 00000000000..1d1bc5002aa --- /dev/null +++ b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-1.rs @@ -0,0 +1,3 @@ +fn main() { + scrape_examples::test_many(); +} diff --git a/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-2.rs b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-2.rs new file mode 100644 index 00000000000..1d1bc5002aa --- /dev/null +++ b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-2.rs @@ -0,0 +1,3 @@ +fn main() { + scrape_examples::test_many(); +} diff --git a/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-3.rs b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-3.rs new file mode 100644 index 00000000000..1d1bc5002aa --- /dev/null +++ b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-3.rs @@ -0,0 +1,3 @@ +fn main() { + scrape_examples::test_many(); +} diff --git a/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-4.rs b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-4.rs new file mode 100644 index 00000000000..1d1bc5002aa --- /dev/null +++ b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-4.rs @@ -0,0 +1,3 @@ +fn main() { + scrape_examples::test_many(); +} diff --git a/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-5.rs b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-5.rs new file mode 100644 index 00000000000..1d1bc5002aa --- /dev/null +++ b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-5.rs @@ -0,0 +1,3 @@ +fn main() { + scrape_examples::test_many(); +} diff --git a/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-6.rs b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-6.rs new file mode 100644 index 00000000000..1d1bc5002aa --- /dev/null +++ b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-6.rs @@ -0,0 +1,3 @@ +fn main() { + scrape_examples::test_many(); +} diff --git a/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-7.rs b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-7.rs new file mode 100644 index 00000000000..1d1bc5002aa --- /dev/null +++ b/src/test/rustdoc-gui/src/scrape_examples/examples/check-many-7.rs @@ -0,0 +1,3 @@ +fn main() { + scrape_examples::test_many(); +} diff --git a/src/test/rustdoc-gui/src/scrape_examples/examples/check.rs b/src/test/rustdoc-gui/src/scrape_examples/examples/check.rs index 3e69c6086ae..b3f682fe497 100644 --- a/src/test/rustdoc-gui/src/scrape_examples/examples/check.rs +++ b/src/test/rustdoc-gui/src/scrape_examples/examples/check.rs @@ -22,4 +22,5 @@ fn main() { println!("hello world!"); println!("hello world!"); } + scrape_examples::test(); } diff --git a/src/test/rustdoc-gui/src/scrape_examples/src/lib.rs b/src/test/rustdoc-gui/src/scrape_examples/src/lib.rs index 6412de2c03a..88b03cf2603 100644 --- a/src/test/rustdoc-gui/src/scrape_examples/src/lib.rs +++ b/src/test/rustdoc-gui/src/scrape_examples/src/lib.rs @@ -5,3 +5,5 @@ /// test(); /// ``` pub fn test() {} + +pub fn test_many() {} diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index dea154c9319..f1b69d4dc1d 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -76,6 +76,7 @@ impl AsRef<str> for Foo { /// /// # title! #[doc(alias = "ThisIsAnAlias")] +#[non_exhaustive] pub enum WhoLetTheDogOut { /// Woof! Woof, @@ -153,6 +154,11 @@ pub mod huge_amount_of_consts { /// Very long code text `hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`. pub mod long_code_block {} +/// Very long code text [`hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`][lnk]. +/// +/// [lnk]: crate::long_code_block_link +pub mod long_code_block_link {} + #[macro_export] macro_rules! repro { () => {}; @@ -342,6 +348,9 @@ pub mod doc_block_table { /// | header1 | header2 | /// |--------------------------|--------------------------| /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum | + /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum | + /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum | + /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum | pub struct DocBlockTable {} impl DocBlockTableTrait for DocBlockTable { @@ -438,3 +447,11 @@ pub mod trait_members { fn function2() {} } } + +pub struct TypeWithImplDoc; + +/// impl doc +impl TypeWithImplDoc { + /// fn doc + pub fn test_fn() {} +} diff --git a/src/test/rustdoc-gui/stab-badge.goml b/src/test/rustdoc-gui/stab-badge.goml new file mode 100644 index 00000000000..aaed8440a40 --- /dev/null +++ b/src/test/rustdoc-gui/stab-badge.goml @@ -0,0 +1,41 @@ +// All stability badges should have rounded corners and colored backgrounds. +goto: "file://" + |DOC_PATH| + "/test_docs/index.html" +show-text: true +define-function: ( + "check-badge", + (theme, background, color), + [ + ("local-storage", {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|}), + ("goto", "file://" + |DOC_PATH| + "/test_docs/index.html"), + ("assert", (".docblock .stab")), + ("assert", (".item-table .stab")), + ("assert-css", (".stab", { + "border-radius": "3px", + "color": |color|, + "background-color": |background|, + })), + ("goto", "file://" + |DOC_PATH| + "/test_docs/fn.replaced_function.html"), + ("assert", (".item-info .stab")), + ("assert-css", (".stab", { + "border-radius": "3px", + "color": |color|, + "background-color": |background|, + })), + ] +) + +call-function: ("check-badge", { + "theme": "ayu", + "color": "rgb(197, 197, 197)", + "background": "rgb(49, 69, 89)", +}) +call-function: ("check-badge", { + "theme": "dark", + "color": "rgb(221, 221, 221)", + "background": "rgb(49, 69, 89)", +}) +call-function: ("check-badge", { + "theme": "light", + "color": "rgb(0, 0, 0)", + "background": "rgb(255, 245, 214)", +}) diff --git a/src/test/rustdoc-gui/toggle-docs.goml b/src/test/rustdoc-gui/toggle-docs.goml index 8c9fd0a8866..45bb8daf1f2 100644 --- a/src/test/rustdoc-gui/toggle-docs.goml +++ b/src/test/rustdoc-gui/toggle-docs.goml @@ -7,6 +7,10 @@ wait-for: 50 // This is now collapsed so there shouldn't be the "open" attribute on details. assert-attribute-false: ("#main-content > details.top-doc", {"open": ""}) assert-text: ("#toggle-all-docs", "[+]") +assert-css: ( + "#main-content > details.top-doc > summary", + {"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'}, +) click: "#toggle-all-docs" // Not collapsed anymore so the "open" attribute should be back. wait-for-attribute: ("#main-content > details.top-doc", {"open": ""}) @@ -40,3 +44,32 @@ assert-attribute-false: ( click: "#toggle-all-docs" wait-for-text: ("#toggle-all-docs", "[−]") assert-attribute: ("details.rustdoc-toggle", {"open": ""}, ALL) + +// Checking the toggles style. +show-text: true +define-function: ( + "check-color", + (theme, filter), + [ + // Setting the theme. + ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}), + // We reload the page so the local storage settings are being used. + ("reload"), + + ("assert-css", ("details.rustdoc-toggle > summary::before", { + "opacity": "0.5", + "filter": |filter|, + }, ALL)), + ("move-cursor-to", "details.rustdoc-toggle summary"), + ("assert-css", ("details.rustdoc-toggle > summary:hover::before", { + "opacity": "1", + "filter": |filter|, + })), + // moving the cursor somewhere else to not mess with next function calls. + ("move-cursor-to", ".search-input"), + ] +) + +call-function: ("check-color", {"theme": "ayu", "filter": "invert(1)"}) +call-function: ("check-color", {"theme": "dark", "filter": "invert(1)"}) +call-function: ("check-color", {"theme": "light", "filter": "none"}) diff --git a/src/test/rustdoc-json/intra-doc-links/auxiliary/enum_variant_in_trait_method.rs b/src/test/rustdoc-json/intra-doc-links/auxiliary/enum_variant_in_trait_method.rs new file mode 100644 index 00000000000..bfe85f59e81 --- /dev/null +++ b/src/test/rustdoc-json/intra-doc-links/auxiliary/enum_variant_in_trait_method.rs @@ -0,0 +1,8 @@ +pub trait Trait { + /// [`Enum::Variant`] + fn method() {} +} + +pub enum Enum { + Variant, +} diff --git a/src/test/rustdoc-json/intra-doc-links/foreign_variant.rs b/src/test/rustdoc-json/intra-doc-links/foreign_variant.rs new file mode 100644 index 00000000000..e2968231338 --- /dev/null +++ b/src/test/rustdoc-json/intra-doc-links/foreign_variant.rs @@ -0,0 +1,13 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/105025> +// aux-build: enum_variant_in_trait_method.rs + +extern crate enum_variant_in_trait_method; + +pub struct Local; + +/// local impl +impl enum_variant_in_trait_method::Trait for Local {} + +// @!has "$.index[*][?(@.name == 'Trait')]" +// @!has "$.index[*][?(@.name == 'method')]" +// @count "$.index[*][?(@.docs == 'local impl')].inner.items[*]" 0 diff --git a/src/test/rustdoc-json/reexport/auxiliary/trait_with_docs.rs b/src/test/rustdoc-json/reexport/auxiliary/trait_with_docs.rs new file mode 100644 index 00000000000..1e87966b28a --- /dev/null +++ b/src/test/rustdoc-json/reexport/auxiliary/trait_with_docs.rs @@ -0,0 +1,2 @@ +/// The Docs +pub trait HasDocs {} diff --git a/src/test/rustdoc-json/reexport/synthesize_trait_with_docs.rs b/src/test/rustdoc-json/reexport/synthesize_trait_with_docs.rs new file mode 100644 index 00000000000..25a7c08d689 --- /dev/null +++ b/src/test/rustdoc-json/reexport/synthesize_trait_with_docs.rs @@ -0,0 +1,10 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/105022> +// aux-build: trait_with_docs.rs + +extern crate trait_with_docs; + +pub struct Local; + +impl trait_with_docs::HasDocs for Local {} + +// @!has "$.index[*][?(@.name == 'HasDocs')]" diff --git a/src/test/rustdoc-json/traits/uses_extern_trait.rs b/src/test/rustdoc-json/traits/uses_extern_trait.rs index a4add43c6a1..55a51f739ab 100644 --- a/src/test/rustdoc-json/traits/uses_extern_trait.rs +++ b/src/test/rustdoc-json/traits/uses_extern_trait.rs @@ -1,12 +1,5 @@ #![no_std] pub fn drop_default<T: core::default::Default>(_x: T) {} -// FIXME(adotinthevoid): Theses shouldn't be here -// @has "$.index[*][?(@.name=='Debug')]" - -// Debug may have several items. All we depend on here the that `fmt` is first. See -// https://github.com/rust-lang/rust/pull/104525#issuecomment-1331087852 for why we -// can't use [*]. - -// @set Debug_fmt = "$.index[*][?(@.name=='Debug')].inner.items[0]" -// @has "$.index[*][?(@.name=='fmt')].id" $Debug_fmt +// @!has "$.index[*][?(@.name=='Debug')]" +// @!has "$.index[*][?(@.name=='Default')]" diff --git a/src/test/rustdoc/const-evalutation-ice.rs b/src/test/rustdoc-ui/const-evalutation-ice.rs index 68c7f9c5686..0dd3bcaa289 100644 --- a/src/test/rustdoc/const-evalutation-ice.rs +++ b/src/test/rustdoc-ui/const-evalutation-ice.rs @@ -7,4 +7,5 @@ pub struct S { s: Cell<usize> } -pub const N: usize = 0 - (mem::size_of::<S>() != 4) as usize; +pub const N: usize = 0 - (mem::size_of::<S>() != 400) as usize; +//~^ ERROR evaluation of constant value failed diff --git a/src/test/rustdoc-ui/const-evalutation-ice.stderr b/src/test/rustdoc-ui/const-evalutation-ice.stderr new file mode 100644 index 00000000000..5d9c16c0765 --- /dev/null +++ b/src/test/rustdoc-ui/const-evalutation-ice.stderr @@ -0,0 +1,9 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/const-evalutation-ice.rs:10:22 + | +LL | pub const N: usize = 0 - (mem::size_of::<S>() != 400) as usize; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/rustdoc-ui/doc-cfg.stderr b/src/test/rustdoc-ui/doc-cfg.stderr index b379f6febe2..14b7b17e04d 100644 --- a/src/test/rustdoc-ui/doc-cfg.stderr +++ b/src/test/rustdoc-ui/doc-cfg.stderr @@ -2,7 +2,7 @@ error: `cfg` predicate is not specified --> $DIR/doc-cfg.rs:3:7 | LL | #[doc(cfg(), cfg(foo, bar))] - | ^^^^^ + | ^^^^^ help: expected syntax is: `cfg(/* predicate */)` error: multiple `cfg` predicates are specified --> $DIR/doc-cfg.rs:3:23 @@ -14,7 +14,7 @@ error: `cfg` predicate is not specified --> $DIR/doc-cfg.rs:7:7 | LL | #[doc(cfg())] - | ^^^^^ + | ^^^^^ help: expected syntax is: `cfg(/* predicate */)` error: multiple `cfg` predicates are specified --> $DIR/doc-cfg.rs:8:16 diff --git a/src/test/rustdoc-ui/issue-91713.stdout b/src/test/rustdoc-ui/issue-91713.stdout index a19e452b459..16783524363 100644 --- a/src/test/rustdoc-ui/issue-91713.stdout +++ b/src/test/rustdoc-ui/issue-91713.stdout @@ -5,11 +5,9 @@ check_doc_test_visibility - run various visibility-related lints on doctests strip-priv-imports - strips all private import statements (`use`, `extern crate`) from a crate propagate-doc-cfg - propagates `#[doc(cfg(...))]` to child items collect-intra-doc-links - resolves intra-doc links -check-code-block-syntax - validates syntax inside Rust code blocks collect-trait-impls - retrieves trait impls for items in the crate calculate-doc-coverage - counts the number of items with and without documentation -check-invalid-html-tags - detects invalid HTML tags in doc comments - check-bare-urls - detects URLs that are not hyperlinks + run-lints - runs some of rustdoc's lints Default passes for rustdoc: collect-trait-impls @@ -18,10 +16,8 @@ check_doc_test_visibility strip-private (when not --document-private-items) strip-priv-imports (when --document-private-items) collect-intra-doc-links -check-code-block-syntax -check-invalid-html-tags propagate-doc-cfg - check-bare-urls + run-lints Passes run with `--show-coverage`: strip-hidden (when not --document-hidden-items) diff --git a/src/test/rustdoc-ui/unable-fulfill-trait.rs b/src/test/rustdoc-ui/unable-fulfill-trait.rs new file mode 100644 index 00000000000..70357082248 --- /dev/null +++ b/src/test/rustdoc-ui/unable-fulfill-trait.rs @@ -0,0 +1,13 @@ +// This test ensures that it's not crashing rustdoc. + +pub struct Foo<'a, 'b, T> { + field1: dyn Bar<'a, 'b,>, + //~^ ERROR + //~^^ ERROR +} + +pub trait Bar<'x, 's, U> + where U: 'x, + Self:'x, + Self:'s +{} diff --git a/src/test/rustdoc-ui/unable-fulfill-trait.stderr b/src/test/rustdoc-ui/unable-fulfill-trait.stderr new file mode 100644 index 00000000000..a16b5b6eb2f --- /dev/null +++ b/src/test/rustdoc-ui/unable-fulfill-trait.stderr @@ -0,0 +1,26 @@ +error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied + --> $DIR/unable-fulfill-trait.rs:4:17 + | +LL | field1: dyn Bar<'a, 'b,>, + | ^^^ expected 1 generic argument + | +note: trait defined here, with 1 generic parameter: `U` + --> $DIR/unable-fulfill-trait.rs:9:11 + | +LL | pub trait Bar<'x, 's, U> + | ^^^ - +help: add missing generic argument + | +LL | field1: dyn Bar<'a, 'b, U,>, + | +++ + +error[E0227]: ambiguous lifetime bound, explicit lifetime bound required + --> $DIR/unable-fulfill-trait.rs:4:13 + | +LL | field1: dyn Bar<'a, 'b,>, + | ^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0107, E0227. +For more information about an error, try `rustc --explain E0107`. diff --git a/src/test/rustdoc-ui/z-help.stdout b/src/test/rustdoc-ui/z-help.stdout index 22e37821322..94cf7b94241 100644 --- a/src/test/rustdoc-ui/z-help.stdout +++ b/src/test/rustdoc-ui/z-help.stdout @@ -77,6 +77,7 @@ -Z location-detail=val -- what location details should be tracked when using caller_location, either `none`, or a comma separated list of location details, for which valid options are `file`, `line`, and `column` (default: `file,line,column`) -Z ls=val -- list the symbols defined by a library crate (default: no) -Z macro-backtrace=val -- show macro backtraces (default: no) + -Z maximal-hir-to-mir-coverage=val -- save as much information as possible about the correspondence between MIR and HIR as source scopes (default: no) -Z merge-functions=val -- control the operation of the MergeFunctions LLVM pass, taking the same values as the target option of the same name -Z meta-stats=val -- gather metadata statistics (default: no) -Z mir-emit-retag=val -- emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 (default: no) @@ -90,7 +91,6 @@ -Z no-analysis=val -- parse and expand the source, but run no analysis -Z no-codegen=val -- run all passes except codegen; no output -Z no-generate-arange-section=val -- omit DWARF address ranges that give faster lookups - -Z no-interleave-lints=val -- execute lints separately; allows benchmarking individual lints -Z no-leak-check=val -- disable the 'leak check' for subtyping; unsound, but useful for tests -Z no-link=val -- compile without linking -Z no-parallel-llvm=val -- run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO) diff --git a/src/test/rustdoc/bounds-in-multiple-parts.rs b/src/test/rustdoc/bounds-in-multiple-parts.rs new file mode 100644 index 00000000000..279e3c14888 --- /dev/null +++ b/src/test/rustdoc/bounds-in-multiple-parts.rs @@ -0,0 +1,20 @@ +#![crate_name = "foo"] + +pub trait Eq {} +pub trait Eq2 {} + +// Checking that "where predicates" and "generics params" are merged. +// @has 'foo/trait.T.html' +// @has - "//*[@id='tymethod.f']/h4" "fn f<'a, 'b, 'c, T>()where Self: Eq, T: Eq + 'a, 'c: 'b + 'a," +pub trait T { + fn f<'a, 'b, 'c: 'a, T: Eq + 'a>() + where Self: Eq, Self: Eq, T: Eq, 'c: 'b; +} + +// Checking that a duplicated "where predicate" is removed. +// @has 'foo/trait.T2.html' +// @has - "//*[@id='tymethod.f']/h4" "fn f<T>()where Self: Eq + Eq2, T: Eq2 + Eq," +pub trait T2 { + fn f<T: Eq>() + where Self: Eq, Self: Eq2, T: Eq2; +} diff --git a/src/test/rustdoc/impl-parts.rs b/src/test/rustdoc/impl-parts.rs index 7b931727e44..90cbb77cb6b 100644 --- a/src/test/rustdoc/impl-parts.rs +++ b/src/test/rustdoc/impl-parts.rs @@ -6,7 +6,7 @@ pub auto trait AnAutoTrait {} pub struct Foo<T> { field: T } // @has impl_parts/struct.Foo.html '//*[@class="impl has-srclink"]//h3[@class="code-header"]' \ -// "impl<T: Clone> !AnAutoTrait for Foo<T>where T: Sync," +// "impl<T> !AnAutoTrait for Foo<T>where T: Sync + Clone," // @has impl_parts/trait.AnAutoTrait.html '//*[@id="implementors-list"]//h3[@class="code-header"]' \ -// "impl<T: Clone> !AnAutoTrait for Foo<T>where T: Sync," +// "impl<T> !AnAutoTrait for Foo<T>where T: Sync + Clone," impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync {} diff --git a/src/test/rustdoc/rfc-2632-const-trait-impl.rs b/src/test/rustdoc/rfc-2632-const-trait-impl.rs index 602ee1b1b1f..7ed9d6729b6 100644 --- a/src/test/rustdoc/rfc-2632-const-trait-impl.rs +++ b/src/test/rustdoc/rfc-2632-const-trait-impl.rs @@ -61,7 +61,7 @@ impl<T> S<T> { // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/a[@class="trait"]' 'Clone' // @!has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where"]' '~const' // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Clone' - pub const fn foo<B: ~const Clone + ~const Destruct>() + pub const fn foo<B, C: ~const Clone + ~const Destruct>() where B: ~const Clone + ~const Destruct, { diff --git a/src/test/rustdoc/toggle-trait-fn.rs b/src/test/rustdoc/toggle-trait-fn.rs index e41422ce7c5..0a1f088b9ab 100644 --- a/src/test/rustdoc/toggle-trait-fn.rs +++ b/src/test/rustdoc/toggle-trait-fn.rs @@ -4,6 +4,8 @@ // summary. Trait methods with no documentation should not be wrapped. // // @has foo/trait.Foo.html +// @has - '//details[@class="rustdoc-toggle"]//summary//h4[@class="code-header"]' 'type Item' +// @!has - '//details[@class="rustdoc-toggle"]//summary//h4[@class="code-header"]' 'type Item2' // @has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4[@class="code-header"]' 'is_documented()' // @!has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4[@class="code-header"]' 'not_documented()' // @has - '//details[@class="rustdoc-toggle method-toggle"]//*[@class="docblock"]' 'is_documented is documented' @@ -11,6 +13,11 @@ // @!has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4[@class="code-header"]' 'not_documented_optional()' // @has - '//details[@class="rustdoc-toggle method-toggle"]//*[@class="docblock"]' 'is_documented_optional is documented' pub trait Foo { + /// is documented + type Item; + + type Item2; + fn not_documented(); /// is_documented is documented diff --git a/src/test/rustdoc/whitespace-after-where-clause.enum.html b/src/test/rustdoc/whitespace-after-where-clause.enum.html index c74866f4a10..f7663e4616a 100644 --- a/src/test/rustdoc/whitespace-after-where-clause.enum.html +++ b/src/test/rustdoc/whitespace-after-where-clause.enum.html @@ -1,4 +1,4 @@ -<div class="item-decl"><pre class="rust enum"><code>pub enum Cow<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>>,</span>{ +<div class="item-decl"><pre class="rust enum"><code>pub enum Cow<'a, B><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ Borrowed(<a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a </a>B), Whatever(<a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>), }</code></pre></div> \ No newline at end of file diff --git a/src/test/rustdoc/whitespace-after-where-clause.struct.html b/src/test/rustdoc/whitespace-after-where-clause.struct.html index 1ba1367d20f..fa3f224e7ad 100644 --- a/src/test/rustdoc/whitespace-after-where-clause.struct.html +++ b/src/test/rustdoc/whitespace-after-where-clause.struct.html @@ -1,4 +1,4 @@ -<div class="item-decl"><pre class="rust struct"><code>pub struct Struct<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>>,</span>{ +<div class="item-decl"><pre class="rust struct"><code>pub struct Struct<'a, B><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ pub a: <a class="primitive" href="{{channel}}/std/primitive.reference.html">&'a </a>B, pub b: <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a>, }</code></pre></div> \ No newline at end of file diff --git a/src/test/rustdoc/whitespace-after-where-clause.union.html b/src/test/rustdoc/whitespace-after-where-clause.union.html index 0dfb6407d45..7bb177debc3 100644 --- a/src/test/rustdoc/whitespace-after-where-clause.union.html +++ b/src/test/rustdoc/whitespace-after-where-clause.union.html @@ -1,3 +1,3 @@ -<div class="item-decl"><pre class="rust union"><code>pub union Union<'a, B: ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>>,</span>{ +<div class="item-decl"><pre class="rust union"><code>pub union Union<'a, B><span class="where fmt-newline">where<br />    B: <a class="trait" href="trait.ToOwned.html" title="trait foo::ToOwned">ToOwned</a><dyn <a class="trait" href="{{channel}}/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>> + ?<a class="trait" href="{{channel}}/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + 'a,</span>{ /* private fields */ }</code></pre></div> \ No newline at end of file diff --git a/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.rs b/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.rs index 2cb1ed6fcb7..3f7429a5fcc 100644 --- a/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.rs +++ b/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.rs @@ -33,8 +33,7 @@ fn main() { TyKind::GeneratorWitness(..) => (), //~ ERROR usage of `ty::TyKind::<kind>` TyKind::Never => (), //~ ERROR usage of `ty::TyKind::<kind>` TyKind::Tuple(..) => (), //~ ERROR usage of `ty::TyKind::<kind>` - TyKind::Projection(..) => (), //~ ERROR usage of `ty::TyKind::<kind>` - TyKind::Opaque(..) => (), //~ ERROR usage of `ty::TyKind::<kind>` + TyKind::Alias(..) => (), //~ ERROR usage of `ty::TyKind::<kind>` TyKind::Param(..) => (), //~ ERROR usage of `ty::TyKind::<kind>` TyKind::Bound(..) => (), //~ ERROR usage of `ty::TyKind::<kind>` TyKind::Placeholder(..) => (), //~ ERROR usage of `ty::TyKind::<kind>` diff --git a/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr b/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr index 171f49087d6..1f49d6b6464 100644 --- a/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr +++ b/src/test/ui-fulldeps/internal-lints/ty_tykind_usage.stderr @@ -133,53 +133,47 @@ LL | TyKind::Tuple(..) => (), error: usage of `ty::TyKind::<kind>` --> $DIR/ty_tykind_usage.rs:36:9 | -LL | TyKind::Projection(..) => (), +LL | TyKind::Alias(..) => (), | ^^^^^^ help: try using `ty::<kind>` directly: `ty` error: usage of `ty::TyKind::<kind>` --> $DIR/ty_tykind_usage.rs:37:9 | -LL | TyKind::Opaque(..) => (), - | ^^^^^^ help: try using `ty::<kind>` directly: `ty` - -error: usage of `ty::TyKind::<kind>` - --> $DIR/ty_tykind_usage.rs:38:9 - | LL | TyKind::Param(..) => (), | ^^^^^^ help: try using `ty::<kind>` directly: `ty` error: usage of `ty::TyKind::<kind>` - --> $DIR/ty_tykind_usage.rs:39:9 + --> $DIR/ty_tykind_usage.rs:38:9 | LL | TyKind::Bound(..) => (), | ^^^^^^ help: try using `ty::<kind>` directly: `ty` error: usage of `ty::TyKind::<kind>` - --> $DIR/ty_tykind_usage.rs:40:9 + --> $DIR/ty_tykind_usage.rs:39:9 | LL | TyKind::Placeholder(..) => (), | ^^^^^^ help: try using `ty::<kind>` directly: `ty` error: usage of `ty::TyKind::<kind>` - --> $DIR/ty_tykind_usage.rs:41:9 + --> $DIR/ty_tykind_usage.rs:40:9 | LL | TyKind::Infer(..) => (), | ^^^^^^ help: try using `ty::<kind>` directly: `ty` error: usage of `ty::TyKind::<kind>` - --> $DIR/ty_tykind_usage.rs:42:9 + --> $DIR/ty_tykind_usage.rs:41:9 | LL | TyKind::Error(_) => (), | ^^^^^^ help: try using `ty::<kind>` directly: `ty` error: usage of `ty::TyKind::<kind>` - --> $DIR/ty_tykind_usage.rs:47:12 + --> $DIR/ty_tykind_usage.rs:46:12 | LL | if let TyKind::Int(int_ty) = kind {} | ^^^^^^ help: try using `ty::<kind>` directly: `ty` error: usage of `ty::TyKind` - --> $DIR/ty_tykind_usage.rs:49:24 + --> $DIR/ty_tykind_usage.rs:48:24 | LL | fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {} | ^^^^^^^^^^ @@ -187,7 +181,7 @@ LL | fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {} = help: try using `Ty` instead error: usage of `ty::TyKind` - --> $DIR/ty_tykind_usage.rs:51:37 + --> $DIR/ty_tykind_usage.rs:50:37 | LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> { | ^^^^^^^^^^^ @@ -195,7 +189,7 @@ LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> { = help: try using `Ty` instead error: usage of `ty::TyKind` - --> $DIR/ty_tykind_usage.rs:51:53 + --> $DIR/ty_tykind_usage.rs:50:53 | LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> { | ^^^^^^^^^^^ @@ -203,12 +197,12 @@ LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> { = help: try using `Ty` instead error: usage of `ty::TyKind::<kind>` - --> $DIR/ty_tykind_usage.rs:54:9 + --> $DIR/ty_tykind_usage.rs:53:9 | LL | IrTyKind::Bool | --------^^^^^^ | | | help: try using `ty::<kind>` directly: `ty` -error: aborting due to 33 previous errors +error: aborting due to 32 previous errors diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr b/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr index 981631494fa..82679c9e10a 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr @@ -1,11 +1,3 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> <crate attribute>:1:1 - | -LL | plugin(lint_plugin_test) - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - warning: item is named 'lintme' --> $DIR/lint-plugin-cmdline-load.rs:8:1 | @@ -14,5 +6,13 @@ LL | fn lintme() { } | = note: `#[warn(test_lint)]` on by default +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> <crate attribute>:1:1 + | +LL | plugin(lint_plugin_test) + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + warning: 2 warnings emitted diff --git a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr index b9774c04462..5e8891bf1f1 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr +++ b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr @@ -1,11 +1,3 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-deny-attr.rs:5:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - error: item is named 'lintme' --> $DIR/lint-plugin-deny-attr.rs:9:1 | @@ -18,5 +10,13 @@ note: the lint level is defined here LL | #![deny(test_lint)] | ^^^^^^^^^ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-deny-attr.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr index cbabb09f6a5..d5d6b535214 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr +++ b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr @@ -1,11 +1,3 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-deny-cmdline.rs:6:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - error: item is named 'lintme' --> $DIR/lint-plugin-deny-cmdline.rs:9:1 | @@ -14,5 +6,13 @@ LL | fn lintme() { } | = note: requested on the command line with `-D test-lint` +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-deny-cmdline.rs:6:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs index 4833f6971c1..cf31b3ec158 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs @@ -11,7 +11,6 @@ fn lintme() {} //~ ERROR item is named 'lintme' #[allow(test_lint)] //~^ ERROR allow(test_lint) incompatible //~| ERROR allow(test_lint) incompatible -//~| ERROR allow(test_lint) incompatible pub fn main() { lintme(); } diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr index e11a4f84493..ae34b25cc2f 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr @@ -7,23 +7,6 @@ LL | #![forbid(test_lint)] LL | #[allow(test_lint)] | ^^^^^^^^^ overruled by previous forbid -error[E0453]: allow(test_lint) incompatible with previous forbid - --> $DIR/lint-plugin-forbid-attrs.rs:11:9 - | -LL | #![forbid(test_lint)] - | --------- `forbid` level set here -... -LL | #[allow(test_lint)] - | ^^^^^^^^^ overruled by previous forbid - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-forbid-attrs.rs:5:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - error: item is named 'lintme' --> $DIR/lint-plugin-forbid-attrs.rs:9:1 | @@ -45,6 +28,14 @@ LL | #![forbid(test_lint)] LL | #[allow(test_lint)] | ^^^^^^^^^ overruled by previous forbid -error: aborting due to 4 previous errors; 1 warning emitted +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-forbid-attrs.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0453`. diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs index ce034ee38d7..b9d1aa85a69 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs @@ -9,7 +9,7 @@ fn lintme() { } //~ ERROR item is named 'lintme' #[allow(test_lint)] //~ ERROR allow(test_lint) incompatible //~| ERROR allow(test_lint) incompatible - //~| ERROR allow(test_lint) + pub fn main() { lintme(); } diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr index 09c19af617a..491c4d20646 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr @@ -6,22 +6,6 @@ LL | #[allow(test_lint)] | = note: `forbid` lint level was set on command line -error[E0453]: allow(test_lint) incompatible with previous forbid - --> $DIR/lint-plugin-forbid-cmdline.rs:10:9 - | -LL | #[allow(test_lint)] - | ^^^^^^^^^ overruled by previous forbid - | - = note: `forbid` lint level was set on command line - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-forbid-cmdline.rs:6:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - error: item is named 'lintme' --> $DIR/lint-plugin-forbid-cmdline.rs:8:1 | @@ -38,6 +22,14 @@ LL | #[allow(test_lint)] | = note: `forbid` lint level was set on command line -error: aborting due to 4 previous errors; 1 warning emitted +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-forbid-cmdline.rs:6:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0453`. diff --git a/src/test/ui-fulldeps/lint-plugin.stderr b/src/test/ui-fulldeps/lint-plugin.stderr index 765832071cb..dd5d3d72ecf 100644 --- a/src/test/ui-fulldeps/lint-plugin.stderr +++ b/src/test/ui-fulldeps/lint-plugin.stderr @@ -1,11 +1,3 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin.rs:5:1 - | -LL | #![plugin(lint_plugin_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - warning: item is named 'lintme' --> $DIR/lint-plugin.rs:8:1 | @@ -14,5 +6,13 @@ LL | fn lintme() { } | = note: `#[warn(test_lint)]` on by default +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + warning: 2 warnings emitted diff --git a/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr b/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr index b4fb9e22da4..b060e3a3e38 100644 --- a/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr +++ b/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr @@ -6,18 +6,6 @@ warning: lint name `test_lint` is deprecated and does not have an effect anymore | = note: requested on the command line with `-A test_lint` -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-tool-cmdline-allow.rs:7:1 - | -LL | #![plugin(lint_tool_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint - | - = note: requested on the command line with `-A test_lint` - warning: item is named 'lintme' --> $DIR/lint-tool-cmdline-allow.rs:9:1 | @@ -26,9 +14,17 @@ LL | fn lintme() {} | = note: `#[warn(clippy::test_lint)]` on by default +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-tool-cmdline-allow.rs:7:1 + | +LL | #![plugin(lint_tool_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint | = note: requested on the command line with `-A test_lint` -warning: 6 warnings emitted +warning: 5 warnings emitted diff --git a/src/test/ui-fulldeps/lint-tool-test.rs b/src/test/ui-fulldeps/lint-tool-test.rs index 0d04eb6fcfa..f92bcd213b8 100644 --- a/src/test/ui-fulldeps/lint-tool-test.rs +++ b/src/test/ui-fulldeps/lint-tool-test.rs @@ -10,12 +10,10 @@ //~^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future //~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future //~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future -//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future #![deny(clippy_group)] //~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future //~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future //~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future -//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future fn lintme() { } //~ ERROR item is named 'lintme' @@ -32,7 +30,6 @@ pub fn main() { //~^ WARNING lint name `test_group` is deprecated and may not have an effect in the future //~| WARNING lint name `test_group` is deprecated and may not have an effect in the future //~| WARNING lint name `test_group` is deprecated and may not have an effect in the future -//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future #[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist` fn hello() { fn lintmetoo() { } diff --git a/src/test/ui-fulldeps/lint-tool-test.stderr b/src/test/ui-fulldeps/lint-tool-test.stderr index af9b8dedc73..027cf8f80cf 100644 --- a/src/test/ui-fulldeps/lint-tool-test.stderr +++ b/src/test/ui-fulldeps/lint-tool-test.stderr @@ -7,13 +7,13 @@ LL | #![cfg_attr(foo, warn(test_lint))] = note: `#[warn(renamed_and_removed_lints)]` on by default warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:14:9 + --> $DIR/lint-tool-test.rs:13:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ help: change it to: `clippy::group` warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:31:9 + --> $DIR/lint-tool-test.rs:29:9 | LL | #[allow(test_group)] | ^^^^^^^^^^ help: change it to: `clippy::test_group` @@ -25,60 +25,26 @@ LL | #![cfg_attr(foo, warn(test_lint))] | ^^^^^^^^^ help: change it to: `clippy::test_lint` warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:14:9 - | -LL | #![deny(clippy_group)] - | ^^^^^^^^^^^^ help: change it to: `clippy::group` - -warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:31:9 - | -LL | #[allow(test_group)] - | ^^^^^^^^^^ help: change it to: `clippy::test_group` - -warning: unknown lint: `this_lint_does_not_exist` - --> $DIR/lint-tool-test.rs:36:8 - | -LL | #[deny(this_lint_does_not_exist)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(unknown_lints)]` on by default - -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-tool-test.rs:6:1 - | -LL | #![plugin(lint_tool_test)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default - -warning: lint name `test_lint` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:9:23 - | -LL | #![cfg_attr(foo, warn(test_lint))] - | ^^^^^^^^^ help: change it to: `clippy::test_lint` - -warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:14:9 + --> $DIR/lint-tool-test.rs:13:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ help: change it to: `clippy::group` error: item is named 'lintme' - --> $DIR/lint-tool-test.rs:20:1 + --> $DIR/lint-tool-test.rs:18:1 | LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/lint-tool-test.rs:14:9 + --> $DIR/lint-tool-test.rs:13:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ = note: `#[deny(clippy::test_lint)]` implied by `#[deny(clippy::group)]` error: item is named 'lintmetoo' - --> $DIR/lint-tool-test.rs:28:5 + --> $DIR/lint-tool-test.rs:26:5 | LL | fn lintmetoo() { } | ^^^^^^^^^^^^^^^^^^ @@ -86,11 +52,27 @@ LL | fn lintmetoo() { } = note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]` warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:31:9 + --> $DIR/lint-tool-test.rs:29:9 | LL | #[allow(test_group)] | ^^^^^^^^^^ help: change it to: `clippy::test_group` +warning: unknown lint: `this_lint_does_not_exist` + --> $DIR/lint-tool-test.rs:33:8 + | +LL | #[deny(this_lint_does_not_exist)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unknown_lints)]` on by default + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-tool-test.rs:6:1 + | +LL | #![plugin(lint_tool_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + warning: lint name `test_lint` is deprecated and may not have an effect in the future. --> $DIR/lint-tool-test.rs:9:23 | @@ -98,16 +80,16 @@ LL | #![cfg_attr(foo, warn(test_lint))] | ^^^^^^^^^ help: change it to: `clippy::test_lint` warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:14:9 + --> $DIR/lint-tool-test.rs:13:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ help: change it to: `clippy::group` warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:31:9 + --> $DIR/lint-tool-test.rs:29:9 | LL | #[allow(test_group)] | ^^^^^^^^^^ help: change it to: `clippy::test_group` -error: aborting due to 2 previous errors; 14 warnings emitted +error: aborting due to 2 previous errors; 11 warnings emitted diff --git a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs index d6dc179da7f..a93ba87470a 100644 --- a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs @@ -126,6 +126,7 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) { fn_decl: decl.clone(), body: e, fn_decl_span: DUMMY_SP, + fn_arg_span: DUMMY_SP, }))) }); } diff --git a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index d0be7be66b8..f39d32a221c 100644 --- a/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/src/test/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -674,10 +674,7 @@ LL | #[derive(Diagnostic)] = help: normalized in stderr note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:LL:CC - | -LL | arg: impl IntoDiagnosticArg, - | ^^^^^^^^^^^^^^^^^ required by this bound in `DiagnosticBuilder::<'a, G>::set_arg` - = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `Diagnostic` which comes from the expansion of the macro `forward` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 85 previous errors diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr index adb652fe616..2673ee9f937 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr @@ -17,9 +17,6 @@ LL | | } = note: struct `core::alloc::Layout` and struct `Layout` have similar names, but are actually distinct types note: struct `core::alloc::Layout` is defined in crate `core` --> $SRC_DIR/core/src/alloc/layout.rs:LL:COL - | -LL | pub struct Layout { - | ^^^^^^^^^^^^^^^^^ note: struct `Layout` is defined in the current crate --> $DIR/alloc-error-handler-bad-signature-2.rs:7:1 | diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr index bf5f642ca82..afb7f8fea92 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr +++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr @@ -13,6 +13,10 @@ note: required by a bound in `f1` | LL | fn f1<F>(_: F) where F: Fn(&(), &()) {} | ^^^^^^^^^^^^ required by this bound in `f1` +help: consider borrowing the argument + | +LL | f1(|_: &(), _: &()| {}); + | ~~~ ~~~ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:3:5 @@ -29,6 +33,10 @@ note: required by a bound in `f2` | LL | fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {} | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f2` +help: consider borrowing the argument + | +LL | f2(|_: &'a (), _: &()| {}); + | ~~~~~~ ~~~ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:4:5 @@ -45,6 +53,10 @@ note: required by a bound in `f3` | LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {} | ^^^^^^^^^^^^^^^ required by this bound in `f3` +help: consider borrowing the argument + | +LL | f3(|_: &(), _: &()| {}); + | ~~~ ~~~ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:5:5 @@ -61,6 +73,10 @@ note: required by a bound in `f4` | LL | fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f4` +help: consider borrowing the argument + | +LL | f4(|_: &(), _: &'r ()| {}); + | ~~~ ~~~~~~ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:6:5 @@ -77,13 +93,19 @@ note: required by a bound in `f5` | LL | fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f5` +help: consider borrowing the argument + | +LL | f5(|_: &'r (), _: &'r ()| {}); + | ~~~~~~ ~~~~~~ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:7:5 | LL | g1(|_: (), _: ()| {}); - | ^^ -------------- found signature defined here - | | + | ^^ -------------- + | | | | + | | | help: consider borrowing the argument: `&()` + | | found signature defined here | expected due to this | = note: expected closure signature `for<'a> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>) -> _` @@ -98,8 +120,10 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5 | LL | g2(|_: (), _: ()| {}); - | ^^ -------------- found signature defined here - | | + | ^^ -------------- + | | | | + | | | help: consider borrowing the argument: `&()` + | | found signature defined here | expected due to this | = note: expected closure signature `for<'a> fn(&'a (), for<'a> fn(&'a ())) -> _` @@ -114,8 +138,10 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:9:5 | LL | g3(|_: (), _: ()| {}); - | ^^ -------------- found signature defined here - | | + | ^^ -------------- + | | | | + | | | help: consider borrowing the argument: `&'s ()` + | | found signature defined here | expected due to this | = note: expected closure signature `for<'s> fn(&'s (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>) -> _` @@ -130,8 +156,10 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5 | LL | g4(|_: (), _: ()| {}); - | ^^ -------------- found signature defined here - | | + | ^^ -------------- + | | | | + | | | help: consider borrowing the argument: `&()` + | | found signature defined here | expected due to this | = note: expected closure signature `for<'a> fn(&'a (), for<'r> fn(&'r ())) -> _` @@ -157,6 +185,10 @@ note: required by a bound in `h1` | LL | fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h1` +help: consider borrowing the argument + | +LL | h1(|_: &(), _: (), _: &(), _: ()| {}); + | ~~~ ~~~ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 @@ -173,6 +205,10 @@ note: required by a bound in `h2` | LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), &())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h2` +help: consider borrowing the argument + | +LL | h2(|_: &(), _: (), _: &'t0 (), _: ()| {}); + | ~~~ ~~~~~~~ error: aborting due to 11 previous errors diff --git a/src/test/ui/array-slice-vec/infer_array_len.stderr b/src/test/ui/array-slice-vec/infer_array_len.stderr index 919550cac30..c2a509a1963 100644 --- a/src/test/ui/array-slice-vec/infer_array_len.stderr +++ b/src/test/ui/array-slice-vec/infer_array_len.stderr @@ -6,8 +6,8 @@ LL | let [_, _] = a.into(); | help: consider giving this pattern a type | -LL | let [_, _]: _ = a.into(); - | +++ +LL | let [_, _]: /* Type */ = a.into(); + | ++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/associated-consts/issue-47814.rs b/src/test/ui/associated-consts/issue-47814.rs new file mode 100644 index 00000000000..a28b1c00113 --- /dev/null +++ b/src/test/ui/associated-consts/issue-47814.rs @@ -0,0 +1,14 @@ +struct ArpIPv4<'a> { + s: &'a u8 +} + +impl<'a> ArpIPv4<'a> { + const LENGTH: usize = 20; + + pub fn to_buffer() -> [u8; Self::LENGTH] { + //~^ ERROR: generic `Self` types are currently not permitted in anonymous constants + unimplemented!() + } +} + +fn main() {} diff --git a/src/test/ui/associated-consts/issue-47814.stderr b/src/test/ui/associated-consts/issue-47814.stderr new file mode 100644 index 00000000000..2e4ddb81166 --- /dev/null +++ b/src/test/ui/associated-consts/issue-47814.stderr @@ -0,0 +1,14 @@ +error: generic `Self` types are currently not permitted in anonymous constants + --> $DIR/issue-47814.rs:8:32 + | +LL | pub fn to_buffer() -> [u8; Self::LENGTH] { + | ^^^^ + | +note: not a concrete type + --> $DIR/issue-47814.rs:5:10 + | +LL | impl<'a> ArpIPv4<'a> { + | ^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/associated-consts/issue-93835.rs b/src/test/ui/associated-consts/issue-93835.rs index 5c7b065983e..b2a437fcbfb 100644 --- a/src/test/ui/associated-consts/issue-93835.rs +++ b/src/test/ui/associated-consts/issue-93835.rs @@ -1,9 +1,11 @@ +#![feature(type_ascription)] + fn e() { - p:a<p:p<e=6>> - //~^ ERROR comparison operators + type_ascribe!(p, a<p:p<e=6>>); + //~^ ERROR cannot find type `a` in this scope //~| ERROR cannot find value //~| ERROR associated const equality - //~| ERROR associated const equality + //~| ERROR cannot find trait `p` in this scope //~| ERROR associated type bounds } diff --git a/src/test/ui/associated-consts/issue-93835.stderr b/src/test/ui/associated-consts/issue-93835.stderr index 0406a16a397..be0573a1301 100644 --- a/src/test/ui/associated-consts/issue-93835.stderr +++ b/src/test/ui/associated-consts/issue-93835.stderr @@ -1,65 +1,40 @@ -error: comparison operators cannot be chained - --> $DIR/issue-93835.rs:2:8 - | -LL | fn e() { - | - while parsing this struct -LL | p:a<p:p<e=6>> - | ^ ^ - | - = help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments - = help: or use `(...)` if you meant to specify fn arguments - error[E0425]: cannot find value `p` in this scope - --> $DIR/issue-93835.rs:2:5 - | -LL | p:a<p:p<e=6>> - | ^ not found in this scope - | -help: you might have meant to write a `struct` literal - | -LL ~ fn e() { SomeStruct { -LL | p:a<p:p<e=6>> - ... -LL | -LL ~ }} + --> $DIR/issue-93835.rs:4:19 | -help: maybe you meant to write a path separator here - | -LL | p::a<p:p<e=6>> - | ~~ -help: maybe you meant to write an assignment here - | -LL | let p:a<p:p<e=6>> - | ~~~~~ +LL | type_ascribe!(p, a<p:p<e=6>>); + | ^ not found in this scope -error[E0658]: associated const equality is incomplete - --> $DIR/issue-93835.rs:2:13 +error[E0412]: cannot find type `a` in this scope + --> $DIR/issue-93835.rs:4:22 | -LL | p:a<p:p<e=6>> - | ^^^ +LL | type_ascribe!(p, a<p:p<e=6>>); + | ^ not found in this scope + +error[E0405]: cannot find trait `p` in this scope + --> $DIR/issue-93835.rs:4:26 | - = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information - = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable +LL | type_ascribe!(p, a<p:p<e=6>>); + | ^ not found in this scope error[E0658]: associated const equality is incomplete - --> $DIR/issue-93835.rs:2:13 + --> $DIR/issue-93835.rs:4:28 | -LL | p:a<p:p<e=6>> - | ^^^ +LL | type_ascribe!(p, a<p:p<e=6>>); + | ^^^ | = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable error[E0658]: associated type bounds are unstable - --> $DIR/issue-93835.rs:2:9 + --> $DIR/issue-93835.rs:4:24 | -LL | p:a<p:p<e=6>> - | ^^^^^^^^ +LL | type_ascribe!(p, a<p:p<e=6>>); + | ^^^^^^^^ | = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information = help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable error: aborting due to 5 previous errors -Some errors have detailed explanations: E0425, E0658. -For more information about an error, try `rustc --explain E0425`. +Some errors have detailed explanations: E0405, E0412, E0425, E0658. +For more information about an error, try `rustc --explain E0405`. diff --git a/src/test/ui/associated-inherent-types/issue-104260.rs b/src/test/ui/associated-inherent-types/issue-104260.rs new file mode 100644 index 00000000000..a73cd1775b4 --- /dev/null +++ b/src/test/ui/associated-inherent-types/issue-104260.rs @@ -0,0 +1,14 @@ +// check-pass + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct Foo; + +impl Foo { + type Bar<T> = u8; +} + +fn main() { + let a: Foo::Bar<()>; +} diff --git a/src/test/ui/associated-inherent-types/normalize-projection-0.rs b/src/test/ui/associated-inherent-types/normalize-projection-0.rs new file mode 100644 index 00000000000..50763ecddf9 --- /dev/null +++ b/src/test/ui/associated-inherent-types/normalize-projection-0.rs @@ -0,0 +1,22 @@ +// check-pass + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct S<T>(T); + +impl<T: O> S<T> { + type P = <T as O>::P; +} + +trait O { + type P; +} + +impl O for i32 { + type P = String; +} + +fn main() { + let _: S<i32>::P = String::new(); +} diff --git a/src/test/ui/associated-inherent-types/normalize-projection-1.rs b/src/test/ui/associated-inherent-types/normalize-projection-1.rs new file mode 100644 index 00000000000..2f7b2551a03 --- /dev/null +++ b/src/test/ui/associated-inherent-types/normalize-projection-1.rs @@ -0,0 +1,22 @@ +// check-pass + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct S; + +impl S { + type P<T: O> = <T as O>::P; +} + +trait O { + type P; +} + +impl O for i32 { + type P = String; +} + +fn main() { + let _: S::P<i32> = String::new(); +} diff --git a/src/test/ui/associated-inherent-types/struct-generics.rs b/src/test/ui/associated-inherent-types/struct-generics.rs new file mode 100644 index 00000000000..8952b379173 --- /dev/null +++ b/src/test/ui/associated-inherent-types/struct-generics.rs @@ -0,0 +1,15 @@ +// check-pass + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct S<T>(T); + +impl<T> S<T> { + type P = T; +} + +fn main() { + type A = S<()>::P; + let _: A = (); +} diff --git a/src/test/ui/associated-item/issue-105449.rs b/src/test/ui/associated-item/issue-105449.rs new file mode 100644 index 00000000000..dd14e05fd49 --- /dev/null +++ b/src/test/ui/associated-item/issue-105449.rs @@ -0,0 +1,59 @@ +// check-pass +// compile-flags: -C debug_assertions=yes -Zunstable-options + +#[allow(dead_code)] +fn problematic_function<Space>() +where + DefaultAlloc: FinAllok<R1, Space>, +{ + let e = Edge2dElement; + let _ = Into::<Point>::into(e.map_reference_coords()); +} +impl<N> Allocator<N, R0> for DefaultAlloc { + type Buffer = MStorage; +} +impl<N> Allocator<N, R1> for DefaultAlloc { + type Buffer = MStorage; +} +impl<N, D> From<VectorN<N, D>> for Point +where + DefaultAlloc: Allocator<N, D>, +{ + fn from(_: VectorN<N, D>) -> Self { + unimplemented!() + } +} +impl<GeometryDim, NodalDim> FinAllok<GeometryDim, NodalDim> for DefaultAlloc +where + DefaultAlloc: Allocator<Ure, GeometryDim>, + DefaultAlloc: Allocator<Ure, NodalDim> +{ +} +impl FiniteElement<R1> for Edge2dElement { + fn map_reference_coords(&self) -> VectorN<Ure, R1> { + unimplemented!() + } +} +type VectorN<N, R> = (N, R, <DefaultAlloc as Allocator<N, R>>::Buffer); +struct DefaultAlloc; +struct R0; +struct R1; +struct MStorage; +struct Point; +struct Edge2dElement; +struct Ure; +trait Allocator<N, R> { + type Buffer; +} +trait FinAllok<GeometryDim, NodalDim>: + Allocator<Ure, GeometryDim> + + Allocator<Ure, NodalDim> + +{ +} +trait FiniteElement<Rau> +where + DefaultAlloc: FinAllok<Rau, Rau>, +{ + fn map_reference_coords(&self) -> VectorN<Ure, Rau>; +} +fn main() {} diff --git a/src/test/ui/associated-type-bounds/issue-99828.stderr b/src/test/ui/associated-type-bounds/issue-99828.stderr index 1c20ead0556..dc93c47dace 100644 --- a/src/test/ui/associated-type-bounds/issue-99828.stderr +++ b/src/test/ui/associated-type-bounds/issue-99828.stderr @@ -15,9 +15,6 @@ LL | fn get_iter(vec: &[i32]) -> impl Iterator<Item = {}> + '_ { | note: associated type defined here --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | type Item; - | ^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/defaults-wf.stderr b/src/test/ui/associated-types/defaults-wf.stderr index 8455f88f18e..fc830b8d676 100644 --- a/src/test/ui/associated-types/defaults-wf.stderr +++ b/src/test/ui/associated-types/defaults-wf.stderr @@ -7,9 +7,6 @@ LL | type Ty = Vec<[u8]>; = help: the trait `Sized` is not implemented for `[u8]` note: required by a bound in `Vec` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | ^ required by this bound in `Vec` error: aborting due to previous error diff --git a/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr b/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr index 0edc9a556b7..8e7cf86c406 100644 --- a/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr +++ b/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr @@ -6,9 +6,6 @@ LL | trait ArithmeticOps: Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> | note: required by a bound in `Add` --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | pub trait Add<Rhs = Self> { - | ^^^^^^^^^^ required by this bound in `Add` help: consider further restricting `Self` | LL | trait ArithmeticOps: Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + Div<Output=Self> + Sized {} diff --git a/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr b/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr index 3be7f370da3..f0f5245a3b4 100644 --- a/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr +++ b/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr @@ -40,7 +40,7 @@ LL | async fn bar2<T>(_: T) -> ! { LL | | panic!() LL | | } | |_^ - = note: required because it captures the following types: `ResumeTy`, `Option<bool>`, `impl Future<Output = !>`, `()` + = note: required because it captures the following types: `&mut Context<'_>`, `Option<bool>`, `impl Future<Output = !>`, `()` note: required because it's used within this `async fn` body --> $DIR/async-await-let-else.rs:21:32 | @@ -68,14 +68,10 @@ note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:33:28 | LL | (Rc::new(()), bar().await); - | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later - | | + | ----------- ^^^^^^ - `Rc::new(())` is later dropped here + | | | + | | await occurs here, with `Rc::new(())` maybe used later | has type `Rc<()>` which is not `Send` -note: `Rc::new(())` is later dropped here - --> $DIR/async-await-let-else.rs:33:35 - | -LL | (Rc::new(()), bar().await); - | ^ note: required by a bound in `is_send` --> $DIR/async-await-let-else.rs:19:15 | diff --git a/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr b/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr index 7f93563e288..d3c5e80a30d 100644 --- a/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr +++ b/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr @@ -53,14 +53,10 @@ note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:33:28 | LL | (Rc::new(()), bar().await); - | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later - | | + | ----------- ^^^^^^ - `Rc::new(())` is later dropped here + | | | + | | await occurs here, with `Rc::new(())` maybe used later | has type `Rc<()>` which is not `Send` -note: `Rc::new(())` is later dropped here - --> $DIR/async-await-let-else.rs:33:35 - | -LL | (Rc::new(()), bar().await); - | ^ note: required by a bound in `is_send` --> $DIR/async-await-let-else.rs:19:15 | diff --git a/src/test/ui/async-await/drop-track-bad-field-in-fru.rs b/src/test/ui/async-await/drop-track-bad-field-in-fru.rs new file mode 100644 index 00000000000..28ad7767583 --- /dev/null +++ b/src/test/ui/async-await/drop-track-bad-field-in-fru.rs @@ -0,0 +1,10 @@ +// compile-flags: -Zdrop-tracking +// edition: 2021 + +fn main() {} + +async fn foo() { + None { value: (), ..Default::default() }.await; + //~^ ERROR `Option<_>` is not a future + //~| ERROR variant `Option<_>::None` has no field named `value` +} diff --git a/src/test/ui/async-await/drop-track-bad-field-in-fru.stderr b/src/test/ui/async-await/drop-track-bad-field-in-fru.stderr new file mode 100644 index 00000000000..819b64ad77f --- /dev/null +++ b/src/test/ui/async-await/drop-track-bad-field-in-fru.stderr @@ -0,0 +1,23 @@ +error[E0559]: variant `Option<_>::None` has no field named `value` + --> $DIR/drop-track-bad-field-in-fru.rs:7:12 + | +LL | None { value: (), ..Default::default() }.await; + | ^^^^^ `Option<_>::None` does not have this field + +error[E0277]: `Option<_>` is not a future + --> $DIR/drop-track-bad-field-in-fru.rs:7:45 + | +LL | None { value: (), ..Default::default() }.await; + | ^^^^^^ + | | + | `Option<_>` is not a future + | help: remove the `.await` + | + = help: the trait `Future` is not implemented for `Option<_>` + = note: Option<_> must be a future or must implement `IntoFuture` to be awaited + = note: required for `Option<_>` to implement `IntoFuture` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0277, E0559. +For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/generator-desc.stderr b/src/test/ui/async-await/generator-desc.stderr index 1686153acf9..963c6ba57ad 100644 --- a/src/test/ui/async-await/generator-desc.stderr +++ b/src/test/ui/async-await/generator-desc.stderr @@ -12,9 +12,6 @@ LL | fun(async {}, async {}); found `async` block `[async block@$DIR/generator-desc.rs:10:19: 10:27]` note: function defined here --> $SRC_DIR/core/src/future/mod.rs:LL:COL - | -LL | pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut { - | ^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/generator-desc.rs:12:16 diff --git a/src/test/ui/async-await/generator-not-future.rs b/src/test/ui/async-await/generator-not-future.rs new file mode 100644 index 00000000000..37d7cfa6fb7 --- /dev/null +++ b/src/test/ui/async-await/generator-not-future.rs @@ -0,0 +1,45 @@ +// edition:2018 +#![feature(generators, generator_trait)] + +use std::future::Future; +use std::ops::Generator; + +async fn async_fn() {} +fn returns_async_block() -> impl Future<Output = ()> { + async {} +} +fn returns_generator() -> impl Generator<(), Yield = (), Return = ()> { + || { + let _: () = yield (); + } +} + +fn takes_future(_f: impl Future<Output = ()>) {} +fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {} + +fn main() { + // okay: + takes_future(async_fn()); + takes_future(returns_async_block()); + takes_future(async {}); + takes_generator(returns_generator()); + takes_generator(|| { + let _: () = yield (); + }); + + // async futures are not generators: + takes_generator(async_fn()); + //~^ ERROR the trait bound + takes_generator(returns_async_block()); + //~^ ERROR the trait bound + takes_generator(async {}); + //~^ ERROR the trait bound + + // generators are not futures: + takes_future(returns_generator()); + //~^ ERROR is not a future + takes_future(|ctx| { + //~^ ERROR is not a future + ctx = yield (); + }); +} diff --git a/src/test/ui/async-await/generator-not-future.stderr b/src/test/ui/async-await/generator-not-future.stderr new file mode 100644 index 00000000000..1b81b461f0a --- /dev/null +++ b/src/test/ui/async-await/generator-not-future.stderr @@ -0,0 +1,81 @@ +error[E0277]: the trait bound `impl Future<Output = ()>: Generator<_>` is not satisfied + --> $DIR/generator-not-future.rs:31:21 + | +LL | takes_generator(async_fn()); + | --------------- ^^^^^^^^^^ the trait `Generator<_>` is not implemented for `impl Future<Output = ()>` + | | + | required by a bound introduced by this call + | +note: required by a bound in `takes_generator` + --> $DIR/generator-not-future.rs:18:39 + | +LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator` + +error[E0277]: the trait bound `impl Future<Output = ()>: Generator<_>` is not satisfied + --> $DIR/generator-not-future.rs:33:21 + | +LL | takes_generator(returns_async_block()); + | --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Generator<_>` is not implemented for `impl Future<Output = ()>` + | | + | required by a bound introduced by this call + | +note: required by a bound in `takes_generator` + --> $DIR/generator-not-future.rs:18:39 + | +LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator` + +error[E0277]: the trait bound `[async block@$DIR/generator-not-future.rs:35:21: 35:29]: Generator<_>` is not satisfied + --> $DIR/generator-not-future.rs:35:21 + | +LL | takes_generator(async {}); + | --------------- ^^^^^^^^ the trait `Generator<_>` is not implemented for `[async block@$DIR/generator-not-future.rs:35:21: 35:29]` + | | + | required by a bound introduced by this call + | +note: required by a bound in `takes_generator` + --> $DIR/generator-not-future.rs:18:39 + | +LL | fn takes_generator<ResumeTy>(_g: impl Generator<ResumeTy, Yield = (), Return = ()>) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_generator` + +error[E0277]: `impl Generator<Yield = (), Return = ()>` is not a future + --> $DIR/generator-not-future.rs:39:18 + | +LL | takes_future(returns_generator()); + | ------------ ^^^^^^^^^^^^^^^^^^^ `impl Generator<Yield = (), Return = ()>` is not a future + | | + | required by a bound introduced by this call + | + = help: the trait `Future` is not implemented for `impl Generator<Yield = (), Return = ()>` + = note: impl Generator<Yield = (), Return = ()> must be a future or must implement `IntoFuture` to be awaited +note: required by a bound in `takes_future` + --> $DIR/generator-not-future.rs:17:26 + | +LL | fn takes_future(_f: impl Future<Output = ()>) {} + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future` + +error[E0277]: `[generator@$DIR/generator-not-future.rs:41:18: 41:23]` is not a future + --> $DIR/generator-not-future.rs:41:18 + | +LL | takes_future(|ctx| { + | _____------------_^ + | | | + | | required by a bound introduced by this call +LL | | +LL | | ctx = yield (); +LL | | }); + | |_____^ `[generator@$DIR/generator-not-future.rs:41:18: 41:23]` is not a future + | + = help: the trait `Future` is not implemented for `[generator@$DIR/generator-not-future.rs:41:18: 41:23]` + = note: [generator@$DIR/generator-not-future.rs:41:18: 41:23] must be a future or must implement `IntoFuture` to be awaited +note: required by a bound in `takes_future` + --> $DIR/generator-not-future.rs:17:26 + | +LL | fn takes_future(_f: impl Future<Output = ()>) {} + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/async-await/in-trait/async-generics-and-bounds.stderr b/src/test/ui/async-await/in-trait/async-generics-and-bounds.stderr index 5c8d64fc6cb..f1f0d7e5907 100644 --- a/src/test/ui/async-await/in-trait/async-generics-and-bounds.stderr +++ b/src/test/ui/async-await/in-trait/async-generics-and-bounds.stderr @@ -4,11 +4,11 @@ error[E0311]: the parameter type `U` may not live long enough LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; | ^^^^^^^ | -note: the parameter type `U` must be valid for the anonymous lifetime as defined here... +note: the parameter type `U` must be valid for the anonymous lifetime defined here... --> $DIR/async-generics-and-bounds.rs:12:18 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^ + | ^^^^^ note: ...so that the reference type `&(T, U)` does not outlive the data it points at --> $DIR/async-generics-and-bounds.rs:12:28 | @@ -21,11 +21,11 @@ error[E0311]: the parameter type `T` may not live long enough LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; | ^^^^^^^ | -note: the parameter type `T` must be valid for the anonymous lifetime as defined here... +note: the parameter type `T` must be valid for the anonymous lifetime defined here... --> $DIR/async-generics-and-bounds.rs:12:18 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^ + | ^^^^^ note: ...so that the reference type `&(T, U)` does not outlive the data it points at --> $DIR/async-generics-and-bounds.rs:12:28 | diff --git a/src/test/ui/async-await/in-trait/async-generics.stderr b/src/test/ui/async-await/in-trait/async-generics.stderr index 6ae73d9e3a6..2f05564564c 100644 --- a/src/test/ui/async-await/in-trait/async-generics.stderr +++ b/src/test/ui/async-await/in-trait/async-generics.stderr @@ -4,11 +4,11 @@ error[E0311]: the parameter type `U` may not live long enough LL | async fn foo(&self) -> &(T, U); | ^^^^^^^ | -note: the parameter type `U` must be valid for the anonymous lifetime as defined here... +note: the parameter type `U` must be valid for the anonymous lifetime defined here... --> $DIR/async-generics.rs:9:18 | LL | async fn foo(&self) -> &(T, U); - | ^ + | ^^^^^ note: ...so that the reference type `&(T, U)` does not outlive the data it points at --> $DIR/async-generics.rs:9:28 | @@ -21,11 +21,11 @@ error[E0311]: the parameter type `T` may not live long enough LL | async fn foo(&self) -> &(T, U); | ^^^^^^^ | -note: the parameter type `T` must be valid for the anonymous lifetime as defined here... +note: the parameter type `T` must be valid for the anonymous lifetime defined here... --> $DIR/async-generics.rs:9:18 | LL | async fn foo(&self) -> &(T, U); - | ^ + | ^^^^^ note: ...so that the reference type `&(T, U)` does not outlive the data it points at --> $DIR/async-generics.rs:9:28 | diff --git a/src/test/ui/async-await/in-trait/async-lifetimes-and-bounds.rs b/src/test/ui/async-await/in-trait/async-lifetimes-and-bounds.rs index 3f7448cecd1..d5481d277e4 100644 --- a/src/test/ui/async-await/in-trait/async-lifetimes-and-bounds.rs +++ b/src/test/ui/async-await/in-trait/async-lifetimes-and-bounds.rs @@ -1,5 +1,4 @@ -// check-fail -// known-bug: #102682 +// check-pass // edition: 2021 #![feature(async_fn_in_trait)] diff --git a/src/test/ui/async-await/in-trait/async-lifetimes-and-bounds.stderr b/src/test/ui/async-await/in-trait/async-lifetimes-and-bounds.stderr deleted file mode 100644 index 0f024202743..00000000000 --- a/src/test/ui/async-await/in-trait/async-lifetimes-and-bounds.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0309]: the parameter type `Self` may not live long enough - --> $DIR/async-lifetimes-and-bounds.rs:11:43 - | -LL | async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T) where T: Debug + Sized; - | ^^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `Self: 'a`... - = note: ...so that the reference type `&'a Self` does not outlive the data it points at - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/async-lifetimes-and-bounds.rs:11:43 - | -LL | async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T) where T: Debug + Sized; - | ^^^^^^^^^^^^^^^^^ ...so that the reference type `&'b T` does not outlive the data it points at - | -help: consider adding an explicit lifetime bound... - | -LL | trait MyTrait<'a, 'b, T: 'b> { - | ++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/async-await/in-trait/async-lifetimes.rs b/src/test/ui/async-await/in-trait/async-lifetimes.rs index acbac471cf7..f298e45d239 100644 --- a/src/test/ui/async-await/in-trait/async-lifetimes.rs +++ b/src/test/ui/async-await/in-trait/async-lifetimes.rs @@ -1,5 +1,4 @@ -// check-fail -// known-bug: #102682 +// check-pass // edition: 2021 #![feature(async_fn_in_trait)] diff --git a/src/test/ui/async-await/in-trait/async-lifetimes.stderr b/src/test/ui/async-await/in-trait/async-lifetimes.stderr deleted file mode 100644 index 9a7d294bb17..00000000000 --- a/src/test/ui/async-await/in-trait/async-lifetimes.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0309]: the parameter type `Self` may not live long enough - --> $DIR/async-lifetimes.rs:9:43 - | -LL | async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T); - | ^^^^^^^^^^^^^^^^^ - | - = help: consider adding an explicit lifetime bound `Self: 'a`... - = note: ...so that the reference type `&'a Self` does not outlive the data it points at - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/async-lifetimes.rs:9:43 - | -LL | async fn foo(&'a self, key: &'b T) -> (&'a Self, &'b T); - | ^^^^^^^^^^^^^^^^^ ...so that the reference type `&'b T` does not outlive the data it points at - | -help: consider adding an explicit lifetime bound... - | -LL | trait MyTrait<'a, 'b, T: 'b> { - | ++++ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0309`. diff --git a/src/test/ui/async-await/in-trait/implied-bounds.rs b/src/test/ui/async-await/in-trait/implied-bounds.rs new file mode 100644 index 00000000000..52bceb3cc5c --- /dev/null +++ b/src/test/ui/async-await/in-trait/implied-bounds.rs @@ -0,0 +1,13 @@ +// check-pass +// edition: 2021 + +#![feature(async_fn_in_trait)] +#![allow(incomplete_features)] + +trait TcpStack { + type Connection<'a>: Sized where Self: 'a; + fn connect<'a>(&'a self) -> Self::Connection<'a>; + async fn async_connect<'a>(&'a self) -> Self::Connection<'a>; +} + +fn main() {} diff --git a/src/test/ui/async-await/in-trait/lifetime-mismatch.rs b/src/test/ui/async-await/in-trait/lifetime-mismatch.rs new file mode 100644 index 00000000000..45ede193c0f --- /dev/null +++ b/src/test/ui/async-await/in-trait/lifetime-mismatch.rs @@ -0,0 +1,20 @@ +// edition:2021 + +#![feature(async_fn_in_trait)] +//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + +trait MyTrait { + async fn foo<'a>(&self); + async fn bar(&self); +} + +impl MyTrait for i32 { + async fn foo(&self) {} + //~^ ERROR lifetime parameters or bounds on method `foo` do not match the trait declaration + + async fn bar(&self) { + self.foo(); + } +} + +fn main() {} diff --git a/src/test/ui/async-await/in-trait/lifetime-mismatch.stderr b/src/test/ui/async-await/in-trait/lifetime-mismatch.stderr new file mode 100644 index 00000000000..d87adcc78b6 --- /dev/null +++ b/src/test/ui/async-await/in-trait/lifetime-mismatch.stderr @@ -0,0 +1,21 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/lifetime-mismatch.rs:3:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration + --> $DIR/lifetime-mismatch.rs:12:17 + | +LL | async fn foo<'a>(&self); + | ---- lifetimes in impl do not match this method in trait +... +LL | async fn foo(&self) {} + | ^ lifetimes do not match method in trait + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0195`. diff --git a/src/test/ui/async-await/in-trait/nested-rpit.rs b/src/test/ui/async-await/in-trait/nested-rpit.rs new file mode 100644 index 00000000000..ae8e0aed0cc --- /dev/null +++ b/src/test/ui/async-await/in-trait/nested-rpit.rs @@ -0,0 +1,17 @@ +// check-pass +// edition: 2021 + +#![feature(async_fn_in_trait)] +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +use std::future::Future; +use std::marker::PhantomData; + +trait Lockable<K, V> { + async fn lock_all_entries(&self) -> impl Future<Output = Guard<'_>>; +} + +struct Guard<'a>(PhantomData<&'a ()>); + +fn main() {} diff --git a/src/test/ui/async-await/in-trait/return-type-suggestion.rs b/src/test/ui/async-await/in-trait/return-type-suggestion.rs new file mode 100644 index 00000000000..3446761d119 --- /dev/null +++ b/src/test/ui/async-await/in-trait/return-type-suggestion.rs @@ -0,0 +1,14 @@ +// edition: 2021 + +#![feature(async_fn_in_trait)] +//~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + +trait A { + async fn e() { + Ok(()) + //~^ ERROR mismatched types + //~| HELP consider using a semicolon here + } +} + +fn main() {} diff --git a/src/test/ui/async-await/in-trait/return-type-suggestion.stderr b/src/test/ui/async-await/in-trait/return-type-suggestion.stderr new file mode 100644 index 00000000000..5a9b15e54a0 --- /dev/null +++ b/src/test/ui/async-await/in-trait/return-type-suggestion.stderr @@ -0,0 +1,23 @@ +warning: the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/return-type-suggestion.rs:3:12 + | +LL | #![feature(async_fn_in_trait)] + | ^^^^^^^^^^^^^^^^^ + | + = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0308]: mismatched types + --> $DIR/return-type-suggestion.rs:8:9 + | +LL | Ok(()) + | ^^^^^^- help: consider using a semicolon here: `;` + | | + | expected `()`, found enum `Result` + | + = note: expected unit type `()` + found enum `Result<(), _>` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/async-await/issue-68112.drop_tracking.stderr b/src/test/ui/async-await/issue-68112.drop_tracking.stderr index f2802698fd5..1c90bedae79 100644 --- a/src/test/ui/async-await/issue-68112.drop_tracking.stderr +++ b/src/test/ui/async-await/issue-68112.drop_tracking.stderr @@ -57,7 +57,7 @@ note: required because it appears within the type `impl Future<Output = Arc<RefC | LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `Ready<i32>` + = note: required because it captures the following types: `&mut Context<'_>`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `Ready<i32>` note: required because it's used within this `async` block --> $DIR/issue-68112.rs:60:20 | diff --git a/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr b/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr index 38eb85b302f..e09ae7fedd8 100644 --- a/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr +++ b/src/test/ui/async-await/issue-68112.no_drop_tracking.stderr @@ -57,7 +57,7 @@ note: required because it appears within the type `impl Future<Output = Arc<RefC | LL | fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `i32`, `Ready<i32>` + = note: required because it captures the following types: `&mut Context<'_>`, `impl Future<Output = Arc<RefCell<i32>>>`, `()`, `i32`, `Ready<i32>` note: required because it's used within this `async` block --> $DIR/issue-68112.rs:60:20 | diff --git a/src/test/ui/async-await/issue-69446-fnmut-capture.stderr b/src/test/ui/async-await/issue-69446-fnmut-capture.stderr index 3d2b0402bc5..e6ad2f0d444 100644 --- a/src/test/ui/async-await/issue-69446-fnmut-capture.stderr +++ b/src/test/ui/async-await/issue-69446-fnmut-capture.stderr @@ -14,6 +14,9 @@ LL | | }); | = note: `FnMut` closures only have access to their captured variables while they are executing... = note: ...therefore, they cannot allow references to captured variables to escape + = note: requirement occurs because of a mutable reference to `Context<'_>` + = note: mutable references are invariant over their type parameter + = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance error: aborting due to previous error diff --git a/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr b/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr index 721234aa4a7..a8fd97cde8f 100644 --- a/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr +++ b/src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr @@ -18,7 +18,7 @@ LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> { | ___________________________________________________________________^ LL | | } | |_^ - = note: required because it captures the following types: `ResumeTy`, `impl Future<Output = ()>`, `()` + = note: required because it captures the following types: `&mut Context<'_>`, `impl Future<Output = ()>`, `()` note: required because it's used within this `async` block --> $DIR/issue-70935-complex-spans.rs:16:5 | diff --git a/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr b/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr index 34b31198e4f..8036d82daa4 100644 --- a/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr +++ b/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr @@ -12,14 +12,10 @@ LL | baz(|| async{ | _____________- LL | | foo(tx.clone()); LL | | }).await; - | | - ^^^^^^ await occurs here, with the value maybe used later - | |_________| + | | - ^^^^^^- the value is later dropped here + | | | | + | |_________| await occurs here, with the value maybe used later | has type `[closure@$DIR/issue-70935-complex-spans.rs:17:13: 17:15]` which is not `Send` -note: the value is later dropped here - --> $DIR/issue-70935-complex-spans.rs:19:17 - | -LL | }).await; - | ^ error: aborting due to previous error diff --git a/src/test/ui/async-await/issue-72442.stderr b/src/test/ui/async-await/issue-72442.stderr index 919abf64603..4a1705715ca 100644 --- a/src/test/ui/async-await/issue-72442.stderr +++ b/src/test/ui/async-await/issue-72442.stderr @@ -8,9 +8,6 @@ LL | let mut f = File::open(path.to_str())?; | note: required by a bound in `File::open` --> $SRC_DIR/std/src/fs.rs:LL:COL - | -LL | pub fn open<P: AsRef<Path>>(path: P) -> io::Result<File> { - | ^^^^^^^^^^^ required by this bound in `File::open` error: aborting due to previous error diff --git a/src/test/ui/async-await/issues/issue-65159.stderr b/src/test/ui/async-await/issues/issue-65159.stderr index 45f5ec40cd7..40c0e72b203 100644 --- a/src/test/ui/async-await/issues/issue-65159.stderr +++ b/src/test/ui/async-await/issues/issue-65159.stderr @@ -6,11 +6,6 @@ LL | async fn copy() -> Result<()> | | | expected 2 generic arguments | -note: enum defined here, with 2 generic parameters: `T`, `E` - --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | ^^^^^^ - - help: add missing generic argument | LL | async fn copy() -> Result<(), E> diff --git a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr index ab196dca20c..1033fa6cc8b 100644 --- a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr +++ b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr @@ -13,14 +13,10 @@ note: future is not `Send` as this value is used across an await --> $DIR/issue-65436-raw-ptr-not-send.rs:18:35 | LL | bar(Foo(std::ptr::null())).await; - | ---------------- ^^^^^^ await occurs here, with `std::ptr::null()` maybe used later - | | + | ---------------- ^^^^^^- `std::ptr::null()` is later dropped here + | | | + | | await occurs here, with `std::ptr::null()` maybe used later | has type `*const u8` which is not `Send` -note: `std::ptr::null()` is later dropped here - --> $DIR/issue-65436-raw-ptr-not-send.rs:18:41 - | -LL | bar(Foo(std::ptr::null())).await; - | ^ help: consider moving this into a `let` binding to create a shorter lived borrow --> $DIR/issue-65436-raw-ptr-not-send.rs:18:13 | diff --git a/src/test/ui/async-await/issues/issue-67893.stderr b/src/test/ui/async-await/issues/issue-67893.stderr index 316b6d06f93..2ce68a78291 100644 --- a/src/test/ui/async-await/issues/issue-67893.stderr +++ b/src/test/ui/async-await/issues/issue-67893.stderr @@ -9,14 +9,10 @@ note: future is not `Send` as this value is used across an await --> $DIR/auxiliary/issue_67893.rs:9:26 | LL | f(*x.lock().unwrap()).await; - | ----------------- ^^^^^^ await occurs here, with `x.lock().unwrap()` maybe used later - | | + | ----------------- ^^^^^^- `x.lock().unwrap()` is later dropped here + | | | + | | await occurs here, with `x.lock().unwrap()` maybe used later | has type `MutexGuard<'_, ()>` which is not `Send` -note: `x.lock().unwrap()` is later dropped here - --> $DIR/auxiliary/issue_67893.rs:9:32 - | -LL | f(*x.lock().unwrap()).await; - | ^ note: required by a bound in `g` --> $DIR/issue-67893.rs:6:14 | diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr b/src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr index 17b4ef7bdc6..25876d50840 100644 --- a/src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr +++ b/src/test/ui/async-await/partial-drop-partial-reinit.drop_tracking.stderr @@ -11,7 +11,7 @@ LL | async fn foo() { | = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend` = note: required because it appears within the type `(NotSend,)` - = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `()`, `impl Future<Output = ()>` + = note: required because it captures the following types: `&mut Context<'_>`, `(NotSend,)`, `()`, `impl Future<Output = ()>` note: required because it's used within this `async fn` body --> $DIR/partial-drop-partial-reinit.rs:31:16 | diff --git a/src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr b/src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr index 34d8a159f10..dba2a620779 100644 --- a/src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr +++ b/src/test/ui/async-await/partial-drop-partial-reinit.no_drop_tracking.stderr @@ -11,7 +11,7 @@ LL | async fn foo() { | = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend` = note: required because it appears within the type `(NotSend,)` - = note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `impl Future<Output = ()>`, `()` + = note: required because it captures the following types: `&mut Context<'_>`, `(NotSend,)`, `impl Future<Output = ()>`, `()` note: required because it's used within this `async fn` body --> $DIR/partial-drop-partial-reinit.rs:31:16 | diff --git a/src/test/ui/async-await/pin-needed-to-poll-2.stderr b/src/test/ui/async-await/pin-needed-to-poll-2.stderr index 83d1a02c876..0a6f705e255 100644 --- a/src/test/ui/async-await/pin-needed-to-poll-2.stderr +++ b/src/test/ui/async-await/pin-needed-to-poll-2.stderr @@ -14,9 +14,6 @@ LL | struct Sleep(std::marker::PhantomPinned); | ^^^^^ note: required by a bound in `Pin::<P>::new` --> $SRC_DIR/core/src/pin.rs:LL:COL - | -LL | impl<P: Deref<Target: Unpin>> Pin<P> { - | ^^^^^ required by this bound in `Pin::<P>::new` error: aborting due to previous error diff --git a/src/test/ui/async-await/pin-needed-to-poll.stderr b/src/test/ui/async-await/pin-needed-to-poll.stderr index 2e8723b2743..b1f4a73aafe 100644 --- a/src/test/ui/async-await/pin-needed-to-poll.stderr +++ b/src/test/ui/async-await/pin-needed-to-poll.stderr @@ -6,11 +6,9 @@ LL | struct Sleep; ... LL | self.sleep.poll(cx) | ^^^^ method not found in `Sleep` + --> $SRC_DIR/core/src/future/future.rs:LL:COL | - ::: $SRC_DIR/core/src/future/future.rs:LL:COL - | -LL | fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>; - | ---- the method is available for `Pin<&mut Sleep>` here + = note: the method is available for `Pin<&mut Sleep>` here | help: consider wrapping the receiver expression with the appropriate type | diff --git a/src/test/ui/async-await/track-caller/async-block.rs b/src/test/ui/async-await/track-caller/async-block.rs new file mode 100644 index 00000000000..8e81387c34b --- /dev/null +++ b/src/test/ui/async-await/track-caller/async-block.rs @@ -0,0 +1,9 @@ +// edition:2021 + +#![feature(closure_track_caller, stmt_expr_attributes)] + +fn main() { + let _ = #[track_caller] async { + //~^ ERROR attribute should be applied to a function definition [E0739] + }; +} diff --git a/src/test/ui/async-await/track-caller/async-block.stderr b/src/test/ui/async-await/track-caller/async-block.stderr new file mode 100644 index 00000000000..407439921c0 --- /dev/null +++ b/src/test/ui/async-await/track-caller/async-block.stderr @@ -0,0 +1,12 @@ +error[E0739]: attribute should be applied to a function definition + --> $DIR/async-block.rs:6:13 + | +LL | let _ = #[track_caller] async { + | _____________^^^^^^^^^^^^^^^_- +LL | | +LL | | }; + | |_____- not a function definition + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0739`. diff --git a/src/test/ui/async-await/track-caller/async-closure-gate.rs b/src/test/ui/async-await/track-caller/async-closure-gate.rs new file mode 100644 index 00000000000..9593fdb1908 --- /dev/null +++ b/src/test/ui/async-await/track-caller/async-closure-gate.rs @@ -0,0 +1,10 @@ +// edition:2021 + +#![feature(async_closure, stmt_expr_attributes)] + +fn main() { + let _ = #[track_caller] async || { + //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658] + //~| ERROR `#[track_caller]` on closures is currently unstable [E0658] + }; +} diff --git a/src/test/ui/async-await/track-caller/async-closure-gate.stderr b/src/test/ui/async-await/track-caller/async-closure-gate.stderr new file mode 100644 index 00000000000..be3d110eccd --- /dev/null +++ b/src/test/ui/async-await/track-caller/async-closure-gate.stderr @@ -0,0 +1,25 @@ +error[E0658]: `#[track_caller]` on closures is currently unstable + --> $DIR/async-closure-gate.rs:6:13 + | +LL | let _ = #[track_caller] async || { + | ^^^^^^^^^^^^^^^ + | + = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information + = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable + +error[E0658]: `#[track_caller]` on closures is currently unstable + --> $DIR/async-closure-gate.rs:6:38 + | +LL | let _ = #[track_caller] async || { + | ______________________________________^ +LL | | +LL | | +LL | | }; + | |_____^ + | + = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information + = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/async-await/track-caller/issue-105134.rs b/src/test/ui/async-await/track-caller/issue-105134.rs new file mode 100644 index 00000000000..4e52b8e250b --- /dev/null +++ b/src/test/ui/async-await/track-caller/issue-105134.rs @@ -0,0 +1,11 @@ +// check-pass +// edition:2021 + +#[track_caller] +fn f() { + let _ = async {}; +} + +fn main() { + f(); +} diff --git a/src/test/ui/async-await/track-caller/panic-track-caller.rs b/src/test/ui/async-await/track-caller/panic-track-caller.rs index b113c56412f..066cf97628f 100644 --- a/src/test/ui/async-await/track-caller/panic-track-caller.rs +++ b/src/test/ui/async-await/track-caller/panic-track-caller.rs @@ -1,7 +1,7 @@ // run-pass // edition:2021 // needs-unwind -#![feature(closure_track_caller)] +#![feature(closure_track_caller, async_closure, stmt_expr_attributes)] use std::future::Future; use std::panic; @@ -54,6 +54,26 @@ async fn foo_track_caller() { bar_track_caller().await } +struct Foo; + +impl Foo { + #[track_caller] + async fn bar_assoc() { + panic!(); + } +} + +async fn foo_assoc() { + Foo::bar_assoc().await +} + +async fn foo_closure() { + let c = #[track_caller] async || { + panic!(); + }; + c().await +} + fn panicked_at(f: impl FnOnce() + panic::UnwindSafe) -> u32 { let loc = Arc::new(Mutex::new(None)); @@ -73,4 +93,6 @@ fn panicked_at(f: impl FnOnce() + panic::UnwindSafe) -> u32 { fn main() { assert_eq!(panicked_at(|| block_on(foo())), 41); assert_eq!(panicked_at(|| block_on(foo_track_caller())), 54); + assert_eq!(panicked_at(|| block_on(foo_assoc())), 67); + assert_eq!(panicked_at(|| block_on(foo_closure())), 74); } diff --git a/src/test/ui/attributes/unused-item-in-attr.rs b/src/test/ui/attributes/unused-item-in-attr.rs new file mode 100644 index 00000000000..70dcd5413f1 --- /dev/null +++ b/src/test/ui/attributes/unused-item-in-attr.rs @@ -0,0 +1,6 @@ +#[w = { extern crate alloc; }] +//~^ ERROR unexpected expression: `{ +//~| ERROR cannot find attribute `w` in this scope +fn f() {} + +fn main() {} diff --git a/src/test/ui/attributes/unused-item-in-attr.stderr b/src/test/ui/attributes/unused-item-in-attr.stderr new file mode 100644 index 00000000000..92a8f585821 --- /dev/null +++ b/src/test/ui/attributes/unused-item-in-attr.stderr @@ -0,0 +1,16 @@ +error: unexpected expression: `{ + extern crate alloc; + }` + --> $DIR/unused-item-in-attr.rs:1:7 + | +LL | #[w = { extern crate alloc; }] + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot find attribute `w` in this scope + --> $DIR/unused-item-in-attr.rs:1:3 + | +LL | #[w = { extern crate alloc; }] + | ^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/auto-traits/bad-generics-on-dyn.rs b/src/test/ui/auto-traits/bad-generics-on-dyn.rs new file mode 100644 index 00000000000..3f8ac14c72d --- /dev/null +++ b/src/test/ui/auto-traits/bad-generics-on-dyn.rs @@ -0,0 +1,11 @@ +#![feature(auto_traits)] + +auto trait Trait1<'a> {} +//~^ ERROR auto traits cannot have generic parameters + +fn f<'a>(x: &dyn Trait1<'a>) +{} + +fn main() { + f(&1); +} diff --git a/src/test/ui/auto-traits/bad-generics-on-dyn.stderr b/src/test/ui/auto-traits/bad-generics-on-dyn.stderr new file mode 100644 index 00000000000..ade69ced606 --- /dev/null +++ b/src/test/ui/auto-traits/bad-generics-on-dyn.stderr @@ -0,0 +1,11 @@ +error[E0567]: auto traits cannot have generic parameters + --> $DIR/bad-generics-on-dyn.rs:3:18 + | +LL | auto trait Trait1<'a> {} + | ------^^^^ help: remove the parameters + | | + | auto trait cannot have generic parameters + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0567`. diff --git a/src/test/ui/binop/binop-consume-args.stderr b/src/test/ui/binop/binop-consume-args.stderr index c734f8c1e17..6fbbb55437e 100644 --- a/src/test/ui/binop/binop-consume-args.stderr +++ b/src/test/ui/binop/binop-consume-args.stderr @@ -10,9 +10,6 @@ LL | drop(lhs); | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | fn add(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn add<A: Add<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -46,9 +43,6 @@ LL | drop(lhs); | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | fn sub(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn sub<A: Sub<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -82,9 +76,6 @@ LL | drop(lhs); | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | fn mul(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn mul<A: Mul<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -118,9 +109,6 @@ LL | drop(lhs); | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | fn div(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn div<A: Div<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -154,9 +142,6 @@ LL | drop(lhs); | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | fn rem(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn rem<A: Rem<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -190,9 +175,6 @@ LL | drop(lhs); | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | fn bitand(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn bitand<A: BitAnd<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -226,9 +208,6 @@ LL | drop(lhs); | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | fn bitor(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn bitor<A: BitOr<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -262,9 +241,6 @@ LL | drop(lhs); | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | fn bitxor(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn bitxor<A: BitXor<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -298,9 +274,6 @@ LL | drop(lhs); | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | fn shl(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn shl<A: Shl<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -334,9 +307,6 @@ LL | drop(lhs); | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | fn shr(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn shr<A: Shr<B, Output=()> + Copy, B>(lhs: A, rhs: B) { diff --git a/src/test/ui/binop/binop-move-semantics.stderr b/src/test/ui/binop/binop-move-semantics.stderr index 994eaf9d8c7..dae267da05d 100644 --- a/src/test/ui/binop/binop-move-semantics.stderr +++ b/src/test/ui/binop/binop-move-semantics.stderr @@ -13,9 +13,6 @@ LL | | x; | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | fn add(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn double_move<T: Add<Output=()> + Copy>(x: T) { @@ -78,9 +75,6 @@ LL | | *n; | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | fn add(self, rhs: Rhs) -> Self::Output; - | ^^^^ error[E0507]: cannot move out of `*n` which is behind a shared reference --> $DIR/binop-move-semantics.rs:32:5 diff --git a/src/test/ui/binop/binop-mul-i32-f32.stderr b/src/test/ui/binop/binop-mul-i32-f32.stderr index 21c490965b1..c986bc3fd1e 100644 --- a/src/test/ui/binop/binop-mul-i32-f32.stderr +++ b/src/test/ui/binop/binop-mul-i32-f32.stderr @@ -6,15 +6,10 @@ LL | x * y | = help: the trait `Mul<f32>` is not implemented for `i32` = help: the following other types implement trait `Mul<Rhs>`: - <&'a f32 as Mul<f32>> - <&'a f64 as Mul<f64>> - <&'a i128 as Mul<i128>> - <&'a i16 as Mul<i16>> <&'a i32 as Mul<i32>> - <&'a i64 as Mul<i64>> - <&'a i8 as Mul<i8>> - <&'a isize as Mul<isize>> - and 49 others + <&i32 as Mul<&i32>> + <i32 as Mul<&i32>> + <i32 as Mul> error: aborting due to previous error diff --git a/src/test/ui/binop/issue-28837.stderr b/src/test/ui/binop/issue-28837.stderr index b9c7e1bea70..6e236ca5296 100644 --- a/src/test/ui/binop/issue-28837.stderr +++ b/src/test/ui/binop/issue-28837.stderr @@ -11,11 +11,8 @@ note: an implementation of `Add<_>` might be missing for `A` | LL | struct A; | ^^^^^^^^ must implement `Add<_>` -note: the following trait must be implemented +note: the trait `Add` must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | pub trait Add<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: cannot subtract `A` from `A` --> $DIR/issue-28837.rs:8:7 @@ -30,11 +27,8 @@ note: an implementation of `Sub<_>` might be missing for `A` | LL | struct A; | ^^^^^^^^ must implement `Sub<_>` -note: the following trait must be implemented +note: the trait `Sub` must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | pub trait Sub<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: cannot multiply `A` by `A` --> $DIR/issue-28837.rs:10:7 @@ -49,11 +43,8 @@ note: an implementation of `Mul<_>` might be missing for `A` | LL | struct A; | ^^^^^^^^ must implement `Mul<_>` -note: the following trait must be implemented +note: the trait `Mul` must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | pub trait Mul<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: cannot divide `A` by `A` --> $DIR/issue-28837.rs:12:7 @@ -68,11 +59,8 @@ note: an implementation of `Div<_>` might be missing for `A` | LL | struct A; | ^^^^^^^^ must implement `Div<_>` -note: the following trait must be implemented +note: the trait `Div` must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | pub trait Div<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: cannot mod `A` by `A` --> $DIR/issue-28837.rs:14:7 @@ -87,11 +75,8 @@ note: an implementation of `Rem<_>` might be missing for `A` | LL | struct A; | ^^^^^^^^ must implement `Rem<_>` -note: the following trait must be implemented +note: the trait `Rem` must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | pub trait Rem<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: no implementation for `A & A` --> $DIR/issue-28837.rs:16:7 @@ -106,11 +91,8 @@ note: an implementation of `BitAnd<_>` might be missing for `A` | LL | struct A; | ^^^^^^^^ must implement `BitAnd<_>` -note: the following trait must be implemented +note: the trait `BitAnd` must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | pub trait BitAnd<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: no implementation for `A | A` --> $DIR/issue-28837.rs:18:7 @@ -125,11 +107,8 @@ note: an implementation of `BitOr<_>` might be missing for `A` | LL | struct A; | ^^^^^^^^ must implement `BitOr<_>` -note: the following trait must be implemented +note: the trait `BitOr` must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | pub trait BitOr<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: no implementation for `A << A` --> $DIR/issue-28837.rs:20:7 @@ -144,11 +123,8 @@ note: an implementation of `Shl<_>` might be missing for `A` | LL | struct A; | ^^^^^^^^ must implement `Shl<_>` -note: the following trait must be implemented +note: the trait `Shl` must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | pub trait Shl<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: no implementation for `A >> A` --> $DIR/issue-28837.rs:22:7 @@ -163,11 +139,8 @@ note: an implementation of `Shr<_>` might be missing for `A` | LL | struct A; | ^^^^^^^^ must implement `Shr<_>` -note: the following trait must be implemented +note: the trait `Shr` must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | pub trait Shr<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: binary operation `==` cannot be applied to type `A` --> $DIR/issue-28837.rs:24:7 diff --git a/src/test/ui/binop/issue-3820.stderr b/src/test/ui/binop/issue-3820.stderr index f21f8906911..c313ed6037f 100644 --- a/src/test/ui/binop/issue-3820.stderr +++ b/src/test/ui/binop/issue-3820.stderr @@ -11,11 +11,8 @@ note: an implementation of `Mul<_>` might be missing for `Thing` | LL | struct Thing { | ^^^^^^^^^^^^ must implement `Mul<_>` -note: the following trait must be implemented +note: the trait `Mul` must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | pub trait Mul<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/borrowck/access-mode-in-closures.stderr b/src/test/ui/borrowck/access-mode-in-closures.stderr index 13a6277da14..abee72ba8cf 100644 --- a/src/test/ui/borrowck/access-mode-in-closures.stderr +++ b/src/test/ui/borrowck/access-mode-in-closures.stderr @@ -3,10 +3,15 @@ error[E0507]: cannot move out of `s` which is behind a shared reference | LL | match *s { S(v) => v } | ^^ - - | | | - | | data moved here - | | move occurs because `v` has type `Vec<isize>`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*s` + | | + | data moved here + | move occurs because `v` has type `Vec<isize>`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - match *s { S(v) => v } +LL + match s { S(v) => v } + | error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr index 2eabc1f1d9d..f9ced03e0f0 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr @@ -2,31 +2,46 @@ error[E0507]: cannot move out of a shared reference --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:15 | LL | for &a in x.iter() { - | -- ^^^^^^^^ - | || - | |data moved here - | |move occurs because `a` has type `&mut i32`, which does not implement the `Copy` trait - | help: consider removing the `&`: `a` + | - ^^^^^^^^ + | | + | data moved here + | move occurs because `a` has type `&mut i32`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - for &a in x.iter() { +LL + for a in x.iter() { + | error[E0507]: cannot move out of a shared reference --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:15 | LL | for &a in &f.a { - | -- ^^^^ - | || - | |data moved here - | |move occurs because `a` has type `Box<isize>`, which does not implement the `Copy` trait - | help: consider removing the `&`: `a` + | - ^^^^ + | | + | data moved here + | move occurs because `a` has type `Box<isize>`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - for &a in &f.a { +LL + for a in &f.a { + | error[E0507]: cannot move out of a shared reference --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15 | LL | for &a in x.iter() { - | -- ^^^^^^^^ - | || - | |data moved here - | |move occurs because `a` has type `Box<i32>`, which does not implement the `Copy` trait - | help: consider removing the `&`: `a` + | - ^^^^^^^^ + | | + | data moved here + | move occurs because `a` has type `Box<i32>`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - for &a in x.iter() { +LL + for a in x.iter() { + | error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.fixed b/src/test/ui/borrowck/borrowck-issue-2657-2.fixed new file mode 100644 index 00000000000..625e7c3cad5 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.fixed @@ -0,0 +1,12 @@ +// run-rustfix +fn main() { + + let x: Option<Box<_>> = Some(Box::new(1)); + + match x { + Some(ref y) => { + let _b = y; //~ ERROR cannot move out + } + _ => {} + } +} diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.rs b/src/test/ui/borrowck/borrowck-issue-2657-2.rs index 7dbac02154a..f79a846e70e 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.rs +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.rs @@ -1,3 +1,4 @@ +// run-rustfix fn main() { let x: Option<Box<_>> = Some(Box::new(1)); diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.stderr index f9ba2ca416b..850bb9ae393 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.stderr @@ -1,11 +1,14 @@ error[E0507]: cannot move out of `*y` which is behind a shared reference - --> $DIR/borrowck-issue-2657-2.rs:7:18 + --> $DIR/borrowck-issue-2657-2.rs:8:18 | LL | let _b = *y; - | ^^ - | | - | move occurs because `*y` has type `Box<i32>`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*y` + | ^^ move occurs because `*y` has type `Box<i32>`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let _b = *y; +LL + let _b = y; + | error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.fixed b/src/test/ui/borrowck/borrowck-move-error-with-note.fixed new file mode 100644 index 00000000000..cf6c382a692 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.fixed @@ -0,0 +1,56 @@ +// run-rustfix +#![allow(unused)] +enum Foo { + Foo1(Box<u32>, Box<u32>), + Foo2(Box<u32>), + Foo3, +} + + + +fn blah() { + let f = &Foo::Foo1(Box::new(1), Box::new(2)); + match f { //~ ERROR cannot move out of + Foo::Foo1(num1, + num2) => (), + Foo::Foo2(num) => (), + Foo::Foo3 => () + } +} + +struct S { + f: String, + g: String +} +impl Drop for S { + fn drop(&mut self) { println!("{}", self.f); } +} + +fn move_in_match() { + match (S {f: "foo".to_string(), g: "bar".to_string()}) { + //~^ ERROR cannot move out of type `S`, which implements the `Drop` trait + S { + f: ref _s, + g: ref _t + } => {} + } +} + +// from issue-8064 +struct A { + a: Box<isize>, +} + +fn free<T>(_: T) {} + +fn blah2() { + let a = &A { a: Box::new(1) }; + match &a.a { //~ ERROR cannot move out of + n => { + free(n) + } + } + free(a) +} + +fn main() {} diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.rs b/src/test/ui/borrowck/borrowck-move-error-with-note.rs index ef38cbb63a5..f336ac4f994 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.rs +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.rs @@ -1,3 +1,5 @@ +// run-rustfix +#![allow(unused)] enum Foo { Foo1(Box<u32>, Box<u32>), Foo2(Box<u32>), diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr index 96246d9ae1a..722c2c1443a 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.stderr +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr @@ -1,8 +1,8 @@ error[E0507]: cannot move out of `f` as enum variant `Foo1` which is behind a shared reference - --> $DIR/borrowck-move-error-with-note.rs:11:11 + --> $DIR/borrowck-move-error-with-note.rs:13:11 | LL | match *f { - | ^^ help: consider borrowing here: `&*f` + | ^^ LL | Foo::Foo1(num1, | ---- data moved here LL | num2) => (), @@ -11,9 +11,14 @@ LL | Foo::Foo2(num) => (), | --- ...and here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the dereference here + | +LL - match *f { +LL + match f { + | error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-error-with-note.rs:28:11 + --> $DIR/borrowck-move-error-with-note.rs:30:11 | LL | match (S {f: "foo".to_string(), g: "bar".to_string()}) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here @@ -24,17 +29,30 @@ LL | g: _t | -- ...and here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider borrowing the pattern binding + | +LL | f: ref _s, + | +++ +help: consider borrowing the pattern binding + | +LL | g: ref _t + | +++ error[E0507]: cannot move out of `a.a` which is behind a shared reference - --> $DIR/borrowck-move-error-with-note.rs:46:11 + --> $DIR/borrowck-move-error-with-note.rs:48:11 | LL | match a.a { - | ^^^ help: consider borrowing here: `&a.a` + | ^^^ LL | n => { | - | | | data moved here | move occurs because `n` has type `Box<isize>`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &a.a { + | + error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr index 7ac095e808a..43fc102bd62 100644 --- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr @@ -2,10 +2,13 @@ error[E0507]: cannot move out of `*x` which is behind a raw pointer --> $DIR/borrowck-move-from-unsafe-ptr.rs:2:13 | LL | let y = *x; - | ^^ - | | - | move occurs because `*x` has type `Box<isize>`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*x` + | ^^ move occurs because `*x` has type `Box<isize>`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let y = *x; +LL + let y = x; + | error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.stderr index 6b19f9d977e..21bd073321b 100644 --- a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.stderr +++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.stderr @@ -3,30 +3,45 @@ error[E0507]: cannot move out of a shared reference | LL | fn arg_item(&_x: &String) {} | ^-- - | || - | |data moved here - | |move occurs because `_x` has type `String`, which does not implement the `Copy` trait - | help: consider removing the `&`: `_x` + | | + | data moved here + | move occurs because `_x` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - fn arg_item(&_x: &String) {} +LL + fn arg_item(_x: &String) {} + | error[E0507]: cannot move out of a shared reference --> $DIR/borrowck-move-in-irrefut-pat.rs:7:11 | LL | with(|&_x| ()) | ^-- - | || - | |data moved here - | |move occurs because `_x` has type `String`, which does not implement the `Copy` trait - | help: consider removing the `&`: `_x` + | | + | data moved here + | move occurs because `_x` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - with(|&_x| ()) +LL + with(|_x| ()) + | error[E0507]: cannot move out of a shared reference --> $DIR/borrowck-move-in-irrefut-pat.rs:12:15 | LL | let &_x = &"hi".to_string(); - | --- ^^^^^^^^^^^^^^^^^ - | || - | |data moved here - | |move occurs because `_x` has type `String`, which does not implement the `Copy` trait - | help: consider removing the `&`: `_x` + | -- ^^^^^^^^^^^^^^^^^ + | | + | data moved here + | move occurs because `_x` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - let &_x = &"hi".to_string(); +LL + let _x = &"hi".to_string(); + | error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr index 800f30b34e5..ecf5382e863 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.stderr @@ -7,11 +7,8 @@ LL | let _x = Rc::new(vec![1, 2]).into_iter(); | | value moved due to this method call | move occurs because value has type `Vec<i32>`, which does not implement the `Copy` trait | -note: this function takes ownership of the receiver `self`, which moves value +note: `into_iter` takes ownership of the receiver `self`, which moves value --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr index 68994c2071b..599fa1e88df 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr @@ -2,10 +2,13 @@ error[E0507]: cannot move out of an `Rc` --> $DIR/borrowck-move-out-of-overloaded-deref.rs:4:14 | LL | let _x = *Rc::new("hi".to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | move occurs because value has type `String`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*Rc::new("hi".to_string())` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ move occurs because value has type `String`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let _x = *Rc::new("hi".to_string()); +LL + let _x = Rc::new("hi".to_string()); + | error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.fixed b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.fixed new file mode 100644 index 00000000000..c463c655938 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.fixed @@ -0,0 +1,24 @@ +// run-rustfix +#![allow(unused)] +struct S {f:String} +impl Drop for S { + fn drop(&mut self) { println!("{}", self.f); } +} + +fn move_in_match() { + match (S {f:"foo".to_string()}) { + //~^ ERROR [E0509] + S {f:ref _s} => {} + } +} + +fn move_in_let() { + let S {f:ref _s} = S {f:"foo".to_string()}; + //~^ ERROR [E0509] +} + +fn move_in_fn_arg(S {f:ref _s}: S) { + //~^ ERROR [E0509] +} + +fn main() {} diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs index a429f4bc33b..93183062d61 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs +++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs @@ -1,3 +1,5 @@ +// run-rustfix +#![allow(unused)] struct S {f:String} impl Drop for S { fn drop(&mut self) { println!("{}", self.f); } diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.stderr b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.stderr index 7b00ac9f1c3..58f706c65ff 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:7:11 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:9:11 | LL | match (S {f:"foo".to_string()}) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here @@ -9,18 +9,28 @@ LL | S {f:_s} => {} | | | data moved here | move occurs because `_s` has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | S {f:ref _s} => {} + | +++ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:14:20 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:16:20 | LL | let S {f:_s} = S {f:"foo".to_string()}; | -- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here | | | data moved here | move occurs because `_s` has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | let S {f:ref _s} = S {f:"foo".to_string()}; + | +++ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:19 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:20:19 | LL | fn move_in_fn_arg(S {f:_s}: S) { | ^^^^^--^ @@ -28,6 +38,11 @@ LL | fn move_in_fn_arg(S {f:_s}: S) { | | data moved here | | move occurs because `_s` has type `String`, which does not implement the `Copy` trait | cannot move out of here + | +help: consider borrowing the pattern binding + | +LL | fn move_in_fn_arg(S {f:ref _s}: S) { + | +++ error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.fixed b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.fixed new file mode 100644 index 00000000000..bc2ddf85fb4 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.fixed @@ -0,0 +1,24 @@ +// run-rustfix +#![allow(unused)] +struct S(String); +impl Drop for S { + fn drop(&mut self) { } +} + +fn move_in_match() { + match S("foo".to_string()) { + //~^ ERROR cannot move out of type `S`, which implements the `Drop` trait + S(ref _s) => {} + } +} + +fn move_in_let() { + let S(ref _s) = S("foo".to_string()); + //~^ ERROR cannot move out of type `S`, which implements the `Drop` trait +} + +fn move_in_fn_arg(S(ref _s): S) { + //~^ ERROR cannot move out of type `S`, which implements the `Drop` trait +} + +fn main() {} diff --git a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs index 5bd32f82ebc..f050bce8740 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs +++ b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs @@ -1,3 +1,5 @@ +// run-rustfix +#![allow(unused)] struct S(String); impl Drop for S { fn drop(&mut self) { } diff --git a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr index f00181b7468..160a1f99f63 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:7:11 + --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:9:11 | LL | match S("foo".to_string()) { | ^^^^^^^^^^^^^^^^^^^^ cannot move out of here @@ -9,18 +9,28 @@ LL | S(_s) => {} | | | data moved here | move occurs because `_s` has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | S(ref _s) => {} + | +++ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:14:17 + --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:16:17 | LL | let S(_s) = S("foo".to_string()); | -- ^^^^^^^^^^^^^^^^^^^^ cannot move out of here | | | data moved here | move occurs because `_s` has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | let S(ref _s) = S("foo".to_string()); + | +++ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:18:19 + --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:20:19 | LL | fn move_in_fn_arg(S(_s): S) { | ^^--^ @@ -28,6 +38,11 @@ LL | fn move_in_fn_arg(S(_s): S) { | | data moved here | | move occurs because `_s` has type `String`, which does not implement the `Copy` trait | cannot move out of here + | +help: consider borrowing the pattern binding + | +LL | fn move_in_fn_arg(S(ref _s): S) { + | +++ error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr index a865812cb4a..9ff20a1f46a 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr @@ -10,10 +10,10 @@ LL | Foo { string: b }] => { | - ...and here | = note: move occurs because these variables have types that don't implement the `Copy` trait -help: consider removing the `&` +help: consider removing the borrow | -LL ~ [Foo { string: a }, -LL ~ Foo { string: b }] => { +LL - &[Foo { string: a }, +LL + [Foo { string: a }, | error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr index 2b4293b433e..f5f4817e9bf 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr @@ -2,10 +2,12 @@ error[E0507]: cannot move out of index of `MyVec<Box<i32>>` --> $DIR/borrowck-overloaded-index-move-from-vec.rs:20:15 | LL | let bad = v[0]; - | ^^^^ - | | - | move occurs because value has type `Box<i32>`, which does not implement the `Copy` trait - | help: consider borrowing here: `&v[0]` + | ^^^^ move occurs because value has type `Box<i32>`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let bad = &v[0]; + | + error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs index 8a9296c5978..0e9284a2cad 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs @@ -37,7 +37,7 @@ fn c() { &mut [_a, //~^ NOTE data moved here //~| NOTE move occurs because `_a` has type - //~| HELP consider removing the `&mut` + //~| HELP consider removing the mutable borrow .. ] => { } @@ -56,7 +56,7 @@ fn d() { //~^ ERROR cannot move out //~| NOTE cannot move out &mut [ - //~^ HELP consider removing the `&mut` + //~^ HELP consider removing the mutable borrow _b] => {} //~^ NOTE data moved here //~| NOTE move occurs because `_b` has type @@ -79,7 +79,7 @@ fn e() { //~^ NOTE data moved here //~| NOTE and here //~| NOTE and here - //~| HELP consider removing the `&mut` + //~| HELP consider removing the mutable borrow _ => {} } let a = vec[0]; //~ ERROR cannot move out diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr index c3bcb7de65d..0dc5e64e4ff 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -34,14 +34,10 @@ LL | &mut [_a, | data moved here | move occurs because `_a` has type `Box<isize>`, which does not implement the `Copy` trait | -help: consider removing the `&mut` +help: consider removing the mutable borrow | -LL ~ [_a, -LL + -LL + -LL + -LL + .. -LL ~ ] => { +LL - &mut [_a, +LL + [_a, | error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice @@ -52,7 +48,11 @@ LL | let a = vec[0]; | | | cannot move out of here | move occurs because `vec[_]` has type `Box<isize>`, which does not implement the `Copy` trait - | help: consider borrowing here: `&vec[0]` + | +help: consider borrowing here + | +LL | let a = &vec[0]; + | + error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:55:11 @@ -66,11 +66,10 @@ LL | _b] => {} | data moved here | move occurs because `_b` has type `Box<isize>`, which does not implement the `Copy` trait | -help: consider removing the `&mut` +help: consider removing the mutable borrow | -LL ~ [ -LL + -LL ~ _b] => {} +LL - &mut [ +LL + [ | error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice @@ -81,7 +80,11 @@ LL | let a = vec[0]; | | | cannot move out of here | move occurs because `vec[_]` has type `Box<isize>`, which does not implement the `Copy` trait - | help: consider borrowing here: `&vec[0]` + | +help: consider borrowing here + | +LL | let a = &vec[0]; + | + error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:74:11 @@ -90,14 +93,17 @@ LL | match vec { | ^^^ cannot move out of here ... LL | &mut [_a, _b, _c] => {} - | ----------------- - | | | | | - | | | | ...and here - | | | ...and here - | | data moved here - | help: consider removing the `&mut`: `[_a, _b, _c]` + | -- -- -- ...and here + | | | + | | ...and here + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the mutable borrow + | +LL - &mut [_a, _b, _c] => {} +LL + [_a, _b, _c] => {} + | error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:85:13 @@ -107,7 +113,11 @@ LL | let a = vec[0]; | | | cannot move out of here | move occurs because `vec[_]` has type `Box<isize>`, which does not implement the `Copy` trait - | help: consider borrowing here: `&vec[0]` + | +help: consider borrowing here + | +LL | let a = &vec[0]; + | + error: aborting due to 8 previous errors diff --git a/src/test/ui/borrowck/issue-17718-static-move.stderr b/src/test/ui/borrowck/issue-17718-static-move.stderr index 984534bfb8b..65aea5b1834 100644 --- a/src/test/ui/borrowck/issue-17718-static-move.stderr +++ b/src/test/ui/borrowck/issue-17718-static-move.stderr @@ -2,10 +2,12 @@ error[E0507]: cannot move out of static item `FOO` --> $DIR/issue-17718-static-move.rs:6:14 | LL | let _a = FOO; - | ^^^ - | | - | move occurs because `FOO` has type `Foo`, which does not implement the `Copy` trait - | help: consider borrowing here: `&FOO` + | ^^^ move occurs because `FOO` has type `Foo`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let _a = &FOO; + | + error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-20801.stderr b/src/test/ui/borrowck/issue-20801.stderr index d276231dc0c..215bf010063 100644 --- a/src/test/ui/borrowck/issue-20801.stderr +++ b/src/test/ui/borrowck/issue-20801.stderr @@ -2,37 +2,49 @@ error[E0507]: cannot move out of a mutable reference --> $DIR/issue-20801.rs:26:22 | LL | let a = unsafe { *mut_ref() }; - | ^^^^^^^^^^ - | | - | move occurs because value has type `T`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*mut_ref()` + | ^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let a = unsafe { *mut_ref() }; +LL + let a = unsafe { mut_ref() }; + | error[E0507]: cannot move out of a shared reference --> $DIR/issue-20801.rs:29:22 | LL | let b = unsafe { *imm_ref() }; - | ^^^^^^^^^^ - | | - | move occurs because value has type `T`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*imm_ref()` + | ^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let b = unsafe { *imm_ref() }; +LL + let b = unsafe { imm_ref() }; + | error[E0507]: cannot move out of a raw pointer --> $DIR/issue-20801.rs:32:22 | LL | let c = unsafe { *mut_ptr() }; - | ^^^^^^^^^^ - | | - | move occurs because value has type `T`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*mut_ptr()` + | ^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let c = unsafe { *mut_ptr() }; +LL + let c = unsafe { mut_ptr() }; + | error[E0507]: cannot move out of a raw pointer --> $DIR/issue-20801.rs:35:22 | LL | let d = unsafe { *const_ptr() }; - | ^^^^^^^^^^^^ - | | - | move occurs because value has type `T`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*const_ptr()` + | ^^^^^^^^^^^^ move occurs because value has type `T`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let d = unsafe { *const_ptr() }; +LL + let d = unsafe { const_ptr() }; + | error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-29166.rs b/src/test/ui/borrowck/issue-29166.rs index ca819ba39a2..ca819ba39a2 100644 --- a/src/test/ui/issues/issue-29166.rs +++ b/src/test/ui/borrowck/issue-29166.rs diff --git a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr index eb41af1cea8..8d4918867f7 100644 --- a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr +++ b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr @@ -2,10 +2,12 @@ error[E0507]: cannot move out of static item `X` --> $DIR/issue-47215-ice-from-drop-elab.rs:17:21 | LL | let mut x = X; - | ^ - | | - | move occurs because `X` has type `AtomicUsize`, which does not implement the `Copy` trait - | help: consider borrowing here: `&X` + | ^ move occurs because `X` has type `AtomicUsize`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let mut x = &X; + | + error: aborting due to previous error diff --git a/src/test/ui/issues/issue-51301.rs b/src/test/ui/borrowck/issue-51301.rs index 7e0a5190fcd..7e0a5190fcd 100644 --- a/src/test/ui/issues/issue-51301.rs +++ b/src/test/ui/borrowck/issue-51301.rs diff --git a/src/test/ui/issues/issue-51301.stderr b/src/test/ui/borrowck/issue-51301.stderr index f3decf7a991..6ec920cb81f 100644 --- a/src/test/ui/issues/issue-51301.stderr +++ b/src/test/ui/borrowck/issue-51301.stderr @@ -6,6 +6,11 @@ LL | .find(|(&event_type, _)| event == event_type) | | | data moved here | move occurs because `event_type` has type `EventType`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | .find(|(&ref event_type, _)| event == event_type) + | +++ error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-51415.fixed b/src/test/ui/borrowck/issue-51415.fixed new file mode 100644 index 00000000000..92943f6c9ec --- /dev/null +++ b/src/test/ui/borrowck/issue-51415.fixed @@ -0,0 +1,12 @@ +// run-rustfix +// Regression test for #51415: match default bindings were failing to +// see the "move out" implied by `&s` below. + +fn main() { + let a = vec![String::from("a")]; + let opt = a.iter().enumerate().find(|(_, &ref s)| { + //~^ ERROR cannot move out + *s == String::from("d") + }).map(|(i, _)| i); + println!("{:?}", opt); +} diff --git a/src/test/ui/borrowck/issue-51415.rs b/src/test/ui/borrowck/issue-51415.rs index f031308fb78..56ed57a61a0 100644 --- a/src/test/ui/borrowck/issue-51415.rs +++ b/src/test/ui/borrowck/issue-51415.rs @@ -1,3 +1,4 @@ +// run-rustfix // Regression test for #51415: match default bindings were failing to // see the "move out" implied by `&s` below. diff --git a/src/test/ui/borrowck/issue-51415.stderr b/src/test/ui/borrowck/issue-51415.stderr index a88819efcf7..0d486b45592 100644 --- a/src/test/ui/borrowck/issue-51415.stderr +++ b/src/test/ui/borrowck/issue-51415.stderr @@ -1,11 +1,16 @@ error[E0507]: cannot move out of a shared reference - --> $DIR/issue-51415.rs:6:42 + --> $DIR/issue-51415.rs:7:42 | LL | let opt = a.iter().enumerate().find(|(_, &s)| { | ^^^^^-^ | | | data moved here | move occurs because `s` has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | let opt = a.iter().enumerate().find(|(_, &ref s)| { + | +++ error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr index 1f9cbdb7342..99c63e4db50 100644 --- a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr +++ b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr @@ -2,10 +2,13 @@ error[E0507]: cannot move out of `*array` which is behind a shared reference --> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:14:13 | LL | *array - | ^^^^^^ - | | - | move occurs because `*array` has type `Vec<Value>`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*array` + | ^^^^^^ move occurs because `*array` has type `Vec<Value>`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - *array +LL + array + | error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-81899.stderr b/src/test/ui/borrowck/issue-81899.stderr index a4d5f212188..1b03bc3af9c 100644 --- a/src/test/ui/borrowck/issue-81899.stderr +++ b/src/test/ui/borrowck/issue-81899.stderr @@ -1,15 +1,19 @@ error[E0080]: evaluation of constant value failed --> $DIR/issue-81899.rs:11:5 | -LL | const _CONST: &[u8] = &f(&[], |_| {}); - | -------------- inside `_CONST` at $DIR/issue-81899.rs:4:24 -... +LL | panic!() + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:11:5 + | +note: inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:34]>` + --> $DIR/issue-81899.rs:11:5 + | LL | panic!() | ^^^^^^^^ - | | - | the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:11:5 - | inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL +note: inside `_CONST` + --> $DIR/issue-81899.rs:4:24 | +LL | const _CONST: &[u8] = &f(&[], |_| {}); + | ^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant used diff --git a/src/test/ui/borrowck/issue-83760.stderr b/src/test/ui/borrowck/issue-83760.stderr index 2552fff860c..a585bff0c65 100644 --- a/src/test/ui/borrowck/issue-83760.stderr +++ b/src/test/ui/borrowck/issue-83760.stderr @@ -27,11 +27,8 @@ LL | foo = Some(Struct); LL | let _y = foo; | ^^^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `foo` +note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo` --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | pub const fn unwrap(self) -> T { - | ^^^^ error[E0382]: use of moved value: `foo` --> $DIR/issue-83760.rs:37:14 @@ -55,11 +52,8 @@ LL | foo = Some(Struct); LL | } else if true { LL | foo = Some(Struct); | ^^^^^^^^^^^^^^^^^^ -note: this function takes ownership of the receiver `self`, which moves `foo` +note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `foo` --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | pub const fn unwrap(self) -> T { - | ^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/issue-87456-point-to-closure.stderr b/src/test/ui/borrowck/issue-87456-point-to-closure.stderr index 039575a8d79..afd141125ac 100644 --- a/src/test/ui/borrowck/issue-87456-point-to-closure.stderr +++ b/src/test/ui/borrowck/issue-87456-point-to-closure.stderr @@ -8,10 +8,12 @@ LL | take_mut(|| { | -- captured by this `FnMut` closure LL | LL | let _foo: String = val; - | ^^^ - | | - | move occurs because `val` has type `String`, which does not implement the `Copy` trait - | help: consider borrowing here: `&val` + | ^^^ move occurs because `val` has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let _foo: String = &val; + | + error: aborting due to previous error diff --git a/src/test/ui/borrowck/issue-88434-minimal-example.stderr b/src/test/ui/borrowck/issue-88434-minimal-example.stderr index b95ddc49c99..a5a571c6d4d 100644 --- a/src/test/ui/borrowck/issue-88434-minimal-example.stderr +++ b/src/test/ui/borrowck/issue-88434-minimal-example.stderr @@ -1,15 +1,19 @@ error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-minimal-example.rs:10:5 | -LL | const _CONST: &() = &f(&|_| {}); - | ---------- inside `_CONST` at $DIR/issue-88434-minimal-example.rs:3:22 -... +LL | panic!() + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:10:5 + | +note: inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28]>` + --> $DIR/issue-88434-minimal-example.rs:10:5 + | LL | panic!() | ^^^^^^^^ - | | - | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:10:5 - | inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28]>` at $SRC_DIR/std/src/panic.rs:LL:COL +note: inside `_CONST` + --> $DIR/issue-88434-minimal-example.rs:3:22 | +LL | const _CONST: &() = &f(&|_| {}); + | ^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant used diff --git a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr index 604a6577639..00023c459a8 100644 --- a/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr +++ b/src/test/ui/borrowck/issue-88434-removal-index-should-be-less.stderr @@ -1,15 +1,19 @@ error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | -LL | const _CONST: &[u8] = &f(&[], |_| {}); - | -------------- inside `_CONST` at $DIR/issue-88434-removal-index-should-be-less.rs:3:24 -... +LL | panic!() + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:10:5 + | +note: inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34]>` + --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 + | LL | panic!() | ^^^^^^^^ - | | - | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:10:5 - | inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL +note: inside `_CONST` + --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24 | +LL | const _CONST: &[u8] = &f(&[], |_| {}); + | ^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant used diff --git a/src/test/ui/borrowck/move-error-snippets.stderr b/src/test/ui/borrowck/move-error-snippets.stderr index 984981ce2ea..8ac711e9e59 100644 --- a/src/test/ui/borrowck/move-error-snippets.stderr +++ b/src/test/ui/borrowck/move-error-snippets.stderr @@ -2,10 +2,7 @@ error[E0507]: cannot move out of static item `D` --> $DIR/move-error-snippets-ext.rs:5:17 | LL | let a = $c; - | ^^ - | | - | move occurs because `D` has type `A`, which does not implement the `Copy` trait - | help: consider borrowing here: `&$c` + | ^^ move occurs because `D` has type `A`, which does not implement the `Copy` trait | ::: $DIR/move-error-snippets.rs:21:1 | @@ -13,6 +10,10 @@ LL | sss!(); | ------ in this macro invocation | = note: this error originates in the macro `aaa` which comes from the expansion of the macro `sss` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider borrowing here + | +LL | let a = &$c; + | + error: aborting due to previous error diff --git a/src/test/ui/borrowck/reborrow-sugg-move-then-borrow.stderr b/src/test/ui/borrowck/reborrow-sugg-move-then-borrow.stderr index 13a2005e2ef..ecd916a59fc 100644 --- a/src/test/ui/borrowck/reborrow-sugg-move-then-borrow.stderr +++ b/src/test/ui/borrowck/reborrow-sugg-move-then-borrow.stderr @@ -9,11 +9,8 @@ LL | LL | fill_segment(state); | ^^^^^ value borrowed here after move | -note: this function takes ownership of the receiver `self`, which moves `state` +note: `into_iter` takes ownership of the receiver `self`, which moves `state` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ help: consider creating a fresh reborrow of `state` here | LL | for _ in &mut *state {} diff --git a/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr b/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr index b1af090aec2..4621d879351 100644 --- a/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr +++ b/src/test/ui/borrowck/suggest-as-ref-on-mut-closure.stderr @@ -8,11 +8,8 @@ LL | cb.map(|cb| cb()); | help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents | move occurs because `*cb` has type `Option<&mut dyn FnMut()>`, which does not implement the `Copy` trait | -note: this function takes ownership of the receiver `self`, which moves `*cb` +note: `Option::<T>::map` takes ownership of the receiver `self`, which moves `*cb` --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | pub const fn map<U, F>(self, f: F) -> Option<U> - | ^^^^ error[E0596]: cannot borrow `*cb` as mutable, as it is behind a `&` reference --> $DIR/suggest-as-ref-on-mut-closure.rs:12:26 diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr index 0c151b09707..b1367c65218 100644 --- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr +++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr @@ -10,11 +10,8 @@ LL | y.into_iter(); | | | move occurs because `y` has type `Vec<String>`, which does not implement the `Copy` trait | -note: this function takes ownership of the receiver `self`, which moves `y` +note: `into_iter` takes ownership of the receiver `self`, which moves `y` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/box/into-boxed-slice-fail.stderr b/src/test/ui/box/into-boxed-slice-fail.stderr index de654fdc1a4..f102f666dc2 100644 --- a/src/test/ui/box/into-boxed-slice-fail.stderr +++ b/src/test/ui/box/into-boxed-slice-fail.stderr @@ -9,9 +9,6 @@ LL | let _ = Box::into_boxed_slice(boxed_slice); = help: the trait `Sized` is not implemented for `[u8]` note: required by a bound in `Box::<T, A>::into_boxed_slice` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - | -LL | impl<T, A: Allocator> Box<T, A> { - | ^ required by this bound in `Box::<T, A>::into_boxed_slice` error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/into-boxed-slice-fail.rs:7:13 @@ -33,9 +30,6 @@ LL | let _ = Box::into_boxed_slice(boxed_trait); = help: the trait `Sized` is not implemented for `dyn Debug` note: required by a bound in `Box::<T, A>::into_boxed_slice` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - | -LL | impl<T, A: Allocator> Box<T, A> { - | ^ required by this bound in `Box::<T, A>::into_boxed_slice` error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time --> $DIR/into-boxed-slice-fail.rs:11:13 diff --git a/src/test/ui/by-move-pattern-binding.rs b/src/test/ui/by-move-pattern-binding.rs index d4c9f23164f..f68d181291d 100644 --- a/src/test/ui/by-move-pattern-binding.rs +++ b/src/test/ui/by-move-pattern-binding.rs @@ -19,4 +19,11 @@ fn main() { &E::Foo => {} &E::Bar(ref identifier) => println!("{}", *identifier) }; + if let &E::Bar(identifier) = &s.x { //~ ERROR cannot move + f(identifier.clone()); + }; + let &E::Bar(identifier) = &s.x else { //~ ERROR cannot move + return; + }; + f(identifier.clone()); } diff --git a/src/test/ui/by-move-pattern-binding.stderr b/src/test/ui/by-move-pattern-binding.stderr index 0012f67cfa1..203e37dc387 100644 --- a/src/test/ui/by-move-pattern-binding.stderr +++ b/src/test/ui/by-move-pattern-binding.stderr @@ -5,12 +5,47 @@ LL | match &s.x { | ^^^^ LL | &E::Foo => {} LL | &E::Bar(identifier) => f(identifier.clone()) - | ------------------- - | | | - | | data moved here - | | move occurs because `identifier` has type `String`, which does not implement the `Copy` trait - | help: consider removing the `&`: `E::Bar(identifier)` + | ---------- + | | + | data moved here + | move occurs because `identifier` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - &E::Bar(identifier) => f(identifier.clone()) +LL + E::Bar(identifier) => f(identifier.clone()) + | + +error[E0507]: cannot move out of a shared reference + --> $DIR/by-move-pattern-binding.rs:22:34 + | +LL | if let &E::Bar(identifier) = &s.x { + | ---------- ^^^^ + | | + | data moved here + | move occurs because `identifier` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - if let &E::Bar(identifier) = &s.x { +LL + if let E::Bar(identifier) = &s.x { + | + +error[E0507]: cannot move out of a shared reference + --> $DIR/by-move-pattern-binding.rs:25:31 + | +LL | let &E::Bar(identifier) = &s.x else { + | ---------- ^^^^ + | | + | data moved here + | move occurs because `identifier` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - let &E::Bar(identifier) = &s.x else { +LL + let E::Bar(identifier) = &s.x else { + | -error: aborting due to previous error +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/c-variadic/issue-86053-1.stderr b/src/test/ui/c-variadic/issue-86053-1.stderr index 075bd1fc488..d1f13d52362 100644 --- a/src/test/ui/c-variadic/issue-86053-1.stderr +++ b/src/test/ui/c-variadic/issue-86053-1.stderr @@ -63,11 +63,9 @@ error[E0412]: cannot find type `F` in this scope | LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { | ^ + --> $SRC_DIR/core/src/ops/function.rs:LL:COL | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait Fn<Args: Tuple>: FnMut<Args> { - | -------------------------------------- similarly named trait `Fn` defined here + = note: similarly named trait `Fn` defined here | help: a trait with a similar name exists | diff --git a/src/test/ui/chalkify/bugs/async.stderr b/src/test/ui/chalkify/bugs/async.stderr index 4804df13340..eda867f4159 100644 --- a/src/test/ui/chalkify/bugs/async.stderr +++ b/src/test/ui/chalkify/bugs/async.stderr @@ -14,9 +14,6 @@ LL | | } = note: [async fn body@$DIR/async.rs:7:29: 9:2] must be a future or must implement `IntoFuture` to be awaited note: required by a bound in `identity_future` --> $SRC_DIR/core/src/future/mod.rs:LL:COL - | -LL | pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut { - | ^^^^^^^^^^^^^^^^^^ required by this bound in `identity_future` error[E0277]: the size for values of type `<[async fn body@$DIR/async.rs:7:29: 9:2] as Future>::Output` cannot be known at compilation time --> $DIR/async.rs:7:29 @@ -30,9 +27,6 @@ LL | | } = help: the trait `Sized` is not implemented for `<[async fn body@$DIR/async.rs:7:29: 9:2] as Future>::Output` note: required by a bound in `identity_future` --> $SRC_DIR/core/src/future/mod.rs:LL:COL - | -LL | pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut { - | ^ required by this bound in `identity_future` error[E0277]: `[async fn body@$DIR/async.rs:7:29: 9:2]` is not a future --> $DIR/async.rs:7:25 diff --git a/src/test/ui/check-static-values-constraints.stderr b/src/test/ui/check-static-values-constraints.stderr index 31939f7f6db..b13700a4ea5 100644 --- a/src/test/ui/check-static-values-constraints.stderr +++ b/src/test/ui/check-static-values-constraints.stderr @@ -58,10 +58,12 @@ error[E0507]: cannot move out of static item `x` --> $DIR/check-static-values-constraints.rs:110:45 | LL | let y = { static x: Box<isize> = box 3; x }; - | ^ - | | - | move occurs because `x` has type `Box<isize>`, which does not implement the `Copy` trait - | help: consider borrowing here: `&x` + | ^ move occurs because `x` has type `Box<isize>`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let y = { static x: Box<isize> = box 3; &x }; + | + error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:110:38 diff --git a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr index d5432755cfe..7a04ed7381e 100644 --- a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr +++ b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr @@ -6,8 +6,8 @@ LL | with_closure(|x: u32, y| {}); | help: consider giving this closure parameter an explicit type | -LL | with_closure(|x: u32, y: _| {}); - | +++ +LL | with_closure(|x: u32, y: /* Type */| {}); + | ++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/closures/closure-expected.stderr b/src/test/ui/closures/closure-expected.stderr index 7ffe3c1ef95..87a5d67a420 100644 --- a/src/test/ui/closures/closure-expected.stderr +++ b/src/test/ui/closures/closure-expected.stderr @@ -10,9 +10,6 @@ LL | let y = x.or_else(4); = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `Option::<T>::or_else` --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | F: ~const FnOnce() -> Option<T>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::<T>::or_else` error: aborting due to previous error diff --git a/src/test/ui/closures/closure-move-sync.stderr b/src/test/ui/closures/closure-move-sync.stderr index a2ca06b4e6e..64e3b51ea71 100644 --- a/src/test/ui/closures/closure-move-sync.stderr +++ b/src/test/ui/closures/closure-move-sync.stderr @@ -19,9 +19,6 @@ LL | let t = thread::spawn(|| { | ^^ note: required by a bound in `spawn` --> $SRC_DIR/std/src/thread/mod.rs:LL:COL - | -LL | F: Send + 'static, - | ^^^^ required by this bound in `spawn` error[E0277]: `Sender<()>` cannot be shared between threads safely --> $DIR/closure-move-sync.rs:18:19 @@ -40,9 +37,6 @@ LL | thread::spawn(|| tx.send(()).unwrap()); | ^^ note: required by a bound in `spawn` --> $SRC_DIR/std/src/thread/mod.rs:LL:COL - | -LL | F: Send + 'static, - | ^^^^ required by this bound in `spawn` error: aborting due to 2 previous errors diff --git a/src/test/ui/closures/closure-return-type-must-be-sized.stderr b/src/test/ui/closures/closure-return-type-must-be-sized.stderr index b07425bd825..d4fc723fa81 100644 --- a/src/test/ui/closures/closure-return-type-must-be-sized.stderr +++ b/src/test/ui/closures/closure-return-type-must-be-sized.stderr @@ -19,7 +19,7 @@ note: required by a bound in `a::bar` --> $DIR/closure-return-type-must-be-sized.rs:14:19 | LL | pub fn bar<F: FnOnce() -> R, R: ?Sized>() {} - | ^^^^^^^^^^^^^ required by this bound in `a::bar` + | ^^^^^^^^^^^^^ required by this bound in `bar` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time --> $DIR/closure-return-type-must-be-sized.rs:56:5 @@ -51,7 +51,7 @@ note: required by a bound in `b::bar` --> $DIR/closure-return-type-must-be-sized.rs:28:19 | LL | pub fn bar<F: Fn() -> R, R: ?Sized>() {} - | ^^^^^^^^^ required by this bound in `b::bar` + | ^^^^^^^^^ required by this bound in `bar` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time --> $DIR/closure-return-type-must-be-sized.rs:63:5 @@ -83,7 +83,7 @@ note: required by a bound in `c::bar` --> $DIR/closure-return-type-must-be-sized.rs:42:19 | LL | pub fn bar<F: FnMut() -> R, R: ?Sized>() {} - | ^^^^^^^^^^^^ required by this bound in `c::bar` + | ^^^^^^^^^^^^ required by this bound in `bar` error[E0277]: the size for values of type `dyn A` cannot be known at compilation time --> $DIR/closure-return-type-must-be-sized.rs:70:5 diff --git a/src/test/ui/closures/coerce-unsafe-to-closure.stderr b/src/test/ui/closures/coerce-unsafe-to-closure.stderr index 6ce63e829b3..449cd0b3177 100644 --- a/src/test/ui/closures/coerce-unsafe-to-closure.stderr +++ b/src/test/ui/closures/coerce-unsafe-to-closure.stderr @@ -10,9 +10,6 @@ LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute); = note: unsafe function cannot be called generically without an unsafe block note: required by a bound in `Option::<T>::map` --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | F: ~const FnOnce(T) -> U, - | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::<T>::map` error: aborting due to previous error diff --git a/src/test/ui/closures/issue-52437.stderr b/src/test/ui/closures/issue-52437.stderr index 4c24a54bbbe..9ba24c7a886 100644 --- a/src/test/ui/closures/issue-52437.stderr +++ b/src/test/ui/closures/issue-52437.stderr @@ -12,8 +12,8 @@ LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize] | help: consider giving this closure parameter an explicit type | -LL | [(); &(&'static: loop { |x: _| {}; }) as *const _ as usize] - | +++ +LL | [(); &(&'static: loop { |x: /* Type */| {}; }) as *const _ as usize] + | ++++++++++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/closures/issue-78720.stderr b/src/test/ui/closures/issue-78720.stderr index da3f539a007..1e860d32b2a 100644 --- a/src/test/ui/closures/issue-78720.stderr +++ b/src/test/ui/closures/issue-78720.stderr @@ -9,11 +9,9 @@ error[E0412]: cannot find type `F` in this scope | LL | _func: F, | ^ + --> $SRC_DIR/core/src/ops/function.rs:LL:COL | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait Fn<Args: Tuple>: FnMut<Args> { - | -------------------------------------- similarly named trait `Fn` defined here + = note: similarly named trait `Fn` defined here | help: a trait with a similar name exists | diff --git a/src/test/ui/closures/issue-87461.stderr b/src/test/ui/closures/issue-87461.stderr index 0e788a16eb0..72337892734 100644 --- a/src/test/ui/closures/issue-87461.stderr +++ b/src/test/ui/closures/issue-87461.stderr @@ -8,9 +8,6 @@ LL | Ok(()) | note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^ error[E0308]: mismatched types --> $DIR/issue-87461.rs:17:8 @@ -22,9 +19,6 @@ LL | Ok(()) | note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^ error[E0308]: mismatched types --> $DIR/issue-87461.rs:26:12 @@ -36,9 +30,6 @@ LL | Ok(()) | note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/closures/issue-90871.rs b/src/test/ui/closures/issue-90871.rs index 9c70bbc85ac..7ce061cd388 100644 --- a/src/test/ui/closures/issue-90871.rs +++ b/src/test/ui/closures/issue-90871.rs @@ -1,5 +1,7 @@ +#![feature(type_ascription)] + fn main() { - 2: n([u8; || 1]) + type_ascribe!(2, n([u8; || 1])) //~^ ERROR cannot find type `n` in this scope //~| ERROR mismatched types } diff --git a/src/test/ui/closures/issue-90871.stderr b/src/test/ui/closures/issue-90871.stderr index 1e102cc9805..4a578b4d7f5 100644 --- a/src/test/ui/closures/issue-90871.stderr +++ b/src/test/ui/closures/issue-90871.stderr @@ -1,21 +1,24 @@ error[E0412]: cannot find type `n` in this scope - --> $DIR/issue-90871.rs:2:8 + --> $DIR/issue-90871.rs:4:22 | -LL | 2: n([u8; || 1]) - | ^ expecting a type here because of type ascription +LL | type_ascribe!(2, n([u8; || 1])) + | ^ help: a trait with a similar name exists: `Fn` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL + | + = note: similarly named trait `Fn` defined here error[E0308]: mismatched types - --> $DIR/issue-90871.rs:2:15 + --> $DIR/issue-90871.rs:4:29 | -LL | 2: n([u8; || 1]) - | ^^^^ expected `usize`, found closure +LL | type_ascribe!(2, n([u8; || 1])) + | ^^^^ expected `usize`, found closure | = note: expected type `usize` - found closure `[closure@$DIR/issue-90871.rs:2:15: 2:17]` + found closure `[closure@$DIR/issue-90871.rs:4:29: 4:31]` help: use parentheses to call this closure | -LL | 2: n([u8; (|| 1)()]) - | + +++ +LL | type_ascribe!(2, n([u8; (|| 1)()])) + | + +++ error: aborting due to 2 previous errors diff --git a/src/test/ui/closures/multiple-fn-bounds.stderr b/src/test/ui/closures/multiple-fn-bounds.stderr index eefc123fed7..da26302c9d8 100644 --- a/src/test/ui/closures/multiple-fn-bounds.stderr +++ b/src/test/ui/closures/multiple-fn-bounds.stderr @@ -2,8 +2,10 @@ error[E0631]: type mismatch in closure arguments --> $DIR/multiple-fn-bounds.rs:10:5 | LL | foo(move |x| v); - | ^^^ -------- found signature defined here - | | + | ^^^ -------- + | | | | + | | | help: do not borrow the argument: `char` + | | found signature defined here | expected due to this | = note: expected closure signature `fn(char) -> _` diff --git a/src/test/ui/codemap_tests/tab_3.stderr b/src/test/ui/codemap_tests/tab_3.stderr index 080f6c39449..e0e369124a4 100644 --- a/src/test/ui/codemap_tests/tab_3.stderr +++ b/src/test/ui/codemap_tests/tab_3.stderr @@ -9,11 +9,8 @@ LL | { LL | println!("{:?}", some_vec); | ^^^^^^^^ value borrowed here after move | -note: this function takes ownership of the receiver `self`, which moves `some_vec` +note: `into_iter` takes ownership of the receiver `self`, which moves `some_vec` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider cloning the value if the performance cost is acceptable | diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs b/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs index c139e823c2a..d7b11317ad5 100644 --- a/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs +++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs @@ -6,27 +6,27 @@ use std::fmt::Debug; pub fn main() { - let _ = box { [1, 2, 3] }: Box<[i32]>; //~ ERROR mismatched types - let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; //~ ERROR mismatched types - let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[i32]>; + let _ = type_ascribe!(box { [1, 2, 3] }, Box<[i32]>); //~ ERROR mismatched types + let _ = type_ascribe!(box if true { [1, 2, 3] } else { [1, 3, 4] }, Box<[i32]>); //~ ERROR mismatched types + let _ = type_ascribe!(box match true { true => [1, 2, 3], false => [1, 3, 4] }, Box<[i32]>); //~^ ERROR mismatched types - let _ = box { |x| (x as u8) }: Box<dyn Fn(i32) -> _>; //~ ERROR mismatched types - let _ = box if true { false } else { true }: Box<dyn Debug>; //~ ERROR mismatched types - let _ = box match true { true => 'a', false => 'b' }: Box<dyn Debug>; //~ ERROR mismatched types + let _ = type_ascribe!(box { |x| (x as u8) }, Box<dyn Fn(i32) -> _>); //~ ERROR mismatched types + let _ = type_ascribe!(box if true { false } else { true }, Box<dyn Debug>); //~ ERROR mismatched types + let _ = type_ascribe!(box match true { true => 'a', false => 'b' }, Box<dyn Debug>); //~ ERROR mismatched types - let _ = &{ [1, 2, 3] }: &[i32]; //~ ERROR mismatched types - let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; //~ ERROR mismatched types - let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; + let _ = type_ascribe!(&{ [1, 2, 3] }, &[i32]); //~ ERROR mismatched types + let _ = type_ascribe!(&if true { [1, 2, 3] } else { [1, 3, 4] }, &[i32]); //~ ERROR mismatched types + let _ = type_ascribe!(&match true { true => [1, 2, 3], false => [1, 3, 4] }, &[i32]); //~^ ERROR mismatched types - let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _; //~ ERROR mismatched types - let _ = &if true { false } else { true }: &dyn Debug; //~ ERROR mismatched types - let _ = &match true { true => 'a', false => 'b' }: &dyn Debug; //~ ERROR mismatched types + let _ = type_ascribe!(&{ |x| (x as u8) }, &dyn Fn(i32) -> _); //~ ERROR mismatched types + let _ = type_ascribe!(&if true { false } else { true }, &dyn Debug); //~ ERROR mismatched types + let _ = type_ascribe!(&match true { true => 'a', false => 'b' }, &dyn Debug); //~ ERROR mismatched types - let _ = Box::new([1, 2, 3]): Box<[i32]>; //~ ERROR mismatched types - let _ = Box::new(|x| (x as u8)): Box<dyn Fn(i32) -> _>; //~ ERROR mismatched types + let _ = type_ascribe!(Box::new([1, 2, 3]), Box<[i32]>); //~ ERROR mismatched types + let _ = type_ascribe!(Box::new(|x| (x as u8)), Box<dyn Fn(i32) -> _>); //~ ERROR mismatched types - let _ = vec![ + let _ = type_ascribe!(vec![ Box::new(|x| (x as u8)), box |x| (x as i16 as u8), - ]: Vec<Box<dyn Fn(i32) -> _>>; + ], Vec<Box<dyn Fn(i32) -> _>>); } diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr index 9d614e610ad..44968244c4d 100644 --- a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -1,128 +1,128 @@ error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:9:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:9:27 | -LL | let _ = box { [1, 2, 3] }: Box<[i32]>; - | ^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` +LL | let _ = type_ascribe!(box { [1, 2, 3] }, Box<[i32]>); + | ^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` | = note: expected struct `Box<[i32]>` found struct `Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:10:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:10:27 | -LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` +LL | let _ = type_ascribe!(box if true { [1, 2, 3] } else { [1, 3, 4] }, Box<[i32]>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` | = note: expected struct `Box<[i32]>` found struct `Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:11:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:11:27 | -LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[i32]>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` +LL | let _ = type_ascribe!(box match true { true => [1, 2, 3], false => [1, 3, 4] }, Box<[i32]>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` | = note: expected struct `Box<[i32]>` found struct `Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:13:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:13:27 | -LL | let _ = box { |x| (x as u8) }: Box<dyn Fn(i32) -> _>; - | ^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure +LL | let _ = type_ascribe!(box { |x| (x as u8) }, Box<dyn Fn(i32) -> _>); + | ^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure | = note: expected struct `Box<dyn Fn(i32) -> u8>` - found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:19: 13:22]>` + found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:33: 13:36]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:14:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:14:27 | -LL | let _ = box if true { false } else { true }: Box<dyn Debug>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `bool` +LL | let _ = type_ascribe!(box if true { false } else { true }, Box<dyn Debug>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `bool` | = note: expected struct `Box<dyn Debug>` found struct `Box<bool>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:15:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:15:27 | -LL | let _ = box match true { true => 'a', false => 'b' }: Box<dyn Debug>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `char` +LL | let _ = type_ascribe!(box match true { true => 'a', false => 'b' }, Box<dyn Debug>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `char` | = note: expected struct `Box<dyn Debug>` found struct `Box<char>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:17:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:17:27 | -LL | let _ = &{ [1, 2, 3] }: &[i32]; - | ^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` +LL | let _ = type_ascribe!(&{ [1, 2, 3] }, &[i32]); + | ^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` | = note: expected reference `&[i32]` found reference `&[i32; 3]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:18:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:18:27 | -LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` +LL | let _ = type_ascribe!(&if true { [1, 2, 3] } else { [1, 3, 4] }, &[i32]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` | = note: expected reference `&[i32]` found reference `&[i32; 3]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:19:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:19:27 | -LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` +LL | let _ = type_ascribe!(&match true { true => [1, 2, 3], false => [1, 3, 4] }, &[i32]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` | = note: expected reference `&[i32]` found reference `&[i32; 3]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:21:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:21:27 | -LL | let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _; - | ^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure +LL | let _ = type_ascribe!(&{ |x| (x as u8) }, &dyn Fn(i32) -> _); + | ^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure | = note: expected reference `&dyn Fn(i32) -> u8` - found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:16: 21:19]` + found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:30: 21:33]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:22:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:22:27 | -LL | let _ = &if true { false } else { true }: &dyn Debug; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `bool` +LL | let _ = type_ascribe!(&if true { false } else { true }, &dyn Debug); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `bool` | = note: expected reference `&dyn Debug` found reference `&bool` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:23:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:23:27 | -LL | let _ = &match true { true => 'a', false => 'b' }: &dyn Debug; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `char` +LL | let _ = type_ascribe!(&match true { true => 'a', false => 'b' }, &dyn Debug); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `char` | = note: expected reference `&dyn Debug` found reference `&char` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:25:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:25:27 | -LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; - | ^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` +LL | let _ = type_ascribe!(Box::new([1, 2, 3]), Box<[i32]>); + | ^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` | = note: expected struct `Box<[i32]>` found struct `Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:26:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:26:27 | -LL | let _ = Box::new(|x| (x as u8)): Box<dyn Fn(i32) -> _>; - | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure +LL | let _ = type_ascribe!(Box::new(|x| (x as u8)), Box<dyn Fn(i32) -> _>); + | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure | = note: expected struct `Box<dyn Fn(i32) -> u8>` - found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:25]>` + found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:36: 26:39]>` error: aborting due to 14 previous errors diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index d4bd673b84e..d5b4349c00f 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -14,7 +14,7 @@ error: `cfg` predicate is not specified --> $DIR/cfg-attr-syntax-validation.rs:7:1 | LL | #[cfg()] - | ^^^^^^^^ + | ^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)` error: multiple `cfg` predicates are specified --> $DIR/cfg-attr-syntax-validation.rs:10:10 diff --git a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr index f2e7777ce68..a46bd53520b 100644 --- a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr +++ b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr @@ -18,9 +18,7 @@ LL | LL | 1_u32 | ----- return type was inferred to be `u32` here | - = help: the following other types implement trait `Traitor<N, M>`: - <u32 as Traitor<N, 2>> - <u64 as Traitor<1, 2>> + = help: the trait `Traitor<N, 2>` is implemented for `u32` error[E0277]: the trait bound `u64: Traitor` is not satisfied --> $DIR/rp_impl_trait_fail.rs:21:13 @@ -31,9 +29,7 @@ LL | LL | 1_u64 | ----- return type was inferred to be `u64` here | - = help: the following other types implement trait `Traitor<N, M>`: - <u32 as Traitor<N, 2>> - <u64 as Traitor<1, 2>> + = help: the trait `Traitor<1, 2>` is implemented for `u64` error: aborting due to 3 previous errors diff --git a/src/test/ui/const-generics/defaults/self-referential.rs b/src/test/ui/const-generics/defaults/self-referential.rs new file mode 100644 index 00000000000..14a870dc39b --- /dev/null +++ b/src/test/ui/const-generics/defaults/self-referential.rs @@ -0,0 +1,4 @@ +trait Foo<const M: u8, const M: u8 = M> {} +//~^ ERROR the name `M` is already used for a generic parameter in this item's generic parameters +impl Foo<2> for () {} +fn main() {} diff --git a/src/test/ui/const-generics/defaults/self-referential.stderr b/src/test/ui/const-generics/defaults/self-referential.stderr new file mode 100644 index 00000000000..170c1f7f7b2 --- /dev/null +++ b/src/test/ui/const-generics/defaults/self-referential.stderr @@ -0,0 +1,11 @@ +error[E0403]: the name `M` is already used for a generic parameter in this item's generic parameters + --> $DIR/self-referential.rs:1:30 + | +LL | trait Foo<const M: u8, const M: u8 = M> {} + | - ^ already used + | | + | first use of `M` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0403`. diff --git a/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr b/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr index 688db695fa8..13ea4a295af 100644 --- a/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr +++ b/src/test/ui/const-generics/generic_arg_infer/issue-91614.stderr @@ -5,11 +5,14 @@ LL | let y = Mask::<_, _>::splat(false); | ^ ------------------- type must be known at this point | = note: cannot satisfy `_: MaskElement` + = help: the following types implement trait `MaskElement`: + i16 + i32 + i64 + i8 + isize note: required by a bound in `Mask::<T, LANES>::splat` --> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/masks.rs:LL:COL - | -LL | T: MaskElement, - | ^^^^^^^^^^^ required by this bound in `Mask::<T, LANES>::splat` help: consider giving `y` an explicit type, where the type for type parameter `T` is specified | LL | let y: Mask<_, LANES> = Mask::<_, _>::splat(false); diff --git a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr index ada1050d35f..cdf97bd88fd 100644 --- a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr @@ -14,7 +14,7 @@ note: required by a bound in `use_trait_impl::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:14:23 | LL | fn assert_impl<T: Trait>() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:17:5 @@ -28,7 +28,7 @@ note: required by a bound in `use_trait_impl::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:14:23 | LL | fn assert_impl<T: Trait>() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error: unconstrained generic constant --> $DIR/abstract-const-as-cast-3.rs:20:19 @@ -46,7 +46,7 @@ note: required by a bound in `use_trait_impl::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:14:23 | LL | fn assert_impl<T: Trait>() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:20:5 @@ -60,7 +60,7 @@ note: required by a bound in `use_trait_impl::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:14:23 | LL | fn assert_impl<T: Trait>() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:23:5 @@ -74,7 +74,7 @@ note: required by a bound in `use_trait_impl::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:14:23 | LL | fn assert_impl<T: Trait>() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:25:5 @@ -88,7 +88,7 @@ note: required by a bound in `use_trait_impl::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:14:23 | LL | fn assert_impl<T: Trait>() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error: unconstrained generic constant --> $DIR/abstract-const-as-cast-3.rs:35:19 @@ -106,7 +106,7 @@ note: required by a bound in `use_trait_impl_2::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:32:23 | LL | fn assert_impl<T: Trait>() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:35:5 @@ -120,7 +120,7 @@ note: required by a bound in `use_trait_impl_2::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:32:23 | LL | fn assert_impl<T: Trait>() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error: unconstrained generic constant --> $DIR/abstract-const-as-cast-3.rs:38:19 @@ -138,7 +138,7 @@ note: required by a bound in `use_trait_impl_2::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:32:23 | LL | fn assert_impl<T: Trait>() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:38:5 @@ -152,7 +152,7 @@ note: required by a bound in `use_trait_impl_2::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:32:23 | LL | fn assert_impl<T: Trait>() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:41:5 @@ -166,7 +166,7 @@ note: required by a bound in `use_trait_impl_2::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:32:23 | LL | fn assert_impl<T: Trait>() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:43:5 @@ -180,7 +180,7 @@ note: required by a bound in `use_trait_impl_2::assert_impl` --> $DIR/abstract-const-as-cast-3.rs:32:23 | LL | fn assert_impl<T: Trait>() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` + | ^^^^^ required by this bound in `assert_impl` error: aborting due to 12 previous errors diff --git a/src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.rs b/src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.rs new file mode 100644 index 00000000000..6093fc70b16 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.rs @@ -0,0 +1,22 @@ +#![feature(generic_const_exprs, generic_arg_infer)] +#![allow(incomplete_features)] + +// minimized repro for #105205 +// +// the `foo::<_, L>` call results in a `WellFormed(_)` obligation and a +// `ConstEvaluatable(Unevaluated(_ + 1 + L))` obligation. Attempting to fulfill the latter +// unifies the `_` with `Expr(L - 1)` from the paramenv which turns the `WellFormed` +// obligation into `WellFormed(Expr(L - 1))` + +fn foo<const N: usize, const M: usize>(_: [(); N + 1 + M]) {} + +fn ice<const L: usize>() +where + [(); (L - 1) + 1 + L]:, +{ + foo::<_, L>([(); L + 1 + L]); + //~^ ERROR: mismatched types + //~^^ ERROR: unconstrained generic constant +} + +fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr b/src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr new file mode 100644 index 00000000000..da5194696e6 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr @@ -0,0 +1,20 @@ +error[E0308]: mismatched types + --> $DIR/wf_obligation.rs:17:17 + | +LL | foo::<_, L>([(); L + 1 + L]); + | ^^^^^^^^^^^^^^^ expected `N + 1 + M`, found `L + 1 + L` + | + = note: expected constant `N + 1 + M` + found constant `L + 1 + L` + +error: unconstrained generic constant + --> $DIR/wf_obligation.rs:17:22 + | +LL | foo::<_, L>([(); L + 1 + L]); + | ^^^^^^^^^ + | + = help: try adding a `where` bound using this expression: `where [(); L + 1 + L]:` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-105257.rs b/src/test/ui/const-generics/generic_const_exprs/issue-105257.rs new file mode 100644 index 00000000000..d8b23bc01a9 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-105257.rs @@ -0,0 +1,9 @@ +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +trait Trait<T> { + fn fnc<const N: usize = "">(&self) {} //~ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + fn foo<const N: usize = { std::mem::size_of::<T>() }>(&self) {} //~ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions +} + +fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-105257.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-105257.stderr new file mode 100644 index 00000000000..ed7a8cb19a4 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-105257.stderr @@ -0,0 +1,14 @@ +error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + --> $DIR/issue-105257.rs:5:12 + | +LL | fn fnc<const N: usize = "">(&self) {} + | ^^^^^^^^^^^^^^^^^^^ + +error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions + --> $DIR/issue-105257.rs:6:12 + | +LL | fn foo<const N: usize = { std::mem::size_of::<T>() }>(&self) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-105608.rs b/src/test/ui/const-generics/generic_const_exprs/issue-105608.rs new file mode 100644 index 00000000000..e28ba3b1ada --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-105608.rs @@ -0,0 +1,15 @@ +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +struct Combination<const STRATEGIES: usize>; + +impl<const STRATEGIES: usize> Combination<STRATEGIES> { + fn and<M>(self) -> Combination<{ STRATEGIES + 1 }> { + Combination + } +} + +pub fn main() { + Combination::<0>.and::<_>().and::<_>(); + //~^ ERROR: type annotations needed +} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-105608.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-105608.stderr new file mode 100644 index 00000000000..0be4c43daac --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-105608.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/issue-105608.rs:13:22 + | +LL | Combination::<0>.and::<_>().and::<_>(); + | ^^^ cannot infer type of the type parameter `M` declared on the associated function `and` + | +help: consider specifying the generic argument + | +LL | Combination::<0>.and::<_>().and::<_>(); + | ~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr index 4d0d0253f1b..e0444042614 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr @@ -41,6 +41,7 @@ LL | IsLessOrEqual<I, 8>: True, | ^^^^ | = note: cannot satisfy `IsLessOrEqual<I, 8>: True` + = help: the trait `True` is implemented for `IsLessOrEqual<LHS, RHS>` error[E0283]: type annotations needed: cannot satisfy `IsLessOrEqual<I, 8>: True` --> $DIR/issue-72787.rs:21:26 @@ -49,6 +50,7 @@ LL | IsLessOrEqual<I, 8>: True, | ^^^^ | = note: cannot satisfy `IsLessOrEqual<I, 8>: True` + = help: the trait `True` is implemented for `IsLessOrEqual<LHS, RHS>` error: aborting due to 6 previous errors diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.stderr index c90774e944f..029528c3a81 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/issue-79518-default_trait_method_normalization.rs:16:32 | LL | Self::AssocInstance == [(); std::mem::size_of::<Self::Assoc>()]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found array `[(); _]` + | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found array `[(); _]` + | | + | expected because this is `<Self as Foo>::Assoc` | = note: expected associated type `<Self as Foo>::Assoc` found array `[(); _]` diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-80742.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-80742.stderr index 1b502642eb7..a08c9912527 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-80742.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-80742.stderr @@ -1,16 +1,15 @@ error[E0080]: evaluation of `Inline::<dyn std::fmt::Debug>::{constant#0}` failed --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | -LL | intrinsics::size_of::<T>() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | size_of called on unsized type `dyn Debug` - | inside `std::mem::size_of::<dyn Debug>` at $SRC_DIR/core/src/mem/mod.rs:LL:COL + = note: size_of called on unsized type `dyn Debug` | - ::: $DIR/issue-80742.rs:22:10 +note: inside `std::mem::size_of::<dyn Debug>` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL +note: inside `Inline::<dyn Debug>::{constant#0}` + --> $DIR/issue-80742.rs:22:10 | LL | [u8; size_of::<T>() + 1]: , - | -------------- inside `Inline::<dyn Debug>::{constant#0}` at $DIR/issue-80742.rs:22:10 + | ^^^^^^^^^^^^^^ error[E0599]: the function or associated item `new` exists for struct `Inline<dyn Debug>`, but its trait bounds were not satisfied --> $DIR/issue-80742.rs:30:36 @@ -20,11 +19,9 @@ LL | struct Inline<T> ... LL | let dst = Inline::<dyn Debug>::new(0); | ^^^ function or associated item cannot be called on `Inline<dyn Debug>` due to unsatisfied trait bounds + --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL | - ::: $SRC_DIR/core/src/fmt/mod.rs:LL:COL - | -LL | pub trait Debug { - | --------------- doesn't satisfy `dyn Debug: Sized` + = note: doesn't satisfy `dyn Debug: Sized` | = note: the following trait bounds were not satisfied: `dyn Debug: Sized` @@ -32,16 +29,15 @@ LL | pub trait Debug { error[E0080]: evaluation of `Inline::<dyn std::fmt::Debug>::{constant#0}` failed --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | -LL | intrinsics::size_of::<T>() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | size_of called on unsized type `dyn Debug` - | inside `std::mem::size_of::<dyn Debug>` at $SRC_DIR/core/src/mem/mod.rs:LL:COL + = note: size_of called on unsized type `dyn Debug` | - ::: $DIR/issue-80742.rs:14:10 +note: inside `std::mem::size_of::<dyn Debug>` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL +note: inside `Inline::<dyn Debug>::{constant#0}` + --> $DIR/issue-80742.rs:14:10 | LL | [u8; size_of::<T>() + 1]: , - | -------------- inside `Inline::<dyn Debug>::{constant#0}` at $DIR/issue-80742.rs:14:10 + | ^^^^^^^^^^^^^^ error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time --> $DIR/issue-80742.rs:30:15 diff --git a/src/test/ui/const-generics/generic_const_exprs/normed_to_param_is_evaluatable.rs b/src/test/ui/const-generics/generic_const_exprs/normed_to_param_is_evaluatable.rs new file mode 100644 index 00000000000..b37b354ae21 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/normed_to_param_is_evaluatable.rs @@ -0,0 +1,12 @@ +// check-pass +#![feature(generic_const_exprs)] +#![allow(incomplete_features, unused_braces)] + +#[rustfmt::skip] +fn foo<const N: usize>() { + bar::<{{{{{{ N }}}}}}>(); +} + +fn bar<const N: usize>() {} + +fn main() {} diff --git a/src/test/ui/const-generics/invalid-const-arg-for-type-param.stderr b/src/test/ui/const-generics/invalid-const-arg-for-type-param.stderr index d955b4f9651..8c76ca69029 100644 --- a/src/test/ui/const-generics/invalid-const-arg-for-type-param.stderr +++ b/src/test/ui/const-generics/invalid-const-arg-for-type-param.stderr @@ -4,11 +4,6 @@ error[E0107]: this associated function takes 0 generic arguments but 1 generic a LL | let _: u32 = 5i32.try_into::<32>().unwrap(); | ^^^^^^^^ expected 0 generic arguments | -note: associated function defined here, with 0 generic parameters - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn try_into(self) -> Result<T, Self::Error>; - | ^^^^^^^^ help: consider moving this generic argument to the `TryInto` trait, which takes up to 1 argument | LL | let _: u32 = TryInto::<32>::try_into(5i32).unwrap(); diff --git a/src/test/ui/const-generics/invalid-constant-in-args.stderr b/src/test/ui/const-generics/invalid-constant-in-args.stderr index 1400d2bf5a7..993b63518e4 100644 --- a/src/test/ui/const-generics/invalid-constant-in-args.stderr +++ b/src/test/ui/const-generics/invalid-constant-in-args.stderr @@ -5,12 +5,6 @@ LL | let _: Cell<&str, "a"> = Cell::new(""); | ^^^^ --- help: remove this generic argument | | | expected 1 generic argument - | -note: struct defined here, with 1 generic parameter: `T` - --> $SRC_DIR/core/src/cell.rs:LL:COL - | -LL | pub struct Cell<T: ?Sized> { - | ^^^^ - error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-100313.stderr b/src/test/ui/const-generics/issues/issue-100313.stderr index f3ce357c2bb..d4b486376ca 100644 --- a/src/test/ui/const-generics/issues/issue-100313.stderr +++ b/src/test/ui/const-generics/issues/issue-100313.stderr @@ -2,13 +2,18 @@ error[E0080]: evaluation of constant value failed --> $DIR/issue-100313.rs:10:13 | LL | *(B as *const bool as *mut bool) = false; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ writing to alloc7 which is read-only + | +note: inside `T::<&true>::set_false` + --> $DIR/issue-100313.rs:10:13 + | +LL | *(B as *const bool as *mut bool) = false; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | writing to alloc7 which is read-only - | inside `T::<&true>::set_false` at $DIR/issue-100313.rs:10:13 -... +note: inside `_` + --> $DIR/issue-100313.rs:18:5 + | LL | x.set_false(); - | ------------- inside `_` at $DIR/issue-100313.rs:18:5 + | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/const-generics/issues/issue-83249.stderr b/src/test/ui/const-generics/issues/issue-83249.stderr index 362b8554b2f..7491fdc8a69 100644 --- a/src/test/ui/const-generics/issues/issue-83249.stderr +++ b/src/test/ui/const-generics/issues/issue-83249.stderr @@ -6,8 +6,8 @@ LL | let _ = foo([0; 1]); | help: consider giving this pattern a type | -LL | let _: _ = foo([0; 1]); - | +++ +LL | let _: /* Type */ = foo([0; 1]); + | ++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/const-ptr/forbidden_slices.32bit.stderr b/src/test/ui/const-ptr/forbidden_slices.32bit.stderr index 8978ab436d0..3a58a7cd7ef 100644 --- a/src/test/ui/const-ptr/forbidden_slices.32bit.stderr +++ b/src/test/ui/const-ptr/forbidden_slices.32bit.stderr @@ -1,44 +1,41 @@ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/slice/raw.rs:LL:COL | -LL | &*ptr::slice_from_raw_parts(data, len) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance) - | inside `std::slice::from_raw_parts::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance) | - ::: $DIR/forbidden_slices.rs:18:34 +note: inside `std::slice::from_raw_parts::<'_, u32>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `S0` + --> $DIR/forbidden_slices.rs:18:34 | LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) }; - | ------------------------------ inside `S0` at $DIR/forbidden_slices.rs:18:34 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/slice/raw.rs:LL:COL | -LL | &*ptr::slice_from_raw_parts(data, len) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance) - | inside `std::slice::from_raw_parts::<'_, ()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance) | - ::: $DIR/forbidden_slices.rs:19:33 +note: inside `std::slice::from_raw_parts::<'_, ()>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `S1` + --> $DIR/forbidden_slices.rs:19:33 | LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) }; - | ------------------------------ inside `S1` at $DIR/forbidden_slices.rs:19:33 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/slice/raw.rs:LL:COL | -LL | &*ptr::slice_from_raw_parts(data, len) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | dereferencing pointer failed: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds - | inside `std::slice::from_raw_parts::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: dereferencing pointer failed: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds | - ::: $DIR/forbidden_slices.rs:22:34 +note: inside `std::slice::from_raw_parts::<'_, u32>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `S2` + --> $DIR/forbidden_slices.rs:22:34 | LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) }; - | ---------------------- inside `S2` at $DIR/forbidden_slices.rs:22:34 + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:25:1 @@ -88,73 +85,61 @@ LL | pub static S7: &[u16] = unsafe { error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/slice/raw.rs:LL:COL | -LL | &*ptr::slice_from_raw_parts(data, len) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | dereferencing pointer failed: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds - | inside `std::slice::from_raw_parts::<'_, u64>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: dereferencing pointer failed: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds | - ::: $DIR/forbidden_slices.rs:43:5 +note: inside `std::slice::from_raw_parts::<'_, u64>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `S8` + --> $DIR/forbidden_slices.rs:43:5 | LL | from_raw_parts(ptr, 1) - | ---------------------- inside `S8` at $DIR/forbidden_slices.rs:43:5 + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance) - | inside `ptr::const_ptr::<impl *const u32>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance) | - ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL - | -LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) } - | ------------------------------ inside `from_ptr_range::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL - | - ::: $DIR/forbidden_slices.rs:46:34 +note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `from_ptr_range::<'_, u32>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `R0` + --> $DIR/forbidden_slices.rs:46:34 | LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; - | ---------------------------------------- inside `R0` at $DIR/forbidden_slices.rs:46:34 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | assert!(0 < pointee_size && pointee_size <= isize::MAX as usize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the evaluated program panicked at 'assertion failed: 0 < pointee_size && pointee_size <= isize::MAX as usize', $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `ptr::const_ptr::<impl *const ()>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | - ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL - | -LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) } - | ------------------------------ inside `from_ptr_range::<'_, ()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: the evaluated program panicked at 'assertion failed: 0 < pointee_size && pointee_size <= isize::MAX as usize', $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - ::: $DIR/forbidden_slices.rs:47:33 +note: inside `ptr::const_ptr::<impl *const ()>::sub_ptr` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `from_ptr_range::<'_, ()>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `R1` + --> $DIR/forbidden_slices.rs:47:33 | LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; - | ---------------------------------------- inside `R1` at $DIR/forbidden_slices.rs:47:33 - | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds pointer arithmetic: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds - | inside `ptr::const_ptr::<impl *const u32>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -... -LL | unsafe { self.offset(count as isize) } - | --------------------------- inside `ptr::const_ptr::<impl *const u32>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds pointer arithmetic: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds | - ::: $DIR/forbidden_slices.rs:50:25 +note: inside `ptr::const_ptr::<impl *const u32>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `ptr::const_ptr::<impl *const u32>::add` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `R2` + --> $DIR/forbidden_slices.rs:50:25 | LL | from_ptr_range(ptr..ptr.add(2)) - | ---------- inside `R2` at $DIR/forbidden_slices.rs:50:25 + | ^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:52:1 @@ -204,57 +189,47 @@ LL | pub static R7: &[u16] = unsafe { error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds pointer arithmetic: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds - | inside `ptr::const_ptr::<impl *const u64>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -... -LL | unsafe { self.offset(count as isize) } - | --------------------------- inside `ptr::const_ptr::<impl *const u64>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds pointer arithmetic: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds | - ::: $DIR/forbidden_slices.rs:74:25 +note: inside `ptr::const_ptr::<impl *const u64>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `ptr::const_ptr::<impl *const u64>::add` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `R8` + --> $DIR/forbidden_slices.rs:74:25 | LL | from_ptr_range(ptr..ptr.add(1)) - | ---------- inside `R8` at $DIR/forbidden_slices.rs:74:25 + | ^^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | `ptr_offset_from_unsigned` called on pointers into different allocations - | inside `ptr::const_ptr::<impl *const u32>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | - ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL - | -LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) } - | ------------------------------ inside `from_ptr_range::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: `ptr_offset_from_unsigned` called on pointers into different allocations | - ::: $DIR/forbidden_slices.rs:79:34 +note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `from_ptr_range::<'_, u32>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `R9` + --> $DIR/forbidden_slices.rs:79:34 | LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) }; - | ----------------------------------------------- inside `R9` at $DIR/forbidden_slices.rs:79:34 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | `ptr_offset_from_unsigned` called on pointers into different allocations - | inside `ptr::const_ptr::<impl *const u32>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | - ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: `ptr_offset_from_unsigned` called on pointers into different allocations | -LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) } - | ------------------------------ inside `from_ptr_range::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL - | - ::: $DIR/forbidden_slices.rs:80:35 +note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `from_ptr_range::<'_, u32>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `R10` + --> $DIR/forbidden_slices.rs:80:35 | LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) }; - | ------------------------ inside `R10` at $DIR/forbidden_slices.rs:80:35 + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 18 previous errors diff --git a/src/test/ui/const-ptr/forbidden_slices.64bit.stderr b/src/test/ui/const-ptr/forbidden_slices.64bit.stderr index db42b7c9830..4e929e3525c 100644 --- a/src/test/ui/const-ptr/forbidden_slices.64bit.stderr +++ b/src/test/ui/const-ptr/forbidden_slices.64bit.stderr @@ -1,44 +1,41 @@ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/slice/raw.rs:LL:COL | -LL | &*ptr::slice_from_raw_parts(data, len) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance) - | inside `std::slice::from_raw_parts::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance) | - ::: $DIR/forbidden_slices.rs:18:34 +note: inside `std::slice::from_raw_parts::<'_, u32>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `S0` + --> $DIR/forbidden_slices.rs:18:34 | LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) }; - | ------------------------------ inside `S0` at $DIR/forbidden_slices.rs:18:34 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/slice/raw.rs:LL:COL | -LL | &*ptr::slice_from_raw_parts(data, len) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance) - | inside `std::slice::from_raw_parts::<'_, ()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance) | - ::: $DIR/forbidden_slices.rs:19:33 +note: inside `std::slice::from_raw_parts::<'_, ()>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `S1` + --> $DIR/forbidden_slices.rs:19:33 | LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) }; - | ------------------------------ inside `S1` at $DIR/forbidden_slices.rs:19:33 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/slice/raw.rs:LL:COL | -LL | &*ptr::slice_from_raw_parts(data, len) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | dereferencing pointer failed: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds - | inside `std::slice::from_raw_parts::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: dereferencing pointer failed: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds | - ::: $DIR/forbidden_slices.rs:22:34 +note: inside `std::slice::from_raw_parts::<'_, u32>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `S2` + --> $DIR/forbidden_slices.rs:22:34 | LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) }; - | ---------------------- inside `S2` at $DIR/forbidden_slices.rs:22:34 + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:25:1 @@ -88,73 +85,61 @@ LL | pub static S7: &[u16] = unsafe { error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/slice/raw.rs:LL:COL | -LL | &*ptr::slice_from_raw_parts(data, len) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | dereferencing pointer failed: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds - | inside `std::slice::from_raw_parts::<'_, u64>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: dereferencing pointer failed: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds | - ::: $DIR/forbidden_slices.rs:43:5 +note: inside `std::slice::from_raw_parts::<'_, u64>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `S8` + --> $DIR/forbidden_slices.rs:43:5 | LL | from_raw_parts(ptr, 1) - | ---------------------- inside `S8` at $DIR/forbidden_slices.rs:43:5 + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance) - | inside `ptr::const_ptr::<impl *const u32>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance) | - ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL - | -LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) } - | ------------------------------ inside `from_ptr_range::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL - | - ::: $DIR/forbidden_slices.rs:46:34 +note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `from_ptr_range::<'_, u32>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `R0` + --> $DIR/forbidden_slices.rs:46:34 | LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; - | ---------------------------------------- inside `R0` at $DIR/forbidden_slices.rs:46:34 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | assert!(0 < pointee_size && pointee_size <= isize::MAX as usize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the evaluated program panicked at 'assertion failed: 0 < pointee_size && pointee_size <= isize::MAX as usize', $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | inside `ptr::const_ptr::<impl *const ()>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | - ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL - | -LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) } - | ------------------------------ inside `from_ptr_range::<'_, ()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: the evaluated program panicked at 'assertion failed: 0 < pointee_size && pointee_size <= isize::MAX as usize', $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | - ::: $DIR/forbidden_slices.rs:47:33 +note: inside `ptr::const_ptr::<impl *const ()>::sub_ptr` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `from_ptr_range::<'_, ()>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `R1` + --> $DIR/forbidden_slices.rs:47:33 | LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; - | ---------------------------------------- inside `R1` at $DIR/forbidden_slices.rs:47:33 - | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds pointer arithmetic: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds - | inside `ptr::const_ptr::<impl *const u32>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -... -LL | unsafe { self.offset(count as isize) } - | --------------------------- inside `ptr::const_ptr::<impl *const u32>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds pointer arithmetic: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds | - ::: $DIR/forbidden_slices.rs:50:25 +note: inside `ptr::const_ptr::<impl *const u32>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `ptr::const_ptr::<impl *const u32>::add` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `R2` + --> $DIR/forbidden_slices.rs:50:25 | LL | from_ptr_range(ptr..ptr.add(2)) - | ---------- inside `R2` at $DIR/forbidden_slices.rs:50:25 + | ^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value --> $DIR/forbidden_slices.rs:52:1 @@ -204,57 +189,47 @@ LL | pub static R7: &[u16] = unsafe { error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds pointer arithmetic: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds - | inside `ptr::const_ptr::<impl *const u64>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL -... -LL | unsafe { self.offset(count as isize) } - | --------------------------- inside `ptr::const_ptr::<impl *const u64>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds pointer arithmetic: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds | - ::: $DIR/forbidden_slices.rs:74:25 +note: inside `ptr::const_ptr::<impl *const u64>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `ptr::const_ptr::<impl *const u64>::add` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `R8` + --> $DIR/forbidden_slices.rs:74:25 | LL | from_ptr_range(ptr..ptr.add(1)) - | ---------- inside `R8` at $DIR/forbidden_slices.rs:74:25 + | ^^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | `ptr_offset_from_unsigned` called on pointers into different allocations - | inside `ptr::const_ptr::<impl *const u32>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | - ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL - | -LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) } - | ------------------------------ inside `from_ptr_range::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: `ptr_offset_from_unsigned` called on pointers into different allocations | - ::: $DIR/forbidden_slices.rs:79:34 +note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `from_ptr_range::<'_, u32>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `R9` + --> $DIR/forbidden_slices.rs:79:34 | LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) }; - | ----------------------------------------------- inside `R9` at $DIR/forbidden_slices.rs:79:34 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | `ptr_offset_from_unsigned` called on pointers into different allocations - | inside `ptr::const_ptr::<impl *const u32>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | - ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL + = note: `ptr_offset_from_unsigned` called on pointers into different allocations | -LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) } - | ------------------------------ inside `from_ptr_range::<'_, u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL - | - ::: $DIR/forbidden_slices.rs:80:35 +note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `from_ptr_range::<'_, u32>` + --> $SRC_DIR/core/src/slice/raw.rs:LL:COL +note: inside `R10` + --> $DIR/forbidden_slices.rs:80:35 | LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) }; - | ------------------------ inside `R10` at $DIR/forbidden_slices.rs:80:35 + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 18 previous errors diff --git a/src/test/ui/const-ptr/out_of_bounds_read.stderr b/src/test/ui/const-ptr/out_of_bounds_read.stderr index 52b173c4d04..3e7b09a5982 100644 --- a/src/test/ui/const-ptr/out_of_bounds_read.stderr +++ b/src/test/ui/const-ptr/out_of_bounds_read.stderr @@ -1,54 +1,45 @@ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | -LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds - | inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + = note: memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds | - ::: $DIR/out_of_bounds_read.rs:12:33 +note: inside `std::ptr::read::<u32>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `_READ` + --> $DIR/out_of_bounds_read.rs:12:33 | LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) }; - | ----------------------- inside `_READ` at $DIR/out_of_bounds_read.rs:12:33 + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | -LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds - | inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | - ::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds | -LL | unsafe { read(self) } - | ---------- inside `ptr::const_ptr::<impl *const u32>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | - ::: $DIR/out_of_bounds_read.rs:13:39 +note: inside `std::ptr::read::<u32>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `ptr::const_ptr::<impl *const u32>::read` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `_CONST_READ` + --> $DIR/out_of_bounds_read.rs:13:39 | LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() }; - | ------------------- inside `_CONST_READ` at $DIR/out_of_bounds_read.rs:13:39 + | ^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | -LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds - | inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + = note: memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds | - ::: $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - | -LL | unsafe { read(self) } - | ---------- inside `ptr::mut_ptr::<impl *mut u32>::read` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - | - ::: $DIR/out_of_bounds_read.rs:14:37 +note: inside `std::ptr::read::<u32>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `ptr::mut_ptr::<impl *mut u32>::read` + --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL +note: inside `_MUT_READ` + --> $DIR/out_of_bounds_read.rs:14:37 | LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() }; - | --------------------------------- inside `_MUT_READ` at $DIR/out_of_bounds_read.rs:14:37 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr index c685922c456..f199170018f 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr @@ -12,15 +12,10 @@ LL | = [0; (i8::MAX + 1u8) as usize]; | = help: the trait `~const Add<u8>` is not implemented for `i8` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> - <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> - <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&i8 as Add<&i8>> + <i8 as Add<&i8>> + <i8 as Add> error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr index b396079240a..1f8e402317a 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr @@ -12,15 +12,10 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize] | = help: the trait `~const Add<u8>` is not implemented for `i8` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> - <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> - <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&i8 as Add<&i8>> + <i8 as Add<&i8>> + <i8 as Add> error[E0604]: only `u8` can be cast as `char`, not `i8` --> $DIR/const-eval-overflow-4b.rs:22:13 diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr index 3784a3861c3..0734f479f98 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr +++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr @@ -2,25 +2,35 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_fn_ptr_fail2.rs:9:5 | LL | x(y) + | ^^^^ calling non-const function `double` + | +note: inside `bar` + --> $DIR/const_fn_ptr_fail2.rs:9:5 + | +LL | x(y) | ^^^^ - | | - | calling non-const function `double` - | inside `bar` at $DIR/const_fn_ptr_fail2.rs:9:5 -... +note: inside `Y` + --> $DIR/const_fn_ptr_fail2.rs:14:18 + | LL | const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday - | --------- inside `Y` at $DIR/const_fn_ptr_fail2.rs:14:18 + | ^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $DIR/const_fn_ptr_fail2.rs:9:5 | LL | x(y) + | ^^^^ calling non-const function `double` + | +note: inside `bar` + --> $DIR/const_fn_ptr_fail2.rs:9:5 + | +LL | x(y) | ^^^^ - | | - | calling non-const function `double` - | inside `bar` at $DIR/const_fn_ptr_fail2.rs:9:5 -... +note: inside `Z` + --> $DIR/const_fn_ptr_fail2.rs:15:18 + | LL | const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday - | -------------- inside `Z` at $DIR/const_fn_ptr_fail2.rs:15:18 + | ^^^^^^^^^^^^^^ warning: skipping const checks | diff --git a/src/test/ui/consts/const-eval/const_panic_track_caller.stderr b/src/test/ui/consts/const-eval/const_panic_track_caller.stderr index 5c3b412d37f..846458176d6 100644 --- a/src/test/ui/consts/const-eval/const_panic_track_caller.stderr +++ b/src/test/ui/consts/const-eval/const_panic_track_caller.stderr @@ -2,13 +2,18 @@ error[E0080]: evaluation of constant value failed --> $DIR/const_panic_track_caller.rs:15:5 | LL | b() + | ^^^ the evaluated program panicked at 'hey', $DIR/const_panic_track_caller.rs:15:5 + | +note: inside `c` + --> $DIR/const_panic_track_caller.rs:15:5 + | +LL | b() | ^^^ - | | - | the evaluated program panicked at 'hey', $DIR/const_panic_track_caller.rs:15:5 - | inside `c` at $DIR/const_panic_track_caller.rs:15:5 -... +note: inside `X` + --> $DIR/const_panic_track_caller.rs:21:16 + | LL | const X: u32 = c(); - | --- inside `X` at $DIR/const_panic_track_caller.rs:21:16 + | ^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr index 2628a78455c..8f3b3d5f700 100644 --- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr +++ b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr @@ -1,14 +1,19 @@ error[E0080]: evaluation of constant value failed --> $DIR/alloc_intrinsic_errors.rs:9:17 | -LL | const FOO: i32 = foo(); - | ----- inside `FOO` at $DIR/alloc_intrinsic_errors.rs:6:18 -... +LL | let _ = intrinsics::const_allocate(4, 3) as *mut i32; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ align has to be a power of 2, `3` is not a power of 2 + | +note: inside `foo` + --> $DIR/alloc_intrinsic_errors.rs:9:17 + | LL | let _ = intrinsics::const_allocate(4, 3) as *mut i32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | align has to be a power of 2, `3` is not a power of 2 - | inside `foo` at $DIR/alloc_intrinsic_errors.rs:9:17 +note: inside `FOO` + --> $DIR/alloc_intrinsic_errors.rs:6:18 + | +LL | const FOO: i32 = foo(); + | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/unwind-abort.stderr b/src/test/ui/consts/const-eval/unwind-abort.stderr index 99178ae8c83..759ce15ab1b 100644 --- a/src/test/ui/consts/const-eval/unwind-abort.stderr +++ b/src/test/ui/consts/const-eval/unwind-abort.stderr @@ -2,14 +2,18 @@ error[E0080]: evaluation of constant value failed --> $DIR/unwind-abort.rs:4:5 | LL | panic!() + | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/unwind-abort.rs:4:5 + | +note: inside `foo` + --> $DIR/unwind-abort.rs:4:5 + | +LL | panic!() | ^^^^^^^^ - | | - | the evaluated program panicked at 'explicit panic', $DIR/unwind-abort.rs:4:5 - | inside `foo` at $SRC_DIR/std/src/panic.rs:LL:COL -... -LL | const _: () = foo(); - | ----- inside `_` at $DIR/unwind-abort.rs:7:15 +note: inside `_` + --> $DIR/unwind-abort.rs:7:15 | +LL | const _: () = foo(); + | ^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr index 8b4d845b30e..9710bf476ec 100644 --- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr +++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr @@ -14,13 +14,18 @@ error[E0080]: evaluation of constant value failed --> $DIR/validate_uninhabited_zsts.rs:4:14 | LL | unsafe { std::mem::transmute(()) } + | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type + | +note: inside `foo` + --> $DIR/validate_uninhabited_zsts.rs:4:14 + | +LL | unsafe { std::mem::transmute(()) } | ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | transmuting to uninhabited type - | inside `foo` at $DIR/validate_uninhabited_zsts.rs:4:14 -... +note: inside `FOO` + --> $DIR/validate_uninhabited_zsts.rs:19:33 + | LL | const FOO: [empty::Empty; 3] = [foo(); 3]; - | ----- inside `FOO` at $DIR/validate_uninhabited_zsts.rs:19:33 + | ^^^^^ error[E0080]: it is undefined behavior to use this value --> $DIR/validate_uninhabited_zsts.rs:21:1 diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr index 8b4d845b30e..9710bf476ec 100644 --- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr +++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr @@ -14,13 +14,18 @@ error[E0080]: evaluation of constant value failed --> $DIR/validate_uninhabited_zsts.rs:4:14 | LL | unsafe { std::mem::transmute(()) } + | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type + | +note: inside `foo` + --> $DIR/validate_uninhabited_zsts.rs:4:14 + | +LL | unsafe { std::mem::transmute(()) } | ^^^^^^^^^^^^^^^^^^^^^^^ - | | - | transmuting to uninhabited type - | inside `foo` at $DIR/validate_uninhabited_zsts.rs:4:14 -... +note: inside `FOO` + --> $DIR/validate_uninhabited_zsts.rs:19:33 + | LL | const FOO: [empty::Empty; 3] = [foo(); 3]; - | ----- inside `FOO` at $DIR/validate_uninhabited_zsts.rs:19:33 + | ^^^^^ error[E0080]: it is undefined behavior to use this value --> $DIR/validate_uninhabited_zsts.rs:21:1 diff --git a/src/test/ui/consts/const-float-bits-reject-conv.stderr b/src/test/ui/consts/const-float-bits-reject-conv.stderr index e1ad72416f2..7ad02252094 100644 --- a/src/test/ui/consts/const-float-bits-reject-conv.stderr +++ b/src/test/ui/consts/const-float-bits-reject-conv.stderr @@ -1,39 +1,33 @@ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/num/f32.rs:LL:COL | -LL | panic!("const-eval error: cannot use f32::to_bits on a NaN") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the evaluated program panicked at 'const-eval error: cannot use f32::to_bits on a NaN', $SRC_DIR/core/src/num/f32.rs:LL:COL - | inside `core::f32::<impl f32>::to_bits::ct_f32_to_u32` at $SRC_DIR/core/src/panic.rs:LL:COL -... -LL | unsafe { intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32) } - | -------------------------------------------------------------------- inside `core::f32::<impl f32>::to_bits` at $SRC_DIR/core/src/num/f32.rs:LL:COL + = note: the evaluated program panicked at 'const-eval error: cannot use f32::to_bits on a NaN', $SRC_DIR/core/src/num/f32.rs:LL:COL | - ::: $DIR/const-float-bits-reject-conv.rs:28:30 +note: inside `core::f32::<impl f32>::to_bits::ct_f32_to_u32` + --> $SRC_DIR/core/src/num/f32.rs:LL:COL +note: inside `core::f32::<impl f32>::to_bits` + --> $SRC_DIR/core/src/num/f32.rs:LL:COL +note: inside `f32::MASKED_NAN1` + --> $DIR/const-float-bits-reject-conv.rs:28:30 | LL | const MASKED_NAN1: u32 = f32::NAN.to_bits() ^ 0x002A_AAAA; - | ------------------ inside `f32::MASKED_NAN1` at $DIR/const-float-bits-reject-conv.rs:28:30 - | + | ^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/num/f32.rs:LL:COL | -LL | panic!("const-eval error: cannot use f32::to_bits on a NaN") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the evaluated program panicked at 'const-eval error: cannot use f32::to_bits on a NaN', $SRC_DIR/core/src/num/f32.rs:LL:COL - | inside `core::f32::<impl f32>::to_bits::ct_f32_to_u32` at $SRC_DIR/core/src/panic.rs:LL:COL -... -LL | unsafe { intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32) } - | -------------------------------------------------------------------- inside `core::f32::<impl f32>::to_bits` at $SRC_DIR/core/src/num/f32.rs:LL:COL + = note: the evaluated program panicked at 'const-eval error: cannot use f32::to_bits on a NaN', $SRC_DIR/core/src/num/f32.rs:LL:COL | - ::: $DIR/const-float-bits-reject-conv.rs:30:30 +note: inside `core::f32::<impl f32>::to_bits::ct_f32_to_u32` + --> $SRC_DIR/core/src/num/f32.rs:LL:COL +note: inside `core::f32::<impl f32>::to_bits` + --> $SRC_DIR/core/src/num/f32.rs:LL:COL +note: inside `f32::MASKED_NAN2` + --> $DIR/const-float-bits-reject-conv.rs:30:30 | LL | const MASKED_NAN2: u32 = f32::NAN.to_bits() ^ 0x0055_5555; - | ------------------ inside `f32::MASKED_NAN2` at $DIR/const-float-bits-reject-conv.rs:30:30 - | + | ^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant used @@ -63,39 +57,33 @@ LL | const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/num/f64.rs:LL:COL | -LL | panic!("const-eval error: cannot use f64::to_bits on a NaN") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the evaluated program panicked at 'const-eval error: cannot use f64::to_bits on a NaN', $SRC_DIR/core/src/num/f64.rs:LL:COL - | inside `core::f64::<impl f64>::to_bits::ct_f64_to_u64` at $SRC_DIR/core/src/panic.rs:LL:COL -... -LL | unsafe { intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) } - | -------------------------------------------------------------------- inside `core::f64::<impl f64>::to_bits` at $SRC_DIR/core/src/num/f64.rs:LL:COL + = note: the evaluated program panicked at 'const-eval error: cannot use f64::to_bits on a NaN', $SRC_DIR/core/src/num/f64.rs:LL:COL | - ::: $DIR/const-float-bits-reject-conv.rs:50:30 +note: inside `core::f64::<impl f64>::to_bits::ct_f64_to_u64` + --> $SRC_DIR/core/src/num/f64.rs:LL:COL +note: inside `core::f64::<impl f64>::to_bits` + --> $SRC_DIR/core/src/num/f64.rs:LL:COL +note: inside `f64::MASKED_NAN1` + --> $DIR/const-float-bits-reject-conv.rs:50:30 | LL | const MASKED_NAN1: u64 = f64::NAN.to_bits() ^ 0x000A_AAAA_AAAA_AAAA; - | ------------------ inside `f64::MASKED_NAN1` at $DIR/const-float-bits-reject-conv.rs:50:30 - | + | ^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/num/f64.rs:LL:COL | -LL | panic!("const-eval error: cannot use f64::to_bits on a NaN") - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | the evaluated program panicked at 'const-eval error: cannot use f64::to_bits on a NaN', $SRC_DIR/core/src/num/f64.rs:LL:COL - | inside `core::f64::<impl f64>::to_bits::ct_f64_to_u64` at $SRC_DIR/core/src/panic.rs:LL:COL -... -LL | unsafe { intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) } - | -------------------------------------------------------------------- inside `core::f64::<impl f64>::to_bits` at $SRC_DIR/core/src/num/f64.rs:LL:COL + = note: the evaluated program panicked at 'const-eval error: cannot use f64::to_bits on a NaN', $SRC_DIR/core/src/num/f64.rs:LL:COL | - ::: $DIR/const-float-bits-reject-conv.rs:52:30 +note: inside `core::f64::<impl f64>::to_bits::ct_f64_to_u64` + --> $SRC_DIR/core/src/num/f64.rs:LL:COL +note: inside `core::f64::<impl f64>::to_bits` + --> $SRC_DIR/core/src/num/f64.rs:LL:COL +note: inside `f64::MASKED_NAN2` + --> $DIR/const-float-bits-reject-conv.rs:52:30 | LL | const MASKED_NAN2: u64 = f64::NAN.to_bits() ^ 0x0005_5555_5555_5555; - | ------------------ inside `f64::MASKED_NAN2` at $DIR/const-float-bits-reject-conv.rs:52:30 - | + | ^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant used diff --git a/src/test/ui/consts/const-fn-error.stderr b/src/test/ui/consts/const-fn-error.stderr index 02960b363e7..f6b532fb658 100644 --- a/src/test/ui/consts/const-fn-error.stderr +++ b/src/test/ui/consts/const-fn-error.stderr @@ -21,9 +21,6 @@ LL | for i in 0..x { | note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | impl<I: Iterator> const IntoIterator for I { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants error[E0658]: mutable references are not allowed in constant functions diff --git a/src/test/ui/consts/const-for.stderr b/src/test/ui/consts/const-for.stderr index 11e4ae309c0..294ea627d85 100644 --- a/src/test/ui/consts/const-for.stderr +++ b/src/test/ui/consts/const-for.stderr @@ -6,9 +6,6 @@ LL | for _ in 0..5 {} | note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | impl<I: Iterator> const IntoIterator for I { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: calls in constants are limited to constant functions, tuple structs and tuple variants error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants diff --git a/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr b/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr index 234e55e3a96..6e110dbdd64 100644 --- a/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr +++ b/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr @@ -2,13 +2,18 @@ error[E0080]: evaluation of constant value failed --> $DIR/mut_ref_in_final_dynamic_check.rs:13:10 | LL | Some(&mut *(42 as *mut i32)) + | ^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: 0x2a[noalloc] is a dangling pointer (it has no provenance) + | +note: inside `helper` + --> $DIR/mut_ref_in_final_dynamic_check.rs:13:10 + | +LL | Some(&mut *(42 as *mut i32)) | ^^^^^^^^^^^^^^^^^^^^^^ - | | - | dereferencing pointer failed: 0x2a[noalloc] is a dangling pointer (it has no provenance) - | inside `helper` at $DIR/mut_ref_in_final_dynamic_check.rs:13:10 -... +note: inside `A` + --> $DIR/mut_ref_in_final_dynamic_check.rs:18:29 + | LL | const A: Option<&mut i32> = helper(); - | -------- inside `A` at $DIR/mut_ref_in_final_dynamic_check.rs:18:29 + | ^^^^^^^^ error: encountered dangling pointer in final constant --> $DIR/mut_ref_in_final_dynamic_check.rs:25:1 diff --git a/src/test/ui/consts/const_in_pattern/accept_structural.rs b/src/test/ui/consts/const_in_pattern/accept_structural.rs index 5093fe53915..1f56f581c02 100644 --- a/src/test/ui/consts/const_in_pattern/accept_structural.rs +++ b/src/test/ui/consts/const_in_pattern/accept_structural.rs @@ -45,7 +45,7 @@ fn main() { const TUPLE: (OND, OND) = (None, None); match (None, None) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), }; - const TYPE_ASCRIPTION: OND = None: OND; + const TYPE_ASCRIPTION: OND = type_ascribe!(None, OND); match None { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), }; const ARRAY: [OND; 2] = [None, None]; diff --git a/src/test/ui/consts/const_in_pattern/reject_non_structural.rs b/src/test/ui/consts/const_in_pattern/reject_non_structural.rs index 7a8169bec45..75fde0d92de 100644 --- a/src/test/ui/consts/const_in_pattern/reject_non_structural.rs +++ b/src/test/ui/consts/const_in_pattern/reject_non_structural.rs @@ -53,7 +53,7 @@ fn main() { match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), }; //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` - const TYPE_ASCRIPTION: OND = Some(NoDerive): OND; + const TYPE_ASCRIPTION: OND = type_ascribe!(Some(NoDerive), OND); match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), }; //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` diff --git a/src/test/ui/consts/const_unsafe_unreachable_ub.stderr b/src/test/ui/consts/const_unsafe_unreachable_ub.stderr index f6de3699f77..593a51bfe8f 100644 --- a/src/test/ui/consts/const_unsafe_unreachable_ub.stderr +++ b/src/test/ui/consts/const_unsafe_unreachable_ub.stderr @@ -1,19 +1,20 @@ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/hint.rs:LL:COL | -LL | intrinsics::unreachable() - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | entering unreachable code - | inside `unreachable_unchecked` at $SRC_DIR/core/src/hint.rs:LL:COL + = note: entering unreachable code | - ::: $DIR/const_unsafe_unreachable_ub.rs:6:18 +note: inside `unreachable_unchecked` + --> $SRC_DIR/core/src/hint.rs:LL:COL +note: inside `foo` + --> $DIR/const_unsafe_unreachable_ub.rs:6:18 | LL | false => std::hint::unreachable_unchecked(), - | ---------------------------------- inside `foo` at $DIR/const_unsafe_unreachable_ub.rs:6:18 -... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: inside `BAR` + --> $DIR/const_unsafe_unreachable_ub.rs:10:28 + | LL | const BAR: bool = unsafe { foo(false) }; - | ---------- inside `BAR` at $DIR/const_unsafe_unreachable_ub.rs:10:28 + | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr b/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr index 4726905ade3..51eec783365 100644 --- a/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr +++ b/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr @@ -31,21 +31,17 @@ LL | let _x: &u32 = transmute(&[0u8; 4]); error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | -LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | accessing memory with alignment 1, but alignment 4 is required - | inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + = note: accessing memory with alignment 1, but alignment 4 is required | - ::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | -LL | unsafe { read(self) } - | ---------- inside `ptr::const_ptr::<impl *const u32>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | - ::: $DIR/detect-extra-ub.rs:38:9 +note: inside `std::ptr::read::<u32>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `ptr::const_ptr::<impl *const u32>::read` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `INNER` + --> $DIR/detect-extra-ub.rs:38:9 | LL | ptr.read(); - | ---------- inside `INNER` at $DIR/detect-extra-ub.rs:38:9 + | ^^^^^^^^^^ note: erroneous constant used --> $DIR/detect-extra-ub.rs:32:5 diff --git a/src/test/ui/consts/issue-miri-1910.stderr b/src/test/ui/consts/issue-miri-1910.stderr index 3872e3d4f0d..61865b1dad7 100644 --- a/src/test/ui/consts/issue-miri-1910.stderr +++ b/src/test/ui/consts/issue-miri-1910.stderr @@ -1,24 +1,19 @@ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | -LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | unable to copy parts of a pointer from memory at ALLOC - | inside `std::ptr::read::<u8>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | - ::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | -LL | unsafe { read(self) } - | ---------- inside `ptr::const_ptr::<impl *const u8>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - | - ::: $DIR/issue-miri-1910.rs:8:5 - | -LL | (&foo as *const _ as *const u8).add(one_and_a_half_pointers).read(); - | ------------------------------------------------------------------- inside `C` at $DIR/issue-miri-1910.rs:8:5 + = note: unable to copy parts of a pointer from memory at ALLOC | = 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: inside `std::ptr::read::<u8>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `ptr::const_ptr::<impl *const u8>::read` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `C` + --> $DIR/issue-miri-1910.rs:8:5 + | +LL | (&foo as *const _ as *const u8).add(one_and_a_half_pointers).read(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr index 840d698ebbf..cf3fd88d034 100644 --- a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr +++ b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr @@ -2,13 +2,18 @@ error[E0080]: could not evaluate static initializer --> $DIR/abi-mismatch.rs:9:5 | LL | my_fn(); + | ^^^^^^^ calling a function with calling convention C using calling convention Rust + | +note: inside `call_rust_fn` + --> $DIR/abi-mismatch.rs:9:5 + | +LL | my_fn(); | ^^^^^^^ - | | - | calling a function with calling convention C using calling convention Rust - | inside `call_rust_fn` at $DIR/abi-mismatch.rs:9:5 -... +note: inside `VAL` + --> $DIR/abi-mismatch.rs:15:18 + | LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) }); - | --------------------------------------------------------------------- inside `VAL` at $DIR/abi-mismatch.rs:15:18 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: skipping const checks | diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.stderr b/src/test/ui/consts/miri_unleashed/assoc_const.stderr index 33e7e4af276..e1da43c3aea 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const.stderr +++ b/src/test/ui/consts/miri_unleashed/assoc_const.stderr @@ -1,17 +1,17 @@ error[E0080]: evaluation of `<std::string::String as Bar<std::vec::Vec<u32>, std::string::String>>::F` failed --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | -LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | calling non-const function `<Vec<u32> as Drop>::drop` - | inside `std::ptr::drop_in_place::<Vec<u32>> - shim(Some(Vec<u32>))` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - | inside `std::ptr::drop_in_place::<(Vec<u32>, u32)> - shim(Some((Vec<u32>, u32)))` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + = note: calling non-const function `<Vec<u32> as Drop>::drop` | - ::: $DIR/assoc_const.rs:12:31 +note: inside `std::ptr::drop_in_place::<Vec<u32>> - shim(Some(Vec<u32>))` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `std::ptr::drop_in_place::<(Vec<u32>, u32)> - shim(Some((Vec<u32>, u32)))` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `<String as Bar<Vec<u32>, String>>::F` + --> $DIR/assoc_const.rs:12:31 | LL | const F: u32 = (U::X, 42).1; - | - inside `<String as Bar<Vec<u32>, String>>::F` at $DIR/assoc_const.rs:12:31 + | ^ note: erroneous constant used --> $DIR/assoc_const.rs:29:13 diff --git a/src/test/ui/consts/miri_unleashed/drop.stderr b/src/test/ui/consts/miri_unleashed/drop.stderr index a3a502723d2..4f60b882069 100644 --- a/src/test/ui/consts/miri_unleashed/drop.stderr +++ b/src/test/ui/consts/miri_unleashed/drop.stderr @@ -1,16 +1,15 @@ error[E0080]: could not evaluate static initializer --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL | -LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | calling non-const function `<Vec<i32> as Drop>::drop` - | inside `std::ptr::drop_in_place::<Vec<i32>> - shim(Some(Vec<i32>))` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + = note: calling non-const function `<Vec<i32> as Drop>::drop` | - ::: $DIR/drop.rs:17:1 +note: inside `std::ptr::drop_in_place::<Vec<i32>> - shim(Some(Vec<i32>))` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `TEST_BAD` + --> $DIR/drop.rs:17:1 | LL | }; - | - inside `TEST_BAD` at $DIR/drop.rs:17:1 + | ^ warning: skipping const checks | diff --git a/src/test/ui/consts/miri_unleashed/tls.stderr b/src/test/ui/consts/miri_unleashed/tls.stderr index 436c5112360..7aaeadd0403 100644 --- a/src/test/ui/consts/miri_unleashed/tls.stderr +++ b/src/test/ui/consts/miri_unleashed/tls.stderr @@ -2,13 +2,13 @@ error[E0080]: could not evaluate static initializer --> $DIR/tls.rs:11:25 | LL | unsafe { let _val = A; } - | ^ cannot access thread local static (DefId(0:6 ~ tls[78b0]::A)) + | ^ cannot access thread local static (DefId(0:4 ~ tls[78b0]::A)) error[E0080]: could not evaluate static initializer --> $DIR/tls.rs:18:26 | LL | unsafe { let _val = &A; } - | ^ cannot access thread local static (DefId(0:6 ~ tls[78b0]::A)) + | ^ cannot access thread local static (DefId(0:4 ~ tls[78b0]::A)) warning: skipping const checks | diff --git a/src/test/ui/consts/missing_span_in_backtrace.rs b/src/test/ui/consts/missing_span_in_backtrace.rs new file mode 100644 index 00000000000..dd2b81c5af2 --- /dev/null +++ b/src/test/ui/consts/missing_span_in_backtrace.rs @@ -0,0 +1,27 @@ +// compile-flags: -Z ui-testing=no +// normalize-stderr-test "alloc[0-9]+" -> "ALLOC_ID" + +#![feature(const_swap)] +#![feature(const_mut_refs)] +use std::{ + mem::{self, MaybeUninit}, + ptr, +}; + +const X: () = { + let mut ptr1 = &1; + let mut ptr2 = &2; + + // Swap them, bytewise. + unsafe { + ptr::swap_nonoverlapping( + &mut ptr1 as *mut _ as *mut MaybeUninit<u8>, + &mut ptr2 as *mut _ as *mut MaybeUninit<u8>, + mem::size_of::<&i32>(), + ); + } +}; + +fn main() { + X +} diff --git a/src/test/ui/consts/missing_span_in_backtrace.stderr b/src/test/ui/consts/missing_span_in_backtrace.stderr new file mode 100644 index 00000000000..e6d3d51990d --- /dev/null +++ b/src/test/ui/consts/missing_span_in_backtrace.stderr @@ -0,0 +1,28 @@ +error[E0080]: evaluation of constant value failed + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL + | + = note: unable to copy parts of a pointer from memory at ALLOC_ID + | + = 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: inside `std::ptr::read::<MaybeUninit<MaybeUninit<u8>>>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `mem::swap_simple::<MaybeUninit<MaybeUninit<u8>>>` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL +note: inside `ptr::swap_nonoverlapping_simple_untyped::<MaybeUninit<u8>>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `swap_nonoverlapping::<MaybeUninit<u8>>` + --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL +note: inside `X` + --> $DIR/missing_span_in_backtrace.rs:17:9 + | +17 | / ptr::swap_nonoverlapping( +18 | | &mut ptr1 as *mut _ as *mut MaybeUninit<u8>, +19 | | &mut ptr2 as *mut _ as *mut MaybeUninit<u8>, +20 | | mem::size_of::<&i32>(), +21 | | ); + | |_________^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/offset_from_ub.stderr b/src/test/ui/consts/offset_from_ub.stderr index 62a087d94d3..fff4729689f 100644 --- a/src/test/ui/consts/offset_from_ub.stderr +++ b/src/test/ui/consts/offset_from_ub.stderr @@ -7,16 +7,15 @@ LL | let offset = unsafe { ptr_offset_from(field_ptr, base_ptr) }; error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::ptr_offset_from(self, origin) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | `ptr_offset_from` called on pointers into different allocations - | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: `ptr_offset_from` called on pointers into different allocations | - ::: $DIR/offset_from_ub.rs:24:14 +note: inside `ptr::const_ptr::<impl *const u8>::offset_from` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `NOT_PTR` + --> $DIR/offset_from_ub.rs:24:14 | LL | unsafe { (42 as *const u8).offset_from(&5u8) as usize } - | ----------------------------------- inside `NOT_PTR` at $DIR/offset_from_ub.rs:24:14 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $DIR/offset_from_ub.rs:31:14 @@ -87,30 +86,28 @@ LL | unsafe { ptr_offset_from_unsigned(ptr2, ptr1) } error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::ptr_offset_from(self, origin) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance) - | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance) | - ::: $DIR/offset_from_ub.rs:115:14 +note: inside `ptr::const_ptr::<impl *const u8>::offset_from` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `OFFSET_VERY_FAR1` + --> $DIR/offset_from_ub.rs:115:14 | LL | unsafe { ptr2.offset_from(ptr1) } - | ---------------------- inside `OFFSET_VERY_FAR1` at $DIR/offset_from_ub.rs:115:14 + | ^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::ptr_offset_from(self, origin) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance) - | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance) | - ::: $DIR/offset_from_ub.rs:121:14 +note: inside `ptr::const_ptr::<impl *const u8>::offset_from` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `OFFSET_VERY_FAR2` + --> $DIR/offset_from_ub.rs:121:14 | LL | unsafe { ptr1.offset_from(ptr2.wrapping_offset(1)) } - | ----------------------------------------- inside `OFFSET_VERY_FAR2` at $DIR/offset_from_ub.rs:121:14 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 15 previous errors diff --git a/src/test/ui/consts/offset_ub.stderr b/src/test/ui/consts/offset_ub.stderr index 5a792bba50c..c0c851df507 100644 --- a/src/test/ui/consts/offset_ub.stderr +++ b/src/test/ui/consts/offset_ub.stderr @@ -1,170 +1,158 @@ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | overflowing in-bounds pointer arithmetic - | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: overflowing in-bounds pointer arithmetic | - ::: $DIR/offset_ub.rs:7:46 +note: inside `ptr::const_ptr::<impl *const u8>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `BEFORE_START` + --> $DIR/offset_ub.rs:7:46 | LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) }; - | ------------------------------ inside `BEFORE_START` at $DIR/offset_ub.rs:7:46 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset 0 is out-of-bounds - | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset 0 is out-of-bounds | - ::: $DIR/offset_ub.rs:8:43 +note: inside `ptr::const_ptr::<impl *const u8>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `AFTER_END` + --> $DIR/offset_ub.rs:8:43 | LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) }; - | ----------------------------- inside `AFTER_END` at $DIR/offset_ub.rs:8:43 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds pointer arithmetic: allocN has size 100, so pointer to 101 bytes starting at offset 0 is out-of-bounds - | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds pointer arithmetic: allocN has size 100, so pointer to 101 bytes starting at offset 0 is out-of-bounds | - ::: $DIR/offset_ub.rs:9:45 +note: inside `ptr::const_ptr::<impl *const u8>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `AFTER_ARRAY` + --> $DIR/offset_ub.rs:9:45 | LL | pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) }; - | ------------------------------- inside `AFTER_ARRAY` at $DIR/offset_ub.rs:9:45 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | overflowing in-bounds pointer arithmetic - | inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: overflowing in-bounds pointer arithmetic | - ::: $DIR/offset_ub.rs:11:43 +note: inside `ptr::const_ptr::<impl *const u16>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `OVERFLOW` + --> $DIR/offset_ub.rs:11:43 | LL | pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) }; - | ------------------------------------- inside `OVERFLOW` at $DIR/offset_ub.rs:11:43 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | overflowing in-bounds pointer arithmetic - | inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: overflowing in-bounds pointer arithmetic | - ::: $DIR/offset_ub.rs:12:44 +note: inside `ptr::const_ptr::<impl *const u16>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `UNDERFLOW` + --> $DIR/offset_ub.rs:12:44 | LL | pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) }; - | ------------------------------------- inside `UNDERFLOW` at $DIR/offset_ub.rs:12:44 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | overflowing in-bounds pointer arithmetic - | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: overflowing in-bounds pointer arithmetic | - ::: $DIR/offset_ub.rs:13:56 +note: inside `ptr::const_ptr::<impl *const u8>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `OVERFLOW_ADDRESS_SPACE` + --> $DIR/offset_ub.rs:13:56 | LL | pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) }; - | ----------------------------------- inside `OVERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:13:56 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | overflowing in-bounds pointer arithmetic - | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: overflowing in-bounds pointer arithmetic | - ::: $DIR/offset_ub.rs:14:57 +note: inside `ptr::const_ptr::<impl *const u8>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `UNDERFLOW_ADDRESS_SPACE` + --> $DIR/offset_ub.rs:14:57 | LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) }; - | --------------------------- inside `UNDERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:14:57 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset -4 is out-of-bounds - | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset -4 is out-of-bounds | - ::: $DIR/offset_ub.rs:15:49 +note: inside `ptr::const_ptr::<impl *const u8>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `NEGATIVE_OFFSET` + --> $DIR/offset_ub.rs:15:49 | LL | pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) }; - | ------------------------------------------------ inside `NEGATIVE_OFFSET` at $DIR/offset_ub.rs:15:49 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds pointer arithmetic: allocN has size 0, so pointer to 1 byte starting at offset 0 is out-of-bounds - | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds pointer arithmetic: allocN has size 0, so pointer to 1 byte starting at offset 0 is out-of-bounds | - ::: $DIR/offset_ub.rs:17:50 +note: inside `ptr::const_ptr::<impl *const u8>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `ZERO_SIZED_ALLOC` + --> $DIR/offset_ub.rs:17:50 | LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) }; - | --------------------------- inside `ZERO_SIZED_ALLOC` at $DIR/offset_ub.rs:17:50 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) as *mut T } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance) - | inside `ptr::mut_ptr::<impl *mut u8>::offset` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + = note: out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance) | - ::: $DIR/offset_ub.rs:18:42 +note: inside `ptr::mut_ptr::<impl *mut u8>::offset` + --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL +note: inside `DANGLING` + --> $DIR/offset_ub.rs:18:42 | LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) }; - | ------------------------------------------------- inside `DANGLING` at $DIR/offset_ub.rs:18:42 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds pointer arithmetic: null pointer is a dangling pointer (it has no provenance) - | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds pointer arithmetic: null pointer is a dangling pointer (it has no provenance) | - ::: $DIR/offset_ub.rs:21:50 +note: inside `ptr::const_ptr::<impl *const u8>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `NULL_OFFSET_ZERO` + --> $DIR/offset_ub.rs:21:50 | LL | pub const NULL_OFFSET_ZERO: *const u8 = unsafe { ptr::null::<u8>().offset(0) }; - | --------------------------- inside `NULL_OFFSET_ZERO` at $DIR/offset_ub.rs:21:50 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds pointer arithmetic: 0x7f..f[noalloc] is a dangling pointer (it has no provenance) - | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds pointer arithmetic: 0x7f..f[noalloc] is a dangling pointer (it has no provenance) | - ::: $DIR/offset_ub.rs:24:47 +note: inside `ptr::const_ptr::<impl *const u8>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `UNDERFLOW_ABS` + --> $DIR/offset_ub.rs:24:47 | LL | pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) }; - | -------------------------------------------- inside `UNDERFLOW_ABS` at $DIR/offset_ub.rs:24:47 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 12 previous errors diff --git a/src/test/ui/consts/ptr_comparisons.stderr b/src/test/ui/consts/ptr_comparisons.stderr index b71964b92c7..fea924d12e5 100644 --- a/src/test/ui/consts/ptr_comparisons.stderr +++ b/src/test/ui/consts/ptr_comparisons.stderr @@ -1,16 +1,15 @@ error[E0080]: evaluation of constant value failed --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | -LL | unsafe { intrinsics::offset(self, count) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | out-of-bounds pointer arithmetic: alloc3 has size $WORD, so pointer to $TWO_WORDS bytes starting at offset 0 is out-of-bounds - | inside `ptr::const_ptr::<impl *const usize>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + = note: out-of-bounds pointer arithmetic: alloc3 has size $WORD, so pointer to $TWO_WORDS bytes starting at offset 0 is out-of-bounds | - ::: $DIR/ptr_comparisons.rs:50:34 +note: inside `ptr::const_ptr::<impl *const usize>::offset` + --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL +note: inside `_` + --> $DIR/ptr_comparisons.rs:50:34 | LL | const _: *const usize = unsafe { (FOO as *const usize).offset(2) }; - | ------------------------------- inside `_` at $DIR/ptr_comparisons.rs:50:34 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed --> $DIR/ptr_comparisons.rs:53:33 diff --git a/src/test/ui/consts/recursive.stderr b/src/test/ui/consts/recursive.stderr index 14fa3da7ab0..60ce64d2a1e 100644 --- a/src/test/ui/consts/recursive.stderr +++ b/src/test/ui/consts/recursive.stderr @@ -13,14 +13,23 @@ error[E0080]: evaluation of constant value failed --> $DIR/recursive.rs:4:5 | LL | f(x); + | ^^^^ reached the configured maximum number of stack frames + | +note: inside `f::<i32>` + --> $DIR/recursive.rs:4:5 + | +LL | f(x); | ^^^^ - | | - | reached the configured maximum number of stack frames - | inside `f::<i32>` at $DIR/recursive.rs:4:5 - | [... 126 additional calls inside `f::<i32>` at $DIR/recursive.rs:4:5 ...] -... +note: [... 126 additional calls inside `f::<i32>` ...] + --> $DIR/recursive.rs:4:5 + | +LL | f(x); + | ^^^^ +note: inside `X` + --> $DIR/recursive.rs:8:15 + | LL | const X: () = f(1); - | ---- inside `X` at $DIR/recursive.rs:8:15 + | ^^^^ error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/consts/uninhabited-const-issue-61744.stderr b/src/test/ui/consts/uninhabited-const-issue-61744.stderr index 8b39f390bb4..3a94e19313f 100644 --- a/src/test/ui/consts/uninhabited-const-issue-61744.stderr +++ b/src/test/ui/consts/uninhabited-const-issue-61744.stderr @@ -2,143 +2,648 @@ error[E0080]: evaluation of `<i32 as Const>::CONSTANT` failed --> $DIR/uninhabited-const-issue-61744.rs:4:5 | LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ reached the configured maximum number of stack frames + | +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() | ^^^^^^^^^^^^^^^^^^ - | | - | reached the configured maximum number of stack frames - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::<i32>` at $DIR/uninhabited-const-issue-61744.rs:4:5 -... -LL | fake_type() - | ----------- - | | - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 -... +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<!>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `hint_unreachable` + --> $DIR/uninhabited-const-issue-61744.rs:8:5 + | +LL | fake_type() + | ^^^^^^^^^^^ +note: inside `fake_type::<i32>` + --> $DIR/uninhabited-const-issue-61744.rs:4:5 + | +LL | hint_unreachable() + | ^^^^^^^^^^^^^^^^^^ +note: inside `<i32 as Const>::CONSTANT` + --> $DIR/uninhabited-const-issue-61744.rs:12:36 + | LL | const CONSTANT: i32 = unsafe { fake_type() }; - | ----------- inside `<i32 as Const>::CONSTANT` at $DIR/uninhabited-const-issue-61744.rs:12:36 + | ^^^^^^^^^^^ note: erroneous constant used --> $DIR/uninhabited-const-issue-61744.rs:18:10 diff --git a/src/test/ui/debuginfo/issue-105386-debuginfo-ub.rs b/src/test/ui/debuginfo/issue-105386-debuginfo-ub.rs new file mode 100644 index 00000000000..6c6eb5d4e86 --- /dev/null +++ b/src/test/ui/debuginfo/issue-105386-debuginfo-ub.rs @@ -0,0 +1,20 @@ +// run-pass +// compile-flags: --edition 2021 -Copt-level=3 -Cdebuginfo=2 -Zmir-opt-level=3 + +fn main() { + TranslatorI.visit_pre(); +} + +impl TranslatorI { + fn visit_pre(self) { + Some(()) + .map(|_| self.flags()) + .unwrap_or_else(|| self.flags()); + } +} + +struct TranslatorI; + +impl TranslatorI { + fn flags(&self) {} +} diff --git a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr index e3fb234b96e..2be69a30b1c 100644 --- a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr @@ -9,9 +9,6 @@ LL | x: Error | note: required by a bound in `AssertParamIsEq` --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub struct AssertParamIsEq<T: Eq + ?Sized> { - | ^^ required by this bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Eq)]` | diff --git a/src/test/ui/derives/derives-span-Eq-enum.stderr b/src/test/ui/derives/derives-span-Eq-enum.stderr index 4e10c3f69e7..4f4f821cca3 100644 --- a/src/test/ui/derives/derives-span-Eq-enum.stderr +++ b/src/test/ui/derives/derives-span-Eq-enum.stderr @@ -9,9 +9,6 @@ LL | Error | note: required by a bound in `AssertParamIsEq` --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub struct AssertParamIsEq<T: Eq + ?Sized> { - | ^^ required by this bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Eq)]` | diff --git a/src/test/ui/derives/derives-span-Eq-struct.stderr b/src/test/ui/derives/derives-span-Eq-struct.stderr index bfdab052a2e..f15659c3e16 100644 --- a/src/test/ui/derives/derives-span-Eq-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-struct.stderr @@ -9,9 +9,6 @@ LL | x: Error | note: required by a bound in `AssertParamIsEq` --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub struct AssertParamIsEq<T: Eq + ?Sized> { - | ^^ required by this bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Eq)]` | diff --git a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr index 26b8be34333..4e5659b35f4 100644 --- a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr @@ -9,9 +9,6 @@ LL | Error | note: required by a bound in `AssertParamIsEq` --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub struct AssertParamIsEq<T: Eq + ?Sized> { - | ^^ required by this bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Error` with `#[derive(Eq)]` | diff --git a/src/test/ui/derives/deriving-meta-unknown-trait.stderr b/src/test/ui/derives/deriving-meta-unknown-trait.stderr index f3ff95a85da..053d34f6825 100644 --- a/src/test/ui/derives/deriving-meta-unknown-trait.stderr +++ b/src/test/ui/derives/deriving-meta-unknown-trait.stderr @@ -3,22 +3,18 @@ error: cannot find derive macro `Eqr` in this scope | LL | #[derive(Eqr)] | ^^^ help: a derive macro with a similar name exists: `Eq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL | - ::: $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub macro Eq($item:item) { - | ------------ similarly named derive macro `Eq` defined here + = note: similarly named derive macro `Eq` defined here error: cannot find derive macro `Eqr` in this scope --> $DIR/deriving-meta-unknown-trait.rs:1:10 | LL | #[derive(Eqr)] | ^^^ help: a derive macro with a similar name exists: `Eq` + --> $SRC_DIR/core/src/cmp.rs:LL:COL | - ::: $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub macro Eq($item:item) { - | ------------ similarly named derive macro `Eq` defined here + = note: similarly named derive macro `Eq` defined here error: aborting due to 2 previous errors diff --git a/src/test/ui/deriving/issue-103157.stderr b/src/test/ui/deriving/issue-103157.stderr index ee3528fe106..b18e1e5098b 100644 --- a/src/test/ui/deriving/issue-103157.stderr +++ b/src/test/ui/deriving/issue-103157.stderr @@ -20,9 +20,6 @@ LL | Float(Option<f64>), = note: required for `Option<f64>` to implement `Eq` note: required by a bound in `AssertParamIsEq` --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub struct AssertParamIsEq<T: Eq + ?Sized> { - | ^^ required by this bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/deriving/issue-105101.rs b/src/test/ui/deriving/issue-105101.rs new file mode 100644 index 00000000000..1a377feb919 --- /dev/null +++ b/src/test/ui/deriving/issue-105101.rs @@ -0,0 +1,9 @@ +// compile-flags: --crate-type=lib + +#[derive(Default)] //~ ERROR multiple declared defaults +enum E { + #[default] + A, + #[default] + A, //~ ERROR defined multiple times +} diff --git a/src/test/ui/deriving/issue-105101.stderr b/src/test/ui/deriving/issue-105101.stderr new file mode 100644 index 00000000000..0f6f67043f3 --- /dev/null +++ b/src/test/ui/deriving/issue-105101.stderr @@ -0,0 +1,29 @@ +error: multiple declared defaults + --> $DIR/issue-105101.rs:3:10 + | +LL | #[derive(Default)] + | ^^^^^^^ +... +LL | A, + | - first default +LL | #[default] +LL | A, + | - additional default + | + = note: only one variant can be default + = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0428]: the name `A` is defined multiple times + --> $DIR/issue-105101.rs:8:5 + | +LL | A, + | - previous definition of the type `A` here +LL | #[default] +LL | A, + | ^ `A` redefined here + | + = note: `A` must be defined only once in the type namespace of this enum + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0428`. diff --git a/src/test/ui/destructuring-assignment/note-unsupported.stderr b/src/test/ui/destructuring-assignment/note-unsupported.stderr index e45344aa51f..8a88332b73e 100644 --- a/src/test/ui/destructuring-assignment/note-unsupported.stderr +++ b/src/test/ui/destructuring-assignment/note-unsupported.stderr @@ -49,11 +49,8 @@ note: an implementation of `AddAssign<_>` might be missing for `S` | LL | struct S { x: u8, y: u8 } | ^^^^^^^^ must implement `AddAssign<_>` -note: the following trait must be implemented +note: the trait `AddAssign` must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | pub trait AddAssign<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0067]: invalid left-hand side of assignment --> $DIR/note-unsupported.rs:17:22 diff --git a/src/test/ui/diagnostic-width/long-E0308.rs b/src/test/ui/diagnostic-width/long-E0308.rs new file mode 100644 index 00000000000..f021f102933 --- /dev/null +++ b/src/test/ui/diagnostic-width/long-E0308.rs @@ -0,0 +1,97 @@ +// compile-flags: --diagnostic-width=60 +// normalize-stderr-test: "long-type-\d+" -> "long-type-hash" + +mod a { + // Force the "short path for unique types" machinery to trip up + pub struct Atype; + pub struct Btype; + pub struct Ctype; +} + +mod b { + pub struct Atype<T, K>(T, K); + pub struct Btype<T, K>(T, K); + pub struct Ctype<T, K>(T, K); +} + +use b::*; + +fn main() { + let x: Atype< + Btype< + Ctype< + Atype< + Btype< + Ctype< + Atype< + Btype< + Ctype<i32, i32>, + i32 + >, + i32 + >, + i32 + >, + i32 + >, + i32 + >, + i32 + >, + i32 + >, + i32 + > = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok( + Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok( + Ok("") + )))))))))))))))))))))))))))))) + )))))))))))))))))))))))))))))); + //~^^^^^ ERROR E0308 + + let _ = Some(Ok(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some( + Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some( + Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some(Some( + Some(Some(Some(Some(Some(Some(Some(Some(Some(""))))))))) + ))))))))))))))))) + )))))))))))))))))) + ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok( + Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok( + Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) + )))))))))))))))))))))))))))))) + )))))))))))))))))))))))); + //~^^^^^ ERROR E0308 + + let x: Atype< + Btype< + Ctype< + Atype< + Btype< + Ctype< + Atype< + Btype< + Ctype<i32, i32>, + i32 + >, + i32 + >, + i32 + >, + i32 + >, + i32 + >, + i32 + >, + i32 + >, + i32 + > = (); + //~^ ERROR E0308 + + let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok( + Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok( + Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) + )))))))))))))))))))))))))))))) + )))))))))))))))))))))))); + //~^^^^^ ERROR E0308 +} diff --git a/src/test/ui/diagnostic-width/long-E0308.stderr b/src/test/ui/diagnostic-width/long-E0308.stderr new file mode 100644 index 00000000000..1c99898bc83 --- /dev/null +++ b/src/test/ui/diagnostic-width/long-E0308.stderr @@ -0,0 +1,80 @@ +error[E0308]: mismatched types + --> $DIR/long-E0308.rs:44:9 + | +LL | let x: Atype< + | _____________- +LL | | Btype< +LL | | Ctype< +LL | | Atype< +... | +LL | | i32 +LL | | > = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok... + | | _____-___^ + | ||_____| + | | expected due to this +LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok... +LL | | Ok("") +LL | | )))))))))))))))))))))))))))))) +LL | | )))))))))))))))))))))))))))))); + | |__________________________________^ expected struct `Atype`, found enum `Result` + | + = note: expected struct `Atype<Btype<..., ...>, ...>` + the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt' + found enum `Result<Result<..., ...>, ...>` + the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt' + +error[E0308]: mismatched types + --> $DIR/long-E0308.rs:57:26 + | +LL | ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O... + | __________________________^ +LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(... +LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) +LL | | )))))))))))))))))))))))))))))) +LL | | )))))))))))))))))))))))); + | |____________________________^ expected enum `Option`, found enum `Result` + | + = note: expected enum `Option<Result<..., ...>>` + the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt' + found enum `Result<Result<..., ...>, ...>` + the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt' + +error[E0308]: mismatched types + --> $DIR/long-E0308.rs:88:9 + | +LL | let x: Atype< + | ____________- +LL | | Btype< +LL | | Ctype< +LL | | Atype< +... | +LL | | i32 +LL | | > = (); + | | - ^^ expected struct `Atype`, found `()` + | |_____| + | expected due to this + | + = note: expected struct `Atype<Btype<..., ...>, ...>` + the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt' + found unit type `()` + +error[E0308]: mismatched types + --> $DIR/long-E0308.rs:91:17 + | +LL | let _: () = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O... + | ____________--___^ + | | | + | | expected due to this +LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(... +LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) +LL | | )))))))))))))))))))))))))))))) +LL | | )))))))))))))))))))))))); + | |____________________________^ expected `()`, found enum `Result` + | + = note: expected unit type `()` + found enum `Result<Result<..., ...>, ...>` + the full type name has been written to '$TEST_BUILD_DIR/diagnostic-width/long-E0308/long-E0308.long-type-hash.txt' + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr index d27b05fe7f7..7229b9ac986 100644 --- a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr @@ -12,10 +12,6 @@ LL | Foo::<i32>::bar(&1i8); <i8 as Foo<u32>> <i8 as Foo<u64>> <i8 as Foo<u8>> - <u8 as Foo<bool>> - <u8 as Foo<u16>> - <u8 as Foo<u32>> - <u8 as Foo<u64>> error[E0277]: the trait bound `u8: Foo<i32>` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:25:21 @@ -26,11 +22,6 @@ LL | Foo::<i32>::bar(&1u8); | required by a bound introduced by this call | = help: the following other types implement trait `Foo<B>`: - <i8 as Foo<bool>> - <i8 as Foo<u16>> - <i8 as Foo<u32>> - <i8 as Foo<u64>> - <i8 as Foo<u8>> <u8 as Foo<bool>> <u8 as Foo<u16>> <u8 as Foo<u32>> diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.fixed b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.fixed new file mode 100644 index 00000000000..ae0a84eea4d --- /dev/null +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.fixed @@ -0,0 +1,21 @@ +// run-rustfix +struct X { + x: String, +} + +impl Drop for X { + fn drop(&mut self) { + println!("value: {}", self.x); + } +} + +fn unwrap(x: X) -> String { + let X { x: ref y } = x; //~ ERROR cannot move out of type + y.to_string() +} + +fn main() { + let x = X { x: "hello".to_string() }; + let y = unwrap(x); + println!("contents: {}", y); +} diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.rs b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.rs index 8e394498a23..c8db7861068 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.rs +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.rs @@ -1,3 +1,4 @@ +// run-rustfix struct X { x: String, } @@ -10,7 +11,7 @@ impl Drop for X { fn unwrap(x: X) -> String { let X { x: y } = x; //~ ERROR cannot move out of type - y + y.to_string() } fn main() { diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr index cda81d13669..596ad4bf784 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr @@ -1,11 +1,16 @@ error[E0509]: cannot move out of type `X`, which implements the `Drop` trait - --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:22 + --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:13:22 | LL | let X { x: y } = x; | - ^ cannot move out of here | | | data moved here | move occurs because `y` has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | let X { x: ref y } = x; + | +++ error: aborting due to previous error diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.fixed b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.fixed new file mode 100644 index 00000000000..c8a451efeb2 --- /dev/null +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.fixed @@ -0,0 +1,19 @@ +// run-rustfix +struct X { + x: String, +} + +impl Drop for X { + fn drop(&mut self) { + println!("value: {}", self.x); + } +} + +fn main() { + let x = X { x: "hello".to_string() }; + + match x { + //~^ ERROR cannot move out of type `X`, which implements the `Drop` trait + X { x: ref y } => println!("contents: {}", y) + } +} diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs index 9c996a93b95..815567ffec3 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs @@ -1,3 +1,4 @@ +// run-rustfix struct X { x: String, } diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr index 70cdd6446c8..e32a4dd4411 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `X`, which implements the `Drop` trait - --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:14:11 + --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:15:11 | LL | match x { | ^ cannot move out of here @@ -9,6 +9,11 @@ LL | X { x: y } => println!("contents: {}", y) | | | data moved here | move occurs because `y` has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | X { x: ref y } => println!("contents: {}", y) + | +++ error: aborting due to previous error diff --git a/src/test/ui/disambiguate-identical-names.stderr b/src/test/ui/disambiguate-identical-names.stderr index 42925cfed55..87560c4c797 100644 --- a/src/test/ui/disambiguate-identical-names.stderr +++ b/src/test/ui/disambiguate-identical-names.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/disambiguate-identical-names.rs:13:10 | LL | test(&v); - | ---- ^^ expected struct `std::vec::Vec`, found struct `HashMap` + | ---- ^^ expected struct `Vec`, found struct `HashMap` | | | arguments to this function are incorrect | diff --git a/src/test/ui/drop/drop_order.rs b/src/test/ui/drop/drop_order.rs index 42385216ae7..5ce1fd54a9e 100644 --- a/src/test/ui/drop/drop_order.rs +++ b/src/test/ui/drop/drop_order.rs @@ -43,7 +43,7 @@ impl DropOrderCollector { } if { - if self.option_loud_drop(7).is_some() && self.option_loud_drop(6).is_some() { + if self.option_loud_drop(6).is_some() && self.option_loud_drop(7).is_some() { self.loud_drop(8); true } else { @@ -118,17 +118,85 @@ impl DropOrderCollector { } } + fn and_chain(&self) { + // issue-103107 + if self.option_loud_drop(1).is_some() // 1 + && self.option_loud_drop(2).is_some() // 2 + && self.option_loud_drop(3).is_some() // 3 + && self.option_loud_drop(4).is_some() // 4 + && self.option_loud_drop(5).is_some() // 5 + { + self.print(6); // 6 + } + + let _ = self.option_loud_drop(7).is_some() // 1 + && self.option_loud_drop(8).is_some() // 2 + && self.option_loud_drop(9).is_some(); // 3 + self.print(10); // 4 + + // Test associativity + if self.option_loud_drop(11).is_some() // 1 + && (self.option_loud_drop(12).is_some() // 2 + && self.option_loud_drop(13).is_some() // 3 + && self.option_loud_drop(14).is_some()) // 4 + && self.option_loud_drop(15).is_some() // 5 + { + self.print(16); // 6 + } + } + + fn or_chain(&self) { + // issue-103107 + if self.option_loud_drop(1).is_none() // 1 + || self.option_loud_drop(2).is_none() // 2 + || self.option_loud_drop(3).is_none() // 3 + || self.option_loud_drop(4).is_none() // 4 + || self.option_loud_drop(5).is_some() // 5 + { + self.print(6); // 6 + } + + let _ = self.option_loud_drop(7).is_none() // 1 + || self.option_loud_drop(8).is_none() // 2 + || self.option_loud_drop(9).is_none(); // 3 + self.print(10); // 4 + + // Test associativity + if self.option_loud_drop(11).is_none() // 1 + || (self.option_loud_drop(12).is_none() // 2 + || self.option_loud_drop(13).is_none() // 3 + || self.option_loud_drop(14).is_none()) // 4 + || self.option_loud_drop(15).is_some() // 5 + { + self.print(16); // 6 + } + } + + fn mixed_and_or_chain(&self) { + // issue-103107 + if self.option_loud_drop(1).is_none() // 1 + || self.option_loud_drop(2).is_none() // 2 + || self.option_loud_drop(3).is_some() // 3 + && self.option_loud_drop(4).is_some() // 4 + && self.option_loud_drop(5).is_none() // 5 + || self.option_loud_drop(6).is_none() // 6 + || self.option_loud_drop(7).is_some() // 7 + { + self.print(8); // 8 + } + } + fn let_chain(&self) { // take the "then" branch - if self.option_loud_drop(2).is_some() // 2 - && self.option_loud_drop(1).is_some() // 1 + if self.option_loud_drop(1).is_some() // 1 + && self.option_loud_drop(2).is_some() // 2 && let Some(_d) = self.option_loud_drop(4) { // 4 self.print(3); // 3 } // take the "else" branch - if self.option_loud_drop(6).is_some() // 2 - && self.option_loud_drop(5).is_some() // 1 + if self.option_loud_drop(5).is_some() // 1 + && self.option_loud_drop(6).is_some() // 2 && let None = self.option_loud_drop(8) { // 4 unreachable!(); } else { @@ -152,8 +220,8 @@ impl DropOrderCollector { } // let exprs last - if self.option_loud_drop(20).is_some() // 2 - && self.option_loud_drop(19).is_some() // 1 + if self.option_loud_drop(19).is_some() // 1 + && self.option_loud_drop(20).is_some() // 2 && let Some(_d) = self.option_loud_drop(23) // 5 && let Some(_e) = self.option_loud_drop(22) { // 4 self.print(21); // 3 @@ -187,6 +255,21 @@ fn main() { collector.if_(); collector.assert_sorted(); + println!("-- and chain --"); + let collector = DropOrderCollector::default(); + collector.and_chain(); + collector.assert_sorted(); + + println!("-- or chain --"); + let collector = DropOrderCollector::default(); + collector.or_chain(); + collector.assert_sorted(); + + println!("-- mixed and/or chain --"); + let collector = DropOrderCollector::default(); + collector.mixed_and_or_chain(); + collector.assert_sorted(); + println!("-- if let --"); let collector = DropOrderCollector::default(); collector.if_let(); diff --git a/src/test/ui/drop/issue-103107.rs b/src/test/ui/drop/issue-103107.rs new file mode 100644 index 00000000000..5f447595662 --- /dev/null +++ b/src/test/ui/drop/issue-103107.rs @@ -0,0 +1,37 @@ +// check-pass +// compile-flags: -Z validate-mir + +struct Foo<'a>(&'a mut u32); + +impl<'a> Drop for Foo<'a> { + fn drop(&mut self) { + *self.0 = 0; + } +} + +fn and() { + let mut foo = 0; + // This used to compile also before the fix + if true && *Foo(&mut foo).0 == 0 && ({ foo = 0; true}) {} + + // This used to fail before the fix + if *Foo(&mut foo).0 == 0 && ({ foo = 0; true}) {} + + println!("{foo}"); +} + +fn or() { + let mut foo = 0; + // This used to compile also before the fix + if false || *Foo(&mut foo).0 == 1 || ({ foo = 0; true}) {} + + // This used to fail before the fix + if *Foo(&mut foo).0 == 1 || ({ foo = 0; true}) {} + + println!("{foo}"); +} + +fn main() { + and(); + or(); +} diff --git a/src/test/ui/issues/issue-21486.rs b/src/test/ui/drop/issue-21486.rs index 46d6ccd56bd..46d6ccd56bd 100644 --- a/src/test/ui/issues/issue-21486.rs +++ b/src/test/ui/drop/issue-21486.rs diff --git a/src/test/ui/dst/dst-rvalue.stderr b/src/test/ui/dst/dst-rvalue.stderr index 727f4d84303..8d0a82b707d 100644 --- a/src/test/ui/dst/dst-rvalue.stderr +++ b/src/test/ui/dst/dst-rvalue.stderr @@ -9,9 +9,6 @@ LL | let _x: Box<str> = Box::new(*"hello world"); = help: the trait `Sized` is not implemented for `str` note: required by a bound in `Box::<T>::new` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - | -LL | impl<T> Box<T> { - | ^ required by this bound in `Box::<T>::new` error[E0277]: the size for values of type `[isize]` cannot be known at compilation time --> $DIR/dst-rvalue.rs:8:37 @@ -24,9 +21,6 @@ LL | let _x: Box<[isize]> = Box::new(*array); = help: the trait `Sized` is not implemented for `[isize]` note: required by a bound in `Box::<T>::new` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - | -LL | impl<T> Box<T> { - | ^ required by this bound in `Box::<T>::new` error: aborting due to 2 previous errors diff --git a/src/test/ui/duplicate/duplicate-type-parameter.stderr b/src/test/ui/duplicate/duplicate-type-parameter.stderr index 6754574f0b9..628f898d5c8 100644 --- a/src/test/ui/duplicate/duplicate-type-parameter.stderr +++ b/src/test/ui/duplicate/duplicate-type-parameter.stderr @@ -55,10 +55,10 @@ LL | impl<T,T> Qux<T,T> for Option<T> {} | first use of `T` error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates - --> $DIR/duplicate-type-parameter.rs:24:6 + --> $DIR/duplicate-type-parameter.rs:24:8 | LL | impl<T,T> Qux<T,T> for Option<T> {} - | ^ unconstrained type parameter + | ^ unconstrained type parameter error: aborting due to 8 previous errors diff --git a/src/test/ui/dyn-star/no-implicit-dyn-star.stderr b/src/test/ui/dyn-star/no-implicit-dyn-star.stderr index e7c5918629b..a3f4d21ca94 100644 --- a/src/test/ui/dyn-star/no-implicit-dyn-star.stderr +++ b/src/test/ui/dyn-star/no-implicit-dyn-star.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/no-implicit-dyn-star.rs:6:48 | LL | dyn_star_foreign::require_dyn_star_display(1usize); - | ------------------------------------------ ^^^^^^ expected trait object `dyn std::fmt::Display`, found `usize` + | ------------------------------------------ ^^^^^^ expected trait object `dyn Display`, found `usize` | | | arguments to this function are incorrect | diff --git a/src/test/ui/enum-discriminant/issue-104519.rs b/src/test/ui/enum-discriminant/issue-104519.rs new file mode 100644 index 00000000000..c4630f76b3a --- /dev/null +++ b/src/test/ui/enum-discriminant/issue-104519.rs @@ -0,0 +1,36 @@ +// run-pass +#![allow(dead_code)] + +enum OpenResult { + Ok(()), + Err(()), + TransportErr(TransportErr), +} + +#[repr(i32)] +enum TransportErr { + UnknownMethod = -2, +} + +#[inline(never)] +fn some_match(result: OpenResult) -> u8 { + match result { + OpenResult::Ok(()) => 0, + _ => 1, + } +} + +fn main() { + let result = OpenResult::Ok(()); + assert_eq!(some_match(result), 0); + + let result = OpenResult::Ok(()); + match result { + OpenResult::Ok(()) => (), + _ => unreachable!("message a"), + } + match result { + OpenResult::Ok(()) => (), + _ => unreachable!("message b"), + } +} diff --git a/src/test/ui/enum/issue-67945-2.rs b/src/test/ui/enum/issue-67945-2.rs index e5044468da1..2eb123b7328 100644 --- a/src/test/ui/enum/issue-67945-2.rs +++ b/src/test/ui/enum/issue-67945-2.rs @@ -1,7 +1,7 @@ #![feature(type_ascription)] enum Bug<S> { //~ ERROR parameter `S` is never used - Var = 0: S, + Var = type_ascribe!(0, S), //~^ ERROR generic parameters may not be used } diff --git a/src/test/ui/enum/issue-67945-2.stderr b/src/test/ui/enum/issue-67945-2.stderr index 4f5e236a37b..63d3521afe4 100644 --- a/src/test/ui/enum/issue-67945-2.stderr +++ b/src/test/ui/enum/issue-67945-2.stderr @@ -1,8 +1,8 @@ error: generic parameters may not be used in const operations - --> $DIR/issue-67945-2.rs:4:14 + --> $DIR/issue-67945-2.rs:4:28 | -LL | Var = 0: S, - | ^ cannot perform const operation using `S` +LL | Var = type_ascribe!(0, S), + | ^ cannot perform const operation using `S` | = note: type parameters may not be used in const expressions = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr index 6f5bb4309c3..e829bac196f 100644 --- a/src/test/ui/error-codes/E0004-2.stderr +++ b/src/test/ui/error-codes/E0004-2.stderr @@ -6,15 +6,12 @@ LL | match x { } | note: `Option<i32>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL + ::: $SRC_DIR/core/src/option.rs:LL:COL | -LL | pub enum Option<T> { - | ------------------ -... -LL | None, - | ^^^^ not covered -... -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ not covered + = note: not covered + ::: $SRC_DIR/core/src/option.rs:LL:COL + | + = note: not covered = note: the matched value is of type `Option<i32>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | diff --git a/src/test/ui/error-codes/E0005.stderr b/src/test/ui/error-codes/E0005.stderr index de8e6bac486..0f179259356 100644 --- a/src/test/ui/error-codes/E0005.stderr +++ b/src/test/ui/error-codes/E0005.stderr @@ -8,12 +8,9 @@ LL | let Some(y) = x; = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html note: `Option<i32>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL + ::: $SRC_DIR/core/src/option.rs:LL:COL | -LL | pub enum Option<T> { - | ------------------ -... -LL | None, - | ^^^^ not covered + = note: not covered = note: the matched value is of type `Option<i32>` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/error-codes/E0059.stderr b/src/test/ui/error-codes/E0059.stderr index f331d014226..4f6abb22ab2 100644 --- a/src/test/ui/error-codes/E0059.stderr +++ b/src/test/ui/error-codes/E0059.stderr @@ -6,9 +6,6 @@ LL | fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) } | note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait Fn<Args: Tuple>: FnMut<Args> { - | ^^^^^ required by this bound in `Fn` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0275.stderr b/src/test/ui/error-codes/E0275.stderr index 49a4d984af9..451a683ac8a 100644 --- a/src/test/ui/error-codes/E0275.stderr +++ b/src/test/ui/error-codes/E0275.stderr @@ -5,7 +5,7 @@ LL | impl<T> Foo for T where Bar<T>: Foo {} | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`E0275`) -note: required for `Bar<Bar<Bar<Bar<Bar<Bar<...>>>>>>` to implement `Foo` +note: required for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<...>>>>>>>>>>>>>>>>>>>>>` to implement `Foo` --> $DIR/E0275.rs:6:9 | LL | impl<T> Foo for T where Bar<T>: Foo {} diff --git a/src/test/ui/error-codes/E0282.stderr b/src/test/ui/error-codes/E0282.stderr index d01aa3617c7..892d3a81f27 100644 --- a/src/test/ui/error-codes/E0282.stderr +++ b/src/test/ui/error-codes/E0282.stderr @@ -6,8 +6,8 @@ LL | let x = "hello".chars().rev().collect(); | help: consider giving `x` an explicit type | -LL | let x: _ = "hello".chars().rev().collect(); - | +++ +LL | let x: Vec<_> = "hello".chars().rev().collect(); + | ++++++++ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0297.stderr b/src/test/ui/error-codes/E0297.stderr index 693b079238d..903422f3b9b 100644 --- a/src/test/ui/error-codes/E0297.stderr +++ b/src/test/ui/error-codes/E0297.stderr @@ -6,12 +6,9 @@ LL | for Some(x) in xs {} | note: `Option<i32>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL + ::: $SRC_DIR/core/src/option.rs:LL:COL | -LL | pub enum Option<T> { - | ------------------ -... -LL | None, - | ^^^^ not covered + = note: not covered = note: the matched value is of type `Option<i32>` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0401.stderr b/src/test/ui/error-codes/E0401.stderr index 9687eca61fa..fa4b91cacef 100644 --- a/src/test/ui/error-codes/E0401.stderr +++ b/src/test/ui/error-codes/E0401.stderr @@ -59,7 +59,7 @@ note: required by a bound in `bfnr` | LL | fn bfnr<U, V: Baz<U>, W: Fn()>(y: T) { | ^^^^ required by this bound in `bfnr` -help: consider specifying the type arguments in the function call +help: consider specifying the generic arguments | LL | bfnr::<U, V, W>(x); | +++++++++++ diff --git a/src/test/ui/error-codes/E0507.stderr b/src/test/ui/error-codes/E0507.stderr index ce8d1ef0349..03630f38987 100644 --- a/src/test/ui/error-codes/E0507.stderr +++ b/src/test/ui/error-codes/E0507.stderr @@ -7,7 +7,7 @@ LL | x.borrow().nothing_is_true(); | | value moved due to this method call | move occurs because value has type `TheDarkKnight`, which does not implement the `Copy` trait | -note: this function takes ownership of the receiver `self`, which moves value +note: `TheDarkKnight::nothing_is_true` takes ownership of the receiver `self`, which moves value --> $DIR/E0507.rs:6:24 | LL | fn nothing_is_true(self) {} diff --git a/src/test/ui/error-codes/E0508-fail.stderr b/src/test/ui/error-codes/E0508-fail.stderr index b69d7743b6c..208ba30729f 100644 --- a/src/test/ui/error-codes/E0508-fail.stderr +++ b/src/test/ui/error-codes/E0508-fail.stderr @@ -6,7 +6,11 @@ LL | let _value = array[0]; | | | cannot move out of here | move occurs because `array[_]` has type `NonCopy`, which does not implement the `Copy` trait - | help: consider borrowing here: `&array[0]` + | +help: consider borrowing here + | +LL | let _value = &array[0]; + | + error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0508.stderr b/src/test/ui/error-codes/E0508.stderr index 5e7b56dcd37..df2d3b0d311 100644 --- a/src/test/ui/error-codes/E0508.stderr +++ b/src/test/ui/error-codes/E0508.stderr @@ -6,7 +6,11 @@ LL | let _value = array[0]; | | | cannot move out of here | move occurs because `array[_]` has type `NonCopy`, which does not implement the `Copy` trait - | help: consider borrowing here: `&array[0]` + | +help: consider borrowing here + | +LL | let _value = &array[0]; + | + error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0509.stderr b/src/test/ui/error-codes/E0509.stderr index cbfbc3ccf6a..c00d9142e75 100644 --- a/src/test/ui/error-codes/E0509.stderr +++ b/src/test/ui/error-codes/E0509.stderr @@ -6,7 +6,11 @@ LL | let fancy_field = drop_struct.fancy; | | | cannot move out of here | move occurs because `drop_struct.fancy` has type `FancyNum`, which does not implement the `Copy` trait - | help: consider borrowing here: `&drop_struct.fancy` + | +help: consider borrowing here + | +LL | let fancy_field = &drop_struct.fancy; + | + error: aborting due to previous error diff --git a/src/test/ui/error-festival.stderr b/src/test/ui/error-festival.stderr index 43122c13efb..fe9956b70bd 100644 --- a/src/test/ui/error-festival.stderr +++ b/src/test/ui/error-festival.stderr @@ -41,11 +41,8 @@ note: an implementation of `Not` might be missing for `Question` | LL | enum Question { | ^^^^^^^^^^^^^ must implement `Not` -note: the following trait must be implemented +note: the trait `Not` must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | pub trait Not { - | ^^^^^^^^^^^^^ error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/error-festival.rs:25:5 diff --git a/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr b/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr index 759d79493a9..2f9d10d70a2 100644 --- a/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr +++ b/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr @@ -14,7 +14,7 @@ LL | let p = Some(45).and_then({ LL | | LL | | |x| println!("doubling {}", x); LL | | Some(x * 2) - | | ----------- this tail expression is of type `std::option::Option<_>` + | | ----------- this tail expression is of type `Option<_>` LL | | LL | | }); | |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>` @@ -22,9 +22,6 @@ LL | | }); = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>` note: required by a bound in `Option::<T>::and_then` --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | F: ~const FnOnce(T) -> Option<U>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::<T>::and_then` error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr index 5ced344f13f..e253e4791e8 100644 --- a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr @@ -8,12 +8,9 @@ LL | let Ok(_x) = foo(); = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html note: `Result<u32, !>` defined here --> $SRC_DIR/core/src/result.rs:LL:COL + ::: $SRC_DIR/core/src/result.rs:LL:COL | -LL | pub enum Result<T, E> { - | --------------------- -... -LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), - | ^^^ not covered + = note: not covered = note: the matched value is of type `Result<u32, !>` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr b/src/test/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr index c485bc5c3ab..760dcb615c8 100644 --- a/src/test/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr +++ b/src/test/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr @@ -3,12 +3,18 @@ error[E0562]: `impl Trait` only allowed in function and inherent method return t | LL | fn f() -> impl Fn() -> impl Sized { || () } | ^^^^^^^^^^ + | + = note: see issue #99697 <https://github.com/rust-lang/rust/issues/99697> for more information + = help: add `#![feature(impl_trait_in_fn_trait_return)]` to the crate attributes to enable error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return --> $DIR/feature-gate-impl_trait_in_fn_trait_return.rs:3:32 | LL | fn g() -> &'static dyn Fn() -> impl Sized { &|| () } | ^^^^^^^^^^ + | + = note: see issue #99697 <https://github.com/rust-lang/rust/issues/99697> for more information + = help: add `#![feature(impl_trait_in_fn_trait_return)]` to the crate attributes to enable error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-linkage.rs b/src/test/ui/feature-gates/feature-gate-linkage.rs index 15b8d442aeb..505f31ec638 100644 --- a/src/test/ui/feature-gates/feature-gate-linkage.rs +++ b/src/test/ui/feature-gates/feature-gate-linkage.rs @@ -1,5 +1,5 @@ extern "C" { - #[linkage = "extern_weak"] static foo: isize; + #[linkage = "extern_weak"] static foo: *mut isize; //~^ ERROR: the `linkage` attribute is experimental and not portable } diff --git a/src/test/ui/feature-gates/feature-gate-linkage.stderr b/src/test/ui/feature-gates/feature-gate-linkage.stderr index 3e5b79bfd41..a1c73e555ef 100644 --- a/src/test/ui/feature-gates/feature-gate-linkage.stderr +++ b/src/test/ui/feature-gates/feature-gate-linkage.stderr @@ -1,7 +1,7 @@ error[E0658]: the `linkage` attribute is experimental and not portable across platforms --> $DIR/feature-gate-linkage.rs:2:5 | -LL | #[linkage = "extern_weak"] static foo: isize; +LL | #[linkage = "extern_weak"] static foo: *mut isize; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #29603 <https://github.com/rust-lang/rust/issues/29603> for more information diff --git a/src/test/ui/fmt/ifmt-bad-arg.stderr b/src/test/ui/fmt/ifmt-bad-arg.stderr index 1b595a50e99..a8a2a47fe46 100644 --- a/src/test/ui/fmt/ifmt-bad-arg.stderr +++ b/src/test/ui/fmt/ifmt-bad-arg.stderr @@ -309,9 +309,6 @@ LL | println!("{} {:.*} {}", 1, 3.2, 4); found reference `&{float}` note: associated function defined here --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL - | -LL | pub fn from_usize(x: &usize) -> ArgumentV1<'_> { - | ^^^^^^^^^^ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types @@ -327,9 +324,6 @@ LL | println!("{} {:07$.*} {}", 1, 3.2, 4); found reference `&{float}` note: associated function defined here --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL - | -LL | pub fn from_usize(x: &usize) -> ArgumentV1<'_> { - | ^^^^^^^^^^ = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 38 previous errors diff --git a/src/test/ui/fmt/ifmt-unimpl.stderr b/src/test/ui/fmt/ifmt-unimpl.stderr index 0e34f913511..be321c3c5c0 100644 --- a/src/test/ui/fmt/ifmt-unimpl.stderr +++ b/src/test/ui/fmt/ifmt-unimpl.stderr @@ -17,9 +17,6 @@ LL | format!("{:X}", "3"); = note: required for `&str` to implement `UpperHex` note: required by a bound in `ArgumentV1::<'a>::new_upper_hex` --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL - | -LL | arg_new!(new_upper_hex, UpperHex); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ArgumentV1::<'a>::new_upper_hex` = note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `arg_new` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/fn/signature-error-reporting-under-verbose.rs b/src/test/ui/fn/signature-error-reporting-under-verbose.rs new file mode 100644 index 00000000000..d7a8c95e8b2 --- /dev/null +++ b/src/test/ui/fn/signature-error-reporting-under-verbose.rs @@ -0,0 +1,15 @@ +// compile-flags: -Zverbose + +fn foo(_: i32, _: i32) {} + +fn needs_ptr(_: fn(i32, u32)) {} +//~^ NOTE function defined here +//~| NOTE + +fn main() { + needs_ptr(foo); + //~^ ERROR mismatched types + //~| NOTE expected `u32`, found `i32` + //~| NOTE expected fn pointer `fn(i32, u32)` + //~| NOTE arguments to this function are incorrect +} diff --git a/src/test/ui/fn/signature-error-reporting-under-verbose.stderr b/src/test/ui/fn/signature-error-reporting-under-verbose.stderr new file mode 100644 index 00000000000..6260fc8dcec --- /dev/null +++ b/src/test/ui/fn/signature-error-reporting-under-verbose.stderr @@ -0,0 +1,19 @@ +error[E0308]: mismatched types + --> $DIR/signature-error-reporting-under-verbose.rs:10:15 + | +LL | needs_ptr(foo); + | --------- ^^^ expected `u32`, found `i32` + | | + | arguments to this function are incorrect + | + = note: expected fn pointer `fn(i32, u32)` + found fn item `fn(i32, i32) {foo}` +note: function defined here + --> $DIR/signature-error-reporting-under-verbose.rs:5:4 + | +LL | fn needs_ptr(_: fn(i32, u32)) {} + | ^^^^^^^^^ --------------- + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/generator/issue-102645.stderr b/src/test/ui/generator/issue-102645.stderr index 7b4d5021325..afb39c9e594 100644 --- a/src/test/ui/generator/issue-102645.stderr +++ b/src/test/ui/generator/issue-102645.stderr @@ -6,9 +6,6 @@ LL | Pin::new(&mut b).resume(); | note: associated function defined here --> $SRC_DIR/core/src/ops/generator.rs:LL:COL - | -LL | fn resume(self: Pin<&mut Self>, arg: R) -> GeneratorState<Self::Yield, Self::Return>; - | ^^^^^^ help: provide the argument | LL | Pin::new(&mut b).resume(()); diff --git a/src/test/ui/generator/print/generator-print-verbose-1.stderr b/src/test/ui/generator/print/generator-print-verbose-1.stderr index 2e020780480..ed0628bbbc3 100644 --- a/src/test/ui/generator/print/generator-print-verbose-1.stderr +++ b/src/test/ui/generator/print/generator-print-verbose-1.stderr @@ -9,7 +9,7 @@ note: generator is not `Send` as this value is used across a yield --> $DIR/generator-print-verbose-1.rs:35:9 | LL | let _non_send_gen = make_non_send_generator(); - | ------------- has type `Opaque(DefId(0:44 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send` + | ------------- has type `Opaque(DefId(0:34 ~ generator_print_verbose_1[749a]::make_non_send_generator::{opaque#0}), [])` which is not `Send` LL | yield; | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later LL | }; @@ -35,17 +35,17 @@ note: required because it's used within this generator | LL | || { | ^^ -note: required because it appears within the type `Opaque(DefId(0:45 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [std::sync::Arc<std::cell::RefCell<i32>>])` +note: required because it appears within the type `Opaque(DefId(0:35 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [std::sync::Arc<std::cell::RefCell<i32>>])` --> $DIR/generator-print-verbose-1.rs:41:30 | LL | pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required because it appears within the type `Opaque(DefId(0:46 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` +note: required because it appears within the type `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])` --> $DIR/generator-print-verbose-1.rs:47:34 | LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: required because it captures the following types: `Opaque(DefId(0:46 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`, `()` + = note: required because it captures the following types: `Opaque(DefId(0:36 ~ generator_print_verbose_1[749a]::make_non_send_generator2::{opaque#0}), [])`, `()` note: required because it's used within this generator --> $DIR/generator-print-verbose-1.rs:52:20 | diff --git a/src/test/ui/generator/sized-yield.stderr b/src/test/ui/generator/sized-yield.stderr index ea2a48d13ce..fb34540d969 100644 --- a/src/test/ui/generator/sized-yield.stderr +++ b/src/test/ui/generator/sized-yield.stderr @@ -20,9 +20,6 @@ LL | Pin::new(&mut gen).resume(()); = help: the trait `Sized` is not implemented for `str` note: required by a bound in `GeneratorState` --> $SRC_DIR/core/src/ops/generator.rs:LL:COL - | -LL | pub enum GeneratorState<Y, R> { - | ^ required by this bound in `GeneratorState` error: aborting due to 2 previous errors diff --git a/src/test/ui/generic-associated-types/cross-crate-bounds.stderr b/src/test/ui/generic-associated-types/cross-crate-bounds.stderr index c81cd7e7718..83ee04d5a6c 100644 --- a/src/test/ui/generic-associated-types/cross-crate-bounds.stderr +++ b/src/test/ui/generic-associated-types/cross-crate-bounds.stderr @@ -8,7 +8,7 @@ note: required by a bound in `foo_defn::Foo::Bar` --> $DIR/auxiliary/foo_defn.rs:4:15 | LL | type Bar: AsRef<()>; - | ^^^^^^^^^ required by this bound in `foo_defn::Foo::Bar` + | ^^^^^^^^^ required by this bound in `Foo::Bar` error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/issue-101020.stderr b/src/test/ui/generic-associated-types/issue-101020.stderr index b4e94cb83f7..422ac548427 100644 --- a/src/test/ui/generic-associated-types/issue-101020.stderr +++ b/src/test/ui/generic-associated-types/issue-101020.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `for<'a> &'a mut (): Foo<&'a mut ()>` is not satisfied - --> $DIR/issue-101020.rs:31:5 + --> $DIR/issue-101020.rs:31:22 | LL | (&mut EmptyIter).consume(()); - | ^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call - | | - | the trait `for<'a> Foo<&'a mut ()>` is not implemented for `&'a mut ()` + | ^^^^^^^ the trait `for<'a> Foo<&'a mut ()>` is not implemented for `&'a mut ()` | note: required for `&'a mut ()` to implement `for<'a> FuncInput<'a, &'a mut ()>` --> $DIR/issue-101020.rs:27:20 diff --git a/src/test/ui/generic-associated-types/own-bound-span.rs b/src/test/ui/generic-associated-types/own-bound-span.rs new file mode 100644 index 00000000000..3699f7296f5 --- /dev/null +++ b/src/test/ui/generic-associated-types/own-bound-span.rs @@ -0,0 +1,17 @@ +struct S; + +trait D { + type P<T: Copy>; + //~^ NOTE required by this bound in `D::P` + //~| NOTE required by a bound in `D::P` +} + +impl D for S { + type P<T: Copy> = (); +} + +fn main() { + let _: <S as D>::P<String>; + //~^ ERROR the trait bound `String: Copy` is not satisfied + //~| NOTE the trait `Copy` is not implemented for `String` +} diff --git a/src/test/ui/generic-associated-types/own-bound-span.stderr b/src/test/ui/generic-associated-types/own-bound-span.stderr new file mode 100644 index 00000000000..8ab8ea623b2 --- /dev/null +++ b/src/test/ui/generic-associated-types/own-bound-span.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `String: Copy` is not satisfied + --> $DIR/own-bound-span.rs:14:12 + | +LL | let _: <S as D>::P<String>; + | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` + | +note: required by a bound in `D::P` + --> $DIR/own-bound-span.rs:4:15 + | +LL | type P<T: Copy>; + | ^^^^ required by this bound in `D::P` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/generic-associated-types/self-outlives-lint.stderr b/src/test/ui/generic-associated-types/self-outlives-lint.stderr index 58172bf06b5..9e9b2e18abe 100644 --- a/src/test/ui/generic-associated-types/self-outlives-lint.stderr +++ b/src/test/ui/generic-associated-types/self-outlives-lint.stderr @@ -108,17 +108,6 @@ LL | type Bar<'b>; = note: this bound is currently required to ensure that impls have maximum flexibility = note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information -error: missing required bound on `Item` - --> $DIR/self-outlives-lint.rs:140:5 - | -LL | type Item<'a>; - | ^^^^^^^^^^^^^- - | | - | help: add the required where clause: `where Self: 'a` - | - = note: this bound is currently required to ensure that impls have maximum flexibility - = note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information - error: missing required bound on `Iterator` --> $DIR/self-outlives-lint.rs:142:5 | @@ -131,6 +120,17 @@ LL | type Iterator<'a>: Iterator<Item = Self::Item<'a>>; = note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information error: missing required bound on `Item` + --> $DIR/self-outlives-lint.rs:140:5 + | +LL | type Item<'a>; + | ^^^^^^^^^^^^^- + | | + | help: add the required where clause: `where Self: 'a` + | + = note: this bound is currently required to ensure that impls have maximum flexibility + = note: we are soliciting feedback, see issue #87479 <https://github.com/rust-lang/rust/issues/87479> for more information + +error: missing required bound on `Item` --> $DIR/self-outlives-lint.rs:148:5 | LL | type Item<'a>; diff --git a/src/test/ui/generics/wrong-number-of-args.stderr b/src/test/ui/generics/wrong-number-of-args.stderr index 0475eb908a7..b48966a1a1e 100644 --- a/src/test/ui/generics/wrong-number-of-args.stderr +++ b/src/test/ui/generics/wrong-number-of-args.stderr @@ -889,11 +889,6 @@ error[E0107]: missing generics for struct `HashMap` LL | type A = HashMap; | ^^^^^^^ expected at least 2 generic arguments | -note: struct defined here, with at least 2 generic parameters: `K`, `V` - --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL - | -LL | pub struct HashMap<K, V, S = RandomState> { - | ^^^^^^^ - - help: add missing generic arguments | LL | type A = HashMap<K, V>; @@ -907,11 +902,6 @@ LL | type B = HashMap<String>; | | | expected at least 2 generic arguments | -note: struct defined here, with at least 2 generic parameters: `K`, `V` - --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL - | -LL | pub struct HashMap<K, V, S = RandomState> { - | ^^^^^^^ - - help: add missing generic argument | LL | type B = HashMap<String, V>; @@ -924,12 +914,6 @@ LL | type C = HashMap<'static>; | ^^^^^^^--------- help: remove these generics | | | expected 0 lifetime arguments - | -note: struct defined here, with 0 lifetime parameters - --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL - | -LL | pub struct HashMap<K, V, S = RandomState> { - | ^^^^^^^ error[E0107]: this struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:318:18 @@ -937,11 +921,6 @@ error[E0107]: this struct takes at least 2 generic arguments but 0 generic argum LL | type C = HashMap<'static>; | ^^^^^^^ expected at least 2 generic arguments | -note: struct defined here, with at least 2 generic parameters: `K`, `V` - --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL - | -LL | pub struct HashMap<K, V, S = RandomState> { - | ^^^^^^^ - - help: add missing generic arguments | LL | type C = HashMap<'static, K, V>; @@ -954,12 +933,6 @@ LL | type D = HashMap<usize, String, char, f64>; | ^^^^^^^ --- help: remove this generic argument | | | expected at most 3 generic arguments - | -note: struct defined here, with at most 3 generic parameters: `K`, `V`, `S` - --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL - | -LL | pub struct HashMap<K, V, S = RandomState> { - | ^^^^^^^ - - --------------- error[E0107]: this struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:328:18 @@ -967,11 +940,6 @@ error[E0107]: this struct takes at least 2 generic arguments but 0 generic argum LL | type E = HashMap<>; | ^^^^^^^ expected at least 2 generic arguments | -note: struct defined here, with at least 2 generic parameters: `K`, `V` - --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL - | -LL | pub struct HashMap<K, V, S = RandomState> { - | ^^^^^^^ - - help: add missing generic arguments | LL | type E = HashMap<K, V>; @@ -983,11 +951,6 @@ error[E0107]: missing generics for enum `Result` LL | type A = Result; | ^^^^^^ expected 2 generic arguments | -note: enum defined here, with 2 generic parameters: `T`, `E` - --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | ^^^^^^ - - help: add missing generic arguments | LL | type A = Result<T, E>; @@ -1001,11 +964,6 @@ LL | type B = Result<String>; | | | expected 2 generic arguments | -note: enum defined here, with 2 generic parameters: `T`, `E` - --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | ^^^^^^ - - help: add missing generic argument | LL | type B = Result<String, E>; @@ -1018,12 +976,6 @@ LL | type C = Result<'static>; | ^^^^^^--------- help: remove these generics | | | expected 0 lifetime arguments - | -note: enum defined here, with 0 lifetime parameters - --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | ^^^^^^ error[E0107]: this enum takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:342:18 @@ -1031,11 +983,6 @@ error[E0107]: this enum takes 2 generic arguments but 0 generic arguments were s LL | type C = Result<'static>; | ^^^^^^ expected 2 generic arguments | -note: enum defined here, with 2 generic parameters: `T`, `E` - --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | ^^^^^^ - - help: add missing generic arguments | LL | type C = Result<'static, T, E>; @@ -1048,12 +995,6 @@ LL | type D = Result<usize, String, char>; | ^^^^^^ ---- help: remove this generic argument | | | expected 2 generic arguments - | -note: enum defined here, with 2 generic parameters: `T`, `E` - --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | ^^^^^^ - - error[E0107]: this enum takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:352:18 @@ -1061,11 +1002,6 @@ error[E0107]: this enum takes 2 generic arguments but 0 generic arguments were s LL | type E = Result<>; | ^^^^^^ expected 2 generic arguments | -note: enum defined here, with 2 generic parameters: `T`, `E` - --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | ^^^^^^ - - help: add missing generic arguments | LL | type E = Result<T, E>; diff --git a/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr b/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr index a6f8563a047..095a1c6af37 100644 --- a/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr +++ b/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` LL | [_, 99.., _] => {}, - | ^^ expected struct `std::ops::Range`, found integer + | ^^ expected struct `Range`, found integer | = note: expected struct `std::ops::Range<{integer}>` found type `{integer}` diff --git a/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr b/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr index 4e0102c930d..2ea3205dcd4 100644 --- a/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr +++ b/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.stderr @@ -10,7 +10,7 @@ error[E0308]: mismatched types LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` LL | [_, 99..] => {}, - | ^^ expected struct `std::ops::Range`, found integer + | ^^ expected struct `Range`, found integer | = note: expected struct `std::ops::Range<{integer}>` found type `{integer}` diff --git a/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr b/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr index 790a1337228..bbdf0c83f62 100644 --- a/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr +++ b/src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` LL | [..9, 99..100, _] => {}, - | ^ expected struct `std::ops::Range`, found integer + | ^ expected struct `Range`, found integer | = note: expected struct `std::ops::Range<{integer}>` found type `{integer}` @@ -17,7 +17,7 @@ LL | match [5..4, 99..105, 43..44] { LL | [..9, 99..100, _] => {}, | ^^ --- this is of type `{integer}` | | - | expected struct `std::ops::Range`, found integer + | expected struct `Range`, found integer | = note: expected struct `std::ops::Range<{integer}>` found type `{integer}` @@ -28,7 +28,7 @@ error[E0308]: mismatched types LL | match [5..4, 99..105, 43..44] { | ----------------------- this expression has type `[std::ops::Range<{integer}>; 3]` LL | [..9, 99..100, _] => {}, - | -- ^^^ expected struct `std::ops::Range`, found integer + | -- ^^^ expected struct `Range`, found integer | | | this is of type `{integer}` | diff --git a/src/test/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.rs b/src/test/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.rs new file mode 100644 index 00000000000..d34b7a29623 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.rs @@ -0,0 +1,16 @@ +// normalize-stderr-test: "long-type-\d+" -> "long-type-hash" + +fn id( + f: &dyn Fn(u32), +) -> &dyn Fn( + &dyn Fn( + &dyn Fn( + &dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(u32))))))))), + ), + ), +) { + f + //~^ ERROR mismatched types +} + +fn main() {} diff --git a/src/test/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr b/src/test/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr new file mode 100644 index 00000000000..71e196c3227 --- /dev/null +++ b/src/test/ui/higher-rank-trait-bounds/hang-on-deeply-nested-dyn.stderr @@ -0,0 +1,22 @@ +error[E0308]: mismatched types + --> $DIR/hang-on-deeply-nested-dyn.rs:12:5 + | +LL | ) -> &dyn Fn( + | ______- +LL | | &dyn Fn( +LL | | &dyn Fn( +LL | | &dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(&dyn Fn(u32))))))))), +LL | | ), +LL | | ), +LL | | ) { + | |_- expected `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn Fn(u32) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a)) + 'a))` because of return type +LL | f + | ^ expected reference, found `u32` + | + = note: expected reference `&dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a (dyn for<'a> Fn(&'a ...) + 'a)) + 'a)) + 'a))` + the full type name has been written to '$TEST_BUILD_DIR/higher-rank-trait-bounds/hang-on-deeply-nested-dyn/hang-on-deeply-nested-dyn.long-type-hash.txt' + found reference `&dyn Fn(u32)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-15221.rs b/src/test/ui/hygiene/issue-15221.rs index 4b8319a8304..4b8319a8304 100644 --- a/src/test/ui/issues/issue-15221.rs +++ b/src/test/ui/hygiene/issue-15221.rs diff --git a/src/test/ui/illegal-sized-bound/mutability-mismatch.rs b/src/test/ui/illegal-sized-bound/mutability-mismatch.rs new file mode 100644 index 00000000000..deb84f6fe97 --- /dev/null +++ b/src/test/ui/illegal-sized-bound/mutability-mismatch.rs @@ -0,0 +1,34 @@ +struct MutType; + +pub trait MutTrait { + fn function(&mut self) + where + Self: Sized; + //~^ this has a `Sized` requirement +} + +impl MutTrait for MutType { + fn function(&mut self) {} +} + +struct Type; + +pub trait Trait { + fn function(&self) + where + Self: Sized; + //~^ this has a `Sized` requirement +} + +impl Trait for Type { + fn function(&self) {} +} + +fn main() { + (&MutType as &dyn MutTrait).function(); + //~^ ERROR the `function` method cannot be invoked on a trait object + //~| NOTE you need `&mut dyn MutTrait` instead of `&dyn MutTrait` + (&mut Type as &mut dyn Trait).function(); + //~^ ERROR the `function` method cannot be invoked on a trait object + //~| NOTE you need `&dyn Trait` instead of `&mut dyn Trait` +} diff --git a/src/test/ui/illegal-sized-bound/mutability-mismatch.stderr b/src/test/ui/illegal-sized-bound/mutability-mismatch.stderr new file mode 100644 index 00000000000..dbbf79a4f1a --- /dev/null +++ b/src/test/ui/illegal-sized-bound/mutability-mismatch.stderr @@ -0,0 +1,24 @@ +error: the `function` method cannot be invoked on a trait object + --> $DIR/mutability-mismatch.rs:28:33 + | +LL | Self: Sized; + | ----- this has a `Sized` requirement +... +LL | (&MutType as &dyn MutTrait).function(); + | ^^^^^^^^ + | + = note: you need `&mut dyn MutTrait` instead of `&dyn MutTrait` + +error: the `function` method cannot be invoked on a trait object + --> $DIR/mutability-mismatch.rs:31:35 + | +LL | Self: Sized; + | ----- this has a `Sized` requirement +... +LL | (&mut Type as &mut dyn Trait).function(); + | ^^^^^^^^ + | + = note: you need `&dyn Trait` instead of `&mut dyn Trait` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/illegal-sized-bound/regular.rs b/src/test/ui/illegal-sized-bound/regular.rs new file mode 100644 index 00000000000..7abd27ef983 --- /dev/null +++ b/src/test/ui/illegal-sized-bound/regular.rs @@ -0,0 +1,32 @@ +struct MutType; + +pub trait MutTrait { + fn function(&mut self) + where + Self: Sized; + //~^ this has a `Sized` requirement +} + +impl MutTrait for MutType { + fn function(&mut self) {} +} + +struct Type; + +pub trait Trait { + fn function(&self) + where + Self: Sized; + //~^ this has a `Sized` requirement +} + +impl Trait for Type { + fn function(&self) {} +} + +fn main() { + (&mut MutType as &mut dyn MutTrait).function(); + //~^ ERROR the `function` method cannot be invoked on a trait object + (&Type as &dyn Trait).function(); + //~^ ERROR the `function` method cannot be invoked on a trait object +} diff --git a/src/test/ui/illegal-sized-bound/regular.stderr b/src/test/ui/illegal-sized-bound/regular.stderr new file mode 100644 index 00000000000..7f3744145d9 --- /dev/null +++ b/src/test/ui/illegal-sized-bound/regular.stderr @@ -0,0 +1,20 @@ +error: the `function` method cannot be invoked on a trait object + --> $DIR/regular.rs:28:41 + | +LL | Self: Sized; + | ----- this has a `Sized` requirement +... +LL | (&mut MutType as &mut dyn MutTrait).function(); + | ^^^^^^^^ + +error: the `function` method cannot be invoked on a trait object + --> $DIR/regular.rs:30:27 + | +LL | Self: Sized; + | ----- this has a `Sized` requirement +... +LL | (&Type as &dyn Trait).function(); + | ^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/impl-trait/equality.stderr b/src/test/ui/impl-trait/equality.stderr index 1841b8e5dcd..69f4cbbbf42 100644 --- a/src/test/ui/impl-trait/equality.stderr +++ b/src/test/ui/impl-trait/equality.stderr @@ -30,15 +30,10 @@ LL | n + sum_to(n - 1) | = help: the trait `Add<impl Foo>` is not implemented for `u32` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> - <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> - <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> - <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&'a u32 as Add<u32>> + <&u32 as Add<&u32>> + <u32 as Add<&u32>> + <u32 as Add> error: aborting due to 2 previous errors; 1 warning emitted diff --git a/src/test/ui/impl-trait/impl-generic-mismatch.stderr b/src/test/ui/impl-trait/impl-generic-mismatch.stderr index 542f02d7ec5..973b65bfd62 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch.stderr +++ b/src/test/ui/impl-trait/impl-generic-mismatch.stderr @@ -46,11 +46,9 @@ error[E0643]: method `hash` has incompatible signature for trait | LL | fn hash(&self, hasher: &mut impl Hasher) {} | ^^^^^^^^^^^ expected generic parameter, found `impl Trait` + --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | - ::: $SRC_DIR/core/src/hash/mod.rs:LL:COL - | -LL | fn hash<H: Hasher>(&self, state: &mut H); - | - declaration in trait here + = note: declaration in trait here error: aborting due to 4 previous errors diff --git a/src/test/ui/impl-trait/in-trait/wf-bounds.stderr b/src/test/ui/impl-trait/in-trait/wf-bounds.stderr index 92e36841b70..03cc4c2b93b 100644 --- a/src/test/ui/impl-trait/in-trait/wf-bounds.stderr +++ b/src/test/ui/impl-trait/in-trait/wf-bounds.stderr @@ -7,9 +7,6 @@ LL | fn nya() -> impl Wf<Vec<[u8]>>; = help: the trait `Sized` is not implemented for `[u8]` note: required by a bound in `Vec` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | ^ required by this bound in `Vec` error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/wf-bounds.rs:12:23 diff --git a/src/test/ui/impl-trait/in-trait/where-clause.rs b/src/test/ui/impl-trait/in-trait/where-clause.rs new file mode 100644 index 00000000000..87bac519cf3 --- /dev/null +++ b/src/test/ui/impl-trait/in-trait/where-clause.rs @@ -0,0 +1,24 @@ +// check-pass +// edition: 2021 + +#![feature(return_position_impl_trait_in_trait)] +#![allow(incomplete_features)] + +use std::fmt::Debug; + +trait Foo<Item> { + fn foo<'a>(&'a self) -> impl Debug + where + Item: 'a; +} + +impl<Item, D: Debug + Clone> Foo<Item> for D { + fn foo<'a>(&'a self) -> impl Debug + where + Item: 'a, + { + self.clone() + } +} + +fn main() {} diff --git a/src/test/ui/impl-trait/issues/issue-62742.stderr b/src/test/ui/impl-trait/issues/issue-62742.stderr index 34f4dc2cef3..bc342dc4689 100644 --- a/src/test/ui/impl-trait/issues/issue-62742.stderr +++ b/src/test/ui/impl-trait/issues/issue-62742.stderr @@ -25,7 +25,7 @@ LL | pub struct SafeImpl<T: ?Sized, A: Raw<T>>(PhantomData<(A, T)>); | = note: the following trait bounds were not satisfied: `RawImpl<()>: Raw<()>` -note: the following trait must be implemented +note: the trait `Raw` must be implemented --> $DIR/issue-62742.rs:12:1 | LL | pub trait Raw<T: ?Sized> { diff --git a/src/test/ui/impl-trait/issues/issue-86719.stderr b/src/test/ui/impl-trait/issues/issue-86719.stderr index 09047cdcbe1..7592418fdfd 100644 --- a/src/test/ui/impl-trait/issues/issue-86719.stderr +++ b/src/test/ui/impl-trait/issues/issue-86719.stderr @@ -20,8 +20,8 @@ LL | |_| true | help: consider giving this closure parameter an explicit type | -LL | |_: _| true - | +++ +LL | |_: /* Type */| true + | ++++++++++++ error: aborting due to 3 previous errors diff --git a/src/test/ui/impl-trait/issues/issue-92305.stderr b/src/test/ui/impl-trait/issues/issue-92305.stderr index 34d5c2d61dc..f09c14d3df1 100644 --- a/src/test/ui/impl-trait/issues/issue-92305.stderr +++ b/src/test/ui/impl-trait/issues/issue-92305.stderr @@ -4,11 +4,6 @@ error[E0107]: missing generics for struct `Vec` LL | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec> { | ^^^ expected at least 1 generic argument | -note: struct defined here, with at least 1 generic parameter: `T` - --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | ^^^ - help: add missing generic argument | LL | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec<T>> { diff --git a/src/test/ui/impl-trait/nested-return-type4.rs b/src/test/ui/impl-trait/nested-return-type4.rs new file mode 100644 index 00000000000..cec70bb1a0d --- /dev/null +++ b/src/test/ui/impl-trait/nested-return-type4.rs @@ -0,0 +1,8 @@ +// edition: 2021 + +fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized> { + async move { let _s = s; } + //~^ ERROR hidden type for `impl Future<Output = impl Sized>` captures lifetime that does not appear in bounds +} + +fn main() {} diff --git a/src/test/ui/impl-trait/nested-return-type4.stderr b/src/test/ui/impl-trait/nested-return-type4.stderr new file mode 100644 index 00000000000..e761a60e79c --- /dev/null +++ b/src/test/ui/impl-trait/nested-return-type4.stderr @@ -0,0 +1,20 @@ +error[E0700]: hidden type for `impl Future<Output = impl Sized>` captures lifetime that does not appear in bounds + --> $DIR/nested-return-type4.rs:4:5 + | +LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized> { + | -- hidden type `[async block@$DIR/nested-return-type4.rs:4:5: 4:31]` captures the lifetime `'s` as defined here +LL | async move { let _s = s; } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: to declare that `impl Future<Output = impl Sized>` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized> + 's { + | ++++ +help: to declare that `impl Sized` captures `'s`, you can add an explicit `'s` lifetime bound + | +LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized + 's> { + | ++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0700`. diff --git a/src/test/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr b/src/test/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr index 3dda5761ada..3ee26f74a78 100644 --- a/src/test/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr +++ b/src/test/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr @@ -15,7 +15,7 @@ LL | type Foo = impl PartialEq<(Foo, i32)>; LL | fn eq(&self, _other: &(Foo, i32)) -> bool { | ^^^^^^^^^^^ | | - | expected struct `a::Bar`, found opaque type + | expected struct `Bar`, found opaque type | help: change the parameter type to match the trait: `&(a::Bar, i32)` | = note: expected fn pointer `fn(&a::Bar, &(a::Bar, i32)) -> _` @@ -38,7 +38,7 @@ LL | type Foo = impl PartialEq<(Foo, i32)>; LL | fn eq(&self, _other: &(Bar, i32)) -> bool { | ^^^^^^^^^^^ | | - | expected opaque type, found struct `b::Bar` + | expected opaque type, found struct `Bar` | help: change the parameter type to match the trait: `&(b::Foo, i32)` | = note: expected fn pointer `fn(&b::Bar, &(b::Foo, i32)) -> _` diff --git a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr index c31c8840381..ade479ed102 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr +++ b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr @@ -24,11 +24,8 @@ LL | extern crate std as Vec; ... LL | define_vec!(); | ------------- in this macro invocation -note: `Vec` could also refer to the struct defined here +note: `Vec` could also refer to a struct from prelude --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL - | -LL | pub use super::v1::*; - | ^^^^^^^^^^^^ = note: this error originates in the macro `define_vec` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-26930.rs b/src/test/ui/imports/issue-26930.rs index 707e71b1124..707e71b1124 100644 --- a/src/test/ui/issues/issue-26930.rs +++ b/src/test/ui/imports/issue-26930.rs diff --git a/src/test/ui/inference/deref-suggestion.stderr b/src/test/ui/inference/deref-suggestion.stderr index 034005697b4..3db67cdb537 100644 --- a/src/test/ui/inference/deref-suggestion.stderr +++ b/src/test/ui/inference/deref-suggestion.stderr @@ -87,7 +87,10 @@ error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:37:5 | LL | assert_eq!(3i32, &3i32); - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `&i32` + | ^^^^^^^^^^^^^^^^^^^^^^^ + | | + | expected `i32`, found `&i32` + | expected because this is `i32` | = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/inference/erase-type-params-in-label.stderr b/src/test/ui/inference/erase-type-params-in-label.stderr index 5c52e7bcfab..9be18286480 100644 --- a/src/test/ui/inference/erase-type-params-in-label.stderr +++ b/src/test/ui/inference/erase-type-params-in-label.stderr @@ -10,10 +10,10 @@ note: required by a bound in `foo` | LL | fn foo<T, K, W: Default, Z: Default>(t: T, k: K) -> Foo<T, K, W, Z> { | ^^^^^^^ required by this bound in `foo` -help: consider specifying the type arguments in the function call +help: consider giving `foo` an explicit type, where the type for type parameter `W` is specified | -LL | let foo = foo::<T, K, W, Z>(1, ""); - | ++++++++++++++ +LL | let foo: Foo<i32, &str, W, Z> = foo(1, ""); + | ++++++++++++++++++++++ error[E0283]: type annotations needed for `Bar<i32, &str, Z>` --> $DIR/erase-type-params-in-label.rs:5:9 @@ -27,10 +27,10 @@ note: required by a bound in `bar` | LL | fn bar<T, K, Z: Default>(t: T, k: K) -> Bar<T, K, Z> { | ^^^^^^^ required by this bound in `bar` -help: consider specifying the type arguments in the function call +help: consider giving `bar` an explicit type, where the type for type parameter `Z` is specified | -LL | let bar = bar::<T, K, Z>(1, ""); - | +++++++++++ +LL | let bar: Bar<i32, &str, Z> = bar(1, ""); + | +++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/inference/issue-71732.stderr b/src/test/ui/inference/issue-71732.stderr index 79bee33280d..01b37f2acaa 100644 --- a/src/test/ui/inference/issue-71732.stderr +++ b/src/test/ui/inference/issue-71732.stderr @@ -12,9 +12,6 @@ LL | .get(&"key".into()) where T: ?Sized; note: required by a bound in `HashMap::<K, V, S>::get` --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL - | -LL | K: Borrow<Q>, - | ^^^^^^^^^ required by this bound in `HashMap::<K, V, S>::get` help: consider specifying the generic argument | LL | .get::<Q>(&"key".into()) diff --git a/src/test/ui/inference/issue-72690.stderr b/src/test/ui/inference/issue-72690.stderr index d4eeda07366..8eda71ec09b 100644 --- a/src/test/ui/inference/issue-72690.stderr +++ b/src/test/ui/inference/issue-72690.stderr @@ -32,8 +32,8 @@ LL | |x| String::from("x".as_ref()); | help: consider giving this closure parameter an explicit type | -LL | |x: _| String::from("x".as_ref()); - | +++ +LL | |x: /* Type */| String::from("x".as_ref()); + | ++++++++++++ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:12:26 diff --git a/src/test/ui/infinite/infinite-recursion-const-fn.stderr b/src/test/ui/infinite/infinite-recursion-const-fn.stderr index 620c9e110ff..53b603a47b5 100644 --- a/src/test/ui/infinite/infinite-recursion-const-fn.stderr +++ b/src/test/ui/infinite/infinite-recursion-const-fn.stderr @@ -2,143 +2,648 @@ error[E0080]: evaluation of constant value failed --> $DIR/infinite-recursion-const-fn.rs:4:5 | LL | b() + | ^^^ reached the configured maximum number of stack frames + | +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() | ^^^ - | | - | reached the configured maximum number of stack frames - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 - | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 -... -LL | a() - | --- - | | - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 - | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 -LL | } +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `b` + --> $DIR/infinite-recursion-const-fn.rs:7:5 + | +LL | a() + | ^^^ +note: inside `a` + --> $DIR/infinite-recursion-const-fn.rs:4:5 + | +LL | b() + | ^^^ +note: inside `ARR::{constant#0}` + --> $DIR/infinite-recursion-const-fn.rs:9:18 + | LL | const ARR: [i32; a()] = [5; 6]; - | --- inside `ARR::{constant#0}` at $DIR/infinite-recursion-const-fn.rs:9:18 + | ^^^ error: aborting due to previous error diff --git a/src/test/ui/inline-const/expr-unsafe-err.mir.stderr b/src/test/ui/inline-const/expr-unsafe-err.mir.stderr new file mode 100644 index 00000000000..1bec41e2efa --- /dev/null +++ b/src/test/ui/inline-const/expr-unsafe-err.mir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function is unsafe and requires unsafe function or block + --> $DIR/expr-unsafe-err.rs:8:9 + | +LL | require_unsafe(); + | ^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/inline-const/expr-unsafe-err.rs b/src/test/ui/inline-const/expr-unsafe-err.rs new file mode 100644 index 00000000000..adf05d352ea --- /dev/null +++ b/src/test/ui/inline-const/expr-unsafe-err.rs @@ -0,0 +1,11 @@ +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck +#![feature(inline_const)] +const unsafe fn require_unsafe() -> usize { 1 } + +fn main() { + const { + require_unsafe(); + //~^ ERROR [E0133] + } +} diff --git a/src/test/ui/inline-const/expr-unsafe-err.thir.stderr b/src/test/ui/inline-const/expr-unsafe-err.thir.stderr new file mode 100644 index 00000000000..c971e8afb35 --- /dev/null +++ b/src/test/ui/inline-const/expr-unsafe-err.thir.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block + --> $DIR/expr-unsafe-err.rs:8:9 + | +LL | require_unsafe(); + | ^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/inline-const/expr-unsafe.mir.stderr b/src/test/ui/inline-const/expr-unsafe.mir.stderr new file mode 100644 index 00000000000..1ab6e42fba0 --- /dev/null +++ b/src/test/ui/inline-const/expr-unsafe.mir.stderr @@ -0,0 +1,14 @@ +warning: unnecessary `unsafe` block + --> $DIR/expr-unsafe.rs:12:13 + | +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/expr-unsafe.rs:4:9 + | +LL | #![warn(unused_unsafe)] + | ^^^^^^^^^^^^^ + +warning: 1 warning emitted + diff --git a/src/test/ui/inline-const/expr-unsafe.rs b/src/test/ui/inline-const/expr-unsafe.rs new file mode 100644 index 00000000000..d71efd33db1 --- /dev/null +++ b/src/test/ui/inline-const/expr-unsafe.rs @@ -0,0 +1,16 @@ +// check-pass +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck +#![warn(unused_unsafe)] +#![feature(inline_const)] +const unsafe fn require_unsafe() -> usize { 1 } + +fn main() { + unsafe { + const { + require_unsafe(); + unsafe {} + //~^ WARNING unnecessary `unsafe` block + } + } +} diff --git a/src/test/ui/inline-const/expr-unsafe.thir.stderr b/src/test/ui/inline-const/expr-unsafe.thir.stderr new file mode 100644 index 00000000000..4737444fb61 --- /dev/null +++ b/src/test/ui/inline-const/expr-unsafe.thir.stderr @@ -0,0 +1,17 @@ +warning: unnecessary `unsafe` block + --> $DIR/expr-unsafe.rs:12:13 + | +LL | unsafe { + | ------ because it's nested under this `unsafe` block +... +LL | unsafe {} + | ^^^^^^ unnecessary `unsafe` block + | +note: the lint level is defined here + --> $DIR/expr-unsafe.rs:4:9 + | +LL | #![warn(unused_unsafe)] + | ^^^^^^^^^^^^^ + +warning: 1 warning emitted + diff --git a/src/test/ui/inline-const/expr-with-block-err.rs b/src/test/ui/inline-const/expr-with-block-err.rs new file mode 100644 index 00000000000..f7547742ddc --- /dev/null +++ b/src/test/ui/inline-const/expr-with-block-err.rs @@ -0,0 +1,6 @@ +#![feature(inline_const)] + +fn main() { + const { 2 } - const { 1 }; + //~^ ERROR mismatched types +} diff --git a/src/test/ui/inline-const/expr-with-block-err.stderr b/src/test/ui/inline-const/expr-with-block-err.stderr new file mode 100644 index 00000000000..6f7408f4e2a --- /dev/null +++ b/src/test/ui/inline-const/expr-with-block-err.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/expr-with-block-err.rs:4:13 + | +LL | const { 2 } - const { 1 }; + | ^ expected `()`, found integer + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/inline-const/expr-with-block.rs b/src/test/ui/inline-const/expr-with-block.rs new file mode 100644 index 00000000000..391872476fc --- /dev/null +++ b/src/test/ui/inline-const/expr-with-block.rs @@ -0,0 +1,10 @@ +// check-pass +#![feature(inline_const)] +fn main() { + match true { + true => const {} + false => () + } + const {} + () +} diff --git a/src/test/ui/inline-const/pat-unsafe-err.rs b/src/test/ui/inline-const/pat-unsafe-err.rs new file mode 100644 index 00000000000..e290b438c51 --- /dev/null +++ b/src/test/ui/inline-const/pat-unsafe-err.rs @@ -0,0 +1,17 @@ +// ignore-test This is currently broken +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +#![allow(incomplete_features)] +#![feature(inline_const_pat)] + +const unsafe fn require_unsafe() -> usize { 1 } + +fn main() { + match () { + const { + require_unsafe(); + //~^ ERROR [E0133] + } => (), + } +} diff --git a/src/test/ui/inline-const/pat-unsafe.rs b/src/test/ui/inline-const/pat-unsafe.rs new file mode 100644 index 00000000000..bcf7f6e0180 --- /dev/null +++ b/src/test/ui/inline-const/pat-unsafe.rs @@ -0,0 +1,22 @@ +// ignore-test This is currently broken +// check-pass +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +#![allow(incomplete_features)] +#![warn(unused_unsafe)] +#![feature(inline_const_pat)] + +const unsafe fn require_unsafe() -> usize { 1 } + +fn main() { + unsafe { + match () { + const { + require_unsafe(); + unsafe {} + //~^ WARNING unnecessary `unsafe` block + } => (), + } + } +} diff --git a/src/test/ui/interior-mutability/interior-mutability.stderr b/src/test/ui/interior-mutability/interior-mutability.stderr index 94f41c92598..034d22591b3 100644 --- a/src/test/ui/interior-mutability/interior-mutability.stderr +++ b/src/test/ui/interior-mutability/interior-mutability.stderr @@ -16,9 +16,6 @@ LL | catch_unwind(|| { x.set(23); }); | ^^ note: required by a bound in `catch_unwind` --> $SRC_DIR/std/src/panic.rs:LL:COL - | -LL | pub fn catch_unwind<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> { - | ^^^^^^^^^^ required by this bound in `catch_unwind` error: aborting due to previous error diff --git a/src/test/ui/intrinsics/const-eval-select-bad.stderr b/src/test/ui/intrinsics/const-eval-select-bad.stderr index 3720528ad4e..fd7d061b6b2 100644 --- a/src/test/ui/intrinsics/const-eval-select-bad.stderr +++ b/src/test/ui/intrinsics/const-eval-select-bad.stderr @@ -37,9 +37,6 @@ LL | const_eval_select((), 42, 0xDEADBEEF); = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL - | -LL | F: FnOnce<ARG, Output = RET>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select` error: this argument must be a function item --> $DIR/const-eval-select-bad.rs:10:31 @@ -62,9 +59,6 @@ LL | const_eval_select((), 42, 0xDEADBEEF); = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL - | -LL | G: FnOnce<ARG, Output = RET>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select` error[E0271]: expected `fn(i32) -> bool {bar}` to be a fn item that returns `i32`, but it returns `bool` --> $DIR/const-eval-select-bad.rs:32:34 @@ -76,9 +70,6 @@ LL | const_eval_select((1,), foo, bar); | note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL - | -LL | G: FnOnce<ARG, Output = RET>, - | ^^^^^^^^^^^^ required by this bound in `const_eval_select` error[E0631]: type mismatch in function arguments --> $DIR/const-eval-select-bad.rs:37:32 @@ -95,9 +86,6 @@ LL | const_eval_select((true,), foo, baz); found function signature `fn(i32) -> _` note: required by a bound in `const_eval_select` --> $SRC_DIR/core/src/intrinsics.rs:LL:COL - | -LL | F: FnOnce<ARG, Output = RET>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select` error: this argument must be a `const fn` --> $DIR/const-eval-select-bad.rs:42:29 diff --git a/src/test/ui/invalid/invalid-no-sanitize.stderr b/src/test/ui/invalid/invalid-no-sanitize.stderr index d328cafa00b..4600034952b 100644 --- a/src/test/ui/invalid/invalid-no-sanitize.stderr +++ b/src/test/ui/invalid/invalid-no-sanitize.stderr @@ -4,7 +4,7 @@ error: invalid argument for `no_sanitize` LL | #[no_sanitize(brontosaurus)] | ^^^^^^^^^^^^ | - = note: expected one of: `address`, `cfi`, `hwaddress`, `memory`, `memtag`, `shadow-call-stack`, or `thread` + = note: expected one of: `address`, `cfi`, `hwaddress`, `kcfi`, `memory`, `memtag`, `shadow-call-stack`, or `thread` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-105330.rs b/src/test/ui/issues/issue-105330.rs new file mode 100644 index 00000000000..86e45f10b0e --- /dev/null +++ b/src/test/ui/issues/issue-105330.rs @@ -0,0 +1,21 @@ +pub trait TraitWAssocConst { + const A: usize; +} +pub struct Demo {} + +impl TraitWAssocConst for impl Demo { //~ ERROR E0404 + //~^ ERROR E0562 + pubconst A: str = 32; //~ ERROR expected one of +} + +fn foo<A: TraitWAssocConst<A=32>>() { //~ ERROR E0658 + foo::<Demo>()(); //~ ERROR E0271 + //~^ ERROR E0618 + //~| ERROR E0277 +} + +fn main<A: TraitWAssocConst<A=32>>() { //~ ERROR E0131 + //~^ ERROR E0658 + foo::<Demo>(); //~ ERROR E0277 + //~^ ERROR E0271 +} diff --git a/src/test/ui/issues/issue-105330.stderr b/src/test/ui/issues/issue-105330.stderr new file mode 100644 index 00000000000..92f2ccb6544 --- /dev/null +++ b/src/test/ui/issues/issue-105330.stderr @@ -0,0 +1,109 @@ +error: expected one of `!` or `::`, found `A` + --> $DIR/issue-105330.rs:8:14 + | +LL | impl TraitWAssocConst for impl Demo { + | - while parsing this item list starting here +LL | +LL | pubconst A: str = 32; + | ^ expected one of `!` or `::` +LL | } + | - the item list ends here + +error[E0404]: expected trait, found struct `Demo` + --> $DIR/issue-105330.rs:6:32 + | +LL | impl TraitWAssocConst for impl Demo { + | ^^^^ not a trait + +error[E0658]: associated const equality is incomplete + --> $DIR/issue-105330.rs:11:28 + | +LL | fn foo<A: TraitWAssocConst<A=32>>() { + | ^^^^ + | + = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information + = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable + +error[E0658]: associated const equality is incomplete + --> $DIR/issue-105330.rs:17:29 + | +LL | fn main<A: TraitWAssocConst<A=32>>() { + | ^^^^ + | + = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information + = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable + +error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in type + --> $DIR/issue-105330.rs:6:27 + | +LL | impl TraitWAssocConst for impl Demo { + | ^^^^^^^^^ + +error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied + --> $DIR/issue-105330.rs:12:11 + | +LL | foo::<Demo>()(); + | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo` + | +note: required by a bound in `foo` + --> $DIR/issue-105330.rs:11:11 + | +LL | fn foo<A: TraitWAssocConst<A=32>>() { + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` + +error[E0271]: type mismatch resolving `<Demo as TraitWAssocConst>::A == 32` + --> $DIR/issue-105330.rs:12:11 + | +LL | foo::<Demo>()(); + | ^^^^ types differ + | +note: required by a bound in `foo` + --> $DIR/issue-105330.rs:11:28 + | +LL | fn foo<A: TraitWAssocConst<A=32>>() { + | ^^^^ required by this bound in `foo` + +error[E0618]: expected function, found `()` + --> $DIR/issue-105330.rs:12:5 + | +LL | fn foo<A: TraitWAssocConst<A=32>>() { + | ----------------------------------- `foo::<Demo>` defined here returns `()` +LL | foo::<Demo>()(); + | ^^^^^^^^^^^^^-- + | | + | call expression requires function + +error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied + --> $DIR/issue-105330.rs:19:11 + | +LL | foo::<Demo>(); + | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo` + | +note: required by a bound in `foo` + --> $DIR/issue-105330.rs:11:11 + | +LL | fn foo<A: TraitWAssocConst<A=32>>() { + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` + +error[E0271]: type mismatch resolving `<Demo as TraitWAssocConst>::A == 32` + --> $DIR/issue-105330.rs:19:11 + | +LL | foo::<Demo>(); + | ^^^^ types differ + | +note: required by a bound in `foo` + --> $DIR/issue-105330.rs:11:28 + | +LL | fn foo<A: TraitWAssocConst<A=32>>() { + | ^^^^ required by this bound in `foo` + +error[E0131]: `main` function is not allowed to have generic parameters + --> $DIR/issue-105330.rs:17:8 + | +LL | fn main<A: TraitWAssocConst<A=32>>() { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` cannot have generic parameters + +error: aborting due to 11 previous errors + +Some errors have detailed explanations: E0131, E0271, E0277, E0404, E0562, E0618, E0658. +For more information about an error, try `rustc --explain E0131`. diff --git a/src/test/ui/issues/issue-12567.stderr b/src/test/ui/issues/issue-12567.stderr index 3ce659ccd14..7fa06825f0f 100644 --- a/src/test/ui/issues/issue-12567.stderr +++ b/src/test/ui/issues/issue-12567.stderr @@ -11,6 +11,14 @@ LL | (&[hd1, ..], &[hd2, ..]) | --- ...and here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider borrowing the pattern binding + | +LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[]) + | +++ +help: consider borrowing the pattern binding + | +LL | (&[ref hd1, ..], &[hd2, ..]) + | +++ error[E0508]: cannot move out of type `[T]`, a non-copy slice --> $DIR/issue-12567.rs:2:11 @@ -25,6 +33,14 @@ LL | (&[hd1, ..], &[hd2, ..]) | --- ...and here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider borrowing the pattern binding + | +LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[]) + | +++ +help: consider borrowing the pattern binding + | +LL | (&[hd1, ..], &[ref hd2, ..]) + | +++ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-14091-2.stderr b/src/test/ui/issues/issue-14091-2.stderr index a191afd7980..f8375d4ef90 100644 --- a/src/test/ui/issues/issue-14091-2.stderr +++ b/src/test/ui/issues/issue-14091-2.stderr @@ -9,11 +9,8 @@ note: an implementation of `Not` might be missing for `BytePos` | LL | pub struct BytePos(pub u32); | ^^^^^^^^^^^^^^^^^^ must implement `Not` -note: the following trait must be implemented +note: the trait `Not` must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | pub trait Not { - | ^^^^^^^^^^^^^ = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14092.stderr b/src/test/ui/issues/issue-14092.stderr index 7928b3fba27..132e2b101a5 100644 --- a/src/test/ui/issues/issue-14092.stderr +++ b/src/test/ui/issues/issue-14092.stderr @@ -4,13 +4,6 @@ error[E0107]: missing generics for struct `Box` LL | fn fn1(0: Box) {} | ^^^ expected at least 1 generic argument | -note: struct defined here, with at least 1 generic parameter: `T` - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - | -LL | pub struct Box< - | ^^^ -LL | T: ?Sized, - | - help: add missing generic argument | LL | fn fn1(0: Box<T>) {} diff --git a/src/test/ui/issues/issue-16966.stderr b/src/test/ui/issues/issue-16966.stderr index 8524a62a0a4..60f5190dbd0 100644 --- a/src/test/ui/issues/issue-16966.stderr +++ b/src/test/ui/issues/issue-16966.stderr @@ -5,11 +5,6 @@ LL | panic!(std::default::Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `M` declared on the function `begin_panic` | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) -help: consider specifying the generic argument - --> $SRC_DIR/std/src/panic.rs:LL:COL - | -LL | $crate::rt::begin_panic::<M>($msg) - | +++++ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17546.stderr b/src/test/ui/issues/issue-17546.stderr index 16678c8c8a9..81592320a27 100644 --- a/src/test/ui/issues/issue-17546.stderr +++ b/src/test/ui/issues/issue-17546.stderr @@ -3,11 +3,9 @@ error[E0573]: expected type, found variant `NoResult` | LL | fn new() -> NoResult<MyEnum, String> { | ^^^^^^^^^^^^^^^^^^^^^^^^ + --> $SRC_DIR/core/src/result.rs:LL:COL | - ::: $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | --------------------- similarly named enum `Result` defined here + = note: similarly named enum `Result` defined here | help: try using the variant's enum | @@ -57,11 +55,9 @@ error[E0573]: expected type, found variant `NoResult` | LL | fn newer() -> NoResult<foo::MyEnum, String> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + --> $SRC_DIR/core/src/result.rs:LL:COL | - ::: $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | --------------------- similarly named enum `Result` defined here + = note: similarly named enum `Result` defined here | help: try using the variant's enum | diff --git a/src/test/ui/issues/issue-17651.stderr b/src/test/ui/issues/issue-17651.stderr index efaaeeda2fa..b37811e1955 100644 --- a/src/test/ui/issues/issue-17651.stderr +++ b/src/test/ui/issues/issue-17651.stderr @@ -9,9 +9,6 @@ LL | (|| Box::new(*(&[0][..])))(); = help: the trait `Sized` is not implemented for `[{integer}]` note: required by a bound in `Box::<T>::new` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - | -LL | impl<T> Box<T> { - | ^ required by this bound in `Box::<T>::new` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18159.stderr b/src/test/ui/issues/issue-18159.stderr index 605ff3829d1..5e0589eed43 100644 --- a/src/test/ui/issues/issue-18159.stderr +++ b/src/test/ui/issues/issue-18159.stderr @@ -6,8 +6,8 @@ LL | let x; | help: consider giving `x` an explicit type | -LL | let x: _; - | +++ +LL | let x: /* Type */; + | ++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18423.stderr b/src/test/ui/issues/issue-18423.stderr index 4711a3f3ce0..bbf79366244 100644 --- a/src/test/ui/issues/issue-18423.stderr +++ b/src/test/ui/issues/issue-18423.stderr @@ -5,12 +5,6 @@ LL | x: Box<'a, isize> | ^^^ -- help: remove this lifetime argument | | | expected 0 lifetime arguments - | -note: struct defined here, with 0 lifetime parameters - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - | -LL | pub struct Box< - | ^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20162.stderr b/src/test/ui/issues/issue-20162.stderr index 3f9b3be9851..1c5b76fbfc1 100644 --- a/src/test/ui/issues/issue-20162.stderr +++ b/src/test/ui/issues/issue-20162.stderr @@ -1,16 +1,11 @@ error[E0277]: the trait bound `X: Ord` is not satisfied - --> $DIR/issue-20162.rs:5:5 + --> $DIR/issue-20162.rs:5:7 | LL | b.sort(); - | ^ ---- required by a bound introduced by this call - | | - | the trait `Ord` is not implemented for `X` + | ^^^^ the trait `Ord` is not implemented for `X` | note: required by a bound in `slice::<impl [T]>::sort` --> $SRC_DIR/alloc/src/slice.rs:LL:COL - | -LL | T: Ord, - | ^^^ required by this bound in `slice::<impl [T]>::sort` help: consider annotating `X` with `#[derive(Ord)]` | LL | #[derive(Ord)] diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index 91509ceace8..78df445972c 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -14,7 +14,7 @@ LL | impl<T> Foo for T where NoData<T>: Foo { | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) -note: required for `NoData<NoData<NoData<NoData<NoData<NoData<...>>>>>>` to implement `Foo` +note: required for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<...>>>>>>>>>>>>>` to implement `Foo` --> $DIR/issue-20413.rs:9:9 | LL | impl<T> Foo for T where NoData<T>: Foo { @@ -30,13 +30,13 @@ LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) -note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<...>>>>>>` to implement `Bar` +note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<...>>>>>>>` to implement `Bar` --> $DIR/issue-20413.rs:28:9 | LL | impl<T> Bar for T where EvenLessData<T>: Baz { | ^^^ ^ = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' -note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<...>>>>>>` to implement `Baz` +note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<...>>>>>>>` to implement `Baz` --> $DIR/issue-20413.rs:35:9 | LL | impl<T> Baz for T where AlmostNoData<T>: Bar { @@ -52,13 +52,13 @@ LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_20413`) -note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<...>>>>>>` to implement `Baz` +note: required for `EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<...>>>>>>>` to implement `Baz` --> $DIR/issue-20413.rs:35:9 | LL | impl<T> Baz for T where AlmostNoData<T>: Bar { | ^^^ ^ = note: the full type name has been written to '$TEST_BUILD_DIR/issues/issue-20413/issue-20413.long-type-hash.txt' -note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<...>>>>>>` to implement `Bar` +note: required for `AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<EvenLessData<AlmostNoData<...>>>>>>>` to implement `Bar` --> $DIR/issue-20413.rs:28:9 | LL | impl<T> Bar for T where EvenLessData<T>: Baz { diff --git a/src/test/ui/issues/issue-20433.stderr b/src/test/ui/issues/issue-20433.stderr index 9d3bb8b924d..3ae952546a6 100644 --- a/src/test/ui/issues/issue-20433.stderr +++ b/src/test/ui/issues/issue-20433.stderr @@ -7,9 +7,6 @@ LL | fn iceman(c: Vec<[i32]>) {} = help: the trait `Sized` is not implemented for `[i32]` note: required by a bound in `Vec` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | ^ required by this bound in `Vec` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2151.stderr b/src/test/ui/issues/issue-2151.stderr index 31a8ca5fbfa..c75038b6169 100644 --- a/src/test/ui/issues/issue-2151.stderr +++ b/src/test/ui/issues/issue-2151.stderr @@ -8,8 +8,8 @@ LL | x.clone(); | help: consider giving `x` an explicit type | -LL | let x: _ = panic!(); - | +++ +LL | let x: /* Type */ = panic!(); + | ++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23024.stderr b/src/test/ui/issues/issue-23024.stderr index dc8b34a70c3..014eb2897b4 100644 --- a/src/test/ui/issues/issue-23024.stderr +++ b/src/test/ui/issues/issue-23024.stderr @@ -13,11 +13,6 @@ error[E0107]: missing generics for trait `Fn` LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3)); | ^^ expected 1 generic argument | -note: trait defined here, with 1 generic parameter: `Args` - --> $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait Fn<Args: Tuple>: FnMut<Args> { - | ^^ ---- help: add missing generic argument | LL | println!("{:?}",(vfnfer[0] as dyn Fn<Args>)(3)); diff --git a/src/test/ui/issues/issue-23122-2.stderr b/src/test/ui/issues/issue-23122-2.stderr index 5828e027b59..1f50b06a0e4 100644 --- a/src/test/ui/issues/issue-23122-2.stderr +++ b/src/test/ui/issues/issue-23122-2.stderr @@ -5,7 +5,7 @@ LL | type Next = <GetNext<T::Next> as Next>::Next; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_23122_2`) -note: required for `GetNext<<<<<<... as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` to implement `Next` +note: required for `GetNext<<<<<<<... as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` to implement `Next` --> $DIR/issue-23122-2.rs:10:15 | LL | impl<T: Next> Next for GetNext<T> { diff --git a/src/test/ui/issues/issue-23966.stderr b/src/test/ui/issues/issue-23966.stderr index ae8233d5c76..8f934481d85 100644 --- a/src/test/ui/issues/issue-23966.stderr +++ b/src/test/ui/issues/issue-23966.stderr @@ -9,9 +9,6 @@ LL | "".chars().fold(|_, _| (), ()); = help: the trait `FnMut<(_, char)>` is not implemented for `()` note: required by a bound in `fold` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | F: FnMut(B, Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `fold` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-24036.stderr b/src/test/ui/issues/issue-24036.stderr index a42e35c4cad..0e73a51faed 100644 --- a/src/test/ui/issues/issue-24036.stderr +++ b/src/test/ui/issues/issue-24036.stderr @@ -19,8 +19,8 @@ LL | 1 => |c| c + 1, | help: consider giving this closure parameter an explicit type | -LL | 1 => |c: _| c + 1, - | +++ +LL | 1 => |c: /* Type */| c + 1, + | ++++++++++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-24352.stderr b/src/test/ui/issues/issue-24352.stderr index 118f37f6971..1f51b6e2905 100644 --- a/src/test/ui/issues/issue-24352.stderr +++ b/src/test/ui/issues/issue-24352.stderr @@ -6,15 +6,10 @@ LL | 1.0f64 - 1 | = help: the trait `Sub<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Sub<Rhs>`: - <&'a f32 as Sub<f32>> <&'a f64 as Sub<f64>> - <&'a i128 as Sub<i128>> - <&'a i16 as Sub<i16>> - <&'a i32 as Sub<i32>> - <&'a i64 as Sub<i64>> - <&'a i8 as Sub<i8>> - <&'a isize as Sub<isize>> - and 48 others + <&f64 as Sub<&f64>> + <f64 as Sub<&f64>> + <f64 as Sub> help: consider using a floating-point literal by writing it with `.0` | LL | 1.0f64 - 1.0 diff --git a/src/test/ui/issues/issue-27033.stderr b/src/test/ui/issues/issue-27033.stderr index 9a38d49cd0c..7a0ca888d74 100644 --- a/src/test/ui/issues/issue-27033.stderr +++ b/src/test/ui/issues/issue-27033.stderr @@ -3,11 +3,9 @@ error[E0530]: match bindings cannot shadow unit variants | LL | None @ _ => {} | ^^^^ cannot be named the same as a unit variant + --> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | - ::: $SRC_DIR/std/src/prelude/mod.rs:LL:COL - | -LL | pub use super::v1::*; - | ------------ the unit variant `None` is defined here + = note: the unit variant `None` is defined here error[E0530]: match bindings cannot shadow constants --> $DIR/issue-27033.rs:7:9 diff --git a/src/test/ui/issues/issue-3044.stderr b/src/test/ui/issues/issue-3044.stderr index a4c455ca192..2b142f688ec 100644 --- a/src/test/ui/issues/issue-3044.stderr +++ b/src/test/ui/issues/issue-3044.stderr @@ -9,9 +9,6 @@ LL | | }); | note: associated function defined here --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn fold<B, F>(mut self, init: B, mut f: F) -> B - | ^^^^ help: provide the argument | LL ~ needlesArr.iter().fold(|x, y| { diff --git a/src/test/ui/issues/issue-31173.rs b/src/test/ui/issues/issue-31173.rs index 04efa27189b..f678df5b42b 100644 --- a/src/test/ui/issues/issue-31173.rs +++ b/src/test/ui/issues/issue-31173.rs @@ -4,12 +4,11 @@ pub fn get_tok(it: &mut IntoIter<u8>) { let mut found_e = false; let temp: Vec<u8> = it - //~^ ERROR to be an iterator that yields `&_`, but it yields `u8` .take_while(|&x| { found_e = true; false }) - .cloned() + .cloned() //~ ERROR to be an iterator that yields `&_`, but it yields `u8` .collect(); //~ ERROR the method } diff --git a/src/test/ui/issues/issue-31173.stderr b/src/test/ui/issues/issue-31173.stderr index e3334eef3ad..b667ae0a789 100644 --- a/src/test/ui/issues/issue-31173.stderr +++ b/src/test/ui/issues/issue-31173.stderr @@ -1,46 +1,31 @@ -error[E0271]: expected `TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>` to be an iterator that yields `&_`, but it yields `u8` - --> $DIR/issue-31173.rs:6:25 +error[E0271]: expected `TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>` to be an iterator that yields `&_`, but it yields `u8` + --> $DIR/issue-31173.rs:11:10 | -LL | let temp: Vec<u8> = it - | _________________________^ -LL | | -LL | | .take_while(|&x| { -LL | | found_e = true; -LL | | false -LL | | }) - | |__________^ expected reference, found `u8` -LL | .cloned() - | ------ required by a bound introduced by this call +LL | .cloned() + | ^^^^^^ expected reference, found `u8` | = note: expected reference `&_` found type `u8` note: required by a bound in `cloned` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | Self: Sized + Iterator<Item = &'a T>, - | ^^^^^^^^^^^^ required by this bound in `cloned` -error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>`, but its trait bounds were not satisfied - --> $DIR/issue-31173.rs:13:10 +error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>`, but its trait bounds were not satisfied + --> $DIR/issue-31173.rs:12:10 | LL | .collect(); - | ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>` due to unsatisfied trait bounds - | - ::: $SRC_DIR/core/src/iter/adapters/take_while.rs:LL:COL - | -LL | pub struct TakeWhile<I, P> { - | -------------------------- doesn't satisfy `<_ as Iterator>::Item = &_` + | ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>` due to unsatisfied trait bounds + --> $SRC_DIR/core/src/iter/adapters/take_while.rs:LL:COL | - ::: $SRC_DIR/core/src/iter/adapters/cloned.rs:LL:COL + = note: doesn't satisfy `<_ as Iterator>::Item = &_` + --> $SRC_DIR/core/src/iter/adapters/cloned.rs:LL:COL | -LL | pub struct Cloned<I> { - | -------------------- doesn't satisfy `_: Iterator` + = note: doesn't satisfy `_: Iterator` | = note: the following trait bounds were not satisfied: - `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]> as Iterator>::Item = &_` - which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator` - `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator` - which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator` + `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]> as Iterator>::Item = &_` + which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator` + `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator` + which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-32655.stderr b/src/test/ui/issues/issue-32655.stderr index 5a758c7002b..b8362499b2d 100644 --- a/src/test/ui/issues/issue-32655.stderr +++ b/src/test/ui/issues/issue-32655.stderr @@ -6,11 +6,9 @@ LL | #[derive_Clone] ... LL | foo!(); | ------ in this macro invocation + --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | - ::: $SRC_DIR/core/src/macros/mod.rs:LL:COL - | -LL | pub macro derive_const($item:item) { - | ---------------------- similarly named attribute macro `derive_const` defined here + = note: similarly named attribute macro `derive_const` defined here | = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -19,11 +17,9 @@ error: cannot find attribute `derive_Clone` in this scope | LL | #[derive_Clone] | ^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `derive_const` + --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | - ::: $SRC_DIR/core/src/macros/mod.rs:LL:COL - | -LL | pub macro derive_const($item:item) { - | ---------------------- similarly named attribute macro `derive_const` defined here + = note: similarly named attribute macro `derive_const` defined here error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr index 691b8f88f4e..49702c47658 100644 --- a/src/test/ui/issues/issue-33941.stderr +++ b/src/test/ui/issues/issue-33941.stderr @@ -1,18 +1,13 @@ error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` - --> $DIR/issue-33941.rs:6:14 + --> $DIR/issue-33941.rs:6:36 | LL | for _ in HashMap::new().iter().cloned() {} - | ^^^^^^^^^^^^^^^^^^^^^ ------ required by a bound introduced by this call - | | - | expected reference, found tuple + | ^^^^^^ expected reference, found tuple | = note: expected reference `&_` found tuple `(&_, &_)` note: required by a bound in `cloned` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | Self: Sized + Iterator<Item = &'a T>, - | ^^^^^^^^^^^^ required by this bound in `cloned` error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)` --> $DIR/issue-33941.rs:6:14 diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr index 72082f0cd17..9d2c315e4db 100644 --- a/src/test/ui/issues/issue-34334.stderr +++ b/src/test/ui/issues/issue-34334.stderr @@ -13,20 +13,25 @@ LL | let sr: Vec<(u32, _, _)> = vec![]; | + error[E0277]: a value of type `Vec<(u32, _, _)>` cannot be built from an iterator over elements of type `()` - --> $DIR/issue-34334.rs:5:33 + --> $DIR/issue-34334.rs:5:87 | LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call - | | - | value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>` + | ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>` | = help: the trait `FromIterator<()>` is not implemented for `Vec<(u32, _, _)>` = help: the trait `FromIterator<T>` is implemented for `Vec<T>` +note: the method call chain might not have had the expected associated types + --> $DIR/issue-34334.rs:5:43 + | +LL | let sr: Vec<(u32, _, _) = vec![]; + | ------ this expression has type `Vec<(_, _, _)>` +... +LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect(); + | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here + | | + | `Iterator::Item` is `&(_, _, _)` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn collect<B: FromIterator<Self::Item>>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-34721.stderr b/src/test/ui/issues/issue-34721.stderr index 045819061c1..f2bf22227db 100644 --- a/src/test/ui/issues/issue-34721.stderr +++ b/src/test/ui/issues/issue-34721.stderr @@ -13,7 +13,7 @@ LL | }; LL | x.zero() | ^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `x` +note: `Foo::zero` takes ownership of the receiver `self`, which moves `x` --> $DIR/issue-34721.rs:4:13 | LL | fn zero(self) -> Self; diff --git a/src/test/ui/issues/issue-35976.rs b/src/test/ui/issues/issue-35976.rs index d075794d994..aa6f74cb5d4 100644 --- a/src/test/ui/issues/issue-35976.rs +++ b/src/test/ui/issues/issue-35976.rs @@ -1,5 +1,9 @@ +// revisions: imported unimported +//[imported] check-pass + mod private { pub trait Future { + //[unimported]~^^ HELP perhaps add a `use` for it fn wait(&self) where Self: Sized; } @@ -8,13 +12,13 @@ mod private { } } -//use private::Future; +#[cfg(imported)] +use private::Future; fn bar(arg: Box<dyn private::Future>) { + // Importing the trait means that we don't autoderef `Box<dyn Future>` arg.wait(); - //~^ ERROR the `wait` method cannot be invoked on a trait object + //[unimported]~^ ERROR the `wait` method cannot be invoked on a trait object } -fn main() { - -} +fn main() {} diff --git a/src/test/ui/issues/issue-35976.stderr b/src/test/ui/issues/issue-35976.unimported.stderr index fe16f97b9d0..5d61bb8ea37 100644 --- a/src/test/ui/issues/issue-35976.stderr +++ b/src/test/ui/issues/issue-35976.unimported.stderr @@ -1,11 +1,16 @@ error: the `wait` method cannot be invoked on a trait object - --> $DIR/issue-35976.rs:14:9 + --> $DIR/issue-35976.rs:20:9 | LL | fn wait(&self) where Self: Sized; | ----- this has a `Sized` requirement ... LL | arg.wait(); | ^^^^ + | +help: another candidate was found in the following trait, perhaps add a `use` for it: + | +LL | use private::Future; + | error: aborting due to previous error diff --git a/src/test/ui/issues/issue-38857.stderr b/src/test/ui/issues/issue-38857.stderr index 23090c1ed78..4d505784b86 100644 --- a/src/test/ui/issues/issue-38857.stderr +++ b/src/test/ui/issues/issue-38857.stderr @@ -12,9 +12,6 @@ LL | let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() | note: the module `sys` is defined here --> $SRC_DIR/std/src/lib.rs:LL:COL - | -LL | mod sys; - | ^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr index 0a5a6b80e9b..e15eed65612 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr @@ -2,10 +2,12 @@ error[E0507]: cannot move out of index of `Vec<String>` --> $DIR/issue-40402-1.rs:9:13 | LL | let e = f.v[0]; - | ^^^^^^ - | | - | move occurs because value has type `String`, which does not implement the `Copy` trait - | help: consider borrowing here: `&f.v[0]` + | ^^^^^^ move occurs because value has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let e = &f.v[0]; + | + error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr index b6049f967ff..1bc554efb5c 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr @@ -2,12 +2,16 @@ error[E0507]: cannot move out of index of `Vec<(String, String)>` --> $DIR/issue-40402-2.rs:5:18 | LL | let (a, b) = x[0]; - | - - ^^^^ help: consider borrowing here: `&x[0]` + | - - ^^^^ | | | | | ...and here | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider borrowing here + | +LL | let (a, b) = &x[0]; + | + error: aborting due to previous error diff --git a/src/test/ui/issues/issue-47486.stderr b/src/test/ui/issues/issue-47486.stderr index 2bd24f08c1e..c7e9af70e64 100644 --- a/src/test/ui/issues/issue-47486.stderr +++ b/src/test/ui/issues/issue-47486.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/issue-47486.rs:2:10 | LL | () < std::mem::size_of::<_>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `usize` + | -- ^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `usize` + | | + | expected because this is `()` error[E0282]: type annotations needed --> $DIR/issue-47486.rs:3:11 diff --git a/src/test/ui/issues/issue-48364.stderr b/src/test/ui/issues/issue-48364.stderr index 7fd36676df8..da3e62e35dc 100644 --- a/src/test/ui/issues/issue-48364.stderr +++ b/src/test/ui/issues/issue-48364.stderr @@ -10,9 +10,6 @@ LL | b"".starts_with(stringify!(foo)) found reference `&'static str` note: associated function defined here --> $SRC_DIR/core/src/slice/mod.rs:LL:COL - | -LL | pub fn starts_with(&self, needle: &[T]) -> bool - | ^^^^^^^^^^^ = note: this error originates in the macro `stringify` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-51154.stderr b/src/test/ui/issues/issue-51154.stderr index 44ec626dea5..d8a833a86f5 100644 --- a/src/test/ui/issues/issue-51154.stderr +++ b/src/test/ui/issues/issue-51154.stderr @@ -13,9 +13,6 @@ LL | let _: Box<F> = Box::new(|| ()); = help: every closure has a distinct type and so could not always match the caller-chosen type of parameter `F` note: associated function defined here --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - | -LL | pub fn new(x: T) -> Self { - | ^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-5353.rs b/src/test/ui/issues/issue-5353.rs deleted file mode 100644 index 1d6813d5a39..00000000000 --- a/src/test/ui/issues/issue-5353.rs +++ /dev/null @@ -1,18 +0,0 @@ -// check-pass -#![allow(dead_code)] -// pretty-expanded FIXME #23616 - -const INVALID_ENUM : u32 = 0; -const INVALID_VALUE : u32 = 1; - -fn gl_err_str(err: u32) -> String -{ - match err - { - INVALID_ENUM => { "Invalid enum".to_string() }, - INVALID_VALUE => { "Invalid value".to_string() }, - _ => { "Unknown error".to_string() } - } -} - -pub fn main() {} diff --git a/src/test/ui/issues/issue-61108.stderr b/src/test/ui/issues/issue-61108.stderr index e5b671d7b7a..3aaf5fb3f3e 100644 --- a/src/test/ui/issues/issue-61108.stderr +++ b/src/test/ui/issues/issue-61108.stderr @@ -9,11 +9,8 @@ LL | for l in bad_letters { LL | bad_letters.push('s'); | ^^^^^^^^^^^^^^^^^^^^^ value borrowed here after move | -note: this function takes ownership of the receiver `self`, which moves `bad_letters` +note: `into_iter` takes ownership of the receiver `self`, which moves `bad_letters` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ help: consider iterating over a slice of the `Vec<char>`'s content to avoid moving into the `for` loop | LL | for l in &bad_letters { diff --git a/src/test/ui/issues/issue-64559.stderr b/src/test/ui/issues/issue-64559.stderr index ef178bbd155..386ac794d7d 100644 --- a/src/test/ui/issues/issue-64559.stderr +++ b/src/test/ui/issues/issue-64559.stderr @@ -10,11 +10,8 @@ LL | let _closure = || orig; | | | value used here after move | -note: this function takes ownership of the receiver `self`, which moves `orig` +note: `into_iter` takes ownership of the receiver `self`, which moves `orig` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ help: consider iterating over a slice of the `Vec<bool>`'s content to avoid moving into the `for` loop | LL | for _val in &orig {} diff --git a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr index 2de15037650..cec482a53ba 100644 --- a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr +++ b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr @@ -1,34 +1,39 @@ error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64` - --> $DIR/issue-66923-show-error-for-correct-call.rs:8:24 + --> $DIR/issue-66923-show-error-for-correct-call.rs:8:39 | LL | let x2: Vec<f64> = x1.into_iter().collect(); - | ^^^^^^^^^^^^^^ ------- required by a bound introduced by this call - | | - | value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>` + | ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>` | = help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>` = help: the trait `FromIterator<T>` is implemented for `Vec<T>` +note: the method call chain might not have had the expected associated types + --> $DIR/issue-66923-show-error-for-correct-call.rs:8:27 + | +LL | let x1: &[f64] = &v; + | -- this expression has type `&Vec<f64>` +LL | let x2: Vec<f64> = x1.into_iter().collect(); + | ^^^^^^^^^^^ `Iterator::Item` is `&f64` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn collect<B: FromIterator<Self::Item>>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64` - --> $DIR/issue-66923-show-error-for-correct-call.rs:12:14 + --> $DIR/issue-66923-show-error-for-correct-call.rs:12:29 | LL | let x3 = x1.into_iter().collect::<Vec<f64>>(); - | ^^^^^^^^^^^^^^ ------- required by a bound introduced by this call - | | - | value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>` + | ^^^^^^^ value of type `Vec<f64>` cannot be built from `std::iter::Iterator<Item=&f64>` | = help: the trait `FromIterator<&f64>` is not implemented for `Vec<f64>` = help: the trait `FromIterator<T>` is implemented for `Vec<T>` +note: the method call chain might not have had the expected associated types + --> $DIR/issue-66923-show-error-for-correct-call.rs:12:17 + | +LL | let x1: &[f64] = &v; + | -- this expression has type `&Vec<f64>` +... +LL | let x3 = x1.into_iter().collect::<Vec<f64>>(); + | ^^^^^^^^^^^ `Iterator::Item` is `&f64` here note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn collect<B: FromIterator<Self::Item>>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-7607-1.stderr b/src/test/ui/issues/issue-7607-1.stderr index f1ab0ad26d7..c983026995b 100644 --- a/src/test/ui/issues/issue-7607-1.stderr +++ b/src/test/ui/issues/issue-7607-1.stderr @@ -3,11 +3,9 @@ error[E0412]: cannot find type `Fo` in this scope | LL | impl Fo { | ^^ help: a trait with a similar name exists: `Fn` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait Fn<Args: Tuple>: FnMut<Args> { - | -------------------------------------- similarly named trait `Fn` defined here + = note: similarly named trait `Fn` defined here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-83924.stderr b/src/test/ui/issues/issue-83924.stderr index 767571cddbe..572414df2bf 100644 --- a/src/test/ui/issues/issue-83924.stderr +++ b/src/test/ui/issues/issue-83924.stderr @@ -10,11 +10,8 @@ LL | for n in v { LL | for n in v { | ^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `v` +note: `into_iter` takes ownership of the receiver `self`, which moves `v` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ help: consider creating a fresh reborrow of `v` here | LL | for n in &mut *v { diff --git a/src/test/ui/iterators/collect-into-array.rs b/src/test/ui/iterators/collect-into-array.rs index 4c424999b75..99d0d9bd735 100644 --- a/src/test/ui/iterators/collect-into-array.rs +++ b/src/test/ui/iterators/collect-into-array.rs @@ -3,5 +3,4 @@ fn main() { //~^ ERROR an array of type `[u32; 10]` cannot be built directly from an iterator //~| NOTE try collecting into a `Vec<{integer}>`, then using `.try_into()` //~| NOTE required by a bound in `collect` - //~| NOTE required by a bound introduced by this call } diff --git a/src/test/ui/iterators/collect-into-array.stderr b/src/test/ui/iterators/collect-into-array.stderr index a23a36a88ab..e38745cc10e 100644 --- a/src/test/ui/iterators/collect-into-array.stderr +++ b/src/test/ui/iterators/collect-into-array.stderr @@ -1,17 +1,12 @@ error[E0277]: an array of type `[u32; 10]` cannot be built directly from an iterator - --> $DIR/collect-into-array.rs:2:31 + --> $DIR/collect-into-array.rs:2:39 | LL | let whatever: [u32; 10] = (0..10).collect(); - | ^^^^^^^ ------- required by a bound introduced by this call - | | - | try collecting into a `Vec<{integer}>`, then using `.try_into()` + | ^^^^^^^ try collecting into a `Vec<{integer}>`, then using `.try_into()` | = help: the trait `FromIterator<{integer}>` is not implemented for `[u32; 10]` note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn collect<B: FromIterator<Self::Item>>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error: aborting due to previous error diff --git a/src/test/ui/iterators/collect-into-slice.rs b/src/test/ui/iterators/collect-into-slice.rs index 09832c260d0..5a8aacb1a6d 100644 --- a/src/test/ui/iterators/collect-into-slice.rs +++ b/src/test/ui/iterators/collect-into-slice.rs @@ -13,6 +13,5 @@ fn main() { //~| NOTE all local variables must have a statically known size //~| NOTE doesn't have a size known at compile-time //~| NOTE doesn't have a size known at compile-time - //~| NOTE required by a bound introduced by this call process_slice(&some_generated_vec); } diff --git a/src/test/ui/iterators/collect-into-slice.stderr b/src/test/ui/iterators/collect-into-slice.stderr index bc152467ce3..29fff8c51c6 100644 --- a/src/test/ui/iterators/collect-into-slice.stderr +++ b/src/test/ui/iterators/collect-into-slice.stderr @@ -17,24 +17,16 @@ LL | let some_generated_vec = (0..10).collect(); = help: the trait `Sized` is not implemented for `[i32]` note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn collect<B: FromIterator<Self::Item>>(self) -> B - | ^ required by this bound in `collect` error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size - --> $DIR/collect-into-slice.rs:6:30 + --> $DIR/collect-into-slice.rs:6:38 | LL | let some_generated_vec = (0..10).collect(); - | ^^^^^^^ ------- required by a bound introduced by this call - | | - | try explicitly collecting into a `Vec<{integer}>` + | ^^^^^^^ try explicitly collecting into a `Vec<{integer}>` | = help: the trait `FromIterator<{integer}>` is not implemented for `[i32]` note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn collect<B: FromIterator<Self::Item>>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error: aborting due to 3 previous errors diff --git a/src/test/ui/iterators/invalid-iterator-chain.rs b/src/test/ui/iterators/invalid-iterator-chain.rs new file mode 100644 index 00000000000..87116e49245 --- /dev/null +++ b/src/test/ui/iterators/invalid-iterator-chain.rs @@ -0,0 +1,41 @@ +fn main() { + let scores = vec![(0, 0)] + .iter() + .map(|(a, b)| { + a + b; + }); + println!("{}", scores.sum::<i32>()); //~ ERROR E0277 + println!( + "{}", + vec![0, 1] + .iter() + .map(|x| x * 2) + .map(|x| x as f64) + .map(|x| x as i64) + .filter(|x| *x > 0) + .map(|x| { x + 1 }) + .map(|x| { x; }) + .sum::<i32>(), //~ ERROR E0277 + ); + println!( + "{}", + vec![0, 1] + .iter() + .map(|x| x * 2) + .map(|x| x as f64) + .filter(|x| *x > 0.0) + .map(|x| { x + 1.0 }) + .sum::<i32>(), //~ ERROR E0277 + ); + println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>()); //~ ERROR E0277 + println!("{}", vec![(), ()].iter().sum::<i32>()); //~ ERROR E0277 + let a = vec![0]; + let b = a.into_iter(); + let c = b.map(|x| x + 1); + let d = c.filter(|x| *x > 10 ); + let e = d.map(|x| { + x + 1; + }); + let f = e.filter(|_| false); + let g: Vec<i32> = f.collect(); //~ ERROR E0277 +} diff --git a/src/test/ui/iterators/invalid-iterator-chain.stderr b/src/test/ui/iterators/invalid-iterator-chain.stderr new file mode 100644 index 00000000000..84bac7833f6 --- /dev/null +++ b/src/test/ui/iterators/invalid-iterator-chain.stderr @@ -0,0 +1,158 @@ +error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()` + --> $DIR/invalid-iterator-chain.rs:7:27 + | +LL | println!("{}", scores.sum::<i32>()); + | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>` + | + = help: the trait `Sum<()>` is not implemented for `i32` + = help: the following other types implement trait `Sum<A>`: + <i32 as Sum<&'a i32>> + <i32 as Sum> +note: the method call chain might not have had the expected associated types + --> $DIR/invalid-iterator-chain.rs:4:10 + | +LL | let scores = vec![(0, 0)] + | ------------ this expression has type `Vec<({integer}, {integer})>` +LL | .iter() + | ------ `Iterator::Item` is `&({integer}, {integer})` here +LL | .map(|(a, b)| { + | __________^ +LL | | a + b; +LL | | }); + | |__________^ `Iterator::Item` changed to `()` here +note: required by a bound in `std::iter::Iterator::sum` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()` + --> $DIR/invalid-iterator-chain.rs:18:14 + | +LL | .sum::<i32>(), + | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>` + | + = help: the trait `Sum<()>` is not implemented for `i32` + = help: the following other types implement trait `Sum<A>`: + <i32 as Sum<&'a i32>> + <i32 as Sum> +note: the method call chain might not have had the expected associated types + --> $DIR/invalid-iterator-chain.rs:12:14 + | +LL | vec![0, 1] + | ---------- this expression has type `Vec<{integer}>` +LL | .iter() + | ------ `Iterator::Item` is `&{integer}` here +LL | .map(|x| x * 2) + | ^^^^^^^^^^^^^^ `Iterator::Item` changed to `{integer}` here +LL | .map(|x| x as f64) + | ----------------- `Iterator::Item` changed to `f64` here +LL | .map(|x| x as i64) + | ----------------- `Iterator::Item` changed to `i64` here +LL | .filter(|x| *x > 0) + | ------------------ `Iterator::Item` remains `i64` here +LL | .map(|x| { x + 1 }) + | ------------------ `Iterator::Item` remains `i64` here +LL | .map(|x| { x; }) + | ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here +note: required by a bound in `std::iter::Iterator::sum` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `f64` + --> $DIR/invalid-iterator-chain.rs:28:14 + | +LL | .sum::<i32>(), + | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=f64>` + | + = help: the trait `Sum<f64>` is not implemented for `i32` + = help: the following other types implement trait `Sum<A>`: + <i32 as Sum<&'a i32>> + <i32 as Sum> +note: the method call chain might not have had the expected associated types + --> $DIR/invalid-iterator-chain.rs:24:14 + | +LL | vec![0, 1] + | ---------- this expression has type `Vec<{integer}>` +LL | .iter() + | ------ `Iterator::Item` is `&{integer}` here +LL | .map(|x| x * 2) + | ^^^^^^^^^^^^^^ `Iterator::Item` changed to `{integer}` here +LL | .map(|x| x as f64) + | ^^^^^^^^^^^^^^^^^ `Iterator::Item` changed to `f64` here +LL | .filter(|x| *x > 0.0) + | -------------------- `Iterator::Item` remains `f64` here +LL | .map(|x| { x + 1.0 }) + | -------------------- `Iterator::Item` remains `f64` here +note: required by a bound in `std::iter::Iterator::sum` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()` + --> $DIR/invalid-iterator-chain.rs:30:54 + | +LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>()); + | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=()>` + | + = help: the trait `Sum<()>` is not implemented for `i32` + = help: the following other types implement trait `Sum<A>`: + <i32 as Sum<&'a i32>> + <i32 as Sum> +note: the method call chain might not have had the expected associated types + --> $DIR/invalid-iterator-chain.rs:30:38 + | +LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>()); + | ---------- ------ ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here + | | | + | | `Iterator::Item` is `&{integer}` here + | this expression has type `Vec<{integer}>` +note: required by a bound in `std::iter::Iterator::sum` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()` + --> $DIR/invalid-iterator-chain.rs:31:40 + | +LL | println!("{}", vec![(), ()].iter().sum::<i32>()); + | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>` + | + = help: the trait `Sum<&()>` is not implemented for `i32` + = help: the following other types implement trait `Sum<A>`: + <i32 as Sum<&'a i32>> + <i32 as Sum> +note: the method call chain might not have had the expected associated types + --> $DIR/invalid-iterator-chain.rs:31:33 + | +LL | println!("{}", vec![(), ()].iter().sum::<i32>()); + | ------------ ^^^^^^ `Iterator::Item` is `&()` here + | | + | this expression has type `Vec<()>` +note: required by a bound in `std::iter::Iterator::sum` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error[E0277]: a value of type `Vec<i32>` cannot be built from an iterator over elements of type `()` + --> $DIR/invalid-iterator-chain.rs:40:25 + | +LL | let g: Vec<i32> = f.collect(); + | ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=()>` + | + = help: the trait `FromIterator<()>` is not implemented for `Vec<i32>` + = help: the trait `FromIterator<T>` is implemented for `Vec<T>` +note: the method call chain might not have had the expected associated types + --> $DIR/invalid-iterator-chain.rs:36:15 + | +LL | let a = vec![0]; + | ------- this expression has type `Vec<{integer}>` +LL | let b = a.into_iter(); + | ----------- `Iterator::Item` is `{integer}` here +LL | let c = b.map(|x| x + 1); + | -------------- `Iterator::Item` remains `{integer}` here +LL | let d = c.filter(|x| *x > 10 ); + | -------------------- `Iterator::Item` remains `{integer}` here +LL | let e = d.map(|x| { + | _______________^ +LL | | x + 1; +LL | | }); + | |______^ `Iterator::Item` changed to `()` here +LL | let f = e.filter(|_| false); + | ----------------- `Iterator::Item` remains `()` here +note: required by a bound in `collect` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/iterators/vec-on-unimplemented.stderr b/src/test/ui/iterators/vec-on-unimplemented.stderr index afcce5c30ca..a7d9c481a1a 100644 --- a/src/test/ui/iterators/vec-on-unimplemented.stderr +++ b/src/test/ui/iterators/vec-on-unimplemented.stderr @@ -3,11 +3,9 @@ error[E0599]: `Vec<bool>` is not an iterator | LL | vec![true, false].map(|v| !v).collect::<Vec<_>>(); | ^^^ `Vec<bool>` is not an iterator; try calling `.into_iter()` or `.iter()` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | - ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | ------------------------------------------------------------------------------------------------ doesn't satisfy `Vec<bool>: Iterator` + = note: doesn't satisfy `Vec<bool>: Iterator` | = note: the following trait bounds were not satisfied: `Vec<bool>: Iterator` diff --git a/src/test/ui/kindck/kindck-copy.stderr b/src/test/ui/kindck/kindck-copy.stderr index 025a5008d0f..9af89159a8c 100644 --- a/src/test/ui/kindck/kindck-copy.stderr +++ b/src/test/ui/kindck/kindck-copy.stderr @@ -4,16 +4,7 @@ error[E0277]: the trait bound `&'static mut isize: Copy` is not satisfied LL | assert_copy::<&'static mut isize>(); | ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'static mut isize` | - = help: the following other types implement trait `Copy`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize - and 6 others + = help: the trait `Copy` is implemented for `isize` note: required by a bound in `assert_copy` --> $DIR/kindck-copy.rs:5:18 | @@ -26,16 +17,7 @@ error[E0277]: the trait bound `&'a mut isize: Copy` is not satisfied LL | assert_copy::<&'a mut isize>(); | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'a mut isize` | - = help: the following other types implement trait `Copy`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize - and 6 others + = help: the trait `Copy` is implemented for `isize` note: required by a bound in `assert_copy` --> $DIR/kindck-copy.rs:5:18 | diff --git a/src/test/ui/lazy-type-alias-impl-trait/branches.stderr b/src/test/ui/lazy-type-alias-impl-trait/branches.stderr index 33f82448dd2..0b206f31e7b 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/branches.stderr +++ b/src/test/ui/lazy-type-alias-impl-trait/branches.stderr @@ -1,17 +1,12 @@ error[E0277]: a value of type `Bar` cannot be built from an iterator over elements of type `_` - --> $DIR/branches.rs:19:9 + --> $DIR/branches.rs:19:28 | LL | std::iter::empty().collect() - | ^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call - | | - | value of type `Bar` cannot be built from `std::iter::Iterator<Item=_>` + | ^^^^^^^ value of type `Bar` cannot be built from `std::iter::Iterator<Item=_>` | = help: the trait `FromIterator<_>` is not implemented for `Bar` note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn collect<B: FromIterator<Self::Item>>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error: aborting due to previous error diff --git a/src/test/ui/lazy-type-alias-impl-trait/branches3.stderr b/src/test/ui/lazy-type-alias-impl-trait/branches3.stderr index 420104e526d..fe2631f9474 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/branches3.stderr +++ b/src/test/ui/lazy-type-alias-impl-trait/branches3.stderr @@ -6,8 +6,8 @@ LL | |s| s.len() | help: consider giving this closure parameter an explicit type | -LL | |s: _| s.len() - | +++ +LL | |s: /* Type */| s.len() + | ++++++++++++ error[E0282]: type annotations needed --> $DIR/branches3.rs:15:10 @@ -17,8 +17,8 @@ LL | |s| s.len() | help: consider giving this closure parameter an explicit type | -LL | |s: _| s.len() - | +++ +LL | |s: /* Type */| s.len() + | ++++++++++++ error[E0282]: type annotations needed --> $DIR/branches3.rs:23:10 @@ -28,8 +28,8 @@ LL | |s| s.len() | help: consider giving this closure parameter an explicit type | -LL | |s: _| s.len() - | +++ +LL | |s: /* Type */| s.len() + | ++++++++++++ error[E0282]: type annotations needed --> $DIR/branches3.rs:30:10 @@ -39,8 +39,8 @@ LL | |s| s.len() | help: consider giving this closure parameter an explicit type | -LL | |s: _| s.len() - | +++ +LL | |s: /* Type */| s.len() + | ++++++++++++ error: aborting due to 4 previous errors diff --git a/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr b/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr index 57978edf2bf..d8ac39a4f27 100644 --- a/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr +++ b/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr @@ -1,32 +1,22 @@ error[E0277]: a value of type `Foo` cannot be built from an iterator over elements of type `_` - --> $DIR/recursion4.rs:10:9 + --> $DIR/recursion4.rs:10:28 | LL | x = std::iter::empty().collect(); - | ^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call - | | - | value of type `Foo` cannot be built from `std::iter::Iterator<Item=_>` + | ^^^^^^^ value of type `Foo` cannot be built from `std::iter::Iterator<Item=_>` | = help: the trait `FromIterator<_>` is not implemented for `Foo` note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn collect<B: FromIterator<Self::Item>>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error[E0277]: a value of type `impl Debug` cannot be built from an iterator over elements of type `_` - --> $DIR/recursion4.rs:19:9 + --> $DIR/recursion4.rs:19:28 | LL | x = std::iter::empty().collect(); - | ^^^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call - | | - | value of type `impl Debug` cannot be built from `std::iter::Iterator<Item=_>` + | ^^^^^^^ value of type `impl Debug` cannot be built from `std::iter::Iterator<Item=_>` | = help: the trait `FromIterator<_>` is not implemented for `impl Debug` note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn collect<B: FromIterator<Self::Item>>(self) -> B - | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `collect` error: aborting due to 2 previous errors diff --git a/src/test/ui/let-else/let-else-deref-coercion.stderr b/src/test/ui/let-else/let-else-deref-coercion.stderr index addcd798f4f..bf78a079cdf 100644 --- a/src/test/ui/let-else/let-else-deref-coercion.stderr +++ b/src/test/ui/let-else/let-else-deref-coercion.stderr @@ -12,7 +12,7 @@ error[E0308]: mismatched types LL | let Bar(z) = x; | ^^^^^^ - this expression has type `&mut irrefutable::Foo` | | - | expected struct `irrefutable::Foo`, found struct `irrefutable::Bar` + | expected struct `Foo`, found struct `Bar` error: aborting due to 2 previous errors diff --git a/src/test/ui/lexer/lex-bad-char-literals-6.stderr b/src/test/ui/lexer/lex-bad-char-literals-6.stderr index afef0cb6034..ce41942467c 100644 --- a/src/test/ui/lexer/lex-bad-char-literals-6.stderr +++ b/src/test/ui/lexer/lex-bad-char-literals-6.stderr @@ -42,12 +42,11 @@ LL | if x == y {} <&'a str as PartialEq<OsString>> <&'a str as PartialEq<String>> <&'b str as PartialEq<Cow<'a, str>>> - <String as PartialEq<&'a str>> - <String as PartialEq<Cow<'a, str>>> - <String as PartialEq<str>> - <String as PartialEq> <str as PartialEq<Cow<'a, str>>> - and 4 others + <str as PartialEq<OsStr>> + <str as PartialEq<OsString>> + <str as PartialEq<String>> + <str as PartialEq> error[E0308]: mismatched types --> $DIR/lex-bad-char-literals-6.rs:15:20 @@ -68,12 +67,11 @@ LL | if x == z {} <&'a str as PartialEq<OsString>> <&'a str as PartialEq<String>> <&'b str as PartialEq<Cow<'a, str>>> - <String as PartialEq<&'a str>> - <String as PartialEq<Cow<'a, str>>> - <String as PartialEq<str>> - <String as PartialEq> <str as PartialEq<Cow<'a, str>>> - and 4 others + <str as PartialEq<OsStr>> + <str as PartialEq<OsString>> + <str as PartialEq<String>> + <str as PartialEq> error: aborting due to 6 previous errors diff --git a/src/test/ui/lifetimes/issue-34979.stderr b/src/test/ui/lifetimes/issue-34979.stderr index 5832c4d173c..a332c6547b8 100644 --- a/src/test/ui/lifetimes/issue-34979.stderr +++ b/src/test/ui/lifetimes/issue-34979.stderr @@ -5,6 +5,7 @@ LL | &'a (): Foo, | ^^^ | = note: cannot satisfy `&'a (): Foo` + = help: the trait `Foo` is implemented for `&'a T` error: aborting due to previous error diff --git a/src/test/ui/limits/issue-55878.stderr b/src/test/ui/limits/issue-55878.stderr index e35f9f14c7e..f455dcb06f7 100644 --- a/src/test/ui/limits/issue-55878.stderr +++ b/src/test/ui/limits/issue-55878.stderr @@ -1,13 +1,13 @@ error[E0080]: values of the type `[u8; SIZE]` are too big for the current architecture --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | -LL | intrinsics::size_of::<T>() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ inside `std::mem::size_of::<[u8; SIZE]>` at $SRC_DIR/core/src/mem/mod.rs:LL:COL - | - ::: $DIR/issue-55878.rs:7:26 +note: inside `std::mem::size_of::<[u8; SIZE]>` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL +note: inside `main` + --> $DIR/issue-55878.rs:7:26 | LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); - | ---------------------------------------------- inside `main` at $DIR/issue-55878.rs:7:26 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: erroneous constant used --> $DIR/issue-55878.rs:7:26 diff --git a/src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs b/src/test/ui/linkage-attr/auxiliary/def_external.rs index 2300930e513..2300930e513 100644 --- a/src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs +++ b/src/test/ui/linkage-attr/auxiliary/def_external.rs diff --git a/src/test/ui/linkage-attr/linkage-import.rs b/src/test/ui/linkage-attr/linkage-import.rs new file mode 100644 index 00000000000..f754ddc6e08 --- /dev/null +++ b/src/test/ui/linkage-attr/linkage-import.rs @@ -0,0 +1,8 @@ +// build-pass +// aux-build:def_external.rs + +extern crate def_external as dep; + +fn main() { + println!("{:p}", &dep::EXTERN); +} diff --git a/src/test/ui/linkage-attr/linkage-requires-raw-ptr.rs b/src/test/ui/linkage-attr/linkage-requires-raw-ptr.rs deleted file mode 100644 index 93afc537f7c..00000000000 --- a/src/test/ui/linkage-attr/linkage-requires-raw-ptr.rs +++ /dev/null @@ -1,11 +0,0 @@ -// rust-lang/rust#59548: We used to ICE when trying to use a static -// with a type that violated its own `#[linkage]`. - -// build-fail -// aux-build:def_illtyped_external.rs - -extern crate def_illtyped_external as dep; - -fn main() { - println!("{:p}", &dep::EXTERN); -} diff --git a/src/test/ui/linkage-attr/linkage-requires-raw-ptr.stderr b/src/test/ui/linkage-attr/linkage-requires-raw-ptr.stderr deleted file mode 100644 index 5abbe745c6a..00000000000 --- a/src/test/ui/linkage-attr/linkage-requires-raw-ptr.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: must have type `*const T` or `*mut T` due to `#[linkage]` attribute - --> $DIR/auxiliary/def_illtyped_external.rs:5:1 - | -LL | pub static EXTERN: u32 = 0; - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/linkage-attr/linkage2.rs b/src/test/ui/linkage-attr/linkage2.rs index a7be1985286..aa42874f7ba 100644 --- a/src/test/ui/linkage-attr/linkage2.rs +++ b/src/test/ui/linkage-attr/linkage2.rs @@ -1,16 +1,11 @@ -// FIXME https://github.com/rust-lang/rust/issues/59774 - -// build-fail -// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" -// ignore-sgx no weak linkages permitted +// check-fail #![feature(linkage)] extern "C" { #[linkage = "extern_weak"] static foo: i32; -//~^ ERROR: must have type `*const T` or `*mut T` due to `#[linkage]` attribute +//~^ ERROR: invalid type for variable with `#[linkage]` attribute } fn main() { diff --git a/src/test/ui/linkage-attr/linkage2.stderr b/src/test/ui/linkage-attr/linkage2.stderr index a6ac0aad077..7265f711fd0 100644 --- a/src/test/ui/linkage-attr/linkage2.stderr +++ b/src/test/ui/linkage-attr/linkage2.stderr @@ -1,8 +1,9 @@ -error: must have type `*const T` or `*mut T` due to `#[linkage]` attribute - --> $DIR/linkage2.rs:12:5 +error[E0791]: invalid type for variable with `#[linkage]` attribute + --> $DIR/linkage2.rs:7:5 | LL | static foo: i32; | ^^^^^^^^^^^^^^^ error: aborting due to previous error +For more information about this error, try `rustc --explain E0791`. diff --git a/src/test/ui/lint/invalid_value.stderr b/src/test/ui/lint/invalid_value.stderr index 5370660d6c1..48fd4169da7 100644 --- a/src/test/ui/lint/invalid_value.stderr +++ b/src/test/ui/lint/invalid_value.stderr @@ -604,9 +604,6 @@ LL | let _val: Result<i32, i32> = mem::uninitialized(); | note: enums with multiple inhabited variants have to be initialized to a variant --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | ^^^^^^^^^^^^^^^^^^^^^ error: the type `&i32` does not permit zero-initialization --> $DIR/invalid_value.rs:152:34 diff --git a/src/test/ui/lint/issue-104897.rs b/src/test/ui/lint/issue-104897.rs new file mode 100644 index 00000000000..5fbc658f155 --- /dev/null +++ b/src/test/ui/lint/issue-104897.rs @@ -0,0 +1,6 @@ +// error-pattern: this file contains an unclosed delimiter +// error-pattern: this file contains an unclosed delimiter +// error-pattern: this file contains an unclosed delimiter +// error-pattern: format argument must be a string literal + +fn f(){(print!(á diff --git a/src/test/ui/lint/issue-104897.stderr b/src/test/ui/lint/issue-104897.stderr new file mode 100644 index 00000000000..817a93c2f3b --- /dev/null +++ b/src/test/ui/lint/issue-104897.stderr @@ -0,0 +1,43 @@ +error: this file contains an unclosed delimiter + --> $DIR/issue-104897.rs:6:18 + | +LL | fn f(){(print!(á + | -- - ^ + | || | + | || unclosed delimiter + | |unclosed delimiter + | unclosed delimiter + +error: this file contains an unclosed delimiter + --> $DIR/issue-104897.rs:6:18 + | +LL | fn f(){(print!(á + | -- - ^ + | || | + | || unclosed delimiter + | |unclosed delimiter + | unclosed delimiter + +error: this file contains an unclosed delimiter + --> $DIR/issue-104897.rs:6:18 + | +LL | fn f(){(print!(á + | -- - ^ + | || | + | || unclosed delimiter + | |unclosed delimiter + | unclosed delimiter + +error: format argument must be a string literal + --> $DIR/issue-104897.rs:6:16 + | +LL | fn f(){(print!(á + | ^ + | +help: you might be missing a string literal to format with + | +LL | fn f(){(print!("{}", á + | +++++ + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/lint/issue-97094.interleaved.stderr b/src/test/ui/lint/issue-97094.interleaved.stderr deleted file mode 100644 index a2581658920..00000000000 --- a/src/test/ui/lint/issue-97094.interleaved.stderr +++ /dev/null @@ -1,53 +0,0 @@ -error: unknown lint: `nonex_lint_top_level` - --> $DIR/issue-97094.rs:14:26 - | -LL | #![cfg_attr(all(), allow(nonex_lint_top_level))] - | ^^^^^^^^^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/issue-97094.rs:10:9 - | -LL | #![deny(warnings)] - | ^^^^^^^^ - = note: `#[deny(unknown_lints)]` implied by `#[deny(warnings)]` - -error: lint `bare_trait_object` has been renamed to `bare_trait_objects` - --> $DIR/issue-97094.rs:16:26 - | -LL | #![cfg_attr(all(), allow(bare_trait_object))] - | ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects` - | - = note: `#[deny(renamed_and_removed_lints)]` implied by `#[deny(warnings)]` - -error: unknown lint: `nonex_lint_mod` - --> $DIR/issue-97094.rs:19:25 - | -LL | #[cfg_attr(all(), allow(nonex_lint_mod))] - | ^^^^^^^^^^^^^^ - -error: unknown lint: `nonex_lint_mod_inner` - --> $DIR/issue-97094.rs:22:30 - | -LL | #![cfg_attr(all(), allow(nonex_lint_mod_inner))] - | ^^^^^^^^^^^^^^^^^^^^ - -error: unknown lint: `nonex_lint_fn` - --> $DIR/issue-97094.rs:26:25 - | -LL | #[cfg_attr(all(), allow(nonex_lint_fn))] - | ^^^^^^^^^^^^^ - -error: unknown lint: `nonex_lint_in_macro` - --> $DIR/issue-97094.rs:37:29 - | -LL | #[cfg_attr(all(), allow(nonex_lint_in_macro))] - | ^^^^^^^^^^^^^^^^^^^ - -error: unknown lint: `nonex_lint_fn` - --> $DIR/issue-97094.rs:56:13 - | -LL | #[allow(nonex_lint_fn)] - | ^^^^^^^^^^^^^ - -error: aborting due to 7 previous errors - diff --git a/src/test/ui/lint/issue-97094.rs b/src/test/ui/lint/issue-97094.rs index aeaead1bd11..22525ca11ae 100644 --- a/src/test/ui/lint/issue-97094.rs +++ b/src/test/ui/lint/issue-97094.rs @@ -1,12 +1,3 @@ -// revisions: interleaved nointerleaved -// [nointerleaved]compile-flags: -Z no-interleave-lints - -// This test has two revisions because the logic change -// needed to make this test pass had to be adjusted -// for no-interleave-lints. Should the debug option -// be removed one day, please don't remove this -// test entirely, just remove the revision from it. - #![deny(warnings)] // Ensure that unknown lints inside cfg-attr's are linted for diff --git a/src/test/ui/lint/issue-97094.nointerleaved.stderr b/src/test/ui/lint/issue-97094.stderr index a2581658920..1a0a3eaf250 100644 --- a/src/test/ui/lint/issue-97094.nointerleaved.stderr +++ b/src/test/ui/lint/issue-97094.stderr @@ -1,18 +1,18 @@ error: unknown lint: `nonex_lint_top_level` - --> $DIR/issue-97094.rs:14:26 + --> $DIR/issue-97094.rs:5:26 | LL | #![cfg_attr(all(), allow(nonex_lint_top_level))] | ^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/issue-97094.rs:10:9 + --> $DIR/issue-97094.rs:1:9 | LL | #![deny(warnings)] | ^^^^^^^^ = note: `#[deny(unknown_lints)]` implied by `#[deny(warnings)]` error: lint `bare_trait_object` has been renamed to `bare_trait_objects` - --> $DIR/issue-97094.rs:16:26 + --> $DIR/issue-97094.rs:7:26 | LL | #![cfg_attr(all(), allow(bare_trait_object))] | ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects` @@ -20,31 +20,31 @@ LL | #![cfg_attr(all(), allow(bare_trait_object))] = note: `#[deny(renamed_and_removed_lints)]` implied by `#[deny(warnings)]` error: unknown lint: `nonex_lint_mod` - --> $DIR/issue-97094.rs:19:25 + --> $DIR/issue-97094.rs:10:25 | LL | #[cfg_attr(all(), allow(nonex_lint_mod))] | ^^^^^^^^^^^^^^ error: unknown lint: `nonex_lint_mod_inner` - --> $DIR/issue-97094.rs:22:30 + --> $DIR/issue-97094.rs:13:30 | LL | #![cfg_attr(all(), allow(nonex_lint_mod_inner))] | ^^^^^^^^^^^^^^^^^^^^ error: unknown lint: `nonex_lint_fn` - --> $DIR/issue-97094.rs:26:25 + --> $DIR/issue-97094.rs:17:25 | LL | #[cfg_attr(all(), allow(nonex_lint_fn))] | ^^^^^^^^^^^^^ error: unknown lint: `nonex_lint_in_macro` - --> $DIR/issue-97094.rs:37:29 + --> $DIR/issue-97094.rs:28:29 | LL | #[cfg_attr(all(), allow(nonex_lint_in_macro))] | ^^^^^^^^^^^^^^^^^^^ error: unknown lint: `nonex_lint_fn` - --> $DIR/issue-97094.rs:56:13 + --> $DIR/issue-97094.rs:47:13 | LL | #[allow(nonex_lint_fn)] | ^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-const-item-mutation.stderr b/src/test/ui/lint/lint-const-item-mutation.stderr index 9f4360e6763..747c38b8007 100644 --- a/src/test/ui/lint/lint-const-item-mutation.stderr +++ b/src/test/ui/lint/lint-const-item-mutation.stderr @@ -108,9 +108,6 @@ LL | VEC.push(0); = note: the mutable reference will refer to this temporary, not the original `const` item note: mutable reference created due to call to this method --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | pub fn push(&mut self, value: T) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `const` item defined here --> $DIR/lint-const-item-mutation.rs:31:1 | diff --git a/src/test/ui/lint/lint-missing-copy-implementations-allow.rs b/src/test/ui/lint/lint-missing-copy-implementations-allow.rs new file mode 100644 index 00000000000..051a905aed6 --- /dev/null +++ b/src/test/ui/lint/lint-missing-copy-implementations-allow.rs @@ -0,0 +1,35 @@ +// check-pass +#![deny(missing_copy_implementations)] + +// Don't recommend implementing Copy on something stateful like an iterator. +pub struct MyIterator { + num: u8, +} + +impl Iterator for MyIterator { + type Item = u8; + + fn next(&mut self) -> Option<Self::Item> { + todo!() + } +} + +pub struct Handle { + inner: *mut (), +} + +pub struct Handle2 { + inner: *const (), +} + +pub enum MaybeHandle { + Ptr(*mut ()), +} + +pub union UnionHandle { + ptr: *mut (), +} + +pub struct Array([u8; 2048]); + +fn main() {} diff --git a/src/test/ui/lint/unused/issue-54538-unused-parens-lint.fixed b/src/test/ui/lint/unused/issue-54538-unused-parens-lint.fixed index 0b3fe9371f7..71ebaea8ed2 100644 --- a/src/test/ui/lint/unused/issue-54538-unused-parens-lint.fixed +++ b/src/test/ui/lint/unused/issue-54538-unused-parens-lint.fixed @@ -1,6 +1,6 @@ // run-rustfix -#![feature(box_patterns, stmt_expr_attributes)] +#![feature(box_patterns, stmt_expr_attributes, yeet_expr)] #![allow( dead_code, @@ -25,6 +25,13 @@ fn _no_lint_attr() { let _x = #[allow(dead_code)] (1 + 2); } +fn _no_lint_yeet() -> Result<(), ()> { + #[allow(unreachable_code)] + if (do yeet) {} + + Ok(()) +} + // Don't lint in these cases (#64106). fn or_patterns_no_lint() { match Box::new(0) { diff --git a/src/test/ui/lint/unused/issue-54538-unused-parens-lint.rs b/src/test/ui/lint/unused/issue-54538-unused-parens-lint.rs index 1e78ec5f7d9..28b662dd024 100644 --- a/src/test/ui/lint/unused/issue-54538-unused-parens-lint.rs +++ b/src/test/ui/lint/unused/issue-54538-unused-parens-lint.rs @@ -1,6 +1,6 @@ // run-rustfix -#![feature(box_patterns, stmt_expr_attributes)] +#![feature(box_patterns, stmt_expr_attributes, yeet_expr)] #![allow( dead_code, @@ -25,6 +25,13 @@ fn _no_lint_attr() { let _x = #[allow(dead_code)] (1 + 2); } +fn _no_lint_yeet() -> Result<(), ()> { + #[allow(unreachable_code)] + if (do yeet) {} + + Ok(()) +} + // Don't lint in these cases (#64106). fn or_patterns_no_lint() { match Box::new(0) { diff --git a/src/test/ui/lint/unused/issue-54538-unused-parens-lint.stderr b/src/test/ui/lint/unused/issue-54538-unused-parens-lint.stderr index c73884663c8..a5e69e6d938 100644 --- a/src/test/ui/lint/unused/issue-54538-unused-parens-lint.stderr +++ b/src/test/ui/lint/unused/issue-54538-unused-parens-lint.stderr @@ -76,7 +76,7 @@ LL + let _ = |a: u8| 0; | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:49:12 + --> $DIR/issue-54538-unused-parens-lint.rs:56:12 | LL | if let (0 | 1) = 0 {} | ^ ^ @@ -88,7 +88,7 @@ LL + if let 0 | 1 = 0 {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:50:13 + --> $DIR/issue-54538-unused-parens-lint.rs:57:13 | LL | if let ((0 | 1),) = (0,) {} | ^ ^ @@ -100,7 +100,7 @@ LL + if let (0 | 1,) = (0,) {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:51:13 + --> $DIR/issue-54538-unused-parens-lint.rs:58:13 | LL | if let [(0 | 1)] = [0] {} | ^ ^ @@ -112,7 +112,7 @@ LL + if let [0 | 1] = [0] {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:52:16 + --> $DIR/issue-54538-unused-parens-lint.rs:59:16 | LL | if let 0 | (1 | 2) = 0 {} | ^ ^ @@ -124,7 +124,7 @@ LL + if let 0 | 1 | 2 = 0 {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:54:15 + --> $DIR/issue-54538-unused-parens-lint.rs:61:15 | LL | if let TS((0 | 1)) = TS(0) {} | ^ ^ @@ -136,7 +136,7 @@ LL + if let TS(0 | 1) = TS(0) {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:56:20 + --> $DIR/issue-54538-unused-parens-lint.rs:63:20 | LL | if let NS { f: (0 | 1) } = (NS { f: 0 }) {} | ^ ^ @@ -148,7 +148,7 @@ LL + if let NS { f: 0 | 1 } = (NS { f: 0 }) {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:66:9 + --> $DIR/issue-54538-unused-parens-lint.rs:73:9 | LL | (_) => {} | ^ ^ @@ -160,7 +160,7 @@ LL + _ => {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:67:9 + --> $DIR/issue-54538-unused-parens-lint.rs:74:9 | LL | (y) => {} | ^ ^ @@ -172,7 +172,7 @@ LL + y => {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:68:9 + --> $DIR/issue-54538-unused-parens-lint.rs:75:9 | LL | (ref r) => {} | ^ ^ @@ -184,7 +184,7 @@ LL + ref r => {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:69:9 + --> $DIR/issue-54538-unused-parens-lint.rs:76:9 | LL | (e @ 1...2) => {} | ^ ^ @@ -196,7 +196,7 @@ LL + e @ 1...2 => {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:75:9 + --> $DIR/issue-54538-unused-parens-lint.rs:82:9 | LL | (e @ &(1...2)) => {} | ^ ^ @@ -208,7 +208,7 @@ LL + e @ &(1...2) => {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:76:10 + --> $DIR/issue-54538-unused-parens-lint.rs:83:10 | LL | &(_) => {} | ^ ^ @@ -220,7 +220,7 @@ LL + &_ => {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:87:9 + --> $DIR/issue-54538-unused-parens-lint.rs:94:9 | LL | (_) => {} | ^ ^ @@ -232,7 +232,7 @@ LL + _ => {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:88:9 + --> $DIR/issue-54538-unused-parens-lint.rs:95:9 | LL | (y) => {} | ^ ^ @@ -244,7 +244,7 @@ LL + y => {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:89:9 + --> $DIR/issue-54538-unused-parens-lint.rs:96:9 | LL | (ref r) => {} | ^ ^ @@ -256,7 +256,7 @@ LL + ref r => {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:90:9 + --> $DIR/issue-54538-unused-parens-lint.rs:97:9 | LL | (e @ 1..=2) => {} | ^ ^ @@ -268,7 +268,7 @@ LL + e @ 1..=2 => {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:96:9 + --> $DIR/issue-54538-unused-parens-lint.rs:103:9 | LL | (e @ &(1..=2)) => {} | ^ ^ @@ -280,7 +280,7 @@ LL + e @ &(1..=2) => {} | error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:97:10 + --> $DIR/issue-54538-unused-parens-lint.rs:104:10 | LL | &(_) => {} | ^ ^ diff --git a/src/test/ui/lint/unused/issue-88519-unused-paren.rs b/src/test/ui/lint/unused/issue-88519-unused-paren.rs index be02fcd3f00..ce3d15ac183 100644 --- a/src/test/ui/lint/unused/issue-88519-unused-paren.rs +++ b/src/test/ui/lint/unused/issue-88519-unused-paren.rs @@ -51,22 +51,13 @@ mod casts { mod typeascription { fn outside() -> u8 { - ({ 0 }): u8 - } - fn inside() -> u8 { - ({ 0 }: u8) + type_ascribe!(({ 0 }), u8) } fn outside_match() -> u8 { - (match 0 { x => x }): u8 - } - fn inside_match() -> u8 { - (match 0 { x => x }: u8) + type_ascribe!((match 0 { x => x }), u8) } fn outside_if() -> u8 { - (if false { 0 } else { 0 }): u8 - } - fn inside_if() -> u8 { - (if false { 0 } else { 0 }: u8) + type_ascribe!((if false { 0 } else { 0 }), u8) } } diff --git a/src/test/ui/loops/issue-82916.stderr b/src/test/ui/loops/issue-82916.stderr index 57d76016c45..e6a60d7bc40 100644 --- a/src/test/ui/loops/issue-82916.stderr +++ b/src/test/ui/loops/issue-82916.stderr @@ -9,11 +9,8 @@ LL | for y in x { LL | let z = x; | ^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `x` +note: `into_iter` takes ownership of the receiver `self`, which moves `x` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ help: consider iterating over a slice of the `Vec<S>`'s content to avoid moving into the `for` loop | LL | for y in &x { diff --git a/src/test/ui/macros/format-args-temporaries-in-write.stderr b/src/test/ui/macros/format-args-temporaries-in-write.stderr index 03ecc4b4418..287cd7d6704 100644 --- a/src/test/ui/macros/format-args-temporaries-in-write.stderr +++ b/src/test/ui/macros/format-args-temporaries-in-write.stderr @@ -12,11 +12,6 @@ LL | }; | | | `mutex` dropped here while still borrowed | -help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped - --> $SRC_DIR/core/src/macros/mod.rs:LL:COL - | -LL | $dst.write_fmt($crate::format_args!($($arg)*)); - | + error[E0597]: `mutex` does not live long enough --> $DIR/format-args-temporaries-in-write.rs:47:29 @@ -32,11 +27,6 @@ LL | }; | | | `mutex` dropped here while still borrowed | -help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped - --> $SRC_DIR/core/src/macros/mod.rs:LL:COL - | -LL | $dst.write_fmt($crate::format_args_nl!($($arg)*)); - | + error: aborting due to 2 previous errors diff --git a/src/test/ui/macros/issue-103529.rs b/src/test/ui/macros/issue-103529.rs new file mode 100644 index 00000000000..fa05baed7fc --- /dev/null +++ b/src/test/ui/macros/issue-103529.rs @@ -0,0 +1,13 @@ +macro_rules! m { + ($s:stmt) => {} +} + +m! { mut x } +//~^ ERROR expected expression, found keyword `mut` +//~| ERROR expected a statement +m! { auto x } +//~^ ERROR invalid variable declaration +m! { var x } +//~^ ERROR invalid variable declaration + +fn main() {} diff --git a/src/test/ui/macros/issue-103529.stderr b/src/test/ui/macros/issue-103529.stderr new file mode 100644 index 00000000000..61e322afc77 --- /dev/null +++ b/src/test/ui/macros/issue-103529.stderr @@ -0,0 +1,39 @@ +error: expected expression, found keyword `mut` + --> $DIR/issue-103529.rs:5:6 + | +LL | m! { mut x } + | ^^^ expected expression + +error: expected a statement + --> $DIR/issue-103529.rs:5:10 + | +LL | ($s:stmt) => {} + | ------- while parsing argument for this `stmt` macro fragment +... +LL | m! { mut x } + | ^ + +error: invalid variable declaration + --> $DIR/issue-103529.rs:8:6 + | +LL | m! { auto x } + | ^^^^ + | +help: write `let` instead of `auto` to introduce a new variable + | +LL | m! { let x } + | ~~~ + +error: invalid variable declaration + --> $DIR/issue-103529.rs:10:6 + | +LL | m! { var x } + | ^^^ + | +help: write `let` instead of `var` to introduce a new variable + | +LL | m! { let x } + | ~~~ + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/macros/issue-105011.rs b/src/test/ui/macros/issue-105011.rs new file mode 100644 index 00000000000..da12c381464 --- /dev/null +++ b/src/test/ui/macros/issue-105011.rs @@ -0,0 +1,3 @@ +fn main() { + println!(""y); //~ ERROR suffixes on string literals are invalid +} diff --git a/src/test/ui/macros/issue-105011.stderr b/src/test/ui/macros/issue-105011.stderr new file mode 100644 index 00000000000..e898af7faa3 --- /dev/null +++ b/src/test/ui/macros/issue-105011.stderr @@ -0,0 +1,8 @@ +error: suffixes on string literals are invalid + --> $DIR/issue-105011.rs:2:14 + | +LL | println!(""y); + | ^^^ invalid suffix `y` + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-42954.fixed b/src/test/ui/macros/issue-42954.fixed index a73054c9257..a73054c9257 100644 --- a/src/test/ui/issues/issue-42954.fixed +++ b/src/test/ui/macros/issue-42954.fixed diff --git a/src/test/ui/issues/issue-42954.rs b/src/test/ui/macros/issue-42954.rs index 5f9b0e31da5..5f9b0e31da5 100644 --- a/src/test/ui/issues/issue-42954.rs +++ b/src/test/ui/macros/issue-42954.rs diff --git a/src/test/ui/issues/issue-42954.stderr b/src/test/ui/macros/issue-42954.stderr index 396a91994eb..396a91994eb 100644 --- a/src/test/ui/issues/issue-42954.stderr +++ b/src/test/ui/macros/issue-42954.stderr diff --git a/src/test/ui/issues/issue-51848.rs b/src/test/ui/macros/issue-51848.rs index 4792bdd64f0..4792bdd64f0 100644 --- a/src/test/ui/issues/issue-51848.rs +++ b/src/test/ui/macros/issue-51848.rs diff --git a/src/test/ui/issues/issue-51848.stderr b/src/test/ui/macros/issue-51848.stderr index c25bedf37b7..c25bedf37b7 100644 --- a/src/test/ui/issues/issue-51848.stderr +++ b/src/test/ui/macros/issue-51848.stderr diff --git a/src/test/ui/macros/macro-in-expression-context.stderr b/src/test/ui/macros/macro-in-expression-context.stderr index 1023189eaa3..36aba8aa08a 100644 --- a/src/test/ui/macros/macro-in-expression-context.stderr +++ b/src/test/ui/macros/macro-in-expression-context.stderr @@ -5,11 +5,13 @@ LL | assert_eq!("B", "B"); | ^^^^^^^^^ ... LL | foo!() - | ------- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here + | ------ caused by the macro expansion here | = note: the usage of `foo!` is likely invalid in expression context +help: you might be missing a semicolon here + | +LL | foo!(); + | + warning: trailing semicolon in macro used in expression position --> $DIR/macro-in-expression-context.rs:5:29 diff --git a/src/test/ui/macros/macro-name-typo.stderr b/src/test/ui/macros/macro-name-typo.stderr index 3e8cfb3f0e9..d7c8aaae22e 100644 --- a/src/test/ui/macros/macro-name-typo.stderr +++ b/src/test/ui/macros/macro-name-typo.stderr @@ -3,11 +3,9 @@ error: cannot find macro `printlx` in this scope | LL | printlx!("oh noes!"); | ^^^^^^^ help: a macro with a similar name exists: `println` + --> $SRC_DIR/std/src/macros.rs:LL:COL | - ::: $SRC_DIR/std/src/macros.rs:LL:COL - | -LL | macro_rules! println { - | -------------------- similarly named macro `println` defined here + = note: similarly named macro `println` defined here error: aborting due to previous error diff --git a/src/test/ui/macros/macro-path-prelude-fail-3.stderr b/src/test/ui/macros/macro-path-prelude-fail-3.stderr index 70900a6bc81..f1c3512bc9b 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-3.stderr +++ b/src/test/ui/macros/macro-path-prelude-fail-3.stderr @@ -3,11 +3,9 @@ error: cannot find macro `inline` in this scope | LL | inline!(); | ^^^^^^ help: a macro with a similar name exists: `line` + --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | - ::: $SRC_DIR/core/src/macros/mod.rs:LL:COL - | -LL | macro_rules! line { - | ----------------- similarly named macro `line` defined here + = note: similarly named macro `line` defined here | = note: `inline` is in scope, but it is an attribute: `#[inline]` diff --git a/src/test/ui/macros/syntax-error-recovery.stderr b/src/test/ui/macros/syntax-error-recovery.stderr index c153b3b910b..c42ee9b295e 100644 --- a/src/test/ui/macros/syntax-error-recovery.stderr +++ b/src/test/ui/macros/syntax-error-recovery.stderr @@ -7,6 +7,7 @@ LL | $token $($inner)? = $value, LL | values!(STRING(1) as (String) => cfg(test),); | -------------------------------------------- in this macro invocation | + = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` = note: this error originates in the macro `values` (in Nightly builds, run with -Z macro-backtrace for more info) error: macro expansion ignores token `(String)` and any following diff --git a/src/test/ui/macros/unknown-builtin.stderr b/src/test/ui/macros/unknown-builtin.stderr index 8f9dba16578..22f54e04e54 100644 --- a/src/test/ui/macros/unknown-builtin.stderr +++ b/src/test/ui/macros/unknown-builtin.stderr @@ -7,9 +7,6 @@ LL | macro_rules! unknown { () => () } error[E0773]: attempted to define built-in macro more than once --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | -LL | macro_rules! line { - | ^^^^^^^^^^^^^^^^^ - | note: previously defined here --> $DIR/unknown-builtin.rs:9:1 | diff --git a/src/test/ui/malformed/malformed-derive-entry.stderr b/src/test/ui/malformed/malformed-derive-entry.stderr index 803883460f0..6ff6fbabb4a 100644 --- a/src/test/ui/malformed/malformed-derive-entry.stderr +++ b/src/test/ui/malformed/malformed-derive-entry.stderr @@ -24,9 +24,6 @@ LL | #[derive(Copy(Bad))] | note: required by a bound in `Copy` --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | pub trait Copy: Clone { - | ^^^^^ required by this bound in `Copy` = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Test1` with `#[derive(Clone)]` | @@ -41,9 +38,6 @@ LL | #[derive(Copy="bad")] | note: required by a bound in `Copy` --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | pub trait Copy: Clone { - | ^^^^^ required by this bound in `Copy` = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Test2` with `#[derive(Clone)]` | diff --git a/src/test/ui/match/match-unresolved-one-arm.stderr b/src/test/ui/match/match-unresolved-one-arm.stderr index 9eadb88a8ba..e3b501b2fd5 100644 --- a/src/test/ui/match/match-unresolved-one-arm.stderr +++ b/src/test/ui/match/match-unresolved-one-arm.stderr @@ -6,8 +6,8 @@ LL | let x = match () { | help: consider giving `x` an explicit type | -LL | let x: _ = match () { - | +++ +LL | let x: /* Type */ = match () { + | ++++++++++++ error: aborting due to previous error diff --git a/src/test/ui/maximal_mir_to_hir_coverage.rs b/src/test/ui/maximal_mir_to_hir_coverage.rs new file mode 100644 index 00000000000..5ca54633f21 --- /dev/null +++ b/src/test/ui/maximal_mir_to_hir_coverage.rs @@ -0,0 +1,10 @@ +// compile-flags: -Zmaximal-hir-to-mir-coverage +// run-pass + +// Just making sure this flag is accepted and doesn't crash the compiler + +fn main() { + let x = 1; + let y = x + 1; + println!("{y}"); +} diff --git a/src/test/ui/methods/issues/issue-90315.stderr b/src/test/ui/methods/issues/issue-90315.stderr index 070cd305436..8d7b32e025a 100644 --- a/src/test/ui/methods/issues/issue-90315.stderr +++ b/src/test/ui/methods/issues/issue-90315.stderr @@ -57,7 +57,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:28:8 | LL | if 1..(end + 1).is_empty() { - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<{integer}>` @@ -77,7 +77,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:34:8 | LL | if 1..(end + 1).is_sorted() { - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<{integer}>` @@ -97,7 +97,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:40:21 | LL | let _res: i32 = 3..6.take(2).sum(); - | --- ^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `std::ops::Range` + | --- ^^^^^^^^^^^^^^^^^^ expected `i32`, found struct `Range` | | | expected due to this | @@ -119,7 +119,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:45:21 | LL | let _sum: i32 = 3..6.sum(); - | --- ^^^^^^^^^^ expected `i32`, found struct `std::ops::Range` + | --- ^^^^^^^^^^ expected `i32`, found struct `Range` | | | expected due to this | @@ -158,7 +158,7 @@ error[E0308]: mismatched types --> $DIR/issue-90315.rs:62:8 | LL | if 1..end.error_method() { - | ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<{integer}>` diff --git a/src/test/ui/methods/method-call-err-msg.stderr b/src/test/ui/methods/method-call-err-msg.stderr index a4ffb864dad..3f4e647491e 100644 --- a/src/test/ui/methods/method-call-err-msg.stderr +++ b/src/test/ui/methods/method-call-err-msg.stderr @@ -61,11 +61,8 @@ LL | .take() = note: the following trait bounds were not satisfied: `Foo: Iterator` which is required by `&mut Foo: Iterator` -note: the following trait must be implemented +note: the trait `Iterator` must be implemented --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | pub trait Iterator { - | ^^^^^^^^^^^^^^^^^^ = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `take`, perhaps you need to implement it: candidate #1: `Iterator` diff --git a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr index 62f20d6d50c..25ad360b329 100644 --- a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr @@ -11,11 +11,9 @@ warning: cannot specify lifetime arguments explicitly if late bound lifetime par | LL | 0.clone::<'a>(); | ^^ + --> $SRC_DIR/core/src/clone.rs:LL:COL | - ::: $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | fn clone(&self) -> Self; - | - the late bound lifetime parameter is introduced here + = note: the late bound lifetime parameter is introduced here | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868> diff --git a/src/test/ui/issues/issue-29227.rs b/src/test/ui/mir/issue-29227.rs index e9dfc2840e5..e9dfc2840e5 100644 --- a/src/test/ui/issues/issue-29227.rs +++ b/src/test/ui/mir/issue-29227.rs diff --git a/src/test/ui/issues/issue-46845.rs b/src/test/ui/mir/issue-46845.rs index fc85b25519a..fc85b25519a 100644 --- a/src/test/ui/issues/issue-46845.rs +++ b/src/test/ui/mir/issue-46845.rs diff --git a/src/test/ui/issues/issue-77002.rs b/src/test/ui/mir/issue-77002.rs index 0c37346eaf8..0c37346eaf8 100644 --- a/src/test/ui/issues/issue-77002.rs +++ b/src/test/ui/mir/issue-77002.rs diff --git a/src/test/ui/mir/mir_ascription_coercion.rs b/src/test/ui/mir/mir_ascription_coercion.rs index 0ebd20e97d7..9e04d601987 100644 --- a/src/test/ui/mir/mir_ascription_coercion.rs +++ b/src/test/ui/mir/mir_ascription_coercion.rs @@ -6,5 +6,5 @@ fn main() { let x = [1, 2, 3]; // The RHS should coerce to &[i32] - let _y : &[i32] = &x : &[i32; 3]; + let _y : &[i32] = type_ascribe!(&x, &[i32; 3]); } diff --git a/src/test/ui/mir/issue-95978-validator-lifetime-comparison.rs b/src/test/ui/mir/validate/issue-95978-validator-lifetime-comparison.rs index cd6c5bf2719..cd6c5bf2719 100644 --- a/src/test/ui/mir/issue-95978-validator-lifetime-comparison.rs +++ b/src/test/ui/mir/validate/issue-95978-validator-lifetime-comparison.rs diff --git a/src/test/ui/mir/validate/needs-reveal-all.rs b/src/test/ui/mir/validate/needs-reveal-all.rs new file mode 100644 index 00000000000..3852daf245e --- /dev/null +++ b/src/test/ui/mir/validate/needs-reveal-all.rs @@ -0,0 +1,52 @@ +// Regression test for #105009. the issue here was that even after the `RevealAll` pass, +// `validate` still used `Reveal::UserFacing`. This meant that it now ends up comparing +// opaque types with their revealed version, resulting in an ICE. +// +// We're using these flags to run the `RevealAll` pass while making it less likely to +// accidentally removing the assignment from `Foo<fn_ptr>` to `Foo<fn_def>`. + +// compile-flags: -Zinline_mir=yes -Zmir-opt-level=0 -Zvalidate-mir +// run-pass + +use std::hint::black_box; + +trait Func { + type Ret: Id; +} + +trait Id { + type Assoc; +} +impl Id for u32 { + type Assoc = u32; +} +impl Id for i32 { + type Assoc = i32; +} + +impl<F: FnOnce() -> R, R: Id> Func for F { + type Ret = R; +} + +fn bar() -> impl Copy + Id { + 0u32 +} + +struct Foo<T: Func> { + _func: T, + value: Option<<<T as Func>::Ret as Id>::Assoc>, +} + +fn main() { + let mut fn_def = black_box(Foo { + _func: bar, + value: None, + }); + let fn_ptr = black_box(Foo { + _func: bar as fn() -> _, + value: None, + }); + + fn_def.value = fn_ptr.value; + black_box(fn_def); +} diff --git a/src/test/ui/mismatched_types/assignment-operator-unimplemented.stderr b/src/test/ui/mismatched_types/assignment-operator-unimplemented.stderr index ffd95b48ac2..2393791a9b2 100644 --- a/src/test/ui/mismatched_types/assignment-operator-unimplemented.stderr +++ b/src/test/ui/mismatched_types/assignment-operator-unimplemented.stderr @@ -11,11 +11,8 @@ note: an implementation of `AddAssign<_>` might be missing for `Foo` | LL | struct Foo; | ^^^^^^^^^^ must implement `AddAssign<_>` -note: the following trait must be implemented +note: the trait `AddAssign` must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | pub trait AddAssign<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/mismatched_types/binops.stderr b/src/test/ui/mismatched_types/binops.stderr index 3de652d87ec..3585587ed4c 100644 --- a/src/test/ui/mismatched_types/binops.stderr +++ b/src/test/ui/mismatched_types/binops.stderr @@ -24,15 +24,10 @@ LL | 2 as usize - Some(1); | = help: the trait `Sub<Option<{integer}>>` is not implemented for `usize` = help: the following other types implement trait `Sub<Rhs>`: - <&'a f32 as Sub<f32>> - <&'a f64 as Sub<f64>> - <&'a i128 as Sub<i128>> - <&'a i16 as Sub<i16>> - <&'a i32 as Sub<i32>> - <&'a i64 as Sub<i64>> - <&'a i8 as Sub<i8>> - <&'a isize as Sub<isize>> - and 48 others + <&'a usize as Sub<usize>> + <&usize as Sub<&usize>> + <usize as Sub<&usize>> + <usize as Sub> error[E0277]: cannot multiply `{integer}` by `()` --> $DIR/binops.rs:4:7 diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index a02ec819838..2ecab9f024a 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -128,9 +128,6 @@ LL | fn foo() {} | note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments --> $DIR/closure-arg-count.rs:27:57 @@ -144,9 +141,6 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(bar); | note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments --> $DIR/closure-arg-count.rs:29:57 @@ -161,9 +155,6 @@ LL | fn qux(x: usize, y: usize) {} | note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0593]: function is expected to take 1 argument, but it takes 2 arguments --> $DIR/closure-arg-count.rs:32:45 @@ -175,9 +166,6 @@ LL | let _it = vec![1, 2, 3].into_iter().map(usize::checked_add); | note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0593]: function is expected to take 0 arguments, but it takes 1 argument --> $DIR/closure-arg-count.rs:35:10 diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index 92d545b7366..fab9b7edc0c 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -2,17 +2,16 @@ error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:3:14 | LL | a.iter().map(|_: (u32, u32)| 45); - | ^^^ --------------- found signature defined here - | | + | ^^^ --------------- + | | | | + | | | help: consider borrowing the argument: `&(u32, u32)` + | | found signature defined here | expected due to this | = note: expected closure signature `fn(&(u32, u32)) -> _` found closure signature `fn((u32, u32)) -> _` note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:4:14 @@ -26,9 +25,6 @@ LL | a.iter().map(|_: &(u16, u16)| 45); found closure signature `for<'a> fn(&'a (u16, u16)) -> _` note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:5:14 @@ -42,9 +38,6 @@ LL | a.iter().map(|_: (u16, u16)| 45); found closure signature `fn((u16, u16)) -> _` note: required by a bound in `map` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | F: FnMut(Self::Item) -> B, - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `map` error: aborting due to 3 previous errors diff --git a/src/test/ui/mismatched_types/issue-35030.stderr b/src/test/ui/mismatched_types/issue-35030.stderr index 5ea9bcfc122..680aff1726f 100644 --- a/src/test/ui/mismatched_types/issue-35030.stderr +++ b/src/test/ui/mismatched_types/issue-35030.stderr @@ -13,9 +13,6 @@ LL | Some(true) found type `bool` (`bool`) note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/mismatched_types/issue-36053-2.stderr b/src/test/ui/mismatched_types/issue-36053-2.stderr index 906001ca1e0..b91f75b97f8 100644 --- a/src/test/ui/mismatched_types/issue-36053-2.stderr +++ b/src/test/ui/mismatched_types/issue-36053-2.stderr @@ -2,17 +2,16 @@ error[E0631]: type mismatch in closure arguments --> $DIR/issue-36053-2.rs:7:32 | LL | once::<&str>("str").fuse().filter(|a: &str| true).count(); - | ^^^^^^ --------- found signature defined here - | | + | ^^^^^^ --------- + | | | | + | | | help: consider borrowing the argument: `&&str` + | | found signature defined here | expected due to this | = note: expected closure signature `for<'a> fn(&'a &str) -> _` found closure signature `for<'a> fn(&'a str) -> _` note: required by a bound in `filter` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | P: FnMut(&Self::Item) -> bool, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `filter` error[E0599]: the method `count` exists for struct `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>`, but its trait bounds were not satisfied --> $DIR/issue-36053-2.rs:7:55 @@ -22,11 +21,9 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count(); | | | doesn't satisfy `<_ as FnOnce<(&&str,)>>::Output = bool` | doesn't satisfy `_: FnMut<(&&str,)>` + --> $SRC_DIR/core/src/iter/adapters/filter.rs:LL:COL | - ::: $SRC_DIR/core/src/iter/adapters/filter.rs:LL:COL - | -LL | pub struct Filter<I, P> { - | ----------------------- doesn't satisfy `_: Iterator` + = note: doesn't satisfy `_: Iterator` | = note: the following trait bounds were not satisfied: `<[closure@$DIR/issue-36053-2.rs:7:39: 7:48] as FnOnce<(&&str,)>>::Output = bool` diff --git a/src/test/ui/mismatched_types/issue-47706-trait.stderr b/src/test/ui/mismatched_types/issue-47706-trait.stderr index d596b4a69f3..a5f38dd5366 100644 --- a/src/test/ui/mismatched_types/issue-47706-trait.stderr +++ b/src/test/ui/mismatched_types/issue-47706-trait.stderr @@ -10,9 +10,6 @@ LL | None::<()>.map(Self::f); | note: required by a bound in `Option::<T>::map` --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | F: ~const FnOnce(T) -> U, - | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::<T>::map` error: aborting due to previous error diff --git a/src/test/ui/mismatched_types/issue-47706.stderr b/src/test/ui/mismatched_types/issue-47706.stderr index 8b856368401..d9d408844d0 100644 --- a/src/test/ui/mismatched_types/issue-47706.stderr +++ b/src/test/ui/mismatched_types/issue-47706.stderr @@ -11,9 +11,6 @@ LL | self.foo.map(Foo::new) | note: required by a bound in `Option::<T>::map` --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | F: ~const FnOnce(T) -> U, - | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::<T>::map` error[E0593]: function is expected to take 0 arguments, but it takes 1 argument --> $DIR/issue-47706.rs:27:9 diff --git a/src/test/ui/mismatched_types/issue-74918-missing-lifetime.stderr b/src/test/ui/mismatched_types/issue-74918-missing-lifetime.stderr index 94a9c97576f..b75c7a99fdd 100644 --- a/src/test/ui/mismatched_types/issue-74918-missing-lifetime.stderr +++ b/src/test/ui/mismatched_types/issue-74918-missing-lifetime.stderr @@ -14,11 +14,9 @@ error: `impl` item signature doesn't match `trait` item signature | LL | fn next(&mut self) -> Option<IteratorChunk<T, S>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'1, T, S>>` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | - ::: $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | fn next(&mut self) -> Option<Self::Item>; - | ----------------------------------------- expected `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'static, T, S>>` + = note: expected `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'static, T, S>>` | = note: expected `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'static, T, S>>` found `fn(&'1 mut ChunkingIterator<T, S>) -> Option<IteratorChunk<'1, T, S>>` diff --git a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr index 36748fae13c..d3b7525072f 100644 --- a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr +++ b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr @@ -1,18 +1,13 @@ error[E0277]: `Foo` doesn't implement `Debug` - --> $DIR/method-help-unsatisfied-bound.rs:5:5 + --> $DIR/method-help-unsatisfied-bound.rs:5:7 | LL | a.unwrap(); - | ^ ------ required by a bound introduced by this call - | | - | `Foo` cannot be formatted using `{:?}` + | ^^^^^^ `Foo` cannot be formatted using `{:?}` | = help: the trait `Debug` is not implemented for `Foo` = note: add `#[derive(Debug)]` to `Foo` or manually `impl Debug for Foo` note: required by a bound in `Result::<T, E>::unwrap` --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | E: fmt::Debug, - | ^^^^^^^^^^ required by this bound in `Result::<T, E>::unwrap` help: consider annotating `Foo` with `#[derive(Debug)]` | LL | #[derive(Debug)] diff --git a/src/test/ui/mismatched_types/similar_paths.stderr b/src/test/ui/mismatched_types/similar_paths.stderr index e65ae58d4ce..46a38332552 100644 --- a/src/test/ui/mismatched_types/similar_paths.stderr +++ b/src/test/ui/mismatched_types/similar_paths.stderr @@ -9,9 +9,6 @@ LL | Some(42_u8) = note: enum `std::option::Option` and enum `Option` have similar names, but are actually distinct types note: enum `std::option::Option` is defined in crate `core` --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | pub enum Option<T> { - | ^^^^^^^^^^^^^^^^^^ note: enum `Option` is defined in the current crate --> $DIR/similar_paths.rs:1:1 | diff --git a/src/test/ui/mismatched_types/wrap-suggestion-privacy.stderr b/src/test/ui/mismatched_types/wrap-suggestion-privacy.stderr index e8eb8d263ec..fdd92cbfc44 100644 --- a/src/test/ui/mismatched_types/wrap-suggestion-privacy.stderr +++ b/src/test/ui/mismatched_types/wrap-suggestion-privacy.stderr @@ -42,7 +42,7 @@ error[E0308]: mismatched types --> $DIR/wrap-suggestion-privacy.rs:22:17 | LL | needs_ready(Some(0)); - | ----------- ^^^^^^^ expected struct `std::future::Ready`, found enum `Option` + | ----------- ^^^^^^^ expected struct `Ready`, found enum `Option` | | | arguments to this function are incorrect | diff --git a/src/test/ui/moves/issue-99470-move-out-of-some.stderr b/src/test/ui/moves/issue-99470-move-out-of-some.stderr index 6e4a4e5ba22..c5159471fe3 100644 --- a/src/test/ui/moves/issue-99470-move-out-of-some.stderr +++ b/src/test/ui/moves/issue-99470-move-out-of-some.stderr @@ -5,11 +5,16 @@ LL | match x { | ^ LL | LL | &Some(_y) => (), - | --------- - | | | - | | data moved here - | | move occurs because `_y` has type `Box<i32>`, which does not implement the `Copy` trait - | help: consider removing the `&`: `Some(_y)` + | -- + | | + | data moved here + | move occurs because `_y` has type `Box<i32>`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - &Some(_y) => (), +LL + Some(_y) => (), + | error: aborting due to previous error diff --git a/src/test/ui/moves/move-fn-self-receiver.stderr b/src/test/ui/moves/move-fn-self-receiver.stderr index c13dc58826e..b3f95ee192a 100644 --- a/src/test/ui/moves/move-fn-self-receiver.stderr +++ b/src/test/ui/moves/move-fn-self-receiver.stderr @@ -6,11 +6,8 @@ LL | val.0.into_iter().next(); LL | val.0; | ^^^^^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `val.0` +note: `into_iter` takes ownership of the receiver `self`, which moves `val.0` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ = note: move occurs because `val.0` has type `Vec<bool>`, which does not implement the `Copy` trait error[E0382]: use of moved value: `foo` @@ -23,7 +20,7 @@ LL | foo.use_self(); LL | foo; | ^^^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `foo` +note: `Foo::use_self` takes ownership of the receiver `self`, which moves `foo` --> $DIR/move-fn-self-receiver.rs:13:17 | LL | fn use_self(self) {} @@ -49,7 +46,7 @@ LL | boxed_foo.use_box_self(); LL | boxed_foo; | ^^^^^^^^^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `boxed_foo` +note: `Foo::use_box_self` takes ownership of the receiver `self`, which moves `boxed_foo` --> $DIR/move-fn-self-receiver.rs:14:21 | LL | fn use_box_self(self: Box<Self>) {} @@ -65,7 +62,7 @@ LL | pin_box_foo.use_pin_box_self(); LL | pin_box_foo; | ^^^^^^^^^^^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `pin_box_foo` +note: `Foo::use_pin_box_self` takes ownership of the receiver `self`, which moves `pin_box_foo` --> $DIR/move-fn-self-receiver.rs:15:25 | LL | fn use_pin_box_self(self: Pin<Box<Self>>) {} @@ -91,7 +88,7 @@ LL | rc_foo.use_rc_self(); LL | rc_foo; | ^^^^^^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `rc_foo` +note: `Foo::use_rc_self` takes ownership of the receiver `self`, which moves `rc_foo` --> $DIR/move-fn-self-receiver.rs:16:20 | LL | fn use_rc_self(self: Rc<Self>) {} @@ -113,9 +110,6 @@ LL | foo_add; | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | fn add(self, rhs: Rhs) -> Self::Output; - | ^^^^ error[E0382]: use of moved value: `implicit_into_iter` --> $DIR/move-fn-self-receiver.rs:63:5 @@ -157,7 +151,7 @@ LL | for _val in container.custom_into_iter() {} LL | container; | ^^^^^^^^^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `container` +note: `Container::custom_into_iter` takes ownership of the receiver `self`, which moves `container` --> $DIR/move-fn-self-receiver.rs:23:25 | LL | fn custom_into_iter(self) -> impl Iterator<Item = bool> { diff --git a/src/test/ui/moves/move-out-of-array-ref.stderr b/src/test/ui/moves/move-out-of-array-ref.stderr index 0caa0b83a4c..26d4996d6cb 100644 --- a/src/test/ui/moves/move-out-of-array-ref.stderr +++ b/src/test/ui/moves/move-out-of-array-ref.stderr @@ -2,45 +2,61 @@ error[E0508]: cannot move out of type `[D; 4]`, a non-copy array --> $DIR/move-out-of-array-ref.rs:8:24 | LL | let [_, e, _, _] = *a; - | - ^^ - | | | - | | cannot move out of here - | | help: consider borrowing here: `&*a` + | - ^^ cannot move out of here + | | | data moved here | move occurs because `e` has type `D`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let [_, e, _, _] = *a; +LL + let [_, e, _, _] = a; + | error[E0508]: cannot move out of type `[D; 4]`, a non-copy array --> $DIR/move-out-of-array-ref.rs:13:27 | LL | let [_, s @ .. , _] = *a; - | - ^^ - | | | - | | cannot move out of here - | | help: consider borrowing here: `&*a` + | - ^^ cannot move out of here + | | | data moved here | move occurs because `s` has type `[D; 2]`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let [_, s @ .. , _] = *a; +LL + let [_, s @ .. , _] = a; + | error[E0508]: cannot move out of type `[D; 4]`, a non-copy array --> $DIR/move-out-of-array-ref.rs:18:24 | LL | let [_, e, _, _] = *a; - | - ^^ - | | | - | | cannot move out of here - | | help: consider borrowing here: `&*a` + | - ^^ cannot move out of here + | | | data moved here | move occurs because `e` has type `D`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let [_, e, _, _] = *a; +LL + let [_, e, _, _] = a; + | error[E0508]: cannot move out of type `[D; 4]`, a non-copy array --> $DIR/move-out-of-array-ref.rs:23:27 | LL | let [_, s @ .. , _] = *a; - | - ^^ - | | | - | | cannot move out of here - | | help: consider borrowing here: `&*a` + | - ^^ cannot move out of here + | | | data moved here | move occurs because `s` has type `[D; 2]`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let [_, s @ .. , _] = *a; +LL + let [_, s @ .. , _] = a; + | error: aborting due to 4 previous errors diff --git a/src/test/ui/moves/move-out-of-slice-1.stderr b/src/test/ui/moves/move-out-of-slice-1.stderr index ce5ddb3e183..5a0357cf567 100644 --- a/src/test/ui/moves/move-out-of-slice-1.stderr +++ b/src/test/ui/moves/move-out-of-slice-1.stderr @@ -8,6 +8,11 @@ LL | box [a] => {}, | | | data moved here | move occurs because `a` has type `A`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | box [ref a] => {}, + | +++ error: aborting due to previous error diff --git a/src/test/ui/moves/move-out-of-slice-2.rs b/src/test/ui/moves/move-out-of-slice-2.rs index 59c02d42bf1..2f7394fbfd3 100644 --- a/src/test/ui/moves/move-out-of-slice-2.rs +++ b/src/test/ui/moves/move-out-of-slice-2.rs @@ -1,5 +1,6 @@ #![feature(unsized_locals)] //~^ WARN the feature `unsized_locals` is incomplete +#![allow(unused)] struct A; #[derive(Clone, Copy)] diff --git a/src/test/ui/moves/move-out-of-slice-2.stderr b/src/test/ui/moves/move-out-of-slice-2.stderr index 46357ce6f2e..b46854cd6b4 100644 --- a/src/test/ui/moves/move-out-of-slice-2.stderr +++ b/src/test/ui/moves/move-out-of-slice-2.stderr @@ -8,7 +8,7 @@ LL | #![feature(unsized_locals)] = note: `#[warn(incomplete_features)]` on by default error[E0508]: cannot move out of type `[A]`, a non-copy slice - --> $DIR/move-out-of-slice-2.rs:10:11 + --> $DIR/move-out-of-slice-2.rs:11:11 | LL | match *a { | ^^ cannot move out of here @@ -18,9 +18,14 @@ LL | [a @ ..] => {} | | | data moved here | move occurs because `a` has type `[A]`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | [ref a @ ..] => {} + | +++ error[E0508]: cannot move out of type `[A]`, a non-copy slice - --> $DIR/move-out-of-slice-2.rs:16:11 + --> $DIR/move-out-of-slice-2.rs:17:11 | LL | match *b { | ^^ cannot move out of here @@ -30,9 +35,14 @@ LL | [_, _, b @ .., _] => {} | | | data moved here | move occurs because `b` has type `[A]`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | [_, _, ref b @ .., _] => {} + | +++ error[E0508]: cannot move out of type `[C]`, a non-copy slice - --> $DIR/move-out-of-slice-2.rs:24:11 + --> $DIR/move-out-of-slice-2.rs:25:11 | LL | match *c { | ^^ cannot move out of here @@ -42,9 +52,14 @@ LL | [c @ ..] => {} | | | data moved here | move occurs because `c` has type `[C]`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | [ref c @ ..] => {} + | +++ error[E0508]: cannot move out of type `[C]`, a non-copy slice - --> $DIR/move-out-of-slice-2.rs:30:11 + --> $DIR/move-out-of-slice-2.rs:31:11 | LL | match *d { | ^^ cannot move out of here @@ -54,6 +69,11 @@ LL | [_, _, d @ .., _] => {} | | | data moved here | move occurs because `d` has type `[C]`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | [_, _, ref d @ .., _] => {} + | +++ error: aborting due to 4 previous errors; 1 warning emitted diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr index a49ee31b466..0b1a623a013 100644 --- a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr +++ b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr @@ -8,11 +8,8 @@ LL | consume(x.into_iter().next().unwrap()); LL | touch(&x[0]); | ^ value borrowed here after move | -note: this function takes ownership of the receiver `self`, which moves `x` +note: `into_iter` takes ownership of the receiver `self`, which moves `x` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ help: consider cloning the value if the performance cost is acceptable | LL | consume(x.clone().into_iter().next().unwrap()); diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.stderr index 5ed91a0d559..df09ababa5a 100644 --- a/src/test/ui/moves/moves-based-on-type-block-bad.stderr +++ b/src/test/ui/moves/moves-based-on-type-block-bad.stderr @@ -2,13 +2,18 @@ error[E0507]: cannot move out of `hellothere.x` as enum variant `Bar` which is b --> $DIR/moves-based-on-type-block-bad.rs:22:19 | LL | match hellothere.x { - | ^^^^^^^^^^^^ help: consider borrowing here: `&hellothere.x` + | ^^^^^^^^^^^^ LL | box E::Foo(_) => {} LL | box E::Bar(x) => println!("{}", x.to_string()), | - | | | data moved here | move occurs because `x` has type `Box<isize>`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &hellothere.x { + | + error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-exprs.stderr b/src/test/ui/moves/moves-based-on-type-exprs.stderr index 838b1282cb4..ae76889f104 100644 --- a/src/test/ui/moves/moves-based-on-type-exprs.stderr +++ b/src/test/ui/moves/moves-based-on-type-exprs.stderr @@ -160,11 +160,8 @@ LL | let _y = x.into_iter().next().unwrap(); LL | touch(&x); | ^^ value borrowed here after move | -note: this function takes ownership of the receiver `self`, which moves `x` +note: `into_iter` takes ownership of the receiver `self`, which moves `x` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ help: consider cloning the value if the performance cost is acceptable | LL | let _y = x.clone().into_iter().next().unwrap(); @@ -180,11 +177,8 @@ LL | let _y = [x.into_iter().next().unwrap(); 1]; LL | touch(&x); | ^^ value borrowed here after move | -note: this function takes ownership of the receiver `self`, which moves `x` +note: `into_iter` takes ownership of the receiver `self`, which moves `x` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ help: consider cloning the value if the performance cost is acceptable | LL | let _y = [x.clone().into_iter().next().unwrap(); 1]; diff --git a/src/test/ui/never_type/feature-gate-never_type_fallback.stderr b/src/test/ui/never_type/feature-gate-never_type_fallback.stderr index 6dc039fc35d..2db1cc4b776 100644 --- a/src/test/ui/never_type/feature-gate-never_type_fallback.stderr +++ b/src/test/ui/never_type/feature-gate-never_type_fallback.stderr @@ -5,7 +5,7 @@ LL | foo(panic!()) | --- ^^^^^^^^ | | | | | the trait `T` is not implemented for `()` - | | this tail expression is of type `_` + | | this tail expression is of type `()` | required by a bound introduced by this call | note: required by a bound in `foo` diff --git a/src/test/ui/never_type/issue-13352.stderr b/src/test/ui/never_type/issue-13352.stderr index fed780e6895..2d22da0b420 100644 --- a/src/test/ui/never_type/issue-13352.stderr +++ b/src/test/ui/never_type/issue-13352.stderr @@ -6,15 +6,10 @@ LL | 2_usize + (loop {}); | = help: the trait `Add<()>` is not implemented for `usize` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> - <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> - <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> - <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&'a usize as Add<usize>> + <&usize as Add<&usize>> + <usize as Add<&usize>> + <usize as Add> error: aborting due to previous error diff --git a/src/test/ui/never_type/issue-52443.stderr b/src/test/ui/never_type/issue-52443.stderr index 0910e9ad77a..de5c9c56016 100644 --- a/src/test/ui/never_type/issue-52443.stderr +++ b/src/test/ui/never_type/issue-52443.stderr @@ -46,9 +46,6 @@ LL | [(); { for _ in 0usize.. {}; 0}]; | note: impl defined here, but it is not `const` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | impl<I: Iterator> const IntoIterator for I { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: calls in constants are limited to constant functions, tuple structs and tuple variants error[E0658]: mutable references are not allowed in constants diff --git a/src/test/ui/never_type/issue-96335.stderr b/src/test/ui/never_type/issue-96335.stderr index 168cf2f8353..e148b983e8e 100644 --- a/src/test/ui/never_type/issue-96335.stderr +++ b/src/test/ui/never_type/issue-96335.stderr @@ -26,9 +26,6 @@ LL | 0.....{loop{}1}; found struct `RangeTo<{integer}>` note: associated function defined here --> $SRC_DIR/core/src/ops/range.rs:LL:COL - | -LL | pub const fn new(start: Idx, end: Idx) -> Self { - | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/cannot-move-block-spans.stderr b/src/test/ui/nll/cannot-move-block-spans.stderr index 56a5cdff073..0dc5c08ea5f 100644 --- a/src/test/ui/nll/cannot-move-block-spans.stderr +++ b/src/test/ui/nll/cannot-move-block-spans.stderr @@ -2,28 +2,37 @@ error[E0507]: cannot move out of `*r` which is behind a shared reference --> $DIR/cannot-move-block-spans.rs:5:15 | LL | let x = { *r }; - | ^^ - | | - | move occurs because `*r` has type `String`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*r` + | ^^ move occurs because `*r` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let x = { *r }; +LL + let x = { r }; + | error[E0507]: cannot move out of `*r` which is behind a shared reference --> $DIR/cannot-move-block-spans.rs:6:22 | LL | let y = unsafe { *r }; - | ^^ - | | - | move occurs because `*r` has type `String`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*r` + | ^^ move occurs because `*r` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let y = unsafe { *r }; +LL + let y = unsafe { r }; + | error[E0507]: cannot move out of `*r` which is behind a shared reference --> $DIR/cannot-move-block-spans.rs:7:26 | LL | let z = loop { break *r; }; - | ^^ - | | - | move occurs because `*r` has type `String`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*r` + | ^^ move occurs because `*r` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let z = loop { break *r; }; +LL + let z = loop { break r; }; + | error[E0508]: cannot move out of type `[String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:11:15 @@ -33,7 +42,11 @@ LL | let x = { arr[0] }; | | | cannot move out of here | move occurs because `arr[_]` has type `String`, which does not implement the `Copy` trait - | help: consider borrowing here: `&arr[0]` + | +help: consider borrowing here + | +LL | let x = { &arr[0] }; + | + error[E0508]: cannot move out of type `[String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:12:22 @@ -43,7 +56,11 @@ LL | let y = unsafe { arr[0] }; | | | cannot move out of here | move occurs because `arr[_]` has type `String`, which does not implement the `Copy` trait - | help: consider borrowing here: `&arr[0]` + | +help: consider borrowing here + | +LL | let y = unsafe { &arr[0] }; + | + error[E0508]: cannot move out of type `[String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:13:26 @@ -53,34 +70,47 @@ LL | let z = loop { break arr[0]; }; | | | cannot move out of here | move occurs because `arr[_]` has type `String`, which does not implement the `Copy` trait - | help: consider borrowing here: `&arr[0]` + | +help: consider borrowing here + | +LL | let z = loop { break &arr[0]; }; + | + error[E0507]: cannot move out of `*r` which is behind a shared reference --> $DIR/cannot-move-block-spans.rs:17:38 | LL | let x = { let mut u = 0; u += 1; *r }; - | ^^ - | | - | move occurs because `*r` has type `String`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*r` + | ^^ move occurs because `*r` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let x = { let mut u = 0; u += 1; *r }; +LL + let x = { let mut u = 0; u += 1; r }; + | error[E0507]: cannot move out of `*r` which is behind a shared reference --> $DIR/cannot-move-block-spans.rs:18:45 | LL | let y = unsafe { let mut u = 0; u += 1; *r }; - | ^^ - | | - | move occurs because `*r` has type `String`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*r` + | ^^ move occurs because `*r` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let y = unsafe { let mut u = 0; u += 1; *r }; +LL + let y = unsafe { let mut u = 0; u += 1; r }; + | error[E0507]: cannot move out of `*r` which is behind a shared reference --> $DIR/cannot-move-block-spans.rs:19:49 | LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; - | ^^ - | | - | move occurs because `*r` has type `String`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*r` + | ^^ move occurs because `*r` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; +LL + let z = loop { let mut u = 0; u += 1; break r; u += 2; }; + | error: aborting due to 9 previous errors diff --git a/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr b/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr index c0a17a67ee2..7f9cbc3c30a 100644 --- a/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr +++ b/src/test/ui/nll/issue-52059-report-when-borrow-and-drop-conflict.stderr @@ -36,7 +36,11 @@ LL | let p = s.url; p | | | cannot move out of here | move occurs because `s.url` has type `&mut String`, which does not implement the `Copy` trait - | help: consider borrowing here: `&s.url` + | +help: consider borrowing here + | +LL | let p = &s.url; p + | + error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/move-errors.stderr b/src/test/ui/nll/move-errors.stderr index b03fcf70bab..58b8aa31d4c 100644 --- a/src/test/ui/nll/move-errors.stderr +++ b/src/test/ui/nll/move-errors.stderr @@ -2,10 +2,13 @@ error[E0507]: cannot move out of `*a` which is behind a shared reference --> $DIR/move-errors.rs:6:13 | LL | let b = *a; - | ^^ - | | - | move occurs because `*a` has type `A`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*a` + | ^^ move occurs because `*a` has type `A`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let b = *a; +LL + let b = a; + | error[E0508]: cannot move out of type `[A; 1]`, a non-copy array --> $DIR/move-errors.rs:12:13 @@ -15,25 +18,35 @@ LL | let b = a[0]; | | | cannot move out of here | move occurs because `a[_]` has type `A`, which does not implement the `Copy` trait - | help: consider borrowing here: `&a[0]` + | +help: consider borrowing here + | +LL | let b = &a[0]; + | + error[E0507]: cannot move out of `**r` which is behind a shared reference --> $DIR/move-errors.rs:19:13 | LL | let s = **r; - | ^^^ - | | - | move occurs because `**r` has type `A`, which does not implement the `Copy` trait - | help: consider borrowing here: `&**r` + | ^^^ move occurs because `**r` has type `A`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let s = **r; +LL + let s = *r; + | error[E0507]: cannot move out of an `Rc` --> $DIR/move-errors.rs:27:13 | LL | let s = *r; - | ^^ - | | - | move occurs because value has type `A`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*r` + | ^^ move occurs because value has type `A`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let s = *r; +LL + let s = r; + | error[E0508]: cannot move out of type `[A; 1]`, a non-copy array --> $DIR/move-errors.rs:32:13 @@ -43,16 +56,26 @@ LL | let a = [A("".to_string())][0]; | | | cannot move out of here | move occurs because value has type `A`, which does not implement the `Copy` trait - | help: consider borrowing here: `&[A("".to_string())][0]` + | +help: consider borrowing here + | +LL | let a = &[A("".to_string())][0]; + | + error[E0507]: cannot move out of `a` which is behind a shared reference --> $DIR/move-errors.rs:38:16 | LL | let A(s) = *a; - | - ^^ help: consider borrowing here: `&*a` + | - ^^ | | | data moved here | move occurs because `s` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let A(s) = *a; +LL + let A(s) = a; + | error[E0509]: cannot move out of type `D`, which implements the `Drop` trait --> $DIR/move-errors.rs:44:19 @@ -62,6 +85,11 @@ LL | let C(D(s)) = c; | | | data moved here | move occurs because `s` has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | let C(D(ref s)) = c; + | +++ error[E0507]: cannot move out of `*a` which is behind a shared reference --> $DIR/move-errors.rs:51:9 @@ -73,10 +101,7 @@ error[E0508]: cannot move out of type `[B; 1]`, a non-copy array --> $DIR/move-errors.rs:74:11 | LL | match x[0] { - | ^^^^ - | | - | cannot move out of here - | help: consider borrowing here: `&x[0]` + | ^^^^ cannot move out of here LL | LL | B::U(d) => (), | - data moved here @@ -84,6 +109,10 @@ LL | B::V(s) => (), | - ...and here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider borrowing here + | +LL | match &x[0] { + | + error[E0509]: cannot move out of type `D`, which implements the `Drop` trait --> $DIR/move-errors.rs:83:11 @@ -96,6 +125,11 @@ LL | B::U(D(s)) => (), | | | data moved here | move occurs because `s` has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | B::U(D(ref s)) => (), + | +++ error[E0509]: cannot move out of type `D`, which implements the `Drop` trait --> $DIR/move-errors.rs:92:11 @@ -108,6 +142,11 @@ LL | (D(s), &t) => (), | | | data moved here | move occurs because `s` has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | (D(ref s), &t) => (), + | +++ error[E0507]: cannot move out of `*x.1` which is behind a shared reference --> $DIR/move-errors.rs:92:11 @@ -120,6 +159,11 @@ LL | (D(s), &t) => (), | | | data moved here | move occurs because `t` has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | (D(s), &ref t) => (), + | +++ error[E0509]: cannot move out of type `F`, which implements the `Drop` trait --> $DIR/move-errors.rs:102:11 @@ -133,18 +177,32 @@ LL | F(s, mut t) => (), | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider borrowing the pattern binding + | +LL | F(ref s, mut t) => (), + | +++ +help: consider borrowing the pattern binding + | +LL | F(s, ref mut t) => (), + | +++ error[E0507]: cannot move out of `x` as enum variant `Err` which is behind a shared reference --> $DIR/move-errors.rs:110:11 | LL | match *x { - | ^^ help: consider borrowing here: `&*x` + | ^^ LL | LL | Ok(s) | Err(s) => (), | - | | | data moved here | move occurs because `s` has type `String`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - match *x { +LL + match x { + | error: aborting due to 14 previous errors diff --git a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs index 9b3ec702c75..95c655654ea 100644 --- a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs +++ b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs @@ -8,17 +8,17 @@ type PairCoupledTypes<T> = (T, T); type PairCoupledRegions<'a, T> = (&'a T, &'a T); fn uncoupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - let ((y, _z),) = ((s, _x),): (PairUncoupled<_>,); + let ((y, _z),) = type_ascribe!(((s, _x),), (PairUncoupled<_>,)); y // OK } fn coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - let ((y, _z),) = ((s, _x),): (PairCoupledTypes<_>,); + let ((y, _z),) = type_ascribe!(((s, _x),), (PairCoupledTypes<_>,)); y //~ ERROR lifetime may not live long enough } fn coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { - let ((y, _z),) = ((s, _x),): (PairCoupledRegions<_>,); + let ((y, _z),) = type_ascribe!(((s, _x),), (PairCoupledRegions<_>,)); y //~ ERROR lifetime may not live long enough } diff --git a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr index c99f53c5aa4..8601691e88a 100644 --- a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr +++ b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { | -- lifetime `'a` defined here -LL | let ((y, _z),) = ((s, _x),): (PairCoupledTypes<_>,); +LL | let ((y, _z),) = type_ascribe!(((s, _x),), (PairCoupledTypes<_>,)); LL | y | ^ returning this value requires that `'a` must outlive `'static` @@ -12,7 +12,7 @@ error: lifetime may not live long enough | LL | fn coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { | -- lifetime `'a` defined here -LL | let ((y, _z),) = ((s, _x),): (PairCoupledRegions<_>,); +LL | let ((y, _z),) = type_ascribe!(((s, _x),), (PairCoupledRegions<_>,)); LL | y | ^ returning this value requires that `'a` must outlive `'static` diff --git a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs index 101b5cfabb3..88d646dee7c 100644 --- a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs +++ b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs @@ -3,5 +3,5 @@ fn main() { let x = 22_u32; - let y: &u32 = &x: &'static u32; //~ ERROR E0597 + let y: &u32 = type_ascribe!(&x, &'static u32); //~ ERROR E0597 } diff --git a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr index 133bbef5231..ccbf3c1d927 100644 --- a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr +++ b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr @@ -1,10 +1,10 @@ error[E0597]: `x` does not live long enough - --> $DIR/type_ascription_static_lifetime.rs:6:19 + --> $DIR/type_ascription_static_lifetime.rs:6:33 | -LL | let y: &u32 = &x: &'static u32; - | ^^-------------- - | | - | borrowed value does not live long enough +LL | let y: &u32 = type_ascribe!(&x, &'static u32); + | --------------^^--------------- + | | | + | | borrowed value does not live long enough | type annotation requires that `x` is borrowed for `'static` LL | } | - `x` dropped here while still borrowed diff --git a/src/test/ui/no-capture-arc.stderr b/src/test/ui/no-capture-arc.stderr index 9ae41e78c22..296e1fb3f26 100644 --- a/src/test/ui/no-capture-arc.stderr +++ b/src/test/ui/no-capture-arc.stderr @@ -13,11 +13,6 @@ LL | assert_eq!((*arc_v)[2], 3); | ^^^^^^^^ value borrowed here after move | = note: borrow occurs due to deref coercion to `Vec<i32>` -note: deref defined here - --> $SRC_DIR/alloc/src/sync.rs:LL:COL - | -LL | type Target = T; - | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/no-reuse-move-arc.stderr b/src/test/ui/no-reuse-move-arc.stderr index 564b0585474..bcd481c33f3 100644 --- a/src/test/ui/no-reuse-move-arc.stderr +++ b/src/test/ui/no-reuse-move-arc.stderr @@ -13,11 +13,6 @@ LL | assert_eq!((*arc_v)[2], 3); | ^^^^^^^^ value borrowed here after move | = note: borrow occurs due to deref coercion to `Vec<i32>` -note: deref defined here - --> $SRC_DIR/alloc/src/sync.rs:LL:COL - | -LL | type Target = T; - | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/no-send-res-ports.stderr b/src/test/ui/no-send-res-ports.stderr index c864b93dbbb..75561f4119a 100644 --- a/src/test/ui/no-send-res-ports.stderr +++ b/src/test/ui/no-send-res-ports.stderr @@ -31,9 +31,6 @@ LL | thread::spawn(move|| { | ^^^^^^ note: required by a bound in `spawn` --> $SRC_DIR/std/src/thread/mod.rs:LL:COL - | -LL | F: Send + 'static, - | ^^^^ required by this bound in `spawn` error: aborting due to previous error diff --git a/src/test/ui/not-clone-closure.stderr b/src/test/ui/not-clone-closure.stderr index f61ee661bb7..37d94cf0ebd 100644 --- a/src/test/ui/not-clone-closure.stderr +++ b/src/test/ui/not-clone-closure.stderr @@ -1,13 +1,11 @@ error[E0277]: the trait bound `S: Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]` - --> $DIR/not-clone-closure.rs:11:17 + --> $DIR/not-clone-closure.rs:11:23 | LL | let hello = move || { | ------- within this `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]` ... LL | let hello = hello.clone(); - | ^^^^^ ----- required by a bound introduced by this call - | | - | within `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`, the trait `Clone` is not implemented for `S` + | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 7:24]`, the trait `Clone` is not implemented for `S` | note: required because it's used within this closure --> $DIR/not-clone-closure.rs:7:17 diff --git a/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr b/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr index 6aa1ad8dd89..8f0eef237cf 100644 --- a/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr +++ b/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr @@ -6,15 +6,10 @@ LL | x + 100.0 | = help: the trait `Add<{float}>` is not implemented for `u8` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> - <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> - <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> - <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&'a u8 as Add<u8>> + <&u8 as Add<&u8>> + <u8 as Add<&u8>> + <u8 as Add> error[E0277]: cannot add `&str` to `f64` --> $DIR/not-suggest-float-literal.rs:6:7 @@ -24,15 +19,10 @@ LL | x + "foo" | = help: the trait `Add<&str>` is not implemented for `f64` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> - <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> - <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&f64 as Add<&f64>> + <f64 as Add<&f64>> + <f64 as Add> error[E0277]: cannot add `{integer}` to `f64` --> $DIR/not-suggest-float-literal.rs:11:7 @@ -42,15 +32,10 @@ LL | x + y | = help: the trait `Add<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> - <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> - <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&f64 as Add<&f64>> + <f64 as Add<&f64>> + <f64 as Add> error[E0277]: cannot subtract `{float}` from `u8` --> $DIR/not-suggest-float-literal.rs:15:7 @@ -60,15 +45,10 @@ LL | x - 100.0 | = help: the trait `Sub<{float}>` is not implemented for `u8` = help: the following other types implement trait `Sub<Rhs>`: - <&'a f32 as Sub<f32>> - <&'a f64 as Sub<f64>> - <&'a i128 as Sub<i128>> - <&'a i16 as Sub<i16>> - <&'a i32 as Sub<i32>> - <&'a i64 as Sub<i64>> - <&'a i8 as Sub<i8>> - <&'a isize as Sub<isize>> - and 48 others + <&'a u8 as Sub<u8>> + <&u8 as Sub<&u8>> + <u8 as Sub<&u8>> + <u8 as Sub> error[E0277]: cannot subtract `&str` from `f64` --> $DIR/not-suggest-float-literal.rs:19:7 @@ -78,15 +58,10 @@ LL | x - "foo" | = help: the trait `Sub<&str>` is not implemented for `f64` = help: the following other types implement trait `Sub<Rhs>`: - <&'a f32 as Sub<f32>> <&'a f64 as Sub<f64>> - <&'a i128 as Sub<i128>> - <&'a i16 as Sub<i16>> - <&'a i32 as Sub<i32>> - <&'a i64 as Sub<i64>> - <&'a i8 as Sub<i8>> - <&'a isize as Sub<isize>> - and 48 others + <&f64 as Sub<&f64>> + <f64 as Sub<&f64>> + <f64 as Sub> error[E0277]: cannot subtract `{integer}` from `f64` --> $DIR/not-suggest-float-literal.rs:24:7 @@ -96,15 +71,10 @@ LL | x - y | = help: the trait `Sub<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Sub<Rhs>`: - <&'a f32 as Sub<f32>> <&'a f64 as Sub<f64>> - <&'a i128 as Sub<i128>> - <&'a i16 as Sub<i16>> - <&'a i32 as Sub<i32>> - <&'a i64 as Sub<i64>> - <&'a i8 as Sub<i8>> - <&'a isize as Sub<isize>> - and 48 others + <&f64 as Sub<&f64>> + <f64 as Sub<&f64>> + <f64 as Sub> error[E0277]: cannot multiply `u8` by `{float}` --> $DIR/not-suggest-float-literal.rs:28:7 @@ -114,15 +84,10 @@ LL | x * 100.0 | = help: the trait `Mul<{float}>` is not implemented for `u8` = help: the following other types implement trait `Mul<Rhs>`: - <&'a f32 as Mul<f32>> - <&'a f64 as Mul<f64>> - <&'a i128 as Mul<i128>> - <&'a i16 as Mul<i16>> - <&'a i32 as Mul<i32>> - <&'a i64 as Mul<i64>> - <&'a i8 as Mul<i8>> - <&'a isize as Mul<isize>> - and 49 others + <&'a u8 as Mul<u8>> + <&u8 as Mul<&u8>> + <u8 as Mul<&u8>> + <u8 as Mul> error[E0277]: cannot multiply `f64` by `&str` --> $DIR/not-suggest-float-literal.rs:32:7 @@ -132,15 +97,10 @@ LL | x * "foo" | = help: the trait `Mul<&str>` is not implemented for `f64` = help: the following other types implement trait `Mul<Rhs>`: - <&'a f32 as Mul<f32>> <&'a f64 as Mul<f64>> - <&'a i128 as Mul<i128>> - <&'a i16 as Mul<i16>> - <&'a i32 as Mul<i32>> - <&'a i64 as Mul<i64>> - <&'a i8 as Mul<i8>> - <&'a isize as Mul<isize>> - and 49 others + <&f64 as Mul<&f64>> + <f64 as Mul<&f64>> + <f64 as Mul> error[E0277]: cannot multiply `f64` by `{integer}` --> $DIR/not-suggest-float-literal.rs:37:7 @@ -150,15 +110,10 @@ LL | x * y | = help: the trait `Mul<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Mul<Rhs>`: - <&'a f32 as Mul<f32>> <&'a f64 as Mul<f64>> - <&'a i128 as Mul<i128>> - <&'a i16 as Mul<i16>> - <&'a i32 as Mul<i32>> - <&'a i64 as Mul<i64>> - <&'a i8 as Mul<i8>> - <&'a isize as Mul<isize>> - and 49 others + <&f64 as Mul<&f64>> + <f64 as Mul<&f64>> + <f64 as Mul> error[E0277]: cannot divide `u8` by `{float}` --> $DIR/not-suggest-float-literal.rs:41:7 @@ -168,15 +123,11 @@ LL | x / 100.0 | = help: the trait `Div<{float}>` is not implemented for `u8` = help: the following other types implement trait `Div<Rhs>`: - <&'a f32 as Div<f32>> - <&'a f64 as Div<f64>> - <&'a i128 as Div<i128>> - <&'a i16 as Div<i16>> - <&'a i32 as Div<i32>> - <&'a i64 as Div<i64>> - <&'a i8 as Div<i8>> - <&'a isize as Div<isize>> - and 54 others + <&'a u8 as Div<u8>> + <&u8 as Div<&u8>> + <u8 as Div<&u8>> + <u8 as Div<NonZeroU8>> + <u8 as Div> error[E0277]: cannot divide `f64` by `&str` --> $DIR/not-suggest-float-literal.rs:45:7 @@ -186,15 +137,10 @@ LL | x / "foo" | = help: the trait `Div<&str>` is not implemented for `f64` = help: the following other types implement trait `Div<Rhs>`: - <&'a f32 as Div<f32>> <&'a f64 as Div<f64>> - <&'a i128 as Div<i128>> - <&'a i16 as Div<i16>> - <&'a i32 as Div<i32>> - <&'a i64 as Div<i64>> - <&'a i8 as Div<i8>> - <&'a isize as Div<isize>> - and 54 others + <&f64 as Div<&f64>> + <f64 as Div<&f64>> + <f64 as Div> error[E0277]: cannot divide `f64` by `{integer}` --> $DIR/not-suggest-float-literal.rs:50:7 @@ -204,15 +150,10 @@ LL | x / y | = help: the trait `Div<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Div<Rhs>`: - <&'a f32 as Div<f32>> <&'a f64 as Div<f64>> - <&'a i128 as Div<i128>> - <&'a i16 as Div<i16>> - <&'a i32 as Div<i32>> - <&'a i64 as Div<i64>> - <&'a i8 as Div<i8>> - <&'a isize as Div<isize>> - and 54 others + <&f64 as Div<&f64>> + <f64 as Div<&f64>> + <f64 as Div> error: aborting due to 12 previous errors diff --git a/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr b/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr index 988379e582a..03779d35637 100644 --- a/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr +++ b/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr @@ -7,14 +7,9 @@ LL | x + 100 = help: the trait `Add<{integer}>` is not implemented for `f32` = help: the following other types implement trait `Add<Rhs>`: <&'a f32 as Add<f32>> - <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> - <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> - <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&f32 as Add<&f32>> + <f32 as Add<&f32>> + <f32 as Add> help: consider using a floating-point literal by writing it with `.0` | LL | x + 100.0 @@ -28,15 +23,10 @@ LL | x + 100 | = help: the trait `Add<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> - <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> - <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&f64 as Add<&f64>> + <f64 as Add<&f64>> + <f64 as Add> help: consider using a floating-point literal by writing it with `.0` | LL | x + 100.0 @@ -51,14 +41,9 @@ LL | x - 100 = help: the trait `Sub<{integer}>` is not implemented for `f32` = help: the following other types implement trait `Sub<Rhs>`: <&'a f32 as Sub<f32>> - <&'a f64 as Sub<f64>> - <&'a i128 as Sub<i128>> - <&'a i16 as Sub<i16>> - <&'a i32 as Sub<i32>> - <&'a i64 as Sub<i64>> - <&'a i8 as Sub<i8>> - <&'a isize as Sub<isize>> - and 48 others + <&f32 as Sub<&f32>> + <f32 as Sub<&f32>> + <f32 as Sub> help: consider using a floating-point literal by writing it with `.0` | LL | x - 100.0 @@ -72,15 +57,10 @@ LL | x - 100 | = help: the trait `Sub<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Sub<Rhs>`: - <&'a f32 as Sub<f32>> <&'a f64 as Sub<f64>> - <&'a i128 as Sub<i128>> - <&'a i16 as Sub<i16>> - <&'a i32 as Sub<i32>> - <&'a i64 as Sub<i64>> - <&'a i8 as Sub<i8>> - <&'a isize as Sub<isize>> - and 48 others + <&f64 as Sub<&f64>> + <f64 as Sub<&f64>> + <f64 as Sub> help: consider using a floating-point literal by writing it with `.0` | LL | x - 100.0 @@ -95,14 +75,9 @@ LL | x * 100 = help: the trait `Mul<{integer}>` is not implemented for `f32` = help: the following other types implement trait `Mul<Rhs>`: <&'a f32 as Mul<f32>> - <&'a f64 as Mul<f64>> - <&'a i128 as Mul<i128>> - <&'a i16 as Mul<i16>> - <&'a i32 as Mul<i32>> - <&'a i64 as Mul<i64>> - <&'a i8 as Mul<i8>> - <&'a isize as Mul<isize>> - and 49 others + <&f32 as Mul<&f32>> + <f32 as Mul<&f32>> + <f32 as Mul> help: consider using a floating-point literal by writing it with `.0` | LL | x * 100.0 @@ -116,15 +91,10 @@ LL | x * 100 | = help: the trait `Mul<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Mul<Rhs>`: - <&'a f32 as Mul<f32>> <&'a f64 as Mul<f64>> - <&'a i128 as Mul<i128>> - <&'a i16 as Mul<i16>> - <&'a i32 as Mul<i32>> - <&'a i64 as Mul<i64>> - <&'a i8 as Mul<i8>> - <&'a isize as Mul<isize>> - and 49 others + <&f64 as Mul<&f64>> + <f64 as Mul<&f64>> + <f64 as Mul> help: consider using a floating-point literal by writing it with `.0` | LL | x * 100.0 @@ -139,14 +109,9 @@ LL | x / 100 = help: the trait `Div<{integer}>` is not implemented for `f32` = help: the following other types implement trait `Div<Rhs>`: <&'a f32 as Div<f32>> - <&'a f64 as Div<f64>> - <&'a i128 as Div<i128>> - <&'a i16 as Div<i16>> - <&'a i32 as Div<i32>> - <&'a i64 as Div<i64>> - <&'a i8 as Div<i8>> - <&'a isize as Div<isize>> - and 54 others + <&f32 as Div<&f32>> + <f32 as Div<&f32>> + <f32 as Div> help: consider using a floating-point literal by writing it with `.0` | LL | x / 100.0 @@ -160,15 +125,10 @@ LL | x / 100 | = help: the trait `Div<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Div<Rhs>`: - <&'a f32 as Div<f32>> <&'a f64 as Div<f64>> - <&'a i128 as Div<i128>> - <&'a i16 as Div<i16>> - <&'a i32 as Div<i32>> - <&'a i64 as Div<i64>> - <&'a i8 as Div<i8>> - <&'a isize as Div<isize>> - and 54 others + <&f64 as Div<&f64>> + <f64 as Div<&f64>> + <f64 as Div> help: consider using a floating-point literal by writing it with `.0` | LL | x / 100.0 diff --git a/src/test/ui/numeric/numeric-cast-binop.stderr b/src/test/ui/numeric/numeric-cast-binop.stderr index 2f58f164985..d5213e3f5b6 100644 --- a/src/test/ui/numeric/numeric-cast-binop.stderr +++ b/src/test/ui/numeric/numeric-cast-binop.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:23:16 | LL | x_u8 > x_u16; - | ^^^^^ expected `u8`, found `u16` + | ---- ^^^^^ expected `u8`, found `u16` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `u16`, matching the type of `x_u16` | @@ -13,7 +15,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:25:16 | LL | x_u8 > x_u32; - | ^^^^^ expected `u8`, found `u32` + | ---- ^^^^^ expected `u8`, found `u32` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `u32`, matching the type of `x_u32` | @@ -24,7 +28,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:27:16 | LL | x_u8 > x_u64; - | ^^^^^ expected `u8`, found `u64` + | ---- ^^^^^ expected `u8`, found `u64` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `u64`, matching the type of `x_u64` | @@ -35,7 +41,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:29:16 | LL | x_u8 > x_u128; - | ^^^^^^ expected `u8`, found `u128` + | ---- ^^^^^^ expected `u8`, found `u128` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `u128`, matching the type of `x_u128` | @@ -46,7 +54,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:31:16 | LL | x_u8 > x_usize; - | ^^^^^^^ expected `u8`, found `usize` + | ---- ^^^^^^^ expected `u8`, found `usize` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `usize`, matching the type of `x_usize` | @@ -57,7 +67,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:34:17 | LL | x_u16 > x_u8; - | ^^^^ expected `u16`, found `u8` + | ----- ^^^^ expected `u16`, found `u8` + | | + | expected because this is `u16` | help: you can convert a `u8` to a `u16` | @@ -68,7 +80,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:36:17 | LL | x_u16 > x_u32; - | ^^^^^ expected `u16`, found `u32` + | ----- ^^^^^ expected `u16`, found `u32` + | | + | expected because this is `u16` | help: you can convert `x_u16` from `u16` to `u32`, matching the type of `x_u32` | @@ -79,7 +93,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:38:17 | LL | x_u16 > x_u64; - | ^^^^^ expected `u16`, found `u64` + | ----- ^^^^^ expected `u16`, found `u64` + | | + | expected because this is `u16` | help: you can convert `x_u16` from `u16` to `u64`, matching the type of `x_u64` | @@ -90,7 +106,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:40:17 | LL | x_u16 > x_u128; - | ^^^^^^ expected `u16`, found `u128` + | ----- ^^^^^^ expected `u16`, found `u128` + | | + | expected because this is `u16` | help: you can convert `x_u16` from `u16` to `u128`, matching the type of `x_u128` | @@ -101,7 +119,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:42:17 | LL | x_u16 > x_usize; - | ^^^^^^^ expected `u16`, found `usize` + | ----- ^^^^^^^ expected `u16`, found `usize` + | | + | expected because this is `u16` | help: you can convert `x_u16` from `u16` to `usize`, matching the type of `x_usize` | @@ -112,7 +132,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:45:17 | LL | x_u32 > x_u8; - | ^^^^ expected `u32`, found `u8` + | ----- ^^^^ expected `u32`, found `u8` + | | + | expected because this is `u32` | help: you can convert a `u8` to a `u32` | @@ -123,7 +145,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:47:17 | LL | x_u32 > x_u16; - | ^^^^^ expected `u32`, found `u16` + | ----- ^^^^^ expected `u32`, found `u16` + | | + | expected because this is `u32` | help: you can convert a `u16` to a `u32` | @@ -134,7 +158,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:49:17 | LL | x_u32 > x_u64; - | ^^^^^ expected `u32`, found `u64` + | ----- ^^^^^ expected `u32`, found `u64` + | | + | expected because this is `u32` | help: you can convert `x_u32` from `u32` to `u64`, matching the type of `x_u64` | @@ -145,7 +171,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:51:17 | LL | x_u32 > x_u128; - | ^^^^^^ expected `u32`, found `u128` + | ----- ^^^^^^ expected `u32`, found `u128` + | | + | expected because this is `u32` | help: you can convert `x_u32` from `u32` to `u128`, matching the type of `x_u128` | @@ -156,7 +184,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:53:17 | LL | x_u32 > x_usize; - | ^^^^^^^ expected `u32`, found `usize` + | ----- ^^^^^^^ expected `u32`, found `usize` + | | + | expected because this is `u32` | help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit | @@ -167,7 +197,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:56:17 | LL | x_u64 > x_u8; - | ^^^^ expected `u64`, found `u8` + | ----- ^^^^ expected `u64`, found `u8` + | | + | expected because this is `u64` | help: you can convert a `u8` to a `u64` | @@ -178,7 +210,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:58:17 | LL | x_u64 > x_u16; - | ^^^^^ expected `u64`, found `u16` + | ----- ^^^^^ expected `u64`, found `u16` + | | + | expected because this is `u64` | help: you can convert a `u16` to a `u64` | @@ -189,7 +223,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:60:17 | LL | x_u64 > x_u32; - | ^^^^^ expected `u64`, found `u32` + | ----- ^^^^^ expected `u64`, found `u32` + | | + | expected because this is `u64` | help: you can convert a `u32` to a `u64` | @@ -200,7 +236,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:62:17 | LL | x_u64 > x_u128; - | ^^^^^^ expected `u64`, found `u128` + | ----- ^^^^^^ expected `u64`, found `u128` + | | + | expected because this is `u64` | help: you can convert `x_u64` from `u64` to `u128`, matching the type of `x_u128` | @@ -211,7 +249,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:64:17 | LL | x_u64 > x_usize; - | ^^^^^^^ expected `u64`, found `usize` + | ----- ^^^^^^^ expected `u64`, found `usize` + | | + | expected because this is `u64` | help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit | @@ -222,7 +262,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:67:18 | LL | x_u128 > x_u8; - | ^^^^ expected `u128`, found `u8` + | ------ ^^^^ expected `u128`, found `u8` + | | + | expected because this is `u128` | help: you can convert a `u8` to a `u128` | @@ -233,7 +275,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:69:18 | LL | x_u128 > x_u16; - | ^^^^^ expected `u128`, found `u16` + | ------ ^^^^^ expected `u128`, found `u16` + | | + | expected because this is `u128` | help: you can convert a `u16` to a `u128` | @@ -244,7 +288,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:71:18 | LL | x_u128 > x_u32; - | ^^^^^ expected `u128`, found `u32` + | ------ ^^^^^ expected `u128`, found `u32` + | | + | expected because this is `u128` | help: you can convert a `u32` to a `u128` | @@ -255,7 +301,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:73:18 | LL | x_u128 > x_u64; - | ^^^^^ expected `u128`, found `u64` + | ------ ^^^^^ expected `u128`, found `u64` + | | + | expected because this is `u128` | help: you can convert a `u64` to a `u128` | @@ -266,7 +314,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:75:18 | LL | x_u128 > x_usize; - | ^^^^^^^ expected `u128`, found `usize` + | ------ ^^^^^^^ expected `u128`, found `usize` + | | + | expected because this is `u128` | help: you can convert a `usize` to a `u128` and panic if the converted value doesn't fit | @@ -277,7 +327,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:78:19 | LL | x_usize > x_u8; - | ^^^^ expected `usize`, found `u8` + | ------- ^^^^ expected `usize`, found `u8` + | | + | expected because this is `usize` | help: you can convert a `u8` to a `usize` | @@ -288,7 +340,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:80:19 | LL | x_usize > x_u16; - | ^^^^^ expected `usize`, found `u16` + | ------- ^^^^^ expected `usize`, found `u16` + | | + | expected because this is `usize` | help: you can convert a `u16` to a `usize` | @@ -299,7 +353,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:82:19 | LL | x_usize > x_u32; - | ^^^^^ expected `usize`, found `u32` + | ------- ^^^^^ expected `usize`, found `u32` + | | + | expected because this is `usize` | help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit | @@ -310,7 +366,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:84:19 | LL | x_usize > x_u64; - | ^^^^^ expected `usize`, found `u64` + | ------- ^^^^^ expected `usize`, found `u64` + | | + | expected because this is `usize` | help: you can convert a `u64` to a `usize` and panic if the converted value doesn't fit | @@ -321,7 +379,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:86:19 | LL | x_usize > x_u128; - | ^^^^^^ expected `usize`, found `u128` + | ------- ^^^^^^ expected `usize`, found `u128` + | | + | expected because this is `usize` | help: you can convert a `u128` to a `usize` and panic if the converted value doesn't fit | @@ -332,7 +392,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:92:16 | LL | x_i8 > x_i16; - | ^^^^^ expected `i8`, found `i16` + | ---- ^^^^^ expected `i8`, found `i16` + | | + | expected because this is `i8` | help: you can convert `x_i8` from `i8` to `i16`, matching the type of `x_i16` | @@ -343,7 +405,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:94:16 | LL | x_i8 > x_i32; - | ^^^^^ expected `i8`, found `i32` + | ---- ^^^^^ expected `i8`, found `i32` + | | + | expected because this is `i8` | help: you can convert `x_i8` from `i8` to `i32`, matching the type of `x_i32` | @@ -354,7 +418,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:96:16 | LL | x_i8 > x_i64; - | ^^^^^ expected `i8`, found `i64` + | ---- ^^^^^ expected `i8`, found `i64` + | | + | expected because this is `i8` | help: you can convert `x_i8` from `i8` to `i64`, matching the type of `x_i64` | @@ -365,7 +431,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:98:16 | LL | x_i8 > x_i128; - | ^^^^^^ expected `i8`, found `i128` + | ---- ^^^^^^ expected `i8`, found `i128` + | | + | expected because this is `i8` | help: you can convert `x_i8` from `i8` to `i128`, matching the type of `x_i128` | @@ -376,7 +444,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:100:16 | LL | x_i8 > x_isize; - | ^^^^^^^ expected `i8`, found `isize` + | ---- ^^^^^^^ expected `i8`, found `isize` + | | + | expected because this is `i8` | help: you can convert `x_i8` from `i8` to `isize`, matching the type of `x_isize` | @@ -387,7 +457,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:103:17 | LL | x_i16 > x_i8; - | ^^^^ expected `i16`, found `i8` + | ----- ^^^^ expected `i16`, found `i8` + | | + | expected because this is `i16` | help: you can convert an `i8` to an `i16` | @@ -398,7 +470,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:105:17 | LL | x_i16 > x_i32; - | ^^^^^ expected `i16`, found `i32` + | ----- ^^^^^ expected `i16`, found `i32` + | | + | expected because this is `i16` | help: you can convert `x_i16` from `i16` to `i32`, matching the type of `x_i32` | @@ -409,7 +483,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:107:17 | LL | x_i16 > x_i64; - | ^^^^^ expected `i16`, found `i64` + | ----- ^^^^^ expected `i16`, found `i64` + | | + | expected because this is `i16` | help: you can convert `x_i16` from `i16` to `i64`, matching the type of `x_i64` | @@ -420,7 +496,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:109:17 | LL | x_i16 > x_i128; - | ^^^^^^ expected `i16`, found `i128` + | ----- ^^^^^^ expected `i16`, found `i128` + | | + | expected because this is `i16` | help: you can convert `x_i16` from `i16` to `i128`, matching the type of `x_i128` | @@ -431,7 +509,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:111:17 | LL | x_i16 > x_isize; - | ^^^^^^^ expected `i16`, found `isize` + | ----- ^^^^^^^ expected `i16`, found `isize` + | | + | expected because this is `i16` | help: you can convert `x_i16` from `i16` to `isize`, matching the type of `x_isize` | @@ -442,7 +522,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:114:17 | LL | x_i32 > x_i8; - | ^^^^ expected `i32`, found `i8` + | ----- ^^^^ expected `i32`, found `i8` + | | + | expected because this is `i32` | help: you can convert an `i8` to an `i32` | @@ -453,7 +535,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:116:17 | LL | x_i32 > x_i16; - | ^^^^^ expected `i32`, found `i16` + | ----- ^^^^^ expected `i32`, found `i16` + | | + | expected because this is `i32` | help: you can convert an `i16` to an `i32` | @@ -464,7 +548,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:118:17 | LL | x_i32 > x_i64; - | ^^^^^ expected `i32`, found `i64` + | ----- ^^^^^ expected `i32`, found `i64` + | | + | expected because this is `i32` | help: you can convert `x_i32` from `i32` to `i64`, matching the type of `x_i64` | @@ -475,7 +561,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:120:17 | LL | x_i32 > x_i128; - | ^^^^^^ expected `i32`, found `i128` + | ----- ^^^^^^ expected `i32`, found `i128` + | | + | expected because this is `i32` | help: you can convert `x_i32` from `i32` to `i128`, matching the type of `x_i128` | @@ -486,7 +574,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:122:17 | LL | x_i32 > x_isize; - | ^^^^^^^ expected `i32`, found `isize` + | ----- ^^^^^^^ expected `i32`, found `isize` + | | + | expected because this is `i32` | help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit | @@ -497,7 +587,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:125:17 | LL | x_i64 > x_i8; - | ^^^^ expected `i64`, found `i8` + | ----- ^^^^ expected `i64`, found `i8` + | | + | expected because this is `i64` | help: you can convert an `i8` to an `i64` | @@ -508,7 +600,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:127:17 | LL | x_i64 > x_i16; - | ^^^^^ expected `i64`, found `i16` + | ----- ^^^^^ expected `i64`, found `i16` + | | + | expected because this is `i64` | help: you can convert an `i16` to an `i64` | @@ -519,7 +613,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:129:17 | LL | x_i64 > x_i32; - | ^^^^^ expected `i64`, found `i32` + | ----- ^^^^^ expected `i64`, found `i32` + | | + | expected because this is `i64` | help: you can convert an `i32` to an `i64` | @@ -530,7 +626,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:131:17 | LL | x_i64 > x_i128; - | ^^^^^^ expected `i64`, found `i128` + | ----- ^^^^^^ expected `i64`, found `i128` + | | + | expected because this is `i64` | help: you can convert `x_i64` from `i64` to `i128`, matching the type of `x_i128` | @@ -541,7 +639,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:133:17 | LL | x_i64 > x_isize; - | ^^^^^^^ expected `i64`, found `isize` + | ----- ^^^^^^^ expected `i64`, found `isize` + | | + | expected because this is `i64` | help: you can convert an `isize` to an `i64` and panic if the converted value doesn't fit | @@ -552,7 +652,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:136:18 | LL | x_i128 > x_i8; - | ^^^^ expected `i128`, found `i8` + | ------ ^^^^ expected `i128`, found `i8` + | | + | expected because this is `i128` | help: you can convert an `i8` to an `i128` | @@ -563,7 +665,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:138:18 | LL | x_i128 > x_i16; - | ^^^^^ expected `i128`, found `i16` + | ------ ^^^^^ expected `i128`, found `i16` + | | + | expected because this is `i128` | help: you can convert an `i16` to an `i128` | @@ -574,7 +678,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:140:18 | LL | x_i128 > x_i32; - | ^^^^^ expected `i128`, found `i32` + | ------ ^^^^^ expected `i128`, found `i32` + | | + | expected because this is `i128` | help: you can convert an `i32` to an `i128` | @@ -585,7 +691,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:142:18 | LL | x_i128 > x_i64; - | ^^^^^ expected `i128`, found `i64` + | ------ ^^^^^ expected `i128`, found `i64` + | | + | expected because this is `i128` | help: you can convert an `i64` to an `i128` | @@ -596,7 +704,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:144:18 | LL | x_i128 > x_isize; - | ^^^^^^^ expected `i128`, found `isize` + | ------ ^^^^^^^ expected `i128`, found `isize` + | | + | expected because this is `i128` | help: you can convert an `isize` to an `i128` and panic if the converted value doesn't fit | @@ -607,7 +717,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:147:19 | LL | x_isize > x_i8; - | ^^^^ expected `isize`, found `i8` + | ------- ^^^^ expected `isize`, found `i8` + | | + | expected because this is `isize` | help: you can convert an `i8` to an `isize` | @@ -618,7 +730,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:149:19 | LL | x_isize > x_i16; - | ^^^^^ expected `isize`, found `i16` + | ------- ^^^^^ expected `isize`, found `i16` + | | + | expected because this is `isize` | help: you can convert an `i16` to an `isize` | @@ -629,7 +743,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:151:19 | LL | x_isize > x_i32; - | ^^^^^ expected `isize`, found `i32` + | ------- ^^^^^ expected `isize`, found `i32` + | | + | expected because this is `isize` | help: you can convert an `i32` to an `isize` and panic if the converted value doesn't fit | @@ -640,7 +756,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:153:19 | LL | x_isize > x_i64; - | ^^^^^ expected `isize`, found `i64` + | ------- ^^^^^ expected `isize`, found `i64` + | | + | expected because this is `isize` | help: you can convert an `i64` to an `isize` and panic if the converted value doesn't fit | @@ -651,7 +769,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:155:19 | LL | x_isize > x_i128; - | ^^^^^^ expected `isize`, found `i128` + | ------- ^^^^^^ expected `isize`, found `i128` + | | + | expected because this is `isize` | help: you can convert an `i128` to an `isize` and panic if the converted value doesn't fit | @@ -662,7 +782,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:161:16 | LL | x_u8 > x_i8; - | ^^^^ expected `u8`, found `i8` + | ---- ^^^^ expected `u8`, found `i8` + | | + | expected because this is `u8` | help: you can convert an `i8` to a `u8` and panic if the converted value doesn't fit | @@ -673,7 +795,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:163:16 | LL | x_u8 > x_i16; - | ^^^^^ expected `u8`, found `i16` + | ---- ^^^^^ expected `u8`, found `i16` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `i16`, matching the type of `x_i16` | @@ -684,7 +808,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:165:16 | LL | x_u8 > x_i32; - | ^^^^^ expected `u8`, found `i32` + | ---- ^^^^^ expected `u8`, found `i32` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `i32`, matching the type of `x_i32` | @@ -695,7 +821,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:167:16 | LL | x_u8 > x_i64; - | ^^^^^ expected `u8`, found `i64` + | ---- ^^^^^ expected `u8`, found `i64` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `i64`, matching the type of `x_i64` | @@ -706,7 +834,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:169:16 | LL | x_u8 > x_i128; - | ^^^^^^ expected `u8`, found `i128` + | ---- ^^^^^^ expected `u8`, found `i128` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `i128`, matching the type of `x_i128` | @@ -717,7 +847,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:171:16 | LL | x_u8 > x_isize; - | ^^^^^^^ expected `u8`, found `isize` + | ---- ^^^^^^^ expected `u8`, found `isize` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `isize`, matching the type of `x_isize` | @@ -728,7 +860,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:174:17 | LL | x_u16 > x_i8; - | ^^^^ expected `u16`, found `i8` + | ----- ^^^^ expected `u16`, found `i8` + | | + | expected because this is `u16` | help: you can convert an `i8` to a `u16` and panic if the converted value doesn't fit | @@ -739,7 +873,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:176:17 | LL | x_u16 > x_i16; - | ^^^^^ expected `u16`, found `i16` + | ----- ^^^^^ expected `u16`, found `i16` + | | + | expected because this is `u16` | help: you can convert an `i16` to a `u16` and panic if the converted value doesn't fit | @@ -750,7 +886,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:178:17 | LL | x_u16 > x_i32; - | ^^^^^ expected `u16`, found `i32` + | ----- ^^^^^ expected `u16`, found `i32` + | | + | expected because this is `u16` | help: you can convert `x_u16` from `u16` to `i32`, matching the type of `x_i32` | @@ -761,7 +899,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:180:17 | LL | x_u16 > x_i64; - | ^^^^^ expected `u16`, found `i64` + | ----- ^^^^^ expected `u16`, found `i64` + | | + | expected because this is `u16` | help: you can convert `x_u16` from `u16` to `i64`, matching the type of `x_i64` | @@ -772,7 +912,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:182:17 | LL | x_u16 > x_i128; - | ^^^^^^ expected `u16`, found `i128` + | ----- ^^^^^^ expected `u16`, found `i128` + | | + | expected because this is `u16` | help: you can convert `x_u16` from `u16` to `i128`, matching the type of `x_i128` | @@ -783,7 +925,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:184:17 | LL | x_u16 > x_isize; - | ^^^^^^^ expected `u16`, found `isize` + | ----- ^^^^^^^ expected `u16`, found `isize` + | | + | expected because this is `u16` | help: you can convert an `isize` to a `u16` and panic if the converted value doesn't fit | @@ -794,7 +938,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:187:17 | LL | x_u32 > x_i8; - | ^^^^ expected `u32`, found `i8` + | ----- ^^^^ expected `u32`, found `i8` + | | + | expected because this is `u32` | help: you can convert an `i8` to a `u32` and panic if the converted value doesn't fit | @@ -805,7 +951,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:189:17 | LL | x_u32 > x_i16; - | ^^^^^ expected `u32`, found `i16` + | ----- ^^^^^ expected `u32`, found `i16` + | | + | expected because this is `u32` | help: you can convert an `i16` to a `u32` and panic if the converted value doesn't fit | @@ -816,7 +964,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:191:17 | LL | x_u32 > x_i32; - | ^^^^^ expected `u32`, found `i32` + | ----- ^^^^^ expected `u32`, found `i32` + | | + | expected because this is `u32` | help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit | @@ -827,7 +977,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:193:17 | LL | x_u32 > x_i64; - | ^^^^^ expected `u32`, found `i64` + | ----- ^^^^^ expected `u32`, found `i64` + | | + | expected because this is `u32` | help: you can convert `x_u32` from `u32` to `i64`, matching the type of `x_i64` | @@ -838,7 +990,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:195:17 | LL | x_u32 > x_i128; - | ^^^^^^ expected `u32`, found `i128` + | ----- ^^^^^^ expected `u32`, found `i128` + | | + | expected because this is `u32` | help: you can convert `x_u32` from `u32` to `i128`, matching the type of `x_i128` | @@ -849,7 +1003,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:197:17 | LL | x_u32 > x_isize; - | ^^^^^^^ expected `u32`, found `isize` + | ----- ^^^^^^^ expected `u32`, found `isize` + | | + | expected because this is `u32` | help: you can convert an `isize` to a `u32` and panic if the converted value doesn't fit | @@ -860,7 +1016,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:200:17 | LL | x_u64 > x_i8; - | ^^^^ expected `u64`, found `i8` + | ----- ^^^^ expected `u64`, found `i8` + | | + | expected because this is `u64` | help: you can convert an `i8` to a `u64` and panic if the converted value doesn't fit | @@ -871,7 +1029,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:202:17 | LL | x_u64 > x_i16; - | ^^^^^ expected `u64`, found `i16` + | ----- ^^^^^ expected `u64`, found `i16` + | | + | expected because this is `u64` | help: you can convert an `i16` to a `u64` and panic if the converted value doesn't fit | @@ -882,7 +1042,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:204:17 | LL | x_u64 > x_i32; - | ^^^^^ expected `u64`, found `i32` + | ----- ^^^^^ expected `u64`, found `i32` + | | + | expected because this is `u64` | help: you can convert an `i32` to a `u64` and panic if the converted value doesn't fit | @@ -893,7 +1055,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:206:17 | LL | x_u64 > x_i64; - | ^^^^^ expected `u64`, found `i64` + | ----- ^^^^^ expected `u64`, found `i64` + | | + | expected because this is `u64` | help: you can convert an `i64` to a `u64` and panic if the converted value doesn't fit | @@ -904,7 +1068,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:208:17 | LL | x_u64 > x_i128; - | ^^^^^^ expected `u64`, found `i128` + | ----- ^^^^^^ expected `u64`, found `i128` + | | + | expected because this is `u64` | help: you can convert `x_u64` from `u64` to `i128`, matching the type of `x_i128` | @@ -915,7 +1081,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:210:17 | LL | x_u64 > x_isize; - | ^^^^^^^ expected `u64`, found `isize` + | ----- ^^^^^^^ expected `u64`, found `isize` + | | + | expected because this is `u64` | help: you can convert an `isize` to a `u64` and panic if the converted value doesn't fit | @@ -926,7 +1094,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:213:18 | LL | x_u128 > x_i8; - | ^^^^ expected `u128`, found `i8` + | ------ ^^^^ expected `u128`, found `i8` + | | + | expected because this is `u128` | help: you can convert an `i8` to a `u128` and panic if the converted value doesn't fit | @@ -937,7 +1107,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:215:18 | LL | x_u128 > x_i16; - | ^^^^^ expected `u128`, found `i16` + | ------ ^^^^^ expected `u128`, found `i16` + | | + | expected because this is `u128` | help: you can convert an `i16` to a `u128` and panic if the converted value doesn't fit | @@ -948,7 +1120,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:217:18 | LL | x_u128 > x_i32; - | ^^^^^ expected `u128`, found `i32` + | ------ ^^^^^ expected `u128`, found `i32` + | | + | expected because this is `u128` | help: you can convert an `i32` to a `u128` and panic if the converted value doesn't fit | @@ -959,7 +1133,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:219:18 | LL | x_u128 > x_i64; - | ^^^^^ expected `u128`, found `i64` + | ------ ^^^^^ expected `u128`, found `i64` + | | + | expected because this is `u128` | help: you can convert an `i64` to a `u128` and panic if the converted value doesn't fit | @@ -970,7 +1146,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:221:18 | LL | x_u128 > x_i128; - | ^^^^^^ expected `u128`, found `i128` + | ------ ^^^^^^ expected `u128`, found `i128` + | | + | expected because this is `u128` | help: you can convert an `i128` to a `u128` and panic if the converted value doesn't fit | @@ -981,7 +1159,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:223:18 | LL | x_u128 > x_isize; - | ^^^^^^^ expected `u128`, found `isize` + | ------ ^^^^^^^ expected `u128`, found `isize` + | | + | expected because this is `u128` | help: you can convert an `isize` to a `u128` and panic if the converted value doesn't fit | @@ -992,7 +1172,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:226:19 | LL | x_usize > x_i8; - | ^^^^ expected `usize`, found `i8` + | ------- ^^^^ expected `usize`, found `i8` + | | + | expected because this is `usize` | help: you can convert an `i8` to a `usize` and panic if the converted value doesn't fit | @@ -1003,7 +1185,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:228:19 | LL | x_usize > x_i16; - | ^^^^^ expected `usize`, found `i16` + | ------- ^^^^^ expected `usize`, found `i16` + | | + | expected because this is `usize` | help: you can convert an `i16` to a `usize` and panic if the converted value doesn't fit | @@ -1014,7 +1198,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:230:19 | LL | x_usize > x_i32; - | ^^^^^ expected `usize`, found `i32` + | ------- ^^^^^ expected `usize`, found `i32` + | | + | expected because this is `usize` | help: you can convert an `i32` to a `usize` and panic if the converted value doesn't fit | @@ -1025,7 +1211,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:232:19 | LL | x_usize > x_i64; - | ^^^^^ expected `usize`, found `i64` + | ------- ^^^^^ expected `usize`, found `i64` + | | + | expected because this is `usize` | help: you can convert an `i64` to a `usize` and panic if the converted value doesn't fit | @@ -1036,7 +1224,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:234:19 | LL | x_usize > x_i128; - | ^^^^^^ expected `usize`, found `i128` + | ------- ^^^^^^ expected `usize`, found `i128` + | | + | expected because this is `usize` | help: you can convert an `i128` to a `usize` and panic if the converted value doesn't fit | @@ -1047,7 +1237,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:236:19 | LL | x_usize > x_isize; - | ^^^^^^^ expected `usize`, found `isize` + | ------- ^^^^^^^ expected `usize`, found `isize` + | | + | expected because this is `usize` | help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit | @@ -1058,7 +1250,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:242:16 | LL | x_i8 > x_u8; - | ^^^^ expected `i8`, found `u8` + | ---- ^^^^ expected `i8`, found `u8` + | | + | expected because this is `i8` | help: you can convert a `u8` to an `i8` and panic if the converted value doesn't fit | @@ -1069,7 +1263,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:244:16 | LL | x_i8 > x_u16; - | ^^^^^ expected `i8`, found `u16` + | ---- ^^^^^ expected `i8`, found `u16` + | | + | expected because this is `i8` | help: you can convert a `u16` to an `i8` and panic if the converted value doesn't fit | @@ -1080,7 +1276,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:246:16 | LL | x_i8 > x_u32; - | ^^^^^ expected `i8`, found `u32` + | ---- ^^^^^ expected `i8`, found `u32` + | | + | expected because this is `i8` | help: you can convert a `u32` to an `i8` and panic if the converted value doesn't fit | @@ -1091,7 +1289,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:248:16 | LL | x_i8 > x_u64; - | ^^^^^ expected `i8`, found `u64` + | ---- ^^^^^ expected `i8`, found `u64` + | | + | expected because this is `i8` | help: you can convert a `u64` to an `i8` and panic if the converted value doesn't fit | @@ -1102,7 +1302,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:250:16 | LL | x_i8 > x_u128; - | ^^^^^^ expected `i8`, found `u128` + | ---- ^^^^^^ expected `i8`, found `u128` + | | + | expected because this is `i8` | help: you can convert a `u128` to an `i8` and panic if the converted value doesn't fit | @@ -1113,7 +1315,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:252:16 | LL | x_i8 > x_usize; - | ^^^^^^^ expected `i8`, found `usize` + | ---- ^^^^^^^ expected `i8`, found `usize` + | | + | expected because this is `i8` | help: you can convert a `usize` to an `i8` and panic if the converted value doesn't fit | @@ -1124,7 +1328,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:255:17 | LL | x_i16 > x_u8; - | ^^^^ expected `i16`, found `u8` + | ----- ^^^^ expected `i16`, found `u8` + | | + | expected because this is `i16` | help: you can convert a `u8` to an `i16` | @@ -1135,7 +1341,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:257:17 | LL | x_i16 > x_u16; - | ^^^^^ expected `i16`, found `u16` + | ----- ^^^^^ expected `i16`, found `u16` + | | + | expected because this is `i16` | help: you can convert a `u16` to an `i16` and panic if the converted value doesn't fit | @@ -1146,7 +1354,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:259:17 | LL | x_i16 > x_u32; - | ^^^^^ expected `i16`, found `u32` + | ----- ^^^^^ expected `i16`, found `u32` + | | + | expected because this is `i16` | help: you can convert a `u32` to an `i16` and panic if the converted value doesn't fit | @@ -1157,7 +1367,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:261:17 | LL | x_i16 > x_u64; - | ^^^^^ expected `i16`, found `u64` + | ----- ^^^^^ expected `i16`, found `u64` + | | + | expected because this is `i16` | help: you can convert a `u64` to an `i16` and panic if the converted value doesn't fit | @@ -1168,7 +1380,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:263:17 | LL | x_i16 > x_u128; - | ^^^^^^ expected `i16`, found `u128` + | ----- ^^^^^^ expected `i16`, found `u128` + | | + | expected because this is `i16` | help: you can convert a `u128` to an `i16` and panic if the converted value doesn't fit | @@ -1179,7 +1393,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:265:17 | LL | x_i16 > x_usize; - | ^^^^^^^ expected `i16`, found `usize` + | ----- ^^^^^^^ expected `i16`, found `usize` + | | + | expected because this is `i16` | help: you can convert a `usize` to an `i16` and panic if the converted value doesn't fit | @@ -1190,7 +1406,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:268:17 | LL | x_i32 > x_u8; - | ^^^^ expected `i32`, found `u8` + | ----- ^^^^ expected `i32`, found `u8` + | | + | expected because this is `i32` | help: you can convert a `u8` to an `i32` | @@ -1201,7 +1419,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:270:17 | LL | x_i32 > x_u16; - | ^^^^^ expected `i32`, found `u16` + | ----- ^^^^^ expected `i32`, found `u16` + | | + | expected because this is `i32` | help: you can convert a `u16` to an `i32` | @@ -1212,7 +1432,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:272:17 | LL | x_i32 > x_u32; - | ^^^^^ expected `i32`, found `u32` + | ----- ^^^^^ expected `i32`, found `u32` + | | + | expected because this is `i32` | help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit | @@ -1223,7 +1445,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:274:17 | LL | x_i32 > x_u64; - | ^^^^^ expected `i32`, found `u64` + | ----- ^^^^^ expected `i32`, found `u64` + | | + | expected because this is `i32` | help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit | @@ -1234,7 +1458,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:276:17 | LL | x_i32 > x_u128; - | ^^^^^^ expected `i32`, found `u128` + | ----- ^^^^^^ expected `i32`, found `u128` + | | + | expected because this is `i32` | help: you can convert a `u128` to an `i32` and panic if the converted value doesn't fit | @@ -1245,7 +1471,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:278:17 | LL | x_i32 > x_usize; - | ^^^^^^^ expected `i32`, found `usize` + | ----- ^^^^^^^ expected `i32`, found `usize` + | | + | expected because this is `i32` | help: you can convert a `usize` to an `i32` and panic if the converted value doesn't fit | @@ -1256,7 +1484,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:281:17 | LL | x_i64 > x_u8; - | ^^^^ expected `i64`, found `u8` + | ----- ^^^^ expected `i64`, found `u8` + | | + | expected because this is `i64` | help: you can convert a `u8` to an `i64` | @@ -1267,7 +1497,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:283:17 | LL | x_i64 > x_u16; - | ^^^^^ expected `i64`, found `u16` + | ----- ^^^^^ expected `i64`, found `u16` + | | + | expected because this is `i64` | help: you can convert a `u16` to an `i64` | @@ -1278,7 +1510,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:285:17 | LL | x_i64 > x_u32; - | ^^^^^ expected `i64`, found `u32` + | ----- ^^^^^ expected `i64`, found `u32` + | | + | expected because this is `i64` | help: you can convert a `u32` to an `i64` | @@ -1289,7 +1523,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:287:17 | LL | x_i64 > x_u64; - | ^^^^^ expected `i64`, found `u64` + | ----- ^^^^^ expected `i64`, found `u64` + | | + | expected because this is `i64` | help: you can convert a `u64` to an `i64` and panic if the converted value doesn't fit | @@ -1300,7 +1536,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:289:17 | LL | x_i64 > x_u128; - | ^^^^^^ expected `i64`, found `u128` + | ----- ^^^^^^ expected `i64`, found `u128` + | | + | expected because this is `i64` | help: you can convert a `u128` to an `i64` and panic if the converted value doesn't fit | @@ -1311,7 +1549,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:291:17 | LL | x_i64 > x_usize; - | ^^^^^^^ expected `i64`, found `usize` + | ----- ^^^^^^^ expected `i64`, found `usize` + | | + | expected because this is `i64` | help: you can convert a `usize` to an `i64` and panic if the converted value doesn't fit | @@ -1322,7 +1562,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:294:18 | LL | x_i128 > x_u8; - | ^^^^ expected `i128`, found `u8` + | ------ ^^^^ expected `i128`, found `u8` + | | + | expected because this is `i128` | help: you can convert a `u8` to an `i128` | @@ -1333,7 +1575,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:296:18 | LL | x_i128 > x_u16; - | ^^^^^ expected `i128`, found `u16` + | ------ ^^^^^ expected `i128`, found `u16` + | | + | expected because this is `i128` | help: you can convert a `u16` to an `i128` | @@ -1344,7 +1588,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:298:18 | LL | x_i128 > x_u32; - | ^^^^^ expected `i128`, found `u32` + | ------ ^^^^^ expected `i128`, found `u32` + | | + | expected because this is `i128` | help: you can convert a `u32` to an `i128` | @@ -1355,7 +1601,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:300:18 | LL | x_i128 > x_u64; - | ^^^^^ expected `i128`, found `u64` + | ------ ^^^^^ expected `i128`, found `u64` + | | + | expected because this is `i128` | help: you can convert a `u64` to an `i128` | @@ -1366,7 +1614,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:302:18 | LL | x_i128 > x_u128; - | ^^^^^^ expected `i128`, found `u128` + | ------ ^^^^^^ expected `i128`, found `u128` + | | + | expected because this is `i128` | help: you can convert a `u128` to an `i128` and panic if the converted value doesn't fit | @@ -1377,7 +1627,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:304:18 | LL | x_i128 > x_usize; - | ^^^^^^^ expected `i128`, found `usize` + | ------ ^^^^^^^ expected `i128`, found `usize` + | | + | expected because this is `i128` | help: you can convert a `usize` to an `i128` and panic if the converted value doesn't fit | @@ -1388,7 +1640,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:307:19 | LL | x_isize > x_u8; - | ^^^^ expected `isize`, found `u8` + | ------- ^^^^ expected `isize`, found `u8` + | | + | expected because this is `isize` | help: you can convert a `u8` to an `isize` | @@ -1399,7 +1653,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:309:19 | LL | x_isize > x_u16; - | ^^^^^ expected `isize`, found `u16` + | ------- ^^^^^ expected `isize`, found `u16` + | | + | expected because this is `isize` | help: you can convert a `u16` to an `isize` and panic if the converted value doesn't fit | @@ -1410,7 +1666,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:311:19 | LL | x_isize > x_u32; - | ^^^^^ expected `isize`, found `u32` + | ------- ^^^^^ expected `isize`, found `u32` + | | + | expected because this is `isize` | help: you can convert a `u32` to an `isize` and panic if the converted value doesn't fit | @@ -1421,7 +1679,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:313:19 | LL | x_isize > x_u64; - | ^^^^^ expected `isize`, found `u64` + | ------- ^^^^^ expected `isize`, found `u64` + | | + | expected because this is `isize` | help: you can convert a `u64` to an `isize` and panic if the converted value doesn't fit | @@ -1432,7 +1692,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:315:19 | LL | x_isize > x_u128; - | ^^^^^^ expected `isize`, found `u128` + | ------- ^^^^^^ expected `isize`, found `u128` + | | + | expected because this is `isize` | help: you can convert a `u128` to an `isize` and panic if the converted value doesn't fit | @@ -1443,7 +1705,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-binop.rs:317:19 | LL | x_isize > x_usize; - | ^^^^^^^ expected `isize`, found `usize` + | ------- ^^^^^^^ expected `isize`, found `usize` + | | + | expected because this is `isize` | help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit | diff --git a/src/test/ui/numeric/numeric-cast-no-fix.stderr b/src/test/ui/numeric/numeric-cast-no-fix.stderr index e4843206de1..c244e479d24 100644 --- a/src/test/ui/numeric/numeric-cast-no-fix.stderr +++ b/src/test/ui/numeric/numeric-cast-no-fix.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:10:15 | LL | x_usize > -1_isize; - | ^^^^^^^^ expected `usize`, found `isize` + | ------- ^^^^^^^^ expected `usize`, found `isize` + | | + | expected because this is `usize` | = note: `-1_isize` cannot fit into type `usize` @@ -10,7 +12,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:12:14 | LL | x_u128 > -1_isize; - | ^^^^^^^^ expected `u128`, found `isize` + | ------ ^^^^^^^^ expected `u128`, found `isize` + | | + | expected because this is `u128` | = note: `-1_isize` cannot fit into type `u128` @@ -18,7 +22,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:14:13 | LL | x_u64 > -1_isize; - | ^^^^^^^^ expected `u64`, found `isize` + | ----- ^^^^^^^^ expected `u64`, found `isize` + | | + | expected because this is `u64` | = note: `-1_isize` cannot fit into type `u64` @@ -26,7 +32,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:16:13 | LL | x_u32 > -1_isize; - | ^^^^^^^^ expected `u32`, found `isize` + | ----- ^^^^^^^^ expected `u32`, found `isize` + | | + | expected because this is `u32` | = note: `-1_isize` cannot fit into type `u32` @@ -34,7 +42,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:18:13 | LL | x_u16 > -1_isize; - | ^^^^^^^^ expected `u16`, found `isize` + | ----- ^^^^^^^^ expected `u16`, found `isize` + | | + | expected because this is `u16` | = note: `-1_isize` cannot fit into type `u16` @@ -42,7 +52,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:20:12 | LL | x_u8 > -1_isize; - | ^^^^^^^^ expected `u8`, found `isize` + | ---- ^^^^^^^^ expected `u8`, found `isize` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `isize`, matching the type of `-1_isize` | @@ -53,7 +65,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:23:15 | LL | x_usize > -1_i128; - | ^^^^^^^ expected `usize`, found `i128` + | ------- ^^^^^^^ expected `usize`, found `i128` + | | + | expected because this is `usize` | = note: `-1_i128` cannot fit into type `usize` @@ -61,7 +75,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:25:14 | LL | x_u128 > -1_i128; - | ^^^^^^^ expected `u128`, found `i128` + | ------ ^^^^^^^ expected `u128`, found `i128` + | | + | expected because this is `u128` | = note: `-1_i128` cannot fit into type `u128` @@ -69,7 +85,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:27:13 | LL | x_u64 > -1_i128; - | ^^^^^^^ expected `u64`, found `i128` + | ----- ^^^^^^^ expected `u64`, found `i128` + | | + | expected because this is `u64` | help: you can convert `x_u64` from `u64` to `i128`, matching the type of `-1_i128` | @@ -80,7 +98,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:29:13 | LL | x_u32 > -1_i128; - | ^^^^^^^ expected `u32`, found `i128` + | ----- ^^^^^^^ expected `u32`, found `i128` + | | + | expected because this is `u32` | help: you can convert `x_u32` from `u32` to `i128`, matching the type of `-1_i128` | @@ -91,7 +111,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:31:13 | LL | x_u16 > -1_i128; - | ^^^^^^^ expected `u16`, found `i128` + | ----- ^^^^^^^ expected `u16`, found `i128` + | | + | expected because this is `u16` | help: you can convert `x_u16` from `u16` to `i128`, matching the type of `-1_i128` | @@ -102,7 +124,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:33:12 | LL | x_u8 > -1_i128; - | ^^^^^^^ expected `u8`, found `i128` + | ---- ^^^^^^^ expected `u8`, found `i128` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `i128`, matching the type of `-1_i128` | @@ -113,7 +137,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:36:15 | LL | x_usize > -1_i64; - | ^^^^^^ expected `usize`, found `i64` + | ------- ^^^^^^ expected `usize`, found `i64` + | | + | expected because this is `usize` | = note: `-1_i64` cannot fit into type `usize` @@ -121,7 +147,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:38:14 | LL | x_u128 > -1_i64; - | ^^^^^^ expected `u128`, found `i64` + | ------ ^^^^^^ expected `u128`, found `i64` + | | + | expected because this is `u128` | = note: `-1_i64` cannot fit into type `u128` @@ -129,7 +157,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:40:13 | LL | x_u64 > -1_i64; - | ^^^^^^ expected `u64`, found `i64` + | ----- ^^^^^^ expected `u64`, found `i64` + | | + | expected because this is `u64` | = note: `-1_i64` cannot fit into type `u64` @@ -137,7 +167,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:42:13 | LL | x_u32 > -1_i64; - | ^^^^^^ expected `u32`, found `i64` + | ----- ^^^^^^ expected `u32`, found `i64` + | | + | expected because this is `u32` | help: you can convert `x_u32` from `u32` to `i64`, matching the type of `-1_i64` | @@ -148,7 +180,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:44:13 | LL | x_u16 > -1_i64; - | ^^^^^^ expected `u16`, found `i64` + | ----- ^^^^^^ expected `u16`, found `i64` + | | + | expected because this is `u16` | help: you can convert `x_u16` from `u16` to `i64`, matching the type of `-1_i64` | @@ -159,7 +193,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:46:12 | LL | x_u8 > -1_i64; - | ^^^^^^ expected `u8`, found `i64` + | ---- ^^^^^^ expected `u8`, found `i64` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `i64`, matching the type of `-1_i64` | @@ -170,7 +206,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:49:15 | LL | x_usize > -1_i32; - | ^^^^^^ expected `usize`, found `i32` + | ------- ^^^^^^ expected `usize`, found `i32` + | | + | expected because this is `usize` | = note: `-1_i32` cannot fit into type `usize` @@ -178,7 +216,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:51:14 | LL | x_u128 > -1_i32; - | ^^^^^^ expected `u128`, found `i32` + | ------ ^^^^^^ expected `u128`, found `i32` + | | + | expected because this is `u128` | = note: `-1_i32` cannot fit into type `u128` @@ -186,7 +226,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:53:13 | LL | x_u64 > -1_i32; - | ^^^^^^ expected `u64`, found `i32` + | ----- ^^^^^^ expected `u64`, found `i32` + | | + | expected because this is `u64` | = note: `-1_i32` cannot fit into type `u64` @@ -194,7 +236,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:55:13 | LL | x_u32 > -1_i32; - | ^^^^^^ expected `u32`, found `i32` + | ----- ^^^^^^ expected `u32`, found `i32` + | | + | expected because this is `u32` | = note: `-1_i32` cannot fit into type `u32` @@ -202,7 +246,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:57:13 | LL | x_u16 > -1_i32; - | ^^^^^^ expected `u16`, found `i32` + | ----- ^^^^^^ expected `u16`, found `i32` + | | + | expected because this is `u16` | help: you can convert `x_u16` from `u16` to `i32`, matching the type of `-1_i32` | @@ -213,7 +259,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:59:12 | LL | x_u8 > -1_i32; - | ^^^^^^ expected `u8`, found `i32` + | ---- ^^^^^^ expected `u8`, found `i32` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `i32`, matching the type of `-1_i32` | @@ -224,7 +272,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:62:15 | LL | x_usize > -1_i16; - | ^^^^^^ expected `usize`, found `i16` + | ------- ^^^^^^ expected `usize`, found `i16` + | | + | expected because this is `usize` | = note: `-1_i16` cannot fit into type `usize` @@ -232,7 +282,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:64:14 | LL | x_u128 > -1_i16; - | ^^^^^^ expected `u128`, found `i16` + | ------ ^^^^^^ expected `u128`, found `i16` + | | + | expected because this is `u128` | = note: `-1_i16` cannot fit into type `u128` @@ -240,7 +292,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:66:13 | LL | x_u64 > -1_i16; - | ^^^^^^ expected `u64`, found `i16` + | ----- ^^^^^^ expected `u64`, found `i16` + | | + | expected because this is `u64` | = note: `-1_i16` cannot fit into type `u64` @@ -248,7 +302,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:68:13 | LL | x_u32 > -1_i16; - | ^^^^^^ expected `u32`, found `i16` + | ----- ^^^^^^ expected `u32`, found `i16` + | | + | expected because this is `u32` | = note: `-1_i16` cannot fit into type `u32` @@ -256,7 +312,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:70:13 | LL | x_u16 > -1_i16; - | ^^^^^^ expected `u16`, found `i16` + | ----- ^^^^^^ expected `u16`, found `i16` + | | + | expected because this is `u16` | = note: `-1_i16` cannot fit into type `u16` @@ -264,7 +322,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:72:12 | LL | x_u8 > -1_i16; - | ^^^^^^ expected `u8`, found `i16` + | ---- ^^^^^^ expected `u8`, found `i16` + | | + | expected because this is `u8` | help: you can convert `x_u8` from `u8` to `i16`, matching the type of `-1_i16` | @@ -275,7 +335,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:75:15 | LL | x_usize > -1_i8; - | ^^^^^ expected `usize`, found `i8` + | ------- ^^^^^ expected `usize`, found `i8` + | | + | expected because this is `usize` | = note: `-1_i8` cannot fit into type `usize` @@ -283,7 +345,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:77:14 | LL | x_u128 > -1_i8; - | ^^^^^ expected `u128`, found `i8` + | ------ ^^^^^ expected `u128`, found `i8` + | | + | expected because this is `u128` | = note: `-1_i8` cannot fit into type `u128` @@ -291,7 +355,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:79:13 | LL | x_u64 > -1_i8; - | ^^^^^ expected `u64`, found `i8` + | ----- ^^^^^ expected `u64`, found `i8` + | | + | expected because this is `u64` | = note: `-1_i8` cannot fit into type `u64` @@ -299,7 +365,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:81:13 | LL | x_u32 > -1_i8; - | ^^^^^ expected `u32`, found `i8` + | ----- ^^^^^ expected `u32`, found `i8` + | | + | expected because this is `u32` | = note: `-1_i8` cannot fit into type `u32` @@ -307,7 +375,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:83:13 | LL | x_u16 > -1_i8; - | ^^^^^ expected `u16`, found `i8` + | ----- ^^^^^ expected `u16`, found `i8` + | | + | expected because this is `u16` | = note: `-1_i8` cannot fit into type `u16` @@ -315,7 +385,9 @@ error[E0308]: mismatched types --> $DIR/numeric-cast-no-fix.rs:85:12 | LL | x_u8 > -1_i8; - | ^^^^^ expected `u8`, found `i8` + | ---- ^^^^^ expected `u8`, found `i8` + | | + | expected because this is `u8` | = note: `-1_i8` cannot fit into type `u8` diff --git a/src/test/ui/numeric/uppercase-base-prefix-invalid-no-fix.rs b/src/test/ui/numeric/uppercase-base-prefix-invalid-no-fix.rs new file mode 100644 index 00000000000..f00cde4a74c --- /dev/null +++ b/src/test/ui/numeric/uppercase-base-prefix-invalid-no-fix.rs @@ -0,0 +1,34 @@ +// Checks that integers with seeming uppercase base prefixes do not get bogus capitalization +// suggestions. + +fn main() { + _ = 123X1a3; + //~^ ERROR invalid suffix `X1a3` for number literal + //~| NOTE invalid suffix `X1a3` + //~| HELP the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + + _ = 456O123; + //~^ ERROR invalid suffix `O123` for number literal + //~| NOTE invalid suffix `O123` + //~| HELP the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + + _ = 789B101; + //~^ ERROR invalid suffix `B101` for number literal + //~| NOTE invalid suffix `B101` + //~| HELP the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + + _ = 0XYZ; + //~^ ERROR invalid suffix `XYZ` for number literal + //~| NOTE invalid suffix `XYZ` + //~| HELP the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + + _ = 0OPQ; + //~^ ERROR invalid suffix `OPQ` for number literal + //~| NOTE invalid suffix `OPQ` + //~| HELP the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + + _ = 0BCD; + //~^ ERROR invalid suffix `BCD` for number literal + //~| NOTE invalid suffix `BCD` + //~| HELP the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) +} diff --git a/src/test/ui/numeric/uppercase-base-prefix-invalid-no-fix.stderr b/src/test/ui/numeric/uppercase-base-prefix-invalid-no-fix.stderr new file mode 100644 index 00000000000..380c16ca789 --- /dev/null +++ b/src/test/ui/numeric/uppercase-base-prefix-invalid-no-fix.stderr @@ -0,0 +1,50 @@ +error: invalid suffix `X1a3` for number literal + --> $DIR/uppercase-base-prefix-invalid-no-fix.rs:5:9 + | +LL | _ = 123X1a3; + | ^^^^^^^ invalid suffix `X1a3` + | + = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + +error: invalid suffix `O123` for number literal + --> $DIR/uppercase-base-prefix-invalid-no-fix.rs:10:9 + | +LL | _ = 456O123; + | ^^^^^^^ invalid suffix `O123` + | + = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + +error: invalid suffix `B101` for number literal + --> $DIR/uppercase-base-prefix-invalid-no-fix.rs:15:9 + | +LL | _ = 789B101; + | ^^^^^^^ invalid suffix `B101` + | + = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + +error: invalid suffix `XYZ` for number literal + --> $DIR/uppercase-base-prefix-invalid-no-fix.rs:20:9 + | +LL | _ = 0XYZ; + | ^^^^ invalid suffix `XYZ` + | + = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + +error: invalid suffix `OPQ` for number literal + --> $DIR/uppercase-base-prefix-invalid-no-fix.rs:25:9 + | +LL | _ = 0OPQ; + | ^^^^ invalid suffix `OPQ` + | + = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + +error: invalid suffix `BCD` for number literal + --> $DIR/uppercase-base-prefix-invalid-no-fix.rs:30:9 + | +LL | _ = 0BCD; + | ^^^^ invalid suffix `BCD` + | + = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr b/src/test/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr index c1aaad31e81..f05b0cd6538 100644 --- a/src/test/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr +++ b/src/test/ui/object-safety/object-safety-supertrait-mentions-GAT.stderr @@ -3,10 +3,10 @@ error[E0311]: the parameter type `Self` may not live long enough = help: consider adding an explicit lifetime bound `Self: 'a`... = note: ...so that the type `Self` will meet its required lifetime bounds... note: ...that is required by this bound - --> $DIR/object-safety-supertrait-mentions-GAT.rs:9:39 + --> $DIR/object-safety-supertrait-mentions-GAT.rs:6:15 | -LL | trait SuperTrait<T>: for<'a> GatTrait<Gat<'a> = T> { - | ^^^^^^^^^^^ +LL | Self: 'a; + | ^^ error: associated item referring to unboxed trait object for its own trait --> $DIR/object-safety-supertrait-mentions-GAT.rs:10:20 diff --git a/src/test/ui/on-unimplemented/sum.rs b/src/test/ui/on-unimplemented/sum.rs new file mode 100644 index 00000000000..4f1c521d9fe --- /dev/null +++ b/src/test/ui/on-unimplemented/sum.rs @@ -0,0 +1,9 @@ +// <https://github.com/rust-lang/rust/issues/105184> + +fn main() { + vec![(), ()].iter().sum::<i32>(); + //~^ ERROR + + vec![(), ()].iter().product::<i32>(); + //~^ ERROR +} diff --git a/src/test/ui/on-unimplemented/sum.stderr b/src/test/ui/on-unimplemented/sum.stderr new file mode 100644 index 00000000000..2a316dba778 --- /dev/null +++ b/src/test/ui/on-unimplemented/sum.stderr @@ -0,0 +1,43 @@ +error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()` + --> $DIR/sum.rs:4:25 + | +LL | vec![(), ()].iter().sum::<i32>(); + | ^^^ value of type `i32` cannot be made by summing a `std::iter::Iterator<Item=&()>` + | + = help: the trait `Sum<&()>` is not implemented for `i32` + = help: the following other types implement trait `Sum<A>`: + <i32 as Sum<&'a i32>> + <i32 as Sum> +note: the method call chain might not have had the expected associated types + --> $DIR/sum.rs:4:18 + | +LL | vec![(), ()].iter().sum::<i32>(); + | ------------ ^^^^^^ `Iterator::Item` is `&()` here + | | + | this expression has type `Vec<()>` +note: required by a bound in `std::iter::Iterator::sum` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error[E0277]: a value of type `i32` cannot be made by multiplying all elements of type `&()` from an iterator + --> $DIR/sum.rs:7:25 + | +LL | vec![(), ()].iter().product::<i32>(); + | ^^^^^^^ value of type `i32` cannot be made by multiplying all elements from a `std::iter::Iterator<Item=&()>` + | + = help: the trait `Product<&()>` is not implemented for `i32` + = help: the following other types implement trait `Product<A>`: + <i32 as Product<&'a i32>> + <i32 as Product> +note: the method call chain might not have had the expected associated types + --> $DIR/sum.rs:7:18 + | +LL | vec![(), ()].iter().product::<i32>(); + | ------------ ^^^^^^ `Iterator::Item` is `&()` here + | | + | this expression has type `Vec<()>` +note: required by a bound in `std::iter::Iterator::product` + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr b/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr index 920720a4f53..10d42b7e3c0 100644 --- a/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr +++ b/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr @@ -35,11 +35,8 @@ note: an implementation of `BitOr<_>` might be missing for `E` | LL | enum E { A, B } | ^^^^^^ must implement `BitOr<_>` -note: the following trait must be implemented +note: the trait `BitOr` must be implemented --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | pub trait BitOr<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/overloaded/overloaded-calls-nontuple.stderr b/src/test/ui/overloaded/overloaded-calls-nontuple.stderr index 794535aeb11..2e160078259 100644 --- a/src/test/ui/overloaded/overloaded-calls-nontuple.stderr +++ b/src/test/ui/overloaded/overloaded-calls-nontuple.stderr @@ -6,9 +6,6 @@ LL | impl FnMut<isize> for S { | note: required by a bound in `FnMut` --> $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait FnMut<Args: Tuple>: FnOnce<Args> { - | ^^^^^ required by this bound in `FnMut` error[E0059]: type parameter to bare `FnOnce` trait must be a tuple --> $DIR/overloaded-calls-nontuple.rs:18:6 @@ -18,9 +15,6 @@ LL | impl FnOnce<isize> for S { | note: required by a bound in `FnOnce` --> $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait FnOnce<Args: Tuple> { - | ^^^^^ required by this bound in `FnOnce` error[E0277]: functions with the "rust-call" ABI must take a single non-self tuple argument --> $DIR/overloaded-calls-nontuple.rs:12:5 diff --git a/src/test/ui/parser/bare-struct-body.stderr b/src/test/ui/parser/bare-struct-body.stderr index c77992b2c34..7d17ea59647 100644 --- a/src/test/ui/parser/bare-struct-body.stderr +++ b/src/test/ui/parser/bare-struct-body.stderr @@ -34,7 +34,9 @@ error[E0308]: mismatched types --> $DIR/bare-struct-body.rs:11:14 | LL | x.val == 42; - | ^^ expected `()`, found integer + | ----- ^^ expected `()`, found integer + | | + | expected because this is `()` error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/chained-comparison-suggestion.stderr b/src/test/ui/parser/chained-comparison-suggestion.stderr index 694b0b6eb02..ae243816d7c 100644 --- a/src/test/ui/parser/chained-comparison-suggestion.stderr +++ b/src/test/ui/parser/chained-comparison-suggestion.stderr @@ -123,37 +123,49 @@ error[E0308]: mismatched types --> $DIR/chained-comparison-suggestion.rs:4:14 | LL | 1 < 2 <= 3; - | ^ expected `bool`, found integer + | ----- ^ expected `bool`, found integer + | | + | expected because this is `bool` error[E0308]: mismatched types --> $DIR/chained-comparison-suggestion.rs:13:14 | LL | 1 <= 2 < 3; - | ^ expected `bool`, found integer + | ------ ^ expected `bool`, found integer + | | + | expected because this is `bool` error[E0308]: mismatched types --> $DIR/chained-comparison-suggestion.rs:18:15 | LL | 1 <= 2 <= 3; - | ^ expected `bool`, found integer + | ------ ^ expected `bool`, found integer + | | + | expected because this is `bool` error[E0308]: mismatched types --> $DIR/chained-comparison-suggestion.rs:23:14 | LL | 1 > 2 >= 3; - | ^ expected `bool`, found integer + | ----- ^ expected `bool`, found integer + | | + | expected because this is `bool` error[E0308]: mismatched types --> $DIR/chained-comparison-suggestion.rs:36:15 | LL | 1 >= 2 >= 3; - | ^ expected `bool`, found integer + | ------ ^ expected `bool`, found integer + | | + | expected because this is `bool` error[E0308]: mismatched types --> $DIR/chained-comparison-suggestion.rs:49:15 | LL | 1 == 2 == 3; - | ^ expected `bool`, found integer + | ------ ^ expected `bool`, found integer + | | + | expected because this is `bool` error: aborting due to 17 previous errors diff --git a/src/test/ui/parser/expr-as-stmt.fixed b/src/test/ui/parser/expr-as-stmt.fixed index 36709eea17c..b06f62794c4 100644 --- a/src/test/ui/parser/expr-as-stmt.fixed +++ b/src/test/ui/parser/expr-as-stmt.fixed @@ -64,4 +64,16 @@ fn asteroids() -> impl FnOnce() -> bool { { foo(); } || { true } //~ ERROR E0308 } +// https://github.com/rust-lang/rust/issues/105179 +fn r#match() -> i32 { + (match () { () => 1 }) + match () { () => 1 } //~ ERROR expected expression, found `+` + //~^ ERROR mismatched types +} + +// https://github.com/rust-lang/rust/issues/102171 +fn r#unsafe() -> i32 { + (unsafe { 1 }) + unsafe { 1 } //~ ERROR expected expression, found `+` + //~^ ERROR mismatched types +} + fn main() {} diff --git a/src/test/ui/parser/expr-as-stmt.rs b/src/test/ui/parser/expr-as-stmt.rs index 92bb972b240..b39d2b88647 100644 --- a/src/test/ui/parser/expr-as-stmt.rs +++ b/src/test/ui/parser/expr-as-stmt.rs @@ -64,4 +64,16 @@ fn asteroids() -> impl FnOnce() -> bool { { foo() } || { true } //~ ERROR E0308 } +// https://github.com/rust-lang/rust/issues/105179 +fn r#match() -> i32 { + match () { () => 1 } + match () { () => 1 } //~ ERROR expected expression, found `+` + //~^ ERROR mismatched types +} + +// https://github.com/rust-lang/rust/issues/102171 +fn r#unsafe() -> i32 { + unsafe { 1 } + unsafe { 1 } //~ ERROR expected expression, found `+` + //~^ ERROR mismatched types +} + fn main() {} diff --git a/src/test/ui/parser/expr-as-stmt.stderr b/src/test/ui/parser/expr-as-stmt.stderr index 6da4ac34067..18c8b0b7c50 100644 --- a/src/test/ui/parser/expr-as-stmt.stderr +++ b/src/test/ui/parser/expr-as-stmt.stderr @@ -55,6 +55,28 @@ help: parentheses are required to parse this as an expression LL | ({ true }) | { true } | + + +error: expected expression, found `+` + --> $DIR/expr-as-stmt.rs:69:26 + | +LL | match () { () => 1 } + match () { () => 1 } + | ^ expected expression + | +help: parentheses are required to parse this as an expression + | +LL | (match () { () => 1 }) + match () { () => 1 } + | + + + +error: expected expression, found `+` + --> $DIR/expr-as-stmt.rs:75:18 + | +LL | unsafe { 1 } + unsafe { 1 } + | ^ expected expression + | +help: parentheses are required to parse this as an expression + | +LL | (unsafe { 1 }) + unsafe { 1 } + | + + + error[E0308]: mismatched types --> $DIR/expr-as-stmt.rs:64:7 | @@ -201,7 +223,26 @@ help: parentheses are required to parse this as an expression LL | ({ true }) || { true } | + + -error: aborting due to 18 previous errors +error[E0308]: mismatched types + --> $DIR/expr-as-stmt.rs:69:5 + | +LL | match () { () => 1 } + match () { () => 1 } + | ^^^^^^^^^^^^^^^^^^^^- help: consider using a semicolon here + | | + | expected `()`, found integer + +error[E0308]: mismatched types + --> $DIR/expr-as-stmt.rs:75:14 + | +LL | unsafe { 1 } + unsafe { 1 } + | ^ expected `()`, found integer + | +help: you might have meant to return this value + | +LL | unsafe { return 1; } + unsafe { 1 } + | ++++++ + + +error: aborting due to 22 previous errors Some errors have detailed explanations: E0308, E0600, E0614. For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/increment-autofix-2.fixed b/src/test/ui/parser/increment-autofix-2.fixed new file mode 100644 index 00000000000..580ebaf5dbb --- /dev/null +++ b/src/test/ui/parser/increment-autofix-2.fixed @@ -0,0 +1,63 @@ +// run-rustfix + +struct Foo { + bar: Bar, +} + +struct Bar { + qux: i32, +} + +pub fn post_regular() { + let mut i = 0; + i += 1; //~ ERROR Rust has no postfix increment operator + println!("{}", i); +} + +pub fn post_while() { + let mut i = 0; + while { let tmp = i; i += 1; tmp } < 5 { + //~^ ERROR Rust has no postfix increment operator + println!("{}", i); + } +} + +pub fn post_regular_tmp() { + let mut tmp = 0; + tmp += 1; //~ ERROR Rust has no postfix increment operator + println!("{}", tmp); +} + +pub fn post_while_tmp() { + let mut tmp = 0; + while { let tmp_ = tmp; tmp += 1; tmp_ } < 5 { + //~^ ERROR Rust has no postfix increment operator + println!("{}", tmp); + } +} + +pub fn post_field() { + let mut foo = Foo { bar: Bar { qux: 0 } }; + foo.bar.qux += 1; + //~^ ERROR Rust has no postfix increment operator + println!("{}", foo.bar.qux); +} + +pub fn post_field_tmp() { + struct S { + tmp: i32 + } + let mut s = S { tmp: 0 }; + s.tmp += 1; + //~^ ERROR Rust has no postfix increment operator + println!("{}", s.tmp); +} + +pub fn pre_field() { + let mut foo = Foo { bar: Bar { qux: 0 } }; + foo.bar.qux += 1; + //~^ ERROR Rust has no prefix increment operator + println!("{}", foo.bar.qux); +} + +fn main() {} diff --git a/src/test/ui/parser/increment-notfixed.rs b/src/test/ui/parser/increment-autofix-2.rs index 15f159e53d2..ebe5fa6ca1e 100644 --- a/src/test/ui/parser/increment-notfixed.rs +++ b/src/test/ui/parser/increment-autofix-2.rs @@ -1,3 +1,5 @@ +// run-rustfix + struct Foo { bar: Bar, } @@ -35,7 +37,7 @@ pub fn post_while_tmp() { } pub fn post_field() { - let foo = Foo { bar: Bar { qux: 0 } }; + let mut foo = Foo { bar: Bar { qux: 0 } }; foo.bar.qux++; //~^ ERROR Rust has no postfix increment operator println!("{}", foo.bar.qux); @@ -45,14 +47,14 @@ pub fn post_field_tmp() { struct S { tmp: i32 } - let s = S { tmp: 0 }; + let mut s = S { tmp: 0 }; s.tmp++; //~^ ERROR Rust has no postfix increment operator println!("{}", s.tmp); } pub fn pre_field() { - let foo = Foo { bar: Bar { qux: 0 } }; + let mut foo = Foo { bar: Bar { qux: 0 } }; ++foo.bar.qux; //~^ ERROR Rust has no prefix increment operator println!("{}", foo.bar.qux); diff --git a/src/test/ui/parser/increment-notfixed.stderr b/src/test/ui/parser/increment-autofix-2.stderr index ae55ae06714..11e985480d6 100644 --- a/src/test/ui/parser/increment-notfixed.stderr +++ b/src/test/ui/parser/increment-autofix-2.stderr @@ -1,18 +1,16 @@ error: Rust has no postfix increment operator - --> $DIR/increment-notfixed.rs:11:6 + --> $DIR/increment-autofix-2.rs:13:6 | LL | i++; | ^^ not a valid postfix operator | help: use `+= 1` instead | -LL | { let tmp = i; i += 1; tmp }; - | +++++++++++ ~~~~~~~~~~~~~~~ LL | i += 1; | ~~~~ error: Rust has no postfix increment operator - --> $DIR/increment-notfixed.rs:17:12 + --> $DIR/increment-autofix-2.rs:19:12 | LL | while i++ < 5 { | ----- ^^ not a valid postfix operator @@ -23,24 +21,20 @@ help: use `+= 1` instead | LL | while { let tmp = i; i += 1; tmp } < 5 { | +++++++++++ ~~~~~~~~~~~~~~~ -LL | while i += 1 < 5 { - | ~~~~ error: Rust has no postfix increment operator - --> $DIR/increment-notfixed.rs:25:8 + --> $DIR/increment-autofix-2.rs:27:8 | LL | tmp++; | ^^ not a valid postfix operator | help: use `+= 1` instead | -LL | { let tmp_ = tmp; tmp += 1; tmp_ }; - | ++++++++++++ ~~~~~~~~~~~~~~~~~~ LL | tmp += 1; | ~~~~ error: Rust has no postfix increment operator - --> $DIR/increment-notfixed.rs:31:14 + --> $DIR/increment-autofix-2.rs:33:14 | LL | while tmp++ < 5 { | ----- ^^ not a valid postfix operator @@ -51,37 +45,31 @@ help: use `+= 1` instead | LL | while { let tmp_ = tmp; tmp += 1; tmp_ } < 5 { | ++++++++++++ ~~~~~~~~~~~~~~~~~~ -LL | while tmp += 1 < 5 { - | ~~~~ error: Rust has no postfix increment operator - --> $DIR/increment-notfixed.rs:39:16 + --> $DIR/increment-autofix-2.rs:41:16 | LL | foo.bar.qux++; | ^^ not a valid postfix operator | help: use `+= 1` instead | -LL | { let tmp = foo.bar.qux; foo.bar.qux += 1; tmp }; - | +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~ LL | foo.bar.qux += 1; | ~~~~ error: Rust has no postfix increment operator - --> $DIR/increment-notfixed.rs:49:10 + --> $DIR/increment-autofix-2.rs:51:10 | LL | s.tmp++; | ^^ not a valid postfix operator | help: use `+= 1` instead | -LL | { let tmp = s.tmp; s.tmp += 1; tmp }; - | +++++++++++ ~~~~~~~~~~~~~~~~~~~ LL | s.tmp += 1; | ~~~~ error: Rust has no prefix increment operator - --> $DIR/increment-notfixed.rs:56:5 + --> $DIR/increment-autofix-2.rs:58:5 | LL | ++foo.bar.qux; | ^^ not a valid prefix operator diff --git a/src/test/ui/parser/issue-101477-enum.stderr b/src/test/ui/parser/issue-101477-enum.stderr index bffc881bdc8..1edca391e8f 100644 --- a/src/test/ui/parser/issue-101477-enum.stderr +++ b/src/test/ui/parser/issue-101477-enum.stderr @@ -3,6 +3,8 @@ error: unexpected `==` | LL | B == 2 | ^^ help: try using `=` instead + | + = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` error: expected item, found `==` --> $DIR/issue-101477-enum.rs:6:7 diff --git a/src/test/ui/parser/issue-103869.rs b/src/test/ui/parser/issue-103869.rs new file mode 100644 index 00000000000..28c442bdd63 --- /dev/null +++ b/src/test/ui/parser/issue-103869.rs @@ -0,0 +1,9 @@ +enum VecOrMap{ + vec: Vec<usize>, + //~^ ERROR expected one of `(`, `,`, `=`, `{`, or `}`, found `:` + //~| HELP: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` + //~| ERROR expected item, found `:` + map: HashMap<String,usize> +} + +fn main() {} diff --git a/src/test/ui/parser/issue-103869.stderr b/src/test/ui/parser/issue-103869.stderr new file mode 100644 index 00000000000..0b8cd919a9d --- /dev/null +++ b/src/test/ui/parser/issue-103869.stderr @@ -0,0 +1,16 @@ +error: expected one of `(`, `,`, `=`, `{`, or `}`, found `:` + --> $DIR/issue-103869.rs:2:8 + | +LL | vec: Vec<usize>, + | ^ expected one of `(`, `,`, `=`, `{`, or `}` + | + = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` + +error: expected item, found `:` + --> $DIR/issue-103869.rs:2:8 + | +LL | vec: Vec<usize>, + | ^ expected item + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/parser/issue-104867-inc-dec-2.rs b/src/test/ui/parser/issue-104867-inc-dec-2.rs new file mode 100644 index 00000000000..a006421a975 --- /dev/null +++ b/src/test/ui/parser/issue-104867-inc-dec-2.rs @@ -0,0 +1,52 @@ +fn test1() { + let mut i = 0; + let _ = i + ++i; //~ ERROR Rust has no prefix increment operator +} + +fn test2() { + let mut i = 0; + let _ = ++i + i; //~ ERROR Rust has no prefix increment operator +} + +fn test3() { + let mut i = 0; + let _ = ++i + ++i; //~ ERROR Rust has no prefix increment operator +} + +fn test4() { + let mut i = 0; + let _ = i + i++; //~ ERROR Rust has no postfix increment operator + // won't suggest since we can not handle the precedences +} + +fn test5() { + let mut i = 0; + let _ = i++ + i; //~ ERROR Rust has no postfix increment operator +} + +fn test6() { + let mut i = 0; + let _ = i++ + i++; //~ ERROR Rust has no postfix increment operator +} + +fn test7() { + let mut i = 0; + let _ = ++i + i++; //~ ERROR Rust has no prefix increment operator +} + +fn test8() { + let mut i = 0; + let _ = i++ + ++i; //~ ERROR Rust has no postfix increment operator +} + +fn test9() { + let mut i = 0; + let _ = (1 + 2 + i)++; //~ ERROR Rust has no postfix increment operator +} + +fn test10() { + let mut i = 0; + let _ = (i++ + 1) + 2; //~ ERROR Rust has no postfix increment operator +} + +fn main() { } diff --git a/src/test/ui/parser/issue-104867-inc-dec-2.stderr b/src/test/ui/parser/issue-104867-inc-dec-2.stderr new file mode 100644 index 00000000000..4e2d0546851 --- /dev/null +++ b/src/test/ui/parser/issue-104867-inc-dec-2.stderr @@ -0,0 +1,107 @@ +error: Rust has no prefix increment operator + --> $DIR/issue-104867-inc-dec-2.rs:3:17 + | +LL | let _ = i + ++i; + | ^^ not a valid prefix operator + | +help: use `+= 1` instead + | +LL | let _ = i + { i += 1; i }; + | ~ +++++++++ + +error: Rust has no prefix increment operator + --> $DIR/issue-104867-inc-dec-2.rs:8:13 + | +LL | let _ = ++i + i; + | ^^ not a valid prefix operator + | +help: use `+= 1` instead + | +LL | let _ = { i += 1; i } + i; + | ~ +++++++++ + +error: Rust has no prefix increment operator + --> $DIR/issue-104867-inc-dec-2.rs:13:13 + | +LL | let _ = ++i + ++i; + | ^^ not a valid prefix operator + | +help: use `+= 1` instead + | +LL | let _ = { i += 1; i } + ++i; + | ~ +++++++++ + +error: Rust has no postfix increment operator + --> $DIR/issue-104867-inc-dec-2.rs:18:18 + | +LL | let _ = i + i++; + | ^^ not a valid postfix operator + +error: Rust has no postfix increment operator + --> $DIR/issue-104867-inc-dec-2.rs:24:14 + | +LL | let _ = i++ + i; + | ^^ not a valid postfix operator + | +help: use `+= 1` instead + | +LL | let _ = { let tmp = i; i += 1; tmp } + i; + | +++++++++++ ~~~~~~~~~~~~~~~ + +error: Rust has no postfix increment operator + --> $DIR/issue-104867-inc-dec-2.rs:29:14 + | +LL | let _ = i++ + i++; + | ^^ not a valid postfix operator + | +help: use `+= 1` instead + | +LL | let _ = { let tmp = i; i += 1; tmp } + i++; + | +++++++++++ ~~~~~~~~~~~~~~~ + +error: Rust has no prefix increment operator + --> $DIR/issue-104867-inc-dec-2.rs:34:13 + | +LL | let _ = ++i + i++; + | ^^ not a valid prefix operator + | +help: use `+= 1` instead + | +LL | let _ = { i += 1; i } + i++; + | ~ +++++++++ + +error: Rust has no postfix increment operator + --> $DIR/issue-104867-inc-dec-2.rs:39:14 + | +LL | let _ = i++ + ++i; + | ^^ not a valid postfix operator + | +help: use `+= 1` instead + | +LL | let _ = { let tmp = i; i += 1; tmp } + ++i; + | +++++++++++ ~~~~~~~~~~~~~~~ + +error: Rust has no postfix increment operator + --> $DIR/issue-104867-inc-dec-2.rs:44:24 + | +LL | let _ = (1 + 2 + i)++; + | ^^ not a valid postfix operator + | +help: use `+= 1` instead + | +LL | let _ = { let tmp = (1 + 2 + i); (1 + 2 + i) += 1; tmp }; + | +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: Rust has no postfix increment operator + --> $DIR/issue-104867-inc-dec-2.rs:49:15 + | +LL | let _ = (i++ + 1) + 2; + | ^^ not a valid postfix operator + | +help: use `+= 1` instead + | +LL | let _ = ({ let tmp = i; i += 1; tmp } + 1) + 2; + | +++++++++++ ~~~~~~~~~~~~~~~ + +error: aborting due to 10 previous errors + diff --git a/src/test/ui/parser/issue-104867-inc-dec.rs b/src/test/ui/parser/issue-104867-inc-dec.rs new file mode 100644 index 00000000000..760c67b4bed --- /dev/null +++ b/src/test/ui/parser/issue-104867-inc-dec.rs @@ -0,0 +1,45 @@ +struct S { + x: i32, +} + +fn test1() { + let mut i = 0; + i++; //~ ERROR Rust has no postfix increment operator +} + +fn test2() { + let s = S { x: 0 }; + s.x++; //~ ERROR Rust has no postfix increment operator +} + +fn test3() { + let mut i = 0; + if i++ == 1 {} //~ ERROR Rust has no postfix increment operator +} + +fn test4() { + let mut i = 0; + ++i; //~ ERROR Rust has no prefix increment operator +} + +fn test5() { + let mut i = 0; + if ++i == 1 { } //~ ERROR Rust has no prefix increment operator +} + +fn test6() { + let mut i = 0; + loop { break; } + i++; //~ ERROR Rust has no postfix increment operator + loop { break; } + ++i; +} + +fn test7() { + let mut i = 0; + loop { break; } + ++i; //~ ERROR Rust has no prefix increment operator +} + + +fn main() {} diff --git a/src/test/ui/parser/issue-104867-inc-dec.stderr b/src/test/ui/parser/issue-104867-inc-dec.stderr new file mode 100644 index 00000000000..78bfd3e82f0 --- /dev/null +++ b/src/test/ui/parser/issue-104867-inc-dec.stderr @@ -0,0 +1,81 @@ +error: Rust has no postfix increment operator + --> $DIR/issue-104867-inc-dec.rs:7:6 + | +LL | i++; + | ^^ not a valid postfix operator + | +help: use `+= 1` instead + | +LL | i += 1; + | ~~~~ + +error: Rust has no postfix increment operator + --> $DIR/issue-104867-inc-dec.rs:12:8 + | +LL | s.x++; + | ^^ not a valid postfix operator + | +help: use `+= 1` instead + | +LL | s.x += 1; + | ~~~~ + +error: Rust has no postfix increment operator + --> $DIR/issue-104867-inc-dec.rs:17:9 + | +LL | if i++ == 1 {} + | ^^ not a valid postfix operator + | +help: use `+= 1` instead + | +LL | if { let tmp = i; i += 1; tmp } == 1 {} + | +++++++++++ ~~~~~~~~~~~~~~~ + +error: Rust has no prefix increment operator + --> $DIR/issue-104867-inc-dec.rs:22:5 + | +LL | ++i; + | ^^ not a valid prefix operator + | +help: use `+= 1` instead + | +LL - ++i; +LL + i += 1; + | + +error: Rust has no prefix increment operator + --> $DIR/issue-104867-inc-dec.rs:27:8 + | +LL | if ++i == 1 { } + | ^^ not a valid prefix operator + | +help: use `+= 1` instead + | +LL | if { i += 1; i } == 1 { } + | ~ +++++++++ + +error: Rust has no postfix increment operator + --> $DIR/issue-104867-inc-dec.rs:33:6 + | +LL | i++; + | ^^ not a valid postfix operator + | +help: use `+= 1` instead + | +LL | i += 1; + | ~~~~ + +error: Rust has no prefix increment operator + --> $DIR/issue-104867-inc-dec.rs:41:5 + | +LL | ++i; + | ^^ not a valid prefix operator + | +help: use `+= 1` instead + | +LL - ++i; +LL + i += 1; + | + +error: aborting due to 7 previous errors + diff --git a/src/test/ui/parser/issue-105366.fixed b/src/test/ui/parser/issue-105366.fixed new file mode 100644 index 00000000000..ad26643c327 --- /dev/null +++ b/src/test/ui/parser/issue-105366.fixed @@ -0,0 +1,12 @@ +// run-rustfix + +struct Foo; + +impl From<i32> for Foo { + //~^ ERROR you might have meant to write `impl` instead of `fn` + fn from(_a: i32) -> Self { + Foo + } +} + +fn main() {} diff --git a/src/test/ui/parser/issue-105366.rs b/src/test/ui/parser/issue-105366.rs new file mode 100644 index 00000000000..311b6a60f1a --- /dev/null +++ b/src/test/ui/parser/issue-105366.rs @@ -0,0 +1,12 @@ +// run-rustfix + +struct Foo; + +fn From<i32> for Foo { + //~^ ERROR you might have meant to write `impl` instead of `fn` + fn from(_a: i32) -> Self { + Foo + } +} + +fn main() {} diff --git a/src/test/ui/parser/issue-105366.stderr b/src/test/ui/parser/issue-105366.stderr new file mode 100644 index 00000000000..0a7408e2c17 --- /dev/null +++ b/src/test/ui/parser/issue-105366.stderr @@ -0,0 +1,13 @@ +error: you might have meant to write `impl` instead of `fn` + --> $DIR/issue-105366.rs:5:1 + | +LL | fn From<i32> for Foo { + | ^^ + | +help: replace `fn` with `impl` here + | +LL | impl From<i32> for Foo { + | ~~~~ + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-39616.rs b/src/test/ui/parser/issue-39616.rs index 46b5aa334ca..46b5aa334ca 100644 --- a/src/test/ui/issues/issue-39616.rs +++ b/src/test/ui/parser/issue-39616.rs diff --git a/src/test/ui/issues/issue-39616.stderr b/src/test/ui/parser/issue-39616.stderr index 393d1f2e2ce..393d1f2e2ce 100644 --- a/src/test/ui/issues/issue-39616.stderr +++ b/src/test/ui/parser/issue-39616.stderr diff --git a/src/test/ui/issues/issue-49257.rs b/src/test/ui/parser/issue-49257.rs index a7fa19d52fd..a7fa19d52fd 100644 --- a/src/test/ui/issues/issue-49257.rs +++ b/src/test/ui/parser/issue-49257.rs diff --git a/src/test/ui/issues/issue-49257.stderr b/src/test/ui/parser/issue-49257.stderr index 846467f7f22..846467f7f22 100644 --- a/src/test/ui/issues/issue-49257.stderr +++ b/src/test/ui/parser/issue-49257.stderr diff --git a/src/test/ui/parser/issues/issue-62894.stderr b/src/test/ui/parser/issues/issue-62894.stderr index ae89926914e..07a203bf416 100644 --- a/src/test/ui/parser/issues/issue-62894.stderr +++ b/src/test/ui/parser/issues/issue-62894.stderr @@ -42,11 +42,9 @@ LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! LL | LL | fn main() {} | ^^ unexpected token + --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | - ::: $SRC_DIR/core/src/macros/mod.rs:LL:COL - | -LL | ($left:expr, $right:expr $(,)?) => { - | ---------- while parsing argument for this `expr` macro fragment + = note: while parsing argument for this `expr` macro fragment error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/kw-in-trait-bounds.stderr b/src/test/ui/parser/kw-in-trait-bounds.stderr index 546ad84eeee..79643660e8b 100644 --- a/src/test/ui/parser/kw-in-trait-bounds.stderr +++ b/src/test/ui/parser/kw-in-trait-bounds.stderr @@ -91,44 +91,36 @@ error[E0405]: cannot find trait `r#fn` in this scope | LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) | ^^ help: a trait with a similar name exists (notice the capitalization): `Fn` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait Fn<Args: Tuple>: FnMut<Args> { - | -------------------------------------- similarly named trait `Fn` defined here + = note: similarly named trait `Fn` defined here error[E0405]: cannot find trait `r#fn` in this scope --> $DIR/kw-in-trait-bounds.rs:17:4 | LL | G: fn(), | ^^ help: a trait with a similar name exists (notice the capitalization): `Fn` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait Fn<Args: Tuple>: FnMut<Args> { - | -------------------------------------- similarly named trait `Fn` defined here + = note: similarly named trait `Fn` defined here error[E0405]: cannot find trait `r#fn` in this scope --> $DIR/kw-in-trait-bounds.rs:3:27 | LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) | ^^ help: a trait with a similar name exists (notice the capitalization): `Fn` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait Fn<Args: Tuple>: FnMut<Args> { - | -------------------------------------- similarly named trait `Fn` defined here + = note: similarly named trait `Fn` defined here error[E0405]: cannot find trait `r#fn` in this scope --> $DIR/kw-in-trait-bounds.rs:3:41 | LL | fn _f<F: fn(), G>(_: impl fn(), _: &dyn fn()) | ^^ help: a trait with a similar name exists (notice the capitalization): `Fn` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait Fn<Args: Tuple>: FnMut<Args> { - | -------------------------------------- similarly named trait `Fn` defined here + = note: similarly named trait `Fn` defined here error[E0405]: cannot find trait `r#struct` in this scope --> $DIR/kw-in-trait-bounds.rs:24:10 diff --git a/src/test/ui/parser/macro/issue-37113.stderr b/src/test/ui/parser/macro/issue-37113.stderr index b1f8674fbdf..da9e743a0b4 100644 --- a/src/test/ui/parser/macro/issue-37113.stderr +++ b/src/test/ui/parser/macro/issue-37113.stderr @@ -9,6 +9,7 @@ LL | $( $t, )* LL | test_macro!(String,); | -------------------- in this macro invocation | + = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` = note: this error originates in the macro `test_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes-fixable.fixed b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes-fixable.fixed new file mode 100644 index 00000000000..5f04fc83d37 --- /dev/null +++ b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes-fixable.fixed @@ -0,0 +1,12 @@ +// run-rustfix +#![allow(unused_variables)] +fn main() { + struct U; + + // A tuple is a "non-reference pattern". + // A `mut` binding pattern resets the binding mode to by-value. + + let mut p = (U, U); + let (a, ref mut b) = &mut p; + //~^ ERROR cannot move out of a mutable reference +} diff --git a/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes-fixable.rs b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes-fixable.rs new file mode 100644 index 00000000000..5dc1ae2feb5 --- /dev/null +++ b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes-fixable.rs @@ -0,0 +1,12 @@ +// run-rustfix +#![allow(unused_variables)] +fn main() { + struct U; + + // A tuple is a "non-reference pattern". + // A `mut` binding pattern resets the binding mode to by-value. + + let mut p = (U, U); + let (a, mut b) = &mut p; + //~^ ERROR cannot move out of a mutable reference +} diff --git a/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes-fixable.stderr b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes-fixable.stderr new file mode 100644 index 00000000000..d3ab533e35e --- /dev/null +++ b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes-fixable.stderr @@ -0,0 +1,17 @@ +error[E0507]: cannot move out of a mutable reference + --> $DIR/move-ref-patterns-default-binding-modes-fixable.rs:10:22 + | +LL | let (a, mut b) = &mut p; + | ----- ^^^^^^ + | | + | data moved here + | move occurs because `b` has type `U`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | let (a, ref mut b) = &mut p; + | +++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes.rs b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes.rs index 1dd66aad57a..6c913c24513 100644 --- a/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes.rs +++ b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes.rs @@ -7,8 +7,4 @@ fn main() { let p = (U, U); let (a, mut b) = &p; //~^ ERROR cannot move out of a shared reference - - let mut p = (U, U); - let (a, mut b) = &mut p; - //~^ ERROR cannot move out of a mutable reference } diff --git a/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes.stderr b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes.stderr index 6952c743a30..65030b62250 100644 --- a/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes.stderr +++ b/src/test/ui/pattern/move-ref-patterns/move-ref-patterns-default-binding-modes.stderr @@ -6,16 +6,12 @@ LL | let (a, mut b) = &p; | | | data moved here | move occurs because `b` has type `U`, which does not implement the `Copy` trait - -error[E0507]: cannot move out of a mutable reference - --> $DIR/move-ref-patterns-default-binding-modes.rs:12:22 | -LL | let (a, mut b) = &mut p; - | ----- ^^^^^^ - | | - | data moved here - | move occurs because `b` has type `U`, which does not implement the `Copy` trait +help: consider borrowing the pattern binding + | +LL | let (a, ref mut b) = &p; + | +++ -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/pattern/pat-tuple-bad-type.stderr b/src/test/ui/pattern/pat-tuple-bad-type.stderr index 3342b8e4002..da369d33397 100644 --- a/src/test/ui/pattern/pat-tuple-bad-type.stderr +++ b/src/test/ui/pattern/pat-tuple-bad-type.stderr @@ -9,8 +9,8 @@ LL | (..) => {} | help: consider giving `x` an explicit type | -LL | let x: _; - | +++ +LL | let x: /* Type */; + | ++++++++++++ error[E0308]: mismatched types --> $DIR/pat-tuple-bad-type.rs:10:9 diff --git a/src/test/ui/pattern/rest-pat-semantic-disallowed.stderr b/src/test/ui/pattern/rest-pat-semantic-disallowed.stderr index e6a4e5f19b7..beba7def96f 100644 --- a/src/test/ui/pattern/rest-pat-semantic-disallowed.stderr +++ b/src/test/ui/pattern/rest-pat-semantic-disallowed.stderr @@ -193,8 +193,8 @@ LL | let x @ ..; | help: consider giving this pattern a type | -LL | let x @ ..: _; - | +++ +LL | let x @ ..: /* Type */; + | ++++++++++++ error: aborting due to 23 previous errors diff --git a/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr b/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr index f3dca9bcb07..2a016048f2f 100644 --- a/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr +++ b/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr @@ -6,12 +6,9 @@ LL | match Some(1) { | note: `Option<i32>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL + ::: $SRC_DIR/core/src/option.rs:LL:COL | -LL | pub enum Option<T> { - | ------------------ -... -LL | None, - | ^^^^ not covered + = note: not covered = note: the matched value is of type `Option<i32>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr index b450a9aeddf..17e1a2304a1 100644 --- a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr +++ b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr @@ -66,12 +66,9 @@ LL | match None { | note: `Option<HiddenEnum>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL + ::: $SRC_DIR/core/src/option.rs:LL:COL | -LL | pub enum Option<T> { - | ------------------ -... -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ not covered + = note: not covered = note: the matched value is of type `Option<HiddenEnum>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | diff --git a/src/test/ui/pattern/usefulness/issue-35609.stderr b/src/test/ui/pattern/usefulness/issue-35609.stderr index c9781d52e6d..12113957d63 100644 --- a/src/test/ui/pattern/usefulness/issue-35609.stderr +++ b/src/test/ui/pattern/usefulness/issue-35609.stderr @@ -107,9 +107,6 @@ LL | match Some(A) { | note: `Option<Enum>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | pub enum Option<T> { - | ^^^^^^^^^^^^^^^^^^ = note: the matched value is of type `Option<Enum>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | diff --git a/src/test/ui/pattern/usefulness/issue-3601.stderr b/src/test/ui/pattern/usefulness/issue-3601.stderr index eb8c63919b6..59d7bcd4b5e 100644 --- a/src/test/ui/pattern/usefulness/issue-3601.stderr +++ b/src/test/ui/pattern/usefulness/issue-3601.stderr @@ -6,12 +6,6 @@ LL | box NodeKind::Element(ed) => match ed.kind { | note: `Box<ElementKind>` defined here --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - | -LL | / pub struct Box< -LL | | T: ?Sized, -LL | | #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, -LL | | >(Unique<T>, A); - | |_^ = note: the matched value is of type `Box<ElementKind>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr index b0d7fe5eb68..e4dd35a5995 100644 --- a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr +++ b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr @@ -19,15 +19,11 @@ LL | match Some(Some(North)) { | note: `Option<Option<Direction>>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL + ::: $SRC_DIR/core/src/option.rs:LL:COL | -LL | pub enum Option<T> { - | ------------------ -... -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ - | | - | not covered - | not covered + = note: not covered + | + = note: not covered = note: the matched value is of type `Option<Option<Direction>>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/pattern/usefulness/match-privately-empty.stderr b/src/test/ui/pattern/usefulness/match-privately-empty.stderr index 4607cfaae17..86f75d15cfd 100644 --- a/src/test/ui/pattern/usefulness/match-privately-empty.stderr +++ b/src/test/ui/pattern/usefulness/match-privately-empty.stderr @@ -6,12 +6,9 @@ LL | match private::DATA { | note: `Option<Private>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL + ::: $SRC_DIR/core/src/option.rs:LL:COL | -LL | pub enum Option<T> { - | ------------------ -... -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ not covered + = note: not covered = note: the matched value is of type `Option<Private>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr index 4234600d0d0..e2260f50bfe 100644 --- a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -36,12 +36,9 @@ LL | match Some(10) { | note: `Option<i32>` defined here --> $SRC_DIR/core/src/option.rs:LL:COL + ::: $SRC_DIR/core/src/option.rs:LL:COL | -LL | pub enum Option<T> { - | ------------------ -... -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ not covered + = note: not covered = note: the matched value is of type `Option<i32>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | diff --git a/src/test/ui/pptypedef.stderr b/src/test/ui/pptypedef.stderr index 49895f3db4d..08b90b365e3 100644 --- a/src/test/ui/pptypedef.stderr +++ b/src/test/ui/pptypedef.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/pptypedef.rs:4:37 | LL | let_in(3u32, |i| { assert!(i == 3i32); }); - | ^^^^ expected `u32`, found `i32` + | - ^^^^ expected `u32`, found `i32` + | | + | expected because this is `u32` | help: change the type of the numeric literal from `i32` to `u32` | @@ -13,7 +15,9 @@ error[E0308]: mismatched types --> $DIR/pptypedef.rs:8:37 | LL | let_in(3i32, |i| { assert!(i == 3u32); }); - | ^^^^ expected `i32`, found `u32` + | - ^^^^ expected `i32`, found `u32` + | | + | expected because this is `i32` | help: change the type of the numeric literal from `u32` to `i32` | diff --git a/src/test/ui/print_type_sizes/async.rs b/src/test/ui/print_type_sizes/async.rs new file mode 100644 index 00000000000..3491ad5afbc --- /dev/null +++ b/src/test/ui/print_type_sizes/async.rs @@ -0,0 +1,19 @@ +// compile-flags: -Z print-type-sizes +// edition:2021 +// build-pass +// ignore-pass + +#![feature(start)] + +async fn wait() {} + +async fn test(arg: [u8; 8192]) { + wait().await; + drop(arg); +} + +#[start] +fn start(_: isize, _: *const *const u8) -> isize { + let _ = test([0; 8192]); + 0 +} diff --git a/src/test/ui/print_type_sizes/async.stdout b/src/test/ui/print_type_sizes/async.stdout new file mode 100644 index 00000000000..94ad09ef296 --- /dev/null +++ b/src/test/ui/print_type_sizes/async.stdout @@ -0,0 +1,34 @@ +print-type-size type: `[async fn body@$DIR/async.rs:10:32: 13:2]`: 16386 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Suspend0`: 16385 bytes +print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size field `.arg`: 8192 bytes +print-type-size field `.__awaitee`: 1 bytes +print-type-size variant `Unresumed`: 8192 bytes +print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Returned`: 8192 bytes +print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Panicked`: 8192 bytes +print-type-size field `.arg`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size type: `std::mem::ManuallyDrop<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes +print-type-size field `.value`: 8192 bytes +print-type-size type: `std::mem::MaybeUninit<[u8; 8192]>`: 8192 bytes, alignment: 1 bytes +print-type-size variant `MaybeUninit`: 8192 bytes +print-type-size field `.uninit`: 0 bytes +print-type-size field `.value`: 8192 bytes +print-type-size type: `[async fn body@$DIR/async.rs:8:17: 8:19]`: 1 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Unresumed`: 0 bytes +print-type-size variant `Returned`: 0 bytes +print-type-size variant `Panicked`: 0 bytes +print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async.rs:8:17: 8:19]>`: 1 bytes, alignment: 1 bytes +print-type-size field `.value`: 1 bytes +print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async.rs:8:17: 8:19]>`: 1 bytes, alignment: 1 bytes +print-type-size variant `MaybeUninit`: 1 bytes +print-type-size field `.uninit`: 0 bytes +print-type-size field `.value`: 1 bytes +print-type-size type: `std::task::Poll<()>`: 1 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Ready`: 0 bytes +print-type-size field `.0`: 0 bytes +print-type-size variant `Pending`: 0 bytes diff --git a/src/test/ui/print_type_sizes/generator.rs b/src/test/ui/print_type_sizes/generator.rs new file mode 100644 index 00000000000..a46db612104 --- /dev/null +++ b/src/test/ui/print_type_sizes/generator.rs @@ -0,0 +1,20 @@ +// compile-flags: -Z print-type-sizes +// build-pass +// ignore-pass + +#![feature(start, generators, generator_trait)] + +use std::ops::Generator; + +fn generator<const C: usize>(array: [u8; C]) -> impl Generator<Yield = (), Return = ()> { + move |()| { + yield (); + let _ = array; + } +} + +#[start] +fn start(_: isize, _: *const *const u8) -> isize { + let _ = generator([0; 8192]); + 0 +} diff --git a/src/test/ui/print_type_sizes/generator.stdout b/src/test/ui/print_type_sizes/generator.stdout new file mode 100644 index 00000000000..28d4a6e6cff --- /dev/null +++ b/src/test/ui/print_type_sizes/generator.stdout @@ -0,0 +1,10 @@ +print-type-size type: `[generator@$DIR/generator.rs:10:5: 10:14]`: 8193 bytes, alignment: 1 bytes +print-type-size discriminant: 1 bytes +print-type-size variant `Unresumed`: 8192 bytes +print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Returned`: 8192 bytes +print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Panicked`: 8192 bytes +print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes +print-type-size variant `Suspend0`: 8192 bytes +print-type-size field `.array`: 8192 bytes, offset: 0 bytes, alignment: 1 bytes diff --git a/src/test/ui/privacy/associated-item-privacy-trait.rs b/src/test/ui/privacy/associated-item-privacy-trait.rs index ad9a5e15c4e..c686a21772e 100644 --- a/src/test/ui/privacy/associated-item-privacy-trait.rs +++ b/src/test/ui/privacy/associated-item-privacy-trait.rs @@ -19,9 +19,9 @@ mod priv_trait { Pub.method(); //~^ ERROR type `for<'a> fn(&'a Self) {<Self as PrivTr>::method}` is private <Pub as PrivTr>::CONST; - //~^ ERROR associated constant `<Pub as PrivTr>::CONST` is private + //~^ ERROR associated constant `PrivTr::CONST` is private let _: <Pub as PrivTr>::AssocTy; - //~^ ERROR associated type `<Pub as PrivTr>::AssocTy` is private + //~^ ERROR associated type `PrivTr::AssocTy` is private pub type InSignatureTy = <Pub as PrivTr>::AssocTy; //~^ ERROR trait `PrivTr` is private pub trait InSignatureTr: PrivTr {} diff --git a/src/test/ui/privacy/associated-item-privacy-trait.stderr b/src/test/ui/privacy/associated-item-privacy-trait.stderr index c4be1a9d9a2..eb905bf7ef8 100644 --- a/src/test/ui/privacy/associated-item-privacy-trait.stderr +++ b/src/test/ui/privacy/associated-item-privacy-trait.stderr @@ -31,7 +31,7 @@ LL | priv_trait::mac!(); | = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info) -error: associated constant `<Pub as PrivTr>::CONST` is private +error: associated constant `PrivTr::CONST` is private --> $DIR/associated-item-privacy-trait.rs:21:9 | LL | <Pub as PrivTr>::CONST; @@ -42,7 +42,7 @@ LL | priv_trait::mac!(); | = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info) -error: associated type `<Pub as PrivTr>::AssocTy` is private +error: associated type `PrivTr::AssocTy` is private --> $DIR/associated-item-privacy-trait.rs:23:16 | LL | let _: <Pub as PrivTr>::AssocTy; diff --git a/src/test/ui/privacy/effective_visibilities.rs b/src/test/ui/privacy/effective_visibilities.rs index 8d0602fa79f..ff20e20d332 100644 --- a/src/test/ui/privacy/effective_visibilities.rs +++ b/src/test/ui/privacy/effective_visibilities.rs @@ -72,6 +72,5 @@ mod half_public_import { #[rustc_effective_visibility] pub use half_public_import::HalfPublicImport; //~ ERROR Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - //~^ ERROR Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub fn main() {} diff --git a/src/test/ui/privacy/effective_visibilities.stderr b/src/test/ui/privacy/effective_visibilities.stderr index 6a99afe64fe..046b6095f4e 100644 --- a/src/test/ui/privacy/effective_visibilities.stderr +++ b/src/test/ui/privacy/effective_visibilities.stderr @@ -124,12 +124,6 @@ error: Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: LL | pub use half_public_import::HalfPublicImport; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: Direct: pub, Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub - --> $DIR/effective_visibilities.rs:74:9 - | -LL | pub use half_public_import::HalfPublicImport; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImplTrait: pub --> $DIR/effective_visibilities.rs:14:13 | @@ -142,5 +136,5 @@ error: Direct: pub(crate), Reexported: pub, Reachable: pub, ReachableThroughImpl LL | type B; | ^^^^^^ -error: aborting due to 24 previous errors +error: aborting due to 23 previous errors diff --git a/src/test/ui/privacy/private-inferred-type-3.rs b/src/test/ui/privacy/private-inferred-type-3.rs index 0337aedd008..cdbdcf60b2c 100644 --- a/src/test/ui/privacy/private-inferred-type-3.rs +++ b/src/test/ui/privacy/private-inferred-type-3.rs @@ -1,7 +1,7 @@ // aux-build:private-inferred-type.rs // error-pattern:type `fn() {ext::priv_fn}` is private -// error-pattern:static `PRIV_STATIC` is private +// error-pattern:static `ext::PRIV_STATIC` is private // error-pattern:type `ext::PrivEnum` is private // error-pattern:type `fn() {<u8 as ext::PrivTrait>::method}` is private // error-pattern:type `fn(u8) -> ext::PrivTupleStruct {ext::PrivTupleStruct}` is private diff --git a/src/test/ui/privacy/private-inferred-type-3.stderr b/src/test/ui/privacy/private-inferred-type-3.stderr index 00b61512de6..42faeb4bf34 100644 --- a/src/test/ui/privacy/private-inferred-type-3.stderr +++ b/src/test/ui/privacy/private-inferred-type-3.stderr @@ -6,7 +6,7 @@ LL | ext::m!(); | = note: this error originates in the macro `ext::m` (in Nightly builds, run with -Z macro-backtrace for more info) -error: static `PRIV_STATIC` is private +error: static `ext::PRIV_STATIC` is private --> $DIR/private-inferred-type-3.rs:16:5 | LL | ext::m!(); diff --git a/src/test/ui/proc-macro/attr-invalid-exprs.stderr b/src/test/ui/proc-macro/attr-invalid-exprs.stderr index bcb54df0eca..f96939bb6ef 100644 --- a/src/test/ui/proc-macro/attr-invalid-exprs.stderr +++ b/src/test/ui/proc-macro/attr-invalid-exprs.stderr @@ -8,21 +8,25 @@ error: macro expansion ignores token `,` and any following --> $DIR/attr-invalid-exprs.rs:15:13 | LL | let _ = #[duplicate] "Hello, world!"; - | ^^^^^^^^^^^^- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here + | ^^^^^^^^^^^^ caused by the macro expansion here | = note: the usage of `duplicate!` is likely invalid in expression context +help: you might be missing a semicolon here + | +LL | let _ = #[duplicate]; "Hello, world!"; + | + error: macro expansion ignores token `,` and any following --> $DIR/attr-invalid-exprs.rs:24:9 | LL | #[duplicate] - | ^^^^^^^^^^^^- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here + | ^^^^^^^^^^^^ caused by the macro expansion here | = note: the usage of `duplicate!` is likely invalid in expression context +help: you might be missing a semicolon here + | +LL | #[duplicate]; + | + error: aborting due to 3 previous errors diff --git a/src/test/ui/proc-macro/attribute.rs b/src/test/ui/proc-macro/attribute.rs index 5531b323621..9e40e4d9ba6 100644 --- a/src/test/ui/proc-macro/attribute.rs +++ b/src/test/ui/proc-macro/attribute.rs @@ -53,19 +53,19 @@ pub fn foo11(input: TokenStream) -> TokenStream { input } pub fn foo12(input: TokenStream) -> TokenStream { input } #[proc_macro_derive(d13, attributes("a"))] -//~^ ERROR: not a meta item +//~^ ERROR: attribute must be a meta item, not a literal pub fn foo13(input: TokenStream) -> TokenStream { input } #[proc_macro_derive(d14, attributes(a = ""))] -//~^ ERROR: must only be one word +//~^ ERROR: attribute must only be a single word pub fn foo14(input: TokenStream) -> TokenStream { input } #[proc_macro_derive(d15, attributes(m::a))] -//~^ ERROR: must only be one word +//~^ ERROR: attribute must only be a single word pub fn foo15(input: TokenStream) -> TokenStream { input } #[proc_macro_derive(d16, attributes(a(b)))] -//~^ ERROR: must only be one word +//~^ ERROR: attribute must only be a single word pub fn foo16(input: TokenStream) -> TokenStream { input } #[proc_macro_derive(d17, attributes(self))] diff --git a/src/test/ui/proc-macro/attribute.stderr b/src/test/ui/proc-macro/attribute.stderr index 021e7cad09b..3269aaf7f91 100644 --- a/src/test/ui/proc-macro/attribute.stderr +++ b/src/test/ui/proc-macro/attribute.stderr @@ -70,25 +70,25 @@ error: attribute must be of form: `attributes(foo, bar)` LL | #[proc_macro_derive(d12, attributes)] | ^^^^^^^^^^ -error: not a meta item +error: attribute must be a meta item, not a literal --> $DIR/attribute.rs:55:37 | LL | #[proc_macro_derive(d13, attributes("a"))] | ^^^ -error: must only be one word +error: attribute must only be a single word --> $DIR/attribute.rs:59:37 | LL | #[proc_macro_derive(d14, attributes(a = ""))] | ^^^^^^ -error: must only be one word +error: attribute must only be a single word --> $DIR/attribute.rs:63:37 | LL | #[proc_macro_derive(d15, attributes(m::a))] | ^^^^ -error: must only be one word +error: attribute must only be a single word --> $DIR/attribute.rs:67:37 | LL | #[proc_macro_derive(d16, attributes(a(b)))] diff --git a/src/test/ui/proc-macro/expand-expr.stderr b/src/test/ui/proc-macro/expand-expr.stderr index c6c4695fd9c..0004f2fe17f 100644 --- a/src/test/ui/proc-macro/expand-expr.stderr +++ b/src/test/ui/proc-macro/expand-expr.stderr @@ -26,21 +26,25 @@ error: macro expansion ignores token `hello` and any following --> $DIR/expand-expr.rs:115:47 | LL | expand_expr_is!("string", echo_tts!("string"; hello)); - | --------------------^^^^^-- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here + | --------------------^^^^^- caused by the macro expansion here | = note: the usage of `echo_tts!` is likely invalid in expression context +help: you might be missing a semicolon here + | +LL | expand_expr_is!("string", echo_tts!("string"; hello);); + | + error: macro expansion ignores token `;` and any following --> $DIR/expand-expr.rs:116:44 | LL | expand_expr_is!("string", echo_pm!("string"; hello)); - | -----------------^-------- help: you might be missing a semicolon here: `;` - | | - | caused by the macro expansion here + | -----------------^------- caused by the macro expansion here | = note: the usage of `echo_pm!` is likely invalid in expression context +help: you might be missing a semicolon here + | +LL | expand_expr_is!("string", echo_pm!("string"; hello);); + | + error: recursion limit reached while expanding `recursive_expand!` --> $DIR/expand-expr.rs:124:16 diff --git a/src/test/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr b/src/test/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr index ac49e04e3c0..14e5df21ef6 100644 --- a/src/test/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr +++ b/src/test/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr @@ -7,9 +7,6 @@ LL | #[derive(PartialOrd, AddImpl)] = help: the trait `PartialEq` is not implemented for `PriorityQueue<T>` note: required by a bound in `PartialOrd` --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> { - | ^^^^^^^^^^^^^^ required by this bound in `PartialOrd` = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `PriorityQueue<T>: Eq` is not satisfied @@ -20,9 +17,6 @@ LL | #[derive(PartialOrd, AddImpl)] | note: required by a bound in `Ord` --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub trait Ord: Eq + PartialOrd<Self> { - | ^^ required by this bound in `Ord` = note: this error originates in the derive macro `AddImpl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: can't compare `T` with `T` @@ -38,9 +32,6 @@ LL | #[derive(PartialOrd, AddImpl)] | ^^^^^^^^^^ note: required by a bound in `Ord` --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub trait Ord: Eq + PartialOrd<Self> { - | ^^^^^^^^^^^^^^^^ required by this bound in `Ord` = note: this error originates in the derive macro `AddImpl` which comes from the expansion of the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/src/test/ui/proc-macro/parent-source-spans.stderr b/src/test/ui/proc-macro/parent-source-spans.stderr index 65ce24e5522..a3b27fd7bcc 100644 --- a/src/test/ui/proc-macro/parent-source-spans.stderr +++ b/src/test/ui/proc-macro/parent-source-spans.stderr @@ -144,11 +144,9 @@ LL | parent_source_spans!($($tokens)*); ... LL | one!("hello", "world"); | ---------------------- in this macro invocation + --> $SRC_DIR/core/src/result.rs:LL:COL | - ::: $SRC_DIR/core/src/result.rs:LL:COL - | -LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), - | -- similarly named tuple variant `Ok` defined here + = note: similarly named tuple variant `Ok` defined here | = note: this error originates in the macro `parent_source_spans` which comes from the expansion of the macro `one` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -160,11 +158,9 @@ LL | parent_source_spans!($($tokens)*); ... LL | two!("yay", "rust"); | ------------------- in this macro invocation + --> $SRC_DIR/core/src/result.rs:LL:COL | - ::: $SRC_DIR/core/src/result.rs:LL:COL - | -LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), - | -- similarly named tuple variant `Ok` defined here + = note: similarly named tuple variant `Ok` defined here | = note: this error originates in the macro `parent_source_spans` which comes from the expansion of the macro `two` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -176,11 +172,9 @@ LL | parent_source_spans!($($tokens)*); ... LL | three!("hip", "hop"); | -------------------- in this macro invocation + --> $SRC_DIR/core/src/result.rs:LL:COL | - ::: $SRC_DIR/core/src/result.rs:LL:COL - | -LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), - | -- similarly named tuple variant `Ok` defined here + = note: similarly named tuple variant `Ok` defined here | = note: this error originates in the macro `parent_source_spans` which comes from the expansion of the macro `three` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/proc-macro/resolve-error.stderr b/src/test/ui/proc-macro/resolve-error.stderr index a534b9d5377..3c3f24d0ff2 100644 --- a/src/test/ui/proc-macro/resolve-error.stderr +++ b/src/test/ui/proc-macro/resolve-error.stderr @@ -72,22 +72,18 @@ error: cannot find derive macro `Dlone` in this scope | LL | #[derive(Dlone)] | ^^^^^ help: a derive macro with a similar name exists: `Clone` + --> $SRC_DIR/core/src/clone.rs:LL:COL | - ::: $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | pub macro Clone($item:item) { - | --------------- similarly named derive macro `Clone` defined here + = note: similarly named derive macro `Clone` defined here error: cannot find derive macro `Dlone` in this scope --> $DIR/resolve-error.rs:35:10 | LL | #[derive(Dlone)] | ^^^^^ help: a derive macro with a similar name exists: `Clone` + --> $SRC_DIR/core/src/clone.rs:LL:COL | - ::: $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | pub macro Clone($item:item) { - | --------------- similarly named derive macro `Clone` defined here + = note: similarly named derive macro `Clone` defined here error: cannot find attribute `FooWithLongNan` in this scope --> $DIR/resolve-error.rs:32:3 diff --git a/src/test/ui/proc-macro/signature.stderr b/src/test/ui/proc-macro/signature.stderr index 59b3e44c74a..79f2001da00 100644 --- a/src/test/ui/proc-macro/signature.stderr +++ b/src/test/ui/proc-macro/signature.stderr @@ -14,9 +14,6 @@ LL | | } = note: unsafe function cannot be called generically without an unsafe block note: required by a bound in `ProcMacro::custom_derive` --> $SRC_DIR/proc_macro/src/bridge/client.rs:LL:COL - | -LL | expand: impl Fn(crate::TokenStream) -> crate::TokenStream + Copy, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `ProcMacro::custom_derive` error: aborting due to previous error diff --git a/src/test/ui/proc-macro/span-api-tests.rs b/src/test/ui/proc-macro/span-api-tests.rs index 914ad54ed03..3f04ba866b7 100644 --- a/src/test/ui/proc-macro/span-api-tests.rs +++ b/src/test/ui/proc-macro/span-api-tests.rs @@ -2,6 +2,7 @@ // ignore-pretty // aux-build:span-api-tests.rs // aux-build:span-test-macros.rs +// compile-flags: -Ztranslate-remapped-path-to-local-path=yes #[macro_use] extern crate span_test_macros; diff --git a/src/test/ui/query-system/fn-sig-cycle-arity.rs b/src/test/ui/query-system/fn-sig-cycle-arity.rs new file mode 100644 index 00000000000..7a9b8469c9e --- /dev/null +++ b/src/test/ui/query-system/fn-sig-cycle-arity.rs @@ -0,0 +1,8 @@ +trait Dancer { + fn dance(&self) -> _ { + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types + self.dance() + } +} + +fn main() {} diff --git a/src/test/ui/query-system/fn-sig-cycle-arity.stderr b/src/test/ui/query-system/fn-sig-cycle-arity.stderr new file mode 100644 index 00000000000..67e0c254551 --- /dev/null +++ b/src/test/ui/query-system/fn-sig-cycle-arity.stderr @@ -0,0 +1,9 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types + --> $DIR/fn-sig-cycle-arity.rs:2:24 + | +LL | fn dance(&self) -> _ { + | ^ not allowed in type signatures + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0121`. diff --git a/src/test/ui/range/issue-54505-no-literals.stderr b/src/test/ui/range/issue-54505-no-literals.stderr index 4cbf8869d0c..070dc844563 100644 --- a/src/test/ui/range/issue-54505-no-literals.stderr +++ b/src/test/ui/range/issue-54505-no-literals.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | take_range(std::ops::Range { start: 0, end: 1 }); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `std::ops::Range` + | | expected reference, found struct `Range` | | help: consider borrowing here: `&std::ops::Range { start: 0, end: 1 }` | arguments to this function are incorrect | @@ -22,7 +22,7 @@ error[E0308]: mismatched types LL | take_range(::std::ops::Range { start: 0, end: 1 }); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `std::ops::Range` + | | expected reference, found struct `Range` | | help: consider borrowing here: `&::std::ops::Range { start: 0, end: 1 }` | arguments to this function are incorrect | diff --git a/src/test/ui/range/issue-54505.stderr b/src/test/ui/range/issue-54505.stderr index 38df6e14496..9eec169404c 100644 --- a/src/test/ui/range/issue-54505.stderr +++ b/src/test/ui/range/issue-54505.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | take_range(0..1); | ---------- ^^^^ | | | - | | expected reference, found struct `std::ops::Range` + | | expected reference, found struct `Range` | | help: consider borrowing here: `&(0..1)` | arguments to this function are incorrect | diff --git a/src/test/ui/range/issue-73553-misinterp-range-literal.stderr b/src/test/ui/range/issue-73553-misinterp-range-literal.stderr index 6badd998f96..d08d9b1345d 100644 --- a/src/test/ui/range/issue-73553-misinterp-range-literal.stderr +++ b/src/test/ui/range/issue-73553-misinterp-range-literal.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | demo(tell(1)..tell(10)); | ---- ^^^^^^^^^^^^^^^^^ | | | - | | expected reference, found struct `std::ops::Range` + | | expected `&Range<usize>`, found struct `Range` | | help: consider borrowing here: `&(tell(1)..tell(10))` | arguments to this function are incorrect | @@ -22,7 +22,7 @@ error[E0308]: mismatched types LL | demo(1..10); | ---- ^^^^^ | | | - | | expected reference, found struct `std::ops::Range` + | | expected `&Range<usize>`, found struct `Range` | | help: consider borrowing here: `&(1..10)` | arguments to this function are incorrect | diff --git a/src/test/ui/range/range-1.stderr b/src/test/ui/range/range-1.stderr index aaea91ce0cb..3956390368f 100644 --- a/src/test/ui/range/range-1.stderr +++ b/src/test/ui/range/range-1.stderr @@ -32,9 +32,6 @@ LL | let range = *arr..; = help: the trait `Sized` is not implemented for `[{integer}]` note: required by a bound in `RangeFrom` --> $SRC_DIR/core/src/ops/range.rs:LL:COL - | -LL | pub struct RangeFrom<Idx> { - | ^^^ required by this bound in `RangeFrom` error: aborting due to 3 previous errors diff --git a/src/test/ui/raw-ref-op/raw-ref-temp-deref.rs b/src/test/ui/raw-ref-op/raw-ref-temp-deref.rs index a814003aebf..2e075a1b9e8 100644 --- a/src/test/ui/raw-ref-op/raw-ref-temp-deref.rs +++ b/src/test/ui/raw-ref-op/raw-ref-temp-deref.rs @@ -18,7 +18,7 @@ fn main() { let index_deref_ref = &raw const SLICE_REF[1]; let x = 0; - let ascribe_ref = &raw const (x: i32); - let ascribe_deref = &raw const (*ARRAY_REF: [i32; 2]); - let ascribe_index_deref = &raw const (ARRAY_REF[0]: i32); + let ascribe_ref = &raw const type_ascribe!(x, i32); + let ascribe_deref = &raw const type_ascribe!(*ARRAY_REF, [i32; 2]); + let ascribe_index_deref = &raw const type_ascribe!(ARRAY_REF[0], i32); } diff --git a/src/test/ui/raw-ref-op/raw-ref-temp.rs b/src/test/ui/raw-ref-op/raw-ref-temp.rs index 32df56468da..10e47cb34c5 100644 --- a/src/test/ui/raw-ref-op/raw-ref-temp.rs +++ b/src/test/ui/raw-ref-op/raw-ref-temp.rs @@ -8,24 +8,24 @@ const PAIR: (i32, i64) = (1, 2); const ARRAY: [i32; 2] = [1, 2]; fn main() { - let ref_expr = &raw const 2; //~ ERROR cannot take address - let mut_ref_expr = &raw mut 3; //~ ERROR cannot take address - let ref_const = &raw const FOUR; //~ ERROR cannot take address - let mut_ref_const = &raw mut FOUR; //~ ERROR cannot take address - - let field_ref_expr = &raw const (1, 2).0; //~ ERROR cannot take address - let mut_field_ref_expr = &raw mut (1, 2).0; //~ ERROR cannot take address - let field_ref = &raw const PAIR.0; //~ ERROR cannot take address - let mut_field_ref = &raw mut PAIR.0; //~ ERROR cannot take address - - let index_ref_expr = &raw const [1, 2][0]; //~ ERROR cannot take address - let mut_index_ref_expr = &raw mut [1, 2][0]; //~ ERROR cannot take address - let index_ref = &raw const ARRAY[0]; //~ ERROR cannot take address - let mut_index_ref = &raw mut ARRAY[1]; //~ ERROR cannot take address - - let ref_ascribe = &raw const (2: i32); //~ ERROR cannot take address - let mut_ref_ascribe = &raw mut (3: i32); //~ ERROR cannot take address - - let ascribe_field_ref = &raw const (PAIR.0: i32); //~ ERROR cannot take address - let ascribe_index_ref = &raw mut (ARRAY[0]: i32); //~ ERROR cannot take address + let ref_expr = &raw const 2; //~ ERROR cannot take address + let mut_ref_expr = &raw mut 3; //~ ERROR cannot take address + let ref_const = &raw const FOUR; //~ ERROR cannot take address + let mut_ref_const = &raw mut FOUR; //~ ERROR cannot take address + + let field_ref_expr = &raw const (1, 2).0; //~ ERROR cannot take address + let mut_field_ref_expr = &raw mut (1, 2).0; //~ ERROR cannot take address + let field_ref = &raw const PAIR.0; //~ ERROR cannot take address + let mut_field_ref = &raw mut PAIR.0; //~ ERROR cannot take address + + let index_ref_expr = &raw const [1, 2][0]; //~ ERROR cannot take address + let mut_index_ref_expr = &raw mut [1, 2][0]; //~ ERROR cannot take address + let index_ref = &raw const ARRAY[0]; //~ ERROR cannot take address + let mut_index_ref = &raw mut ARRAY[1]; //~ ERROR cannot take address + + let ref_ascribe = &raw const type_ascribe!(2, i32); //~ ERROR cannot take address + let mut_ref_ascribe = &raw mut type_ascribe!(3, i32); //~ ERROR cannot take address + + let ascribe_field_ref = &raw const type_ascribe!(PAIR.0, i32); //~ ERROR cannot take address + let ascribe_index_ref = &raw mut type_ascribe!(ARRAY[0], i32); //~ ERROR cannot take address } diff --git a/src/test/ui/raw-ref-op/raw-ref-temp.stderr b/src/test/ui/raw-ref-op/raw-ref-temp.stderr index 80dea76d595..b9666162517 100644 --- a/src/test/ui/raw-ref-op/raw-ref-temp.stderr +++ b/src/test/ui/raw-ref-op/raw-ref-temp.stderr @@ -73,26 +73,26 @@ LL | let mut_index_ref = &raw mut ARRAY[1]; error[E0745]: cannot take address of a temporary --> $DIR/raw-ref-temp.rs:26:34 | -LL | let ref_ascribe = &raw const (2: i32); - | ^^^^^^^^ temporary value +LL | let ref_ascribe = &raw const type_ascribe!(2, i32); + | ^^^^^^^^^^^^^^^^^^^^^ temporary value error[E0745]: cannot take address of a temporary --> $DIR/raw-ref-temp.rs:27:36 | -LL | let mut_ref_ascribe = &raw mut (3: i32); - | ^^^^^^^^ temporary value +LL | let mut_ref_ascribe = &raw mut type_ascribe!(3, i32); + | ^^^^^^^^^^^^^^^^^^^^^ temporary value error[E0745]: cannot take address of a temporary --> $DIR/raw-ref-temp.rs:29:40 | -LL | let ascribe_field_ref = &raw const (PAIR.0: i32); - | ^^^^^^^^^^^^^ temporary value +LL | let ascribe_field_ref = &raw const type_ascribe!(PAIR.0, i32); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value error[E0745]: cannot take address of a temporary --> $DIR/raw-ref-temp.rs:30:38 | -LL | let ascribe_index_ref = &raw mut (ARRAY[0]: i32); - | ^^^^^^^^^^^^^^^ temporary value +LL | let ascribe_index_ref = &raw mut type_ascribe!(ARRAY[0], i32); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value error: aborting due to 16 previous errors diff --git a/src/test/ui/issues/auxiliary/issue-11225-1.rs b/src/test/ui/reachable/auxiliary/issue-11225-1.rs index 2c6f899a0f4..2c6f899a0f4 100644 --- a/src/test/ui/issues/auxiliary/issue-11225-1.rs +++ b/src/test/ui/reachable/auxiliary/issue-11225-1.rs diff --git a/src/test/ui/issues/auxiliary/issue-11225-2.rs b/src/test/ui/reachable/auxiliary/issue-11225-2.rs index 4381f0a4edf..4381f0a4edf 100644 --- a/src/test/ui/issues/auxiliary/issue-11225-2.rs +++ b/src/test/ui/reachable/auxiliary/issue-11225-2.rs diff --git a/src/test/ui/issues/auxiliary/issue-11225-3.rs b/src/test/ui/reachable/auxiliary/issue-11225-3.rs index 266e42a10b5..266e42a10b5 100644 --- a/src/test/ui/issues/auxiliary/issue-11225-3.rs +++ b/src/test/ui/reachable/auxiliary/issue-11225-3.rs diff --git a/src/test/ui/reachable/expr_type.rs b/src/test/ui/reachable/expr_type.rs index 8d32397b542..1ceb2f85971 100644 --- a/src/test/ui/reachable/expr_type.rs +++ b/src/test/ui/reachable/expr_type.rs @@ -6,7 +6,7 @@ fn a() { // the cast is unreachable: - let x = {return}: !; //~ ERROR unreachable + let x = type_ascribe!({return}, !); //~ ERROR unreachable } fn main() { } diff --git a/src/test/ui/reachable/expr_type.stderr b/src/test/ui/reachable/expr_type.stderr index c56c64be721..3cb4a32e02f 100644 --- a/src/test/ui/reachable/expr_type.stderr +++ b/src/test/ui/reachable/expr_type.stderr @@ -1,10 +1,10 @@ error: unreachable expression --> $DIR/expr_type.rs:9:13 | -LL | let x = {return}: !; - | ^------^^^^ - | || - | |any code following this expression is unreachable +LL | let x = type_ascribe!({return}, !); + | ^^^^^^^^^^^^^^^------^^^^^ + | | | + | | any code following this expression is unreachable | unreachable expression | note: the lint level is defined here diff --git a/src/test/ui/issues/issue-11225-1.rs b/src/test/ui/reachable/issue-11225-1.rs index d1f2ea5e7de..d1f2ea5e7de 100644 --- a/src/test/ui/issues/issue-11225-1.rs +++ b/src/test/ui/reachable/issue-11225-1.rs diff --git a/src/test/ui/issues/issue-11225-2.rs b/src/test/ui/reachable/issue-11225-2.rs index d41c75443f1..d41c75443f1 100644 --- a/src/test/ui/issues/issue-11225-2.rs +++ b/src/test/ui/reachable/issue-11225-2.rs diff --git a/src/test/ui/issues/issue-11225-3.rs b/src/test/ui/reachable/issue-11225-3.rs index e69496baa26..e69496baa26 100644 --- a/src/test/ui/issues/issue-11225-3.rs +++ b/src/test/ui/reachable/issue-11225-3.rs diff --git a/src/test/ui/recursion/issue-83150.stderr b/src/test/ui/recursion/issue-83150.stderr index 4d00a708313..dde8ad1b6b3 100644 --- a/src/test/ui/recursion/issue-83150.stderr +++ b/src/test/ui/recursion/issue-83150.stderr @@ -12,7 +12,7 @@ LL | func(&mut iter.map(|x| x + 1)) error[E0275]: overflow evaluating the requirement `Map<&mut Map<&mut Map<&mut Map<..., ...>, ...>, ...>, ...>: Iterator` | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`) - = note: required for `&mut Map<&mut Map<&mut Map<..., ...>, ...>, ...>` to implement `Iterator` + = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<..., ...>, ...>, ...>, ...>, ...>, ...>, ...>` to implement `Iterator` = note: the full type name has been written to '$TEST_BUILD_DIR/recursion/issue-83150/issue-83150.long-type-hash.txt' error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr index f2307899d3c..86ad6aa847c 100644 --- a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr +++ b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr @@ -8,12 +8,9 @@ LL | let Ok(x) = res; = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html note: `Result<u32, &R<'_>>` defined here --> $SRC_DIR/core/src/result.rs:LL:COL + ::: $SRC_DIR/core/src/result.rs:LL:COL | -LL | pub enum Result<T, E> { - | --------------------- -... -LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), - | ^^^ not covered + = note: not covered = note: the matched value is of type `Result<u32, &R<'_>>` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/regions/closure-in-projection-issue-97405.rs b/src/test/ui/regions/closure-in-projection-issue-97405.rs index e567d5c2723..88b1c139651 100644 --- a/src/test/ui/regions/closure-in-projection-issue-97405.rs +++ b/src/test/ui/regions/closure-in-projection-issue-97405.rs @@ -22,11 +22,11 @@ fn good_generic_fn<T>() { // This should fail because `T` ends up in the upvars of the closure. fn bad_generic_fn<T: Copy>(t: T) { assert_static(opaque(async move { t; }).next()); - //~^ ERROR the associated type `<impl Iterator as Iterator>::Item` may not live long enough + //~^ ERROR the parameter type `T` may not live long enough assert_static(opaque(move || { t; }).next()); //~^ ERROR the associated type `<impl Iterator as Iterator>::Item` may not live long enough assert_static(opaque(opaque(async move { t; }).next()).next()); - //~^ ERROR the associated type `<impl Iterator as Iterator>::Item` may not live long enough + //~^ ERROR the parameter type `T` may not live long enough } fn main() {} diff --git a/src/test/ui/regions/closure-in-projection-issue-97405.stderr b/src/test/ui/regions/closure-in-projection-issue-97405.stderr index c08f1059ebf..907964aaf37 100644 --- a/src/test/ui/regions/closure-in-projection-issue-97405.stderr +++ b/src/test/ui/regions/closure-in-projection-issue-97405.stderr @@ -1,11 +1,13 @@ -error[E0310]: the associated type `<impl Iterator as Iterator>::Item` may not live long enough +error[E0310]: the parameter type `T` may not live long enough --> $DIR/closure-in-projection-issue-97405.rs:24:5 | LL | assert_static(opaque(async move { t; }).next()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds | - = help: consider adding an explicit lifetime bound `<impl Iterator as Iterator>::Item: 'static`... - = note: ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds +help: consider adding an explicit lifetime bound... + | +LL | fn bad_generic_fn<T: Copy + 'static>(t: T) { + | +++++++++ error[E0310]: the associated type `<impl Iterator as Iterator>::Item` may not live long enough --> $DIR/closure-in-projection-issue-97405.rs:26:5 @@ -16,14 +18,16 @@ LL | assert_static(opaque(move || { t; }).next()); = help: consider adding an explicit lifetime bound `<impl Iterator as Iterator>::Item: 'static`... = note: ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds -error[E0310]: the associated type `<impl Iterator as Iterator>::Item` may not live long enough +error[E0310]: the parameter type `T` may not live long enough --> $DIR/closure-in-projection-issue-97405.rs:28:5 | LL | assert_static(opaque(opaque(async move { t; }).next()).next()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds | - = help: consider adding an explicit lifetime bound `<impl Iterator as Iterator>::Item: 'static`... - = note: ...so that the type `<impl Iterator as Iterator>::Item` will meet its required lifetime bounds +help: consider adding an explicit lifetime bound... + | +LL | fn bad_generic_fn<T: Copy + 'static>(t: T) { + | +++++++++ error: aborting due to 3 previous errors diff --git a/src/test/ui/regions/issue-102374.rs b/src/test/ui/regions/issue-102374.rs index e0a1164211a..fd71248d9cb 100644 --- a/src/test/ui/regions/issue-102374.rs +++ b/src/test/ui/regions/issue-102374.rs @@ -1,3 +1,4 @@ +// normalize-stderr-test: "long-type-\d+" -> "long-type-hash" use std::cell::Cell; #[rustfmt::skip] diff --git a/src/test/ui/regions/issue-102374.stderr b/src/test/ui/regions/issue-102374.stderr index 31b855c36be..157850693ab 100644 --- a/src/test/ui/regions/issue-102374.stderr +++ b/src/test/ui/regions/issue-102374.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-102374.rs:16:5 + --> $DIR/issue-102374.rs:17:5 | LL | ) -> i32 { | --- expected `i32` because of return type @@ -7,7 +7,8 @@ LL | f | ^ expected `i32`, found fn pointer | = note: expected type `i32` - found fn pointer `for<'z1, 'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, 'q, 'r, 's, 't, 'u, 'v, 'w, 'x, 'y, 'z, 'z0> fn(Cell<(&'z1 i32, &'a i32, &'b i32, &'c i32, &'d i32, &'e i32, &'f i32, &'g i32, &'h i32, &'i i32, &'j i32, &'k i32, &'l i32, &'m i32, &'n i32, &'o i32, &'p i32, &'q i32, &'r i32, &'s i32, &'t i32, &'u i32, &'v i32, &'w i32, &'x i32, &'y i32, &'z i32, &'z0 i32)>)` + found fn pointer `for<'z1, 'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j, 'k, 'l, 'm, 'n, 'o, 'p, 'q, 'r, 's, 't, 'u, 'v, 'w, 'x, 'y, 'z, 'z0> fn(Cell<...>)` + the full type name has been written to '$TEST_BUILD_DIR/regions/issue-102374/issue-102374.long-type-hash.txt' error: aborting due to previous error diff --git a/src/test/ui/resolve/bad-module.stderr b/src/test/ui/resolve/bad-module.stderr index 581a6619814..558760c6793 100644 --- a/src/test/ui/resolve/bad-module.stderr +++ b/src/test/ui/resolve/bad-module.stderr @@ -1,15 +1,15 @@ -error[E0433]: failed to resolve: use of undeclared crate or module `thing` - --> $DIR/bad-module.rs:2:15 - | -LL | let foo = thing::len(Vec::new()); - | ^^^^^ use of undeclared crate or module `thing` - error[E0433]: failed to resolve: use of undeclared crate or module `foo` --> $DIR/bad-module.rs:5:15 | LL | let foo = foo::bar::baz(); | ^^^ use of undeclared crate or module `foo` +error[E0433]: failed to resolve: use of undeclared crate or module `thing` + --> $DIR/bad-module.rs:2:15 + | +LL | let foo = thing::len(Vec::new()); + | ^^^^^ use of undeclared crate or module `thing` + error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/resolve/issue-101749-2.rs b/src/test/ui/resolve/issue-101749-2.rs new file mode 100644 index 00000000000..4d3d469447c --- /dev/null +++ b/src/test/ui/resolve/issue-101749-2.rs @@ -0,0 +1,16 @@ +struct Rectangle { + width: i32, + height: i32, +} +impl Rectangle { + fn new(width: i32, height: i32) -> Self { + Self { width, height } + } +} + +fn main() { + let rect = Rectangle::new(3, 4); + // `area` is not implemented for `Rectangle`, so this should not suggest + let _ = rect::area(); + //~^ ERROR failed to resolve: use of undeclared crate or module `rect` +} diff --git a/src/test/ui/resolve/issue-101749-2.stderr b/src/test/ui/resolve/issue-101749-2.stderr new file mode 100644 index 00000000000..370d4b14540 --- /dev/null +++ b/src/test/ui/resolve/issue-101749-2.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: use of undeclared crate or module `rect` + --> $DIR/issue-101749-2.rs:14:13 + | +LL | let _ = rect::area(); + | ^^^^ use of undeclared crate or module `rect` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/resolve/issue-101749.fixed b/src/test/ui/resolve/issue-101749.fixed new file mode 100644 index 00000000000..3e5544296e4 --- /dev/null +++ b/src/test/ui/resolve/issue-101749.fixed @@ -0,0 +1,19 @@ +// run-rustfix +struct Rectangle { + width: i32, + height: i32, +} +impl Rectangle { + fn new(width: i32, height: i32) -> Self { + Self { width, height } + } + fn area(&self) -> i32 { + self.height * self.width + } +} + +fn main() { + let rect = Rectangle::new(3, 4); + let _ = rect.area(); + //~^ ERROR failed to resolve: use of undeclared crate or module `rect` +} diff --git a/src/test/ui/resolve/issue-101749.rs b/src/test/ui/resolve/issue-101749.rs new file mode 100644 index 00000000000..fd67ccab6fa --- /dev/null +++ b/src/test/ui/resolve/issue-101749.rs @@ -0,0 +1,19 @@ +// run-rustfix +struct Rectangle { + width: i32, + height: i32, +} +impl Rectangle { + fn new(width: i32, height: i32) -> Self { + Self { width, height } + } + fn area(&self) -> i32 { + self.height * self.width + } +} + +fn main() { + let rect = Rectangle::new(3, 4); + let _ = rect::area(); + //~^ ERROR failed to resolve: use of undeclared crate or module `rect` +} diff --git a/src/test/ui/resolve/issue-101749.stderr b/src/test/ui/resolve/issue-101749.stderr new file mode 100644 index 00000000000..dd29d7fc051 --- /dev/null +++ b/src/test/ui/resolve/issue-101749.stderr @@ -0,0 +1,14 @@ +error[E0433]: failed to resolve: use of undeclared crate or module `rect` + --> $DIR/issue-101749.rs:17:13 + | +LL | let _ = rect::area(); + | ^^^^ use of undeclared crate or module `rect` + | +help: you may have meant to call an instance method + | +LL | let _ = rect.area(); + | ~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/resolve/issue-104700-inner_scope.rs b/src/test/ui/resolve/issue-104700-inner_scope.rs new file mode 100644 index 00000000000..e8f28c113e3 --- /dev/null +++ b/src/test/ui/resolve/issue-104700-inner_scope.rs @@ -0,0 +1,11 @@ +fn main() { + let foo = 1; + { + let bar = 2; + let test_func = |x| x > 3; + } + if bar == 2 { //~ ERROR cannot find value + println!("yes"); + } + test_func(1); //~ ERROR cannot find function +} diff --git a/src/test/ui/resolve/issue-104700-inner_scope.stderr b/src/test/ui/resolve/issue-104700-inner_scope.stderr new file mode 100644 index 00000000000..051b234fc72 --- /dev/null +++ b/src/test/ui/resolve/issue-104700-inner_scope.stderr @@ -0,0 +1,21 @@ +error[E0425]: cannot find value `bar` in this scope + --> $DIR/issue-104700-inner_scope.rs:7:8 + | +LL | if bar == 2 { + | ^^^ + | +help: the binding `bar` is available in a different scope in the same function + --> $DIR/issue-104700-inner_scope.rs:4:13 + | +LL | let bar = 2; + | ^^^ + +error[E0425]: cannot find function `test_func` in this scope + --> $DIR/issue-104700-inner_scope.rs:10:5 + | +LL | test_func(1); + | ^^^^^^^^^ not found in this scope + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/resolve/issue-105069.rs b/src/test/ui/resolve/issue-105069.rs new file mode 100644 index 00000000000..73455cf7711 --- /dev/null +++ b/src/test/ui/resolve/issue-105069.rs @@ -0,0 +1,11 @@ +use self::A::*; +use V; //~ ERROR `V` is ambiguous +use self::B::*; +enum A { + V +} +enum B { + V +} + +fn main() {} diff --git a/src/test/ui/resolve/issue-105069.stderr b/src/test/ui/resolve/issue-105069.stderr new file mode 100644 index 00000000000..1e6c9c6e2dc --- /dev/null +++ b/src/test/ui/resolve/issue-105069.stderr @@ -0,0 +1,21 @@ +error[E0659]: `V` is ambiguous + --> $DIR/issue-105069.rs:2:5 + | +LL | use V; + | ^ ambiguous name + | + = note: ambiguous because of multiple potential import sources +note: `V` could refer to the variant imported here + --> $DIR/issue-105069.rs:1:5 + | +LL | use self::A::*; + | ^^^^^^^^^^ +note: `V` could also refer to the variant imported here + --> $DIR/issue-105069.rs:3:5 + | +LL | use self::B::*; + | ^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/resolve/issue-24968.stderr b/src/test/ui/resolve/issue-24968.stderr index 7e539d25804..82f5a1d5b57 100644 --- a/src/test/ui/resolve/issue-24968.stderr +++ b/src/test/ui/resolve/issue-24968.stderr @@ -1,15 +1,3 @@ -error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions - --> $DIR/issue-24968.rs:21:19 - | -LL | const FOO2: u32 = Self::bar(); - | ^^^^ `Self` is only available in impls, traits, and type definitions - -error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions - --> $DIR/issue-24968.rs:27:22 - | -LL | static FOO_S2: u32 = Self::bar(); - | ^^^^ `Self` is only available in impls, traits, and type definitions - error[E0411]: cannot find type `Self` in this scope --> $DIR/issue-24968.rs:3:11 | @@ -51,6 +39,18 @@ LL | static FOO_S: Self = 0; | | | `Self` not allowed in a static item +error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions + --> $DIR/issue-24968.rs:21:19 + | +LL | const FOO2: u32 = Self::bar(); + | ^^^^ `Self` is only available in impls, traits, and type definitions + +error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions + --> $DIR/issue-24968.rs:27:22 + | +LL | static FOO_S2: u32 = Self::bar(); + | ^^^^ `Self` is only available in impls, traits, and type definitions + error: aborting due to 7 previous errors Some errors have detailed explanations: E0411, E0433. diff --git a/src/test/ui/resolve/issue-85348.stderr b/src/test/ui/resolve/issue-85348.stderr index f839dd927db..42b43f825d1 100644 --- a/src/test/ui/resolve/issue-85348.stderr +++ b/src/test/ui/resolve/issue-85348.stderr @@ -21,8 +21,8 @@ LL | let mut N; | help: consider giving `N` an explicit type | -LL | let mut N: _; - | +++ +LL | let mut N: /* Type */; + | ++++++++++++ error: aborting due to 3 previous errors diff --git a/src/test/ui/resolve/levenshtein.stderr b/src/test/ui/resolve/levenshtein.stderr index 9a2d61ea405..cf478210132 100644 --- a/src/test/ui/resolve/levenshtein.stderr +++ b/src/test/ui/resolve/levenshtein.stderr @@ -18,11 +18,9 @@ error[E0412]: cannot find type `Opiton` in this scope | LL | type B = Opiton<u8>; // Misspelled type name from the prelude. | ^^^^^^ help: an enum with a similar name exists: `Option` + --> $SRC_DIR/core/src/option.rs:LL:COL | - ::: $SRC_DIR/core/src/option.rs:LL:COL - | -LL | pub enum Option<T> { - | ------------------ similarly named enum `Option` defined here + = note: similarly named enum `Option` defined here error[E0412]: cannot find type `Baz` in this scope --> $DIR/levenshtein.rs:16:14 diff --git a/src/test/ui/resolve/resolve-primitive-fallback.stderr b/src/test/ui/resolve/resolve-primitive-fallback.stderr index 6d5d5bad9fe..964302e924c 100644 --- a/src/test/ui/resolve/resolve-primitive-fallback.stderr +++ b/src/test/ui/resolve/resolve-primitive-fallback.stderr @@ -28,9 +28,6 @@ LL | std::mem::size_of(u16); | note: function defined here --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | pub const fn size_of<T>() -> usize { - | ^^^^^^^ help: remove the extra argument | LL | std::mem::size_of(); diff --git a/src/test/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/src/test/ui/resolve/typo-suggestion-mistyped-in-path.stderr index ff7cf531c06..89b69e14099 100644 --- a/src/test/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/src/test/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -1,3 +1,24 @@ +error[E0433]: failed to resolve: could not find `Struc` in `module` + --> $DIR/typo-suggestion-mistyped-in-path.rs:35:13 + | +LL | module::Struc::foo(); + | ^^^^^ + | | + | could not find `Struc` in `module` + | help: a struct with a similar name exists: `Struct` + +error[E0599]: no function or associated item named `fob` found for struct `Struct` in the current scope + --> $DIR/typo-suggestion-mistyped-in-path.rs:23:13 + | +LL | struct Struct; + | ------------- function or associated item `fob` not found for this struct +... +LL | Struct::fob(); + | ^^^ + | | + | function or associated item not found in `Struct` + | help: there is an associated function with a similar name: `foo` + error[E0433]: failed to resolve: use of undeclared type `Struc` --> $DIR/typo-suggestion-mistyped-in-path.rs:27:5 | @@ -18,15 +39,6 @@ help: there is a crate or module with a similar name LL | module::foo(); | ~~~~~~ -error[E0433]: failed to resolve: could not find `Struc` in `module` - --> $DIR/typo-suggestion-mistyped-in-path.rs:35:13 - | -LL | module::Struc::foo(); - | ^^^^^ - | | - | could not find `Struc` in `module` - | help: a struct with a similar name exists: `Struct` - error[E0433]: failed to resolve: use of undeclared type `Trai` --> $DIR/typo-suggestion-mistyped-in-path.rs:39:5 | @@ -36,18 +48,6 @@ LL | Trai::foo(); | use of undeclared type `Trai` | help: a trait with a similar name exists: `Trait` -error[E0599]: no function or associated item named `fob` found for struct `Struct` in the current scope - --> $DIR/typo-suggestion-mistyped-in-path.rs:23:13 - | -LL | struct Struct; - | ------------- function or associated item `fob` not found for this struct -... -LL | Struct::fob(); - | ^^^ - | | - | function or associated item not found in `Struct` - | help: there is an associated function with a similar name: `foo` - error: aborting due to 5 previous errors Some errors have detailed explanations: E0433, E0599. diff --git a/src/test/ui/resolve/use_suggestion.stderr b/src/test/ui/resolve/use_suggestion.stderr index 58cb659e822..54ad853831f 100644 --- a/src/test/ui/resolve/use_suggestion.stderr +++ b/src/test/ui/resolve/use_suggestion.stderr @@ -1,9 +1,3 @@ -error[E0433]: failed to resolve: use of undeclared type `GooMap` - --> $DIR/use_suggestion.rs:3:14 - | -LL | let x2 = GooMap::new(); - | ^^^^^^ use of undeclared type `GooMap` - error[E0433]: failed to resolve: use of undeclared type `HashMap` --> $DIR/use_suggestion.rs:2:14 | @@ -32,6 +26,12 @@ error[E0412]: cannot find type `GooMap` in this scope LL | let y2: GooMap; | ^^^^^^ not found in this scope +error[E0433]: failed to resolve: use of undeclared type `GooMap` + --> $DIR/use_suggestion.rs:3:14 + | +LL | let x2 = GooMap::new(); + | ^^^^^^ use of undeclared type `GooMap` + error: aborting due to 4 previous errors Some errors have detailed explanations: E0412, E0433. diff --git a/src/test/ui/return/tail-expr-as-potential-return.rs b/src/test/ui/return/tail-expr-as-potential-return.rs index 2c3610fb24d..f46e088b85f 100644 --- a/src/test/ui/return/tail-expr-as-potential-return.rs +++ b/src/test/ui/return/tail-expr-as-potential-return.rs @@ -12,7 +12,6 @@ // edition:2018 fn main() { - let _ = foo(true); } fn foo(x: bool) -> Result<f64, i32> { @@ -30,3 +29,19 @@ async fn bar(x: bool) -> Result<f64, i32> { } Ok(42.0) } + +trait Identity { + type Out; +} + +impl<T> Identity for T { + type Out = T; +} + +async fn foo2() -> i32 { + if true { + 1i32 //~ ERROR mismatched types + //| HELP you might have meant to return this value + } + 0 +} diff --git a/src/test/ui/return/tail-expr-as-potential-return.stderr b/src/test/ui/return/tail-expr-as-potential-return.stderr index dec1cbc4624..9183b4599ba 100644 --- a/src/test/ui/return/tail-expr-as-potential-return.stderr +++ b/src/test/ui/return/tail-expr-as-potential-return.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/tail-expr-as-potential-return.rs:28:9 + --> $DIR/tail-expr-as-potential-return.rs:27:9 | LL | / if x { LL | | Err(42) @@ -16,7 +16,22 @@ LL | return Err(42); | ++++++ + error[E0308]: mismatched types - --> $DIR/tail-expr-as-potential-return.rs:20:9 + --> $DIR/tail-expr-as-potential-return.rs:43:9 + | +LL | / if true { +LL | | 1i32 + | | ^^^^ expected `()`, found `i32` +LL | | //| HELP you might have meant to return this value +LL | | } + | |_____- expected this to be `()` + | +help: you might have meant to return this value + | +LL | return 1i32; + | ++++++ + + +error[E0308]: mismatched types + --> $DIR/tail-expr-as-potential-return.rs:19:9 | LL | / if x { LL | | Err(42) @@ -32,6 +47,6 @@ help: you might have meant to return this value LL | return Err(42); | ++++++ + -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-requires-both-partialeq-and-eq.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-requires-both-partialeq-and-eq.rs index 6b7d94603b5..a8deb8a7550 100644 --- a/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-requires-both-partialeq-and-eq.rs +++ b/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-requires-both-partialeq-and-eq.rs @@ -5,7 +5,7 @@ struct Foo { impl PartialEq for Foo { fn eq(&self, _: &Foo) -> bool { - false // ha ha sucker! + false // ha ha! } } diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr index 9577952119a..a19750cc73a 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr @@ -9,9 +9,6 @@ LL | fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> { = note: required for `Result<f32, ParseFloatError>` to implement `Termination` note: required by a bound in `assert_test_result` --> $SRC_DIR/test/src/lib.rs:LL:COL - | -LL | pub fn assert_test_result<T: Termination>(result: T) -> Result<(), String> { - | ^^^^^^^^^^^ required by this bound in `assert_test_result` = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/rfc-2005-default-binding-mode/for.stderr b/src/test/ui/rfc-2005-default-binding-mode/for.stderr index 9cc20a7bf31..07991af6ef9 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/for.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/for.stderr @@ -6,6 +6,11 @@ LL | for (n, mut m) in &tups { | | | data moved here | move occurs because `m` has type `Foo`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | for (n, ref mut m) in &tups { + | +++ error: aborting due to previous error diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr index 06699b947be..e97fdcce1c1 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr @@ -8,11 +8,6 @@ LL | let _ = dbg!(a); LL | let _ = dbg!(a); | ^ value used here after move | -help: borrow this binding in the pattern to avoid moving the value - --> $SRC_DIR/std/src/macros.rs:LL:COL - | -LL | ref tmp => { - | +++ error: aborting due to previous error diff --git a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr index 91c00115180..3028f8dbdbf 100644 --- a/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr +++ b/src/test/ui/rfc-2497-if-let-chains/disallowed-positions.stderr @@ -1516,7 +1516,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:157:8 | LL | if true..(let 0 = 0) {} - | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<bool>` @@ -1545,7 +1545,7 @@ error[E0308]: mismatched types LL | if let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1554,7 +1554,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:171:8 | LL | if let Range { start: _, end: _ } = true..true && false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<bool>` @@ -1565,7 +1565,7 @@ error[E0308]: mismatched types LL | if let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1574,7 +1574,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:175:8 | LL | if let Range { start: _, end: _ } = true..true || false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<bool>` @@ -1585,7 +1585,7 @@ error[E0308]: mismatched types LL | if let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool` | | - | expected fn pointer, found struct `std::ops::Range` + | expected fn pointer, found struct `Range` | = note: expected fn pointer `fn() -> bool` found struct `std::ops::Range<_>` @@ -1607,7 +1607,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:182:8 | LL | if let Range { start: F, end } = F..|| true {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<bool>` @@ -1618,7 +1618,7 @@ error[E0308]: mismatched types LL | if let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1639,7 +1639,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:190:8 | LL | if let Range { start: true, end } = t..&&false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<bool>` @@ -1710,7 +1710,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:249:11 | LL | while true..(let 0 = 0) {} - | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<bool>` @@ -1739,7 +1739,7 @@ error[E0308]: mismatched types LL | while let Range { start: _, end: _ } = true..true && false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1748,7 +1748,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:263:11 | LL | while let Range { start: _, end: _ } = true..true && false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<bool>` @@ -1759,7 +1759,7 @@ error[E0308]: mismatched types LL | while let Range { start: _, end: _ } = true..true || false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1768,7 +1768,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:267:11 | LL | while let Range { start: _, end: _ } = true..true || false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<bool>` @@ -1779,7 +1779,7 @@ error[E0308]: mismatched types LL | while let Range { start: F, end } = F..|| true {} | ^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `fn() -> bool` | | - | expected fn pointer, found struct `std::ops::Range` + | expected fn pointer, found struct `Range` | = note: expected fn pointer `fn() -> bool` found struct `std::ops::Range<_>` @@ -1801,7 +1801,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:274:11 | LL | while let Range { start: F, end } = F..|| true {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<bool>` @@ -1812,7 +1812,7 @@ error[E0308]: mismatched types LL | while let Range { start: true, end } = t..&&false {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - this expression has type `&&bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` @@ -1833,7 +1833,7 @@ error[E0308]: mismatched types --> $DIR/disallowed-positions.rs:282:11 | LL | while let Range { start: true, end } = t..&&false {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<bool>` @@ -1883,7 +1883,7 @@ error[E0308]: mismatched types LL | (let Range { start: _, end: _ } = true..true || false); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- this expression has type `bool` | | - | expected `bool`, found struct `std::ops::Range` + | expected `bool`, found struct `Range` | = note: expected type `bool` found struct `std::ops::Range<_>` diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr b/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr index c64930db9be..f9d0d1f7875 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `NonConstImpl: ~const ConstDefaultFn` is not satisfied - --> $DIR/const-default-method-bodies.rs:24:5 + --> $DIR/const-default-method-bodies.rs:24:18 | LL | NonConstImpl.a(); - | ^^^^^^^^^^^^ - required by a bound introduced by this call - | | - | the trait `~const ConstDefaultFn` is not implemented for `NonConstImpl` + | ^ the trait `~const ConstDefaultFn` is not implemented for `NonConstImpl` | note: the trait `ConstDefaultFn` is implemented for `NonConstImpl`, but that implementation is not `const` --> $DIR/const-default-method-bodies.rs:24:5 diff --git a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr index 925ae53e324..633b7cc255a 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gatednc.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `cross_crate::NonConst: ~const cross_crate::MyTrait` is not satisfied - --> $DIR/cross-crate.rs:17:5 + --> $DIR/cross-crate.rs:17:14 | LL | NonConst.func(); - | ^^^^^^^^ ---- required by a bound introduced by this call - | | - | the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst` + | ^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst` | note: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`, but that implementation is not `const` --> $DIR/cross-crate.rs:17:5 diff --git a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr index 11db0c2b8f2..9e97d3f1137 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stocknc.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `cross_crate::NonConst: cross_crate::MyTrait` is not satisfied - --> $DIR/cross-crate.rs:17:5 + --> $DIR/cross-crate.rs:17:14 | LL | NonConst.func(); - | ^^^^^^^^ ---- required by a bound introduced by this call - | | - | the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst` + | ^^^^ the trait `~const cross_crate::MyTrait` is not implemented for `cross_crate::NonConst` | note: the trait `cross_crate::MyTrait` is implemented for `cross_crate::NonConst`, but that implementation is not `const` --> $DIR/cross-crate.rs:17:5 diff --git a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr index c2c16921c2e..21ecddaffbb 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-same-trait-ck.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `(): ~const Tr` is not satisfied - --> $DIR/default-method-body-is-const-same-trait-ck.rs:8:9 + --> $DIR/default-method-body-is-const-same-trait-ck.rs:8:12 | LL | ().a() - | ^^ - required by a bound introduced by this call - | | - | the trait `~const Tr` is not implemented for `()` + | ^ the trait `~const Tr` is not implemented for `()` | note: the trait `Tr` is implemented for `()`, but that implementation is not `const` --> $DIR/default-method-body-is-const-same-trait-ck.rs:8:9 diff --git a/src/test/ui/rfc-2632-const-trait-impl/issue-79450.rs b/src/test/ui/rfc-2632-const-trait-impl/issue-79450.rs new file mode 100644 index 00000000000..b604c65d751 --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/issue-79450.rs @@ -0,0 +1,20 @@ +#![feature(const_fmt_arguments_new)] +#![feature(const_trait_impl)] + +#[const_trait] +trait Tr { + fn req(&self); + + fn prov(&self) { + println!("lul"); //~ ERROR: cannot call non-const fn `_print` in constant functions + self.req(); + } +} + +struct S; + +impl const Tr for S { + fn req(&self) {} +} + +fn main() {} diff --git a/src/test/ui/rfc-2632-const-trait-impl/issue-79450.stderr b/src/test/ui/rfc-2632-const-trait-impl/issue-79450.stderr new file mode 100644 index 00000000000..082c0333fbf --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/issue-79450.stderr @@ -0,0 +1,12 @@ +error[E0015]: cannot call non-const fn `_print` in constant functions + --> $DIR/issue-79450.rs:9:9 + | +LL | println!("lul"); + | ^^^^^^^^^^^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + = note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0015`. diff --git a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr index b52eb2c0332..13fc719f28c 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `T: ~const Foo` is not satisfied - --> $DIR/super-traits-fail-2.rs:15:5 + --> $DIR/super-traits-fail-2.rs:15:7 | LL | x.a(); - | ^ - required by a bound introduced by this call - | | - | the trait `~const Foo` is not implemented for `T` + | ^ the trait `~const Foo` is not implemented for `T` | note: the trait `Foo` is implemented for `T`, but that implementation is not `const` --> $DIR/super-traits-fail-2.rs:15:5 diff --git a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yy.stderr b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yy.stderr index b52eb2c0332..13fc719f28c 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yy.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yy.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `T: ~const Foo` is not satisfied - --> $DIR/super-traits-fail-2.rs:15:5 + --> $DIR/super-traits-fail-2.rs:15:7 | LL | x.a(); - | ^ - required by a bound introduced by this call - | | - | the trait `~const Foo` is not implemented for `T` + | ^ the trait `~const Foo` is not implemented for `T` | note: the trait `Foo` is implemented for `T`, but that implementation is not `const` --> $DIR/super-traits-fail-2.rs:15:5 diff --git a/src/test/ui/span/issue-39018.stderr b/src/test/ui/span/issue-39018.stderr index eea94643e0a..5d4d692b2cf 100644 --- a/src/test/ui/span/issue-39018.stderr +++ b/src/test/ui/span/issue-39018.stderr @@ -26,11 +26,8 @@ note: an implementation of `Add<_>` might be missing for `World` | LL | enum World { | ^^^^^^^^^^ must implement `Add<_>` -note: the following trait must be implemented +note: the trait `Add` must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | pub trait Add<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: cannot add `String` to `&str` --> $DIR/issue-39018.rs:11:22 diff --git a/src/test/ui/span/issue-71363.rs b/src/test/ui/span/issue-71363.rs index bbb4a93623b..8014f379625 100644 --- a/src/test/ui/span/issue-71363.rs +++ b/src/test/ui/span/issue-71363.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z simulate-remapped-rust-src-base=/rustc/xyz -Z translate-remapped-path-to-local-path=no -Z ui-testing=no +// compile-flags: -Z ui-testing=no struct MyError; impl std::error::Error for MyError {} diff --git a/src/test/ui/span/issue-71363.stderr b/src/test/ui/span/issue-71363.stderr index 04e2b46c317..6c7ea007ee0 100644 --- a/src/test/ui/span/issue-71363.stderr +++ b/src/test/ui/span/issue-71363.stderr @@ -7,6 +7,7 @@ error[E0277]: `MyError` doesn't implement `std::fmt::Display` = help: the trait `std::fmt::Display` is not implemented for `MyError` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead note: required by a bound in `std::error::Error` + --> $SRC_DIR/core/src/error.rs:LL:COL error[E0277]: `MyError` doesn't implement `Debug` --> $DIR/issue-71363.rs:4:6 @@ -17,6 +18,7 @@ error[E0277]: `MyError` doesn't implement `Debug` = help: the trait `Debug` is not implemented for `MyError` = note: add `#[derive(Debug)]` to `MyError` or manually `impl Debug for MyError` note: required by a bound in `std::error::Error` + --> $SRC_DIR/core/src/error.rs:LL:COL help: consider annotating `MyError` with `#[derive(Debug)]` | 3 | #[derive(Debug)] diff --git a/src/test/ui/span/method-and-field-eager-resolution.stderr b/src/test/ui/span/method-and-field-eager-resolution.stderr index 7d240589a3f..f6efbe40bc2 100644 --- a/src/test/ui/span/method-and-field-eager-resolution.stderr +++ b/src/test/ui/span/method-and-field-eager-resolution.stderr @@ -9,8 +9,8 @@ LL | x.0; | help: consider giving `x` an explicit type | -LL | let mut x: _ = Default::default(); - | +++ +LL | let mut x: /* Type */ = Default::default(); + | ++++++++++++ error[E0282]: type annotations needed --> $DIR/method-and-field-eager-resolution.rs:11:9 @@ -23,8 +23,8 @@ LL | x[0]; | help: consider giving `x` an explicit type | -LL | let mut x: _ = Default::default(); - | +++ +LL | let mut x: /* Type */ = Default::default(); + | ++++++++++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/span/missing-unit-argument.stderr b/src/test/ui/span/missing-unit-argument.stderr index b76a3ab307a..48a2e763af6 100644 --- a/src/test/ui/span/missing-unit-argument.stderr +++ b/src/test/ui/span/missing-unit-argument.stderr @@ -6,9 +6,6 @@ LL | let _: Result<(), String> = Ok(); | note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^ help: provide the argument | LL | let _: Result<(), String> = Ok(()); diff --git a/src/test/ui/span/multiline-span-simple.stderr b/src/test/ui/span/multiline-span-simple.stderr index c0d9a8634e4..b44df962a9b 100644 --- a/src/test/ui/span/multiline-span-simple.stderr +++ b/src/test/ui/span/multiline-span-simple.stderr @@ -6,15 +6,10 @@ LL | foo(1 as u32 + | = help: the trait `Add<()>` is not implemented for `u32` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> - <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> - <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> - <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&'a u32 as Add<u32>> + <&u32 as Add<&u32>> + <u32 as Add<&u32>> + <u32 as Add> error: aborting due to previous error diff --git a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr index 33ca7a2c210..37788612f43 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr @@ -27,7 +27,7 @@ LL | default impl<T> Foo for T { | ^^^^^^^^^^^^^^^^---^^^^^- | | | unsatisfied trait bound introduced here -note: the following trait must be implemented +note: the trait `Foo` must be implemented --> $DIR/specialization-trait-not-implemented.rs:7:1 | LL | trait Foo { diff --git a/src/test/ui/stability-attribute/stability-in-private-module.stderr b/src/test/ui/stability-attribute/stability-in-private-module.stderr index e64f2acbd35..2f02a24960e 100644 --- a/src/test/ui/stability-attribute/stability-in-private-module.stderr +++ b/src/test/ui/stability-attribute/stability-in-private-module.stderr @@ -6,9 +6,6 @@ LL | let _ = std::thread::thread_info::current_thread(); | note: the module `thread_info` is defined here --> $SRC_DIR/std/src/thread/mod.rs:LL:COL - | -LL | use crate::sys_common::thread_info; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/stats/hir-stats.stderr b/src/test/ui/stats/hir-stats.stderr index 2a0e9497a21..15900bef7f6 100644 --- a/src/test/ui/stats/hir-stats.stderr +++ b/src/test/ui/stats/hir-stats.stderr @@ -120,59 +120,59 @@ hir-stats Name Accumulated Size Count Item Size hir-stats ---------------------------------------------------------------- hir-stats ForeignItemRef 24 ( 0.3%) 1 24 hir-stats Lifetime 24 ( 0.3%) 1 24 -hir-stats Mod 32 ( 0.3%) 1 32 +hir-stats Mod 32 ( 0.4%) 1 32 hir-stats ExprField 40 ( 0.4%) 1 40 hir-stats TraitItemRef 56 ( 0.6%) 2 28 hir-stats Local 64 ( 0.7%) 1 64 hir-stats Param 64 ( 0.7%) 2 32 hir-stats InlineAsm 72 ( 0.8%) 1 72 hir-stats ImplItemRef 72 ( 0.8%) 2 36 -hir-stats Body 96 ( 1.0%) 3 32 -hir-stats FieldDef 96 ( 1.0%) 2 48 -hir-stats Arm 96 ( 1.0%) 2 48 -hir-stats Stmt 96 ( 1.0%) 3 32 -hir-stats - Local 32 ( 0.3%) 1 -hir-stats - Semi 32 ( 0.3%) 1 -hir-stats - Expr 32 ( 0.3%) 1 +hir-stats Body 96 ( 1.1%) 3 32 +hir-stats FieldDef 96 ( 1.1%) 2 48 +hir-stats Arm 96 ( 1.1%) 2 48 +hir-stats Stmt 96 ( 1.1%) 3 32 +hir-stats - Local 32 ( 0.4%) 1 +hir-stats - Semi 32 ( 0.4%) 1 +hir-stats - Expr 32 ( 0.4%) 1 hir-stats FnDecl 120 ( 1.3%) 3 40 hir-stats Attribute 128 ( 1.4%) 4 32 hir-stats GenericArg 128 ( 1.4%) 4 32 -hir-stats - Type 32 ( 0.3%) 1 -hir-stats - Lifetime 96 ( 1.0%) 3 +hir-stats - Type 32 ( 0.4%) 1 +hir-stats - Lifetime 96 ( 1.1%) 3 hir-stats GenericArgs 144 ( 1.6%) 3 48 hir-stats Variant 176 ( 1.9%) 2 88 hir-stats GenericBound 192 ( 2.1%) 4 48 hir-stats - Trait 192 ( 2.1%) 4 hir-stats WherePredicate 192 ( 2.1%) 3 64 hir-stats - BoundPredicate 192 ( 2.1%) 3 -hir-stats Block 288 ( 3.1%) 6 48 -hir-stats Pat 360 ( 3.9%) 5 72 +hir-stats Block 288 ( 3.2%) 6 48 +hir-stats Pat 360 ( 4.0%) 5 72 hir-stats - Wild 72 ( 0.8%) 1 hir-stats - Struct 72 ( 0.8%) 1 hir-stats - Binding 216 ( 2.4%) 3 hir-stats GenericParam 400 ( 4.4%) 5 80 -hir-stats Generics 560 ( 6.1%) 10 56 -hir-stats Ty 720 ( 7.9%) 15 48 +hir-stats Generics 560 ( 6.2%) 10 56 +hir-stats Ty 720 ( 8.0%) 15 48 hir-stats - Ptr 48 ( 0.5%) 1 hir-stats - Rptr 48 ( 0.5%) 1 -hir-stats - Path 624 ( 6.8%) 13 -hir-stats Expr 768 ( 8.4%) 12 64 +hir-stats - Path 624 ( 6.9%) 13 +hir-stats Expr 768 ( 8.5%) 12 64 hir-stats - Path 64 ( 0.7%) 1 hir-stats - Struct 64 ( 0.7%) 1 hir-stats - Match 64 ( 0.7%) 1 hir-stats - InlineAsm 64 ( 0.7%) 1 hir-stats - Lit 128 ( 1.4%) 2 hir-stats - Block 384 ( 4.2%) 6 -hir-stats Item 960 (10.5%) 12 80 +hir-stats Item 880 ( 9.7%) 11 80 hir-stats - Trait 80 ( 0.9%) 1 hir-stats - Enum 80 ( 0.9%) 1 hir-stats - ExternCrate 80 ( 0.9%) 1 hir-stats - ForeignMod 80 ( 0.9%) 1 hir-stats - Impl 80 ( 0.9%) 1 -hir-stats - Fn 160 ( 1.7%) 2 -hir-stats - Use 400 ( 4.4%) 5 -hir-stats Path 1_280 (14.0%) 32 40 -hir-stats PathSegment 1_920 (20.9%) 40 48 +hir-stats - Fn 160 ( 1.8%) 2 +hir-stats - Use 320 ( 3.5%) 4 +hir-stats Path 1_240 (13.7%) 31 40 +hir-stats PathSegment 1_920 (21.2%) 40 48 hir-stats ---------------------------------------------------------------- -hir-stats Total 9_168 +hir-stats Total 9_048 hir-stats diff --git a/src/test/ui/std-uncopyable-atomics.stderr b/src/test/ui/std-uncopyable-atomics.stderr index 9db9fcf40f8..8c5d0b96096 100644 --- a/src/test/ui/std-uncopyable-atomics.stderr +++ b/src/test/ui/std-uncopyable-atomics.stderr @@ -2,37 +2,49 @@ error[E0507]: cannot move out of a shared reference --> $DIR/std-uncopyable-atomics.rs:9:13 | LL | let x = *&x; - | ^^^ - | | - | move occurs because value has type `std::sync::atomic::AtomicBool`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*&x` + | ^^^ move occurs because value has type `std::sync::atomic::AtomicBool`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let x = *&x; +LL + let x = &x; + | error[E0507]: cannot move out of a shared reference --> $DIR/std-uncopyable-atomics.rs:11:13 | LL | let x = *&x; - | ^^^ - | | - | move occurs because value has type `std::sync::atomic::AtomicIsize`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*&x` + | ^^^ move occurs because value has type `std::sync::atomic::AtomicIsize`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let x = *&x; +LL + let x = &x; + | error[E0507]: cannot move out of a shared reference --> $DIR/std-uncopyable-atomics.rs:13:13 | LL | let x = *&x; - | ^^^ - | | - | move occurs because value has type `std::sync::atomic::AtomicUsize`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*&x` + | ^^^ move occurs because value has type `std::sync::atomic::AtomicUsize`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let x = *&x; +LL + let x = &x; + | error[E0507]: cannot move out of a shared reference --> $DIR/std-uncopyable-atomics.rs:15:13 | LL | let x = *&x; - | ^^^ - | | - | move occurs because value has type `std::sync::atomic::AtomicPtr<usize>`, which does not implement the `Copy` trait - | help: consider borrowing here: `&*&x` + | ^^^ move occurs because value has type `std::sync::atomic::AtomicPtr<usize>`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let x = *&x; +LL + let x = &x; + | error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-21058.rs b/src/test/ui/stdlib-unit-tests/issue-21058.rs index 6facf0b2dd5..6facf0b2dd5 100644 --- a/src/test/ui/issues/issue-21058.rs +++ b/src/test/ui/stdlib-unit-tests/issue-21058.rs diff --git a/src/test/ui/str/str-idx.stderr b/src/test/ui/str/str-idx.stderr index 019305def29..cb1a6fcacfc 100644 --- a/src/test/ui/str/str-idx.stderr +++ b/src/test/ui/str/str-idx.stderr @@ -24,9 +24,6 @@ LL | let _ = s.get(4); = help: the trait `SliceIndex<[T]>` is implemented for `usize` note: required by a bound in `core::str::<impl str>::get` --> $SRC_DIR/core/src/str/mod.rs:LL:COL - | -LL | pub const fn get<I: ~const SliceIndex<str>>(&self, i: I) -> Option<&I::Output> { - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get` error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:5:29 @@ -42,9 +39,6 @@ LL | let _ = s.get_unchecked(4); = help: the trait `SliceIndex<[T]>` is implemented for `usize` note: required by a bound in `core::str::<impl str>::get_unchecked` --> $SRC_DIR/core/src/str/mod.rs:LL:COL - | -LL | pub const unsafe fn get_unchecked<I: ~const SliceIndex<str>>(&self, i: I) -> &I::Output { - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked` error[E0277]: the type `str` cannot be indexed by `char` --> $DIR/str-idx.rs:6:19 diff --git a/src/test/ui/str/str-mut-idx.stderr b/src/test/ui/str/str-mut-idx.stderr index b165c482590..ca4b86ba306 100644 --- a/src/test/ui/str/str-mut-idx.stderr +++ b/src/test/ui/str/str-mut-idx.stderr @@ -48,9 +48,6 @@ LL | s.get_mut(1); = help: the trait `SliceIndex<[T]>` is implemented for `usize` note: required by a bound in `core::str::<impl str>::get_mut` --> $SRC_DIR/core/src/str/mod.rs:LL:COL - | -LL | pub const fn get_mut<I: ~const SliceIndex<str>>(&mut self, i: I) -> Option<&mut I::Output> { - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_mut` error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-mut-idx.rs:11:25 @@ -66,9 +63,6 @@ LL | s.get_unchecked_mut(1); = help: the trait `SliceIndex<[T]>` is implemented for `usize` note: required by a bound in `core::str::<impl str>::get_unchecked_mut` --> $SRC_DIR/core/src/str/mod.rs:LL:COL - | -LL | pub const unsafe fn get_unchecked_mut<I: ~const SliceIndex<str>>( - | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::<impl str>::get_unchecked_mut` error[E0277]: the type `str` cannot be indexed by `char` --> $DIR/str-mut-idx.rs:13:7 diff --git a/src/test/ui/structs/struct-fn-in-definition.rs b/src/test/ui/structs/struct-fn-in-definition.rs index 5ae1b727dc7..7f48f55fec9 100644 --- a/src/test/ui/structs/struct-fn-in-definition.rs +++ b/src/test/ui/structs/struct-fn-in-definition.rs @@ -28,6 +28,7 @@ enum E { //~^ ERROR functions are not allowed in enum definitions //~| HELP unlike in C++, Java, and C#, functions are declared in `impl` blocks //~| HELP see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information + //~| HELP enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` } fn main() {} diff --git a/src/test/ui/structs/struct-fn-in-definition.stderr b/src/test/ui/structs/struct-fn-in-definition.stderr index 472365c6ed7..439c86ec22b 100644 --- a/src/test/ui/structs/struct-fn-in-definition.stderr +++ b/src/test/ui/structs/struct-fn-in-definition.stderr @@ -33,6 +33,7 @@ LL | fn foo() {} | = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information + = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` error: aborting due to 3 previous errors diff --git a/src/test/ui/structs/struct-record-suggestion.stderr b/src/test/ui/structs/struct-record-suggestion.stderr index f4fd655e698..9b751d1b66c 100644 --- a/src/test/ui/structs/struct-record-suggestion.stderr +++ b/src/test/ui/structs/struct-record-suggestion.stderr @@ -18,7 +18,7 @@ error[E0308]: mismatched types --> $DIR/struct-record-suggestion.rs:23:20 | LL | let q = B { b: 1..Default::default() }; - | ^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found struct `std::ops::Range` + | ^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found struct `Range` | = note: expected type `u32` found struct `std::ops::Range<{integer}>` diff --git a/src/test/ui/structs/unresolved-struct-with-fru.rs b/src/test/ui/structs/unresolved-struct-with-fru.rs new file mode 100644 index 00000000000..c9fdca45772 --- /dev/null +++ b/src/test/ui/structs/unresolved-struct-with-fru.rs @@ -0,0 +1,12 @@ +struct S { + a: u32, +} + +fn main() { + let s1 = S { a: 1 }; + + let _ = || { + let s2 = Oops { a: 2, ..s1 }; + //~^ ERROR cannot find struct, variant or union type `Oops` in this scope + }; +} diff --git a/src/test/ui/structs/unresolved-struct-with-fru.stderr b/src/test/ui/structs/unresolved-struct-with-fru.stderr new file mode 100644 index 00000000000..a5796a22225 --- /dev/null +++ b/src/test/ui/structs/unresolved-struct-with-fru.stderr @@ -0,0 +1,9 @@ +error[E0422]: cannot find struct, variant or union type `Oops` in this scope + --> $DIR/unresolved-struct-with-fru.rs:9:18 + | +LL | let s2 = Oops { a: 2, ..s1 }; + | ^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0422`. diff --git a/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr b/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr index 0a91c442d2c..44a39efdf25 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr +++ b/src/test/ui/suggestions/args-instead-of-tuple-errors.stderr @@ -13,9 +13,6 @@ LL | let _: Option<(i32, bool)> = Some(1, 2); found type `{integer}` note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ help: remove the extra argument | LL | let _: Option<(i32, bool)> = Some(/* (i32, bool) */); @@ -52,9 +49,6 @@ LL | let _: Option<(i8,)> = Some(); | note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ help: provide the argument | LL | let _: Option<(i8,)> = Some(/* (i8,) */); @@ -72,9 +66,6 @@ LL | let _: Option<(i32,)> = Some(5_usize); found type `usize` note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ error[E0308]: mismatched types --> $DIR/args-instead-of-tuple-errors.rs:17:34 @@ -88,9 +79,6 @@ LL | let _: Option<(i32,)> = Some((5_usize)); found type `usize` note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/suggestions/args-instead-of-tuple.stderr b/src/test/ui/suggestions/args-instead-of-tuple.stderr index 20f9e5259a4..c8499010d68 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple.stderr +++ b/src/test/ui/suggestions/args-instead-of-tuple.stderr @@ -6,9 +6,6 @@ LL | let _: Result<(i32, i8), ()> = Ok(1, 2); | note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^ help: wrap these arguments in parentheses to construct a tuple | LL | let _: Result<(i32, i8), ()> = Ok((1, 2)); @@ -22,9 +19,6 @@ LL | let _: Option<(i32, i8, &'static str)> = Some(1, 2, "hi"); | note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ help: wrap these arguments in parentheses to construct a tuple | LL | let _: Option<(i32, i8, &'static str)> = Some((1, 2, "hi")); @@ -38,9 +32,6 @@ LL | let _: Option<()> = Some(); | note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ help: provide the argument | LL | let _: Option<()> = Some(()); @@ -58,9 +49,6 @@ LL | let _: Option<(i32,)> = Some(3); found type `{integer}` note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ help: use a trailing comma to create a tuple with one element | LL | let _: Option<(i32,)> = Some((3,)); @@ -78,9 +66,6 @@ LL | let _: Option<(i32,)> = Some((3)); found type `{integer}` note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ help: use a trailing comma to create a tuple with one element | LL | let _: Option<(i32,)> = Some((3,)); diff --git a/src/test/ui/suggestions/as-ref-2.stderr b/src/test/ui/suggestions/as-ref-2.stderr index e15e45d86b9..e2129b4502a 100644 --- a/src/test/ui/suggestions/as-ref-2.stderr +++ b/src/test/ui/suggestions/as-ref-2.stderr @@ -10,11 +10,8 @@ LL | let _x: Option<Struct> = foo.map(|s| bar(&s)); LL | let _y = foo; | ^^^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `foo` +note: `Option::<T>::map` takes ownership of the receiver `self`, which moves `foo` --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | pub const fn map<U, F>(self, f: F) -> Option<U> - | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/suggestions/assoc-const-as-fn.rs b/src/test/ui/suggestions/assoc-const-as-fn.rs new file mode 100644 index 00000000000..4b4595dd5e6 --- /dev/null +++ b/src/test/ui/suggestions/assoc-const-as-fn.rs @@ -0,0 +1,18 @@ +unsafe fn pointer(v: usize, w: u32) {} + +pub trait UniformScalar {} +impl UniformScalar for u32 {} + +pub trait GlUniformScalar: UniformScalar { + const FACTORY: unsafe fn(usize, Self) -> (); +} +impl GlUniformScalar for u32 { + const FACTORY: unsafe fn(usize, Self) -> () = pointer; +} + +pub fn foo<T: UniformScalar>(value: T) { + <T as GlUniformScalar>::FACTORY(1, value); + //~^ ERROR the trait bound `T: GlUniformScalar` is not satisfied +} + +fn main() {} diff --git a/src/test/ui/suggestions/assoc-const-as-fn.stderr b/src/test/ui/suggestions/assoc-const-as-fn.stderr new file mode 100644 index 00000000000..3b6e947c59f --- /dev/null +++ b/src/test/ui/suggestions/assoc-const-as-fn.stderr @@ -0,0 +1,16 @@ +error[E0277]: the trait bound `T: GlUniformScalar` is not satisfied + --> $DIR/assoc-const-as-fn.rs:14:40 + | +LL | <T as GlUniformScalar>::FACTORY(1, value); + | ------------------------------- ^^^^^ the trait `GlUniformScalar` is not implemented for `T` + | | + | required by a bound introduced by this call + | +help: consider further restricting this bound + | +LL | pub fn foo<T: UniformScalar + GlUniformScalar>(value: T) { + | +++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/attribute-typos.stderr b/src/test/ui/suggestions/attribute-typos.stderr index 54122cb7360..b871c9b45a5 100644 --- a/src/test/ui/suggestions/attribute-typos.stderr +++ b/src/test/ui/suggestions/attribute-typos.stderr @@ -15,11 +15,9 @@ error: cannot find attribute `tests` in this scope | LL | #[tests] | ^^^^^ help: an attribute macro with a similar name exists: `test` + --> $SRC_DIR/core/src/macros/mod.rs:LL:COL | - ::: $SRC_DIR/core/src/macros/mod.rs:LL:COL - | -LL | pub macro test($item:item) { - | -------------- similarly named attribute macro `test` defined here + = note: similarly named attribute macro `test` defined here error: cannot find attribute `deprcated` in this scope --> $DIR/attribute-typos.rs:1:3 diff --git a/src/test/ui/suggestions/borrow-for-loop-head.stderr b/src/test/ui/suggestions/borrow-for-loop-head.stderr index 0cc8994fe1f..cbdb94877bd 100644 --- a/src/test/ui/suggestions/borrow-for-loop-head.stderr +++ b/src/test/ui/suggestions/borrow-for-loop-head.stderr @@ -16,11 +16,8 @@ LL | for i in &a { LL | for j in a { | ^ `a` moved due to this implicit call to `.into_iter()`, in previous iteration of loop | -note: this function takes ownership of the receiver `self`, which moves `a` +note: `into_iter` takes ownership of the receiver `self`, which moves `a` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ help: consider iterating over a slice of the `Vec<i32>`'s content to avoid moving into the `for` loop | LL | for j in &a { diff --git a/src/test/ui/suggestions/bound-suggestions.stderr b/src/test/ui/suggestions/bound-suggestions.stderr index d53715937f7..cd27947f02f 100644 --- a/src/test/ui/suggestions/bound-suggestions.stderr +++ b/src/test/ui/suggestions/bound-suggestions.stderr @@ -78,9 +78,6 @@ LL | const SIZE: usize = core::mem::size_of::<Self>(); | note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | pub const fn size_of<T>() -> usize { - | ^ required by this bound in `std::mem::size_of` help: consider further restricting `Self` | LL | trait Foo<T>: Sized { @@ -94,9 +91,6 @@ LL | const SIZE: usize = core::mem::size_of::<Self>(); | note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | pub const fn size_of<T>() -> usize { - | ^ required by this bound in `std::mem::size_of` help: consider further restricting `Self` | LL | trait Bar: std::fmt::Display + Sized { @@ -110,9 +104,6 @@ LL | const SIZE: usize = core::mem::size_of::<Self>(); | note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | pub const fn size_of<T>() -> usize { - | ^ required by this bound in `std::mem::size_of` help: consider further restricting `Self` | LL | trait Baz: Sized where Self: std::fmt::Display { @@ -126,9 +117,6 @@ LL | const SIZE: usize = core::mem::size_of::<Self>(); | note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | pub const fn size_of<T>() -> usize { - | ^ required by this bound in `std::mem::size_of` help: consider further restricting `Self` | LL | trait Qux<T>: Sized where Self: std::fmt::Display { @@ -142,9 +130,6 @@ LL | const SIZE: usize = core::mem::size_of::<Self>(); | note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | pub const fn size_of<T>() -> usize { - | ^ required by this bound in `std::mem::size_of` help: consider further restricting `Self` | LL | trait Bat<T>: std::fmt::Display + Sized { diff --git a/src/test/ui/suggestions/crate-or-module-typo.stderr b/src/test/ui/suggestions/crate-or-module-typo.stderr index e8250c9fa5f..98b88b4fb92 100644 --- a/src/test/ui/suggestions/crate-or-module-typo.stderr +++ b/src/test/ui/suggestions/crate-or-module-typo.stderr @@ -20,12 +20,6 @@ help: there is a crate or module with a similar name LL | use bar::bar; | ~~~ -error[E0433]: failed to resolve: use of undeclared crate or module `bar` - --> $DIR/crate-or-module-typo.rs:6:20 - | -LL | pub fn bar() { bar::baz(); } - | ^^^ use of undeclared crate or module `bar` - error[E0433]: failed to resolve: use of undeclared crate or module `st` --> $DIR/crate-or-module-typo.rs:14:10 | @@ -37,6 +31,12 @@ help: there is a crate or module with a similar name LL | bar: std::cell::Cell<bool> | ~~~ +error[E0433]: failed to resolve: use of undeclared crate or module `bar` + --> $DIR/crate-or-module-typo.rs:6:20 + | +LL | pub fn bar() { bar::baz(); } + | ^^^ use of undeclared crate or module `bar` + error: aborting due to 4 previous errors Some errors have detailed explanations: E0432, E0433. diff --git a/src/test/ui/suggestions/derive-clone-for-eq.stderr b/src/test/ui/suggestions/derive-clone-for-eq.stderr index 0645f0cdde7..0a18b770405 100644 --- a/src/test/ui/suggestions/derive-clone-for-eq.stderr +++ b/src/test/ui/suggestions/derive-clone-for-eq.stderr @@ -11,9 +11,6 @@ LL | impl<T: Clone, U> PartialEq<U> for Struct<T> | ^^^^^^^^^^^^ ^^^^^^^^^ note: required by a bound in `Eq` --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub trait Eq: PartialEq<Self> { - | ^^^^^^^^^^^^^^^ required by this bound in `Eq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` | diff --git a/src/test/ui/suggestions/derive-trait-for-method-call.stderr b/src/test/ui/suggestions/derive-trait-for-method-call.stderr index 7cc372f2422..14e8a2675dd 100644 --- a/src/test/ui/suggestions/derive-trait-for-method-call.stderr +++ b/src/test/ui/suggestions/derive-trait-for-method-call.stderr @@ -20,11 +20,8 @@ LL | let y = x.test(); `Enum: Clone` `Enum: Default` `CloneEnum: Default` -note: the following trait must be implemented +note: the trait `Default` must be implemented --> $SRC_DIR/core/src/default.rs:LL:COL - | -LL | pub trait Default: Sized { - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider annotating `Enum` with `#[derive(Clone)]` | LL | #[derive(Clone)] @@ -69,16 +66,12 @@ LL | struct Foo<X, Y> (X, Y); ... LL | let y = x.test(); | ^^^^ method cannot be called on `Foo<Vec<Enum>, Instant>` due to unsatisfied trait bounds + --> $SRC_DIR/std/src/time.rs:LL:COL | - ::: $SRC_DIR/std/src/time.rs:LL:COL - | -LL | pub struct Instant(time::Instant); - | ------------------ doesn't satisfy `Instant: Default` - | - ::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + = note: doesn't satisfy `Instant: Default` + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL | -LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | ------------------------------------------------------------------------------------------------ doesn't satisfy `Vec<Enum>: Clone` + = note: doesn't satisfy `Vec<Enum>: Clone` | = note: the following trait bounds were not satisfied: `Vec<Enum>: Clone` diff --git a/src/test/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr b/src/test/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr index 7bdc8e00f44..0cd6267b3b3 100644 --- a/src/test/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr +++ b/src/test/ui/suggestions/do-not-attempt-to-add-suggestions-with-no-changes.stderr @@ -3,11 +3,9 @@ error[E0573]: expected type, found module `result` | LL | impl result { | ^^^^^^ help: an enum with a similar name exists: `Result` + --> $SRC_DIR/core/src/result.rs:LL:COL | - ::: $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | --------------------- similarly named enum `Result` defined here + = note: similarly named enum `Result` defined here error[E0573]: expected type, found variant `Err` --> $DIR/do-not-attempt-to-add-suggestions-with-no-changes.rs:3:25 diff --git a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs index bf0c1dc27ce..e19d497f21d 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs +++ b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs @@ -38,31 +38,25 @@ pub fn main() { let &(X(_t), X(_u)) = &(x.clone(), x.clone()); //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION (X(_t), X(_u)) + //~| HELP consider removing the borrow if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION (Either::One(_t), Either::Two(_u)) + //~| HELP consider removing the borrow while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION (Either::One(_t), Either::Two(_u)) + //~| HELP consider removing the borrow match &(e.clone(), e.clone()) { //~^ ERROR cannot move &(Either::One(_t), Either::Two(_u)) => (), - //~^ HELP consider removing the `&` - //~| SUGGESTION (Either::One(_t), Either::Two(_u)) + //~^ HELP consider removing the borrow &(Either::Two(_t), Either::One(_u)) => (), - //~^ HELP consider removing the `&` - //~| SUGGESTION (Either::Two(_t), Either::One(_u)) + //~^ HELP consider removing the borrow _ => (), } match &(e.clone(), e.clone()) { //~^ ERROR cannot move &(Either::One(_t), Either::Two(_u)) - //~^ HELP consider removing the `&` - //~| SUGGESTION (Either::One(_t), Either::Two(_u)) + //~^ HELP consider removing the borrow | &(Either::Two(_t), Either::One(_u)) => (), // FIXME: would really like a suggestion here too _ => (), @@ -70,51 +64,42 @@ pub fn main() { match &(e.clone(), e.clone()) { //~^ ERROR cannot move &(Either::One(_t), Either::Two(_u)) => (), - //~^ HELP consider removing the `&` - //~| SUGGESTION (Either::One(_t), Either::Two(_u)) + //~^ HELP consider removing the borrow &(Either::Two(ref _t), Either::One(ref _u)) => (), _ => (), } match &(e.clone(), e.clone()) { //~^ ERROR cannot move &(Either::One(_t), Either::Two(_u)) => (), - //~^ HELP consider removing the `&` - //~| SUGGESTION (Either::One(_t), Either::Two(_u)) + //~^ HELP consider removing the borrow (Either::Two(_t), Either::One(_u)) => (), _ => (), } fn f5(&(X(_t), X(_u)): &(X, X)) { } //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION (X(_t), X(_u)) + //~| HELP consider removing the borrow let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION (X(_t), X(_u)) + //~| HELP consider removing the mutable borrow if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION (Either::One(_t), Either::Two(_u)) + //~| HELP consider removing the mutable borrow while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION (Either::One(_t), Either::Two(_u)) + //~| HELP consider removing the mutable borrow match &mut (em.clone(), em.clone()) { //~^ ERROR cannot move &mut (Either::One(_t), Either::Two(_u)) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION (Either::One(_t), Either::Two(_u)) + //~^ HELP consider removing the mutable borrow &mut (Either::Two(_t), Either::One(_u)) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION (Either::Two(_t), Either::One(_u)) + //~^ HELP consider removing the mutable borrow _ => (), } match &mut (em.clone(), em.clone()) { //~^ ERROR cannot move &mut (Either::One(_t), Either::Two(_u)) - //~^ HELP consider removing the `&mut` - //~| SUGGESTION (Either::One(_t), Either::Two(_u)) + //~^ HELP consider removing the mutable borrow | &mut (Either::Two(_t), Either::One(_u)) => (), // FIXME: would really like a suggestion here too _ => (), @@ -122,29 +107,25 @@ pub fn main() { match &mut (em.clone(), em.clone()) { //~^ ERROR cannot move &mut (Either::One(_t), Either::Two(_u)) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION (Either::One(_t), Either::Two(_u)) + //~^ HELP consider removing the mutable borrow &mut (Either::Two(ref _t), Either::One(ref _u)) => (), _ => (), } match &mut (em.clone(), em.clone()) { //~^ ERROR cannot move &mut (Either::One(_t), Either::Two(_u)) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION (Either::One(_t), Either::Two(_u)) + //~^ HELP consider removing the mutable borrow &mut (Either::Two(ref mut _t), Either::One(ref mut _u)) => (), _ => (), } match &mut (em.clone(), em.clone()) { //~^ ERROR cannot move &mut (Either::One(_t), Either::Two(_u)) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION (Either::One(_t), Either::Two(_u)) + //~^ HELP consider removing the mutable borrow (Either::Two(_t), Either::One(_u)) => (), _ => (), } fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION (X(_t), X(_u)) + //~| HELP consider removing the mutable borrow } diff --git a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr index 40ad671f966..b96b3713f2a 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr @@ -2,40 +2,52 @@ error[E0507]: cannot move out of a shared reference --> $DIR/duplicate-suggestions.rs:39:27 | LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone()); - | --------------- ^^^^^^^^^^^^^^^^^^^^^^^ - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&`: `(X(_t), X(_u))` + | -- -- ^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | ...and here + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the borrow + | +LL - let &(X(_t), X(_u)) = &(x.clone(), x.clone()); +LL + let (X(_t), X(_u)) = &(x.clone(), x.clone()); + | error[E0507]: cannot move out of a shared reference - --> $DIR/duplicate-suggestions.rs:43:50 + --> $DIR/duplicate-suggestions.rs:42:50 | LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } - | ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` + | -- -- ^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | ...and here + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the borrow + | +LL - if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } +LL + if let (Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } + | error[E0507]: cannot move out of a shared reference - --> $DIR/duplicate-suggestions.rs:47:53 + --> $DIR/duplicate-suggestions.rs:45:53 | LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } - | ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` + | -- -- ^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | ...and here + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the borrow + | +LL - while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } +LL + while let (Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } + | error[E0507]: cannot move out of a shared reference - --> $DIR/duplicate-suggestions.rs:51:11 + --> $DIR/duplicate-suggestions.rs:48:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -44,22 +56,24 @@ LL | &(Either::One(_t), Either::Two(_u)) => (), | -- -- ...and here | | | data moved here -... +LL | LL | &(Either::Two(_t), Either::One(_u)) => (), | -- ...and here -- ...and here | = note: move occurs because these variables have types that don't implement the `Copy` trait -help: consider removing the `&` +help: consider removing the borrow | -LL | (Either::One(_t), Either::Two(_u)) => (), - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -help: consider removing the `&` +LL - &(Either::One(_t), Either::Two(_u)) => (), +LL + (Either::One(_t), Either::Two(_u)) => (), + | +help: consider removing the borrow + | +LL - &(Either::Two(_t), Either::One(_u)) => (), +LL + (Either::Two(_t), Either::One(_u)) => (), | -LL | (Either::Two(_t), Either::One(_u)) => (), - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0507]: cannot move out of a shared reference - --> $DIR/duplicate-suggestions.rs:61:11 + --> $DIR/duplicate-suggestions.rs:56:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -70,82 +84,98 @@ LL | &(Either::One(_t), Either::Two(_u)) | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait -help: consider removing the `&` +help: consider removing the borrow | -LL ~ (Either::One(_t), Either::Two(_u)) -LL + -LL + -LL ~ | &(Either::Two(_t), Either::One(_u)) => (), +LL - &(Either::One(_t), Either::Two(_u)) +LL + (Either::One(_t), Either::Two(_u)) | error[E0507]: cannot move out of a shared reference - --> $DIR/duplicate-suggestions.rs:70:11 + --> $DIR/duplicate-suggestions.rs:64:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | &(Either::One(_t), Either::Two(_u)) => (), - | ----------------------------------- - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` + | -- -- ...and here + | | + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the borrow + | +LL - &(Either::One(_t), Either::Two(_u)) => (), +LL + (Either::One(_t), Either::Two(_u)) => (), + | error[E0507]: cannot move out of a shared reference - --> $DIR/duplicate-suggestions.rs:78:11 + --> $DIR/duplicate-suggestions.rs:71:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | &(Either::One(_t), Either::Two(_u)) => (), - | ----------------------------------- - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` + | -- -- ...and here + | | + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the borrow + | +LL - &(Either::One(_t), Either::Two(_u)) => (), +LL + (Either::One(_t), Either::Two(_u)) => (), + | error[E0507]: cannot move out of a mutable reference - --> $DIR/duplicate-suggestions.rs:91:31 + --> $DIR/duplicate-suggestions.rs:82:31 | LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); - | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&mut`: `(X(_t), X(_u))` + | -- -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | ...and here + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the mutable borrow + | +LL - let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); +LL + let (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); + | error[E0507]: cannot move out of a mutable reference - --> $DIR/duplicate-suggestions.rs:95:54 + --> $DIR/duplicate-suggestions.rs:85:54 | LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } - | --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` + | -- -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | ...and here + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the mutable borrow + | +LL - if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } +LL + if let (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } + | error[E0507]: cannot move out of a mutable reference - --> $DIR/duplicate-suggestions.rs:99:57 + --> $DIR/duplicate-suggestions.rs:88:57 | LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } - | --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` + | -- -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | ...and here + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the mutable borrow + | +LL - while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } +LL + while let (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } + | error[E0507]: cannot move out of a mutable reference - --> $DIR/duplicate-suggestions.rs:103:11 + --> $DIR/duplicate-suggestions.rs:91:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -154,22 +184,24 @@ LL | &mut (Either::One(_t), Either::Two(_u)) => (), | -- -- ...and here | | | data moved here -... +LL | LL | &mut (Either::Two(_t), Either::One(_u)) => (), | -- ...and here -- ...and here | = note: move occurs because these variables have types that don't implement the `Copy` trait -help: consider removing the `&mut` +help: consider removing the mutable borrow + | +LL - &mut (Either::One(_t), Either::Two(_u)) => (), +LL + (Either::One(_t), Either::Two(_u)) => (), | -LL | (Either::One(_t), Either::Two(_u)) => (), - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -help: consider removing the `&mut` +help: consider removing the mutable borrow + | +LL - &mut (Either::Two(_t), Either::One(_u)) => (), +LL + (Either::Two(_t), Either::One(_u)) => (), | -LL | (Either::Two(_t), Either::One(_u)) => (), - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0507]: cannot move out of a mutable reference - --> $DIR/duplicate-suggestions.rs:113:11 + --> $DIR/duplicate-suggestions.rs:99:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -180,82 +212,97 @@ LL | &mut (Either::One(_t), Either::Two(_u)) | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait -help: consider removing the `&mut` +help: consider removing the mutable borrow | -LL ~ (Either::One(_t), Either::Two(_u)) -LL + -LL + -LL ~ | &mut (Either::Two(_t), Either::One(_u)) => (), +LL - &mut (Either::One(_t), Either::Two(_u)) +LL + (Either::One(_t), Either::Two(_u)) | error[E0507]: cannot move out of a mutable reference - --> $DIR/duplicate-suggestions.rs:122:11 + --> $DIR/duplicate-suggestions.rs:107:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | &mut (Either::One(_t), Either::Two(_u)) => (), - | --------------------------------------- - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` + | -- -- ...and here + | | + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the mutable borrow + | +LL - &mut (Either::One(_t), Either::Two(_u)) => (), +LL + (Either::One(_t), Either::Two(_u)) => (), + | error[E0507]: cannot move out of a mutable reference - --> $DIR/duplicate-suggestions.rs:130:11 + --> $DIR/duplicate-suggestions.rs:114:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | &mut (Either::One(_t), Either::Two(_u)) => (), - | --------------------------------------- - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` + | -- -- ...and here + | | + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the mutable borrow + | +LL - &mut (Either::One(_t), Either::Two(_u)) => (), +LL + (Either::One(_t), Either::Two(_u)) => (), + | error[E0507]: cannot move out of a mutable reference - --> $DIR/duplicate-suggestions.rs:138:11 + --> $DIR/duplicate-suggestions.rs:121:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | &mut (Either::One(_t), Either::Two(_u)) => (), - | --------------------------------------- - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` + | -- -- ...and here + | | + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the mutable borrow + | +LL - &mut (Either::One(_t), Either::Two(_u)) => (), +LL + (Either::One(_t), Either::Two(_u)) => (), + | error[E0507]: cannot move out of a shared reference - --> $DIR/duplicate-suggestions.rs:86:11 + --> $DIR/duplicate-suggestions.rs:78:11 | LL | fn f5(&(X(_t), X(_u)): &(X, X)) { } | ^^^^--^^^^^--^^ - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&`: `(X(_t), X(_u))` + | | | + | | ...and here + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the borrow + | +LL - fn f5(&(X(_t), X(_u)): &(X, X)) { } +LL + fn f5((X(_t), X(_u)): &(X, X)) { } + | error[E0507]: cannot move out of a mutable reference - --> $DIR/duplicate-suggestions.rs:146:11 + --> $DIR/duplicate-suggestions.rs:128:11 | LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } | ^^^^^^^^--^^^^^--^^ - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&mut`: `(X(_t), X(_u))` + | | | + | | ...and here + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the mutable borrow + | +LL - fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } +LL + fn f6((X(_t), X(_u)): &mut (X, X)) { } + | error: aborting due to 17 previous errors diff --git a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs index f1e043c30f2..44eac3691a3 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs +++ b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs @@ -28,26 +28,21 @@ fn move_into_fn() { let X(_t) = x; //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &x if let Either::One(_t) = e { } //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &e while let Either::One(_t) = e { } //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &e match e { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &e Either::One(_t) | Either::Two(_t) => (), } match e { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &e Either::One(_t) => (), Either::Two(ref _t) => (), // FIXME: should suggest removing `ref` too @@ -56,26 +51,21 @@ fn move_into_fn() { let X(mut _t) = x; //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &x if let Either::One(mut _t) = em { } //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &em while let Either::One(mut _t) = em { } //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &em match em { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &em Either::One(mut _t) | Either::Two(mut _t) => (), } match em { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &em Either::One(mut _t) => (), Either::Two(ref _t) => (), // FIXME: should suggest removing `ref` too @@ -95,26 +85,21 @@ fn move_into_fnmut() { let X(_t) = x; //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &x if let Either::One(_t) = e { } //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &e while let Either::One(_t) = e { } //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &e match e { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &e Either::One(_t) | Either::Two(_t) => (), } match e { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &e Either::One(_t) => (), Either::Two(ref _t) => (), // FIXME: should suggest removing `ref` too @@ -123,26 +108,21 @@ fn move_into_fnmut() { let X(mut _t) = x; //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &x if let Either::One(mut _t) = em { } //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &em while let Either::One(mut _t) = em { } //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &em match em { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &em Either::One(mut _t) | Either::Two(mut _t) => (), } match em { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &em Either::One(mut _t) => (), Either::Two(ref _t) => (), // FIXME: should suggest removing `ref` too @@ -150,7 +130,6 @@ fn move_into_fnmut() { match em { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &em Either::One(mut _t) => (), Either::Two(ref mut _t) => (), // FIXME: should suggest removing `ref` too diff --git a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr index e06ee4290ab..edda2cbc735 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr @@ -7,13 +7,18 @@ LL | let x = X(Y); LL | consume_fn(|| { | -- captured by this `Fn` closure LL | let X(_t) = x; - | -- ^ help: consider borrowing here: `&x` + | -- ^ | | | data moved here | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let X(_t) = &x; + | + error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:32:34 + --> $DIR/move-into-closure.rs:31:34 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -22,13 +27,18 @@ LL | consume_fn(|| { | -- captured by this `Fn` closure ... LL | if let Either::One(_t) = e { } - | -- ^ help: consider borrowing here: `&e` + | -- ^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | if let Either::One(_t) = &e { } + | + error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:36:37 + --> $DIR/move-into-closure.rs:34:37 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -37,13 +47,18 @@ LL | consume_fn(|| { | -- captured by this `Fn` closure ... LL | while let Either::One(_t) = e { } - | -- ^ help: consider borrowing here: `&e` + | -- ^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | while let Either::One(_t) = &e { } + | + error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:40:15 + --> $DIR/move-into-closure.rs:37:15 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -52,16 +67,21 @@ LL | consume_fn(|| { | -- captured by this `Fn` closure ... LL | match e { - | ^ help: consider borrowing here: `&e` + | ^ ... LL | Either::One(_t) | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &e { + | + error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:47:15 + --> $DIR/move-into-closure.rs:43:15 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -70,16 +90,21 @@ LL | consume_fn(|| { | -- captured by this `Fn` closure ... LL | match e { - | ^ help: consider borrowing here: `&e` + | ^ ... LL | Either::One(_t) => (), | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &e { + | + error[E0507]: cannot move out of `x.0`, as `x` is a captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:56:25 + --> $DIR/move-into-closure.rs:51:25 | LL | let x = X(Y); | - captured outer variable @@ -88,13 +113,18 @@ LL | consume_fn(|| { | -- captured by this `Fn` closure ... LL | let X(mut _t) = x; - | ------ ^ help: consider borrowing here: `&x` + | ------ ^ | | | data moved here | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let X(mut _t) = &x; + | + error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:60:38 + --> $DIR/move-into-closure.rs:54:38 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -103,13 +133,18 @@ LL | consume_fn(|| { | -- captured by this `Fn` closure ... LL | if let Either::One(mut _t) = em { } - | ------ ^^ help: consider borrowing here: `&em` + | ------ ^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | if let Either::One(mut _t) = &em { } + | + error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:64:41 + --> $DIR/move-into-closure.rs:57:41 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -118,13 +153,18 @@ LL | consume_fn(|| { | -- captured by this `Fn` closure ... LL | while let Either::One(mut _t) = em { } - | ------ ^^ help: consider borrowing here: `&em` + | ------ ^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | while let Either::One(mut _t) = &em { } + | + error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:68:15 + --> $DIR/move-into-closure.rs:60:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -133,16 +173,21 @@ LL | consume_fn(|| { | -- captured by this `Fn` closure ... LL | match em { - | ^^ help: consider borrowing here: `&em` + | ^^ ... LL | Either::One(mut _t) | ------ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &em { + | + error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:75:15 + --> $DIR/move-into-closure.rs:66:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -151,16 +196,21 @@ LL | consume_fn(|| { | -- captured by this `Fn` closure ... LL | match em { - | ^^ help: consider borrowing here: `&em` + | ^^ ... LL | Either::One(mut _t) => (), | ------ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &em { + | + error[E0507]: cannot move out of `x.0`, as `x` is a captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:95:21 + --> $DIR/move-into-closure.rs:85:21 | LL | let x = X(Y); | - captured outer variable @@ -168,13 +218,18 @@ LL | let x = X(Y); LL | consume_fnmut(|| { | -- captured by this `FnMut` closure LL | let X(_t) = x; - | -- ^ help: consider borrowing here: `&x` + | -- ^ | | | data moved here | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let X(_t) = &x; + | + error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:99:34 + --> $DIR/move-into-closure.rs:88:34 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -183,13 +238,18 @@ LL | consume_fnmut(|| { | -- captured by this `FnMut` closure ... LL | if let Either::One(_t) = e { } - | -- ^ help: consider borrowing here: `&e` + | -- ^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | if let Either::One(_t) = &e { } + | + error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:103:37 + --> $DIR/move-into-closure.rs:91:37 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -198,13 +258,18 @@ LL | consume_fnmut(|| { | -- captured by this `FnMut` closure ... LL | while let Either::One(_t) = e { } - | -- ^ help: consider borrowing here: `&e` + | -- ^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | while let Either::One(_t) = &e { } + | + error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:107:15 + --> $DIR/move-into-closure.rs:94:15 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -213,16 +278,21 @@ LL | consume_fnmut(|| { | -- captured by this `FnMut` closure ... LL | match e { - | ^ help: consider borrowing here: `&e` + | ^ ... LL | Either::One(_t) | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &e { + | + error[E0507]: cannot move out of `e.0`, as `e` is a captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:114:15 + --> $DIR/move-into-closure.rs:100:15 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -231,16 +301,21 @@ LL | consume_fnmut(|| { | -- captured by this `FnMut` closure ... LL | match e { - | ^ help: consider borrowing here: `&e` + | ^ ... LL | Either::One(_t) => (), | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &e { + | + error[E0507]: cannot move out of `x.0`, as `x` is a captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:123:25 + --> $DIR/move-into-closure.rs:108:25 | LL | let x = X(Y); | - captured outer variable @@ -249,13 +324,18 @@ LL | consume_fnmut(|| { | -- captured by this `FnMut` closure ... LL | let X(mut _t) = x; - | ------ ^ help: consider borrowing here: `&x` + | ------ ^ | | | data moved here | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let X(mut _t) = &x; + | + error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:127:38 + --> $DIR/move-into-closure.rs:111:38 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -264,13 +344,18 @@ LL | consume_fnmut(|| { | -- captured by this `FnMut` closure ... LL | if let Either::One(mut _t) = em { } - | ------ ^^ help: consider borrowing here: `&em` + | ------ ^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | if let Either::One(mut _t) = &em { } + | + error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:131:41 + --> $DIR/move-into-closure.rs:114:41 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -279,13 +364,18 @@ LL | consume_fnmut(|| { | -- captured by this `FnMut` closure ... LL | while let Either::One(mut _t) = em { } - | ------ ^^ help: consider borrowing here: `&em` + | ------ ^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | while let Either::One(mut _t) = &em { } + | + error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:135:15 + --> $DIR/move-into-closure.rs:117:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -294,16 +384,21 @@ LL | consume_fnmut(|| { | -- captured by this `FnMut` closure ... LL | match em { - | ^^ help: consider borrowing here: `&em` + | ^^ ... LL | Either::One(mut _t) | ------ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &em { + | + error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:142:15 + --> $DIR/move-into-closure.rs:123:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -312,16 +407,21 @@ LL | consume_fnmut(|| { | -- captured by this `FnMut` closure ... LL | match em { - | ^^ help: consider borrowing here: `&em` + | ^^ ... LL | Either::One(mut _t) => (), | ------ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &em { + | + error[E0507]: cannot move out of `em.0`, as `em` is a captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:150:15 + --> $DIR/move-into-closure.rs:130:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -330,13 +430,18 @@ LL | consume_fnmut(|| { | -- captured by this `FnMut` closure ... LL | match em { - | ^^ help: consider borrowing here: `&em` + | ^^ ... LL | Either::One(mut _t) => (), | ------ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &em { + | + error: aborting due to 21 previous errors diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.rs b/src/test/ui/suggestions/dont-suggest-ref/simple.rs index c53ac3d2cd6..1e40e60a1ce 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/simple.rs +++ b/src/test/ui/suggestions/dont-suggest-ref/simple.rs @@ -37,27 +37,22 @@ pub fn main() { let X(_t) = *s; //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION s + //~| HELP consider removing the dereference here if let Either::One(_t) = *r { } //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION r + //~| HELP consider removing the dereference here while let Either::One(_t) = *r { } //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION r + //~| HELP consider removing the dereference here match *r { //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION r + //~| HELP consider removing the dereference here Either::One(_t) | Either::Two(_t) => (), } match *r { //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION r + //~| HELP consider removing the dereference here Either::One(_t) => (), Either::Two(ref _t) => (), // FIXME: should suggest removing `ref` too @@ -65,35 +60,29 @@ pub fn main() { let X(_t) = *sm; //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION sm + //~| HELP consider removing the dereference here if let Either::One(_t) = *rm { } //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION rm + //~| HELP consider removing the dereference here while let Either::One(_t) = *rm { } //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION rm + //~| HELP consider removing the dereference here match *rm { //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION rm + //~| HELP consider removing the dereference here Either::One(_t) | Either::Two(_t) => (), } match *rm { //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION rm + //~| HELP consider removing the dereference here Either::One(_t) => (), Either::Two(ref _t) => (), // FIXME: should suggest removing `ref` too } match *rm { //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION rm + //~| HELP consider removing the dereference here Either::One(_t) => (), Either::Two(ref mut _t) => (), // FIXME: should suggest removing `ref` too @@ -102,26 +91,21 @@ pub fn main() { let X(_t) = vs[0]; //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &vs[0] if let Either::One(_t) = vr[0] { } //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &vr[0] while let Either::One(_t) = vr[0] { } //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &vr[0] match vr[0] { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &vr[0] Either::One(_t) | Either::Two(_t) => (), } match vr[0] { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &vr[0] Either::One(_t) => (), Either::Two(ref _t) => (), // FIXME: should suggest removing `ref` too @@ -130,26 +114,21 @@ pub fn main() { let X(_t) = vsm[0]; //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &vsm[0] if let Either::One(_t) = vrm[0] { } //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &vrm[0] while let Either::One(_t) = vrm[0] { } //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &vrm[0] match vrm[0] { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &vrm[0] Either::One(_t) | Either::Two(_t) => (), } match vrm[0] { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &vrm[0] Either::One(_t) => (), Either::Two(ref _t) => (), // FIXME: should suggest removing `ref` too @@ -157,7 +136,6 @@ pub fn main() { match vrm[0] { //~^ ERROR cannot move //~| HELP consider borrowing here - //~| SUGGESTION &vrm[0] Either::One(_t) => (), Either::Two(ref mut _t) => (), // FIXME: should suggest removing `ref` too @@ -167,89 +145,73 @@ pub fn main() { let &X(_t) = s; //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION X(_t) + //~| HELP consider removing if let &Either::One(_t) = r { } //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) + //~| HELP consider removing while let &Either::One(_t) = r { } //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) + //~| HELP consider removing match r { //~^ ERROR cannot move &Either::One(_t) - //~^ HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing | &Either::Two(_t) => (), // FIXME: would really like a suggestion here too } match r { //~^ ERROR cannot move &Either::One(_t) => (), - //~^ HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing &Either::Two(ref _t) => (), } match r { //~^ ERROR cannot move &Either::One(_t) => (), - //~^ HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing Either::Two(_t) => (), } fn f1(&X(_t): &X) { } //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION X(_t) + //~| HELP consider removing let &mut X(_t) = sm; //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION X(_t) + //~| HELP consider removing if let &mut Either::One(_t) = rm { } //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) + //~| HELP consider removing while let &mut Either::One(_t) = rm { } //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) + //~| HELP consider removing match rm { //~^ ERROR cannot move &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing &mut Either::Two(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::Two(_t) + //~^ HELP consider removing } match rm { //~^ ERROR cannot move &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing &mut Either::Two(ref _t) => (), } match rm { //~^ ERROR cannot move &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing &mut Either::Two(ref mut _t) => (), } match rm { //~^ ERROR cannot move &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing Either::Two(_t) => (), } fn f2(&mut X(_t): &mut X) { } //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION X(_t) + //~| HELP consider removing // move from tuple of &Either/&X @@ -257,108 +219,118 @@ pub fn main() { let (&X(_t),) = (&x.clone(),); //~^ ERROR cannot move + //~| HELP consider borrowing the pattern binding if let (&Either::One(_t),) = (&e.clone(),) { } //~^ ERROR cannot move + //~| HELP consider borrowing the pattern binding while let (&Either::One(_t),) = (&e.clone(),) { } //~^ ERROR cannot move + //~| HELP consider borrowing the pattern binding match (&e.clone(),) { //~^ ERROR cannot move (&Either::One(_t),) + //~^ HELP consider borrowing the pattern binding | (&Either::Two(_t),) => (), } fn f3((&X(_t),): (&X,)) { } //~^ ERROR cannot move + //~| HELP consider borrowing the pattern binding let (&mut X(_t),) = (&mut xm.clone(),); //~^ ERROR cannot move + //~| HELP consider borrowing the pattern binding if let (&mut Either::One(_t),) = (&mut em.clone(),) { } //~^ ERROR cannot move + //~| HELP consider borrowing the pattern binding while let (&mut Either::One(_t),) = (&mut em.clone(),) { } //~^ ERROR cannot move + //~| HELP consider borrowing the pattern binding match (&mut em.clone(),) { //~^ ERROR cannot move (&mut Either::One(_t),) => (), + //~^ HELP consider borrowing the pattern binding (&mut Either::Two(_t),) => (), + //~^ HELP consider borrowing the pattern binding } fn f4((&mut X(_t),): (&mut X,)) { } //~^ ERROR cannot move + //~| HELP consider borrowing the pattern binding // move from &Either/&X value let &X(_t) = &x; //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION X(_t) + //~| HELP consider removing if let &Either::One(_t) = &e { } //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) + //~| HELP consider removing while let &Either::One(_t) = &e { } //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) + //~| HELP consider removing match &e { //~^ ERROR cannot move &Either::One(_t) - //~^ HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing | &Either::Two(_t) => (), // FIXME: would really like a suggestion here too } match &e { //~^ ERROR cannot move &Either::One(_t) => (), - //~^ HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing &Either::Two(ref _t) => (), } match &e { //~^ ERROR cannot move &Either::One(_t) => (), - //~^ HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing Either::Two(_t) => (), } let &mut X(_t) = &mut xm; //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION X(_t) + //~| HELP consider removing if let &mut Either::One(_t) = &mut em { } //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) + //~| HELP consider removing while let &mut Either::One(_t) = &mut em { } //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) + //~| HELP consider removing match &mut em { //~^ ERROR cannot move &mut Either::One(_t) - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing | &mut Either::Two(_t) => (), // FIXME: would really like a suggestion here too } match &mut em { //~^ ERROR cannot move &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing &mut Either::Two(ref _t) => (), } match &mut em { //~^ ERROR cannot move &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing &mut Either::Two(ref mut _t) => (), } match &mut em { //~^ ERROR cannot move &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) + //~^ HELP consider removing Either::Two(_t) => (), } } + +struct Testing { + a: Option<String> +} + +fn testing(a: &Testing) { + let Some(_s) = a.a else { + //~^ ERROR cannot move + //~| HELP consider borrowing the pattern binding + return; + }; +} diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr index e5443290f9e..52632652423 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr @@ -2,262 +2,398 @@ error[E0507]: cannot move out of `s` which is behind a shared reference --> $DIR/simple.rs:38:17 | LL | let X(_t) = *s; - | -- ^^ help: consider borrowing here: `&*s` + | -- ^^ | | | data moved here | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let X(_t) = *s; +LL + let X(_t) = s; + | error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference - --> $DIR/simple.rs:42:30 + --> $DIR/simple.rs:41:30 | LL | if let Either::One(_t) = *r { } - | -- ^^ help: consider borrowing here: `&*r` + | -- ^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - if let Either::One(_t) = *r { } +LL + if let Either::One(_t) = r { } + | error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference - --> $DIR/simple.rs:46:33 + --> $DIR/simple.rs:44:33 | LL | while let Either::One(_t) = *r { } - | -- ^^ help: consider borrowing here: `&*r` + | -- ^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - while let Either::One(_t) = *r { } +LL + while let Either::One(_t) = r { } + | error[E0507]: cannot move out of `r` as enum variant `Two` which is behind a shared reference - --> $DIR/simple.rs:50:11 + --> $DIR/simple.rs:47:11 | LL | match *r { - | ^^ help: consider borrowing here: `&*r` + | ^^ ... LL | Either::One(_t) | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - match *r { +LL + match r { + | error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference - --> $DIR/simple.rs:57:11 + --> $DIR/simple.rs:53:11 | LL | match *r { - | ^^ help: consider borrowing here: `&*r` + | ^^ ... LL | Either::One(_t) => (), | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - match *r { +LL + match r { + | error[E0507]: cannot move out of `sm` which is behind a mutable reference - --> $DIR/simple.rs:66:17 + --> $DIR/simple.rs:61:17 | LL | let X(_t) = *sm; - | -- ^^^ help: consider borrowing here: `&*sm` + | -- ^^^ | | | data moved here | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - let X(_t) = *sm; +LL + let X(_t) = sm; + | error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference - --> $DIR/simple.rs:70:30 + --> $DIR/simple.rs:64:30 | LL | if let Either::One(_t) = *rm { } - | -- ^^^ help: consider borrowing here: `&*rm` + | -- ^^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - if let Either::One(_t) = *rm { } +LL + if let Either::One(_t) = rm { } + | error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference - --> $DIR/simple.rs:74:33 + --> $DIR/simple.rs:67:33 | LL | while let Either::One(_t) = *rm { } - | -- ^^^ help: consider borrowing here: `&*rm` + | -- ^^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - while let Either::One(_t) = *rm { } +LL + while let Either::One(_t) = rm { } + | error[E0507]: cannot move out of `rm` as enum variant `Two` which is behind a mutable reference - --> $DIR/simple.rs:78:11 + --> $DIR/simple.rs:70:11 | LL | match *rm { - | ^^^ help: consider borrowing here: `&*rm` + | ^^^ ... LL | Either::One(_t) | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - match *rm { +LL + match rm { + | error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference - --> $DIR/simple.rs:85:11 + --> $DIR/simple.rs:76:11 | LL | match *rm { - | ^^^ help: consider borrowing here: `&*rm` + | ^^^ ... LL | Either::One(_t) => (), | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - match *rm { +LL + match rm { + | error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference - --> $DIR/simple.rs:93:11 + --> $DIR/simple.rs:83:11 | LL | match *rm { - | ^^^ help: consider borrowing here: `&*rm` + | ^^^ ... LL | Either::One(_t) => (), | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the dereference here + | +LL - match *rm { +LL + match rm { + | error[E0507]: cannot move out of index of `Vec<X>` - --> $DIR/simple.rs:102:17 + --> $DIR/simple.rs:91:17 | LL | let X(_t) = vs[0]; - | -- ^^^^^ help: consider borrowing here: `&vs[0]` + | -- ^^^^^ | | | data moved here | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let X(_t) = &vs[0]; + | + error[E0507]: cannot move out of index of `Vec<Either>` - --> $DIR/simple.rs:106:30 + --> $DIR/simple.rs:94:30 | LL | if let Either::One(_t) = vr[0] { } - | -- ^^^^^ help: consider borrowing here: `&vr[0]` + | -- ^^^^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | if let Either::One(_t) = &vr[0] { } + | + error[E0507]: cannot move out of index of `Vec<Either>` - --> $DIR/simple.rs:110:33 + --> $DIR/simple.rs:97:33 | LL | while let Either::One(_t) = vr[0] { } - | -- ^^^^^ help: consider borrowing here: `&vr[0]` + | -- ^^^^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | while let Either::One(_t) = &vr[0] { } + | + error[E0507]: cannot move out of index of `Vec<Either>` - --> $DIR/simple.rs:114:11 + --> $DIR/simple.rs:100:11 | LL | match vr[0] { - | ^^^^^ help: consider borrowing here: `&vr[0]` + | ^^^^^ ... LL | Either::One(_t) | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &vr[0] { + | + error[E0507]: cannot move out of index of `Vec<Either>` - --> $DIR/simple.rs:121:11 + --> $DIR/simple.rs:106:11 | LL | match vr[0] { - | ^^^^^ help: consider borrowing here: `&vr[0]` + | ^^^^^ ... LL | Either::One(_t) => (), | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &vr[0] { + | + error[E0507]: cannot move out of index of `Vec<X>` - --> $DIR/simple.rs:130:17 + --> $DIR/simple.rs:114:17 | LL | let X(_t) = vsm[0]; - | -- ^^^^^^ help: consider borrowing here: `&vsm[0]` + | -- ^^^^^^ | | | data moved here | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let X(_t) = &vsm[0]; + | + error[E0507]: cannot move out of index of `Vec<Either>` - --> $DIR/simple.rs:134:30 + --> $DIR/simple.rs:117:30 | LL | if let Either::One(_t) = vrm[0] { } - | -- ^^^^^^ help: consider borrowing here: `&vrm[0]` + | -- ^^^^^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | if let Either::One(_t) = &vrm[0] { } + | + error[E0507]: cannot move out of index of `Vec<Either>` - --> $DIR/simple.rs:138:33 + --> $DIR/simple.rs:120:33 | LL | while let Either::One(_t) = vrm[0] { } - | -- ^^^^^^ help: consider borrowing here: `&vrm[0]` + | -- ^^^^^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | while let Either::One(_t) = &vrm[0] { } + | + error[E0507]: cannot move out of index of `Vec<Either>` - --> $DIR/simple.rs:142:11 + --> $DIR/simple.rs:123:11 | LL | match vrm[0] { - | ^^^^^^ help: consider borrowing here: `&vrm[0]` + | ^^^^^^ ... LL | Either::One(_t) | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &vrm[0] { + | + error[E0507]: cannot move out of index of `Vec<Either>` - --> $DIR/simple.rs:149:11 + --> $DIR/simple.rs:129:11 | LL | match vrm[0] { - | ^^^^^^ help: consider borrowing here: `&vrm[0]` + | ^^^^^^ ... LL | Either::One(_t) => (), | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &vrm[0] { + | + error[E0507]: cannot move out of index of `Vec<Either>` - --> $DIR/simple.rs:157:11 + --> $DIR/simple.rs:136:11 | LL | match vrm[0] { - | ^^^^^^ help: consider borrowing here: `&vrm[0]` + | ^^^^^^ ... LL | Either::One(_t) => (), | -- | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | match &vrm[0] { + | + error[E0507]: cannot move out of `s` which is behind a shared reference - --> $DIR/simple.rs:168:18 + --> $DIR/simple.rs:146:18 | LL | let &X(_t) = s; - | ------ ^ - | | | - | | data moved here - | | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - | help: consider removing the `&`: `X(_t)` + | -- ^ + | | + | data moved here + | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - let &X(_t) = s; +LL + let X(_t) = s; + | error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference - --> $DIR/simple.rs:172:31 + --> $DIR/simple.rs:149:31 | LL | if let &Either::One(_t) = r { } - | ---------------- ^ - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&`: `Either::One(_t)` + | -- ^ + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - if let &Either::One(_t) = r { } +LL + if let Either::One(_t) = r { } + | error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference - --> $DIR/simple.rs:176:34 + --> $DIR/simple.rs:152:34 | LL | while let &Either::One(_t) = r { } - | ---------------- ^ - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&`: `Either::One(_t)` + | -- ^ + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - while let &Either::One(_t) = r { } +LL + while let Either::One(_t) = r { } + | error[E0507]: cannot move out of `r` as enum variant `Two` which is behind a shared reference - --> $DIR/simple.rs:180:11 + --> $DIR/simple.rs:155:11 | LL | match r { | ^ @@ -268,160 +404,215 @@ LL | &Either::One(_t) | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait | -help: consider removing the `&` +help: consider removing the borrow | -LL ~ Either::One(_t) -LL + -LL + -LL ~ | &Either::Two(_t) => (), +LL - &Either::One(_t) +LL + Either::One(_t) | error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference - --> $DIR/simple.rs:188:11 + --> $DIR/simple.rs:162:11 | LL | match r { | ^ LL | LL | &Either::One(_t) => (), - | ---------------- - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&`: `Either::One(_t)` + | -- + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - &Either::One(_t) => (), +LL + Either::One(_t) => (), + | error[E0507]: cannot move out of `r` as enum variant `One` which is behind a shared reference - --> $DIR/simple.rs:195:11 + --> $DIR/simple.rs:168:11 | LL | match r { | ^ LL | LL | &Either::One(_t) => (), - | ---------------- - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&`: `Either::One(_t)` + | -- + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - &Either::One(_t) => (), +LL + Either::One(_t) => (), + | error[E0507]: cannot move out of `sm` which is behind a mutable reference - --> $DIR/simple.rs:207:22 + --> $DIR/simple.rs:178:22 | LL | let &mut X(_t) = sm; - | ---------- ^^ - | | | - | | data moved here - | | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `X(_t)` + | -- ^^ + | | + | data moved here + | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider removing the mutable borrow + | +LL - let &mut X(_t) = sm; +LL + let X(_t) = sm; + | error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference - --> $DIR/simple.rs:211:35 + --> $DIR/simple.rs:181:35 | LL | if let &mut Either::One(_t) = rm { } - | -------------------- ^^ - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `Either::One(_t)` + | -- ^^ + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the mutable borrow + | +LL - if let &mut Either::One(_t) = rm { } +LL + if let Either::One(_t) = rm { } + | error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference - --> $DIR/simple.rs:215:38 + --> $DIR/simple.rs:184:38 | LL | while let &mut Either::One(_t) = rm { } - | -------------------- ^^ - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `Either::One(_t)` + | -- ^^ + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the mutable borrow + | +LL - while let &mut Either::One(_t) = rm { } +LL + while let Either::One(_t) = rm { } + | error[E0507]: cannot move out of `rm` as enum variant `Two` which is behind a mutable reference - --> $DIR/simple.rs:219:11 + --> $DIR/simple.rs:187:11 | LL | match rm { | ^^ LL | LL | &mut Either::One(_t) => (), | -- data moved here -... +LL | LL | &mut Either::Two(_t) => (), | -- ...and here | = note: move occurs because these variables have types that don't implement the `Copy` trait -help: consider removing the `&mut` +help: consider removing the mutable borrow | -LL | Either::One(_t) => (), - | ~~~~~~~~~~~~~~~ -help: consider removing the `&mut` +LL - &mut Either::One(_t) => (), +LL + Either::One(_t) => (), + | +help: consider removing the mutable borrow + | +LL - &mut Either::Two(_t) => (), +LL + Either::Two(_t) => (), | -LL | Either::Two(_t) => (), - | ~~~~~~~~~~~~~~~ error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference - --> $DIR/simple.rs:228:11 + --> $DIR/simple.rs:194:11 | LL | match rm { | ^^ LL | LL | &mut Either::One(_t) => (), - | -------------------- - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `Either::One(_t)` + | -- + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the mutable borrow + | +LL - &mut Either::One(_t) => (), +LL + Either::One(_t) => (), + | error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference - --> $DIR/simple.rs:235:11 + --> $DIR/simple.rs:200:11 | LL | match rm { | ^^ LL | LL | &mut Either::One(_t) => (), - | -------------------- - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `Either::One(_t)` + | -- + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the mutable borrow + | +LL - &mut Either::One(_t) => (), +LL + Either::One(_t) => (), + | error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference - --> $DIR/simple.rs:242:11 + --> $DIR/simple.rs:206:11 | LL | match rm { | ^^ LL | LL | &mut Either::One(_t) => (), - | -------------------- - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `Either::One(_t)` + | -- + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the mutable borrow + | +LL - &mut Either::One(_t) => (), +LL + Either::One(_t) => (), + | error[E0507]: cannot move out of a shared reference - --> $DIR/simple.rs:258:21 + --> $DIR/simple.rs:220:21 | LL | let (&X(_t),) = (&x.clone(),); | -- ^^^^^^^^^^^^^ | | | data moved here | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | let (&X(ref _t),) = (&x.clone(),); + | +++ error[E0507]: cannot move out of a shared reference - --> $DIR/simple.rs:260:34 + --> $DIR/simple.rs:223:34 | LL | if let (&Either::One(_t),) = (&e.clone(),) { } | -- ^^^^^^^^^^^^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | if let (&Either::One(ref _t),) = (&e.clone(),) { } + | +++ error[E0507]: cannot move out of a shared reference - --> $DIR/simple.rs:262:37 + --> $DIR/simple.rs:226:37 | LL | while let (&Either::One(_t),) = (&e.clone(),) { } | -- ^^^^^^^^^^^^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | while let (&Either::One(ref _t),) = (&e.clone(),) { } + | +++ error[E0507]: cannot move out of a shared reference - --> $DIR/simple.rs:264:11 + --> $DIR/simple.rs:229:11 | LL | match (&e.clone(),) { | ^^^^^^^^^^^^^ @@ -431,79 +622,123 @@ LL | (&Either::One(_t),) | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | (&Either::One(ref _t),) + | +++ error[E0507]: cannot move out of a mutable reference - --> $DIR/simple.rs:272:25 + --> $DIR/simple.rs:239:25 | LL | let (&mut X(_t),) = (&mut xm.clone(),); | -- ^^^^^^^^^^^^^^^^^^ | | | data moved here | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | let (&mut X(ref _t),) = (&mut xm.clone(),); + | +++ error[E0507]: cannot move out of a mutable reference - --> $DIR/simple.rs:274:38 + --> $DIR/simple.rs:242:38 | LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { } | -- ^^^^^^^^^^^^^^^^^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | if let (&mut Either::One(ref _t),) = (&mut em.clone(),) { } + | +++ error[E0507]: cannot move out of a mutable reference - --> $DIR/simple.rs:276:41 + --> $DIR/simple.rs:245:41 | LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { } | -- ^^^^^^^^^^^^^^^^^^ | | | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | while let (&mut Either::One(ref _t),) = (&mut em.clone(),) { } + | +++ error[E0507]: cannot move out of a mutable reference - --> $DIR/simple.rs:278:11 + --> $DIR/simple.rs:248:11 | LL | match (&mut em.clone(),) { | ^^^^^^^^^^^^^^^^^^ LL | LL | (&mut Either::One(_t),) => (), | -- data moved here +LL | LL | (&mut Either::Two(_t),) => (), | -- ...and here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider borrowing the pattern binding + | +LL | (&mut Either::One(ref _t),) => (), + | +++ +help: consider borrowing the pattern binding + | +LL | (&mut Either::Two(ref _t),) => (), + | +++ error[E0507]: cannot move out of a shared reference - --> $DIR/simple.rs:288:18 + --> $DIR/simple.rs:261:18 | LL | let &X(_t) = &x; - | ------ ^^ - | | | - | | data moved here - | | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - | help: consider removing the `&`: `X(_t)` + | -- ^^ + | | + | data moved here + | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - let &X(_t) = &x; +LL + let X(_t) = &x; + | error[E0507]: cannot move out of a shared reference - --> $DIR/simple.rs:292:31 + --> $DIR/simple.rs:264:31 | LL | if let &Either::One(_t) = &e { } - | ---------------- ^^ - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&`: `Either::One(_t)` + | -- ^^ + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - if let &Either::One(_t) = &e { } +LL + if let Either::One(_t) = &e { } + | error[E0507]: cannot move out of a shared reference - --> $DIR/simple.rs:296:34 + --> $DIR/simple.rs:267:34 | LL | while let &Either::One(_t) = &e { } - | ---------------- ^^ - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&`: `Either::One(_t)` + | -- ^^ + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - while let &Either::One(_t) = &e { } +LL + while let Either::One(_t) = &e { } + | error[E0507]: cannot move out of a shared reference - --> $DIR/simple.rs:300:11 + --> $DIR/simple.rs:270:11 | LL | match &e { | ^^ @@ -514,72 +749,95 @@ LL | &Either::One(_t) | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait | -help: consider removing the `&` +help: consider removing the borrow | -LL ~ Either::One(_t) -LL + -LL + -LL ~ | &Either::Two(_t) => (), +LL - &Either::One(_t) +LL + Either::One(_t) | error[E0507]: cannot move out of a shared reference - --> $DIR/simple.rs:308:11 + --> $DIR/simple.rs:277:11 | LL | match &e { | ^^ LL | LL | &Either::One(_t) => (), - | ---------------- - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&`: `Either::One(_t)` + | -- + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - &Either::One(_t) => (), +LL + Either::One(_t) => (), + | error[E0507]: cannot move out of a shared reference - --> $DIR/simple.rs:315:11 + --> $DIR/simple.rs:283:11 | LL | match &e { | ^^ LL | LL | &Either::One(_t) => (), - | ---------------- - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&`: `Either::One(_t)` + | -- + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - &Either::One(_t) => (), +LL + Either::One(_t) => (), + | error[E0507]: cannot move out of a mutable reference - --> $DIR/simple.rs:323:22 + --> $DIR/simple.rs:290:22 | LL | let &mut X(_t) = &mut xm; - | ---------- ^^^^^^^ - | | | - | | data moved here - | | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `X(_t)` + | -- ^^^^^^^ + | | + | data moved here + | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider removing the mutable borrow + | +LL - let &mut X(_t) = &mut xm; +LL + let X(_t) = &mut xm; + | error[E0507]: cannot move out of a mutable reference - --> $DIR/simple.rs:327:35 + --> $DIR/simple.rs:293:35 | LL | if let &mut Either::One(_t) = &mut em { } - | -------------------- ^^^^^^^ - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `Either::One(_t)` + | -- ^^^^^^^ + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the mutable borrow + | +LL - if let &mut Either::One(_t) = &mut em { } +LL + if let Either::One(_t) = &mut em { } + | error[E0507]: cannot move out of a mutable reference - --> $DIR/simple.rs:331:38 + --> $DIR/simple.rs:296:38 | LL | while let &mut Either::One(_t) = &mut em { } - | -------------------- ^^^^^^^ - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `Either::One(_t)` + | -- ^^^^^^^ + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the mutable borrow + | +LL - while let &mut Either::One(_t) = &mut em { } +LL + while let Either::One(_t) = &mut em { } + | error[E0507]: cannot move out of a mutable reference - --> $DIR/simple.rs:335:11 + --> $DIR/simple.rs:299:11 | LL | match &mut em { | ^^^^^^^ @@ -590,91 +848,138 @@ LL | &mut Either::One(_t) | data moved here | move occurs because `_t` has type `X`, which does not implement the `Copy` trait | -help: consider removing the `&mut` +help: consider removing the mutable borrow | -LL ~ Either::One(_t) -LL + -LL + -LL ~ | &mut Either::Two(_t) => (), +LL - &mut Either::One(_t) +LL + Either::One(_t) | error[E0507]: cannot move out of a mutable reference - --> $DIR/simple.rs:343:11 + --> $DIR/simple.rs:306:11 | LL | match &mut em { | ^^^^^^^ LL | LL | &mut Either::One(_t) => (), - | -------------------- - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `Either::One(_t)` + | -- + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the mutable borrow + | +LL - &mut Either::One(_t) => (), +LL + Either::One(_t) => (), + | error[E0507]: cannot move out of a mutable reference - --> $DIR/simple.rs:350:11 + --> $DIR/simple.rs:312:11 | LL | match &mut em { | ^^^^^^^ LL | LL | &mut Either::One(_t) => (), - | -------------------- - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `Either::One(_t)` + | -- + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the mutable borrow + | +LL - &mut Either::One(_t) => (), +LL + Either::One(_t) => (), + | error[E0507]: cannot move out of a mutable reference - --> $DIR/simple.rs:357:11 + --> $DIR/simple.rs:318:11 | LL | match &mut em { | ^^^^^^^ LL | LL | &mut Either::One(_t) => (), - | -------------------- - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `Either::One(_t)` + | -- + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the mutable borrow + | +LL - &mut Either::One(_t) => (), +LL + Either::One(_t) => (), + | error[E0507]: cannot move out of a shared reference - --> $DIR/simple.rs:202:11 + --> $DIR/simple.rs:174:11 | LL | fn f1(&X(_t): &X) { } | ^^^--^ - | | | - | | data moved here - | | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - | help: consider removing the `&`: `X(_t)` + | | + | data moved here + | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider removing the borrow + | +LL - fn f1(&X(_t): &X) { } +LL + fn f1(X(_t): &X) { } + | error[E0507]: cannot move out of a mutable reference - --> $DIR/simple.rs:249:11 + --> $DIR/simple.rs:212:11 | LL | fn f2(&mut X(_t): &mut X) { } | ^^^^^^^--^ - | | | - | | data moved here - | | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `X(_t)` + | | + | data moved here + | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider removing the mutable borrow + | +LL - fn f2(&mut X(_t): &mut X) { } +LL + fn f2(X(_t): &mut X) { } + | error[E0507]: cannot move out of a shared reference - --> $DIR/simple.rs:269:11 + --> $DIR/simple.rs:235:11 | LL | fn f3((&X(_t),): (&X,)) { } | ^^^^--^^^ | | | data moved here | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | fn f3((&X(ref _t),): (&X,)) { } + | +++ error[E0507]: cannot move out of a mutable reference - --> $DIR/simple.rs:283:11 + --> $DIR/simple.rs:255:11 | LL | fn f4((&mut X(_t),): (&mut X,)) { } | ^^^^^^^^--^^^ | | | data moved here | move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | fn f4((&mut X(ref _t),): (&mut X,)) { } + | +++ + +error[E0507]: cannot move out of `a.a` as enum variant `Some` which is behind a shared reference + --> $DIR/simple.rs:331:20 + | +LL | let Some(_s) = a.a else { + | -- ^^^ + | | + | data moved here + | move occurs because `_s` has type `String`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | let Some(ref _s) = a.a else { + | +++ -error: aborting due to 60 previous errors +error: aborting due to 61 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/suggestions/dont-suggest-try_into-in-macros.stderr b/src/test/ui/suggestions/dont-suggest-try_into-in-macros.stderr index 4e21d36014c..bc6342004f4 100644 --- a/src/test/ui/suggestions/dont-suggest-try_into-in-macros.stderr +++ b/src/test/ui/suggestions/dont-suggest-try_into-in-macros.stderr @@ -2,7 +2,10 @@ error[E0308]: mismatched types --> $DIR/dont-suggest-try_into-in-macros.rs:2:5 | LL | assert_eq!(10u64, 10usize); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | expected `u64`, found `usize` + | expected because this is `u64` | = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/suggestions/dont-suggest-ufcs-for-const.stderr b/src/test/ui/suggestions/dont-suggest-ufcs-for-const.stderr index 04e0511d788..0d9543e0b8f 100644 --- a/src/test/ui/suggestions/dont-suggest-ufcs-for-const.stderr +++ b/src/test/ui/suggestions/dont-suggest-ufcs-for-const.stderr @@ -2,13 +2,7 @@ error[E0599]: no method named `MAX` found for type `u32` in the current scope --> $DIR/dont-suggest-ufcs-for-const.rs:2:11 | LL | 1_u32.MAX(); - | ------^^^-- - | | | - | | this is an associated function, not a method - | help: use associated function syntax instead: `u32::MAX()` - | - = note: found the following associated functions; to be used as methods, functions must have a `self` parameter - = note: the candidate is defined in an impl for the type `u32` + | ^^^ method not found in `u32` error: aborting due to previous error diff --git a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr index 34ff59a9bb0..b1e04dab8f6 100644 --- a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr +++ b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -41,9 +41,6 @@ LL | Pin::new(x) found type parameter `F` note: associated function defined here --> $SRC_DIR/core/src/pin.rs:LL:COL - | -LL | pub const fn new(pointer: P) -> Pin<P> { - | ^^^ error[E0277]: `dyn Future<Output = i32> + Send` cannot be unpinned --> $DIR/expected-boxed-future-isnt-pinned.rs:19:14 @@ -56,9 +53,6 @@ LL | Pin::new(x) = note: consider using `Box::pin` note: required by a bound in `Pin::<P>::new` --> $SRC_DIR/core/src/pin.rs:LL:COL - | -LL | impl<P: Deref<Target: Unpin>> Pin<P> { - | ^^^^^ required by this bound in `Pin::<P>::new` error[E0277]: `dyn Future<Output = i32> + Send` cannot be unpinned --> $DIR/expected-boxed-future-isnt-pinned.rs:24:14 @@ -71,9 +65,6 @@ LL | Pin::new(Box::new(x)) = note: consider using `Box::pin` note: required by a bound in `Pin::<P>::new` --> $SRC_DIR/core/src/pin.rs:LL:COL - | -LL | impl<P: Deref<Target: Unpin>> Pin<P> { - | ^^^^^ required by this bound in `Pin::<P>::new` error[E0308]: mismatched types --> $DIR/expected-boxed-future-isnt-pinned.rs:28:5 @@ -90,9 +81,6 @@ LL | | } found `async` block `[async block@$DIR/expected-boxed-future-isnt-pinned.rs:28:5: 30:6]` note: function defined here --> $SRC_DIR/core/src/future/mod.rs:LL:COL - | -LL | pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut { - | ^^^^^^^^^^^^^^^ help: you need to pin and box this expression | LL ~ Box::pin(async { diff --git a/src/test/ui/suggestions/for-i-in-vec.stderr b/src/test/ui/suggestions/for-i-in-vec.stderr index 88be9e30a76..c5b81e6b871 100644 --- a/src/test/ui/suggestions/for-i-in-vec.stderr +++ b/src/test/ui/suggestions/for-i-in-vec.stderr @@ -7,11 +7,8 @@ LL | for _ in self.v { | `self.v` moved due to this implicit call to `.into_iter()` | move occurs because `self.v` has type `Vec<u32>`, which does not implement the `Copy` trait | -note: this function takes ownership of the receiver `self`, which moves `self.v` +note: `into_iter` takes ownership of the receiver `self`, which moves `self.v` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ help: consider iterating over a slice of the `Vec<u32>`'s content to avoid moving into the `for` loop | LL | for _ in &self.v { @@ -40,11 +37,8 @@ LL | for loader in *LOADERS { | value moved due to this implicit call to `.into_iter()` | move occurs because value has type `Vec<&u8>`, which does not implement the `Copy` trait | -note: this function takes ownership of the receiver `self`, which moves value +note: `into_iter` takes ownership of the receiver `self`, which moves value --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ help: consider iterating over a slice of the `Vec<&u8>`'s content to avoid moving into the `for` loop | LL | for loader in &*LOADERS { diff --git a/src/test/ui/suggestions/imm-ref-trait-object.stderr b/src/test/ui/suggestions/imm-ref-trait-object.stderr index 42ca3a78d8f..7791b308d5d 100644 --- a/src/test/ui/suggestions/imm-ref-trait-object.stderr +++ b/src/test/ui/suggestions/imm-ref-trait-object.stderr @@ -3,11 +3,9 @@ error: the `min` method cannot be invoked on a trait object | LL | t.min().unwrap() | ^^^ + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL | - ::: $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - | -LL | Self: Sized, - | ----- this has a `Sized` requirement + = note: this has a `Sized` requirement | = note: you need `&mut dyn Iterator<Item = &u64>` instead of `&dyn Iterator<Item = &u64>` diff --git a/src/test/ui/suggestions/import-trait-for-method-call.stderr b/src/test/ui/suggestions/import-trait-for-method-call.stderr index bac8de79872..f159b51a269 100644 --- a/src/test/ui/suggestions/import-trait-for-method-call.stderr +++ b/src/test/ui/suggestions/import-trait-for-method-call.stderr @@ -3,11 +3,9 @@ error[E0599]: no method named `finish` found for struct `DefaultHasher` in the c | LL | h.finish() | ^^^^^^ method not found in `DefaultHasher` + --> $SRC_DIR/core/src/hash/mod.rs:LL:COL | - ::: $SRC_DIR/core/src/hash/mod.rs:LL:COL - | -LL | fn finish(&self) -> u64; - | ------ the method is available for `DefaultHasher` here + = note: the method is available for `DefaultHasher` here | = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: diff --git a/src/test/ui/suggestions/issue-104287.stderr b/src/test/ui/suggestions/issue-104287.stderr index 4b302dd6509..79812a2985e 100644 --- a/src/test/ui/suggestions/issue-104287.stderr +++ b/src/test/ui/suggestions/issue-104287.stderr @@ -11,12 +11,6 @@ LL | simd_gt::<()>(x); | ^^^^^^^------ help: remove these generics | | | expected 0 generic arguments - | -note: associated function defined here, with 0 generic parameters - --> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/ord.rs:LL:COL - | -LL | fn simd_gt(self, other: Self) -> Self::Mask; - | ^^^^^^^ error[E0425]: cannot find function `simd_gt` in this scope --> $DIR/issue-104287.rs:6:5 diff --git a/src/test/ui/suggestions/issue-105226.rs b/src/test/ui/suggestions/issue-105226.rs new file mode 100644 index 00000000000..f123dbf4cae --- /dev/null +++ b/src/test/ui/suggestions/issue-105226.rs @@ -0,0 +1,22 @@ +use std::fmt; + +struct S { +} + +impl S { + fn hello<P>(&self, val: &P) where P: fmt::Display; { + //~^ ERROR non-item in item list + //~| ERROR associated function in `impl` without body + println!("val: {}", val); + } +} + +impl S { + fn hello_empty<P>(&self, val: &P) where P: fmt::Display; + //~^ ERROR associated function in `impl` without body +} + +fn main() { + let s = S{}; + s.hello(&32); +} diff --git a/src/test/ui/suggestions/issue-105226.stderr b/src/test/ui/suggestions/issue-105226.stderr new file mode 100644 index 00000000000..f16a8090103 --- /dev/null +++ b/src/test/ui/suggestions/issue-105226.stderr @@ -0,0 +1,31 @@ +error: non-item in item list + --> $DIR/issue-105226.rs:7:56 + | +LL | impl S { + | - item list starts here +LL | fn hello<P>(&self, val: &P) where P: fmt::Display; { + | - ^ non-item starts here + | | + | help: consider removing this semicolon +... +LL | } + | - item list ends here + +error: associated function in `impl` without body + --> $DIR/issue-105226.rs:7:5 + | +LL | fn hello<P>(&self, val: &P) where P: fmt::Display; { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: provide a definition for the function: `{ <body> }` + +error: associated function in `impl` without body + --> $DIR/issue-105226.rs:15:5 + | +LL | fn hello_empty<P>(&self, val: &P) where P: fmt::Display; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- + | | + | help: provide a definition for the function: `{ <body> }` + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/suggestions/issue-62843.stderr b/src/test/ui/suggestions/issue-62843.stderr index 62f0943d4c9..b6e271de807 100644 --- a/src/test/ui/suggestions/issue-62843.stderr +++ b/src/test/ui/suggestions/issue-62843.stderr @@ -10,9 +10,6 @@ LL | println!("{:?}", line.find(pattern)); = note: required for `String` to implement `Pattern<'_>` note: required by a bound in `core::str::<impl str>::find` --> $SRC_DIR/core/src/str/mod.rs:LL:COL - | -LL | pub fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize> { - | ^^^^^^^^^^^ required by this bound in `core::str::<impl str>::find` help: consider borrowing here | LL | println!("{:?}", line.find(&pattern)); diff --git a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr index 684db23e135..a5e6f5b5ffc 100644 --- a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr +++ b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied - --> $DIR/issue-71394-no-from-impl.rs:3:20 + --> $DIR/issue-71394-no-from-impl.rs:3:25 | LL | let _: &[i8] = data.into(); - | ^^^^ ---- required by a bound introduced by this call - | | - | the trait `From<&[u8]>` is not implemented for `&[i8]` + | ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]` | = help: the following other types implement trait `From<T>`: <[T; LANES] as From<Simd<T, LANES>>> diff --git a/src/test/ui/suggestions/issue-89064.stderr b/src/test/ui/suggestions/issue-89064.stderr index 8b2a3881628..93d8da226c8 100644 --- a/src/test/ui/suggestions/issue-89064.stderr +++ b/src/test/ui/suggestions/issue-89064.stderr @@ -62,11 +62,6 @@ error[E0107]: this associated function takes 0 generic arguments but 1 generic a LL | let _ = 42.into::<Option<_>>(); | ^^^^ expected 0 generic arguments | -note: associated function defined here, with 0 generic parameters - --> $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn into(self) -> T; - | ^^^^ help: consider moving this generic argument to the `Into` trait, which takes up to 1 argument | LL | let _ = Into::<Option<_>>::into(42); diff --git a/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr b/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr index d121932c842..2cb53ecce10 100644 --- a/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr +++ b/src/test/ui/suggestions/mut-borrow-needed-by-trait.stderr @@ -9,9 +9,6 @@ LL | let fp = BufWriter::new(fp); = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write` note: required by a bound in `BufWriter::<W>::new` --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL - | -LL | impl<W: Write> BufWriter<W> { - | ^^^^^ required by this bound in `BufWriter::<W>::new` error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied --> $DIR/mut-borrow-needed-by-trait.rs:17:14 @@ -22,20 +19,15 @@ LL | let fp = BufWriter::new(fp); = note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write` note: required by a bound in `BufWriter` --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL - | -LL | pub struct BufWriter<W: Write> { - | ^^^^^ required by this bound in `BufWriter` error[E0599]: the method `write_fmt` exists for struct `BufWriter<&dyn std::io::Write>`, but its trait bounds were not satisfied --> $DIR/mut-borrow-needed-by-trait.rs:21:5 | LL | writeln!(fp, "hello world").unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `BufWriter<&dyn std::io::Write>` due to unsatisfied trait bounds + --> $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL | - ::: $SRC_DIR/std/src/io/buffered/bufwriter.rs:LL:COL - | -LL | pub struct BufWriter<W: Write> { - | ------------------------------ doesn't satisfy `BufWriter<&dyn std::io::Write>: std::io::Write` + = note: doesn't satisfy `BufWriter<&dyn std::io::Write>: std::io::Write` | = note: the following trait bounds were not satisfied: `&dyn std::io::Write: std::io::Write` diff --git a/src/test/ui/suggestions/option-content-move-from-tuple-match.stderr b/src/test/ui/suggestions/option-content-move-from-tuple-match.stderr index debb8cabaea..97d05d9dcff 100644 --- a/src/test/ui/suggestions/option-content-move-from-tuple-match.stderr +++ b/src/test/ui/suggestions/option-content-move-from-tuple-match.stderr @@ -9,6 +9,11 @@ LL | (None, &c) => &c.unwrap(), | | | data moved here | move occurs because `c` has type `Option<String>`, which does not implement the `Copy` trait + | +help: consider borrowing the pattern binding + | +LL | (None, &ref c) => &c.unwrap(), + | +++ error: aborting due to previous error diff --git a/src/test/ui/suggestions/option-content-move.stderr b/src/test/ui/suggestions/option-content-move.stderr index a6f1ebc975f..3e0271d0257 100644 --- a/src/test/ui/suggestions/option-content-move.stderr +++ b/src/test/ui/suggestions/option-content-move.stderr @@ -7,11 +7,8 @@ LL | if selection.1.unwrap().contains(selection.0) { | help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents | move occurs because `selection.1` has type `Option<String>`, which does not implement the `Copy` trait | -note: this function takes ownership of the receiver `self`, which moves `selection.1` +note: `Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `selection.1` --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | pub const fn unwrap(self) -> T { - | ^^^^ error[E0507]: cannot move out of `selection.1` which is behind a shared reference --> $DIR/option-content-move.rs:27:20 @@ -22,11 +19,8 @@ LL | if selection.1.unwrap().contains(selection.0) { | help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents | move occurs because `selection.1` has type `Result<String, String>`, which does not implement the `Copy` trait | -note: this function takes ownership of the receiver `self`, which moves `selection.1` +note: `Result::<T, E>::unwrap` takes ownership of the receiver `self`, which moves `selection.1` --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub fn unwrap(self) -> T - | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/suggestions/option-to-bool.stderr b/src/test/ui/suggestions/option-to-bool.stderr index 57a934b8342..4050c7be82a 100644 --- a/src/test/ui/suggestions/option-to-bool.stderr +++ b/src/test/ui/suggestions/option-to-bool.stderr @@ -2,7 +2,9 @@ error[E0308]: mismatched types --> $DIR/option-to-bool.rs:4:16 | LL | if true && x {} - | ^ expected `bool`, found enum `Option` + | ---- ^ expected `bool`, found enum `Option` + | | + | expected because this is `bool` | = note: expected type `bool` found enum `Option<i32>` diff --git a/src/test/ui/suggestions/restrict-type-not-param.stderr b/src/test/ui/suggestions/restrict-type-not-param.stderr index e7d9c5ecbe4..5434472ceec 100644 --- a/src/test/ui/suggestions/restrict-type-not-param.stderr +++ b/src/test/ui/suggestions/restrict-type-not-param.stderr @@ -11,11 +11,8 @@ note: an implementation of `Add<_>` might be missing for `Wrapper<T>` | LL | struct Wrapper<T>(T); | ^^^^^^^^^^^^^^^^^ must implement `Add<_>` -note: the following trait must be implemented +note: the trait `Add` must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | pub trait Add<Rhs = Self> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn qux<T>(a: Wrapper<T>, b: T) -> T where Wrapper<T>: Add<T, Output = T> { diff --git a/src/test/ui/suggestions/sugg-else-for-closure.stderr b/src/test/ui/suggestions/sugg-else-for-closure.stderr index 55a0eee1817..da4db46aad3 100644 --- a/src/test/ui/suggestions/sugg-else-for-closure.stderr +++ b/src/test/ui/suggestions/sugg-else-for-closure.stderr @@ -10,9 +10,6 @@ LL | let _s = y.unwrap_or(|| x.split('.').nth(1).unwrap()); found closure `[closure@$DIR/sugg-else-for-closure.rs:6:26: 6:28]` note: associated function defined here --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | pub const fn unwrap_or(self, default: T) -> T - | ^^^^^^^^^ help: try calling `unwrap_or_else` instead | LL | let _s = y.unwrap_or_else(|| x.split('.').nth(1).unwrap()); diff --git a/src/test/ui/suggestions/suggest-change-mut.stderr b/src/test/ui/suggestions/suggest-change-mut.stderr index 889b11a7410..d194afeaf93 100644 --- a/src/test/ui/suggestions/suggest-change-mut.stderr +++ b/src/test/ui/suggestions/suggest-change-mut.stderr @@ -8,9 +8,6 @@ LL | let mut stream_reader = BufReader::new(&stream); | note: required by a bound in `BufReader::<R>::new` --> $SRC_DIR/std/src/io/buffered/bufreader.rs:LL:COL - | -LL | impl<R: Read> BufReader<R> { - | ^^^^ required by this bound in `BufReader::<R>::new` help: consider removing the leading `&`-reference | LL - let mut stream_reader = BufReader::new(&stream); @@ -30,11 +27,9 @@ error[E0599]: the method `read_until` exists for struct `BufReader<&T>`, but its | LL | stream_reader.read_until(b'\n', &mut buffer).expect("Reading into buffer failed"); | ^^^^^^^^^^ method cannot be called on `BufReader<&T>` due to unsatisfied trait bounds + --> $SRC_DIR/std/src/io/buffered/bufreader.rs:LL:COL | - ::: $SRC_DIR/std/src/io/buffered/bufreader.rs:LL:COL - | -LL | pub struct BufReader<R> { - | ----------------------- doesn't satisfy `BufReader<&T>: BufRead` + = note: doesn't satisfy `BufReader<&T>: BufRead` | = note: the following trait bounds were not satisfied: `&T: std::io::Read` diff --git a/src/test/ui/suggestions/suggest-tryinto-edition-change.stderr b/src/test/ui/suggestions/suggest-tryinto-edition-change.stderr index 3d1f2492360..018083f9e03 100644 --- a/src/test/ui/suggestions/suggest-tryinto-edition-change.stderr +++ b/src/test/ui/suggestions/suggest-tryinto-edition-change.stderr @@ -52,11 +52,9 @@ error[E0599]: no method named `try_into` found for type `i32` in the current sco | LL | let _i: i16 = 0_i32.try_into().unwrap(); | ^^^^^^^^ method not found in `i32` + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL | - ::: $SRC_DIR/core/src/convert/mod.rs:LL:COL - | -LL | fn try_into(self) -> Result<T, Self::Error>; - | -------- the method is available for `i32` here + = note: the method is available for `i32` here | = help: items from traits can only be used if the trait is in scope = note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021 diff --git a/src/test/ui/suggestions/try-removing-the-field.rs b/src/test/ui/suggestions/try-removing-the-field.rs index 9d0573ca255..1b7289b229b 100644 --- a/src/test/ui/suggestions/try-removing-the-field.rs +++ b/src/test/ui/suggestions/try-removing-the-field.rs @@ -14,4 +14,19 @@ fn use_foo(x: Foo) -> i32 { return foo; } +// issue #105028, suggest removing the field only for shorthand +fn use_match(x: Foo) { + match x { + Foo { foo: unused, .. } => { //~ WARNING unused variable + //~| help: if this is intentional, prefix it with an underscore + } + } + + match x { + Foo { foo, .. } => { //~ WARNING unused variable + //~| help: try removing the field + } + } +} + fn main() {} diff --git a/src/test/ui/suggestions/try-removing-the-field.stderr b/src/test/ui/suggestions/try-removing-the-field.stderr index 448a2c3d2ec..7a6013d4a6e 100644 --- a/src/test/ui/suggestions/try-removing-the-field.stderr +++ b/src/test/ui/suggestions/try-removing-the-field.stderr @@ -8,5 +8,19 @@ LL | let Foo { foo, bar, .. } = x; | = note: `#[warn(unused_variables)]` on by default -warning: 1 warning emitted +warning: unused variable: `unused` + --> $DIR/try-removing-the-field.rs:20:20 + | +LL | Foo { foo: unused, .. } => { + | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` + +warning: unused variable: `foo` + --> $DIR/try-removing-the-field.rs:26:15 + | +LL | Foo { foo, .. } => { + | ^^^- + | | + | help: try removing the field + +warning: 3 warnings emitted diff --git a/src/test/ui/suggestions/type-ascription-instead-of-path-in-type.stderr b/src/test/ui/suggestions/type-ascription-instead-of-path-in-type.stderr index 951ff23d635..fcff02e09db 100644 --- a/src/test/ui/suggestions/type-ascription-instead-of-path-in-type.stderr +++ b/src/test/ui/suggestions/type-ascription-instead-of-path-in-type.stderr @@ -24,11 +24,6 @@ error[E0107]: this struct takes at least 1 generic argument but 0 generic argume LL | let _: Vec<A:B> = A::B; | ^^^ expected at least 1 generic argument | -note: struct defined here, with at least 1 generic parameter: `T` - --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | ^^^ - help: add missing generic argument | LL | let _: Vec<T, A:B> = A::B; diff --git a/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr b/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr index 773f1392ae7..34eaa8322c8 100644 --- a/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr +++ b/src/test/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:2:18 | LL | let _: f64 = 0..10; - | --- ^^^^^ expected `f64`, found struct `std::ops::Range` + | --- ^^^^^ expected `f64`, found struct `Range` | | | expected due to this | @@ -47,7 +47,7 @@ error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:5:18 | LL | let _: f64 = std::ops::Range { start: 0, end: 1 }; - | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `f64`, found struct `std::ops::Range` + | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `f64`, found struct `Range` | | | expected due to this | diff --git a/src/test/ui/trait-bounds/impl-bound-with-references-error.rs b/src/test/ui/trait-bounds/impl-bound-with-references-error.rs new file mode 100644 index 00000000000..e5d0a1aaed0 --- /dev/null +++ b/src/test/ui/trait-bounds/impl-bound-with-references-error.rs @@ -0,0 +1,20 @@ +// Regression test for #105138. +// This test ensures that the compiler does not add note +// for implementation of trait whose inner type is erroneous. + +pub enum LabelText { + Plain, +} + +impl<T> From<T> for LabelText +//~^ ERROR conflicting implementations of trait `From<LabelText>` for type `LabelText` [E0119] +where + T: Into<Cow<'static, str>>, + //~^ ERROR cannot find type `Cow` in this scope [E0412] +{ + fn from(text: T) -> Self { + LabelText::Plain(text.into()) + } +} + +fn main() {} diff --git a/src/test/ui/trait-bounds/impl-bound-with-references-error.stderr b/src/test/ui/trait-bounds/impl-bound-with-references-error.stderr new file mode 100644 index 00000000000..95fd6bd504c --- /dev/null +++ b/src/test/ui/trait-bounds/impl-bound-with-references-error.stderr @@ -0,0 +1,24 @@ +error[E0412]: cannot find type `Cow` in this scope + --> $DIR/impl-bound-with-references-error.rs:12:13 + | +LL | T: Into<Cow<'static, str>>, + | ^^^ not found in this scope + | +help: consider importing this enum + | +LL | use std::borrow::Cow; + | + +error[E0119]: conflicting implementations of trait `From<LabelText>` for type `LabelText` + --> $DIR/impl-bound-with-references-error.rs:9:1 + | +LL | impl<T> From<T> for LabelText + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl<T> From<T> for T; + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0119, E0412. +For more information about an error, try `rustc --explain E0119`. diff --git a/src/test/ui/trait-bounds/impl-missing-where-clause-lifetimes-from-trait.rs b/src/test/ui/trait-bounds/impl-missing-where-clause-lifetimes-from-trait.rs new file mode 100644 index 00000000000..dcdbd022873 --- /dev/null +++ b/src/test/ui/trait-bounds/impl-missing-where-clause-lifetimes-from-trait.rs @@ -0,0 +1,38 @@ +trait Trait<T> { + fn foo<'a, K>(self, _: T, _: K) where T: 'a, K: 'a; +} + +impl Trait<()> for () { + fn foo<'a, K>(self, _: (), _: K) where { //~ ERROR E0195 + todo!(); + } +} + +struct State; + +trait Foo<T> { + fn foo<'a>(&self, state: &'a State) -> &'a T + where + T: 'a; +} + +impl<F, T> Foo<T> for F +where + F: Fn(&State) -> &T, +{ + fn foo<'a>(&self, state: &'a State) -> &'a T { //~ ERROR E0195 + self(state) + } +} + +trait Bar { + fn foo<'a>(&'a self) {} +} + +impl Bar for () { + fn foo<'a: 'a>(&'a self) {} //~ ERROR E0195 +} + +fn main() { + ().foo((), ()); +} diff --git a/src/test/ui/trait-bounds/impl-missing-where-clause-lifetimes-from-trait.stderr b/src/test/ui/trait-bounds/impl-missing-where-clause-lifetimes-from-trait.stderr new file mode 100644 index 00000000000..e26cb22163f --- /dev/null +++ b/src/test/ui/trait-bounds/impl-missing-where-clause-lifetimes-from-trait.stderr @@ -0,0 +1,36 @@ +error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration + --> $DIR/impl-missing-where-clause-lifetimes-from-trait.rs:6:11 + | +LL | fn foo<'a, K>(self, _: T, _: K) where T: 'a, K: 'a; + | ------- -- -- this bound might be missing in the impl + | | | + | | this bound might be missing in the impl + | lifetimes in impl do not match this method in trait +... +LL | fn foo<'a, K>(self, _: (), _: K) where { + | ^^^^^^^ lifetimes do not match method in trait + +error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration + --> $DIR/impl-missing-where-clause-lifetimes-from-trait.rs:23:11 + | +LL | fn foo<'a>(&self, state: &'a State) -> &'a T + | ---- lifetimes in impl do not match this method in trait +LL | where +LL | T: 'a; + | -- this bound might be missing in the impl +... +LL | fn foo<'a>(&self, state: &'a State) -> &'a T { + | ^^^^ lifetimes do not match method in trait + +error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration + --> $DIR/impl-missing-where-clause-lifetimes-from-trait.rs:33:11 + | +LL | fn foo<'a>(&'a self) {} + | ---- lifetimes in impl do not match this method in trait +... +LL | fn foo<'a: 'a>(&'a self) {} + | ^^^^^^^^ lifetimes do not match method in trait + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0195`. diff --git a/src/test/ui/traits/alias/generic-default-in-dyn.stderr b/src/test/ui/traits/alias/generic-default-in-dyn.stderr index 76a068e864a..0d3f794aa0f 100644 --- a/src/test/ui/traits/alias/generic-default-in-dyn.stderr +++ b/src/test/ui/traits/alias/generic-default-in-dyn.stderr @@ -12,11 +12,9 @@ error[E0393]: the type parameter `Rhs` must be explicitly specified | LL | struct Foo<T>(dyn SendEqAlias<T>); | ^^^^^^^^^^^^^^ missing reference to `Rhs` + --> $SRC_DIR/core/src/cmp.rs:LL:COL | - ::: $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub trait PartialEq<Rhs: ?Sized = Self> { - | --------------------------------------- type parameter `Rhs` must be specified for this + = note: type parameter `Rhs` must be specified for this | = note: because of the default `Self` reference, type parameters must be specified on object types @@ -25,11 +23,9 @@ error[E0393]: the type parameter `Rhs` must be explicitly specified | LL | struct Bar<T>(dyn SendEqAlias<T>, T); | ^^^^^^^^^^^^^^ missing reference to `Rhs` + --> $SRC_DIR/core/src/cmp.rs:LL:COL | - ::: $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub trait PartialEq<Rhs: ?Sized = Self> { - | --------------------------------------- type parameter `Rhs` must be specified for this + = note: type parameter `Rhs` must be specified for this | = note: because of the default `Self` reference, type parameters must be specified on object types diff --git a/src/test/ui/traits/alias/object-fail.stderr b/src/test/ui/traits/alias/object-fail.stderr index 325bc6d2808..048a150df8c 100644 --- a/src/test/ui/traits/alias/object-fail.stderr +++ b/src/test/ui/traits/alias/object-fail.stderr @@ -7,8 +7,7 @@ LL | let _: &dyn EqAlias = &123; note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> --> $SRC_DIR/core/src/cmp.rs:LL:COL | -LL | pub trait Eq: PartialEq<Self> { - | ^^^^^^^^^^^^^^^ the trait cannot be made into an object because it uses `Self` as a type parameter + = note: the trait cannot be made into an object because it uses `Self` as a type parameter error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified --> $DIR/object-fail.rs:9:17 diff --git a/src/test/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/src/test/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 9ca446a0a89..5be33498641 100644 --- a/src/test/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/src/test/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -9,11 +9,9 @@ error[E0404]: expected trait, found struct `String` | LL | struct Foo<T> where T: Bar, <T as Bar>::Baz: String { | ^^^^^^ not a trait + --> $SRC_DIR/alloc/src/string.rs:LL:COL | - ::: $SRC_DIR/alloc/src/string.rs:LL:COL - | -LL | pub trait ToString { - | ------------------ similarly named trait `ToString` defined here + = note: similarly named trait `ToString` defined here | help: constrain the associated type to `String` | @@ -29,11 +27,9 @@ error[E0404]: expected trait, found struct `String` | LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { | ^^^^^^ not a trait + --> $SRC_DIR/alloc/src/string.rs:LL:COL | - ::: $SRC_DIR/alloc/src/string.rs:LL:COL - | -LL | pub trait ToString { - | ------------------ similarly named trait `ToString` defined here + = note: similarly named trait `ToString` defined here | help: constrain the associated type to `String` | @@ -49,11 +45,9 @@ error[E0404]: expected trait, found struct `String` | LL | fn foo<T: Bar>(_: T) where <T as Bar>::Baz: String { | ^^^^^^ not a trait + --> $SRC_DIR/alloc/src/string.rs:LL:COL | - ::: $SRC_DIR/alloc/src/string.rs:LL:COL - | -LL | pub trait ToString { - | ------------------ similarly named trait `ToString` defined here + = note: similarly named trait `ToString` defined here | help: constrain the associated type to `String` | @@ -69,11 +63,9 @@ error[E0404]: expected trait, found struct `String` | LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { | ^^^^^^ not a trait + --> $SRC_DIR/alloc/src/string.rs:LL:COL | - ::: $SRC_DIR/alloc/src/string.rs:LL:COL - | -LL | pub trait ToString { - | ------------------ similarly named trait `ToString` defined here + = note: similarly named trait `ToString` defined here | help: constrain the associated type to `String` | @@ -89,11 +81,9 @@ error[E0404]: expected trait, found struct `String` | LL | fn issue_95327() where <u8 as Unresolved>::Assoc: String {} | ^^^^^^ help: a trait with a similar name exists: `ToString` + --> $SRC_DIR/alloc/src/string.rs:LL:COL | - ::: $SRC_DIR/alloc/src/string.rs:LL:COL - | -LL | pub trait ToString { - | ------------------ similarly named trait `ToString` defined here + = note: similarly named trait `ToString` defined here error: aborting due to 6 previous errors diff --git a/src/test/ui/traits/bad-sized.stderr b/src/test/ui/traits/bad-sized.stderr index 6f9113fff51..fb9900bc57b 100644 --- a/src/test/ui/traits/bad-sized.stderr +++ b/src/test/ui/traits/bad-sized.stderr @@ -18,9 +18,6 @@ LL | let x: Vec<dyn Trait + Sized> = Vec::new(); = help: the trait `Sized` is not implemented for `dyn Trait` note: required by a bound in `Vec` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | ^ required by this bound in `Vec` error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time --> $DIR/bad-sized.rs:4:37 @@ -31,9 +28,6 @@ LL | let x: Vec<dyn Trait + Sized> = Vec::new(); = help: the trait `Sized` is not implemented for `dyn Trait` note: required by a bound in `Vec::<T>::new` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | impl<T> Vec<T> { - | ^ required by this bound in `Vec::<T>::new` error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time --> $DIR/bad-sized.rs:4:37 @@ -44,9 +38,6 @@ LL | let x: Vec<dyn Trait + Sized> = Vec::new(); = help: the trait `Sized` is not implemented for `dyn Trait` note: required by a bound in `Vec` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | ^ required by this bound in `Vec` error: aborting due to 4 previous errors diff --git a/src/test/ui/traits/default-method/rustc_must_implement_one_of_duplicates.rs b/src/test/ui/traits/default-method/rustc_must_implement_one_of_duplicates.rs index 56e8fcff0fc..8db5fa615c0 100644 --- a/src/test/ui/traits/default-method/rustc_must_implement_one_of_duplicates.rs +++ b/src/test/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 +//~^ 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 +//~^ functions names are duplicated +//~| functions names are duplicated +//~| functions names are duplicated trait Trait1 { fn a() {} fn b() {} diff --git a/src/test/ui/traits/default-method/rustc_must_implement_one_of_duplicates.stderr b/src/test/ui/traits/default-method/rustc_must_implement_one_of_duplicates.stderr index 777beba6182..cd1476a6eb8 100644 --- a/src/test/ui/traits/default-method/rustc_must_implement_one_of_duplicates.stderr +++ b/src/test/ui/traits/default-method/rustc_must_implement_one_of_duplicates.stderr @@ -1,34 +1,34 @@ -error: Functions names are duplicated +error: functions names are duplicated --> $DIR/rustc_must_implement_one_of_duplicates.rs:3:31 | LL | #[rustc_must_implement_one_of(a, a)] | ^ ^ | - = note: All `#[rustc_must_implement_one_of]` arguments must be unique + = note: all `#[rustc_must_implement_one_of]` arguments must be unique -error: Functions names are duplicated +error: functions names are duplicated --> $DIR/rustc_must_implement_one_of_duplicates.rs:9:34 | LL | #[rustc_must_implement_one_of(b, a, a, c, b, c)] | ^ ^ | - = note: All `#[rustc_must_implement_one_of]` arguments must be unique + = note: all `#[rustc_must_implement_one_of]` arguments must be unique -error: Functions names are duplicated +error: functions names are duplicated --> $DIR/rustc_must_implement_one_of_duplicates.rs:9:31 | LL | #[rustc_must_implement_one_of(b, a, a, c, b, c)] | ^ ^ | - = note: All `#[rustc_must_implement_one_of]` arguments must be unique + = note: all `#[rustc_must_implement_one_of]` arguments must be unique -error: Functions names are duplicated +error: functions names are duplicated --> $DIR/rustc_must_implement_one_of_duplicates.rs:9:40 | LL | #[rustc_must_implement_one_of(b, a, a, c, b, c)] | ^ ^ | - = note: All `#[rustc_must_implement_one_of]` arguments must be unique + = note: all `#[rustc_must_implement_one_of]` arguments must be unique error: aborting due to 4 previous errors diff --git a/src/test/ui/traits/default-method/rustc_must_implement_one_of_misuse.rs b/src/test/ui/traits/default-method/rustc_must_implement_one_of_misuse.rs index 1f896da94db..b1b91966c8d 100644 --- a/src/test/ui/traits/default-method/rustc_must_implement_one_of_misuse.rs +++ b/src/test/ui/traits/default-method/rustc_must_implement_one_of_misuse.rs @@ -1,12 +1,12 @@ #![feature(rustc_attrs)] #[rustc_must_implement_one_of(a, b)] -//~^ Function not found in this trait -//~| Function not found in this trait +//~^ function not found in this trait +//~| function not found in this trait trait Tr0 {} #[rustc_must_implement_one_of(a, b)] -//~^ Function not found in this trait +//~^ function not found in this trait trait Tr1 { fn a() {} } @@ -23,16 +23,16 @@ trait Tr3 {} #[rustc_must_implement_one_of(A, B)] trait Tr4 { - const A: u8 = 1; //~ Not a function + const A: u8 = 1; //~ not a function - type B; //~ Not a function + type B; //~ not a function } #[rustc_must_implement_one_of(a, b)] trait Tr5 { - fn a(); //~ This function doesn't have a default implementation + fn a(); //~ function doesn't have a default implementation - fn b(); //~ This function doesn't have a default implementation + fn b(); //~ function doesn't have a default implementation } #[rustc_must_implement_one_of(abc, xyz)] diff --git a/src/test/ui/traits/default-method/rustc_must_implement_one_of_misuse.stderr b/src/test/ui/traits/default-method/rustc_must_implement_one_of_misuse.stderr index 869184f0d1a..38e692521ca 100644 --- a/src/test/ui/traits/default-method/rustc_must_implement_one_of_misuse.stderr +++ b/src/test/ui/traits/default-method/rustc_must_implement_one_of_misuse.stderr @@ -22,19 +22,19 @@ LL | LL | struct Struct {} | ---------------- not a trait -error: Function not found in this trait +error: function not found in this trait --> $DIR/rustc_must_implement_one_of_misuse.rs:3:31 | LL | #[rustc_must_implement_one_of(a, b)] | ^ -error: Function not found in this trait +error: function not found in this trait --> $DIR/rustc_must_implement_one_of_misuse.rs:3:34 | LL | #[rustc_must_implement_one_of(a, b)] | ^ -error: Function not found in this trait +error: function not found in this trait --> $DIR/rustc_must_implement_one_of_misuse.rs:8:34 | LL | #[rustc_must_implement_one_of(a, b)] @@ -46,7 +46,7 @@ error: the `#[rustc_must_implement_one_of]` attribute must be used with at least LL | #[rustc_must_implement_one_of(a)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: Not a function +error: not a function --> $DIR/rustc_must_implement_one_of_misuse.rs:26:5 | LL | const A: u8 = 1; @@ -57,9 +57,9 @@ note: required by this annotation | LL | #[rustc_must_implement_one_of(A, B)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: All `#[rustc_must_implement_one_of]` arguments must be associated function names + = note: all `#[rustc_must_implement_one_of]` arguments must be associated function names -error: Not a function +error: not a function --> $DIR/rustc_must_implement_one_of_misuse.rs:28:5 | LL | type B; @@ -70,9 +70,9 @@ note: required by this annotation | LL | #[rustc_must_implement_one_of(A, B)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: All `#[rustc_must_implement_one_of]` arguments must be associated function names + = note: all `#[rustc_must_implement_one_of]` arguments must be associated function names -error: This function doesn't have a default implementation +error: function doesn't have a default implementation --> $DIR/rustc_must_implement_one_of_misuse.rs:33:5 | LL | fn a(); @@ -84,7 +84,7 @@ note: required by this annotation LL | #[rustc_must_implement_one_of(a, b)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: This function doesn't have a default implementation +error: function doesn't have a default implementation --> $DIR/rustc_must_implement_one_of_misuse.rs:35:5 | LL | fn b(); diff --git a/src/test/ui/issues/issue-38404.rs b/src/test/ui/traits/issue-38404.rs index 1a92acc3404..1a92acc3404 100644 --- a/src/test/ui/issues/issue-38404.rs +++ b/src/test/ui/traits/issue-38404.rs diff --git a/src/test/ui/issues/issue-38404.stderr b/src/test/ui/traits/issue-38404.stderr index d7721d7e69c..d7721d7e69c 100644 --- a/src/test/ui/issues/issue-38404.stderr +++ b/src/test/ui/traits/issue-38404.stderr diff --git a/src/test/ui/issues/issue-50480.rs b/src/test/ui/traits/issue-50480.rs index 10597caf5b2..10597caf5b2 100644 --- a/src/test/ui/issues/issue-50480.rs +++ b/src/test/ui/traits/issue-50480.rs diff --git a/src/test/ui/issues/issue-50480.stderr b/src/test/ui/traits/issue-50480.stderr index 0bb1f9ae035..0bb1f9ae035 100644 --- a/src/test/ui/issues/issue-50480.stderr +++ b/src/test/ui/traits/issue-50480.stderr diff --git a/src/test/ui/traits/issue-77982.stderr b/src/test/ui/traits/issue-77982.stderr index b6a04585583..0b57a8212bd 100644 --- a/src/test/ui/traits/issue-77982.stderr +++ b/src/test/ui/traits/issue-77982.stderr @@ -12,9 +12,6 @@ LL | opts.get(opt.as_ref()); where T: ?Sized; note: required by a bound in `HashMap::<K, V, S>::get` --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL - | -LL | K: Borrow<Q>, - | ^^^^^^^^^ required by this bound in `HashMap::<K, V, S>::get` help: consider specifying the generic argument | LL | opts.get::<Q>(opt.as_ref()); @@ -46,7 +43,15 @@ LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect( | | | required by a bound introduced by this call | - = note: cannot satisfy `u32: From<_>` + = note: multiple `impl`s satisfying `u32: From<_>` found in the following crates: `core`, `std`: + - impl From<Ipv4Addr> for u32; + - impl From<NonZeroU32> for u32; + - impl From<bool> for u32; + - impl From<char> for u32; + - impl From<u16> for u32; + - impl From<u8> for u32; + - impl<T> From<!> for T; + - impl<T> From<T> for T; help: try using a fully qualified path to specify the expected types | LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(<u32 as Into<T>>::into(0u32))).collect(); diff --git a/src/test/ui/traits/issue-79458.stderr b/src/test/ui/traits/issue-79458.stderr index cf2e4edf9f0..08f7bbbf0ea 100644 --- a/src/test/ui/traits/issue-79458.stderr +++ b/src/test/ui/traits/issue-79458.stderr @@ -7,10 +7,7 @@ LL | struct Foo<'a, T> { LL | bar: &'a mut T | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&mut T` | - = help: the following other types implement trait `Clone`: - &T - *const T - *mut T + = help: the trait `Clone` is implemented for `&T` = note: `Clone` is implemented for `&T`, but not for `&mut T` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/traits/issue-85735.stderr b/src/test/ui/traits/issue-85735.stderr index fa280135beb..930708f9ad8 100644 --- a/src/test/ui/traits/issue-85735.stderr +++ b/src/test/ui/traits/issue-85735.stderr @@ -5,6 +5,9 @@ LL | T: FnMut(&'a ()), | ^^^^^^^^^^^^^ | = note: cannot satisfy `T: FnMut<(&'a (),)>` + = help: the following types implement trait `FnMut<Args>`: + &F + &mut F error: aborting due to previous error diff --git a/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr b/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr index a74d2524996..1f18c5daf66 100644 --- a/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr +++ b/src/test/ui/traits/issue-91949-hangs-on-recursion.stderr @@ -17,7 +17,7 @@ error[E0275]: overflow evaluating the requirement `(): Sized` = help: consider increasing the recursion limit by adding a `#![recursion_limit = "512"]` attribute to your crate (`issue_91949_hangs_on_recursion`) = note: required for `std::iter::Empty<()>` to implement `Iterator` = note: 171 redundant requirements hidden - = note: required for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<..., ...>>, ...>>` to implement `Iterator` + = note: required for `IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<IteratorOfWrapped<(), Map<..., ...>>, ...>>, ...>>` to implement `Iterator` = note: the full type name has been written to '$TEST_BUILD_DIR/traits/issue-91949-hangs-on-recursion/issue-91949-hangs-on-recursion.long-type-hash.txt' error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/traits/issue-97576.stderr b/src/test/ui/traits/issue-97576.stderr index 146d38d076a..9062a0fab63 100644 --- a/src/test/ui/traits/issue-97576.stderr +++ b/src/test/ui/traits/issue-97576.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `String: From<impl ToString>` is not satisfied - --> $DIR/issue-97576.rs:8:18 + --> $DIR/issue-97576.rs:8:22 | LL | bar: bar.into(), - | ^^^ ---- required by a bound introduced by this call - | | - | the trait `From<impl ToString>` is not implemented for `String` + | ^^^^ the trait `From<impl ToString>` is not implemented for `String` | = note: required for `impl ToString` to implement `Into<String>` diff --git a/src/test/ui/traits/mutual-recursion-issue-75860.stderr b/src/test/ui/traits/mutual-recursion-issue-75860.stderr index 920f66121e0..23e182738f7 100644 --- a/src/test/ui/traits/mutual-recursion-issue-75860.stderr +++ b/src/test/ui/traits/mutual-recursion-issue-75860.stderr @@ -7,9 +7,6 @@ LL | iso(left, right) = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`mutual_recursion_issue_75860`) note: required by a bound in `Option` --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | pub enum Option<T> { - | ^ required by this bound in `Option` error: aborting due to previous error diff --git a/src/test/ui/traits/object/issue-44454-1.rs b/src/test/ui/traits/object/issue-44454-1.rs new file mode 100644 index 00000000000..bbaf3188a89 --- /dev/null +++ b/src/test/ui/traits/object/issue-44454-1.rs @@ -0,0 +1,22 @@ +// Taken from https://github.com/rust-lang/rust/issues/44454#issue-256435333 + +trait Animal<X>: 'static {} + +fn foo<Y, X>() +where + Y: Animal<X> + ?Sized, +{ + // `Y` implements `Animal<X>` so `Y` is 'static. + baz::<Y>() +} + +fn bar<'a>(_arg: &'a i32) { + foo::<dyn Animal<&'a i32>, &'a i32>() //~ ERROR: lifetime may not live long enough +} + +fn baz<T: 'static + ?Sized>() {} + +fn main() { + let a = 5; + bar(&a); +} diff --git a/src/test/ui/traits/object/issue-44454-1.stderr b/src/test/ui/traits/object/issue-44454-1.stderr new file mode 100644 index 00000000000..859487f50ac --- /dev/null +++ b/src/test/ui/traits/object/issue-44454-1.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/issue-44454-1.rs:14:5 + | +LL | fn bar<'a>(_arg: &'a i32) { + | -- lifetime `'a` defined here +LL | foo::<dyn Animal<&'a i32>, &'a i32>() + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/traits/object/issue-44454-2.rs b/src/test/ui/traits/object/issue-44454-2.rs new file mode 100644 index 00000000000..f5178bcdbe2 --- /dev/null +++ b/src/test/ui/traits/object/issue-44454-2.rs @@ -0,0 +1,22 @@ +// Taken from https://github.com/rust-lang/rust/issues/44454#issuecomment-1175925928 + +trait Trait<ARG: 'static>: 'static { + type Assoc: AsRef<str>; +} + +fn hr<T: ?Sized, ARG>(x: T::Assoc) -> Box<dyn AsRef<str> + 'static> +where + T: Trait<ARG> +{ + Box::new(x) +} + +fn extend_lt<'a>(x: &'a str) -> Box<dyn AsRef<str> + 'static> { + type DynTrait = dyn for<'a> Trait<&'a str, Assoc = &'a str>; + hr::<DynTrait, _>(x) //~ ERROR: borrowed data escapes outside of function +} + +fn main() { + let extended = extend_lt(&String::from("hello")); + println!("{}", extended.as_ref().as_ref()); +} diff --git a/src/test/ui/traits/object/issue-44454-2.stderr b/src/test/ui/traits/object/issue-44454-2.stderr new file mode 100644 index 00000000000..7f574769b7f --- /dev/null +++ b/src/test/ui/traits/object/issue-44454-2.stderr @@ -0,0 +1,17 @@ +error[E0521]: borrowed data escapes outside of function + --> $DIR/issue-44454-2.rs:16:5 + | +LL | fn extend_lt<'a>(x: &'a str) -> Box<dyn AsRef<str> + 'static> { + | -- - `x` is a reference that is only valid in the function body + | | + | lifetime `'a` defined here +LL | type DynTrait = dyn for<'a> Trait<&'a str, Assoc = &'a str>; +LL | hr::<DynTrait, _>(x) + | ^^^^^^^^^^^^^^^^^^^^ + | | + | `x` escapes the function body here + | argument requires that `'a` must outlive `'static` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0521`. diff --git a/src/test/ui/traits/object/issue-44454-3.rs b/src/test/ui/traits/object/issue-44454-3.rs new file mode 100644 index 00000000000..bff72703534 --- /dev/null +++ b/src/test/ui/traits/object/issue-44454-3.rs @@ -0,0 +1,33 @@ +// Taken from https://github.com/rust-lang/rust/issues/44454#issuecomment-1332781290 + +use std::any::Any; + +trait Animal<X>: 'static {} + +trait Projector { + type Foo; +} + +impl<X> Projector for dyn Animal<X> { + type Foo = X; +} + +fn make_static<'a, T>(t: &'a T) -> &'static T { + let x: <dyn Animal<&'a T> as Projector>::Foo = t; + let any = generic::<dyn Animal<&'a T>, &'a T>(x); + //~^ ERROR: lifetime may not live long enough + any.downcast_ref::<&'static T>().unwrap() +} + +fn generic<T: Projector + Animal<U> + ?Sized, U>(x: <T as Projector>::Foo) -> Box<dyn Any> { + make_static_any(x) +} + +fn make_static_any<U: 'static>(u: U) -> Box<dyn Any> { + Box::new(u) +} + +fn main() { + let a = make_static(&"salut".to_string()); + println!("{}", *a); +} diff --git a/src/test/ui/traits/object/issue-44454-3.stderr b/src/test/ui/traits/object/issue-44454-3.stderr new file mode 100644 index 00000000000..294684d26bd --- /dev/null +++ b/src/test/ui/traits/object/issue-44454-3.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-44454-3.rs:17:15 + | +LL | fn make_static<'a, T>(t: &'a T) -> &'static T { + | -- lifetime `'a` defined here +LL | let x: <dyn Animal<&'a T> as Projector>::Foo = t; +LL | let any = generic::<dyn Animal<&'a T>, &'a T>(x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/traits/suggest-deferences/issue-39029.stderr b/src/test/ui/traits/suggest-deferences/issue-39029.stderr index eb2b88059d4..49e20c6a76a 100644 --- a/src/test/ui/traits/suggest-deferences/issue-39029.stderr +++ b/src/test/ui/traits/suggest-deferences/issue-39029.stderr @@ -9,9 +9,6 @@ LL | let _errors = TcpListener::bind(&bad); = note: required for `&NoToSocketAddrs` to implement `ToSocketAddrs` note: required by a bound in `TcpListener::bind` --> $SRC_DIR/std/src/net/tcp.rs:LL:COL - | -LL | pub fn bind<A: ToSocketAddrs>(addr: A) -> io::Result<TcpListener> { - | ^^^^^^^^^^^^^ required by this bound in `TcpListener::bind` help: consider dereferencing here | LL | let _errors = TcpListener::bind(&*bad); diff --git a/src/test/ui/traits/suggest-deferences/root-obligation.stderr b/src/test/ui/traits/suggest-deferences/root-obligation.stderr index 76663ace7ed..1363fb8c47a 100644 --- a/src/test/ui/traits/suggest-deferences/root-obligation.stderr +++ b/src/test/ui/traits/suggest-deferences/root-obligation.stderr @@ -11,9 +11,6 @@ LL | .filter(|c| "aeiou".contains(c)) = note: required for `&char` to implement `Pattern<'_>` note: required by a bound in `core::str::<impl str>::contains` --> $SRC_DIR/core/src/str/mod.rs:LL:COL - | -LL | pub fn contains<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool { - | ^^^^^^^^^^^ required by this bound in `core::str::<impl str>::contains` help: consider dereferencing here | LL | .filter(|c| "aeiou".contains(*c)) diff --git a/src/test/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.fixed b/src/test/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.fixed new file mode 100644 index 00000000000..ea3d1bf853a --- /dev/null +++ b/src/test/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.fixed @@ -0,0 +1,14 @@ +// run-rustfix + +struct TargetStruct; + +impl From<usize> for TargetStruct { + fn from(_unchecked: usize) -> Self { + TargetStruct + } +} + +fn main() { + let a = &3; + let _b: TargetStruct = (*a).into(); //~ ERROR the trait bound `TargetStruct: From<&{integer}>` is not satisfied +} diff --git a/src/test/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.rs b/src/test/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.rs new file mode 100644 index 00000000000..9eda68027b2 --- /dev/null +++ b/src/test/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.rs @@ -0,0 +1,14 @@ +// run-rustfix + +struct TargetStruct; + +impl From<usize> for TargetStruct { + fn from(_unchecked: usize) -> Self { + TargetStruct + } +} + +fn main() { + let a = &3; + let _b: TargetStruct = a.into(); //~ ERROR the trait bound `TargetStruct: From<&{integer}>` is not satisfied +} diff --git a/src/test/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.stderr b/src/test/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.stderr new file mode 100644 index 00000000000..ede31a2c7bc --- /dev/null +++ b/src/test/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `TargetStruct: From<&{integer}>` is not satisfied + --> $DIR/suggest-dereferencing-receiver-argument.rs:13:30 + | +LL | let _b: TargetStruct = a.into(); + | ^^^^ the trait `From<&{integer}>` is not implemented for `TargetStruct` + | + = note: required for `&{integer}` to implement `Into<TargetStruct>` +help: consider dereferencing here + | +LL | let _b: TargetStruct = (*a).into(); + | ++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/suggest-where-clause.stderr b/src/test/ui/traits/suggest-where-clause.stderr index 747e2477b9c..44e63b78cce 100644 --- a/src/test/ui/traits/suggest-where-clause.stderr +++ b/src/test/ui/traits/suggest-where-clause.stderr @@ -9,9 +9,6 @@ LL | mem::size_of::<U>(); | note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | pub const fn size_of<T>() -> usize { - | ^ required by this bound in `std::mem::size_of` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn check<T: Iterator, U: ?Sized>() { @@ -34,9 +31,6 @@ LL | struct Misc<T:?Sized>(T); | ^^^^ note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | pub const fn size_of<T>() -> usize { - | ^ required by this bound in `std::mem::size_of` help: consider removing the `?Sized` bound to make the type parameter `Sized` | LL - fn check<T: Iterator, U: ?Sized>() { @@ -80,9 +74,6 @@ LL | mem::size_of::<[T]>(); = help: the trait `Sized` is not implemented for `[T]` note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | pub const fn size_of<T>() -> usize { - | ^ required by this bound in `std::mem::size_of` error[E0277]: the size for values of type `[&U]` cannot be known at compilation time --> $DIR/suggest-where-clause.rs:31:20 @@ -93,9 +84,6 @@ LL | mem::size_of::<[&U]>(); = help: the trait `Sized` is not implemented for `[&U]` note: required by a bound in `std::mem::size_of` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | pub const fn size_of<T>() -> usize { - | ^ required by this bound in `std::mem::size_of` error: aborting due to 7 previous errors diff --git a/src/test/ui/transmutability/issue-101739-2.stderr b/src/test/ui/transmutability/issue-101739-2.stderr index 3f83d6583b0..1b3d202590d 100644 --- a/src/test/ui/transmutability/issue-101739-2.stderr +++ b/src/test/ui/transmutability/issue-101739-2.stderr @@ -8,12 +8,6 @@ LL | / ASSUME_LIFETIMES, LL | | ASSUME_VALIDITY, LL | | ASSUME_VISIBILITY, | |_____________________________- help: remove these generic arguments - | -note: trait defined here, with at most 3 generic parameters: `Src`, `Context`, `ASSUME` - --> $SRC_DIR/core/src/mem/transmutability.rs:LL:COL - | -LL | pub unsafe trait BikeshedIntrinsicFrom<Src, Context, const ASSUME: Assume = { Assume::NOTHING }> - | ^^^^^^^^^^^^^^^^^^^^^ --- ------- ------------------------------------------ error: aborting due to previous error diff --git a/src/test/ui/try-trait/bad-interconversion.stderr b/src/test/ui/try-trait/bad-interconversion.stderr index 419a86bf33b..a49630adb95 100644 --- a/src/test/ui/try-trait/bad-interconversion.stderr +++ b/src/test/ui/try-trait/bad-interconversion.stderr @@ -8,15 +8,8 @@ LL | Ok(Err(123_i32)?) | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait = help: the following other types implement trait `From<T>`: - <f32 as From<i16>> - <f32 as From<i8>> - <f32 as From<u16>> - <f32 as From<u8>> - <f64 as From<f32>> - <f64 as From<i16>> - <f64 as From<i32>> - <f64 as From<i8>> - and 68 others + <u8 as From<NonZeroU8>> + <u8 as From<bool>> = note: required for `Result<u64, u8>` to implement `FromResidual<Result<Infallible, i32>>` error[E0277]: the `?` operator can only be used on `Result`s, not `Option`s, in a function that returns `Result` diff --git a/src/test/ui/tuple/wrong_argument_ice-3.stderr b/src/test/ui/tuple/wrong_argument_ice-3.stderr index f3a547fa238..fe3712ef839 100644 --- a/src/test/ui/tuple/wrong_argument_ice-3.stderr +++ b/src/test/ui/tuple/wrong_argument_ice-3.stderr @@ -13,9 +13,6 @@ LL | groups.push(new_group, vec![process]); found struct `Vec<String>` note: associated function defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | pub fn push(&mut self, value: T) { - | ^^^^ help: remove the extra argument | LL | groups.push(/* (Vec<String>, Vec<Process>) */); diff --git a/src/test/ui/tuple/wrong_argument_ice.stderr b/src/test/ui/tuple/wrong_argument_ice.stderr index ec07f1e70cf..452413fc516 100644 --- a/src/test/ui/tuple/wrong_argument_ice.stderr +++ b/src/test/ui/tuple/wrong_argument_ice.stderr @@ -6,9 +6,6 @@ LL | self.acc.push_back(self.current_provides, self.current_requires); | note: associated function defined here --> $SRC_DIR/alloc/src/collections/vec_deque/mod.rs:LL:COL - | -LL | pub fn push_back(&mut self, value: T) { - | ^^^^^^^^^ help: wrap these arguments in parentheses to construct a tuple | LL | self.acc.push_back((self.current_provides, self.current_requires)); diff --git a/src/test/ui/type-alias-impl-trait/closures_in_branches.stderr b/src/test/ui/type-alias-impl-trait/closures_in_branches.stderr index 48b7946ea82..9cc15f14a99 100644 --- a/src/test/ui/type-alias-impl-trait/closures_in_branches.stderr +++ b/src/test/ui/type-alias-impl-trait/closures_in_branches.stderr @@ -6,8 +6,8 @@ LL | |x| x.len() | help: consider giving this closure parameter an explicit type | -LL | |x: _| x.len() - | +++ +LL | |x: /* Type */| x.len() + | ++++++++++++ error[E0282]: type annotations needed --> $DIR/closures_in_branches.rs:21:10 @@ -17,8 +17,8 @@ LL | |x| x.len() | help: consider giving this closure parameter an explicit type | -LL | |x: _| x.len() - | +++ +LL | |x: /* Type */| x.len() + | ++++++++++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/type-alias-impl-trait/self-referential-2.stderr b/src/test/ui/type-alias-impl-trait/self-referential-2.stderr index 2b505d30730..c2cf70687fd 100644 --- a/src/test/ui/type-alias-impl-trait/self-referential-2.stderr +++ b/src/test/ui/type-alias-impl-trait/self-referential-2.stderr @@ -7,16 +7,7 @@ LL | 42_i32 | ------ return type was inferred to be `i32` here | = help: the trait `PartialEq<Foo>` is not implemented for `i32` - = help: the following other types implement trait `PartialEq<Rhs>`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize - and 6 others + = help: the trait `PartialEq` is implemented for `i32` error: aborting due to previous error diff --git a/src/test/ui/type-alias-impl-trait/self-referential-4.stderr b/src/test/ui/type-alias-impl-trait/self-referential-4.stderr index 27880f792f4..98c762e3d38 100644 --- a/src/test/ui/type-alias-impl-trait/self-referential-4.stderr +++ b/src/test/ui/type-alias-impl-trait/self-referential-4.stderr @@ -7,16 +7,7 @@ LL | i | - return type was inferred to be `&i32` here | = help: the trait `PartialEq<Bar<'b, 'static>>` is not implemented for `&i32` - = help: the following other types implement trait `PartialEq<Rhs>`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize - and 6 others + = help: the trait `PartialEq` is implemented for `i32` error[E0277]: can't compare `&i32` with `Foo<'static, 'b>` --> $DIR/self-referential-4.rs:11:31 @@ -27,16 +18,7 @@ LL | i | - return type was inferred to be `&i32` here | = help: the trait `PartialEq<Foo<'static, 'b>>` is not implemented for `&i32` - = help: the following other types implement trait `PartialEq<Rhs>`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize - and 6 others + = help: the trait `PartialEq` is implemented for `i32` error[E0277]: can't compare `&i32` with `Moo<'static, 'a>` --> $DIR/self-referential-4.rs:17:31 @@ -47,16 +29,7 @@ LL | i | - return type was inferred to be `&i32` here | = help: the trait `PartialEq<Moo<'static, 'a>>` is not implemented for `&i32` - = help: the following other types implement trait `PartialEq<Rhs>`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize - and 6 others + = help: the trait `PartialEq` is implemented for `i32` error: aborting due to 3 previous errors diff --git a/src/test/ui/type-alias-impl-trait/self-referential.stderr b/src/test/ui/type-alias-impl-trait/self-referential.stderr index 97d510f6830..aff489d70e3 100644 --- a/src/test/ui/type-alias-impl-trait/self-referential.stderr +++ b/src/test/ui/type-alias-impl-trait/self-referential.stderr @@ -8,16 +8,7 @@ LL | i | - return type was inferred to be `&i32` here | = help: the trait `PartialEq<Bar<'b, 'a>>` is not implemented for `&i32` - = help: the following other types implement trait `PartialEq<Rhs>`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize - and 6 others + = help: the trait `PartialEq` is implemented for `i32` error[E0277]: can't compare `&i32` with `(i32, &i32)` --> $DIR/self-referential.rs:12:31 @@ -29,16 +20,7 @@ LL | (42, i) | ------- return type was inferred to be `(i32, &i32)` here | = help: the trait `PartialEq<(i32, &i32)>` is not implemented for `&i32` - = help: the following other types implement trait `PartialEq<Rhs>`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize - and 6 others + = help: the trait `PartialEq` is implemented for `i32` error[E0277]: can't compare `&i32` with `(i32, Moo<'b, 'a>::{opaque#0})` --> $DIR/self-referential.rs:19:31 @@ -50,16 +32,7 @@ LL | (42, i) | ------- return type was inferred to be `(i32, &i32)` here | = help: the trait `PartialEq<(i32, Moo<'b, 'a>::{opaque#0})>` is not implemented for `&i32` - = help: the following other types implement trait `PartialEq<Rhs>`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize - and 6 others + = help: the trait `PartialEq` is implemented for `i32` error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-37515.rs b/src/test/ui/type-alias/issue-37515.rs index b3a870d505a..b3a870d505a 100644 --- a/src/test/ui/issues/issue-37515.rs +++ b/src/test/ui/type-alias/issue-37515.rs diff --git a/src/test/ui/issues/issue-37515.stderr b/src/test/ui/type-alias/issue-37515.stderr index f1e83ca74d8..f1e83ca74d8 100644 --- a/src/test/ui/issues/issue-37515.stderr +++ b/src/test/ui/type-alias/issue-37515.stderr diff --git a/src/test/ui/type/ascription/issue-34255-1.stderr b/src/test/ui/type/ascription/issue-34255-1.stderr index 6819d14bb01..fd43e1114c8 100644 --- a/src/test/ui/type/ascription/issue-34255-1.stderr +++ b/src/test/ui/type/ascription/issue-34255-1.stderr @@ -25,11 +25,6 @@ error[E0107]: missing generics for struct `Vec` LL | input_cells: Vec::new() | ^^^ expected at least 1 generic argument | -note: struct defined here, with at least 1 generic parameter: `T` - --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> { - | ^^^ - help: add missing generic argument | LL | input_cells: Vec<T>::new() diff --git a/src/test/ui/type/type-annotation-needed.stderr b/src/test/ui/type/type-annotation-needed.stderr index 4af4c22f751..87bba3166be 100644 --- a/src/test/ui/type/type-annotation-needed.stderr +++ b/src/test/ui/type/type-annotation-needed.stderr @@ -10,7 +10,7 @@ note: required by a bound in `foo` | LL | fn foo<T: Into<String>>(x: i32) {} | ^^^^^^^^^^^^ required by this bound in `foo` -help: consider specifying the type argument in the function call +help: consider specifying the generic argument | LL | foo::<T>(42); | +++++ diff --git a/src/test/ui/type/type-ascription-instead-of-initializer.stderr b/src/test/ui/type/type-ascription-instead-of-initializer.stderr index de578ca93ed..ba8d15d0b73 100644 --- a/src/test/ui/type/type-ascription-instead-of-initializer.stderr +++ b/src/test/ui/type/type-ascription-instead-of-initializer.stderr @@ -15,9 +15,6 @@ LL | let x: Vec::with_capacity(10, 20); | note: associated function defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - | -LL | pub fn with_capacity(capacity: usize) -> Self { - | ^^^^^^^^^^^^^ help: remove the extra argument | LL | let x: Vec::with_capacity(10); diff --git a/src/test/ui/type/type-ascription-precedence.stderr b/src/test/ui/type/type-ascription-precedence.stderr index a8139063db1..edc5aeffdcd 100644 --- a/src/test/ui/type/type-ascription-precedence.stderr +++ b/src/test/ui/type/type-ascription-precedence.stderr @@ -33,11 +33,8 @@ note: an implementation of `std::ops::Neg` might be missing for `Z` | LL | struct Z; | ^^^^^^^^ must implement `std::ops::Neg` -note: the following trait must be implemented +note: the trait `std::ops::Neg` must be implemented --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | pub trait Neg { - | ^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:45:5 @@ -55,7 +52,7 @@ error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:53:5 | LL | (S .. S): S; - | ^^^^^^^^ expected struct `S`, found struct `std::ops::Range` + | ^^^^^^^^ expected struct `S`, found struct `Range` | = note: expected struct `S` found struct `std::ops::Range<S>` diff --git a/src/test/ui/type/type-ascription-soundness.rs b/src/test/ui/type/type-ascription-soundness.rs index d583fc2131a..08316cdcd35 100644 --- a/src/test/ui/type/type-ascription-soundness.rs +++ b/src/test/ui/type/type-ascription-soundness.rs @@ -4,10 +4,10 @@ fn main() { let arr = &[1u8, 2, 3]; - let ref x = arr: &[u8]; //~ ERROR mismatched types - let ref mut x = arr: &[u8]; //~ ERROR mismatched types - match arr: &[u8] { //~ ERROR mismatched types + let ref x = type_ascribe!(arr, &[u8]); //~ ERROR mismatched types + let ref mut x = type_ascribe!(arr, &[u8]); //~ ERROR mismatched types + match type_ascribe!(arr, &[u8]) { //~ ERROR mismatched types ref x => {} } - let _len = (arr: &[u8]).len(); //~ ERROR mismatched types + let _len = type_ascribe!(arr, &[u8]).len(); //~ ERROR mismatched types } diff --git a/src/test/ui/type/type-ascription-soundness.stderr b/src/test/ui/type/type-ascription-soundness.stderr index 6ed940823af..522d5b2e375 100644 --- a/src/test/ui/type/type-ascription-soundness.stderr +++ b/src/test/ui/type/type-ascription-soundness.stderr @@ -1,35 +1,35 @@ error[E0308]: mismatched types - --> $DIR/type-ascription-soundness.rs:7:17 + --> $DIR/type-ascription-soundness.rs:7:31 | -LL | let ref x = arr: &[u8]; - | ^^^ expected slice `[u8]`, found array `[u8; 3]` +LL | let ref x = type_ascribe!(arr, &[u8]); + | ^^^ expected slice `[u8]`, found array `[u8; 3]` | = note: expected reference `&[u8]` found reference `&[u8; 3]` error[E0308]: mismatched types - --> $DIR/type-ascription-soundness.rs:8:21 + --> $DIR/type-ascription-soundness.rs:8:35 | -LL | let ref mut x = arr: &[u8]; - | ^^^ expected slice `[u8]`, found array `[u8; 3]` +LL | let ref mut x = type_ascribe!(arr, &[u8]); + | ^^^ expected slice `[u8]`, found array `[u8; 3]` | = note: expected reference `&[u8]` found reference `&[u8; 3]` error[E0308]: mismatched types - --> $DIR/type-ascription-soundness.rs:9:11 + --> $DIR/type-ascription-soundness.rs:9:25 | -LL | match arr: &[u8] { - | ^^^ expected slice `[u8]`, found array `[u8; 3]` +LL | match type_ascribe!(arr, &[u8]) { + | ^^^ expected slice `[u8]`, found array `[u8; 3]` | = note: expected reference `&[u8]` found reference `&[u8; 3]` error[E0308]: mismatched types - --> $DIR/type-ascription-soundness.rs:12:17 + --> $DIR/type-ascription-soundness.rs:12:30 | -LL | let _len = (arr: &[u8]).len(); - | ^^^ expected slice `[u8]`, found array `[u8; 3]` +LL | let _len = type_ascribe!(arr, &[u8]).len(); + | ^^^ expected slice `[u8]`, found array `[u8; 3]` | = note: expected reference `&[u8]` found reference `&[u8; 3]` diff --git a/src/test/ui/type/type-ascription.rs b/src/test/ui/type/type-ascription.rs index 7adb074428c..e4a4c89d057 100644 --- a/src/test/ui/type/type-ascription.rs +++ b/src/test/ui/type/type-ascription.rs @@ -8,32 +8,32 @@ use std::mem; -const C1: u8 = 10: u8; -const C2: [u8; 1: usize] = [1]; +const C1: u8 = type_ascribe!(10, u8); +const C2: [u8; type_ascribe!(1, usize)] = [1]; struct S { a: u8 } fn main() { - assert_eq!(C1.into(): i32, 10); + assert_eq!(type_ascribe!(C1.into(), i32), 10); assert_eq!(C2[0], 1); - let s = S { a: 10: u8 }; + let s = S { a: type_ascribe!(10, u8) }; let arr = &[1u8, 2, 3]; - let mut v = arr.iter().cloned().collect(): Vec<_>; + let mut v = type_ascribe!(arr.iter().cloned().collect(), Vec<_>); v.push(4); assert_eq!(v, [1, 2, 3, 4]); - let a = 1: u8; - let b = a.into(): u16; - assert_eq!(v[a.into(): usize], 2); + let a = type_ascribe!(1, u8); + let b = type_ascribe!(a.into(), u16); + assert_eq!(v[type_ascribe!(a.into(), usize)], 2); assert_eq!(mem::size_of_val(&a), 1); assert_eq!(mem::size_of_val(&b), 2); - assert_eq!(b, 1: u16); + assert_eq!(b, type_ascribe!(1, u16)); let mut v = Vec::new(); - v: Vec<u8> = vec![1, 2, 3]; // Place expression type ascription + type_ascribe!(v, Vec<u8>) = vec![1, 2, 3]; // Place expression type ascription assert_eq!(v, [1u8, 2, 3]); } diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index cf77c057d46..9ba63ffe9c9 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -66,15 +66,10 @@ LL | trait ProjectionPred<T:Iterator = IntoIter<i32>> where T::Item : Add<u8> {} | = help: the trait `Add<u8>` is not implemented for `i32` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> - <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> - <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&i32 as Add<&i32>> + <i32 as Add<&i32>> + <i32 as Add> error: aborting due to 7 previous errors diff --git a/src/test/ui/type/type-check/assignment-in-if.stderr b/src/test/ui/type/type-check/assignment-in-if.stderr index 8ab08e25e30..9f4558adab1 100644 --- a/src/test/ui/type/type-check/assignment-in-if.stderr +++ b/src/test/ui/type/type-check/assignment-in-if.stderr @@ -68,7 +68,9 @@ error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:44:18 | LL | if x == x && x = x && x == x { - | ^ expected `bool`, found `usize` + | ------ ^ expected `bool`, found `usize` + | | + | expected because this is `bool` error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:44:22 @@ -91,7 +93,9 @@ error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:51:28 | LL | if x == x && x == x && x = x { - | ^ expected `bool`, found `usize` + | ---------------- ^ expected `bool`, found `usize` + | | + | expected because this is `bool` error[E0308]: mismatched types --> $DIR/assignment-in-if.rs:51:8 diff --git a/src/test/ui/type/type-check/unknown_type_for_closure.stderr b/src/test/ui/type/type-check/unknown_type_for_closure.stderr index 9ae97f390d3..e5e29aabf37 100644 --- a/src/test/ui/type/type-check/unknown_type_for_closure.stderr +++ b/src/test/ui/type/type-check/unknown_type_for_closure.stderr @@ -12,8 +12,8 @@ LL | let x = |_| {}; | help: consider giving this closure parameter an explicit type | -LL | let x = |_: _| {}; - | +++ +LL | let x = |_: /* Type */| {}; + | ++++++++++++ error[E0282]: type annotations needed --> $DIR/unknown_type_for_closure.rs:10:14 diff --git a/src/test/ui/type/type-params-in-different-spaces-1.stderr b/src/test/ui/type/type-params-in-different-spaces-1.stderr index 4e73e10a301..7529f25bd8e 100644 --- a/src/test/ui/type/type-params-in-different-spaces-1.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-1.stderr @@ -6,7 +6,9 @@ LL | trait BrokenAdd: Copy + Add<Output=Self> { LL | fn broken_add<T>(&self, rhs: T) -> Self { | - found type parameter LL | *self + rhs - | ^^^ expected type parameter `Self`, found type parameter `T` + | ----- ^^^ expected type parameter `Self`, found type parameter `T` + | | + | expected because this is `Self` | = note: expected type parameter `Self` found type parameter `T` diff --git a/src/test/ui/type/type-path-err-node-types.stderr b/src/test/ui/type/type-path-err-node-types.stderr index c1ae10efac4..1aed1dbe4ba 100644 --- a/src/test/ui/type/type-path-err-node-types.stderr +++ b/src/test/ui/type/type-path-err-node-types.stderr @@ -30,8 +30,8 @@ LL | let _ = |a, b: _| -> _ { 0 }; | help: consider giving this closure parameter an explicit type | -LL | let _ = |a: _, b: _| -> _ { 0 }; - | +++ +LL | let _ = |a: /* Type */, b: _| -> _ { 0 }; + | ++++++++++++ error: aborting due to 5 previous errors diff --git a/src/test/ui/type_length_limit.stderr b/src/test/ui/type_length_limit.stderr index ff487466902..5b00d387aba 100644 --- a/src/test/ui/type_length_limit.stderr +++ b/src/test/ui/type_length_limit.stderr @@ -1,9 +1,6 @@ error: reached the type-length limit while instantiating `std::mem::drop::<Option<((((..., ..., ...), ..., ...), ..., ...), ..., ...)>>` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL | -LL | pub fn drop<T>(_x: T) {} - | ^^^^^^^^^^^^^^^^^^^^^ - | = help: consider adding a `#![type_length_limit="10"]` attribute to your crate = note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit/type_length_limit.long-type.txt' diff --git a/src/test/ui/typeck/issue-104582.rs b/src/test/ui/typeck/issue-104582.rs new file mode 100644 index 00000000000..104669dadbe --- /dev/null +++ b/src/test/ui/typeck/issue-104582.rs @@ -0,0 +1,5 @@ +fn main(){ + let my_var: String(String?); + //~^ ERROR: invalid `?` in type + //~| ERROR: parenthesized type parameters may only be used with a `Fn` trait +} diff --git a/src/test/ui/typeck/issue-104582.stderr b/src/test/ui/typeck/issue-104582.stderr new file mode 100644 index 00000000000..61b6b23642c --- /dev/null +++ b/src/test/ui/typeck/issue-104582.stderr @@ -0,0 +1,25 @@ +error: invalid `?` in type + --> $DIR/issue-104582.rs:2:30 + | +LL | let my_var: String(String?); + | ^ `?` is only allowed on expressions, not types + | +help: if you meant to express that the type might not contain a value, use the `Option` wrapper type + | +LL | let my_var: String(Option<String>); + | +++++++ ~ + +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-104582.rs:2:17 + | +LL | let my_var: String(String?); + | ^^^^^^^^^^^^^^^ only `Fn` traits may use parentheses + | +help: use angle brackets instead + | +LL | let my_var: String<String?>; + | ~ ~ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0214`. diff --git a/src/test/ui/typeck/issue-13853.stderr b/src/test/ui/typeck/issue-13853.stderr index 657bda5f62b..876ac2c67ef 100644 --- a/src/test/ui/typeck/issue-13853.stderr +++ b/src/test/ui/typeck/issue-13853.stderr @@ -5,7 +5,7 @@ LL | fn nodes<'a, I: Iterator<Item=&'a N>>(&self) -> I | - this type parameter - expected `I` because of return type ... LL | self.iter() - | ^^^^^^^^^^^ expected type parameter `I`, found struct `std::slice::Iter` + | ^^^^^^^^^^^ expected type parameter `I`, found struct `Iter` | = note: expected type parameter `I` found struct `std::slice::Iter<'_, N>` diff --git a/src/test/ui/issues/issue-33575.rs b/src/test/ui/typeck/issue-33575.rs index de544afae73..de544afae73 100644 --- a/src/test/ui/issues/issue-33575.rs +++ b/src/test/ui/typeck/issue-33575.rs diff --git a/src/test/ui/issues/issue-33575.stderr b/src/test/ui/typeck/issue-33575.stderr index bbd8042d1cd..bbd8042d1cd 100644 --- a/src/test/ui/issues/issue-33575.stderr +++ b/src/test/ui/typeck/issue-33575.stderr diff --git a/src/test/ui/typeck/issue-46112.stderr b/src/test/ui/typeck/issue-46112.stderr index 91381e8ef4a..f488463ae3c 100644 --- a/src/test/ui/typeck/issue-46112.stderr +++ b/src/test/ui/typeck/issue-46112.stderr @@ -10,9 +10,6 @@ LL | fn main() { test(Ok(())); } found unit type `()` note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^ help: try wrapping the expression in `Some` | LL | fn main() { test(Ok(Some(()))); } diff --git a/src/test/ui/typeck/issue-75883.stderr b/src/test/ui/typeck/issue-75883.stderr index 3861e0507f6..f5adcabe3e9 100644 --- a/src/test/ui/typeck/issue-75883.stderr +++ b/src/test/ui/typeck/issue-75883.stderr @@ -6,11 +6,6 @@ LL | pub fn run() -> Result<_> { | | | expected 2 generic arguments | -note: enum defined here, with 2 generic parameters: `T`, `E` - --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | ^^^^^^ - - help: add missing generic argument | LL | pub fn run() -> Result<_, E> { @@ -24,11 +19,6 @@ LL | pub fn interact(&mut self) -> Result<_> { | | | expected 2 generic arguments | -note: enum defined here, with 2 generic parameters: `T`, `E` - --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | pub enum Result<T, E> { - | ^^^^^^ - - help: add missing generic argument | LL | pub fn interact(&mut self) -> Result<_, E> { diff --git a/src/test/ui/typeck/issue-81293.stderr b/src/test/ui/typeck/issue-81293.stderr index 9658288ac8b..6976be71135 100644 --- a/src/test/ui/typeck/issue-81293.stderr +++ b/src/test/ui/typeck/issue-81293.stderr @@ -21,15 +21,10 @@ LL | a = c + b * 5; | = help: the trait `Add<u16>` is not implemented for `usize` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> - <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> - <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> - <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&'a usize as Add<usize>> + <&usize as Add<&usize>> + <usize as Add<&usize>> + <usize as Add> error: aborting due to 3 previous errors diff --git a/src/test/ui/typeck/issue-83693.stderr b/src/test/ui/typeck/issue-83693.stderr index 1e45c2d35df..ce4f73b820a 100644 --- a/src/test/ui/typeck/issue-83693.stderr +++ b/src/test/ui/typeck/issue-83693.stderr @@ -3,11 +3,9 @@ error[E0412]: cannot find type `F` in this scope | LL | impl F { | ^ help: a trait with a similar name exists: `Fn` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait Fn<Args: Tuple>: FnMut<Args> { - | -------------------------------------- similarly named trait `Fn` defined here + = note: similarly named trait `Fn` defined here error[E0412]: cannot find type `TestResult` in this scope --> $DIR/issue-83693.rs:9:22 diff --git a/src/test/ui/typeck/issue-84768.stderr b/src/test/ui/typeck/issue-84768.stderr index 04dc0e36520..00d23389720 100644 --- a/src/test/ui/typeck/issue-84768.stderr +++ b/src/test/ui/typeck/issue-84768.stderr @@ -16,9 +16,6 @@ LL | <F as FnOnce(&mut u8)>::call_once(f, 1) found type `{integer}` note: associated function defined here --> $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | extern "rust-call" fn call_once(self, args: Args) -> Self::Output; - | ^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/typeck/issue-91267.rs b/src/test/ui/typeck/issue-91267.rs index f5a37e9cb86..4e39cfab5b4 100644 --- a/src/test/ui/typeck/issue-91267.rs +++ b/src/test/ui/typeck/issue-91267.rs @@ -1,5 +1,7 @@ +#![feature(type_ascription)] + fn main() { - 0: u8<e<5>=e> + type_ascribe!(0, u8<e<5>=e>) //~^ ERROR: cannot find type `e` in this scope [E0412] //~| ERROR: associated type bindings are not allowed here [E0229] //~| ERROR: mismatched types [E0308] diff --git a/src/test/ui/typeck/issue-91267.stderr b/src/test/ui/typeck/issue-91267.stderr index aac00b9b6a9..72acd9c673b 100644 --- a/src/test/ui/typeck/issue-91267.stderr +++ b/src/test/ui/typeck/issue-91267.stderr @@ -1,25 +1,22 @@ error[E0412]: cannot find type `e` in this scope - --> $DIR/issue-91267.rs:2:16 + --> $DIR/issue-91267.rs:4:30 | -LL | 0: u8<e<5>=e> - | ^ - | | - | not found in this scope - | help: maybe you meant to write an assignment here: `let e` +LL | type_ascribe!(0, u8<e<5>=e>) + | ^ not found in this scope error[E0229]: associated type bindings are not allowed here - --> $DIR/issue-91267.rs:2:11 + --> $DIR/issue-91267.rs:4:25 | -LL | 0: u8<e<5>=e> - | ^^^^^^ associated type not allowed here +LL | type_ascribe!(0, u8<e<5>=e>) + | ^^^^^^ associated type not allowed here error[E0308]: mismatched types - --> $DIR/issue-91267.rs:2:5 + --> $DIR/issue-91267.rs:4:5 | LL | fn main() { | - expected `()` because of default return type -LL | 0: u8<e<5>=e> - | ^^^^^^^^^^^^^ expected `()`, found `u8` +LL | type_ascribe!(0, u8<e<5>=e>) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `u8` error: aborting due to 3 previous errors diff --git a/src/test/ui/typeck/path-to-method-sugg-unresolved-expr.rs b/src/test/ui/typeck/path-to-method-sugg-unresolved-expr.rs new file mode 100644 index 00000000000..fb56b394493 --- /dev/null +++ b/src/test/ui/typeck/path-to-method-sugg-unresolved-expr.rs @@ -0,0 +1,4 @@ +fn main() { + let page_size = page_size::get(); + //~^ ERROR failed to resolve: use of undeclared crate or module `page_size` +} diff --git a/src/test/ui/typeck/path-to-method-sugg-unresolved-expr.stderr b/src/test/ui/typeck/path-to-method-sugg-unresolved-expr.stderr new file mode 100644 index 00000000000..b01e30be54d --- /dev/null +++ b/src/test/ui/typeck/path-to-method-sugg-unresolved-expr.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: use of undeclared crate or module `page_size` + --> $DIR/path-to-method-sugg-unresolved-expr.rs:2:21 + | +LL | let page_size = page_size::get(); + | ^^^^^^^^^ use of undeclared crate or module `page_size` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/typeck/struct-enum-wrong-args.stderr b/src/test/ui/typeck/struct-enum-wrong-args.stderr index ea94bcbc290..fbced928a8a 100644 --- a/src/test/ui/typeck/struct-enum-wrong-args.stderr +++ b/src/test/ui/typeck/struct-enum-wrong-args.stderr @@ -6,9 +6,6 @@ LL | let _ = Some(3, 2); | note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^^^ help: remove the extra argument | LL | let _ = Some(3); @@ -24,9 +21,6 @@ LL | let _ = Ok(3, 6, 2); | note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^ help: remove the extra arguments | LL | let _ = Ok(3); @@ -40,9 +34,6 @@ LL | let _ = Ok(); | note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL - | -LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), - | ^^ help: provide the argument | LL | let _ = Ok(/* value */); diff --git a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr index bf74dd7dec0..331540d1e42 100644 --- a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr +++ b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr @@ -5,12 +5,6 @@ LL | fn foo1<T:Copy<U>, U>(x: T) {} | ^^^^--- help: remove these generics | | | expected 0 generic arguments - | -note: trait defined here, with 0 generic parameters - --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | pub trait Copy: Clone { - | ^^^^ error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 @@ -19,12 +13,6 @@ LL | trait Trait: Copy<dyn Send> {} | ^^^^---------- help: remove these generics | | | expected 0 generic arguments - | -note: trait defined here, with 0 generic parameters - --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | pub trait Copy: Clone { - | ^^^^ error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:7:21 @@ -33,12 +21,6 @@ LL | struct MyStruct1<T: Copy<T>>; | ^^^^--- help: remove these generics | | | expected 0 generic arguments - | -note: trait defined here, with 0 generic parameters - --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | pub trait Copy: Clone { - | ^^^^ error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:10:25 @@ -47,12 +29,6 @@ LL | struct MyStruct2<'a, T: Copy<'a>>; | ^^^^---- help: remove these generics | | | expected 0 lifetime arguments - | -note: trait defined here, with 0 lifetime parameters - --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | pub trait Copy: Clone { - | ^^^^ error[E0107]: this trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:13:15 @@ -61,12 +37,6 @@ LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} | ^^^^ -- help: remove this lifetime argument | | | expected 0 lifetime arguments - | -note: trait defined here, with 0 lifetime parameters - --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | pub trait Copy: Clone { - | ^^^^ error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:13:15 @@ -75,12 +45,6 @@ LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} | ^^^^ - help: remove this generic argument | | | expected 0 generic arguments - | -note: trait defined here, with 0 generic parameters - --> $SRC_DIR/core/src/marker.rs:LL:COL - | -LL | pub trait Copy: Clone { - | ^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr index eaab6ff3d9a..a2fe627868a 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -8,15 +8,10 @@ LL | <i32 as Add<u32>>::add(1, 2); | = help: the trait `Add<u32>` is not implemented for `i32` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> - <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> - <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&i32 as Add<&i32>> + <i32 as Add<&i32>> + <i32 as Add> error[E0308]: mismatched types --> $DIR/ufcs-qpath-self-mismatch.rs:7:28 @@ -28,9 +23,6 @@ LL | <i32 as Add<i32>>::add(1u32, 2); | note: associated function defined here --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | fn add(self, rhs: Rhs) -> Self::Output; - | ^^^ help: change the type of the numeric literal from `u32` to `i32` | LL | <i32 as Add<i32>>::add(1i32, 2); @@ -46,9 +38,6 @@ LL | <i32 as Add<i32>>::add(1, 2u32); | note: associated function defined here --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | -LL | fn add(self, rhs: Rhs) -> Self::Output; - | ^^^ help: change the type of the numeric literal from `u32` to `i32` | LL | <i32 as Add<i32>>::add(1, 2i32); @@ -62,15 +51,10 @@ LL | <i32 as Add<u32>>::add(1, 2); | = help: the trait `Add<u32>` is not implemented for `i32` = help: the following other types implement trait `Add<Rhs>`: - <&'a f32 as Add<f32>> - <&'a f64 as Add<f64>> - <&'a i128 as Add<i128>> - <&'a i16 as Add<i16>> <&'a i32 as Add<i32>> - <&'a i64 as Add<i64>> - <&'a i8 as Add<i8>> - <&'a isize as Add<isize>> - and 48 others + <&i32 as Add<&i32>> + <i32 as Add<&i32>> + <i32 as Add> error: aborting due to 4 previous errors diff --git a/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr b/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr index 1c18eb0fc49..cfbe1c6f2cb 100644 --- a/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr +++ b/src/test/ui/unboxed-closures/non-tupled-arg-mismatch.stderr @@ -6,9 +6,6 @@ LL | fn a<F: Fn<usize>>(f: F) {} | note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait Fn<Args: Tuple>: FnMut<Args> { - | ^^^^^ required by this bound in `Fn` error: aborting due to previous error diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr index c7882963407..d33a61ca848 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -6,12 +6,9 @@ LL | let _ = match x { | note: `Result<u32, &Void>` defined here --> $SRC_DIR/core/src/result.rs:LL:COL + ::: $SRC_DIR/core/src/result.rs:LL:COL | -LL | pub enum Result<T, E> { - | --------------------- -... -LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), - | ^^^ not covered + = note: not covered = note: the matched value is of type `Result<u32, &Void>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -88,12 +85,9 @@ LL | let _ = match x { | note: `Result<u32, Void>` defined here --> $SRC_DIR/core/src/result.rs:LL:COL + ::: $SRC_DIR/core/src/result.rs:LL:COL | -LL | pub enum Result<T, E> { - | --------------------- -... -LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), - | ^^^ not covered + = note: not covered = note: the matched value is of type `Result<u32, Void>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | @@ -111,12 +105,9 @@ LL | let Ok(x) = x; = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html note: `Result<u32, Void>` defined here --> $SRC_DIR/core/src/result.rs:LL:COL + ::: $SRC_DIR/core/src/result.rs:LL:COL | -LL | pub enum Result<T, E> { - | --------------------- -... -LL | Err(#[stable(feature = "rust1", since = "1.0.0")] E), - | ^^^ not covered + = note: not covered = note: the matched value is of type `Result<u32, Void>` help: you might want to use `if let` to ignore the variant that isn't matched | diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.mirunsafeck.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.mirunsafeck.stderr index ca02de4c61b..7f931b49a58 100644 --- a/src/test/ui/union/union-borrow-move-parent-sibling.mirunsafeck.stderr +++ b/src/test/ui/union/union-borrow-move-parent-sibling.mirunsafeck.stderr @@ -14,10 +14,12 @@ error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec<u8>, Moc --> $DIR/union-borrow-move-parent-sibling.rs:62:13 | LL | let a = u.x.0; - | ^^^^^ - | | - | move occurs because value has type `(MockVec<u8>, MockVec<u8>)`, which does not implement the `Copy` trait - | help: consider borrowing here: `&u.x.0` + | ^^^^^ move occurs because value has type `(MockVec<u8>, MockVec<u8>)`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let a = &u.x.0; + | + error[E0382]: use of moved value: `u` --> $DIR/union-borrow-move-parent-sibling.rs:64:13 @@ -46,10 +48,12 @@ error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec<u8>, Moc --> $DIR/union-borrow-move-parent-sibling.rs:76:13 | LL | let a = (u.x.0).0; - | ^^^^^^^^^ - | | - | move occurs because value has type `MockVec<u8>`, which does not implement the `Copy` trait - | help: consider borrowing here: `&(u.x.0).0` + | ^^^^^^^^^ move occurs because value has type `MockVec<u8>`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let a = &(u.x.0).0; + | + error[E0382]: use of moved value: `u` --> $DIR/union-borrow-move-parent-sibling.rs:78:13 diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.thirunsafeck.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.thirunsafeck.stderr index ca02de4c61b..7f931b49a58 100644 --- a/src/test/ui/union/union-borrow-move-parent-sibling.thirunsafeck.stderr +++ b/src/test/ui/union/union-borrow-move-parent-sibling.thirunsafeck.stderr @@ -14,10 +14,12 @@ error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec<u8>, Moc --> $DIR/union-borrow-move-parent-sibling.rs:62:13 | LL | let a = u.x.0; - | ^^^^^ - | | - | move occurs because value has type `(MockVec<u8>, MockVec<u8>)`, which does not implement the `Copy` trait - | help: consider borrowing here: `&u.x.0` + | ^^^^^ move occurs because value has type `(MockVec<u8>, MockVec<u8>)`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let a = &u.x.0; + | + error[E0382]: use of moved value: `u` --> $DIR/union-borrow-move-parent-sibling.rs:64:13 @@ -46,10 +48,12 @@ error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec<u8>, Moc --> $DIR/union-borrow-move-parent-sibling.rs:76:13 | LL | let a = (u.x.0).0; - | ^^^^^^^^^ - | | - | move occurs because value has type `MockVec<u8>`, which does not implement the `Copy` trait - | help: consider borrowing here: `&(u.x.0).0` + | ^^^^^^^^^ move occurs because value has type `MockVec<u8>`, which does not implement the `Copy` trait + | +help: consider borrowing here + | +LL | let a = &(u.x.0).0; + | + error[E0382]: use of moved value: `u` --> $DIR/union-borrow-move-parent-sibling.rs:78:13 diff --git a/src/test/ui/union/union-derive-clone.mirunsafeck.stderr b/src/test/ui/union/union-derive-clone.mirunsafeck.stderr index 148fb504670..65ff72fe474 100644 --- a/src/test/ui/union/union-derive-clone.mirunsafeck.stderr +++ b/src/test/ui/union/union-derive-clone.mirunsafeck.stderr @@ -6,9 +6,6 @@ LL | #[derive(Clone)] | note: required by a bound in `AssertParamIsCopy` --> $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> { - | ^^^^ required by this bound in `AssertParamIsCopy` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `U1` with `#[derive(Copy)]` | diff --git a/src/test/ui/union/union-derive-clone.thirunsafeck.stderr b/src/test/ui/union/union-derive-clone.thirunsafeck.stderr index 148fb504670..65ff72fe474 100644 --- a/src/test/ui/union/union-derive-clone.thirunsafeck.stderr +++ b/src/test/ui/union/union-derive-clone.thirunsafeck.stderr @@ -6,9 +6,6 @@ LL | #[derive(Clone)] | note: required by a bound in `AssertParamIsCopy` --> $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> { - | ^^^^ required by this bound in `AssertParamIsCopy` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `U1` with `#[derive(Copy)]` | diff --git a/src/test/ui/union/union-derive-eq.mirunsafeck.stderr b/src/test/ui/union/union-derive-eq.mirunsafeck.stderr index 99505f31639..9e55390b54d 100644 --- a/src/test/ui/union/union-derive-eq.mirunsafeck.stderr +++ b/src/test/ui/union/union-derive-eq.mirunsafeck.stderr @@ -9,9 +9,6 @@ LL | a: PartialEqNotEq, | note: required by a bound in `AssertParamIsEq` --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub struct AssertParamIsEq<T: Eq + ?Sized> { - | ^^ required by this bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]` | diff --git a/src/test/ui/union/union-derive-eq.thirunsafeck.stderr b/src/test/ui/union/union-derive-eq.thirunsafeck.stderr index 99505f31639..9e55390b54d 100644 --- a/src/test/ui/union/union-derive-eq.thirunsafeck.stderr +++ b/src/test/ui/union/union-derive-eq.thirunsafeck.stderr @@ -9,9 +9,6 @@ LL | a: PartialEqNotEq, | note: required by a bound in `AssertParamIsEq` --> $SRC_DIR/core/src/cmp.rs:LL:COL - | -LL | pub struct AssertParamIsEq<T: Eq + ?Sized> { - | ^^ required by this bound in `AssertParamIsEq` = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]` | diff --git a/src/test/ui/unique-object-noncopyable.stderr b/src/test/ui/unique-object-noncopyable.stderr index 98a9bd07ed2..db42ed9baf1 100644 --- a/src/test/ui/unique-object-noncopyable.stderr +++ b/src/test/ui/unique-object-noncopyable.stderr @@ -9,14 +9,10 @@ LL | trait Foo { ... LL | let _z = y.clone(); | ^^^^^ method cannot be called on `Box<dyn Foo>` due to unsatisfied trait bounds - | + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL | -LL | / pub struct Box< -LL | | T: ?Sized, -LL | | #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, -LL | | >(Unique<T>, A); - | |_- doesn't satisfy `Box<dyn Foo>: Clone` + = note: doesn't satisfy `Box<dyn Foo>: Clone` | = note: the following trait bounds were not satisfied: `dyn Foo: Sized` diff --git a/src/test/ui/unique-pinned-nocopy.stderr b/src/test/ui/unique-pinned-nocopy.stderr index 7af9c684b72..de6611324ca 100644 --- a/src/test/ui/unique-pinned-nocopy.stderr +++ b/src/test/ui/unique-pinned-nocopy.stderr @@ -6,14 +6,10 @@ LL | struct R { ... LL | let _j = i.clone(); | ^^^^^ method cannot be called on `Box<R>` due to unsatisfied trait bounds - | + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL | -LL | / pub struct Box< -LL | | T: ?Sized, -LL | | #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, -LL | | >(Unique<T>, A); - | |_- doesn't satisfy `Box<R>: Clone` + = note: doesn't satisfy `Box<R>: Clone` | = note: the following trait bounds were not satisfied: `R: Clone` diff --git a/src/test/ui/unop-move-semantics.stderr b/src/test/ui/unop-move-semantics.stderr index d52a92b8888..2a3ca14433f 100644 --- a/src/test/ui/unop-move-semantics.stderr +++ b/src/test/ui/unop-move-semantics.stderr @@ -11,9 +11,6 @@ LL | x.clone(); | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | fn not(self) -> Self::Output; - | ^^^^ help: consider cloning the value if the performance cost is acceptable | LL | !x.clone(); @@ -57,9 +54,6 @@ LL | !*m; | note: calling this operator moves the left-hand side --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - | -LL | fn not(self) -> Self::Output; - | ^^^^ error[E0507]: cannot move out of `*n` which is behind a shared reference --> $DIR/unop-move-semantics.rs:26:6 diff --git a/src/test/ui/unsized-locals/borrow-after-move.stderr b/src/test/ui/unsized-locals/borrow-after-move.stderr index d8bffd4f9cf..9e3c345dd80 100644 --- a/src/test/ui/unsized-locals/borrow-after-move.stderr +++ b/src/test/ui/unsized-locals/borrow-after-move.stderr @@ -59,7 +59,7 @@ LL | y.foo(); LL | println!("{}", &y); | ^^ value borrowed here after move | -note: this function takes ownership of the receiver `self`, which moves `y` +note: `Foo::foo` takes ownership of the receiver `self`, which moves `y` --> $DIR/borrow-after-move.rs:5:12 | LL | fn foo(self) -> String; diff --git a/src/test/ui/unsized-locals/double-move.stderr b/src/test/ui/unsized-locals/double-move.stderr index 71534818141..49b906bbe02 100644 --- a/src/test/ui/unsized-locals/double-move.stderr +++ b/src/test/ui/unsized-locals/double-move.stderr @@ -55,7 +55,7 @@ LL | y.foo(); LL | y.foo(); | ^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `y` +note: `Foo::foo` takes ownership of the receiver `self`, which moves `y` --> $DIR/double-move.rs:5:12 | LL | fn foo(self) -> String; diff --git a/src/test/ui/unsized/issue-71659.stderr b/src/test/ui/unsized/issue-71659.stderr index 50060e53a49..d7b95f55769 100644 --- a/src/test/ui/unsized/issue-71659.stderr +++ b/src/test/ui/unsized/issue-71659.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied - --> $DIR/issue-71659.rs:30:13 + --> $DIR/issue-71659.rs:30:15 | LL | let x = x.cast::<[i32]>(); - | ^ ---- required by a bound introduced by this call - | | - | the trait `CastTo<[i32]>` is not implemented for `dyn Foo` + | ^^^^ the trait `CastTo<[i32]>` is not implemented for `dyn Foo` | note: required by a bound in `Cast::cast` --> $DIR/issue-71659.rs:19:15 diff --git a/src/test/ui/use/use-after-move-self-based-on-type.stderr b/src/test/ui/use/use-after-move-self-based-on-type.stderr index 7fdc4ab251f..1bdf49801f9 100644 --- a/src/test/ui/use/use-after-move-self-based-on-type.stderr +++ b/src/test/ui/use/use-after-move-self-based-on-type.stderr @@ -8,7 +8,7 @@ LL | self.bar(); LL | return self.x; | ^^^^^^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `self` +note: `S::bar` takes ownership of the receiver `self`, which moves `self` --> $DIR/use-after-move-self-based-on-type.rs:15:16 | LL | pub fn bar(self) {} diff --git a/src/test/ui/use/use-after-move-self.stderr b/src/test/ui/use/use-after-move-self.stderr index 073deee63b9..59cc22eadb0 100644 --- a/src/test/ui/use/use-after-move-self.stderr +++ b/src/test/ui/use/use-after-move-self.stderr @@ -8,7 +8,7 @@ LL | self.bar(); LL | return *self.x; | ^^^^^^^ value used here after move | -note: this function takes ownership of the receiver `self`, which moves `self` +note: `S::bar` takes ownership of the receiver `self`, which moves `self` --> $DIR/use-after-move-self.rs:13:16 | LL | pub fn bar(self) {} diff --git a/src/test/ui/walk-struct-literal-with.stderr b/src/test/ui/walk-struct-literal-with.stderr index 4384e345e85..2b85fa9bed4 100644 --- a/src/test/ui/walk-struct-literal-with.stderr +++ b/src/test/ui/walk-struct-literal-with.stderr @@ -8,7 +8,7 @@ LL | let end = Mine{other_val:1, ..start.make_string_bar()}; LL | println!("{}", start.test); | ^^^^^^^^^^ value borrowed here after move | -note: this function takes ownership of the receiver `self`, which moves `start` +note: `Mine::make_string_bar` takes ownership of the receiver `self`, which moves `start` --> $DIR/walk-struct-literal-with.rs:7:28 | LL | fn make_string_bar(mut self) -> Mine{ diff --git a/src/test/ui/wf/hir-wf-canonicalized.rs b/src/test/ui/wf/hir-wf-canonicalized.rs new file mode 100644 index 00000000000..bdb84409d00 --- /dev/null +++ b/src/test/ui/wf/hir-wf-canonicalized.rs @@ -0,0 +1,18 @@ +// incremental + +trait Foo { + type V; +} + +trait Callback<T: Foo>: Fn(&Bar<'_, T>, &T::V) {} + +struct Bar<'a, T> { + callback: Box<dyn Callback<dyn Callback<Bar<'a, T>>>>, + //~^ ERROR the trait bound `Bar<'a, T>: Foo` is not satisfied + //~| ERROR the trait bound `(dyn Callback<Bar<'a, T>, for<'b, 'c, 'd> Output = ()> + 'static): Foo` is not satisfied + //~| ERROR the size for values of type `(dyn Callback<Bar<'a, T>, for<'b, 'c, 'd> Output = ()> + 'static)` cannot be known at compilation time +} + +impl<T: Foo> Bar<'_, Bar<'_, T>> {} + +fn main() {} diff --git a/src/test/ui/wf/hir-wf-canonicalized.stderr b/src/test/ui/wf/hir-wf-canonicalized.stderr new file mode 100644 index 00000000000..9fd0f9c81eb --- /dev/null +++ b/src/test/ui/wf/hir-wf-canonicalized.stderr @@ -0,0 +1,32 @@ +error[E0277]: the trait bound `Bar<'a, T>: Foo` is not satisfied + --> $DIR/hir-wf-canonicalized.rs:10:15 + | +LL | callback: Box<dyn Callback<dyn Callback<Bar<'a, T>>>>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `Bar<'a, T>` + +error[E0277]: the trait bound `(dyn Callback<Bar<'a, T>, for<'b, 'c, 'd> Output = ()> + 'static): Foo` is not satisfied + --> $DIR/hir-wf-canonicalized.rs:10:15 + | +LL | callback: Box<dyn Callback<dyn Callback<Bar<'a, T>>>>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `(dyn Callback<Bar<'a, T>, for<'b, 'c, 'd> Output = ()> + 'static)` + +error[E0277]: the size for values of type `(dyn Callback<Bar<'a, T>, for<'b, 'c, 'd> Output = ()> + 'static)` cannot be known at compilation time + --> $DIR/hir-wf-canonicalized.rs:10:15 + | +LL | callback: Box<dyn Callback<dyn Callback<Bar<'a, T>>>>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn Callback<Bar<'a, T>, for<'b, 'c, 'd> Output = ()> + 'static)` +note: required by a bound in `Bar` + --> $DIR/hir-wf-canonicalized.rs:9:16 + | +LL | struct Bar<'a, T> { + | ^ required by this bound in `Bar` +help: consider relaxing the implicit `Sized` restriction + | +LL | struct Bar<'a, T: ?Sized> { + | ++++++++ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/wf/hir-wf-check-erase-regions.stderr b/src/test/ui/wf/hir-wf-check-erase-regions.stderr index b04588c5716..7bc19dd2e21 100644 --- a/src/test/ui/wf/hir-wf-check-erase-regions.stderr +++ b/src/test/ui/wf/hir-wf-check-erase-regions.stderr @@ -9,9 +9,6 @@ LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; = note: required for `&T` to implement `IntoIterator` note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL - | -LL | pub struct Flatten<I: Iterator<Item: IntoIterator>> { - | ^^^^^^^^^^^^ required by this bound in `Flatten` error[E0277]: `&T` is not an iterator --> $DIR/hir-wf-check-erase-regions.rs:10:27 @@ -24,9 +21,6 @@ LL | fn into_iter(self) -> Self::IntoIter { = note: required for `&T` to implement `IntoIterator` note: required by a bound in `Flatten` --> $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL - | -LL | pub struct Flatten<I: Iterator<Item: IntoIterator>> { - | ^^^^^^^^^^^^ required by this bound in `Flatten` error: aborting due to 2 previous errors diff --git a/src/test/ui/wf/wf-impl-self-type.stderr b/src/test/ui/wf/wf-impl-self-type.stderr index 371321793ad..1ca368729fe 100644 --- a/src/test/ui/wf/wf-impl-self-type.stderr +++ b/src/test/ui/wf/wf-impl-self-type.stderr @@ -7,9 +7,6 @@ LL | impl Foo for Option<[u8]> {} = help: the trait `Sized` is not implemented for `[u8]` note: required by a bound in `Option` --> $SRC_DIR/core/src/option.rs:LL:COL - | -LL | pub enum Option<T> { - | ^ required by this bound in `Option` error: aborting due to previous error diff --git a/src/test/ui/wrong-mul-method-signature.stderr b/src/test/ui/wrong-mul-method-signature.stderr index 9f8896f01ee..8338f61b22a 100644 --- a/src/test/ui/wrong-mul-method-signature.stderr +++ b/src/test/ui/wrong-mul-method-signature.stderr @@ -38,7 +38,9 @@ error[E0308]: mismatched types --> $DIR/wrong-mul-method-signature.rs:63:45 | LL | let x: Vec2 = Vec2 { x: 1.0, y: 2.0 } * 2.0; // trait had reversed order - | ^^^ expected struct `Vec2`, found floating-point number + | ----------------------- ^^^ expected struct `Vec2`, found floating-point number + | | + | expected because this is `Vec2` error[E0308]: mismatched types --> $DIR/wrong-mul-method-signature.rs:63:19 |
